2 lines
792 KiB
JavaScript
2 lines
792 KiB
JavaScript
System.register([],(function(e,t){"use strict";return{execute:function(){e({$:void 0,B:Ni,D:Ci,F:function(e,t,i){return(i-e)/(t-e)},G:Mi,H:function(e,t){return Math.abs(e)>Math.abs(t)?e:t},I:function(e,t){t.forEach((function(t){Object.defineProperty(e,t,{enumerable:!0})}))},W:void 0,X:void 0,Y:void 0,Z:void 0,_:void 0,a0:void 0,a1:void 0,a2:void 0,a3:void 0,a4:void 0,a5:void 0,a6:void 0,a7:void 0,a8:void 0,a9:void 0,aA:void 0,aB:void 0,aa:void 0,ab:void 0,ac:void 0,ad:void 0,ae:void 0,af:void 0,ag:void 0,ah:void 0,ai:void 0,aj:void 0,ak:void 0,al:void 0,am:void 0,an:void 0,ao:void 0,ap:void 0,aq:void 0,ar:void 0,as:void 0,at:void 0,au:void 0,av:void 0,aw:void 0,ax:void 0,ay:void 0,az:void 0,bC:ms,bD:gs,bE:vs,bF:Es,bG:Ts,bH:As,bI:Ss,bw:void 0,c:Ui,c$:void 0,c0:void 0,c1:void 0,cB:void 0,cQ:SN,cR:void 0,cX:void 0,ci:void 0,ck:void 0,cu:void 0,cv:void 0,cw:void 0,cx:void 0,cy:void 0,d$:Pe,d1:void 0,d5:vc,dB:void 0,dD:function(e,t,i,n,r,s){void 0===t&&(t=gn.R32F),void 0===i&&(i=0),void 0===n&&(n=e.byteLength-i),void 0===r&&(r=0),void 0===s&&(s=[]);var a=ls[t];r||(r=a.size);for(var o="get"+gF(a),u=a.size/a.count,h=Math.floor(n/r),c=ka.isLittleEndian,l=0;l<h;++l)for(var _=i+r*l,f=0;f<a.count;++f){var d=_+u*f;s[a.count*l+f]=e[o](d,c)}return s},dE:function(){},dH:B,dI:o,dJ:r,dK:function(){},dQ:Y,dR:A,dS:T,dT:v,dU:xs,dX:function(e,t,i,n,r){void 0===i&&(i=gn.R32F),void 0===n&&(n=0),void 0===r&&(r=0);var s=ls[i];r||(r=s.size);for(var a="set"+gF(s),o=s.size/s.count,u=Math.floor(t.length/s.count),h=ka.isLittleEndian,c=0;c<u;++c)for(var l=n+r*c,_=0;_<s.count;++_){var f=l+o*_;e[a](f,t[s.count*c+_],h)}},dY:ZR,dZ:vF,d_:K,db:c,dc:void 0,dd:uc,de:Ac,dg:$,dk:Hg,dn:function(e){Pg=e},dq:rc,ds:Tc,dt:Ec,du:_,dv:qp,dw:E,dx:ay,dz:void 0,e:an,e$:We,e0:ht,e4:Dh,e5:je,e7:J,eE:om,eF:um,eG:void 0,eH:mm,eM:l,eS:dt,eW:void 0,eX:void 0,eZ:void 0,e_:Pt,ea:void 0,ei:gt,es:z,f0:void 0,f1:j,f3:void 0,f5:void 0,f6:void 0,f9:sh,fA:Jf,fB:ku,fD:function(e){return"function"==typeof e.lerp},fE:void 0,fF:void 0,fG:void 0,fH:void 0,fJ:Ee,fK:Ta,fN:void 0,fO:void 0,fP:ge,fQ:L,fR:U,fS:G,fT:H,fV:gc,fW:yc,fX:Sc,fY:bc,fZ:wc,f_:Rc,fa:ch,fk:void 0,fm:void 0,fn:ot,ft:g,fu:ve,fv:r_,fw:function(e,t){t>=0&&e.length,e.length},fx:ye,g:Pi,g0:nt,g1:li,g5:function(){var e=new mf;return e.assignSorted([[0,{interpolationMode:Hu.CUBIC,value:1}],[1,{interpolationMode:Hu.CUBIC,value:1}]]),e},g6:n,gB:void 0,gG:fe,gH:Pf,gI:ft,gN:function(e){e>0&&(ue=e)},gO:function(e){for(var t,i=E(e);!(t=i()).done;)de(t.value)},gP:function(e){return le||(le="undefined"==typeof Proxy?{}:new Proxy(e,{get:function(e,t,i){return de(t),Reflect.get(e,t,i)}})),le},gQ:cN,gR:lN,gU:kl,gW:function(e){return e[uh]},gb:Dt,gc:Lt,ge:m,gl:fa,gm:void 0,gp:_a,gu:Ct,gw:void 0,h:function(e,t){return Math.abs(e-t)<=gi*Math.max(1,Math.abs(e),Math.abs(t))},h8:ee,h9:te,hA:void 0,hM:void 0,hU:GD,ha:void 0,hd:oD,i:vi,j:yi,k:Ei,l:Ti,m:$i,n:Si,p:wi,q:qi,r:ln,s:hn,t:Ai,u:function(e,t){return Math.floor(wi(e,t))},v:rn,w:Ri,x:Ii,y:function(e,t,i){return Math.floor(Ii(e,t,i))},z:Oi});var i=e("g8",2147483647);function n(e){return(e>0)-(e<0)}function r(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 s(e){return 16843009*((e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135)>>>24}function a(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 o(e){return--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,1+(e|=e>>>16)}var u=new Array(256);function h(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,i){return t&&h(e.prototype,t),i&&h(e,i),e}function l(){return(l=e("eM",Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e})).apply(this,arguments)}function _(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,d(e,t)}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function m(t,i,n){return(m=p()?e("ge",Reflect.construct):e("ge",(function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&d(r,i.prototype),r}))).apply(null,arguments)}function g(t){var i="function"==typeof Map?new Map:void 0;return(g=e("ft",(function(e){if(null===e||(t=e,-1===Function.toString.call(t).indexOf("[native code]")))return e;var t;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(e))return i.get(e);i.set(e,n)}function n(){return m(e,arguments,f(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,e)})))(t)}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function E(e,t){var i;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return y(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?y(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0;return function(){return n>=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 T(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})}function A(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 S(e,t){const i="undefined"==typeof window?global:window;return void 0===i[e]?i[e]=t:i[e]}!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<<r&255}}(u),e("b",Object.freeze({__proto__:null,INT_BITS:32,INT_MAX:i,INT_MIN:-2147483648,sign:n,abs:function(e){var t=e>>31;return(e^t)-t},min:function(e,t){return t^(e^t)&-(e<t)},max:function(e,t){return e^(e^t)&-(e<t)},isPow2:function(e){return!(e&e-1||!e)},log2:r,log10:function(e){return 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:s,countTrailingZeros:a,nextPow2:o,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 u[255&e]<<24|u[e>>>8&255]<<16|u[e>>>16&255]<<8|u[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>>>a(e)+1}})),e("g2",!1),S("CC_WECHAT",!1),S("CC_BAIDU",!1),S("CC_XIAOMI",!1),S("CC_ALIPAY",!1),S("CC_BYTEDANCE",!1),S("CC_OPPO",!1),S("CC_VIVO",!1),S("CC_HUAWEI",!1),S("CC_COCOSPLAY",!1),S("CC_QTT",!1),S("CC_LINKSURE",!1);const b=e("g3",!1);S("CC_EDITOR",!1),S("CC_PREVIEW",!1),S("CC_BUILD",!0),S("CC_TEST",!1),S("CC_DEBUG",!1),S("CC_DEV",!1),e("gx",!1),S("CC_MINIGAME",!1),e("gz",!1),S("CC_RUNTIME_BASED",!1),S("CC_SUPPORT_JIT",!0),e("gy",!1),S("CC_JSB",!1);var w="undefined"==typeof window?global:window,R=e("cY",{_global:w});R.internal={};var I=e("gq","3.6.0");w.CocosEngine=R.ENGINE_VERSION=I,w.cc=R;var O="https://github.com/cocos-creator/engine/blob/develop/EngineErrorMap.md",N=null,C=console.log.bind(console),M=C,x=C,F=function(e,t){if(!e){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];console.log("ASSERT: "+D.apply(void 0,[t].concat(n)))}},P=C;function D(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return R.js.formatStr.apply(null,[e].concat(i))}function L(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return C.apply(void 0,[e].concat(i))}function B(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return M.apply(void 0,[e].concat(i))}function U(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return x.apply(void 0,[e].concat(i))}function G(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];return F.apply(void 0,[e,t].concat(n))}function z(){return P.apply(void 0,arguments)}function k(e){if(C=M=x=F=P=function(){},e!==Q.NONE){if(e>Q.ERROR){var t=function(e){if(R.game.canvas){if(!N){var t=document.createElement("Div");t.setAttribute("id","logInfoDiv"),t.setAttribute("width","200"),t.setAttribute("height",R.game.canvas.height);var i=t.style;i.zIndex="99999",i.position="absolute",i.top=i.left="0",(N=document.createElement("textarea")).setAttribute("rows","20"),N.setAttribute("cols","30"),N.setAttribute("disabled","true");var n=N.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(N),R.game.canvas.parentNode.appendChild(t)}N.value=N.value+e+"\r\n",N.scrollTop=N.scrollHeight}};x=function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];t("ERROR : "+D.apply(void 0,[e].concat(n)))},F=function(e,i){if(!e){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];t("ASSERT: "+D.apply(void 0,[i].concat(r)))}},e!==Q.ERROR_FOR_WEB_PAGE&&(M=function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];t("WARN : "+D.apply(void 0,[e].concat(n)))}),e===Q.INFO_FOR_WEB_PAGE&&(C=function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];t(D.apply(void 0,[e].concat(n)))})}else console&&(console.error||(console.error=console.log),console.warn||(console.warn=console.log),x=console.error.bind?console.error.bind(console):function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return console.error.apply(console,[e].concat(i))},F=function(e,t){if(!e){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];var s=D.apply(void 0,[t].concat(n));throw new Error(s)}});if(e!==Q.ERROR&&(M=console.warn.bind?console.warn.bind(console):function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return console.warn.apply(console,[e].concat(i))}),e<=Q.INFO&&(C=console.log.bind?console.log.bind(console):function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return console.log.apply(console,[e].concat(i))}),e<=Q.VERBOSE&&"function"==typeof console.debug){var i=console.debug.bind(console);P=function(){return i.apply(void 0,arguments)}}}}function H(e){U(e.stack||e)}function V(e){return function(t){for(var i=e+" "+t+", please go to "+O+"#"+t+" to see details.",n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return 0===r.length?i:i+" Arguments: "+r.join(", ")}}var W=V("Log");function j(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];L(W.apply(void 0,[e].concat(i)))}var X=V("Warning");function Y(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];B(X.apply(void 0,[e].concat(i)))}var q=V("Error");function K(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];U(q.apply(void 0,[e].concat(i)))}var Q,Z=V("Assert");function J(e,t){if(!e){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];G(!1,Z.apply(void 0,[t].concat(n)))}}function $(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return q.apply(void 0,[e].concat(i))}function ee(){return!!R.profiler&&R.profiler.isShowingStats()}function te(e){R.profiler&&(e?R.profiler.showStats():R.profiler.hideStats())}!function(e){e[e.NONE=0]="NONE",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.INFO_FOR_WEB_PAGE=5]="INFO_FOR_WEB_PAGE",e[e.WARN_FOR_WEB_PAGE=6]="WARN_FOR_WEB_PAGE",e[e.ERROR_FOR_WEB_PAGE=7]="ERROR_FOR_WEB_PAGE"}(Q||(Q=e("ha",{}))),e("fU",Object.freeze({__proto__:null,log:L,warn:B,error:U,assert:G,debug:z,_resetDebugSetting:k,_throw:H,logID:j,warnID:Y,errorID:K,assertID:J,get DebugMode(){return Q},getError:$,isDisplayStats:ee,setDisplayStats:te}));var ie,ne,re,se,ae,oe,ue=10,he=0,ce=new Map;se=function(e,t,i,n,r,s,a){var o=ce.get(s);o&&o.logTimes>o.count&&(r("'%s' is deprecated, please use '%s' instead. "+a,e+"."+t,i+"."+n),o.count++)},ie=e("cX",(function(e,t,i){null!=e&&i.forEach((function(i){var n=he++;ce.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ue});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 se(t,i.name,a,s,B,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 se(t,i.name,a,s,B,n,u),i.customGetter.call(this)},set:function(e){se(t,i.name,a,s,B,n,u),i.customSetter.call(this,e)},enumerable:!1}):h?Object.defineProperty(e,i.name,{set:function(e){se(t,i.name,a,s,B,n,u),i.customSetter.call(this,e)},enumerable:!1}):c&&Object.defineProperty(e,i.name,{get:function(){return se(t,i.name,a,s,B,n,u),i.customGetter.call(this)},enumerable:!1})}else Object.defineProperty(e,i.name,{get:function(){return se(t,i.name,a,s,B,n,u),o?this[s]:r[s]},set:function(e){se(t,i.name,a,s,B,n,u),o?this[s]=e:r[s]=e},enumerable:!1})}))})),oe=function(e,t,i,n,r){var s=ce.get(n);s&&s.logTimes>s.count&&(i("'%s' has been removed. "+r,e+"."+t),s.count++)},ne=e("c$",(function(e,t,i){null!=e&&i.forEach((function(i){var n=he++;ce.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ue});var r=i.suggest?"("+i.suggest+")":"";Object.defineProperty(e,i.name,{get:function(){return oe(t,i.name,U,n,r)},set:function(){oe(t,i.name,U,n,r)},enumerable:!1})}))})),ae=function(e,t,i,n,r){var s=ce.get(n);s&&s.logTimes>s.count&&(i("'%s' is deprecated. "+r,e+"."+t),s.count++)},re=e("d1",(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=he++;ce.set(s,{id:s,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ue});var a=i.suggest?"("+i.suggest+")":"";if(void 0!==r.value)if("function"==typeof r.value){var o=r.value;e[n]=function(){return ae(t,n,B,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 ae(t,n,B,s,a),u}}),r.writable&&Object.defineProperty(e,n,{set:function(e){ae(t,n,B,s,a),u=e}})}else!function(t,i,n,r,s,a){if(t.get){var o=t.get;t.get=function(){return ae(i,n,r,s,a),o.call(this)}}if(t.set){var u=t.set;t.set=function(e){ae(i,n,r,s,a),u.call(this,e)}}Object.defineProperty(e,n,t)}(r,t,n,B,s,a);Object.defineProperty(e,n,{enumerable:!1})}}))}));var le,_e={};function fe(e){for(var t in e){var i=e[t];_e[t]=i}}function de(e){var t=_e[e];if(t){var i=t.newName,n=t.since;t.removed?i?K(16003,e,n,i):K(16002,e,n):i?Y(16001,e,n,i):Y(16e3,e,n)}}var pe=e("fI",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)},c(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 me(e,t){e.splice(t,1)}function ge(e,t){var i=e.length;t<0||t>=i||(e[t]=e[i-1],e.length=i-1)}function ve(e,t){var i=e.indexOf(t);return i>=0&&(me(e,i),!0)}function ye(e,t){var i=e.findIndex(t);if(i>=0){var n=e[i];return me(e,i),n}}function Ee(e,t){return e.indexOf(t)>=0}var Te=Object.freeze({__proto__:null,removeAt:me,fastRemoveAt:ge,remove:ve,fastRemove:function(e,t){var i=e.indexOf(t);i>=0&&(e[i]=e[e.length-1],--e.length)},removeIf:ye,verifyType:function(e,t){if(e&&e.length>0)for(var i,n=E(e);!(i=n()).done;)if(!(i.value instanceof t))return j(1300),!1;return!0},removeArray:function(e,t){for(var i=0,n=t.length;i<n;i++)ve(e,t[i])},appendObjectsAt:function(e,t,i){return e.splice.apply(e,[i,0].concat(t)),e},contains:Ee,copy:function(e){for(var t=e.length,i=new Array(t),n=0;n<t;n+=1)i[n]=e[n];return i},MutableForwardIterator:pe}),Ae=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},e}();Ae.global=new Ae("global");var Se=new Ae("TmpCId."),be="undefined"==typeof Symbol?"__aliases__":Symbol("[[Aliases]]"),we="__cid__";function Re(e){return"number"==typeof e||e instanceof Number}function Ie(e){return"string"==typeof e||e instanceof String}function Oe(e){for(var t in e)return!1;return!0}var Ne,Ce=(Ne={value:void 0,enumerable:!1,writable:!1,configurable:!0},function(e,t,i,n,r){Ne.value=i,Ne.writable=n,Ne.enumerable=r,Object.defineProperty(e,t,Ne),Ne.value=void 0}),Me=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&&(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}}(),xe=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}}(),Fe=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 Pe(e){var t=Object.create(null);return e&&(t["."]=1,t["/"]=1,delete t["."],delete t["/"]),t}function De(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?De(e.constructor):""}function Le(e,t,i,n){var r=/([^.]+)$/,s=r.exec(t)[0],a=r.exec(i)[0];function o(){return this[a]}n?Me(e,s,o,(function(e){this[a]=e})):xe(e,s,o)}function Be(e,t,i,n){for(var r in i)Le(e,t+"."+r,i[r],n)}var Ue=/(%d)|(%s)/,Ge=/%s/;function ze(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];if(0===arguments.length)return"";if(0===i.length)return""+e;var r="string"==typeof e&&Ue.test(e);if(r)for(var s,a=E(i);!(s=a()).done;){var o=s.value,u="number"==typeof o?Ue:Ge;if(u.test(e)){var h=""+o;e=e.replace(u,h)}else e+=" "+o}else for(var c,l=E(i);!(c=l()).done;){var _=c.value;e+=" "+_}return e}function ke(){for(var e=arguments.length-1,t=new Array(e),i=0;i<e;++i)t[i]=arguments[i+1];return t}function He(e,t){for(;e;){var i=Object.getOwnPropertyDescriptor(e,t);if(i)return i;e=Object.getPrototypeOf(e)}return null}function Ve(e,t,i){var n=He(t,e);n&&Object.defineProperty(i,e,n)}function We(e){e=e||{};for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];for(var r=0,s=i;r<s.length;r++){var a=s[r];if(a){if("object"!=typeof a){K(5402,a);continue}for(var o in a)o in e||Ve(o,a,e)}}return e}function je(e){e=e||{};for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];for(var r=0,s=i;r<s.length;r++){var a=s[r];if(a){if("object"!=typeof a){K(5403,a);continue}for(var o in a)Ve(o,a,e)}}return e}function Xe(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e.prototype=Object.create(t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),e}function Ye(e){var t=e.prototype,i=t&&Object.getPrototypeOf(t);return i&&i.constructor}function qe(e,t){if(e&&t){if("function"!=typeof e)return!1;if("function"!=typeof t)return!1;if(e===t)return!0;for(;;){if(!(e=Ye(e)))return!1;if(e===t)return!0}}return!1}function Ke(e){for(var t=0,i=Object.keys(e);t<i.length;t++)delete e[i[t]]}function Qe(e){return"string"!=typeof e||e.startsWith(Se.prefix)}var Ze=Pe(!0),Je=Pe(!0);function $e(e,t,i){return function(n,r){if(r.prototype.hasOwnProperty(e)&&delete t[r.prototype[e]],Ce(r.prototype,e,n),n){var s=t[n];!i&&s&&s!==r?U("A Class already exists with the same "+e+' : "'+n+'".'):t[n]=r}}}var et=$e("__cid__",Ze,!1),tt=$e("__classname__",Je,!0);function it(e,t){if(tt(e,t),!t.prototype.hasOwnProperty(we)){var i=e||Se.getNewId();i&&et(i,t)}}function nt(e,t){var i=Je[t],n=Ze[t],r=!0;if(i&&i!==e&&(U('"'+t+'" has already been set as name or alias of another class.'),r=!1),n&&n!==e&&(U('"'+t+'" has already been set as id or alias of another class.'),r=!1),r){var s=e[be];s||(s=[],e[be]=s),s.push(t),Je[t]=e,Ze[t]=e}}function rt(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];for(var n=0,r=t;n<r.length;n++){var s=r[n],a=s.prototype,o=a.__cid__;o&&delete Ze[o];var u=a.__classname__;u&&delete Je[u];var h=a[be];if(h)for(var c=0;c<h.length;++c){var l=h[c];delete Je[l],delete Ze[l]}}}function st(e){return at(e)}function at(e){return Ze[e]}function ot(e){return Je[e]}function ut(e,t){return ht(e,t)}function ht(e,t){var i;if(t=void 0===t||t,"function"==typeof e&&e.prototype.hasOwnProperty(we))return i=e.prototype.__cid__,!t&&b&&Qe(i)?"":i;if(e&&e.constructor){var n=e.constructor.prototype;if(n&&n.hasOwnProperty(we))return i=e.__cid__,!t&&b&&Qe(i)?"":i}return""}var ct=e("e6",function(){var e=t.prototype;function t(e,t){this.count=void 0,this._pool=void 0,this._cleanup=void 0;var i=void 0===t?e:t,n=void 0===t?null:e;this.count=0,this._pool=new Array(i),this._cleanup=n}return e.get=function(){return this._get()},e._get=function(){if(this.count>0){--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<t.length){if(this._cleanup&&!1===this._cleanup(e))return;t[this.count]=e,++this.count}},e.resize=function(e){e>=0&&(this._pool.length=e,this.count>e&&(this.count=e))},t}()),lt=e("fy",Te),_t=e("dC",{IDGenerator:Ae,Pool:ct,array:Te,isNumber:Re,isString:Ie,isEmptyObject:Oe,getPropertyDescriptor:He,addon:We,mixin:je,extend:Xe,getSuper:Ye,isChildClassOf:qe,clear:Ke,value:Ce,getset:Me,get:xe,set:Fe,unregisterClass:rt,getClassName:De,setClassName:it,setClassAlias:nt,getClassByName:ot,getClassById:at,get _registeredClassNames(){return l({},Je)},set _registeredClassNames(e){Ke(Je),Object.assign(Je,e)},get _registeredClassIds(){return l({},Ze)},set _registeredClassIds(e){Ke(Ze),Object.assign(Ze,e)},_getClassId:ut,getClassId:ht,_setClassId:et,_getClassById:st,obsolete:Le,obsoletes:Be,formatStr:ze,shiftArguments:ke,createMap:Pe});function ft(e){if("__bitmask__"in e)return e;Ce(e,"__bitmask__",null,!0);for(var t=-1,i=Object.keys(e),n=0;n<i.length;n++){var r=i[n],s=e[r];if(-1===s)s=++t,e[r]=s;else if("number"==typeof s)t=s;else if("string"==typeof s&&Number.isInteger(parseFloat(r)))continue;var a=""+s;r!==a&&Ce(e,a,r)}return e}function dt(e){return"__enums__"in e?e:(Ce(e,"__enums__",null,!0),dt.update(e))}function pt(e){e.hasOwnProperty("__enums__")}function mt(e){pt(e);var t=e.__enums__||[];for(var i in t.length=0,e){var n=e[i];Number.isInteger(n)&&t.push({name:i,value:n})}return t.sort((function(e,t){return e.value-t.value})),e.__enums__=t,t}function gt(e){"__enums__"in e||Ce(e,"__enums__",null,!0)}R.js=_t,e("gJ",Object.freeze({__proto__:null,array:lt,js:_t,IDGenerator:Ae,Pool:ct,isNumber:Re,isString:Ie,isEmptyObject:Oe,value:Ce,getset:Me,get:xe,set:Fe,createMap:Pe,getClassName:De,obsolete:Le,obsoletes:Be,formatStr:ze,shiftArguments:ke,getPropertyDescriptor:He,copyAllProperties:function(e,t,i){for(var n=Object.getOwnPropertyNames(e),r=0,s=n.length;r<s;++r){var a=n[r];-1===i.indexOf(a)&&Ve(a,e,t)}},addon:We,mixin:je,extend:Xe,getSuper:Ye,isChildClassOf:qe,clear:Ke,_idToClass:Ze,_nameToClass:Je,_setClassId:et,setClassName:it,setClassAlias:nt,unregisterClass:rt,_getClassById:st,getClassById:at,getClassByName:ot,_getClassId:ut,getClassId:ht})),ft.isBitMask=function(e){return e&&e.hasOwnProperty("__bitmask__")},ft.getList=function(e){if(e.__bitmask__)return e.__bitmask__;var t=e.__bitmask__=[];for(var i in e){var n=e[i];Number.isInteger(n)&&t.push({name:i,value:n})}return t.sort((function(e,t){return e.value-t.value})),t},R.BitMask=ft,dt.update=function(e){for(var t=-1,i=Object.keys(e),n=0;n<i.length;n++){var r=i[n],s=e[r];if(-1===s)s=++t,e[r]=s;else if("number"==typeof s)t=s;else if("string"==typeof s&&Number.isInteger(parseFloat(r)))continue;var a=""+s;r!==a&&Ce(e,a,r)}return Array.isArray(e.__enums__)&&mt(e),e},dt||(dt=e("eS",{})),dt.isEnum=function(e){return e&&e.hasOwnProperty("__enums__")},dt.getList=function(e){return pt(e),e.__enums__?e.__enums__:mt(e)},R.Enum=dt;var vt,yt=e("fC",function(){function e(){}var t=e.prototype;return t.clone=function(){return K(100,De(this)+".clone"),this},t.equals=function(){return!1},t.set=function(){K(100,De(this)+".set")},t.toString=function(){return""},e}());it("cc.ValueType",yt),R.ValueType=yt,function(e){e.PATH="path",e.ENGINE="engine",e.ASSETS="assets",e.SCRIPTING="scripting",e.PHYSICS="physics",e.RENDERING="rendering",e.LAUNCH="launch",e.SCREEN="screen",e.SPLASH_SCREEN="splashScreen",e.ANIMATION="animation",e.PROFILING="profiling",e.PLUGINS="plugins"}(vt||(vt={}));var Et=e("gg",function(){function e(){this._settings={},this._override={}}var t=e.prototype;return t.init=function(e,t){var i=this;for(var n in void 0===e&&(e=""),void 0===t&&(t={}),t){var r=t[n];if(r)for(var s in r)this.overrideSettings(n,s,r[s])}return e?new Promise((function(t,n){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="text",r.onload=function(){i._settings=JSON.parse(r.response),t()},r.onerror=function(){n(new Error("request settings failed!"))},r.send(null)})):Promise.resolve()},t.overrideSettings=function(e,t,i){e in this._override||(this._override[e]={}),this._override[e][t]=i},t.querySettings=function(e,t){if(e in this._override){var i=this._override[e];if(i&&t in i)return i[t]}if(e in this._settings){var n=this._settings[e];if(n&&t in n)return n[t]}return null},e}());Et.Category=vt;var Tt=e("gf",new Et);R.settings=Tt;var At=e("dh",{SUPPORT_TEXTURE_FORMATS:[".astc",".pkm",".pvr",".webp",".jpg",".jpeg",".bmp",".png"],KEY:{none:0,back:6,menu:18,backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,pause:19,capslock:20,escape:27,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,select:41,insert:45,Delete:46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,num0:96,num1:97,num2:98,num3:99,num4:100,num5:101,num6:102,num7:103,num8:104,num9:105,"*":106,"+":107,"-":109,numdel:110,"/":111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,numlock:144,scrolllock:145,";":186,semicolon:186,equal:187,"=":187,",":188,comma:188,dash:189,".":190,period:190,forwardslash:191,grave:192,"[":219,openbracket:219,backslash:220,"]":221,closebracket:221,quote:222,dpadLeft:1e3,dpadRight:1001,dpadUp:1003,dpadDown:1004,dpadCenter:1005},RAD:Math.PI/180,DEG:180/Math.PI,REPEAT_FOREVER:Number.MAX_VALUE-1,FLT_EPSILON:1.192092896e-7,ORIENTATION_PORTRAIT:1,ORIENTATION_LANDSCAPE:2,ORIENTATION_AUTO:3,ENABLE_TILEDMAP_CULLING:!0,TOUCH_TIMEOUT:5e3,ENABLE_TRANSPARENT_CANVAS:!1,ENABLE_WEBGL_ANTIALIAS:!0,ENABLE_ANTIALIAS_FXAA:!1,ENABLE_BLOOM:!1,CLEANUP_IMAGE_CACHE:!1,ENABLE_MULTI_TOUCH:!0,MAX_LABEL_CANVAS_POOL_SIZE:20,ENABLE_WEBGL_HIGHP_STRUCT_VALUES:!1,BATCHER2D_MEM_INCREMENT:144,CUSTOM_PIPELINE_NAME:"",init:function(){var e=Tt.querySettings(Et.Category.ENGINE,"macros");if(e)for(var t in e)At[t]=e[t]}});R.macro=At;for(var St=/^(?:cc|dragonBones|sp|ccsg)\..+/,bt=new Array(123),wt=0;wt<123;++wt)bt[wt]=64;for(var Rt=0;Rt<64;++Rt)bt["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(Rt)]=Rt;var It=bt;function Ot(e,t,i){function n(e,t,i,n){var r=Object.getOwnPropertyDescriptor(e,t);if(r)r.get&&(e[i]=r.get),r.set&&n&&(e[n]=r.set);else{var s=e[i];Me(e,t,s,e[n])}}for(var r,s=e.prototype,a=0;a<t.length;a++){var o=(r=t[a])[0].toUpperCase()+r.slice(1);n(s,r,"get"+o,"set"+o)}for(r in i){var u=i[r];n(s,r,u[0],u[1])}}function Nt(e,t,i,n){var r=e[t];r?Array.isArray(r)?n?(r.push(r[0]),r[0]=i):r.push(i):e[t]=n?[i,r]:[r,i]:e[t]=i}function Ct(e,t){if("function"==typeof e.contains)return e.contains(t);if("function"==typeof e.compareDocumentPosition)return!!(16&e.compareDocumentPosition(t));var i=t.parentNode;if(i)do{if(i===e)return!0;i=i.parentNode}while(null!==i);return!1}function Mt(e){return"object"==typeof window&&"function"==typeof Node?e instanceof Node:!!e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName}function xt(e,t,i){e&&setTimeout((function(){e(t,i)}),0)}function Ft(e){return!(!e||e.constructor!==Object)&&Oe(e)}function Pt(e,t,i){if(t>i){var n=t;t=i,i=n}return e<t?t:e<i?e:i}function Dt(e){return e*At.RAD}function Lt(e){return e*At.DEG}R.misc={BUILTIN_CLASSID_RE:St,BASE64_VALUES:It,propertyDefine:Ot,pushToMap:Nt,contains:Ct,isDomNode:Mt,callInNextTick:xt,isPlainEmptyObj_DEV:Ft,clampf:Pt,degreesToRadians:Dt,radiansToDegrees:Lt},e("gK",Object.freeze({__proto__:null,BUILTIN_CLASSID_RE:St,BASE64_VALUES:It,propertyDefine:Ot,pushToMap:Nt,contains:Ct,isDomNode:Mt,callInNextTick:xt,tryCatchFunctor_EDITOR:function(e){return Function("target","try {\n target."+e+"();\n}\ncatch (e) {\n cc._throw(e);\n}")},isPlainEmptyObj_DEV:Ft,clampf:Pt,degreesToRadians:Dt,radiansToDegrees:Lt}));var Bt="$_$";function Ut(e,t){var i=t?Object.create(t):{};return Ce(e,"__attrs__",i),i}function Gt(e){if("function"!=typeof e)return Ut(e,kt(e.constructor));for(var t,i=R.Class.getInheritanceChain(e),n=i.length-1;n>=0;n--){var r=i[n];r.hasOwnProperty("__attrs__")&&r.__attrs__||Ut(r,(t=i[n+1])&&t.__attrs__)}return Ut(e,(t=i[0])&&t.__attrs__),e.__attrs__}function zt(e,t){var i=kt(e),n=t+Bt,r={};for(var s in i)s.startsWith(n)&&(r[s.slice(n.length)]=i[s]);return r}function kt(e){return e.hasOwnProperty("__attrs__")&&e.__attrs__||Gt(e)}function Ht(e,t,i,n){kt(e)[t+Bt+i]=n}var Vt=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}(),Wt=e("g9",new Vt("Integer",0));R.Integer=Wt,R.CCInteger=Wt;var jt=e("f8",new Vt("Float",0));R.Float=jt,R.CCFloat=jt;var Xt=e("fc",new Vt("Boolean",!1));R.Boolean=Xt,R.CCBoolean=Xt;var Yt=e("fb",new Vt("String",""));function qt(e,t){return function(i,n){var r='"'+De(i)+"."+n+'"',s=zt(i,n),a=s.type;if(a===Wt||a===jt?a="Number":a!==Yt&&a!==Xt||(a=""+a),a===e){if(s.hasOwnProperty("default")){var o=s.default;if(void 0!==o&&!Array.isArray(o)&&!Ft(o)){var u=typeof o,h=e.toLowerCase();if(u===h)if("object"===h){if(!o||o instanceof s.ctor)return;Y(3605,r,De(s.ctor))}else"Number"!==e&&Y(3606,t,r,e);else{if("function"===u)return;e===Yt.default&&null==o?Y(3607,r):Y(3611,t,r,u)}delete s.type}}}else Y(3604,r)}}R.String=Yt,R.CCString=Yt;var Kt=Object.freeze({__proto__:null,DELIMETER:Bt,createAttrsSingle:Ut,createAttrs:Gt,attr:zt,getClassAttrs:kt,setClassAttr:Ht,PrimitiveType:Vt,CCInteger:Wt,CCFloat:jt,CCBoolean:Xt,CCString:Yt,getTypeChecker_ET:qt,getObjTypeChecker_ET:function(e){return function(t,i){qt("Object","type")(t,i);var n=kt(t)[i+Bt+"default"],r=R.Class.getDefault(n);if(!Array.isArray(r)&&qe(e,R.ValueType)){var s=De(e),a=ze('No need to specify the "type" of "%s.%s" because %s is a child class of ValueType.',De(t),i,s);n?L(a):Y(3612,a,s,De(t),i,s)}}}}),Qt={default:{},serializable:{},editorOnly:{},formerlySerializedAs:{}};function Zt(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,Qt){var o=Qt[a];e.hasOwnProperty(a)&&(s[a]=e[a],o.canUsedInGet||delete e[a])}}}function Jt(e,t,i,n){if(Array.isArray(t)){if(!(t.length>0))return K(5508,i,n);e.type=t=t[0]}"function"==typeof t&&(t===String?e.type=R.String:t===Boolean?e.type=R.Boolean:t===Number&&(e.type=R.Float))}function $t(e,t,i){var n=e?{_short:!0}:{_short:!0,default:t};return i&&(n.type=i),n}function ei(e,t){if(!e||e.constructor!==Object){if(Array.isArray(e)&&e.length>0)return $t(t,[],e);if("function"==typeof e){var i=e;return $t(t,qe(i,R.ValueType)?new i:null,i)}return $t(t,e instanceof Vt?e.default:e)}return null}var ti,ii=[];function ni(){return ii[ii.length-1]}R._RF={push:function(e,t,i,n){void 0===i&&(i=t,t=""),ii.push({uuid:t,script:i,module:e,exports:e.exports,beh:null,importMeta:n})},pop:function(){var e=ii.pop(),t=e.module,i=t.exports;if(i===e.exports){for(var n in i)return;t.exports=i=e.cls}},peek:ni},function(e){e[e.STANDALONE=1]="STANDALONE",e[e.IMPLICIT_VISIBLE=2]="IMPLICIT_VISIBLE",e[e.IMPLICIT_SERIALIZABLE=4]="IMPLICIT_SERIALIZABLE"}(ti||(ti={}));var ri=Bt,si="__ctors__",ai="Enum",oi="BitMask";function ui(e,t,i,n){!function(e,t){!function(e,t){e.indexOf(t)<0&&e.push(t)}(e.__props__,t)}(e,i),di(e,n,t,i)}function hi(e,t,i,n){var r=n.get;n.set,r&&(di(e,n,t,i),Ht(e,i,"serializable",!1))}function ci(e){return"function"==typeof e?e():e}function li(e){var t=e.name,i=e.extends,n=function(e,t,i){var n=R.Component,r=ni();if(r&&qe(t,n)){if(qe(r.cls,n))return K(3615),null;e=e||r.script}var s=function(e,t,i){var n=i.ctor;return Ce(n,si,!0,!0),n.prototype,t&&(n.$super=t),it(e,n),n}(e,t,i);if(r)if(qe(t,n)){var a=r.uuid;a&&et(a,s),r.cls=s}else qe(r.cls,n)||(r.cls=s);return s}(t,i,e);t||(t=R.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=ei(n,!1);if(r&&(n=e[i]=r),n){var s=n.notify;s&&Zt(n,i,s,e),"type"in n&&Jt(n,n.type,t,i)}}}(i,t),i){var s=i[r];s.get||s.set?hi(e,t,r,s):ui(e,t,r,s)}var a=kt(e);e.__values__=e.__props__.filter((function(e){return!1!==a[e+ri+"serializable"]}))}(n,t,e.properties,i);var r=e.editor;return r&&qe(i,R.Component)&&R.Component._registerEditorProps(n,r),n}function _i(e){var t;return null==e||null===(t=e.hasOwnProperty)||void 0===t?void 0:t.call(e,"__values__")}li._isCCClass=function(e){var t;return null==e||null===(t=e.hasOwnProperty)||void 0===t?void 0:t.call(e,si)},li.fastDefine=function(e,t,i){it(e,t);for(var n=t.__props__=t.__values__=Object.keys(i),r=kt(t),s=0;s<n.length;s++){var a=n[s];r[a+ri+"visible"]=!1,r[a+ri+"default"]=i[a]}},li.Attr=Kt,li.attr=zt,li.isCCClassOrFastDefined=_i,li.getInheritanceChain=function(e){for(var t=[];e=Ye(e);)e!==Object&&t.push(e);return t};var fi={Integer:"Number",Float:"Number",Boolean:"Boolean",String:"String"};function di(e,t,i,n){var r=null,s="";function a(){return s=n+ri,r=kt(e)}"type"in t&&void 0===t.type&&Y(3660,n,i);var o=t.type;o&&(fi[o]?(r||a())[s+"type"]=o:"Object"===o||("object"==typeof o?dt.isEnum(o)?((r||a())[s+"type"]=ai,r[s+"enumList"]=dt.getList(o)):ft.isBitMask(o)&&((r||a())[s+"type"]=oi,r[s+"bitmaskList"]=ft.getList(o)):"function"==typeof o&&((r||a())[s+"type"]="Object",r[s+"ctor"]=o))),"default"in t&&((r||a())[s+"default"]=t.default);var u,h=function(e,i){if(e in t){var n=t[e];typeof n===i&&((r||a())[s+e]=n)}};t.editorOnly&&((r||a())[s+"editorOnly"]=!0),t.__internalFlags&ti.STANDALONE?u=!0===t.serializable||0!=(t.__internalFlags&ti.IMPLICIT_SERIALIZABLE):!1===t.serializable&&(u=!1),void 0!==u&&((r||a())[s+"serializable"]=u),h("formerlySerializedAs","string");var c=t.range;c&&Array.isArray(c)&&c.length>=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")}li.isArray=function(e){return e=ci(e),Array.isArray(e)},li.getDefault=ci,li.escapeForJS=function(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},li.IDENTIFIER_RE=/^[A-Za-z_$][0-9A-Za-z_$]*$/,li.getNewValueTypeCode=function(e){for(var t=De(e),i=e.constructor,n="new "+t+"(",r=0;r<i.__props__.length;r++)n+=e[i.__props__[r]],r<i.__props__.length-1&&(n+=",");return n+")"},R.Class=li;var pi=Math.PI/180,mi=180/Math.PI,gi=e("E",1e-6);function vi(e,t,i){return i=i||gi,Math.abs(e-t)<=i}function yi(e,t,i){if(t>i){var n=t;t=i,i=n}return e<t?t:e>i?i:e}function Ei(e){return e<0?0:e>1?1:e}function Ti(e,t,i){return e+(t-e)*i}function Ai(e){return e*pi}function Si(e){return e*mi}var bi=e("o",Math.random);function wi(e,t){return Math.random()*(t-e)+e}function Ri(e){return(e=(9301*e+49297)%233280)/233280}function Ii(e,t,i){return Ri(e)*(i-t)+t}function Oi(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e}function Ni(e,t){return e-Math.floor(e/t)*t}function Ci(e,t){return e=Ni(e,2*t),t-Math.abs(e-t)}function Mi(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}var xi=1/255,Fi=e("C",function(e){function t(t,i,n,r){var s;return(s=e.call(this)||this)._val=0,"string"==typeof t?s.fromHEX(t):void 0!==i?s.set(t,i,n,r):s.set(t),s}_(t,e),t.clone=function(e){var i=new t;return e._val?i._val=e._val:i._val=(e.a<<24>>>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.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=gi),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*xi).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){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*xi,t=this.g*xi,i=this.b*xi,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},c(t,[{key:"r",get:function(){return 255&this._val},set:function(e){e=~~yi(e,0,255),this._val=(4294967040&this._val|e)>>>0}},{key:"g",get:function(){return(65280&this._val)>>8},set:function(e){e=~~yi(e,0,255),this._val=(4294902015&this._val|e<<8)>>>0}},{key:"b",get:function(){return(16711680&this._val)>>16},set:function(e){e=~~yi(e,0,255),this._val=(4278255615&this._val|e<<16)>>>0}},{key:"a",get:function(){return(4278190080&this._val)>>>24},set:function(e){e=~~yi(e,0,255),this._val=(16777215&this._val|e<<24)>>>0}},{key:"x",get:function(){return this.r*xi},set:function(e){this.r=255*e}},{key:"y",get:function(){return this.g*xi},set:function(e){this.g=255*e}},{key:"z",get:function(){return this.b*xi},set:function(e){this.b=255*e}},{key:"w",get:function(){return this.a*xi},set:function(e){this.a=255*e}}]),t}(yt));function Pi(e,t,i,n){return new Fi(e,t,i,n)}Fi.WHITE=Object.freeze(new Fi(255,255,255,255)),Fi.GRAY=Object.freeze(new Fi(127,127,127,255)),Fi.BLACK=Object.freeze(new Fi(0,0,0,255)),Fi.TRANSPARENT=Object.freeze(new Fi(0,0,0,0)),Fi.RED=Object.freeze(new Fi(255,0,0,255)),Fi.GREEN=Object.freeze(new Fi(0,255,0,255)),Fi.BLUE=Object.freeze(new Fi(0,0,255,255)),Fi.CYAN=Object.freeze(new Fi(0,255,255,255)),Fi.MAGENTA=Object.freeze(new Fi(255,0,255,255)),Fi.YELLOW=Object.freeze(new Fi(255,255,0,255)),li.fastDefine("cc.Color",Fi,{r:0,g:0,b:0,a:255}),R.Color=Fi,R.color=Pi;var Di=e("a",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}_(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)<gi?e.x=0:e.x=1/i,Math.abs(n)<gi?e.y=0:e.y=1/n,Math.abs(r)<gi?e.z=0:e.z=1/r,e},t.normalize=function(e,t){var i=t.x,n=t.y,r=t.z,s=i*i+n*n+r*r;return s>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*bi()*Math.PI,n=2*bi()-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=gi);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(Li,e),t.normalize(Bi,i);var n=t.dot(Li,Bi);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=gi),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))},i.equals3f=function(e,t,i,n){return void 0===n&&(n=gi),Math.abs(this.x-e)<=n*Math.max(1,Math.abs(this.x),Math.abs(e))&&Math.abs(this.y-t)<=n*Math.max(1,Math.abs(this.y),Math.abs(t))&&Math.abs(this.z-i)<=n*Math.max(1,Math.abs(this.z),Math.abs(i))},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=yi(this.x,e.x,t.x),this.y=yi(this.y,e.y,t.y),this.z=yi(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}(yt));Di.UNIT_X=Object.freeze(new Di(1,0,0)),Di.UNIT_Y=Object.freeze(new Di(0,1,0)),Di.UNIT_Z=Object.freeze(new Di(0,0,1)),Di.RIGHT=Object.freeze(new Di(1,0,0)),Di.UP=Object.freeze(new Di(0,1,0)),Di.FORWARD=Object.freeze(new Di(0,0,-1)),Di.ZERO=Object.freeze(new Di(0,0,0)),Di.ONE=Object.freeze(new Di(1,1,1)),Di.NEG_ONE=Object.freeze(new Di(-1,-1,-1));var Li=new Di,Bi=new Di;function Ui(e,t,i){return new Di(e,t,i)}li.fastDefine("cc.Vec3",Di,{x:0,y:0,z:0}),R.Vec3=Di,R.v3=Ui;var Gi=e("M",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}_(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,f=h*s-a*u,d=i*l+n*_+r*f;return 0===d?(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):(d=1/d,e.m00=l*d,e.m01=(-c*n+r*h)*d,e.m02=(o*n-r*a)*d,e.m03=_*d,e.m04=(c*i-r*u)*d,e.m05=(-o*i+r*s)*d,e.m06=f*d,e.m07=(-h*i+n*u)*d,e.m08=(a*i-n*s)*d,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,f=i.m01,d=i.m02,p=i.m03,m=i.m04,g=i.m05,v=i.m06,y=i.m07,E=i.m08;return e.m00=_*n+f*a+d*h,e.m01=_*r+f*o+d*c,e.m02=_*s+f*u+d*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,f=i.m01,d=i.m02,p=i.m04,m=i.m05,g=i.m06,v=i.m08,y=i.m09,E=i.m10;return e.m00=_*n+f*a+d*h,e.m01=_*r+f*o+d*c,e.m02=_*s+f*u+d*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,f=i.y;return e.m00=n,e.m01=r,e.m02=s,e.m03=a,e.m04=o,e.m05=u,e.m06=_*n+f*a+h,e.m07=_*r+f*o+c,e.m08=_*s+f*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),f=Math.cos(i);return e.m00=f*n+_*a,e.m01=f*r+_*o,e.m02=f*s+_*u,e.m03=f*a-_*n,e.m04=f*o-_*r,e.m05=f*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 Di.lengthSqr(i)<gi*gi?(t.identity(e),e):(n=n||Di.UNIT_Y,Di.normalize(zi,Di.cross(zi,n,i)),Di.lengthSqr(zi)<gi*gi?(t.identity(e),e):(Di.cross(ki,i,zi),t.set(e,zi.x,zi.y,zi.z,ki.x,ki.y,ki.z,i.x,i.y,i.z),e))},t.fromTranslation=function(e,t){return e.m00=1,e.m01=0,e.m02=0,e.m03=0,e.m04=1,e.m05=0,e.m06=t.x,e.m07=t.y,e.m08=1,e},t.fromScaling=function(e,t){return e.m00=t.x,e.m01=0,e.m02=0,e.m03=0,e.m04=t.y,e.m05=0,e.m06=0,e.m07=0,e.m08=1,e},t.fromRotation=function(e,t){var i=Math.sin(t),n=Math.cos(t);return e.m00=n,e.m01=i,e.m02=0,e.m03=-i,e.m04=n,e.m05=0,e.m06=0,e.m07=0,e.m08=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,f=r*o,d=r*u,p=s*a,m=s*o,g=s*u;return e.m00=1-l-d,e.m03=c-g,e.m06=_+m,e.m01=c+g,e.m04=1-h-d,e.m07=f-p,e.m02=_-m,e.m05=f+p,e.m08=1-h-l,e},t.inverseTransposeMat4=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,f=t.m11,d=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,b=c*p-l*d,w=c*m-_*d,R=c*g-f*d,I=l*m-_*p,O=l*g-f*p,N=_*g-f*m,C=v*N-y*O+E*I+T*R-A*w+S*b;return C?(C=1/C,e.m00=(o*N-u*O+h*I)*C,e.m01=(u*R-a*N-h*w)*C,e.m02=(a*O-o*R+h*b)*C,e.m03=(r*O-n*N-s*I)*C,e.m04=(i*N-r*R+s*w)*C,e.m05=(n*R-i*O-s*b)*C,e.m06=(p*S-m*A+g*T)*C,e.m07=(m*E-d*S-g*y)*C,e.m08=(d*A-p*E+g*v)*C,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},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},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},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},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},t.multiplyScalarAndAdd=function(e,t,i,n){return e.m00=i.m00*n+t.m00,e.m01=i.m01*n+t.m01,e.m02=i.m02*n+t.m02,e.m03=i.m03*n+t.m03,e.m04=i.m04*n+t.m04,e.m05=i.m05*n+t.m05,e.m06=i.m06*n+t.m06,e.m07=i.m07*n+t.m07,e.m08=i.m08*n+t.m08,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},t.equals=function(e,t,i){return void 0===i&&(i=gi),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))};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=gi),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,f=e.m03,d=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=f*t+d*r+p*o,this.m04=f*i+d*s+p*u,this.m05=f*n+d*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,f=n*o,d=r*s,p=r*a,m=r*o;return this.m00=1-c-f,this.m03=h-m,this.m06=l+p,this.m01=h+m,this.m04=1-u-f,this.m07=_-d,this.m02=l-p,this.m05=_+d,this.m08=1-u-c,this},t}(yt));Gi.IDENTITY=Object.freeze(new Gi);var zi=new Di,ki=new Di;li.fastDefine("cc.Mat3",Gi,{m00:1,m01:0,m02:0,m03:0,m04:1,m05:0,m06:0,m07:0,m08:1}),R.Mat3=Gi;var Hi=e("Q",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}_(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=Di.dot(i,n);return r<-.999999?(Di.cross(ji,Di.UNIT_X,i),ji.length()<1e-6&&Di.cross(ji,Di.UNIT_Y,i),Di.normalize(ji,ji),t.fromAxisAngle(e,ji,Math.PI),e):r>.999999?(e.x=0,e.y=0,e.z=0,e.w=1,e):(Di.cross(ji,i,n),e.x=ji.x,e.y=ji.y,e.z=ji.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(Vi,i),Di.transformQuat(ji,n,Vi),t.fromAxisAngle(Vi,ji,r),t.multiply(e,i,Vi),e},t.rotateAroundLocal=function(e,i,n,r){return t.fromAxisAngle(Vi,n,r),t.multiply(e,i,Vi),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(Vi,i,s,a),t.slerp(Wi,n,r,a),t.slerp(e,Vi,Wi,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 Gi.set(Xi,i.x,i.y,i.z,n.x,n.y,n.z,r.x,r.y,r.z),t.normalize(e,t.fromMat3(e,Xi))},t.fromViewUp=function(e,i,n){return Gi.fromViewUp(Xi,i,n),t.normalize(e,t.fromMat3(e,Xi))},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 f=2*Math.sqrt(1+i-a-c);e.w=(h-o)/f,e.x=.25*f,e.y=(n+s)/f,e.z=(r+u)/f}else if(a>c){var d=2*Math.sqrt(1+a-i-c);e.w=(r-u)/d,e.x=(n+s)/d,e.y=.25*d,e.z=(o+h)/d}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*=Yi,i*=Yi,n*=Yi;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*=Yi,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=Si(2*Math.atan2(n,a)),h=90;else if(c<-.499999)o=0,u=-Si(2*Math.atan2(n,a)),h=-90;else{var l=n*n,_=r*r,f=s*s;o=Si(Math.atan2(2*n*a-2*r*s,1-2*l-2*f)),u=Si(Math.atan2(2*r*a-2*n*s,1-2*_-2*f)),h=Si(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.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=gi),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=gi),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}(yt));Hi.IDENTITY=Object.freeze(new Hi);var Vi=new Hi,Wi=new Hi,ji=new Di,Xi=new Gi,Yi=.5*Math.PI/180;function qi(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 Hi(e,t,i,n)}li.fastDefine("cc.Quat",Hi,{x:0,y:0,z:0,w:1}),R.Quat=Hi,R.quat=qi;var Ki=e("gj",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])])),Qi=e("f",function(e){function t(t,i,n,r,s,a,o,u,h,c,l,_,f,d,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===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),(g=e.call(this)||this).m00=void 0,g.m01=void 0,g.m02=void 0,g.m03=void 0,g.m04=void 0,g.m05=void 0,g.m06=void 0,g.m07=void 0,g.m08=void 0,g.m09=void 0,g.m10=void 0,g.m11=void 0,g.m12=void 0,g.m13=void 0,g.m14=void 0,g.m15=void 0,"object"==typeof 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=f,g.m13=d,g.m14=p,g.m15=m),g}_(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,_,f,d,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=f,e.m13=d,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,f=t.m11,d=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,b=c*p-l*d,w=c*m-_*d,R=c*g-f*d,I=l*m-_*p,O=l*g-f*p,N=_*g-f*m,C=v*N-y*O+E*I+T*R-A*w+S*b;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*I)*C,e.m01=(r*O-n*N-s*I)*C,e.m02=(p*S-m*A+g*T)*C,e.m03=(_*A-l*S-f*T)*C,e.m04=(u*R-a*N-h*w)*C,e.m05=(i*N-r*R+s*w)*C,e.m06=(m*E-d*S-g*y)*C,e.m07=(c*S-_*E+f*y)*C,e.m08=(a*O-o*R+h*b)*C,e.m09=(n*R-i*O-s*b)*C,e.m10=(d*A-p*E+g*v)*C,e.m11=(l*E-c*A-f*v)*C,e.m12=(o*w-a*I-u*b)*C,e.m13=(i*I-n*w+r*b)*C,e.m14=(p*y-d*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,f=e.m12,d=e.m13,p=e.m14,m=e.m15;return(t*a-i*s)*(l*m-_*p)-(t*o-n*s)*(c*m-_*d)+(t*u-r*s)*(c*p-l*d)+(i*o-n*a)*(h*m-_*f)-(i*u-r*a)*(h*p-l*f)+(n*u-r*o)*(h*d-c*f)},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,f=t.m10,d=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*f+A*g,e.m03=y*a+E*c+T*d+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*f+A*g,e.m07=y*a+E*c+T*d+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*f+A*g,e.m11=y*a+E*c+T*d+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*f+A*g,e.m15=y*a+E*c+T*d+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,f=t.m07,d=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=f,e.m08=d,e.m09=p,e.m10=m,e.m11=g,e.m12=a*n+c*r+d*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+f*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)<gi)return null;r*=o=1/o,s*=o,a*=o;var u=Math.sin(i),h=Math.cos(i),c=1-h,l=t.m00,_=t.m01,f=t.m02,d=t.m03,p=t.m04,m=t.m05,g=t.m06,v=t.m07,y=t.m08,E=t.m09,T=t.m10,A=t.m11,S=r*r*c+h,b=s*r*c+a*u,w=a*r*c-s*u,R=r*s*c-a*u,I=s*s*c+h,O=a*s*c+r*u,N=r*a*c+s*u,C=s*a*c-r*u,M=a*a*c+h;return e.m00=l*S+p*b+y*w,e.m01=_*S+m*b+E*w,e.m02=f*S+g*b+T*w,e.m03=d*S+v*b+A*w,e.m04=l*R+p*I+y*O,e.m05=_*R+m*I+E*O,e.m06=f*R+g*I+T*O,e.m07=d*R+v*I+A*O,e.m08=l*N+p*C+y*M,e.m09=_*N+m*C+E*M,e.m10=f*N+g*C+T*M,e.m11=d*N+v*C+A*M,t!==e&&(e.m12=t.m12,e.m13=t.m13,e.m14=t.m14,e.m15=t.m15),e},t.rotateX=function(e,t,i){var n=Math.sin(i),r=Math.cos(i),s=t.m04,a=t.m05,o=t.m06,u=t.m07,h=t.m08,c=t.m09,l=t.m10,_=t.m11;return t!==e&&(e.m00=t.m00,e.m01=t.m01,e.m02=t.m02,e.m03=t.m03,e.m12=t.m12,e.m13=t.m13,e.m14=t.m14,e.m15=t.m15),e.m04=s*r+h*n,e.m05=a*r+c*n,e.m06=o*r+l*n,e.m07=u*r+_*n,e.m08=h*r-s*n,e.m09=c*r-a*n,e.m10=l*r-o*n,e.m11=_*r-u*n,e},t.rotateY=function(e,t,i){var n=Math.sin(i),r=Math.cos(i),s=t.m00,a=t.m01,o=t.m02,u=t.m03,h=t.m08,c=t.m09,l=t.m10,_=t.m11;return t!==e&&(e.m04=t.m04,e.m05=t.m05,e.m06=t.m06,e.m07=t.m07,e.m12=t.m12,e.m13=t.m13,e.m14=t.m14,e.m15=t.m15),e.m00=s*r-h*n,e.m01=a*r-c*n,e.m02=o*r-l*n,e.m03=u*r-_*n,e.m08=s*n+h*r,e.m09=a*n+c*r,e.m10=o*n+l*r,e.m11=u*n+_*r,e},t.rotateZ=function(e,t,i){var n=Math.sin(i),r=Math.cos(i),s=t.m00,a=t.m01,o=t.m02,u=t.m03,h=t.m04,c=t.m05,l=t.m06,_=t.m07;return t!==e&&(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.m00=s*r+h*n,e.m01=a*r+c*n,e.m02=o*r+l*n,e.m03=u*r+_*n,e.m04=h*r-s*n,e.m05=c*r-a*n,e.m06=l*r-o*n,e.m07=_*r-u*n,e},t.fromTranslation=function(e,t){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=t.x,e.m13=t.y,e.m14=t.z,e.m15=1,e},t.fromScaling=function(e,t){return e.m00=t.x,e.m01=0,e.m02=0,e.m03=0,e.m04=0,e.m05=t.y,e.m06=0,e.m07=0,e.m08=0,e.m09=0,e.m10=t.z,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=1,e},t.fromRotation=function(e,t,i){var n=i.x,r=i.y,s=i.z,a=Math.sqrt(n*n+r*r+s*s);if(Math.abs(a)<gi)return null;n*=a=1/a,r*=a,s*=a;var o=Math.sin(t),u=Math.cos(t),h=1-u;return e.m00=n*n*h+u,e.m01=r*n*h+s*o,e.m02=s*n*h-r*o,e.m03=0,e.m04=n*r*h-s*o,e.m05=r*r*h+u,e.m06=s*r*h+n*o,e.m07=0,e.m08=n*s*h+r*o,e.m09=r*s*h-n*o,e.m10=s*s*h+u,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=1,e},t.fromXRotation=function(e,t){var i=Math.sin(t),n=Math.cos(t);return e.m00=1,e.m01=0,e.m02=0,e.m03=0,e.m04=0,e.m05=n,e.m06=i,e.m07=0,e.m08=0,e.m09=-i,e.m10=n,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=1,e},t.fromYRotation=function(e,t){var i=Math.sin(t),n=Math.cos(t);return e.m00=n,e.m01=0,e.m02=-i,e.m03=0,e.m04=0,e.m05=1,e.m06=0,e.m07=0,e.m08=i,e.m09=0,e.m10=n,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=1,e},t.fromZRotation=function(e,t){var i=Math.sin(t),n=Math.cos(t);return e.m00=n,e.m01=i,e.m02=0,e.m03=0,e.m04=-i,e.m05=n,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.fromRT=function(e,t,i){var n=t.x,r=t.y,s=t.z,a=t.w,o=n+n,u=r+r,h=s+s,c=n*o,l=n*u,_=n*h,f=r*u,d=r*h,p=s*h,m=a*o,g=a*u,v=a*h;return e.m00=1-(f+p),e.m01=l+v,e.m02=_-g,e.m03=0,e.m04=l-v,e.m05=1-(c+p),e.m06=d+m,e.m07=0,e.m08=_+g,e.m09=d-m,e.m10=1-(c+f),e.m11=0,e.m12=i.x,e.m13=i.y,e.m14=i.z,e.m15=1,e},t.getTranslation=function(e,t){return e.x=t.m12,e.y=t.m13,e.z=t.m14,e},t.getScaling=function(e,t){var i=Ji.m00=t.m00,n=Ji.m01=t.m01,r=Ji.m02=t.m02,s=Ji.m03=t.m04,a=Ji.m04=t.m05,o=Ji.m05=t.m06,u=Ji.m06=t.m08,h=Ji.m07=t.m09,c=Ji.m08=t.m10;return e.x=Math.sqrt(i*i+n*n+r*r),e.y=Math.sqrt(s*s+a*a+o*o),e.z=Math.sqrt(u*u+h*h+c*c),Gi.determinant(Ji)<0&&(e.x*=-1),e},t.getRotation=function(e,t){var i=t.m00+t.m05+t.m10,n=0;return i>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){n.x=Di.set(Zi,e.m00,e.m01,e.m02).length(),Ji.m00=e.m00/n.x,Ji.m01=e.m01/n.x,Ji.m02=e.m02/n.x,n.y=Di.set(Zi,e.m04,e.m05,e.m06).length(),Ji.m03=e.m04/n.y,Ji.m04=e.m05/n.y,Ji.m05=e.m06/n.y,n.z=Di.set(Zi,e.m08,e.m09,e.m10).length(),Ji.m06=e.m08/n.z,Ji.m07=e.m09/n.z,Ji.m08=e.m10/n.z,Gi.determinant(Ji)<0&&(n.x*=-1,Ji.m00*=-1,Ji.m01*=-1,Ji.m02*=-1),Hi.fromMat3(t,Ji),Di.set(i,e.m12,e.m13,e.m14)},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,f=r*c,d=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-(d+m))*E,e.m01=(_+y)*E,e.m02=(f-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=(f+v)*A,e.m09=(p-g)*A,e.m10=(1-(l+d))*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,f=s*c,d=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,b=r.x,w=r.y,R=r.z;return e.m00=(1-(p+g))*T,e.m01=(f+E)*T,e.m02=(d-y)*T,e.m03=0,e.m04=(f-E)*A,e.m05=(1-(_+g))*A,e.m06=(m+v)*A,e.m07=0,e.m08=(d+y)*S,e.m09=(m-v)*S,e.m10=(1-(_+p))*S,e.m11=0,e.m12=i.x+b-(e.m00*b+e.m04*w+e.m08*R),e.m13=i.y+w-(e.m01*b+e.m05*w+e.m09*R),e.m14=i.z+R-(e.m02*b+e.m06*w+e.m10*R),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,f=r*o,d=r*u,p=s*a,m=s*o,g=s*u;return e.m00=1-l-d,e.m01=c+g,e.m02=_-m,e.m03=0,e.m04=c-g,e.m05=1-h-d,e.m06=f+p,e.m07=0,e.m08=_+m,e.m09=f-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,f=Ki[u];return e.m00=l*f[0],e.m01=l*f[1],e.m02=0,e.m03=0,e.m04=_*f[2],e.m05=_*f[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),f=-2*c,d=-2*l,p=(t+i)*c,m=(r+n)*l,g=Ki[h];return e.m00=f*g[0],e.m01=f*g[1],e.m02=0,e.m03=0,e.m04=d*g[2],e.m05=d*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,f=1/Math.sqrt(c*c+l*l+_*_),d=u*(_*=f)-h*(l*=f),p=h*(c*=f)-o*_,m=o*l-u*c,g=l*(m*=f=1/Math.sqrt(d*d+p*p+m*m))-_*(p*=f),v=_*(d*=f)-c*m,y=c*p-l*d;return e.m00=d,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=-(d*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,f=t.m11,d=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,b=c*p-l*d,w=c*m-_*d,R=c*g-f*d,I=l*m-_*p,O=l*g-f*p,N=_*g-f*m,C=v*N-y*O+E*I+T*R-A*w+S*b;return C?(C=1/C,e.m00=(o*N-u*O+h*I)*C,e.m01=(u*R-a*N-h*w)*C,e.m02=(a*O-o*R+h*b)*C,e.m03=0,e.m04=(r*O-n*N-s*I)*C,e.m05=(i*N-r*R+s*w)*C,e.m06=(n*R-i*O-s*b)*C,e.m07=0,e.m08=(p*S-m*A+g*T)*C,e.m09=(m*E-d*S-g*y)*C,e.m10=(d*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=gi),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,_,f,d,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===f&&(f=0),void 0===d&&(d=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=f,this.m14=d,this.m15=p,this.m00=e),this},i.equals=function(e,t){return void 0===t&&(t=gi),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,f=this.m13,d=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*f-h*_,S=u*d-c*_,b=u*p-l*_,w=h*d-c*f,R=h*p-l*f,I=c*p-l*d,O=m*I-g*R+v*w+y*b-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*I-a*R+o*w)*O,this.m01=(i*R-t*I-n*w)*O,this.m02=(f*T-d*E+p*y)*O,this.m03=(c*E-h*T-l*y)*O,this.m04=(a*b-r*I-o*S)*O,this.m05=(e*I-i*b+n*S)*O,this.m06=(d*v-_*T-p*g)*O,this.m07=(u*T-c*v+l*g)*O,this.m08=(r*R-s*b+o*A)*O,this.m09=(t*b-e*R-n*A)*O,this.m10=(_*E-f*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=(f*g-_*y-d*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,f=this.m13,d=this.m14,p=this.m15;return(e*s-t*r)*(c*p-l*d)-(e*a-i*r)*(h*p-l*f)+(e*o-n*r)*(h*d-c*f)+(t*a-i*s)*(u*p-l*_)-(t*o-n*s)*(u*d-c*_)+(i*o-n*a)*(u*f-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,f=this.m12,d=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*f,this.m01=g*i+v*a+y*c+E*d,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*f,this.m05=g*i+v*a+y*c+E*d,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*f,this.m09=g*i+v*a+y*c+E*d,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*f,this.m13=g*i+v*a+y*c+E*d,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)<gi)return null;i*=s=1/s,n*=s,r*=s;var a=Math.sin(e),o=Math.cos(e),u=1-o,h=this.m00,c=this.m01,l=this.m02,_=this.m03,f=this.m04,d=this.m05,p=this.m06,m=this.m07,g=this.m08,v=this.m09,y=this.m10,E=this.m11,T=i*i*u+o,A=n*i*u+r*a,S=r*i*u-n*a,b=i*n*u-r*a,w=n*n*u+o,R=r*n*u+i*a,I=i*r*u+n*a,O=n*r*u-i*a,N=r*r*u+o;return this.m00=h*T+f*A+g*S,this.m01=c*T+d*A+v*S,this.m02=l*T+p*A+y*S,this.m03=_*T+m*A+E*S,this.m04=h*b+f*w+g*R,this.m05=c*b+d*w+v*R,this.m06=l*b+p*w+y*R,this.m07=_*b+m*w+E*R,this.m08=h*I+f*O+g*N,this.m09=c*I+d*O+v*N,this.m10=l*I+p*O+y*N,this.m11=_*I+m*O+E*N,this},i.getTranslation=function(e){return e.x=this.m12,e.y=this.m13,e.z=this.m14,e},i.getScale=function(e){var t=Ji.m00=this.m00,i=Ji.m01=this.m01,n=Ji.m02=this.m02,r=Ji.m03=this.m04,s=Ji.m04=this.m05,a=Ji.m05=this.m06,o=Ji.m06=this.m08,u=Ji.m07=this.m09,h=Ji.m08=this.m10;return e.x=Math.sqrt(t*t+i*i+n*n),e.y=Math.sqrt(r*r+s*s+a*a),e.z=Math.sqrt(o*o+u*u+h*h),Gi.determinant(Ji)<0&&(e.x*=-1),e},i.getRotation=function(e){var t=this.m00+this.m05+this.m10,i=0;return t>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,f=r*u,d=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-(f+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=(d+m)*E,this.m07=0,this.m08=(_+g)*T,this.m09=(d-m)*T,this.m10=(1-(c+f))*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,f=n*o,d=r*s,p=r*a,m=r*o;return this.m00=1-c-f,this.m01=h+m,this.m02=l-p,this.m03=0,this.m04=h-m,this.m05=1-u-f,this.m06=_+d,this.m07=0,this.m08=l+p,this.m09=_-d,this.m10=1-u-c,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},t}(yt));Qi.IDENTITY=Object.freeze(new Qi);var Zi=new Di,Ji=new Gi;function $i(e,t,i,n,r,s,a,o,u,h,c,l,_,f,d,p){return new Qi(e,t,i,n,r,s,a,o,u,h,c,l,_,f,d,p)}li.fastDefine("cc.Mat4",Qi,{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}),R.Mat4=Qi,R.mat4=$i;var en=e("V",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}_(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)<gi?e.x=0:e.x=1/i,Math.abs(n)<gi?e.y=0:e.y=1/n,e},t.normalize=function(e,t){var i=t.x,n=t.y,r=i*i+n*n;return r>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 Di?(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*bi()*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=gi),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(tn,e),t.normalize(nn,i);var n=t.dot(tn,nn);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=gi),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=gi),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=yi(this.x,e.x,t.x),this.y=yi(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=yi(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}(yt));en.ZERO=Object.freeze(new en(0,0)),en.ONE=Object.freeze(new en(1,1)),en.NEG_ONE=Object.freeze(new en(-1,-1)),en.UNIT_X=Object.freeze(new en(1,0)),en.UNIT_Y=Object.freeze(new en(0,1));var tn=new en,nn=new en;function rn(e,t){return new en(e,t)}li.fastDefine("cc.Vec2",en,{x:0,y:0}),R.Vec2=en,R.v2=rn;var sn=e("d",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}_(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)<gi?e.x=0:e.x=1/i,Math.abs(n)<gi?e.y=0:e.y=1/n,Math.abs(r)<gi?e.z=0:e.z=1/r,Math.abs(s)<gi?e.w=0:e.w=1/s,e},t.normalize=function(e,t){var i=t.x,n=t.y,r=t.z,s=t.w,a=i*i+n*n+r*r+s*s;return a>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*bi()*Math.PI,n=2*bi()-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,f=-a*n-o*r-u*s;return e.x=c*h+f*-a+l*-u-_*-o,e.y=l*h+f*-o+_*-a-c*-u,e.z=_*h+f*-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=gi),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=gi),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=gi),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=yi(this.x,e.x,t.x),this.y=yi(this.y,e.y,t.y),this.z=yi(this.z,e.z,t.z),this.w=yi(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}(yt));function an(e,t,i,n){return new sn(e,t,i,n)}sn.ZERO=Object.freeze(new sn(0,0,0,0)),sn.ONE=Object.freeze(new sn(1,1,1,1)),sn.NEG_ONE=Object.freeze(new sn(-1,-1,-1,-1)),li.fastDefine("cc.Vec4",sn,{x:0,y:0,z:0,w:0}),R.Vec4=sn,R.v4=an,ie(en,"Vec2",[{name:"sub",newName:"subtract",target:en,targetName:"Vec2"},{name:"mul",newName:"multiply",target:en,targetName:"Vec2"},{name:"div",newName:"divide",target:en,targetName:"Vec2"},{name:"dist",newName:"distance",target:en,targetName:"Vec2"},{name:"sqrDist",newName:"squaredDistance",target:en,targetName:"Vec2"},{name:"mag",newName:"len",target:en,targetName:"Vec2"},{name:"sqrMag",newName:"lengthSqr",target:en,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:en,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:en,targetName:"Vec2"}]),ie(en.prototype,"Vec2",[{name:"mag",newName:"length",target:en.prototype,targetName:"Vec2"},{name:"magSqr",newName:"lengthSqr",target:en.prototype,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:en.prototype,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:en.prototype,targetName:"Vec2"}]),ie(Di,"Vec3",[{name:"sub",newName:"subtract",target:Di,targetName:"Vec3"},{name:"mul",newName:"multiply",target:Di,targetName:"Vec3"},{name:"div",newName:"divide",target:Di,targetName:"Vec3"},{name:"dist",newName:"distance",target:Di,targetName:"Vec3"},{name:"sqrDist",newName:"squaredDistance",target:Di,targetName:"Vec3"},{name:"mag",newName:"len",target:Di,targetName:"Vec3"},{name:"sqrMag",newName:"lengthSqr",target:Di,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:Di,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:Di,targetName:"Vec3"}]),ie(Di.prototype,"Vec3",[{name:"mag",newName:"length",target:Di.prototype,targetName:"Vec3"},{name:"magSqr",newName:"lengthSqr",target:Di.prototype,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:Di.prototype,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:Di.prototype,targetName:"Vec3"}]),ie(sn,"Vec4",[{name:"sub",newName:"subtract",target:sn,targetName:"Vec4"},{name:"mul",newName:"multiply",target:sn,targetName:"Vec4"},{name:"div",newName:"divide",target:sn,targetName:"Vec4"},{name:"dist",newName:"distance",target:sn,targetName:"Vec4"},{name:"sqrDist",newName:"squaredDistance",target:sn,targetName:"Vec4"},{name:"mag",newName:"len",target:sn,targetName:"Vec4"},{name:"sqrMag",newName:"lengthSqr",target:sn,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:sn,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:sn,targetName:"Vec4"}]),ie(sn.prototype,"Vec4",[{name:"mag",newName:"length",target:sn.prototype,targetName:"Vec4"},{name:"magSqr",newName:"lengthSqr",target:sn.prototype,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:sn.prototype,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:sn.prototype,targetName:"Vec4"}]),ie(Hi,"Quat",[{name:"mag",newName:"len",target:Hi,targetName:"Quat"},{name:"mul",newName:"multiply",target:Hi,targetName:"Quat"},{name:"sqrMag",newName:"lengthSqr",target:Hi,targetName:"Quat"},{name:"scale",newName:"multiplyScalar",target:Hi,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:Hi,targetName:"Quat"}]),ie(Hi.prototype,"Quat",[{name:"scale",newName:"multiplyScalar",target:Hi.prototype,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:Hi.prototype,targetName:"Quat"}]),ie(Fi,"Color",[{name:"sub",newName:"subtract",target:Fi,targetName:"Color"},{name:"mul",newName:"multiply",target:Fi,targetName:"Color"},{name:"div",newName:"divide",target:Fi,targetName:"Color"},{name:"exactEquals",newName:"strictEquals",target:Fi,targetName:"Color"},{name:"fromHex",newName:"fromHEX",customFunction:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var n=t[1].toString(16);return R.Color.fromHEX(t[0],n)}}]),ie(Gi,"Mat3",[{name:"sub",newName:"subtract",target:Gi,targetName:"Mat3"},{name:"mul",newName:"multiply",target:Gi,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:Gi,targetName:"Mat3"},{name:"transfrom",newName:"transform",target:Gi,targetName:"Mat3"}]),ie(Gi.prototype,"Mat3",[{name:"sub",newName:"subtract",target:Gi.prototype,targetName:"Mat3"},{name:"mul",newName:"multiply",target:Gi.prototype,targetName:"Mat3"},{name:"mulScalar",newName:"multiplyScalar",target:Gi.prototype,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:Gi.prototype,targetName:"Mat3"}]),ie(Qi,"Mat4",[{name:"sub",newName:"subtract",target:Qi,targetName:"Mat4"},{name:"mul",newName:"multiply",target:Qi,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:Qi,targetName:"Mat4"}]),ie(Qi.prototype,"Mat4",[{name:"sub",newName:"subtract",target:Qi.prototype,targetName:"Mat4"},{name:"mul",newName:"multiply",target:Qi.prototype,targetName:"Mat4"},{name:"mulScalar",newName:"multiplyScalar",target:Qi.prototype,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:Qi.prototype,targetName:"Mat4"}]);var on=e("A",function(){function e(e,t,i,n,r,s){void 0===e&&(e=1),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),this.a=e,this.b=t,this.c=i,this.d=n,this.tx=r,this.ty=s}return e.identity=function(){return new e},e.clone=function(t){return new e(t.a,t.b,t.c,t.d,t.tx,t.ty)},e.concat=function(e,t,i){var n=t.a,r=t.b,s=t.c,a=t.d,o=t.tx,u=t.ty;e.a=n*i.a+r*i.c,e.b=n*i.b+r*i.d,e.c=s*i.a+a*i.c,e.d=s*i.b+a*i.d,e.tx=o*i.a+u*i.c+i.tx,e.ty=o*i.b+u*i.d+i.ty},e.invert=function(e,t){var i=1/(t.a*t.d-t.b*t.c);e.a=i*t.d,e.b=-i*t.b,e.c=-i*t.c,e.d=i*t.a,e.tx=i*(t.c*t.ty-t.d*t.tx),e.ty=i*(t.b*t.tx-t.a*t.ty)},e.fromMat4=function(e,t){e.a=t.m00,e.b=t.m01,e.c=t.m04,e.d=t.m05,e.tx=t.m12,e.ty=t.m13},e.transformVec2=function(e,t,i,n){var r,s;n?(r=t,s=i):(n=i,r=t.x,s=t.y),e.x=n.a*r+n.c*s+n.tx,e.y=n.b*r+n.d*s+n.ty},e.transformSize=function(e,t,i){e.width=i.a*t.width+i.c*t.height,e.height=i.b*t.width+i.d*t.height},e.transformRect=function(e,t,i){var n=t.x+t.width,r=t.y+t.height,s=i.a*t.x+i.c*t.y+i.tx,a=i.b*t.x+i.d*t.y+i.ty,o=i.a*n+i.c*t.y+i.tx,u=i.b*n+i.d*t.y+i.ty,h=i.a*t.x+i.c*r+i.tx,c=i.b*t.x+i.d*r+i.ty,l=i.a*n+i.c*r+i.tx,_=i.b*n+i.d*r+i.ty,f=Math.min(s,o,h,l),d=Math.max(s,o,h,l),p=Math.min(a,u,c,_),m=Math.max(a,u,c,_);e.x=f,e.y=p,e.width=d-f,e.height=m-p},e.transformObb=function(e,t,i,n,r,s){var a=s.a*r.x+s.c*r.y+s.tx,o=s.b*r.x+s.d*r.y+s.ty,u=s.a*r.width,h=s.b*r.width,c=s.c*r.height,l=s.d*r.height;t.x=a,t.y=o,i.x=u+a,i.y=h+o,e.x=c+a,e.y=l+o,n.x=u+c+a,n.y=h+l+o},e}());R.AffineTransform=on;var un=e("S",function(e){function t(t,i){var n;return n=e.call(this)||this,t&&"object"==typeof t?(n.width=t.width,n.height=t.height):(n.width=t||0,n.height=i||0),n}_(t,e),t.lerp=function(e,t,i,n){return e.width=t.width+(i.width-t.width)*n,e.height=t.height+(i.height-t.height)*n,e};var i=t.prototype;return i.clone=function(){return new t(this.width,this.height)},i.set=function(e,t){return e&&"object"==typeof e?(this.height=e.height,this.width=e.width):(this.width=e||0,this.height=t||0),this},i.equals=function(e){return this.width===e.width&&this.height===e.height},i.lerp=function(e,t){return this.width+=(e.width-this.width)*t,this.height+=(e.height-this.height)*t,this},i.toString=function(){return"("+this.width.toFixed(2)+", "+this.height.toFixed(2)+")"},c(t,[{key:"x",get:function(){return this.width},set:function(e){this.width=e}},{key:"y",get:function(){return this.height},set:function(e){this.height=e}}]),t}(yt));function hn(e,t){return void 0===e&&(e=0),void 0===t&&(t=0),new un(e,t)}un.ZERO=Object.freeze(new un(0,0)),un.ONE=Object.freeze(new un(1,1)),li.fastDefine("cc.Size",un,{width:0,height:0}),R.size=hn,R.Size=un;var cn=e("R",function(e){function t(t,i,n,r){var s;return s=e.call(this)||this,t&&"object"==typeof t?(s.y=t.y,s.width=t.width,s.height=t.height,s.x=t.x):(s.x=t||0,s.y=i||0,s.width=n||0,s.height=r||0),s}_(t,e),t.fromMinMax=function(e,t,i){var n=Math.min(t.x,i.x),r=Math.min(t.y,i.y),s=Math.max(t.x,i.x),a=Math.max(t.y,i.y);return e.x=n,e.y=r,e.width=s-n,e.height=a-r,e},t.lerp=function(e,t,i,n){var r=t.x,s=t.y,a=t.width,o=t.height;return e.x=r+(i.x-r)*n,e.y=s+(i.y-s)*n,e.width=a+(i.width-a)*n,e.height=o+(i.height-o)*n,e},t.intersection=function(e,t,i){var n=t.x,r=t.y,s=t.x+t.width,a=t.y+t.height,o=i.x,u=i.y,h=i.x+i.width,c=i.y+i.height;return e.x=Math.max(n,o),e.y=Math.max(r,u),e.width=Math.min(s,h)-e.x,e.height=Math.min(a,c)-e.y,e},t.union=function(e,t,i){var n=t.x,r=t.y,s=t.width,a=t.height,o=i.x,u=i.y,h=i.width,c=i.height;return e.x=Math.min(n,o),e.y=Math.min(r,u),e.width=Math.max(n+s,o+h)-e.x,e.height=Math.max(r+a,u+c)-e.y,e};var i=t.prototype;return i.clone=function(){return new t(this.x,this.y,this.width,this.height)},i.set=function(e,t,i,n){return e&&"object"==typeof e?(this.y=e.y,this.width=e.width,this.height=e.height,this.x=e.x):(this.x=e||0,this.y=t||0,this.width=i||0,this.height=n||0),this},i.equals=function(e){return this.x===e.x&&this.y===e.y&&this.width===e.width&&this.height===e.height},i.lerp=function(e,t){var i=this.x,n=this.y,r=this.width,s=this.height;return this.x=i+(e.x-i)*t,this.y=n+(e.y-n)*t,this.width=r+(e.width-r)*t,this.height=s+(e.height-s)*t,this},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.width.toFixed(2)+", "+this.height.toFixed(2)+")"},i.intersects=function(e){var t=this.x+this.width,i=this.y+this.height,n=e.x+e.width,r=e.y+e.height;return!(t<e.x||n<this.x||i<e.y||r<this.y)},i.contains=function(e){return this.x<=e.x&&this.x+this.width>=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,f=Math.min(s,o,h,l),d=Math.max(s,o,h,l),p=Math.min(a,u,c,_),m=Math.max(a,u,c,_);return this.x=f,this.y=p,this.width=d-f,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},c(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 en(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 en(this.x,this.y)},set:function(e){this.x=e.x,this.y=e.y}},{key:"size",get:function(){return new un(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}(yt));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 cn(e,t,i,n)}li.fastDefine("cc.Rect",cn,{x:0,y:0,width:0,height:0}),R.Rect=cn,R.rect=ln;var _n,fn,dn,pn,mn,gn,vn,yn,En,Tn,An,Sn,bn,wn,Rn,In,On,Nn,Cn,Mn,xn,Fn,Pn,Dn,Ln,Bn,Un,Gn,zn,kn,Hn,Vn,Wn,jn,Xn,Yn,qn,Kn,Qn,Zn,Jn,$n,er,tr,ir=e("J",Float64Array),nr=(e("K",function(e){function t(){return e.apply(this,arguments)||this}return _(t,e),t.createFloatArray=function(e){return new ir(e)},c(t,[{key:"array",get:function(){return this._array}}]),t}(yt)),new(function(){function e(){this._finalizationRegistry=null,this._gcObjects=new WeakMap}var t=e.prototype;return t.registerGCObject=function(e){return e},t.init=function(){},t.finalizationRegistryCallback=function(e){var t=this._gcObjects.get(e);t&&(this._gcObjects.delete(e),t.destroy()),this._finalizationRegistry.unregister(e)},t.destroy=function(){},e}())),rr=function(){function e(){return nr.registerGCObject(this)}return e.prototype.destroy=function(){},e}(),sr=function(e,t,i){for(var n=0;n<t.length;++n)e.length<=n&&e.push(new i),e[n].copy(t[n]);e.length=t.length};!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.SWAPCHAIN=1]="SWAPCHAIN",e[e.BUFFER=2]="BUFFER",e[e.TEXTURE=3]="TEXTURE",e[e.RENDER_PASS=4]="RENDER_PASS",e[e.FRAMEBUFFER=5]="FRAMEBUFFER",e[e.SAMPLER=6]="SAMPLER",e[e.SHADER=7]="SHADER",e[e.DESCRIPTOR_SET_LAYOUT=8]="DESCRIPTOR_SET_LAYOUT",e[e.PIPELINE_LAYOUT=9]="PIPELINE_LAYOUT",e[e.PIPELINE_STATE=10]="PIPELINE_STATE",e[e.DESCRIPTOR_SET=11]="DESCRIPTOR_SET",e[e.INPUT_ASSEMBLER=12]="INPUT_ASSEMBLER",e[e.COMMAND_BUFFER=13]="COMMAND_BUFFER",e[e.QUEUE=14]="QUEUE",e[e.QUERY_POOL=15]="QUERY_POOL",e[e.GLOBAL_BARRIER=16]="GLOBAL_BARRIER",e[e.TEXTURE_BARRIER=17]="TEXTURE_BARRIER",e[e.BUFFER_BARRIER=18]="BUFFER_BARRIER",e[e.COUNT=19]="COUNT"}(_n||(_n=e("W",{}))),function(e){e[e.UNREADY=0]="UNREADY",e[e.FAILED=1]="FAILED",e[e.SUCCESS=2]="SUCCESS"}(fn||(fn=e("X",{}))),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.GLES2=1]="GLES2",e[e.GLES3=2]="GLES3",e[e.METAL=3]="METAL",e[e.VULKAN=4]="VULKAN",e[e.NVN=5]="NVN",e[e.WEBGL=6]="WEBGL",e[e.WEBGL2=7]="WEBGL2",e[e.WEBGPU=8]="WEBGPU"}(dn||(dn=e("Y",{}))),function(e){e[e.IDENTITY=0]="IDENTITY",e[e.ROTATE_90=1]="ROTATE_90",e[e.ROTATE_180=2]="ROTATE_180",e[e.ROTATE_270=3]="ROTATE_270"}(pn||(pn=e("Z",{}))),function(e){e[e.ELEMENT_INDEX_UINT=0]="ELEMENT_INDEX_UINT",e[e.INSTANCED_ARRAYS=1]="INSTANCED_ARRAYS",e[e.MULTIPLE_RENDER_TARGETS=2]="MULTIPLE_RENDER_TARGETS",e[e.BLEND_MINMAX=3]="BLEND_MINMAX",e[e.COMPUTE_SHADER=4]="COMPUTE_SHADER",e[e.INPUT_ATTACHMENT_BENEFIT=5]="INPUT_ATTACHMENT_BENEFIT",e[e.COUNT=6]="COUNT"}(mn||(mn=e("_",{}))),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A8=1]="A8",e[e.L8=2]="L8",e[e.LA8=3]="LA8",e[e.R8=4]="R8",e[e.R8SN=5]="R8SN",e[e.R8UI=6]="R8UI",e[e.R8I=7]="R8I",e[e.R16F=8]="R16F",e[e.R16UI=9]="R16UI",e[e.R16I=10]="R16I",e[e.R32F=11]="R32F",e[e.R32UI=12]="R32UI",e[e.R32I=13]="R32I",e[e.RG8=14]="RG8",e[e.RG8SN=15]="RG8SN",e[e.RG8UI=16]="RG8UI",e[e.RG8I=17]="RG8I",e[e.RG16F=18]="RG16F",e[e.RG16UI=19]="RG16UI",e[e.RG16I=20]="RG16I",e[e.RG32F=21]="RG32F",e[e.RG32UI=22]="RG32UI",e[e.RG32I=23]="RG32I",e[e.RGB8=24]="RGB8",e[e.SRGB8=25]="SRGB8",e[e.RGB8SN=26]="RGB8SN",e[e.RGB8UI=27]="RGB8UI",e[e.RGB8I=28]="RGB8I",e[e.RGB16F=29]="RGB16F",e[e.RGB16UI=30]="RGB16UI",e[e.RGB16I=31]="RGB16I",e[e.RGB32F=32]="RGB32F",e[e.RGB32UI=33]="RGB32UI",e[e.RGB32I=34]="RGB32I",e[e.RGBA8=35]="RGBA8",e[e.BGRA8=36]="BGRA8",e[e.SRGB8_A8=37]="SRGB8_A8",e[e.RGBA8SN=38]="RGBA8SN",e[e.RGBA8UI=39]="RGBA8UI",e[e.RGBA8I=40]="RGBA8I",e[e.RGBA16F=41]="RGBA16F",e[e.RGBA16UI=42]="RGBA16UI",e[e.RGBA16I=43]="RGBA16I",e[e.RGBA32F=44]="RGBA32F",e[e.RGBA32UI=45]="RGBA32UI",e[e.RGBA32I=46]="RGBA32I",e[e.R5G6B5=47]="R5G6B5",e[e.R11G11B10F=48]="R11G11B10F",e[e.RGB5A1=49]="RGB5A1",e[e.RGBA4=50]="RGBA4",e[e.RGB10A2=51]="RGB10A2",e[e.RGB10A2UI=52]="RGB10A2UI",e[e.RGB9E5=53]="RGB9E5",e[e.DEPTH=54]="DEPTH",e[e.DEPTH_STENCIL=55]="DEPTH_STENCIL",e[e.BC1=56]="BC1",e[e.BC1_ALPHA=57]="BC1_ALPHA",e[e.BC1_SRGB=58]="BC1_SRGB",e[e.BC1_SRGB_ALPHA=59]="BC1_SRGB_ALPHA",e[e.BC2=60]="BC2",e[e.BC2_SRGB=61]="BC2_SRGB",e[e.BC3=62]="BC3",e[e.BC3_SRGB=63]="BC3_SRGB",e[e.BC4=64]="BC4",e[e.BC4_SNORM=65]="BC4_SNORM",e[e.BC5=66]="BC5",e[e.BC5_SNORM=67]="BC5_SNORM",e[e.BC6H_UF16=68]="BC6H_UF16",e[e.BC6H_SF16=69]="BC6H_SF16",e[e.BC7=70]="BC7",e[e.BC7_SRGB=71]="BC7_SRGB",e[e.ETC_RGB8=72]="ETC_RGB8",e[e.ETC2_RGB8=73]="ETC2_RGB8",e[e.ETC2_SRGB8=74]="ETC2_SRGB8",e[e.ETC2_RGB8_A1=75]="ETC2_RGB8_A1",e[e.ETC2_SRGB8_A1=76]="ETC2_SRGB8_A1",e[e.ETC2_RGBA8=77]="ETC2_RGBA8",e[e.ETC2_SRGB8_A8=78]="ETC2_SRGB8_A8",e[e.EAC_R11=79]="EAC_R11",e[e.EAC_R11SN=80]="EAC_R11SN",e[e.EAC_RG11=81]="EAC_RG11",e[e.EAC_RG11SN=82]="EAC_RG11SN",e[e.PVRTC_RGB2=83]="PVRTC_RGB2",e[e.PVRTC_RGBA2=84]="PVRTC_RGBA2",e[e.PVRTC_RGB4=85]="PVRTC_RGB4",e[e.PVRTC_RGBA4=86]="PVRTC_RGBA4",e[e.PVRTC2_2BPP=87]="PVRTC2_2BPP",e[e.PVRTC2_4BPP=88]="PVRTC2_4BPP",e[e.ASTC_RGBA_4X4=89]="ASTC_RGBA_4X4",e[e.ASTC_RGBA_5X4=90]="ASTC_RGBA_5X4",e[e.ASTC_RGBA_5X5=91]="ASTC_RGBA_5X5",e[e.ASTC_RGBA_6X5=92]="ASTC_RGBA_6X5",e[e.ASTC_RGBA_6X6=93]="ASTC_RGBA_6X6",e[e.ASTC_RGBA_8X5=94]="ASTC_RGBA_8X5",e[e.ASTC_RGBA_8X6=95]="ASTC_RGBA_8X6",e[e.ASTC_RGBA_8X8=96]="ASTC_RGBA_8X8",e[e.ASTC_RGBA_10X5=97]="ASTC_RGBA_10X5",e[e.ASTC_RGBA_10X6=98]="ASTC_RGBA_10X6",e[e.ASTC_RGBA_10X8=99]="ASTC_RGBA_10X8",e[e.ASTC_RGBA_10X10=100]="ASTC_RGBA_10X10",e[e.ASTC_RGBA_12X10=101]="ASTC_RGBA_12X10",e[e.ASTC_RGBA_12X12=102]="ASTC_RGBA_12X12",e[e.ASTC_SRGBA_4X4=103]="ASTC_SRGBA_4X4",e[e.ASTC_SRGBA_5X4=104]="ASTC_SRGBA_5X4",e[e.ASTC_SRGBA_5X5=105]="ASTC_SRGBA_5X5",e[e.ASTC_SRGBA_6X5=106]="ASTC_SRGBA_6X5",e[e.ASTC_SRGBA_6X6=107]="ASTC_SRGBA_6X6",e[e.ASTC_SRGBA_8X5=108]="ASTC_SRGBA_8X5",e[e.ASTC_SRGBA_8X6=109]="ASTC_SRGBA_8X6",e[e.ASTC_SRGBA_8X8=110]="ASTC_SRGBA_8X8",e[e.ASTC_SRGBA_10X5=111]="ASTC_SRGBA_10X5",e[e.ASTC_SRGBA_10X6=112]="ASTC_SRGBA_10X6",e[e.ASTC_SRGBA_10X8=113]="ASTC_SRGBA_10X8",e[e.ASTC_SRGBA_10X10=114]="ASTC_SRGBA_10X10",e[e.ASTC_SRGBA_12X10=115]="ASTC_SRGBA_12X10",e[e.ASTC_SRGBA_12X12=116]="ASTC_SRGBA_12X12",e[e.COUNT=117]="COUNT"}(gn||(gn=e("$",{}))),function(e){e[e.NONE=0]="NONE",e[e.UNORM=1]="UNORM",e[e.SNORM=2]="SNORM",e[e.UINT=3]="UINT",e[e.INT=4]="INT",e[e.UFLOAT=5]="UFLOAT",e[e.FLOAT=6]="FLOAT"}(vn||(vn=e("a0",{}))),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.BOOL=1]="BOOL",e[e.BOOL2=2]="BOOL2",e[e.BOOL3=3]="BOOL3",e[e.BOOL4=4]="BOOL4",e[e.INT=5]="INT",e[e.INT2=6]="INT2",e[e.INT3=7]="INT3",e[e.INT4=8]="INT4",e[e.UINT=9]="UINT",e[e.UINT2=10]="UINT2",e[e.UINT3=11]="UINT3",e[e.UINT4=12]="UINT4",e[e.FLOAT=13]="FLOAT",e[e.FLOAT2=14]="FLOAT2",e[e.FLOAT3=15]="FLOAT3",e[e.FLOAT4=16]="FLOAT4",e[e.MAT2=17]="MAT2",e[e.MAT2X3=18]="MAT2X3",e[e.MAT2X4=19]="MAT2X4",e[e.MAT3X2=20]="MAT3X2",e[e.MAT3=21]="MAT3",e[e.MAT3X4=22]="MAT3X4",e[e.MAT4X2=23]="MAT4X2",e[e.MAT4X3=24]="MAT4X3",e[e.MAT4=25]="MAT4",e[e.SAMPLER1D=26]="SAMPLER1D",e[e.SAMPLER1D_ARRAY=27]="SAMPLER1D_ARRAY",e[e.SAMPLER2D=28]="SAMPLER2D",e[e.SAMPLER2D_ARRAY=29]="SAMPLER2D_ARRAY",e[e.SAMPLER3D=30]="SAMPLER3D",e[e.SAMPLER_CUBE=31]="SAMPLER_CUBE",e[e.SAMPLER=32]="SAMPLER",e[e.TEXTURE1D=33]="TEXTURE1D",e[e.TEXTURE1D_ARRAY=34]="TEXTURE1D_ARRAY",e[e.TEXTURE2D=35]="TEXTURE2D",e[e.TEXTURE2D_ARRAY=36]="TEXTURE2D_ARRAY",e[e.TEXTURE3D=37]="TEXTURE3D",e[e.TEXTURE_CUBE=38]="TEXTURE_CUBE",e[e.IMAGE1D=39]="IMAGE1D",e[e.IMAGE1D_ARRAY=40]="IMAGE1D_ARRAY",e[e.IMAGE2D=41]="IMAGE2D",e[e.IMAGE2D_ARRAY=42]="IMAGE2D_ARRAY",e[e.IMAGE3D=43]="IMAGE3D",e[e.IMAGE_CUBE=44]="IMAGE_CUBE",e[e.SUBPASS_INPUT=45]="SUBPASS_INPUT",e[e.COUNT=46]="COUNT"}(yn||(yn=e("a1",{}))),function(e){e[e.NONE=0]="NONE",e[e.TRANSFER_SRC=1]="TRANSFER_SRC",e[e.TRANSFER_DST=2]="TRANSFER_DST",e[e.INDEX=4]="INDEX",e[e.VERTEX=8]="VERTEX",e[e.UNIFORM=16]="UNIFORM",e[e.STORAGE=32]="STORAGE",e[e.INDIRECT=64]="INDIRECT"}(En||(En=e("a2",{}))),function(e){e[e.NONE=0]="NONE"}(Tn||(Tn=e("a3",{}))),function(e){e[e.NONE=0]="NONE",e[e.READ_ONLY=1]="READ_ONLY",e[e.WRITE_ONLY=2]="WRITE_ONLY",e[e.READ_WRITE=3]="READ_WRITE"}(An||(An=e("a4",{}))),function(e){e[e.NONE=0]="NONE",e[e.DEVICE=1]="DEVICE",e[e.HOST=2]="HOST"}(Sn||(Sn=e("a5",{}))),function(e){e[e.TEX1D=0]="TEX1D",e[e.TEX2D=1]="TEX2D",e[e.TEX3D=2]="TEX3D",e[e.CUBE=3]="CUBE",e[e.TEX1D_ARRAY=4]="TEX1D_ARRAY",e[e.TEX2D_ARRAY=5]="TEX2D_ARRAY"}(bn||(bn=e("a6",{}))),function(e){e[e.NONE=0]="NONE",e[e.TRANSFER_SRC=1]="TRANSFER_SRC",e[e.TRANSFER_DST=2]="TRANSFER_DST",e[e.SAMPLED=4]="SAMPLED",e[e.STORAGE=8]="STORAGE",e[e.COLOR_ATTACHMENT=16]="COLOR_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=32]="DEPTH_STENCIL_ATTACHMENT",e[e.INPUT_ATTACHMENT=64]="INPUT_ATTACHMENT"}(wn||(wn=e("a7",{}))),function(e){e[e.NONE=0]="NONE",e[e.GEN_MIPMAP=1]="GEN_MIPMAP",e[e.GENERAL_LAYOUT=2]="GENERAL_LAYOUT"}(Rn||(Rn=e("a8",{}))),function(e){e[e.NONE=0]="NONE",e[e.RENDER_TARGET=1]="RENDER_TARGET",e[e.SAMPLED_TEXTURE=2]="SAMPLED_TEXTURE",e[e.LINEAR_FILTER=4]="LINEAR_FILTER",e[e.STORAGE_TEXTURE=8]="STORAGE_TEXTURE",e[e.VERTEX_ATTRIBUTE=16]="VERTEX_ATTRIBUTE"}(In||(In=e("a9",{}))),function(e){e[e.ONE=0]="ONE",e[e.MULTIPLE_PERFORMANCE=1]="MULTIPLE_PERFORMANCE",e[e.MULTIPLE_BALANCE=2]="MULTIPLE_BALANCE",e[e.MULTIPLE_QUALITY=3]="MULTIPLE_QUALITY"}(On||(On=e("aa",{}))),function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.RELAXED=2]="RELAXED",e[e.MAILBOX=3]="MAILBOX",e[e.HALF=4]="HALF"}(Nn||(Nn=e("ab",{}))),function(e){e[e.NONE=0]="NONE",e[e.POINT=1]="POINT",e[e.LINEAR=2]="LINEAR",e[e.ANISOTROPIC=3]="ANISOTROPIC"}(Cn||(Cn=e("ac",{}))),function(e){e[e.WRAP=0]="WRAP",e[e.MIRROR=1]="MIRROR",e[e.CLAMP=2]="CLAMP",e[e.BORDER=3]="BORDER"}(Mn||(Mn=e("ad",{}))),function(e){e[e.NEVER=0]="NEVER",e[e.LESS=1]="LESS",e[e.EQUAL=2]="EQUAL",e[e.LESS_EQUAL=3]="LESS_EQUAL",e[e.GREATER=4]="GREATER",e[e.NOT_EQUAL=5]="NOT_EQUAL",e[e.GREATER_EQUAL=6]="GREATER_EQUAL",e[e.ALWAYS=7]="ALWAYS"}(xn||(xn=e("ae",{}))),function(e){e[e.ZERO=0]="ZERO",e[e.KEEP=1]="KEEP",e[e.REPLACE=2]="REPLACE",e[e.INCR=3]="INCR",e[e.DECR=4]="DECR",e[e.INVERT=5]="INVERT",e[e.INCR_WRAP=6]="INCR_WRAP",e[e.DECR_WRAP=7]="DECR_WRAP"}(Fn||(Fn=e("af",{}))),function(e){e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_ALPHA=2]="SRC_ALPHA",e[e.DST_ALPHA=3]="DST_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=4]="ONE_MINUS_SRC_ALPHA",e[e.ONE_MINUS_DST_ALPHA=5]="ONE_MINUS_DST_ALPHA",e[e.SRC_COLOR=6]="SRC_COLOR",e[e.DST_COLOR=7]="DST_COLOR",e[e.ONE_MINUS_SRC_COLOR=8]="ONE_MINUS_SRC_COLOR",e[e.ONE_MINUS_DST_COLOR=9]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=10]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=11]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=12]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=13]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=14]="ONE_MINUS_CONSTANT_ALPHA"}(Pn||(Pn=e("ag",{}))),function(e){e[e.ADD=0]="ADD",e[e.SUB=1]="SUB",e[e.REV_SUB=2]="REV_SUB",e[e.MIN=3]="MIN",e[e.MAX=4]="MAX"}(Dn||(Dn=e("ah",{}))),function(e){e[e.NONE=0]="NONE",e[e.R=1]="R",e[e.G=2]="G",e[e.B=4]="B",e[e.A=8]="A",e[e.ALL=15]="ALL"}(Ln||(Ln=e("ai",{}))),function(e){e[e.NONE=0]="NONE",e[e.VERTEX=1]="VERTEX",e[e.CONTROL=2]="CONTROL",e[e.EVALUATION=4]="EVALUATION",e[e.GEOMETRY=8]="GEOMETRY",e[e.FRAGMENT=16]="FRAGMENT",e[e.COMPUTE=32]="COMPUTE",e[e.ALL=63]="ALL"}(Bn||(Bn=e("aj",{}))),function(e){e[e.LOAD=0]="LOAD",e[e.CLEAR=1]="CLEAR",e[e.DISCARD=2]="DISCARD"}(Un||(Un=e("ak",{}))),function(e){e[e.STORE=0]="STORE",e[e.DISCARD=1]="DISCARD"}(Gn||(Gn=e("al",{}))),function(e){e[e.NONE=0]="NONE",e[e.INDIRECT_BUFFER=1]="INDIRECT_BUFFER",e[e.INDEX_BUFFER=2]="INDEX_BUFFER",e[e.VERTEX_BUFFER=4]="VERTEX_BUFFER",e[e.VERTEX_SHADER_READ_UNIFORM_BUFFER=8]="VERTEX_SHADER_READ_UNIFORM_BUFFER",e[e.VERTEX_SHADER_READ_TEXTURE=16]="VERTEX_SHADER_READ_TEXTURE",e[e.VERTEX_SHADER_READ_OTHER=32]="VERTEX_SHADER_READ_OTHER",e[e.FRAGMENT_SHADER_READ_UNIFORM_BUFFER=64]="FRAGMENT_SHADER_READ_UNIFORM_BUFFER",e[e.FRAGMENT_SHADER_READ_TEXTURE=128]="FRAGMENT_SHADER_READ_TEXTURE",e[e.FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT=256]="FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT",e[e.FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT=512]="FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT",e[e.FRAGMENT_SHADER_READ_OTHER=1024]="FRAGMENT_SHADER_READ_OTHER",e[e.COLOR_ATTACHMENT_READ=2048]="COLOR_ATTACHMENT_READ",e[e.DEPTH_STENCIL_ATTACHMENT_READ=4096]="DEPTH_STENCIL_ATTACHMENT_READ",e[e.COMPUTE_SHADER_READ_UNIFORM_BUFFER=8192]="COMPUTE_SHADER_READ_UNIFORM_BUFFER",e[e.COMPUTE_SHADER_READ_TEXTURE=16384]="COMPUTE_SHADER_READ_TEXTURE",e[e.COMPUTE_SHADER_READ_OTHER=32768]="COMPUTE_SHADER_READ_OTHER",e[e.TRANSFER_READ=65536]="TRANSFER_READ",e[e.HOST_READ=131072]="HOST_READ",e[e.PRESENT=262144]="PRESENT",e[e.VERTEX_SHADER_WRITE=524288]="VERTEX_SHADER_WRITE",e[e.FRAGMENT_SHADER_WRITE=1048576]="FRAGMENT_SHADER_WRITE",e[e.COLOR_ATTACHMENT_WRITE=2097152]="COLOR_ATTACHMENT_WRITE",e[e.DEPTH_STENCIL_ATTACHMENT_WRITE=4194304]="DEPTH_STENCIL_ATTACHMENT_WRITE",e[e.COMPUTE_SHADER_WRITE=8388608]="COMPUTE_SHADER_WRITE",e[e.TRANSFER_WRITE=16777216]="TRANSFER_WRITE",e[e.HOST_PREINITIALIZED=33554432]="HOST_PREINITIALIZED",e[e.HOST_WRITE=67108864]="HOST_WRITE"}(zn||(zn=e("am",{}))),function(e){e[e.NONE=0]="NONE",e[e.SAMPLE_ZERO=1]="SAMPLE_ZERO",e[e.AVERAGE=2]="AVERAGE",e[e.MIN=3]="MIN",e[e.MAX=4]="MAX"}(kn||(kn=e("an",{}))),function(e){e[e.GRAPHICS=0]="GRAPHICS",e[e.COMPUTE=1]="COMPUTE",e[e.RAY_TRACING=2]="RAY_TRACING"}(Hn||(Hn=e("ao",{}))),function(e){e[e.POINT_LIST=0]="POINT_LIST",e[e.LINE_LIST=1]="LINE_LIST",e[e.LINE_STRIP=2]="LINE_STRIP",e[e.LINE_LOOP=3]="LINE_LOOP",e[e.LINE_LIST_ADJACENCY=4]="LINE_LIST_ADJACENCY",e[e.LINE_STRIP_ADJACENCY=5]="LINE_STRIP_ADJACENCY",e[e.ISO_LINE_LIST=6]="ISO_LINE_LIST",e[e.TRIANGLE_LIST=7]="TRIANGLE_LIST",e[e.TRIANGLE_STRIP=8]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=9]="TRIANGLE_FAN",e[e.TRIANGLE_LIST_ADJACENCY=10]="TRIANGLE_LIST_ADJACENCY",e[e.TRIANGLE_STRIP_ADJACENCY=11]="TRIANGLE_STRIP_ADJACENCY",e[e.TRIANGLE_PATCH_ADJACENCY=12]="TRIANGLE_PATCH_ADJACENCY",e[e.QUAD_PATCH_LIST=13]="QUAD_PATCH_LIST"}(Vn||(Vn=e("ap",{}))),function(e){e[e.FILL=0]="FILL",e[e.POINT=1]="POINT",e[e.LINE=2]="LINE"}(Wn||(Wn=e("aq",{}))),function(e){e[e.GOURAND=0]="GOURAND",e[e.FLAT=1]="FLAT"}(jn||(jn=e("ar",{}))),function(e){e[e.NONE=0]="NONE",e[e.FRONT=1]="FRONT",e[e.BACK=2]="BACK"}(Xn||(Xn=e("as",{}))),function(e){e[e.NONE=0]="NONE",e[e.LINE_WIDTH=1]="LINE_WIDTH",e[e.DEPTH_BIAS=2]="DEPTH_BIAS",e[e.BLEND_CONSTANTS=4]="BLEND_CONSTANTS",e[e.DEPTH_BOUNDS=8]="DEPTH_BOUNDS",e[e.STENCIL_WRITE_MASK=16]="STENCIL_WRITE_MASK",e[e.STENCIL_COMPARE_MASK=32]="STENCIL_COMPARE_MASK"}(Yn||(Yn=e("at",{}))),function(e){e[e.FRONT=1]="FRONT",e[e.BACK=2]="BACK",e[e.ALL=3]="ALL"}(qn||(qn=e("au",{}))),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.UNIFORM_BUFFER=1]="UNIFORM_BUFFER",e[e.DYNAMIC_UNIFORM_BUFFER=2]="DYNAMIC_UNIFORM_BUFFER",e[e.STORAGE_BUFFER=4]="STORAGE_BUFFER",e[e.DYNAMIC_STORAGE_BUFFER=8]="DYNAMIC_STORAGE_BUFFER",e[e.SAMPLER_TEXTURE=16]="SAMPLER_TEXTURE",e[e.SAMPLER=32]="SAMPLER",e[e.TEXTURE=64]="TEXTURE",e[e.STORAGE_IMAGE=128]="STORAGE_IMAGE",e[e.INPUT_ATTACHMENT=256]="INPUT_ATTACHMENT"}(Kn||(Kn=e("av",{}))),function(e){e[e.GRAPHICS=0]="GRAPHICS",e[e.COMPUTE=1]="COMPUTE",e[e.TRANSFER=2]="TRANSFER"}(Qn||(Qn=e("aw",{}))),function(e){e[e.OCCLUSION=0]="OCCLUSION",e[e.PIPELINE_STATISTICS=1]="PIPELINE_STATISTICS",e[e.TIMESTAMP=2]="TIMESTAMP"}(Zn||(Zn=e("ax",{}))),function(e){e[e.PRIMARY=0]="PRIMARY",e[e.SECONDARY=1]="SECONDARY"}(Jn||(Jn=e("ay",{}))),function(e){e[e.NONE=0]="NONE",e[e.COLOR=1]="COLOR",e[e.DEPTH=2]="DEPTH",e[e.STENCIL=4]="STENCIL",e[e.DEPTH_STENCIL=6]="DEPTH_STENCIL",e[e.ALL=7]="ALL"}($n||($n=e("az",{}))),function(e){e[e.FULL=0]="FULL",e[e.SPLIT_BEGIN=1]="SPLIT_BEGIN",e[e.SPLIT_END=2]="SPLIT_END"}(er||(er=e("aA",{}))),function(e){e[e.RASTER=0]="RASTER",e[e.COMPUTE=1]="COMPUTE",e[e.COPY=2]="COPY",e[e.MOVE=3]="MOVE",e[e.RAYTRACE=4]="RAYTRACE",e[e.PRESENT=5]="PRESENT"}(tr||(tr=e("aB",{})));var ar,or=e("aC",function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this.x=e,this.y=t,this.z=i}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},e}()),ur=e("aD",function(){function e(e,t,i,n,r,s,a,o,u,h,c,l,_,f,d,p,m,g,v,y,E,T){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=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===c&&(c=0),void 0===l&&(l=0),void 0===_&&(_=0),void 0===f&&(f=1),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=new or),void 0===g&&(g=new or),void 0===v&&(v=!1),void 0===y&&(y=-1),void 0===E&&(E=1),void 0===T&&(T=1),this.maxVertexAttributes=e,this.maxVertexUniformVectors=t,this.maxFragmentUniformVectors=i,this.maxTextureUnits=n,this.maxImageUnits=r,this.maxVertexTextureUnits=s,this.maxColorRenderTargets=a,this.maxShaderStorageBufferBindings=o,this.maxShaderStorageBlockSize=u,this.maxUniformBufferBindings=h,this.maxUniformBlockSize=c,this.maxTextureSize=l,this.maxCubeMapTextureSize=_,this.uboOffsetAlignment=f,this.maxComputeSharedMemorySize=d,this.maxComputeWorkGroupInvocations=p,this.maxComputeWorkGroupSize=m,this.maxComputeWorkGroupCount=g,this.supportQuery=v,this.clipSpaceMinZ=y,this.screenSpaceSignY=E,this.clipSpaceSignY=T}return e.prototype.copy=function(e){return this.maxVertexAttributes=e.maxVertexAttributes,this.maxVertexUniformVectors=e.maxVertexUniformVectors,this.maxFragmentUniformVectors=e.maxFragmentUniformVectors,this.maxTextureUnits=e.maxTextureUnits,this.maxImageUnits=e.maxImageUnits,this.maxVertexTextureUnits=e.maxVertexTextureUnits,this.maxColorRenderTargets=e.maxColorRenderTargets,this.maxShaderStorageBufferBindings=e.maxShaderStorageBufferBindings,this.maxShaderStorageBlockSize=e.maxShaderStorageBlockSize,this.maxUniformBufferBindings=e.maxUniformBufferBindings,this.maxUniformBlockSize=e.maxUniformBlockSize,this.maxTextureSize=e.maxTextureSize,this.maxCubeMapTextureSize=e.maxCubeMapTextureSize,this.uboOffsetAlignment=e.uboOffsetAlignment,this.maxComputeSharedMemorySize=e.maxComputeSharedMemorySize,this.maxComputeWorkGroupInvocations=e.maxComputeWorkGroupInvocations,this.maxComputeWorkGroupSize.copy(e.maxComputeWorkGroupSize),this.maxComputeWorkGroupCount.copy(e.maxComputeWorkGroupCount),this.supportQuery=e.supportQuery,this.clipSpaceMinZ=e.clipSpaceMinZ,this.screenSpaceSignY=e.screenSpaceSignY,this.clipSpaceSignY=e.clipSpaceSignY,this},e}()),hr=e("aE",function(){function e(e){void 0===e&&(e=!0),this.enableBarrierDeduce=e}return e.prototype.copy=function(e){return this.enableBarrierDeduce=e.enableBarrierDeduce,this},e}()),cr=e("aF",function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this.x=e,this.y=t,this.z=i}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},e}()),lr=e("aG",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=0),this.x=e,this.y=t,this.width=i,this.height=n}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this},e}()),_r=e("aH",function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=1),this.width=e,this.height=t,this.depth=i}return e.prototype.copy=function(e){return this.width=e.width,this.height=e.height,this.depth=e.depth,this},e}()),fr=e("aI",function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=1),this.mipLevel=e,this.baseArrayLayer=t,this.layerCount=i}return e.prototype.copy=function(e){return this.mipLevel=e.mipLevel,this.baseArrayLayer=e.baseArrayLayer,this.layerCount=e.layerCount,this},e}()),dr=e("aJ",function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=1),void 0===i&&(i=0),void 0===n&&(n=1),this.baseMipLevel=e,this.levelCount=t,this.baseArrayLayer=i,this.layerCount=n}return e.prototype.copy=function(e){return this.baseMipLevel=e.baseMipLevel,this.levelCount=e.levelCount,this.baseArrayLayer=e.baseArrayLayer,this.layerCount=e.layerCount,this},e}()),pr=e("aK",function(){function e(e,t,i,n,r){void 0===e&&(e=new fr),void 0===t&&(t=new cr),void 0===i&&(i=new fr),void 0===n&&(n=new cr),void 0===r&&(r=new _r),this.srcSubres=e,this.srcOffset=t,this.dstSubres=i,this.dstOffset=n,this.extent=r}return e.prototype.copy=function(e){return this.srcSubres.copy(e.srcSubres),this.srcOffset.copy(e.srcOffset),this.dstSubres.copy(e.dstSubres),this.dstOffset.copy(e.dstOffset),this.extent.copy(e.extent),this},e}()),mr=e("aL",function(){function e(e,t,i,n,r,s){void 0===e&&(e=new fr),void 0===t&&(t=new cr),void 0===i&&(i=new _r),void 0===n&&(n=new fr),void 0===r&&(r=new cr),void 0===s&&(s=new _r),this.srcSubres=e,this.srcOffset=t,this.srcExtent=i,this.dstSubres=n,this.dstOffset=r,this.dstExtent=s}return e.prototype.copy=function(e){return this.srcSubres.copy(e.srcSubres),this.srcOffset.copy(e.srcOffset),this.srcExtent.copy(e.srcExtent),this.dstSubres.copy(e.dstSubres),this.dstOffset.copy(e.dstOffset),this.dstExtent.copy(e.dstExtent),this},e}()),gr=e("aM",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=new cr),void 0===r&&(r=new _r),void 0===s&&(s=new fr),this.buffOffset=e,this.buffStride=t,this.buffTexHeight=i,this.texOffset=n,this.texExtent=r,this.texSubres=s}return e.prototype.copy=function(e){return this.buffOffset=e.buffOffset,this.buffStride=e.buffStride,this.buffTexHeight=e.buffTexHeight,this.texOffset.copy(e.texOffset),this.texExtent.copy(e.texExtent),this.texSubres.copy(e.texSubres),this},e}()),vr=e("aN",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.left=e,this.top=t,this.width=i,this.height=n,this.minDepth=r,this.maxDepth=s}return e.prototype.copy=function(e){return this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height,this.minDepth=e.minDepth,this.maxDepth=e.maxDepth,this},e}()),yr=e("aO",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=0),this.x=e,this.y=t,this.z=i,this.w=n}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},e}()),Er=e("aP",function(){function e(e,t,i,n,r,s,a,o){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=[0]),void 0===a&&(a=[0]),void 0===o&&(o=[0]),this.maxBlockCounts=e,this.maxSamplerTextureCounts=t,this.maxSamplerCounts=i,this.maxTextureCounts=n,this.maxBufferCounts=r,this.maxImageCounts=s,this.maxSubpassInputCounts=a,this.setIndices=o}return e.prototype.copy=function(e){return this.maxBlockCounts=e.maxBlockCounts.slice(),this.maxSamplerTextureCounts=e.maxSamplerTextureCounts.slice(),this.maxSamplerCounts=e.maxSamplerCounts.slice(),this.maxTextureCounts=e.maxTextureCounts.slice(),this.maxBufferCounts=e.maxBufferCounts.slice(),this.maxImageCounts=e.maxImageCounts.slice(),this.maxSubpassInputCounts=e.maxSubpassInputCounts.slice(),this.setIndices=e.setIndices.slice(),this},e}()),Tr=e("aQ",function(){function e(e,t,i,n){void 0===e&&(e=null),void 0===t&&(t=Nn.ON),void 0===i&&(i=0),void 0===n&&(n=0),this.windowHandle=e,this.vsyncMode=t,this.width=i,this.height=n}return e.prototype.copy=function(e){return this.windowHandle=e.windowHandle,this.vsyncMode=e.vsyncMode,this.width=e.width,this.height=e.height,this},e}()),Ar=e("aR",function(){function e(e){void 0===e&&(e=new Er),this.bindingMappingInfo=e}return e.prototype.copy=function(e){return this.bindingMappingInfo.copy(e.bindingMappingInfo),this},e}()),Sr=e("aS",function(){function e(e,t,i,n,r){void 0===e&&(e=En.NONE),void 0===t&&(t=Sn.NONE),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=Tn.NONE),this.usage=e,this.memUsage=t,this.size=i,this.stride=n,this.flags=r}return e.prototype.copy=function(e){return this.usage=e.usage,this.memUsage=e.memUsage,this.size=e.size,this.stride=e.stride,this.flags=e.flags,this},e}()),br=e("aT",function(){function e(e,t,i){void 0===e&&(e=null),void 0===t&&(t=0),void 0===i&&(i=0),this.buffer=e,this.offset=t,this.range=i}return e.prototype.copy=function(e){return this.buffer=e.buffer,this.offset=e.offset,this.range=e.range,this},e}()),wr=e("aU",function(){function e(e,t,i,n,r,s,a){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=0),void 0===a&&(a=0),this.vertexCount=e,this.firstVertex=t,this.indexCount=i,this.firstIndex=n,this.vertexOffset=r,this.instanceCount=s,this.firstInstance=a}return e.prototype.copy=function(e){return this.vertexCount=e.vertexCount,this.firstVertex=e.firstVertex,this.indexCount=e.indexCount,this.firstIndex=e.firstIndex,this.vertexOffset=e.vertexOffset,this.instanceCount=e.instanceCount,this.firstInstance=e.firstInstance,this},e}()),Rr=e("aV",function(){function e(e,t,i,n,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=null),void 0===r&&(r=0),this.groupCountX=e,this.groupCountY=t,this.groupCountZ=i,this.indirectBuffer=n,this.indirectOffset=r}return e.prototype.copy=function(e){return this.groupCountX=e.groupCountX,this.groupCountY=e.groupCountY,this.groupCountZ=e.groupCountZ,this.indirectBuffer=e.indirectBuffer,this.indirectOffset=e.indirectOffset,this},e}()),Ir=e("aW",function(){function e(e){void 0===e&&(e=[]),this.drawInfos=e}return e.prototype.copy=function(e){return sr(this.drawInfos,e.drawInfos,wr),this},e}()),Or=e("aX",function(){function e(e,t,i,n,r,s,a,o,u,h,c){void 0===e&&(e=bn.TEX2D),void 0===t&&(t=wn.NONE),void 0===i&&(i=gn.UNKNOWN),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=Rn.NONE),void 0===a&&(a=1),void 0===o&&(o=1),void 0===u&&(u=On.ONE),void 0===h&&(h=1),void 0===c&&(c=0),this.type=e,this.usage=t,this.format=i,this.width=n,this.height=r,this.flags=s,this.layerCount=a,this.levelCount=o,this.samples=u,this.depth=h,this.externalRes=c}return e.prototype.copy=function(e){return this.type=e.type,this.usage=e.usage,this.format=e.format,this.width=e.width,this.height=e.height,this.flags=e.flags,this.layerCount=e.layerCount,this.levelCount=e.levelCount,this.samples=e.samples,this.depth=e.depth,this.externalRes=e.externalRes,this},e}()),Nr=e("aY",function(){function e(e,t,i,n,r,s,a){void 0===e&&(e=null),void 0===t&&(t=bn.TEX2D),void 0===i&&(i=gn.UNKNOWN),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===a&&(a=1),this.texture=e,this.type=t,this.format=i,this.baseLevel=n,this.levelCount=r,this.baseLayer=s,this.layerCount=a}return e.prototype.copy=function(e){return this.texture=e.texture,this.type=e.type,this.format=e.format,this.baseLevel=e.baseLevel,this.levelCount=e.levelCount,this.baseLayer=e.baseLayer,this.layerCount=e.layerCount,this},e}()),Cr=e("aZ",function(){function e(e,t,i,n,r,s,a,o){void 0===e&&(e=Cn.LINEAR),void 0===t&&(t=Cn.LINEAR),void 0===i&&(i=Cn.NONE),void 0===n&&(n=Mn.WRAP),void 0===r&&(r=Mn.WRAP),void 0===s&&(s=Mn.WRAP),void 0===a&&(a=0),void 0===o&&(o=xn.ALWAYS),this.minFilter=e,this.magFilter=t,this.mipFilter=i,this.addressU=n,this.addressV=r,this.addressW=s,this.maxAnisotropy=a,this.cmpFunc=o}return e.prototype.copy=function(e){return this.minFilter=e.minFilter,this.magFilter=e.magFilter,this.mipFilter=e.mipFilter,this.addressU=e.addressU,this.addressV=e.addressV,this.addressW=e.addressW,this.maxAnisotropy=e.maxAnisotropy,this.cmpFunc=e.cmpFunc,this},e}()),Mr=e("a_",function(){function e(e,t,i){void 0===e&&(e=""),void 0===t&&(t=yn.UNKNOWN),void 0===i&&(i=0),this.name=e,this.type=t,this.count=i}return e.prototype.copy=function(e){return this.name=e.name,this.type=e.type,this.count=e.count,this},e}()),xr=e("a$",function(){function e(e,t,i,n,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=""),void 0===n&&(n=[]),void 0===r&&(r=0),this.set=e,this.binding=t,this.name=i,this.members=n,this.count=r}return e.prototype.copy=function(e){return this.set=e.set,this.binding=e.binding,this.name=e.name,sr(this.members,e.members,Mr),this.count=e.count,this},e}()),Fr=e("b0",function(){function e(e,t,i,n,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=""),void 0===n&&(n=yn.UNKNOWN),void 0===r&&(r=0),this.set=e,this.binding=t,this.name=i,this.type=n,this.count=r}return e.prototype.copy=function(e){return this.set=e.set,this.binding=e.binding,this.name=e.name,this.type=e.type,this.count=e.count,this},e}()),Pr=e("b1",function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=""),void 0===n&&(n=0),this.set=e,this.binding=t,this.name=i,this.count=n}return e.prototype.copy=function(e){return this.set=e.set,this.binding=e.binding,this.name=e.name,this.count=e.count,this},e}()),Dr=e("b2",function(){function e(e,t,i,n,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=""),void 0===n&&(n=yn.UNKNOWN),void 0===r&&(r=0),this.set=e,this.binding=t,this.name=i,this.type=n,this.count=r}return e.prototype.copy=function(e){return this.set=e.set,this.binding=e.binding,this.name=e.name,this.type=e.type,this.count=e.count,this},e}()),Lr=e("b3",function(){function e(e,t,i,n,r,s){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=""),void 0===n&&(n=yn.UNKNOWN),void 0===r&&(r=0),void 0===s&&(s=An.READ_WRITE),this.set=e,this.binding=t,this.name=i,this.type=n,this.count=r,this.memoryAccess=s}return e.prototype.copy=function(e){return this.set=e.set,this.binding=e.binding,this.name=e.name,this.type=e.type,this.count=e.count,this.memoryAccess=e.memoryAccess,this},e}()),Br=e("b4",function(){function e(e,t,i,n,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=""),void 0===n&&(n=0),void 0===r&&(r=An.READ_WRITE),this.set=e,this.binding=t,this.name=i,this.count=n,this.memoryAccess=r}return e.prototype.copy=function(e){return this.set=e.set,this.binding=e.binding,this.name=e.name,this.count=e.count,this.memoryAccess=e.memoryAccess,this},e}()),Ur=e("b5",function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=""),void 0===n&&(n=0),this.set=e,this.binding=t,this.name=i,this.count=n}return e.prototype.copy=function(e){return this.set=e.set,this.binding=e.binding,this.name=e.name,this.count=e.count,this},e}()),Gr=e("b6",function(){function e(e,t){void 0===e&&(e=Bn.NONE),void 0===t&&(t=""),this.stage=e,this.source=t}return e.prototype.copy=function(e){return this.stage=e.stage,this.source=e.source,this},e}()),zr=e("b7",function(){function e(e,t,i,n,r,s){void 0===e&&(e=""),void 0===t&&(t=gn.UNKNOWN),void 0===i&&(i=!1),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=0),this.name=e,this.format=t,this.isNormalized=i,this.stream=n,this.isInstanced=r,this.location=s}return e.prototype.copy=function(e){return this.name=e.name,this.format=e.format,this.isNormalized=e.isNormalized,this.stream=e.stream,this.isInstanced=e.isInstanced,this.location=e.location,this},e}()),kr=e("b8",function(){function e(e,t,i,n,r,s,a,o,u,h){void 0===e&&(e=""),void 0===t&&(t=[]),void 0===i&&(i=[]),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===s&&(s=[]),void 0===a&&(a=[]),void 0===o&&(o=[]),void 0===u&&(u=[]),void 0===h&&(h=[]),this.name=e,this.stages=t,this.attributes=i,this.blocks=n,this.buffers=r,this.samplerTextures=s,this.samplers=a,this.textures=o,this.images=u,this.subpassInputs=h}return e.prototype.copy=function(e){return this.name=e.name,sr(this.stages,e.stages,Gr),sr(this.attributes,e.attributes,zr),sr(this.blocks,e.blocks,xr),sr(this.buffers,e.buffers,Br),sr(this.samplerTextures,e.samplerTextures,Fr),sr(this.samplers,e.samplers,Pr),sr(this.textures,e.textures,Dr),sr(this.images,e.images,Lr),sr(this.subpassInputs,e.subpassInputs,Ur),this},e}()),Hr=e("b9",function(){function e(e,t,i,n){void 0===e&&(e=[]),void 0===t&&(t=[]),void 0===i&&(i=null),void 0===n&&(n=null),this.attributes=e,this.vertexBuffers=t,this.indexBuffer=i,this.indirectBuffer=n}return e.prototype.copy=function(e){return sr(this.attributes,e.attributes,zr),this.vertexBuffers=e.vertexBuffers.slice(),this.indexBuffer=e.indexBuffer,this.indirectBuffer=e.indirectBuffer,this},e}()),Vr=e("ba",function(){function e(e,t,i,n,r,s){void 0===e&&(e=gn.UNKNOWN),void 0===t&&(t=On.ONE),void 0===i&&(i=Un.CLEAR),void 0===n&&(n=Gn.STORE),void 0===r&&(r=null),void 0===s&&(s=!1),this.format=e,this.sampleCount=t,this.loadOp=i,this.storeOp=n,this.barrier=r,this.isGeneralLayout=s}return e.prototype.copy=function(e){return this.format=e.format,this.sampleCount=e.sampleCount,this.loadOp=e.loadOp,this.storeOp=e.storeOp,this.barrier=e.barrier,this.isGeneralLayout=e.isGeneralLayout,this},e}()),Wr=e("bb",function(){function e(e,t,i,n,r,s,a,o){void 0===e&&(e=gn.UNKNOWN),void 0===t&&(t=On.ONE),void 0===i&&(i=Un.CLEAR),void 0===n&&(n=Gn.STORE),void 0===r&&(r=Un.CLEAR),void 0===s&&(s=Gn.STORE),void 0===a&&(a=null),void 0===o&&(o=!1),this.format=e,this.sampleCount=t,this.depthLoadOp=i,this.depthStoreOp=n,this.stencilLoadOp=r,this.stencilStoreOp=s,this.barrier=a,this.isGeneralLayout=o}return e.prototype.copy=function(e){return this.format=e.format,this.sampleCount=e.sampleCount,this.depthLoadOp=e.depthLoadOp,this.depthStoreOp=e.depthStoreOp,this.stencilLoadOp=e.stencilLoadOp,this.stencilStoreOp=e.stencilStoreOp,this.barrier=e.barrier,this.isGeneralLayout=e.isGeneralLayout,this},e}()),jr=e("bc",function(){function e(e,t,i,n,r,s,a,o){void 0===e&&(e=[]),void 0===t&&(t=[]),void 0===i&&(i=[]),void 0===n&&(n=[]),void 0===r&&(r=-1),void 0===s&&(s=-1),void 0===a&&(a=kn.NONE),void 0===o&&(o=kn.NONE),this.inputs=e,this.colors=t,this.resolves=i,this.preserves=n,this.depthStencil=r,this.depthStencilResolve=s,this.depthResolveMode=a,this.stencilResolveMode=o}return e.prototype.copy=function(e){return this.inputs=e.inputs.slice(),this.colors=e.colors.slice(),this.resolves=e.resolves.slice(),this.preserves=e.preserves.slice(),this.depthStencil=e.depthStencil,this.depthStencilResolve=e.depthStencilResolve,this.depthResolveMode=e.depthResolveMode,this.stencilResolveMode=e.stencilResolveMode,this},e}()),Xr=e("bd",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=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===s&&(s=0),void 0===a&&(a=null),void 0===o&&(o=null),void 0===u&&(u=0),this.srcSubpass=e,this.dstSubpass=t,this.generalBarrier=i,this.bufferBarriers=n,this.buffers=r,this.bufferBarrierCount=s,this.textureBarriers=a,this.textures=o,this.textureBarrierCount=u}return e.prototype.copy=function(e){return this.srcSubpass=e.srcSubpass,this.dstSubpass=e.dstSubpass,this.generalBarrier=e.generalBarrier,this.bufferBarriers=e.bufferBarriers,this.buffers=e.buffers,this.bufferBarrierCount=e.bufferBarrierCount,this.textureBarriers=e.textureBarriers,this.textures=e.textures,this.textureBarrierCount=e.textureBarrierCount,this},e}()),Yr=e("be",function(){function e(e,t,i,n){void 0===e&&(e=[]),void 0===t&&(t=new Wr),void 0===i&&(i=[]),void 0===n&&(n=[]),this.colorAttachments=e,this.depthStencilAttachment=t,this.subpasses=i,this.dependencies=n}return e.prototype.copy=function(e){return sr(this.colorAttachments,e.colorAttachments,Vr),this.depthStencilAttachment.copy(e.depthStencilAttachment),sr(this.subpasses,e.subpasses,jr),sr(this.dependencies,e.dependencies,Xr),this},e}()),qr=e("bf",function(){function e(e,t,i){void 0===e&&(e=zn.NONE),void 0===t&&(t=zn.NONE),void 0===i&&(i=er.FULL),this.prevAccesses=e,this.nextAccesses=t,this.type=i}return e.prototype.copy=function(e){return this.prevAccesses=e.prevAccesses,this.nextAccesses=e.nextAccesses,this.type=e.type,this},e}()),Kr=e("bg",function(){function e(e,t,i,n,r,s,a,o,u,h){void 0===e&&(e=zn.NONE),void 0===t&&(t=zn.NONE),void 0===i&&(i=er.FULL),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===a&&(a=1),void 0===o&&(o=!1),void 0===u&&(u=null),void 0===h&&(h=null),this.prevAccesses=e,this.nextAccesses=t,this.type=i,this.baseMipLevel=n,this.levelCount=r,this.baseSlice=s,this.sliceCount=a,this.discardContents=o,this.srcQueue=u,this.dstQueue=h}return e.prototype.copy=function(e){return this.prevAccesses=e.prevAccesses,this.nextAccesses=e.nextAccesses,this.type=e.type,this.baseMipLevel=e.baseMipLevel,this.levelCount=e.levelCount,this.baseSlice=e.baseSlice,this.sliceCount=e.sliceCount,this.discardContents=e.discardContents,this.srcQueue=e.srcQueue,this.dstQueue=e.dstQueue,this},e}()),Qr=e("bh",function(){function e(e,t,i,n,r,s,a,o){void 0===e&&(e=zn.NONE),void 0===t&&(t=zn.NONE),void 0===i&&(i=er.FULL),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=!1),void 0===a&&(a=null),void 0===o&&(o=null),this.prevAccesses=e,this.nextAccesses=t,this.type=i,this.offset=n,this.size=r,this.discardContents=s,this.srcQueue=a,this.dstQueue=o}return e.prototype.copy=function(e){return this.prevAccesses=e.prevAccesses,this.nextAccesses=e.nextAccesses,this.type=e.type,this.offset=e.offset,this.size=e.size,this.discardContents=e.discardContents,this.srcQueue=e.srcQueue,this.dstQueue=e.dstQueue,this},e}()),Zr=e("bi",function(){function e(e,t,i){void 0===e&&(e=null),void 0===t&&(t=[]),void 0===i&&(i=null),this.renderPass=e,this.colorTextures=t,this.depthStencilTexture=i}return e.prototype.copy=function(e){return this.renderPass=e.renderPass,this.colorTextures=e.colorTextures.slice(),this.depthStencilTexture=e.depthStencilTexture,this},e}()),Jr=e("bj",function(){function e(e,t,i,n,r){void 0===e&&(e=-1),void 0===t&&(t=Kn.UNKNOWN),void 0===i&&(i=0),void 0===n&&(n=Bn.NONE),void 0===r&&(r=[]),this.binding=e,this.descriptorType=t,this.count=i,this.stageFlags=n,this.immutableSamplers=r}return e.prototype.copy=function(e){return this.binding=e.binding,this.descriptorType=e.descriptorType,this.count=e.count,this.stageFlags=e.stageFlags,this.immutableSamplers=e.immutableSamplers.slice(),this},e}()),$r=e("bk",function(){function e(e){void 0===e&&(e=[]),this.bindings=e}return e.prototype.copy=function(e){return sr(this.bindings,e.bindings,Jr),this},e}()),es=e("bl",function(){function e(e){void 0===e&&(e=null),this.layout=e}return e.prototype.copy=function(e){return this.layout=e.layout,this},e}()),ts=e("bm",function(){function e(e){void 0===e&&(e=[]),this.setLayouts=e}return e.prototype.copy=function(e){return this.setLayouts=e.setLayouts.slice(),this},e}()),is=e("bn",function(){function e(e){void 0===e&&(e=[]),this.attributes=e}return e.prototype.copy=function(e){return sr(this.attributes,e.attributes,zr),this},e}()),ns=e("bo",function(){function e(e,t){void 0===e&&(e=null),void 0===t&&(t=Jn.PRIMARY),this.queue=e,this.type=t}return e.prototype.copy=function(e){return this.queue=e.queue,this.type=e.type,this},e}()),rs=e("bp",function(){function e(e){void 0===e&&(e=Qn.GRAPHICS),this.type=e}return e.prototype.copy=function(e){return this.type=e.type,this},e}()),ss=e("bq",function(){function e(e,t,i){void 0===e&&(e=Zn.OCCLUSION),void 0===t&&(t=32767),void 0===i&&(i=!0),this.type=e,this.maxQueryObjects=t,this.forceWait=i}return e.prototype.copy=function(e){return this.type=e.type,this.maxQueryObjects=e.maxQueryObjects,this.forceWait=e.forceWait,this},e}()),as=e("br",(function(e,t,i,n,r,s,a,o){void 0===e&&(e=""),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=vn.NONE),void 0===r&&(r=!1),void 0===s&&(s=!1),void 0===a&&(a=!1),void 0===o&&(o=!1),this.name=e,this.size=t,this.count=i,this.type=n,this.hasAlpha=r,this.hasDepth=s,this.hasStencil=a,this.isCompressed=o})),os=e("bs",function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=0),this.bufferSize=e,this.textureSize=t}return e.prototype.copy=function(e){return this.bufferSize=e.bufferSize,this.textureSize=e.textureSize,this},e}()),us=e("bt",function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this.writeMask=e,this.compareMask=t,this.reference=i}return e.prototype.copy=function(e){return this.writeMask=e.writeMask,this.compareMask=e.compareMask,this.reference=e.reference,this},e}()),hs=e("bu",function(){function e(e,t,i,n,r,s,a,o,u,h,c){void 0===e&&(e=new vr),void 0===t&&(t=new lr),void 0===i&&(i=new yr),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=new us),void 0===c&&(c=new us),this.viewport=e,this.scissor=t,this.blendConstant=i,this.lineWidth=n,this.depthBiasConstant=r,this.depthBiasClamp=s,this.depthBiasSlope=a,this.depthMinBounds=o,this.depthMaxBounds=u,this.stencilStatesFront=h,this.stencilStatesBack=c}return e.prototype.copy=function(e){return this.viewport.copy(e.viewport),this.scissor.copy(e.scissor),this.blendConstant.copy(e.blendConstant),this.lineWidth=e.lineWidth,this.depthBiasConstant=e.depthBiasConstant,this.depthBiasClamp=e.depthBiasClamp,this.depthBiasSlope=e.depthBiasSlope,this.depthMinBounds=e.depthMinBounds,this.depthMaxBounds=e.depthMaxBounds,this.stencilStatesFront.copy(e.stencilStatesFront),this.stencilStatesBack.copy(e.stencilStatesBack),this},e}()),cs=e("bv",function(e){function t(i){var n;return(n=e.call(this)||this)._objectType=_n.UNKNOWN,n._objectID=0,n._typedID=0,n._objectType=i,n._objectID=t._idTable[_n.UNKNOWN]++,n._typedID=t._idTable[i]++,n}return _(t,e),c(t,[{key:"objectType",get:function(){return this._objectType}},{key:"objectID",get:function(){return this._objectID}},{key:"typedID",get:function(){return this._typedID}}]),t}(rr));cs._idTable=Array(_n.COUNT).fill(65536),function(e){e.ATTR_POSITION="a_position",e.ATTR_NORMAL="a_normal",e.ATTR_TANGENT="a_tangent",e.ATTR_BITANGENT="a_bitangent",e.ATTR_WEIGHTS="a_weights",e.ATTR_JOINTS="a_joints",e.ATTR_COLOR="a_color",e.ATTR_COLOR1="a_color1",e.ATTR_COLOR2="a_color2",e.ATTR_TEX_COORD="a_texCoord",e.ATTR_TEX_COORD1="a_texCoord1",e.ATTR_TEX_COORD2="a_texCoord2",e.ATTR_TEX_COORD3="a_texCoord3",e.ATTR_TEX_COORD4="a_texCoord4",e.ATTR_TEX_COORD5="a_texCoord5",e.ATTR_TEX_COORD6="a_texCoord6",e.ATTR_TEX_COORD7="a_texCoord7",e.ATTR_TEX_COORD8="a_texCoord8",e.ATTR_BATCH_ID="a_batch_id",e.ATTR_BATCH_UV="a_batch_uv"}(ar||(ar=e("bw",{})));var ls=e("bx",Object.freeze([new as("UNKNOWN",0,0,vn.NONE,!1,!1,!1,!1),new as("A8",1,1,vn.UNORM,!0,!1,!1,!1),new as("L8",1,1,vn.UNORM,!1,!1,!1,!1),new as("LA8",1,2,vn.UNORM,!0,!1,!1,!1),new as("R8",1,1,vn.UNORM,!1,!1,!1,!1),new as("R8SN",1,1,vn.SNORM,!1,!1,!1,!1),new as("R8UI",1,1,vn.UINT,!1,!1,!1,!1),new as("R8I",1,1,vn.INT,!1,!1,!1,!1),new as("R16F",2,1,vn.FLOAT,!1,!1,!1,!1),new as("R16UI",2,1,vn.UINT,!1,!1,!1,!1),new as("R16I",2,1,vn.INT,!1,!1,!1,!1),new as("R32F",4,1,vn.FLOAT,!1,!1,!1,!1),new as("R32UI",4,1,vn.UINT,!1,!1,!1,!1),new as("R32I",4,1,vn.INT,!1,!1,!1,!1),new as("RG8",2,2,vn.UNORM,!1,!1,!1,!1),new as("RG8SN",2,2,vn.SNORM,!1,!1,!1,!1),new as("RG8UI",2,2,vn.UINT,!1,!1,!1,!1),new as("RG8I",2,2,vn.INT,!1,!1,!1,!1),new as("RG16F",4,2,vn.FLOAT,!1,!1,!1,!1),new as("RG16UI",4,2,vn.UINT,!1,!1,!1,!1),new as("RG16I",4,2,vn.INT,!1,!1,!1,!1),new as("RG32F",8,2,vn.FLOAT,!1,!1,!1,!1),new as("RG32UI",8,2,vn.UINT,!1,!1,!1,!1),new as("RG32I",8,2,vn.INT,!1,!1,!1,!1),new as("RGB8",3,3,vn.UNORM,!1,!1,!1,!1),new as("SRGB8",3,3,vn.UNORM,!1,!1,!1,!1),new as("RGB8SN",3,3,vn.SNORM,!1,!1,!1,!1),new as("RGB8UI",3,3,vn.UINT,!1,!1,!1,!1),new as("RGB8I",3,3,vn.INT,!1,!1,!1,!1),new as("RGB16F",6,3,vn.FLOAT,!1,!1,!1,!1),new as("RGB16UI",6,3,vn.UINT,!1,!1,!1,!1),new as("RGB16I",6,3,vn.INT,!1,!1,!1,!1),new as("RGB32F",12,3,vn.FLOAT,!1,!1,!1,!1),new as("RGB32UI",12,3,vn.UINT,!1,!1,!1,!1),new as("RGB32I",12,3,vn.INT,!1,!1,!1,!1),new as("RGBA8",4,4,vn.UNORM,!0,!1,!1,!1),new as("BGRA8",4,4,vn.UNORM,!0,!1,!1,!1),new as("SRGB8_A8",4,4,vn.UNORM,!0,!1,!1,!1),new as("RGBA8SN",4,4,vn.SNORM,!0,!1,!1,!1),new as("RGBA8UI",4,4,vn.UINT,!0,!1,!1,!1),new as("RGBA8I",4,4,vn.INT,!0,!1,!1,!1),new as("RGBA16F",8,4,vn.FLOAT,!0,!1,!1,!1),new as("RGBA16UI",8,4,vn.UINT,!0,!1,!1,!1),new as("RGBA16I",8,4,vn.INT,!0,!1,!1,!1),new as("RGBA32F",16,4,vn.FLOAT,!0,!1,!1,!1),new as("RGBA32UI",16,4,vn.UINT,!0,!1,!1,!1),new as("RGBA32I",16,4,vn.INT,!0,!1,!1,!1),new as("R5G6B5",2,3,vn.UNORM,!1,!1,!1,!1),new as("R11G11B10F",4,3,vn.FLOAT,!1,!1,!1,!1),new as("RGB5A1",2,4,vn.UNORM,!0,!1,!1,!1),new as("RGBA4",2,4,vn.UNORM,!0,!1,!1,!1),new as("RGB10A2",2,4,vn.UNORM,!0,!1,!1,!1),new as("RGB10A2UI",2,4,vn.UINT,!0,!1,!1,!1),new as("RGB9E5",2,4,vn.FLOAT,!0,!1,!1,!1),new as("DEPTH",4,1,vn.FLOAT,!1,!0,!1,!1),new as("DEPTH_STENCIL",5,2,vn.FLOAT,!1,!0,!0,!1),new as("BC1",1,3,vn.UNORM,!1,!1,!1,!0),new as("BC1_ALPHA",1,4,vn.UNORM,!0,!1,!1,!0),new as("BC1_SRGB",1,3,vn.UNORM,!1,!1,!1,!0),new as("BC1_SRGB_ALPHA",1,4,vn.UNORM,!0,!1,!1,!0),new as("BC2",1,4,vn.UNORM,!0,!1,!1,!0),new as("BC2_SRGB",1,4,vn.UNORM,!0,!1,!1,!0),new as("BC3",1,4,vn.UNORM,!0,!1,!1,!0),new as("BC3_SRGB",1,4,vn.UNORM,!0,!1,!1,!0),new as("BC4",1,1,vn.UNORM,!1,!1,!1,!0),new as("BC4_SNORM",1,1,vn.SNORM,!1,!1,!1,!0),new as("BC5",1,2,vn.UNORM,!1,!1,!1,!0),new as("BC5_SNORM",1,2,vn.SNORM,!1,!1,!1,!0),new as("BC6H_UF16",1,3,vn.UFLOAT,!1,!1,!1,!0),new as("BC6H_SF16",1,3,vn.FLOAT,!1,!1,!1,!0),new as("BC7",1,4,vn.UNORM,!0,!1,!1,!0),new as("BC7_SRGB",1,4,vn.UNORM,!0,!1,!1,!0),new as("ETC_RGB8",1,3,vn.UNORM,!1,!1,!1,!0),new as("ETC2_RGB8",1,3,vn.UNORM,!1,!1,!1,!0),new as("ETC2_SRGB8",1,3,vn.UNORM,!1,!1,!1,!0),new as("ETC2_RGB8_A1",1,4,vn.UNORM,!0,!1,!1,!0),new as("ETC2_SRGB8_A1",1,4,vn.UNORM,!0,!1,!1,!0),new as("ETC2_RGBA8",2,4,vn.UNORM,!0,!1,!1,!0),new as("ETC2_SRGB8_A8",2,4,vn.UNORM,!0,!1,!1,!0),new as("EAC_R11",1,1,vn.UNORM,!1,!1,!1,!0),new as("EAC_R11SN",1,1,vn.SNORM,!1,!1,!1,!0),new as("EAC_RG11",2,2,vn.UNORM,!1,!1,!1,!0),new as("EAC_RG11SN",2,2,vn.SNORM,!1,!1,!1,!0),new as("PVRTC_RGB2",2,3,vn.UNORM,!1,!1,!1,!0),new as("PVRTC_RGBA2",2,4,vn.UNORM,!0,!1,!1,!0),new as("PVRTC_RGB4",2,3,vn.UNORM,!1,!1,!1,!0),new as("PVRTC_RGBA4",2,4,vn.UNORM,!0,!1,!1,!0),new as("PVRTC2_2BPP",2,4,vn.UNORM,!0,!1,!1,!0),new as("PVRTC2_4BPP",2,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_RGBA_4x4",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_RGBA_5x4",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_RGBA_5x5",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_RGBA_6x5",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_RGBA_6x6",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_RGBA_8x5",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_RGBA_8x6",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_RGBA_8x8",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_RGBA_10x5",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_RGBA_10x6",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_RGBA_10x8",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_RGBA_10x10",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_RGBA_12x10",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_RGBA_12x12",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_SRGBA_4x4",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_SRGBA_5x4",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_SRGBA_5x5",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_SRGBA_6x5",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_SRGBA_6x6",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_SRGBA_8x5",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_SRGBA_8x6",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_SRGBA_8x8",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_SRGBA_10x5",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_SRGBA_10x6",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_SRGBA_10x8",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_SRGBA_10x10",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_SRGBA_12x10",1,4,vn.UNORM,!0,!1,!1,!0),new as("ASTC_SRGBA_12x12",1,4,vn.UNORM,!0,!1,!1,!0)])),_s=e("by",Kn.UNIFORM_BUFFER|Kn.DYNAMIC_UNIFORM_BUFFER|Kn.STORAGE_BUFFER|Kn.DYNAMIC_STORAGE_BUFFER),fs=e("bz",Kn.SAMPLER_TEXTURE|Kn.SAMPLER|Kn.TEXTURE|Kn.STORAGE_IMAGE|Kn.INPUT_ATTACHMENT),ds=e("bA",Kn.DYNAMIC_STORAGE_BUFFER|Kn.DYNAMIC_UNIFORM_BUFFER),ps=e("bB",28);function ms(e){return e>0&&0==(e&e-1)}function gs(e,t,i,n){if(!ls[e].isCompressed)return t*i*n*ls[e].size;switch(e){case gn.BC1:case gn.BC1_ALPHA:case gn.BC1_SRGB:case gn.BC1_SRGB_ALPHA:return Math.ceil(t/4)*Math.ceil(i/4)*8*n;case gn.BC2:case gn.BC2_SRGB:case gn.BC3:case gn.BC3_SRGB:case gn.BC4:case gn.BC4_SNORM:case gn.BC6H_SF16:case gn.BC6H_UF16:case gn.BC7:case gn.BC7_SRGB:return Math.ceil(t/4)*Math.ceil(i/4)*16*n;case gn.BC5:case gn.BC5_SNORM:return Math.ceil(t/4)*Math.ceil(i/4)*32*n;case gn.ETC_RGB8:case gn.ETC2_RGB8:case gn.ETC2_SRGB8:case gn.ETC2_RGB8_A1:case gn.EAC_R11:case gn.EAC_R11SN:return Math.ceil(t/4)*Math.ceil(i/4)*8*n;case gn.ETC2_RGBA8:case gn.ETC2_SRGB8_A1:case gn.EAC_RG11:case gn.EAC_RG11SN:return Math.ceil(t/4)*Math.ceil(i/4)*16*n;case gn.PVRTC_RGB2:case gn.PVRTC_RGBA2:case gn.PVRTC2_2BPP:return Math.ceil(t/8)*Math.ceil(i/4)*8*n;case gn.PVRTC_RGB4:case gn.PVRTC_RGBA4:case gn.PVRTC2_4BPP:return Math.ceil(t/4)*Math.ceil(i/4)*8*n;case gn.ASTC_RGBA_4X4:case gn.ASTC_SRGBA_4X4:return Math.ceil(t/4)*Math.ceil(i/4)*16*n;case gn.ASTC_RGBA_5X4:case gn.ASTC_SRGBA_5X4:return Math.ceil(t/5)*Math.ceil(i/4)*16*n;case gn.ASTC_RGBA_5X5:case gn.ASTC_SRGBA_5X5:return Math.ceil(t/5)*Math.ceil(i/5)*16*n;case gn.ASTC_RGBA_6X5:case gn.ASTC_SRGBA_6X5:return Math.ceil(t/6)*Math.ceil(i/5)*16*n;case gn.ASTC_RGBA_6X6:case gn.ASTC_SRGBA_6X6:return Math.ceil(t/6)*Math.ceil(i/6)*16*n;case gn.ASTC_RGBA_8X5:case gn.ASTC_SRGBA_8X5:return Math.ceil(t/8)*Math.ceil(i/5)*16*n;case gn.ASTC_RGBA_8X6:case gn.ASTC_SRGBA_8X6:return Math.ceil(t/8)*Math.ceil(i/6)*16*n;case gn.ASTC_RGBA_8X8:case gn.ASTC_SRGBA_8X8:return Math.ceil(t/8)*Math.ceil(i/8)*16*n;case gn.ASTC_RGBA_10X5:case gn.ASTC_SRGBA_10X5:return Math.ceil(t/10)*Math.ceil(i/5)*16*n;case gn.ASTC_RGBA_10X6:case gn.ASTC_SRGBA_10X6:return Math.ceil(t/10)*Math.ceil(i/6)*16*n;case gn.ASTC_RGBA_10X8:case gn.ASTC_SRGBA_10X8:return Math.ceil(t/10)*Math.ceil(i/8)*16*n;case gn.ASTC_RGBA_10X10:case gn.ASTC_SRGBA_10X10:return Math.ceil(t/10)*Math.ceil(i/10)*16*n;case gn.ASTC_RGBA_12X10:case gn.ASTC_SRGBA_12X10:return Math.ceil(t/12)*Math.ceil(i/10)*16*n;case gn.ASTC_RGBA_12X12:case gn.ASTC_SRGBA_12X12:return Math.ceil(t/12)*Math.ceil(i/12)*16*n;default:return 0}}function vs(e,t,i,n,r){for(var s=0,a=0;a<r;++a)s+=gs(e,t,i,n),t=Math.max(t>>1,1),i=Math.max(i>>1,1);return s}var ys=[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 Es(e){return ys[e]||0}function Ts(e){if(e.isCompressed)return Uint8Array;var t=e.size/e.count;switch(e.type){case vn.UNORM:case vn.UINT:switch(t){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}case vn.SNORM:case vn.INT:switch(t){case 1:return Int8Array;case 2:return Int16Array;case 4:return Int32Array;default:return Int8Array}case vn.FLOAT:return Float32Array}return Float32Array}function As(e){switch(e){case gn.BC1:case gn.BC1_ALPHA:case gn.BC1_SRGB:case gn.BC1_SRGB_ALPHA:case gn.BC2:case gn.BC2_SRGB:case gn.BC3:case gn.BC3_SRGB:case gn.BC4:case gn.BC4_SNORM:case gn.BC6H_SF16:case gn.BC6H_UF16:case gn.BC7:case gn.BC7_SRGB:case gn.BC5:case gn.BC5_SNORM:case gn.ETC_RGB8:case gn.ETC2_RGB8:case gn.ETC2_SRGB8:case gn.ETC2_RGB8_A1:case gn.EAC_R11:case gn.EAC_R11SN:case gn.ETC2_RGBA8:case gn.ETC2_SRGB8_A1:case gn.EAC_RG11:case gn.EAC_RG11SN:return{width:4,height:4};case gn.PVRTC_RGB2:case gn.PVRTC_RGBA2:case gn.PVRTC2_2BPP:return{width:8,height:4};case gn.PVRTC_RGB4:case gn.PVRTC_RGBA4:case gn.PVRTC2_4BPP:return{width:4,height:4};case gn.ASTC_RGBA_4X4:case gn.ASTC_SRGBA_4X4:return{width:4,height:4};case gn.ASTC_RGBA_5X4:case gn.ASTC_SRGBA_5X4:return{width:5,height:4};case gn.ASTC_RGBA_5X5:case gn.ASTC_SRGBA_5X5:return{width:5,height:5};case gn.ASTC_RGBA_6X5:case gn.ASTC_SRGBA_6X5:return{width:6,height:5};case gn.ASTC_RGBA_6X6:case gn.ASTC_SRGBA_6X6:return{width:6,height:6};case gn.ASTC_RGBA_8X5:case gn.ASTC_SRGBA_8X5:return{width:8,height:5};case gn.ASTC_RGBA_8X6:case gn.ASTC_SRGBA_8X6:return{width:8,height:6};case gn.ASTC_RGBA_8X8:case gn.ASTC_SRGBA_8X8:return{width:8,height:8};case gn.ASTC_RGBA_10X5:case gn.ASTC_SRGBA_10X5:return{width:10,height:5};case gn.ASTC_RGBA_10X6:case gn.ASTC_SRGBA_10X6:return{width:10,height:6};case gn.ASTC_RGBA_10X8:case gn.ASTC_SRGBA_10X8:return{width:10,height:8};case gn.ASTC_RGBA_10X10:case gn.ASTC_SRGBA_10X10:return{width:10,height:10};case gn.ASTC_RGBA_12X10:case gn.ASTC_SRGBA_12X10:return{width:12,height:10};case gn.ASTC_RGBA_12X12:case gn.ASTC_SRGBA_12X12:return{width:12,height:12};default:return{width:1,height:1}}}function Ss(e,t){return Math.ceil(e/t)*t}var bs=Object.freeze({__proto__:null,get ObjectType(){return _n},get Status(){return fn},get API(){return dn},get SurfaceTransform(){return pn},get Feature(){return mn},get Format(){return gn},get FormatType(){return vn},get Type(){return yn},get BufferUsageBit(){return En},get BufferFlagBit(){return Tn},get MemoryAccessBit(){return An},get MemoryUsageBit(){return Sn},get TextureType(){return bn},get TextureUsageBit(){return wn},get TextureFlagBit(){return Rn},get FormatFeatureBit(){return In},get SampleCount(){return On},get VsyncMode(){return Nn},get Filter(){return Cn},get Address(){return Mn},get ComparisonFunc(){return xn},get StencilOp(){return Fn},get BlendFactor(){return Pn},get BlendOp(){return Dn},get ColorMask(){return Ln},get ShaderStageFlagBit(){return Bn},get LoadOp(){return Un},get StoreOp(){return Gn},get AccessFlagBit(){return zn},get ResolveMode(){return kn},get PipelineBindPoint(){return Hn},get PrimitiveMode(){return Vn},get PolygonMode(){return Wn},get ShadeModel(){return jn},get CullMode(){return Xn},get DynamicStateFlagBit(){return Yn},get StencilFace(){return qn},get DescriptorType(){return Kn},get QueueType(){return Qn},get QueryType(){return Zn},get CommandBufferType(){return Jn},get ClearFlagBit(){return $n},get BarrierType(){return er},get PassType(){return tr},Size:or,DeviceCaps:ur,DeviceOptions:hr,Offset:cr,Rect:lr,Extent:_r,TextureSubresLayers:fr,TextureSubresRange:dr,TextureCopy:pr,TextureBlit:mr,BufferTextureCopy:gr,Viewport:vr,Color:yr,BindingMappingInfo:Er,SwapchainInfo:Tr,DeviceInfo:Ar,BufferInfo:Sr,BufferViewInfo:br,DrawInfo:wr,DispatchInfo:Rr,IndirectBuffer:Ir,TextureInfo:Or,TextureViewInfo:Nr,SamplerInfo:Cr,Uniform:Mr,UniformBlock:xr,UniformSamplerTexture:Fr,UniformSampler:Pr,UniformTexture:Dr,UniformStorageImage:Lr,UniformStorageBuffer:Br,UniformInputAttachment:Ur,ShaderStage:Gr,Attribute:zr,ShaderInfo:kr,InputAssemblerInfo:Hr,ColorAttachment:Vr,DepthStencilAttachment:Wr,SubpassInfo:jr,SubpassDependency:Xr,RenderPassInfo:Yr,GeneralBarrierInfo:qr,TextureBarrierInfo:Kr,BufferBarrierInfo:Qr,FramebufferInfo:Zr,DescriptorSetLayoutBinding:Jr,DescriptorSetLayoutInfo:$r,DescriptorSetInfo:es,PipelineLayoutInfo:ts,InputState:is,CommandBufferInfo:ns,QueueInfo:rs,QueryPoolInfo:ss,FormatInfo:as,MemoryStatus:os,DynamicStencilStates:us,DynamicStates:hs,GFXObject:cs,get AttributeName(){return ar},FormatInfos:ls,DESCRIPTOR_BUFFER_TYPE:_s,DESCRIPTOR_SAMPLER_TYPE:fs,DESCRIPTOR_DYNAMIC_TYPE:ds,DRAW_INFO_SIZE:ps,IsPowerOf2:ms,FormatSize:gs,FormatSurfaceSize:vs,GetTypeSize:Es,getTypedArrayConstructor:Ts,formatAlignment:As,alignTo:Ss}),ws=e("T",function(e){function t(){var t;return(t=e.call(this,_n.BUFFER)||this)._usage=En.NONE,t._memUsage=Sn.NONE,t._size=0,t._stride=1,t._count=0,t._flags=Tn.NONE,t._isBufferView=!1,t}return _(t,e),c(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}(cs)),Rs=e("U",function(e){function t(){var t;return(t=e.call(this,_n.COMMAND_BUFFER)||this)._queue=null,t._type=Jn.PRIMARY,t._numDrawCalls=0,t._numInstances=0,t._numTris=0,t}return _(t,e),c(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}(cs)),Is=e("bJ",function(){function e(){this._gfxAPI=dn.UNKNOWN,this._renderer="",this._vendor="",this._features=new Array(mn.COUNT),this._formatFeatures=new Array(gn.COUNT),this._queue=null,this._cmdBuff=null,this._numDrawCalls=0,this._numInstances=0,this._numTris=0,this._memoryStatus=new os,this._caps=new ur,this._bindingMappingInfo=new Er,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]},c(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}());Is.canvas=void 0;var Os=e("bK",function(e){function t(){var t;return(t=e.call(this,_n.SWAPCHAIN)||this)._transform=pn.IDENTITY,t._colorTexture=null,t._depthStencilTexture=null,t}return _(t,e),c(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}(cs)),Ns=e("bL",function(e){function t(){var t;return(t=e.call(this,_n.FRAMEBUFFER)||this)._renderPass=null,t._colorTextures=[],t._depthStencilTexture=null,t}return _(t,e),c(t,[{key:"renderPass",get:function(){return this._renderPass}},{key:"colorTextures",get:function(){return this._colorTextures}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}}]),t}(cs)),Cs=String.prototype.charCodeAt;function Ms(e){return this[e]}function xs(e,t){for(var i=e.length,n=t^i,r=0,s="string"==typeof e?Cs:Ms;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}var Fs=e("bM",function(e){function t(){var t;return(t=e.call(this,_n.INPUT_ASSEMBLER)||this)._attributes=[],t._attributesHash=0,t._vertexBuffers=[],t._indexBuffer=null,t._indirectBuffer=null,t._drawInfo=new wr,t}_(t,e);var i=t.prototype;return i.getVertexBuffer=function(e){return void 0===e&&(e=0),e<this._vertexBuffers.length?this._vertexBuffers[e]:null},i.computeAttributesHash=function(){for(var e="attrs",t=0;t<this.attributes.length;++t){var i=this.attributes[t];e+=","+i.name+","+i.format+","+i.isNormalized+","+i.stream+","+i.isInstanced+","+i.location}return xs(e,666)},c(t,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexBuffers",get:function(){return this._vertexBuffers}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"indirectBuffer",get:function(){return this._indirectBuffer}},{key:"attributesHash",get:function(){return this._attributesHash}},{key:"vertexCount",get:function(){return this._drawInfo.vertexCount},set:function(e){this._drawInfo.vertexCount=e}},{key:"firstVertex",get:function(){return this._drawInfo.firstVertex},set:function(e){this._drawInfo.firstVertex=e}},{key:"indexCount",get:function(){return this._drawInfo.indexCount},set:function(e){this._drawInfo.indexCount=e}},{key:"firstIndex",get:function(){return this._drawInfo.firstIndex},set:function(e){this._drawInfo.firstIndex=e}},{key:"vertexOffset",get:function(){return this._drawInfo.vertexOffset},set:function(e){this._drawInfo.vertexOffset=e}},{key:"instanceCount",get:function(){return this._drawInfo.instanceCount},set:function(e){this._drawInfo.instanceCount=e}},{key:"firstInstance",get:function(){return this._drawInfo.firstInstance},set:function(e){this._drawInfo.firstInstance=e}},{key:"drawInfo",get:function(){return this._drawInfo},set:function(e){this._drawInfo=e}}]),t}(cs)),Ps=e("O",function(e){function t(){var t;return(t=e.call(this,_n.DESCRIPTOR_SET)||this)._layout=null,t._buffers=[],t._textures=[],t._samplers=[],t._isDirty=!1,t}_(t,e);var i=t.prototype;return i.bindBuffer=function(e,t,i){void 0===i&&(i=0);var n=this._layout.bindingIndices[e],r=this._layout.bindings[n];if(r&&r.descriptorType&_s){var s=this._layout.descriptorIndices[e];this._buffers[s+i]!==t&&(this._buffers[s+i]=t,this._isDirty=!0)}},i.bindSampler=function(e,t,i){void 0===i&&(i=0);var n=this._layout.bindingIndices[e],r=this._layout.bindings[n];if(r&&r.descriptorType&fs){var s=this._layout.descriptorIndices[e];this._samplers[s+i]!==t&&(this._samplers[s+i]=t,this._isDirty=!0)}},i.bindTexture=function(e,t,i){void 0===i&&(i=0);var n=this._layout.bindingIndices[e],r=this._layout.bindings[n];if(r&&r.descriptorType&fs){var s=this._layout.descriptorIndices[e];this._textures[s+i]!==t&&(this._textures[s+i]=t,this._isDirty=!0)}},i.getBuffer=function(e,t){void 0===t&&(t=0);var i=this._layout.descriptorIndices[e];return this._buffers[i+t]},i.getSampler=function(e,t){void 0===t&&(t=0);var i=this._layout.descriptorIndices[e];return this._samplers[i+t]},i.getTexture=function(e,t){void 0===t&&(t=0);var i=this._layout.descriptorIndices[e];return this._textures[i+t]},c(t,[{key:"layout",get:function(){return this._layout}}]),t}(cs)),Ds=e("bN",function(e){function t(){var t;return(t=e.call(this,_n.DESCRIPTOR_SET_LAYOUT)||this)._bindings=[],t._bindingIndices=[],t._descriptorIndices=[],t}return _(t,e),c(t,[{key:"bindings",get:function(){return this._bindings}},{key:"bindingIndices",get:function(){return this._bindingIndices}},{key:"descriptorIndices",get:function(){return this._descriptorIndices}}]),t}(cs)),Ls=e("bO",function(e){function t(){var t;return(t=e.call(this,_n.PIPELINE_LAYOUT)||this)._setLayouts=[],t}return _(t,e),c(t,[{key:"setLayouts",get:function(){return this._setLayouts}}]),t}(cs)),Bs=e("bP",function(){function e(e,t,i,n,r,s,a,o,u,h,c,l){void 0===e&&(e=!1),void 0===t&&(t=Wn.FILL),void 0===i&&(i=jn.GOURAND),void 0===n&&(n=Xn.BACK),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=1),this.isDiscard=e,this.polygonMode=t,this.shadeModel=i,this.cullMode=n,this.isFrontFaceCCW=r,this.depthBiasEnabled=s,this.depthBias=a,this.depthBiasClamp=o,this.depthBiasSlop=u,this.isDepthClip=h,this.isMultisample=c,this.lineWidth=l}var t=e.prototype;return t.reset=function(){this.isDiscard=!1,this.polygonMode=Wn.FILL,this.shadeModel=jn.GOURAND,this.cullMode=Xn.BACK,this.isFrontFaceCCW=!0,this.depthBiasEnabled=!1,this.depthBias=0,this.depthBiasClamp=0,this.depthBiasSlop=0,this.isDepthClip=!0,this.isMultisample=!1,this.lineWidth=1},t.assign=function(e){Object.assign(this,e)},t.destroy=function(){},c(e,[{key:"native",get:function(){return this}}]),e}()),Us=e("bQ",function(){function e(e,t,i,n,r,s,a,o,u,h,c,l,_,f,d,p,m,g,v){void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===i&&(i=xn.LESS),void 0===n&&(n=!1),void 0===r&&(r=xn.ALWAYS),void 0===s&&(s=65535),void 0===a&&(a=65535),void 0===o&&(o=Fn.KEEP),void 0===u&&(u=Fn.KEEP),void 0===h&&(h=Fn.KEEP),void 0===c&&(c=1),void 0===l&&(l=!1),void 0===_&&(_=xn.ALWAYS),void 0===f&&(f=65535),void 0===d&&(d=65535),void 0===p&&(p=Fn.KEEP),void 0===m&&(m=Fn.KEEP),void 0===g&&(g=Fn.KEEP),void 0===v&&(v=1),this.depthTest=e,this.depthWrite=t,this.depthFunc=i,this.stencilTestFront=n,this.stencilFuncFront=r,this.stencilReadMaskFront=s,this.stencilWriteMaskFront=a,this.stencilFailOpFront=o,this.stencilZFailOpFront=u,this.stencilPassOpFront=h,this.stencilRefFront=c,this.stencilTestBack=l,this.stencilFuncBack=_,this.stencilReadMaskBack=f,this.stencilWriteMaskBack=d,this.stencilFailOpBack=p,this.stencilZFailOpBack=m,this.stencilPassOpBack=g,this.stencilRefBack=v}var t=e.prototype;return t.reset=function(){this.depthTest=!0,this.depthWrite=!0,this.depthFunc=xn.LESS,this.stencilTestFront=!1,this.stencilFuncFront=xn.ALWAYS,this.stencilReadMaskFront=65535,this.stencilWriteMaskFront=65535,this.stencilFailOpFront=Fn.KEEP,this.stencilZFailOpFront=Fn.KEEP,this.stencilPassOpFront=Fn.KEEP,this.stencilRefFront=1,this.stencilTestBack=!1,this.stencilFuncBack=xn.ALWAYS,this.stencilReadMaskBack=65535,this.stencilWriteMaskBack=65535,this.stencilFailOpBack=Fn.KEEP,this.stencilZFailOpBack=Fn.KEEP,this.stencilPassOpBack=Fn.KEEP,this.stencilRefBack=1},t.assign=function(e){Object.assign(this,e)},t.destroy=function(){},c(e,[{key:"native",get:function(){return this}}]),e}()),Gs=e("bR",function(){function e(e,t,i,n,r,s,a,o){void 0===e&&(e=!1),void 0===t&&(t=Pn.ONE),void 0===i&&(i=Pn.ZERO),void 0===n&&(n=Dn.ADD),void 0===r&&(r=Pn.ONE),void 0===s&&(s=Pn.ZERO),void 0===a&&(a=Dn.ADD),void 0===o&&(o=Ln.ALL),this.blend=e,this.blendSrc=t,this.blendDst=i,this.blendEq=n,this.blendSrcAlpha=r,this.blendDstAlpha=s,this.blendAlphaEq=a,this.blendColorMask=o}var t=e.prototype;return t.reset=function(){this.blend=!1,this.blendSrc=Pn.ONE,this.blendDst=Pn.ZERO,this.blendEq=Dn.ADD,this.blendSrcAlpha=Pn.ONE,this.blendDstAlpha=Pn.ZERO,this.blendAlphaEq=Dn.ADD,this.blendColorMask=Ln.ALL},t.assign=function(e){Object.assign(this,e)},t.destroy=function(){},e}()),zs=e("bS",function(){function e(e,t,i,n){void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=new yr),void 0===n&&(n=[new Gs]),this.isA2C=e,this.isIndepend=t,this.blendColor=i,this.targets=n}var t=e.prototype;return t.setTarget=function(e,t){var i=this.targets[e];i||(i=this.targets[e]=new Gs),Object.assign(i,t)},t.reset=function(){this.isA2C=!1,this.isIndepend=!1,this.blendColor.x=0,this.blendColor.y=0,this.blendColor.z=0,this.blendColor.w=0,this.targets.length=1,this.targets[0].reset()},t.destroy=function(){},c(e,[{key:"native",get:function(){return this}}]),e}()),ks=e("bT",(function(e,t,i,n,r,s,a,o,u,h){void 0===e&&(e=null),void 0===t&&(t=null),void 0===i&&(i=null),void 0===n&&(n=new is),void 0===r&&(r=new Bs),void 0===s&&(s=new Us),void 0===a&&(a=new zs),void 0===o&&(o=Vn.TRIANGLE_LIST),void 0===u&&(u=Yn.NONE),void 0===h&&(h=Hn.GRAPHICS),this.shader=e,this.pipelineLayout=t,this.renderPass=i,this.inputState=n,this.rasterizerState=r,this.depthStencilState=s,this.blendState=a,this.primitive=o,this.dynamicStates=u,this.bindPoint=h})),Hs=e("bU",function(e){function t(){var t;return(t=e.call(this,_n.PIPELINE_STATE)||this)._shader=null,t._pipelineLayout=null,t._primitive=Vn.TRIANGLE_LIST,t._is=null,t._rs=new Bs,t._dss=new Us,t._bs=new zs,t._dynamicStates=Yn.NONE,t._renderPass=null,t}return _(t,e),c(t,[{key:"shader",get:function(){return this._shader}},{key:"pipelineLayout",get:function(){return this._pipelineLayout}},{key:"primitive",get:function(){return this._primitive}},{key:"rasterizerState",get:function(){return this._rs}},{key:"depthStencilState",get:function(){return this._dss}},{key:"blendState",get:function(){return this._bs}},{key:"inputState",get:function(){return this._is}},{key:"dynamicStates",get:function(){return this._dynamicStates}},{key:"renderPass",get:function(){return this._renderPass}}]),t}(cs)),Vs=e("bV",function(e){function t(){var t;return(t=e.call(this,_n.QUEUE)||this)._type=Qn.GRAPHICS,t}return _(t,e),c(t,[{key:"type",get:function(){return this._type}}]),t}(cs)),Ws=e("bW",function(e){function t(){var t;return(t=e.call(this,_n.RENDER_PASS)||this)._colorInfos=[],t._depthStencilInfo=null,t._subpasses=[],t._hash=0,t}return _(t,e),t.prototype.computeHash=function(){var e="";if(this._subpasses.length)for(var t=0;t<this._subpasses.length;++t){var i=this._subpasses[t];if(i.inputs.length){e+="ia";for(var n=0;n<i.inputs.length;++n){var r=this._colorInfos[i.inputs[n]];e+=","+r.format+","+r.sampleCount}}if(i.colors.length){e+="ca";for(var s=0;s<i.inputs.length;++s){var a=this._colorInfos[i.inputs[s]];e+=","+a.format+","+a.sampleCount}}if(i.depthStencil>=0){var o=this._colorInfos[i.depthStencil];e+="ds,"+o.format+","+o.sampleCount}}else{e+="ca";for(var u=0;u<this._colorInfos.length;++u){var h=this._colorInfos[u];e+=","+h.format+","+h.sampleCount}var c=this._depthStencilInfo;c&&(e+="ds,"+c.format+","+c.sampleCount)}return xs(e,666)},c(t,[{key:"colorAttachments",get:function(){return this._colorInfos}},{key:"depthStencilAttachment",get:function(){return this._depthStencilInfo}},{key:"subPasses",get:function(){return this._subpasses}},{key:"hash",get:function(){return this._hash}}]),t}(cs)),js=e("bX",function(e){function t(t,i){var n;return(n=e.call(this,_n.SAMPLER)||this)._info=new Cr,n._hash=0,n._info.copy(t),n._hash=i,n}return _(t,e),t.computeHash=function(e){var t=e.minFilter;return t|=e.magFilter<<2,t|=e.mipFilter<<4,t|=e.addressU<<6,t|=e.addressV<<8,t|=e.addressW<<10,(t|=e.maxAnisotropy<<12)|e.cmpFunc<<16},t.unpackFromHash=function(e){var t=new Cr;return t.minFilter=(3&e)>>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},c(t,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),t}(cs)),Xs=e("bY",function(e){function t(){var t;return(t=e.call(this,_n.SHADER)||this)._name="",t._stages=[],t._attributes=[],t._blocks=[],t._samplers=[],t}return _(t,e),c(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}(cs)),Ys=e("bZ",function(e){function t(){var t;return(t=e.call(this,_n.TEXTURE)||this)._info=new Or,t._viewInfo=new Nr,t._isPowerOf2=!1,t._isTextureView=!1,t._size=0,t}return _(t,e),t.getLevelCount=function(e,t){return Math.floor(Math.log2(Math.max(e,t)))},c(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}(cs)),qs=e("b_",function(e){function t(t,i){var n;return(n=e.call(this,_n.GLOBAL_BARRIER)||this)._info=new qr,n._hash=0,n._info.copy(t),n._hash=i,n}return _(t,e),t.computeHash=function(e){return xs(e.prevAccesses+" "+e.nextAccesses+" "+e.type,666)},c(t,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),t}(cs)),Ks=e("b$",function(e){function t(t,i){var n;return(n=e.call(this,_n.TEXTURE_BARRIER)||this)._info=new Kr,n._hash=0,n._info.copy(t),n._hash=i,n}return _(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,xs(t+=e.dstQueue?e.dstQueue.type:0,666)},c(t,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),t}(cs)),Qs=e("g4",function(e){function t(t,i){var n;return(n=e.call(this,_n.BUFFER_BARRIER)||this)._info=new Qr,n._hash=0,n._info.copy(t),n._hash=i,n}return _(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,xs(t+=e.dstQueue?e.dstQueue.type:0,666)},c(t,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),t}(cs)),Zs={Device:Is,Swapchain:Os,Buffer:ws,Texture:Ys,Sampler:js,Shader:Xs,InputAssembler:Fs,RenderPass:Ws,Framebuffer:Ns,DescriptorSet:Ps,DescriptorSetLayout:Ds,PipelineLayout:Ls,PipelineState:Hs,CommandBuffer:Rs,Queue:Vs,GeneralBarrier:qs,TextureBarrier:Ks,BufferBarrier:Qs,RasterizerState:Bs,BlendState:zs,BlendTarget:Gs,DepthStencilState:Us,PipelineStateInfo:ks};Object.assign(Zs,bs),R.gfx=Zs;var Js={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 $s in Js){var ea=Js[$s];!0===ea?ea=$s.slice(3):!1===ea&&(ea=$s),ie(R,"cc",[{name:$s,newName:ea,target:R.gfx,targetName:"cc.gfx"}])}ne(R,"cc",[{name:"GFX_MAX_VERTEX_ATTRIBUTES"},{name:"GFX_MAX_TEXTURE_UNITS"},{name:"GFX_MAX_ATTACHMENTS"},{name:"GFX_MAX_BUFFER_BINDINGS"},{name:"GFXTextureLayout"}]),ne(mn,"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;"}]),ne(Vr.prototype,"ColorAttachment",[{name:"beginAccesses",suggest:"Please assign to ColorAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to ColorAttachment.barrier instead"}]),ne(Wr.prototype,"DepthStencilAttachment",[{name:"beginAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"}]),ie(Is.prototype,"Device",[{name:"getGlobalBarrier",newName:"getGeneralBarrier"}]);var ta,ia=new(function(){function e(){this._pools=[],this._lastShrinkPassed=0,this.shrinkTimeSpan=5}var t=e.prototype;return t.addContainer=function(e){-1===e._poolHandle&&(e._poolHandle=this._pools.length,this._pools.push(e))},t.removeContainer=function(e){-1!==e._poolHandle&&(this._pools[this._pools.length-1]._poolHandle=e._poolHandle,ge(this._pools,e._poolHandle),e._poolHandle=-1)},t.tryShrink=function(){for(var e=0;e<this._pools.length;e++)this._pools[e].tryShrink()},t.update=function(e){this._lastShrinkPassed+=e,this._lastShrinkPassed>this.shrinkTimeSpan&&(this.tryShrink(),this._lastShrinkPassed-=this.shrinkTimeSpan)},e}()),na=function(){function e(){this._poolHandle=-1,ia.addContainer(this)}return e.prototype.destroy=function(){ia.removeContainer(this)},e}(),ra=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<r._elementsPerBatch;++s)r._freepool.push(t());return r}_(t,e);var i=t.prototype;return i.alloc=function(){if(this._nextAvail<0){this._freepool.length=this._elementsPerBatch;for(var e=0;e<this._elementsPerBatch;e++)this._freepool[e]=this._ctor();this._nextAvail=this._elementsPerBatch-1}return this._freepool[this._nextAvail--]},i.free=function(e){this._freepool[++this._nextAvail]=e},i.freeArray=function(e){this._freepool.length=this._nextAvail+1,Array.prototype.push.apply(this._freepool,e),this._nextAvail+=e.length},i.tryShrink=function(){if(this._nextAvail>>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&&Y(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}(na)),sa=e("L",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;s<i;++s)r._data[s]=t();return r}_(t,e);var i=t.prototype;return i.reset=function(){this._count=0},i.resize=function(e){if(e>this._data.length)for(var t=this._data.length;t<e;++t)this._data[t]=this._fn()},i.add=function(){return this._count>=this._data.length&&this.resize(this._data.length<<1),this._data[this._count++]},i.destroy=function(){if(this._dtor)for(var t=0;t<this._data.length;t++)this._dtor(this._data[t]);this._data.length=0,this._count=0,e.prototype.destroy.call(this)},i.tryShrink=function(){if(this._data.length>>2>this._count){var e=Math.max(this._initSize,this._data.length>>1);if(this._dtor)for(var t=e;t<this._data.length;t++)this._dtor(this._data[t]);this._data.length=e}},i.removeAt=function(e){if(!(e>=this._count)){var t=this._count-1,i=this._data[e];this._data[e]=this._data[t],this._data[t]=i,this._count-=1}},c(t,[{key:"length",get:function(){return this._count}},{key:"data",get:function(){return this._data}}]),t}(na)),aa=e("N",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}_(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<e.length;++t)this.array[this.length++]=e[t]},i.fastRemove=function(e){if(!(e>=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;t<i;++t)if(this.array[t]===e)return t;return-1},t}(na)),oa=e("gY","__editorExtras__"),ua=1<<22,ha=[],ca=e("eP",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=ha.length,t=0;t<e;++t){var i=ha[t];1&i._objFlags||i._destroyImmediate()}e===ha.length?ha.length=0:ha.splice(0,e)};var t=e.prototype;return t.destroy=function(){return 1&this._objFlags?(Y(5e3),!1):!(4&this._objFlags||(this._objFlags|=4,ha.push(this),0))},t._destruct=function(){var e=this.constructor,t=e.__destruct__;t||(t=function(e,t){var i,n=e instanceof R._BaseNode||e instanceof R.Component,r=n?"_id":null,s={};for(i in e)if(e.hasOwnProperty(i)){if(i===r)continue;switch(typeof e[i]){case"string":s[i]="";break;case"object":case"function":s[i]=null}}if(li._isCCClass(t))for(var a=R.Class.Attr.getClassAttrs(t),o=t.__props__,u=0;u<o.length;u++){var h=""+(i=o[u]);if(h in a){if(n&&"_id"===i)continue;switch(typeof a[h]){case"string":s[i]="";break;case"object":case"function":s[i]=null;break;case"undefined":s[i]=void 0}}}var c="";for(i in s){var l;l=li.IDENTIFIER_RE.test(i)?"o."+i+"=":"o["+li.escapeForJS(i)+"]=";var _=s[i];""===_&&(_='""'),c+=l+_+";\n"}return Function("o",c)}(this,e),Ce(e,"__destruct__",t,!0)),t(this)},t._destroyImmediate=function(){1&this._objFlags?K(5e3):(this._onPreDestroy&&this._onPreDestroy(),this._destruct(),this._objFlags|=1)},c(e,[{key:"name",get:function(){return this._name},set:function(e){this._name=e}},{key:"hideFlags",get:function(){return this._objFlags&e.Flags.AllHideMasks},set:function(t){var i=t&e.Flags.AllHideMasks;this._objFlags=this._objFlags&~e.Flags.AllHideMasks|i}},{key:"replicated",get:function(){return!!(this._objFlags&ua)},set:function(e){e?this._objFlags|=ua:this._objFlags&=-4194305}},{key:"isValid",get:function(){return!(1&this._objFlags)}}]),e}()),la=ca.prototype;function _a(e){return e instanceof ca}function fa(e,t){return"object"==typeof e?!(!e||e._objFlags&(t?5:1)):void 0!==e}la._deserialize=null,la._onPreDestroy=null,li.fastDefine("cc.Object",ca,((ta={_name:"",_objFlags:0})[oa]={},ta)),li.Attr.setClassAttr(ca,oa,"editorOnly",!0),li.Attr.setClassAttr(ca,"replicated","visible",!1),Ce(ca,"Flags",{Destroyed:1,DontSave:8,EditorOnly:16,Dirty:32,DontDestroy:64,PersistentMask:-4192741,Destroying:128,Deactivating:256,LockedInEditor:512,HideInHierarchy:1024,AllHideMasks:1560,IsPreloadStarted:8192,IsOnLoadStarted:32768,IsOnLoadCalled:16384,IsOnEnableCalled:2048,IsStartCalled:65536,IsEditorOnEnableCalled:4096,IsPositionLocked:1<<21,IsRotationLocked:1<<17,IsScaleLocked:1<<18,IsAnchorLocked:1<<19,IsSizeLocked:1<<20}),R.isValid=fa,R.Object=ca;var da=lt.fastRemoveAt;function pa(){}var ma=function(){function e(){this.callback=pa,this.target=void 0,this.once=!1}var t=e.prototype;return t.set=function(e,t,i){this.callback=e||pa,this.target=t,this.once=!!i},t.reset=function(){this.target=void 0,this.callback=pa,this.once=!1},t.check=function(){return!(_a(this.target)&&!fa(this.target,!0))},e}(),ga=new ra((function(){return new ma}),32),va=function(){function e(){this.callbackInfos=[],this.isInvoking=!1,this.containCanceled=!1}var t=e.prototype;return t.removeByCallback=function(e){for(var t=0;t<this.callbackInfos.length;++t){var i=this.callbackInfos[t];i&&i.callback===e&&(i.reset(),ga.free(i),da(this.callbackInfos,t),--t)}},t.removeByTarget=function(e){for(var t=0;t<this.callbackInfos.length;++t){var i=this.callbackInfos[t];i&&i.target===e&&(i.reset(),ga.free(i),da(this.callbackInfos,t),--t)}},t.cancel=function(e){var t=this.callbackInfos[e];t&&(t.reset(),this.isInvoking?this.callbackInfos[e]=null:da(this.callbackInfos,e),ga.free(t)),this.containCanceled=!0},t.cancelAll=function(){for(var e=0;e<this.callbackInfos.length;e++){var t=this.callbackInfos[e];t&&(t.reset(),ga.free(t),this.callbackInfos[e]=null)}this.containCanceled=!0},t.purgeCanceled=function(){for(var e=this.callbackInfos.length-1;e>=0;--e)this.callbackInfos[e]||da(this.callbackInfos,e);this.containCanceled=!1},t.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1},e}(),ya=new ra((function(){return new va}),16),Ea=function(){function e(){this._callbackTable=Pe(!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]=ya.alloc());var s=ga.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;s<r.length;++s)if(r[s])return!0;return!1}return r.length>0}for(var a=0;a<r.length;++a){var o=r[a];if(o&&o.check()&&o.callback===t&&o.target===i)return!0}return!1},t.removeAll=function(e){var t=typeof e;if("string"===t||"number"===t){var i=this._callbackTable&&this._callbackTable[e];i&&(i.isInvoking?i.cancelAll():(i.clear(),ya.free(i),delete this._callbackTable[e]))}else if(e)for(var n in this._callbackTable){var r=this._callbackTable[n];if(r.isInvoking)for(var s=r.callbackInfos,a=0;a<s.length;++a){var o=s[a];o&&o.target===e&&r.cancel(a)}else r.removeByTarget(e)}},t.off=function(e,t,i){var n,r=this._callbackTable&&this._callbackTable[e];if(r){var s=r.callbackInfos;if(t)for(var a=0;a<s.length;++a){var o=s[a];if(o&&o.callback===t&&o.target===i){r.cancel(a);break}}else this.removeAll(e)}null===(n=this._offCallback)||void 0===n||n.call(this)},t.emit=function(e,t,i,n,r,s){var a=this._callbackTable&&this._callbackTable[e];if(a){var o=!a.isInvoking;a.isInvoking=!0;for(var u=a.callbackInfos,h=0,c=u.length;h<c;++h){var l=u[h];if(l){var _=l.callback,f=l.target;l.once&&this.off(e,_,f),l.check()?f?_.call(f,t,i,n,r,s):_(t,i,n,r,s):this.off(e,_,f)}}o&&(a.isInvoking=!1,a.containCanceled&&a.purgeCanceled())}},t.clear=function(){for(var e in this._callbackTable){var t=this._callbackTable[e];t&&(t.clear(),ya.free(t),delete this._callbackTable[e])}},t._registerOffCallback=function(e){this._offCallback=e},e}();function Ta(e){for(var t=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._callbackTable=Pe(!0),t}_(t,e);var i=t.prototype;return i.once=function(e,t,i){return this.on(e,t,i,!0)},i.targetOff=function(e){this.removeAll(e)},t}(e),i=Ea.prototype,n=Object.getOwnPropertyNames(i).concat(Object.getOwnPropertySymbols(i)),r=0;r<n.length;++r){var s=n[r];if(!(s in t.prototype)){var a=Object.getOwnPropertyDescriptor(i,s);a&&Object.defineProperty(t.prototype,s,a)}}return t}var Aa=e("fM",Ta((function(){})));R.EventTarget=Aa;var Sa,ba,wa,Ra,Ia,Oa,Na=e("g$",function(){function e(){this._delegates=[]}var t=e.prototype;return t.add=function(e){this._delegates.includes(e)||this._delegates.push(e)},t.hasListener=function(e){return this._delegates.includes(e)},t.remove=function(e){_t.array.fastRemove(this._delegates,e)},t.dispatch=function(){for(var e=arguments,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return Promise.all(this._delegates.map((function(t){return t.apply(void 0,e)})).filter(Boolean))},e}());!function(e){e.UNKNOWN="unknown",e.WECHAT="wechat",e.ANDROID="androidbrowser",e.IE="ie",e.EDGE="edge",e.QQ="qqbrowser",e.MOBILE_QQ="mqqbrowser",e.UC="ucbrowser",e.UCBS="ucbs",e.BROWSER_360="360browser",e.BAIDU_APP="baiduboxapp",e.BAIDU="baidubrowser",e.MAXTHON="maxthon",e.OPERA="opera",e.OUPENG="oupeng",e.MIUI="miuibrowser",e.FIREFOX="firefox",e.SAFARI="safari",e.CHROME="chrome",e.LIEBAO="liebao",e.QZONE="qzone",e.SOUGOU="sogou",e.HUAWEI="huawei"}(Sa||(Sa=e("fO",{}))),function(e){e.UNKNOWN="unknown",e.ENGLISH="en",e.CHINESE="zh",e.FRENCH="fr",e.ITALIAN="it",e.GERMAN="de",e.SPANISH="es",e.DUTCH="du",e.RUSSIAN="ru",e.KOREAN="ko",e.JAPANESE="ja",e.HUNGARIAN="hu",e.PORTUGUESE="pt",e.ARABIC="ar",e.NORWEGIAN="no",e.POLISH="pl",e.TURKISH="tr",e.UKRAINIAN="uk",e.ROMANIAN="ro",e.BULGARIAN="bg"}(ba||(ba={})),function(e){e[e.NONE=0]="NONE",e[e.LAN=1]="LAN",e[e.WWAN=2]="WWAN"}(wa||(wa={})),function(e){e.UNKNOWN="Unknown",e.IOS="iOS",e.ANDROID="Android",e.WINDOWS="Windows",e.LINUX="Linux",e.OSX="OS X",e.OHOS="OHOS"}(Ra||(Ra=e("fN",{}))),function(e){e.UNKNOWN="UNKNOWN",e.EDITOR_PAGE="EDITOR_PAGE",e.EDITOR_CORE="EDITOR_CORE",e.MOBILE_BROWSER="MOBILE_BROWSER",e.DESKTOP_BROWSER="DESKTOP_BROWSER",e.WIN32="WIN32",e.ANDROID="ANDROID",e.IOS="IOS",e.MACOS="MACOS",e.OHOS="OHOS",e.WECHAT_GAME="WECHAT_GAME",e.BAIDU_MINI_GAME="BAIDU_MINI_GAME",e.XIAOMI_QUICK_GAME="XIAOMI_QUICK_GAME",e.ALIPAY_MINI_GAME="ALIPAY_MINI_GAME",e.BYTEDANCE_MINI_GAME="BYTEDANCE_MINI_GAME",e.OPPO_MINI_GAME="OPPO_MINI_GAME",e.VIVO_MINI_GAME="VIVO_MINI_GAME",e.HUAWEI_QUICK_GAME="HUAWEI_QUICK_GAME",e.COCOSPLAY="COCOSPLAY",e.LINKSURE_MINI_GAME="LINKSURE_MINI_GAME",e.QTT_MINI_GAME="QTT_MINI_GAME"}(Ia||(Ia={})),function(e){e.WEBP="WEBP",e.IMAGE_BITMAP="IMAGE_BITMAP",e.WEB_VIEW="WEB_VIEW",e.VIDEO_PLAYER="VIDEO_PLAYER",e.SAFE_AREA="SAFE_AREA",e.INPUT_TOUCH="INPUT_TOUCH",e.EVENT_KEYBOARD="EVENT_KEYBOARD",e.EVENT_MOUSE="EVENT_MOUSE",e.EVENT_TOUCH="EVENT_TOUCH",e.EVENT_ACCELEROMETER="EVENT_ACCELEROMETER"}(Oa||(Oa={}));var Ca,Ma=function(e){function t(){var t,i,n;(n=e.call(this)||this).networkType=void 0,n.isNative=void 0,n.isBrowser=void 0,n.isMobile=void 0,n.isLittleEndian=void 0,n.platform=void 0,n.language=void 0,n.nativeLanguage=void 0,n.os=void 0,n.osVersion=void 0,n.osMainVersion=void 0,n.browserType=void 0,n.browserVersion=void 0,n._battery=void 0,n._featureMap=void 0;var r,s=window.navigator,a=s.userAgent.toLowerCase();null===(t=s.getBattery)||void 0===t||t.call(s).then((function(e){n._battery=e})),n.networkType=wa.LAN,n.isNative=!1,n.isBrowser=!0,n.isMobile=/mobile|android|iphone|ipad/.test(a),n.platform=n.isMobile?Ia.MOBILE_BROWSER:Ia.DESKTOP_BROWSER,n.isLittleEndian=(r=new ArrayBuffer(2),new DataView(r).setInt16(0,256,!0),256===new Int16Array(r)[0]);var o=s.language;n.nativeLanguage=o.toLowerCase(),o=(o=o||s.browserLanguage)?o.split("-")[0]:ba.ENGLISH,n.language=o;var u=!1,h=!1,c="",l=0,_=/android\s*(\d+(?:\.\d+)*)/i.exec(a)||/android\s*(\d+(?:\.\d+)*)/i.exec(s.platform);_&&(u=!0,c=_[1]||"",l=parseInt(c)||0),(_=/(iPad|iPhone|iPod).*OS ((\d+_?){2,3})/i.exec(a))?(h=!0,c=_[2]||"",l=parseInt(c)||0):(/(iPhone|iPad|iPod)/.exec(s.platform)||"MacIntel"===s.platform&&s.maxTouchPoints&&s.maxTouchPoints>1)&&(h=!0,c="",l=0);var f=Ra.UNKNOWN;-1!==s.appVersion.indexOf("Win")?f=Ra.WINDOWS:h?f=Ra.IOS:-1!==s.appVersion.indexOf("Mac")?f=Ra.OSX:-1!==s.appVersion.indexOf("X11")&&-1===s.appVersion.indexOf("Linux")?f=Ra.LINUX:u?f=Ra.ANDROID:-1===s.appVersion.indexOf("Linux")&&-1===a.indexOf("ubuntu")||(f=Ra.LINUX),n.os=f,n.osVersion=c,n.osMainVersion=l,n.browserType=Sa.UNKNOWN;var d=/wechat|weixin|micromessenger/i.exec(a)||/mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|ucbs|360 aphone|360browser|baiduboxapp|baidubrowser|maxthon|mxbrowser|miuibrowser/i.exec(a)||/qq|qqbrowser|ucbrowser|ubrowser|edge|HuaweiBrowser/i.exec(a)||/chrome|safari|firefox|trident|opera|opr\/|oupeng/i.exec(a),p=d?d[0].toLowerCase():Ra.UNKNOWN;("safari"===p&&u||"qq"===p&&/android.*applewebkit/i.test(a))&&(p=Sa.ANDROID);var m={micromessenger:Sa.WECHAT,wechat:Sa.WECHAT,weixin:Sa.WECHAT,trident:Sa.IE,edge:Sa.EDGE,"360 aphone":Sa.BROWSER_360,mxbrowser:Sa.MAXTHON,"opr/":Sa.OPERA,ubrowser:Sa.UC,huaweibrowser:Sa.HUAWEI};n.browserType=m[p]||p,n.browserVersion="";var g=/(mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|uc|ucbs|360 aphone|360|baiduboxapp|baidu|maxthon|mxbrowser|miui(?:.hybrid)?)(mobile)?(browser)?\/?([\d.]+)/i.exec(a);g||(g=/(qq|chrome|safari|firefox|trident|opera|opr\/|oupeng)(mobile)?(browser)?\/?([\d.]+)/i.exec(a)),n.browserVersion=g?g[4]:"";var v,y=document.createElement("canvas");y.getContext("2d");try{v=y.toDataURL("image/webp").startsWith("data:image/webp")}catch(e){v=!1}if(n.browserType===Sa.SAFARI){var E,T=null===(E=/ version\/(\d+)/.exec(a))||void 0===E?void 0:E[1];"string"==typeof T&&Number.parseInt(T)>=14&&(v=!0)}var A=!1;"undefined"!=typeof createImageBitmap&&"undefined"!=typeof Blob&&(y.width=y.height=2,createImageBitmap(y,{}).then((function(e){A=!0,null==e||e.close()})).catch((function(){})));var S=void 0!==document.documentElement.ontouchstart||void 0!==document.ontouchstart||b,w=void 0!==document.documentElement.onmouseup||b;return n._featureMap=((i={})[Oa.WEBP]=v,i[Oa.IMAGE_BITMAP]=A,i[Oa.WEB_VIEW]=!0,i[Oa.VIDEO_PLAYER]=!0,i[Oa.SAFE_AREA]=!1,i[Oa.INPUT_TOUCH]=S,i[Oa.EVENT_KEYBOARD]=void 0!==document.documentElement.onkeyup||b,i[Oa.EVENT_MOUSE]=w,i[Oa.EVENT_TOUCH]=S||w,i[Oa.EVENT_ACCELEROMETER]=void 0!==window.DeviceMotionEvent||void 0!==window.DeviceOrientationEvent,i),n._registerEvent(),n}_(t,e);var i=t.prototype;return 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<s.length;a++)document.addEventListener(s[a],(function(t){var i=document[e];(i=i||t.hidden)?n():r()}));else window.addEventListener("blur",n),window.addEventListener("focus",r);window.navigator.userAgent.indexOf("MicroMessenger")>-1&&(window.onfocus=r),"onpageshow"in window&&"onpagehide"in window&&(window.addEventListener("pagehide",n),window.addEventListener("pageshow",r),document.addEventListener("pagehide",n),document.addEventListener("pageshow",r))},i.hasFeature=function(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}(Aa),xa=e("fL",new Ma);!function(e){e[e.PORTRAIT=1]="PORTRAIT",e[e.PORTRAIT_UPSIDE_DOWN=2]="PORTRAIT_UPSIDE_DOWN",e[e.LANDSCAPE_LEFT=4]="LANDSCAPE_LEFT",e[e.LANDSCAPE_RIGHT=8]="LANDSCAPE_RIGHT",e[e.LANDSCAPE=12]="LANDSCAPE",e[e.AUTO=13]="AUTO"}(Ca||(Ca={}));var Fa,Pa={auto:Ca.AUTO,landscape:Ca.LANDSCAPE,portrait:Ca.PORTRAIT};!function(e){e[e.Unknown=0]="Unknown",e[e.SubFrame=1]="SubFrame",e[e.BrowserWindow=2]="BrowserWindow",e[e.Fullscreen=3]="Fullscreen"}(Fa||(Fa={}));var Da=function(e){function t(){var t,i,n,r,s,a;(t=e.call(this)||this).isFrameRotated=!1,t.handleResizeEvent=!0,t._gameFrame=void 0,t._gameContainer=void 0,t._gameCanvas=void 0,t._isProportionalToFrame=!1,t._cachedFrameStyle={width:"0px",height:"0px"},t._cachedContainerStyle={width:"0px",height:"0px"},t._cbToUpdateFrameBuffer=void 0,t._supportFullScreen=!1,t._touchEventName=void 0,t._onFullscreenChange=void 0,t._onFullscreenError=void 0,t._orientationChangeTimeoutId=-1,t._cachedFrameSize=new un(0,0),t._exactFitScreen=!1,t._fn={},t._fnGroup=[["requestFullscreen","exitFullscreen","fullscreenchange","fullscreenEnabled","fullscreenElement","fullscreenerror"],["requestFullScreen","exitFullScreen","fullScreenchange","fullScreenEnabled","fullScreenElement","fullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitfullscreenchange","webkitIsFullScreen","webkitCurrentFullScreenElement","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange","mozFullScreen","mozFullScreenElement","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","MSFullscreenChange","msFullscreenEnabled","msFullscreenElement","msfullscreenerror"]],t._resolutionScale=1,t._orientation=Ca.AUTO,t._gameFrame=document.getElementById("GameDiv"),t._gameContainer=document.getElementById("Cocos3dGameContainer"),t._gameCanvas=document.getElementById("GameCanvas"),t._gameFrame||(t._gameFrame=document.createElement("div"),t._gameFrame.setAttribute("id","GameDiv"),null===(i=t._gameCanvas)||void 0===i||null===(n=i.parentNode)||void 0===n||n.insertBefore(t._gameFrame,t._gameCanvas),t._gameFrame.appendChild(t._gameCanvas)),t._gameContainer||(t._gameContainer=document.createElement("div"),t._gameContainer.setAttribute("id","Cocos3dGameContainer"),null===(r=t._gameCanvas)||void 0===r||null===(s=r.parentNode)||void 0===s||s.insertBefore(t._gameContainer,t._gameCanvas),t._gameContainer.appendChild(t._gameCanvas));for(var o=t._fnGroup,u=0;u<o.length;u++)if(a=o[u],void 0!==document[a[1]]){for(var h=0;h<a.length;h++)t._fn[o[0][h]]=a[h];break}return t._supportFullScreen=void 0!==t._fn.requestFullscreen,t._touchEventName="ontouchstart"in window?"touchend":"mousedown",t._registerEvent(),t}_(t,e);var i=t.prototype;return i.init=function(e,t){this._cbToUpdateFrameBuffer=t,this.orientation=Pa[e.configOrientation],this._exactFitScreen=e.exactFitScreen,this._resizeFrame()},i.requestFullScreen=function(){var e=this;return new Promise((function(t,i){e.isFullScreen?t():(e._cachedFrameSize=e.windowSize,e._doRequestFullScreen().then((function(){t()})).catch((function(){var n=e._getFullscreenTarget();n?n.addEventListener(e._touchEventName,(function(){e._doRequestFullScreen().then((function(){t()})).catch(i)}),{once:!0,capture:!0}):i(new Error("Cannot access fullscreen target"))})))}))},i.exitFullScreen=function(){var e=this;return new Promise((function(t,i){var n=document[e._fn.exitFullscreen]();window.Promise&&n instanceof Promise?n.then((function(){e.windowSize=e._cachedFrameSize,t()})).catch(i):(e.windowSize=e._cachedFrameSize,t())}))},i._registerEvent=function(){var e=this;document.addEventListener(this._fn.fullscreenerror,(function(){var t;null===(t=e._onFullscreenError)||void 0===t||t.call(e)})),window.addEventListener("resize",(function(){e.handleResizeEvent&&e._resizeFrame()})),"function"==typeof window.matchMedia&&function t(){var i,n,r=window.devicePixelRatio;null===(i=window.matchMedia("(resolution: "+r+"dppx)"))||void 0===i||null===(n=i.addEventListener)||void 0===n||n.call(i,"change",(function(){e.emit("window-resize"),t()}),{once:!0})}(),window.addEventListener("orientationchange",(function(){-1!==e._orientationChangeTimeoutId&&clearTimeout(e._orientationChangeTimeoutId),e._orientationChangeTimeoutId=setTimeout((function(){e.handleResizeEvent&&(e._updateFrameState(),e._resizeFrame(),e.emit("orientation-change"),e._orientationChangeTimeoutId=-1)}),200)})),document.addEventListener(this._fn.fullscreenchange,(function(){var t;null===(t=e._onFullscreenChange)||void 0===t||t.call(e),e.emit("fullscreen-change")}))},i._convertToSizeInCssPixels=function(e){var t=e.clone(),i=this.devicePixelRatio;return t.width/=i,t.height/=i,t},i._resizeFrame=function(e){if(this._gameFrame){if(this._gameFrame.style.display="flex",this._gameFrame.style["justify-content"]="center",this._gameFrame.style["align-items"]="center",this._windowType===Fa.SubFrame){if(!e)return void this._updateContainer();this._gameFrame.style.width=e.width+"px",this._gameFrame.style.height=e.height+"px"}else{var t=window.innerWidth,i=window.innerHeight;this.isFrameRotated?(this._gameFrame.style["-webkit-transform"]="rotate(90deg)",this._gameFrame.style.transform="rotate(90deg)",this._gameFrame.style["-webkit-transform-origin"]="0px 0px 0px",this._gameFrame.style.transformOrigin="0px 0px 0px",this._gameFrame.style.margin="0 0 0 "+t+"px",this._gameFrame.style.width=i+"px",this._gameFrame.style.height=t+"px"):(this._gameFrame.style["-webkit-transform"]="rotate(0deg)",this._gameFrame.style.transform="rotate(0deg)",this._gameFrame.style.margin="0px auto",this._gameFrame.style.width=t+"px",this._gameFrame.style.height=i+"px")}this._updateContainer()}},i._getFullscreenTarget=function(){var e=this._windowType;return e===Fa.Fullscreen?document[this._fn.fullscreenElement]:e===Fa.SubFrame?this._gameFrame:document.body},i._doRequestFullScreen=function(){var e=this;return new Promise((function(t,i){if(e._supportFullScreen){var n=e._getFullscreenTarget();if(n){e._onFullscreenChange=void 0,e._onFullscreenError=void 0;var r=n[e._fn.requestFullscreen]();window.Promise&&r instanceof Promise?r.then(t).catch(i):(e._onFullscreenChange=t,e._onFullscreenError=i)}else i(new Error("Cannot access fullscreen target"))}else i(new Error("fullscreen is not supported"))}))},i._updateFrameState=function(){var e=this.orientation,t=window.innerWidth>window.innerHeight;this.isFrameRotated=xa.isMobile&&(t&&e===Ca.PORTRAIT||!t&&e===Ca.LANDSCAPE)},i._updateContainer=function(){if(this._gameContainer){if(this.isProportionalToFrame){if(!this._gameFrame)return void Y(9201);var e,t,i=R.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;u<h?(e=r,t=o*u):(e=a*h,t=s),c.width=e+"px",c.height=t+"px"}else{var l=this._gameContainer.style;l.width="100%",l.height="100%"}!this._gameFrame||this._cachedFrameStyle.width===this._gameFrame.style.width&&this._cachedFrameStyle.height===this._gameFrame.style.height&&this._cachedContainerStyle.width===this._gameContainer.style.width&&this._cachedContainerStyle.height===this._gameContainer.style.height||(this.emit("window-resize"),this._cachedFrameStyle.width=this._gameFrame.style.width,this._cachedFrameStyle.height=this._gameFrame.style.height,this._cachedContainerStyle.width=this._gameContainer.style.width,this._cachedContainerStyle.height=this._gameContainer.style.height)}else Y(9201)},c(t,[{key:"supportFullScreen",get:function(){return this._supportFullScreen}},{key:"isFullScreen",get:function(){return!!this._supportFullScreen&&!!document[this._fn.fullscreenElement]}},{key:"devicePixelRatio",get:function(){var e;return Math.min(null!==(e=window.devicePixelRatio)&&void 0!==e?e:1,2)}},{key:"windowSize",get:function(){var e=this._windowSizeInCssPixels,t=this.devicePixelRatio;return e.width*=t,e.height*=t,e},set:function(e){this._windowType===Fa.SubFrame?this._resizeFrame(this._convertToSizeInCssPixels(e)):Y(9202)}},{key:"resolution",get:function(){var e=this.windowSize,t=this.resolutionScale;return new un(e.width*t,e.height*t)}},{key:"resolutionScale",get:function(){return this._resolutionScale},set:function(e){var t;e!==this._resolutionScale&&(this._resolutionScale=e,null===(t=this._cbToUpdateFrameBuffer)||void 0===t||t.call(this))}},{key:"orientation",get:function(){return this._orientation},set:function(e){this._orientation!==e&&(this._orientation=e,this._updateFrameState())}},{key:"safeAreaEdge",get:function(){return{top:0,bottom:0,left:0,right:0}}},{key:"isProportionalToFrame",get:function(){return this._isProportionalToFrame},set:function(e){this._isProportionalToFrame!==e&&(this._isProportionalToFrame=e,this._updateContainer())}},{key:"_windowSizeInCssPixels",get:function(){if(this.isProportionalToFrame)return this._gameContainer?new un(this._gameContainer.clientWidth,this._gameContainer.clientHeight):(Y(9201),new un(0,0));var e,t,i;switch(this._windowType){case Fa.SubFrame:return this._gameFrame?new un(this._gameFrame.clientWidth,this._gameFrame.clientHeight):(Y(9201),new un(0,0));case Fa.Fullscreen:return e=this._getFullscreenTarget(),t=this.isFrameRotated?e.clientHeight:e.clientWidth,i=this.isFrameRotated?e.clientWidth:e.clientHeight,new un(t,i);case Fa.BrowserWindow:return t=this.isFrameRotated?window.innerHeight:window.innerWidth,i=this.isFrameRotated?window.innerWidth:window.innerHeight,new un(t,i);case Fa.Unknown:default:return new un(0,0)}}},{key:"_windowType",get:function(){return this.isFullScreen?Fa.Fullscreen:this._gameFrame?this._exactFitScreen?Fa.BrowserWindow:Fa.SubFrame:(Y(9201),Fa.Unknown)}}]),t}(Aa),La=e("gv",new Da),Ba=function(){function e(){}var t=e.prototype;return t.init=function(){var e,t,i=null===(e=Tt.querySettings(Et.Category.SCREEN,"exactFitScreen"))||void 0===e||e,n=null!==(t=Tt.querySettings(Et.Category.SCREEN,"orientation"))&&void 0!==t?t:"auto";La.init({exactFitScreen:i,configOrientation:n},(function(){var e,t=R.director;(null===(e=t.root)||void 0===e?void 0:e.pipeline)?t.root.pipeline.shadingScale=La.resolutionScale:Y(1220)}))},t.fullScreen=function(){return La.isFullScreen},t.requestFullScreen=function(e,t,i){return arguments.length>0&&Y(1400,"screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)","screen.requestFullScreen(): Promise"),La.requestFullScreen().then((function(){null==t||t()})).catch((function(e){console.error(e),null==i||i()}))},t.exitFullScreen=function(){return La.exitFullScreen()},t.autoFullScreen=function(e,t){var i;null===(i=this.requestFullScreen(e,t))||void 0===i||i.catch((function(){}))},t.disableAutoFullScreen=function(){},c(e,[{key:"devicePixelRatio",get:function(){return La.devicePixelRatio}},{key:"windowSize",get:function(){return La.windowSize},set:function(e){La.windowSize=e}},{key:"resolution",get:function(){return La.resolution}},{key:"supportsFullScreen",get:function(){return La.supportFullScreen}}]),e}(),Ua=e("eV",new Ba);R.screen=Ua;var Ga,za,ka=e("dW",{Feature:Oa,hasFeature:function(e){return xa.hasFeature(e)},NetworkType:wa,Language:ba,OS:Ra,Platform:Ia,BrowserType:Sa,isNative:xa.isNative,isBrowser:xa.isBrowser,isMobile:xa.isMobile,isLittleEndian:xa.isLittleEndian,platform:xa.platform,language:xa.language,languageCode:xa.nativeLanguage,os:xa.os,osVersion:xa.osVersion,osMainVersion:xa.osMainVersion,browserType:xa.browserType,browserVersion:xa.browserVersion,windowPixelResolution:Ua.windowSize,capabilities:{canvas:!0,opengl:!0,webp:xa.hasFeature(Oa.WEBP),imageBitmap:xa.hasFeature(Oa.IMAGE_BITMAP),touches:xa.hasFeature(Oa.INPUT_TOUCH),mouse:xa.hasFeature(Oa.EVENT_MOUSE),keyboard:xa.hasFeature(Oa.EVENT_KEYBOARD),accelerometer:xa.hasFeature(Oa.EVENT_ACCELEROMETER)},localStorage:{},getNetworkType:function(){return xa.networkType},getBatteryLevel:function(){return xa.getBatteryLevel()},garbageCollect:function(){xa.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+="capabilities : "+JSON.stringify(this.capabilities)+"\r\n",e+="os : "+this.os+"\r\n",e+="osVersion : "+this.osVersion+"\r\n",e+="platform : "+this.platform+"\r\n",L(e+="Using "+(R.game.renderType===R.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n")},openURL:function(e){xa.openURL(e)},init:function(){try{var e=ka.localStorage=window.localStorage;e.setItem("storage",""),e.removeItem("storage"),e=null}catch(e){var t=function(){Y(5200)};this.localStorage={getItem:t,setItem:t,clear:t,removeItem:t}}this.__isWebIOS14OrIPadOS14Env=(ka.os===Ra.IOS||ka.os===Ra.OSX)&&xa.isBrowser&&/(OS 14)|(Version\/14)/.test(window.navigator.userAgent)},now:function(){return xa.now()},restartVM:function(){xa.restartJSVM()},getSafeAreaRect:function(){var e=R.view,t=La.safeAreaEdge,i=La.windowSize,n=new en(t.left,t.bottom),r=new en(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 cn(s,a,o,u)}});R.sys=ka,function(e){e[e.AUTO=0]="AUTO",e[e.CANVAS=1]="CANVAS",e[e.WEBGL=2]="WEBGL",e[e.HEADLESS=3]="HEADLESS"}(Ga||(Ga=e("c0",{}))),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"}(za||(za=e("c1",{})));var Ha=e("c2",function(){function e(){this.initialized=!1,this._canvas=null,this._renderType=za.UNKNOWN}var t=e.prototype;return t.init=function(e,t){if(!this.initialized){var i=Tt.querySettings(Et.Category.RENDERING,"renderMode");if(this._canvas=e,this._renderType=this._determineRenderType(i),this._renderType===za.WEBGL){var n=new Ar(t),r=!!window.WebGL2RenderingContext,s=window.navigator.userAgent.toLowerCase();(-1!==s.indexOf("safari")&&-1===s.indexOf("chrome")||ka.browserType===Sa.UC)&&(r=!1);var a=[];r&&R.WebGL2Device&&a.push(R.WebGL2Device),R.WebGLDevice&&a.push(R.WebGLDevice),R.EmptyDevice&&a.push(R.EmptyDevice),Is.canvas=e;for(var o=0;o<a.length&&(this._gfxDevice=new a[o],!this._gfxDevice.initialize(n));o++);}else this._renderType===za.HEADLESS&&R.EmptyDevice&&(this._gfxDevice=new R.EmptyDevice,this._gfxDevice.initialize(new Ar(t)));if(!this._gfxDevice)return U("can not support canvas rendering in 3D"),void(this._renderType=za.UNKNOWN);var u=new Tr(this._canvas),h=Ua.windowSize;u.width=h.width,u.height=h.height,this._swapchain=this._gfxDevice.createSwapchain(u),this._canvas&&(this._canvas.oncontextmenu=function(){return!1})}},t._determineRenderType=function(e){("number"!=typeof e||e>za.HEADLESS||e<Ga.AUTO)&&(e=Ga.AUTO);var t=za.CANVAS,i=!1;if(e===Ga.CANVAS?(t=za.CANVAS,i=!0):e===Ga.AUTO||e===Ga.WEBGL?(t=za.WEBGL,i=!0):e===Ga.HEADLESS&&(t=za.HEADLESS,i=!0),!i)throw new Error($(3820,e));return t},c(e,[{key:"gfxDevice",get:function(){return this._gfxDevice}},{key:"swapchain",get:function(){return this._swapchain}}]),e}()),Va=e("c3",new Ha),Wa=new Di,ja=new Di,Xa=new Di,Ya=new Di,qa=new Di,Ka=new Di,Qa=new Array(3),Za=new Array(3);function Ja(e,t){return Di.dot(t.n,e)-t.d}function $a(e,t,i){return Di.copy(e,t),Di.subtract(qa,i.center,i.halfExtents),Di.add(Ka,i.center,i.halfExtents),e.x=e.x<qa.x?qa.x:e.x,e.y=e.y<qa.y?qa.y:e.y,e.z=e.z<qa.z?qa.z:e.z,e.x=e.x>Ka.x?Ka.x:e.x,e.y=e.y>Ka.y?Ka.y:e.y,e.z=e.z>Ka.z?Ka.z:e.z,e}function eo(e,t,i){Di.set(Wa,i.orientation.m00,i.orientation.m01,i.orientation.m02),Di.set(ja,i.orientation.m03,i.orientation.m04,i.orientation.m05),Di.set(Xa,i.orientation.m06,i.orientation.m07,i.orientation.m08),Qa[0]=Wa,Qa[1]=ja,Qa[2]=Xa,Za[0]=i.halfExtents.x,Za[1]=i.halfExtents.y,Za[2]=i.halfExtents.z,Di.subtract(Ya,t,i.center),Di.set(e,i.center.x,i.center.y,i.center.z);for(var n=0;n<3;n++){var r=Di.dot(Ya,Qa[n]);r>Za[n]&&(r=Za[n]),r<-Za[n]&&(r=-Za[n]),e.x+=r*Qa[n].x,e.y+=r*Qa[n].y,e.z+=r*Qa[n].z}return e}e("c4",Object.freeze({__proto__:null,point_plane:Ja,pt_point_plane:function(e,t,i){var n=Ja(t,i);return Di.subtract(e,t,Di.multiplyScalar(e,i.n,n))},pt_point_aabb:$a,pt_point_obb:eo,pt_point_line:function(e,t,i,n){Di.subtract(Wa,i,n);var r=Wa,s=Di.lengthSqr(r);if(0==s)Di.copy(e,i);else{Di.subtract(Wa,t,i);var a=Di.dot(Wa,r)/s;a<0?Di.copy(e,i):a>1?Di.copy(e,n):Di.scaleAndAdd(e,i,r,a)}}}));var to=e("c5",{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}),io=e("c7",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=to.SHAPE_LINE,this.s=new Di(e,t,i),this.e=new Di(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 Di.copy(e.s,t.s),Di.copy(e.e,t.e),e},e.fromPoints=function(e,t,i){return Di.copy(e.s,t),Di.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 Di.distance(e.s,e.e)},e.prototype.length=function(){return Di.distance(this.s,this.e)},c(e,[{key:"type",get:function(){return this._type}}]),e}()),no=e("c9",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=to.SHAPE_RAY,this.o=new Di(e,t,i),this.d=new Di(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 Di.copy(e.o,t.o),Di.copy(e.d,t.d),e},e.fromPoints=function(e,t,i){return Di.copy(e.o,t),Di.normalize(e.d,Di.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){Di.normalize(e,this.d),Di.scaleAndAdd(e,this.o,e,t)},c(e,[{key:"type",get:function(){return this._type}}]),e}()),ro=new Di,so=new Di,ao=new Di,oo=new Di;function uo(e){return Math.max(Math.max(e.x,e.y),e.z)}var ho,co=e("cb",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 Di(0,0,0),this._radius=0,this._type=void 0,this._type=to.SHAPE_SPHERE,this._center=new Di(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 Di.copy(e.center,t.center),e.radius=t.radius,e},e.fromPoints=function(e,t,i){return Di.multiplyScalar(e.center,Di.add(ro,t,i),.5),e.radius=.5*Di.subtract(ro,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){Di.set(e,this.center.x-this.radius,this.center.y-this.radius,this.center.z-this.radius),Di.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){Di.transformMat4(r.center,this.center,e),r.radius=this.radius*uo(n)},t.translateAndRotate=function(e,t,i){Di.transformMat4(i.center,this.center,e)},t.setScale=function(e,t){t.radius=this.radius*uo(e)},t.mergePoint=function(e){this.radius<0&&(this.center.set(e),this.radius=0),Di.subtract(so,e,this.center);var t=so.length();if(t>this.radius){var i=.5*(t-this.radius);this.radius+=i,Di.multiplyScalar(so,so,i/t),Di.add(this.center,this.center,so)}},t.mergePoints=function(e){var t=e.length;if(!(t<1)){this.radius=-1;for(var i=0;i<t;i++)this.mergePoint(e[i])}},t.mergeAABB=function(e){e.getBoundary(ao,oo),this.mergePoint(ao),this.mergePoint(oo)},c(e,[{key:"center",get:function(){return this._center},set:function(e){this._center=e}},{key:"radius",get:function(){return this._radius},set:function(e){this._radius=e}},{key:"type",get:function(){return this._type}}]),e}()),lo=e("ca",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=to.SHAPE_TRIANGLE,this.a=new Di(e,t,i),this.b=new Di(n,r,s),this.c=new Di(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 Di.copy(e.a,t.a),Di.copy(e.b,t.b),Di.copy(e.c,t.c),e},e.fromPoints=function(e,t,i,n){return Di.copy(e.a,t),Di.copy(e.b,i),Di.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},c(e,[{key:"type",get:function(){return this._type}}]),e}());!function(e){e[e.ALL=0]="ALL",e[e.CLOSEST=1]="CLOSEST",e[e.ANY=2]="ANY"}(ho||(ho=e("ck",{})));var _o,fo,po,mo,go,vo,yo,Eo,To=(_o=new Di(0,0,0),function(e,t){var i=Di.dot(e.d,t.n);if(Math.abs(i)<Number.EPSILON)return 0;Di.multiplyScalar(_o,t.n,t.d);var n=Di.dot(Di.subtract(_o,_o,e.o),t.n)/i;return n<0?0:n}),Ao=(fo=new Di(0,0,0),po=new Di(0,0,0),mo=new Di(0,0,0),go=new Di(0,0,0),vo=new Di(0,0,0),function(e,t,i){Di.subtract(fo,t.b,t.a),Di.subtract(po,t.c,t.a),Di.cross(mo,e.d,po);var n=Di.dot(fo,mo);if(n<Number.EPSILON&&(!i||n>-Number.EPSILON))return 0;var r=1/n;Di.subtract(go,e.o,t.a);var s=Di.dot(go,mo)*r;if(s<0||s>1)return 0;Di.cross(vo,go,fo);var a=Di.dot(e.d,vo)*r;if(a<0||s+a>1)return 0;var o=Di.dot(po,vo)*r;return o<0?0:o}),So=function(){var e=new Di(0,0,0);return function(t,i){var n=i.radius,r=i.center,s=t.o,a=t.d,o=n*n;Di.subtract(e,r,s);var u=e.lengthSqr(),h=Di.dot(e,a),c=o-(u-h*h);if(c<0)return 0;var l=Math.sqrt(c),_=u<o?h+l:h-l;return _<0?0:_}}(),bo=(yo=new Di,Eo=new Di,function(e,t){return Di.subtract(yo,t.center,t.halfExtents),Di.add(Eo,t.center,t.halfExtents),wo(e,yo,Eo)});function wo(e,t,i){var n=e.o,r=e.d,s=1/r.x,a=1/r.y,o=1/r.z,u=(t.x-n.x)*s,h=(i.x-n.x)*s,c=(t.y-n.y)*a,l=(i.y-n.y)*a,_=(t.z-n.z)*o,f=(i.z-n.z)*o,d=Math.max(Math.max(Math.min(u,h),Math.min(c,l)),Math.min(_,f)),p=Math.min(Math.min(Math.max(u,h),Math.max(c,l)),Math.max(_,f));return p<0||d>p?0:d>0?d:p}var Ro,Io,Oo,No,Co=function(){var e=new Di,t=new Di,i=new Di,n=new Di,r=new Di,s=new Di,a=new Di,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,Di.set(n,_.orientation.m00,_.orientation.m01,_.orientation.m02),Di.set(r,_.orientation.m03,_.orientation.m04,_.orientation.m05),Di.set(s,_.orientation.m06,_.orientation.m07,_.orientation.m08),Di.subtract(a,e,t),u[0]=Di.dot(n,i),u[1]=Di.dot(r,i),u[2]=Di.dot(s,i),h[0]=Di.dot(n,a),h[1]=Di.dot(r,a),h[2]=Di.dot(s,a);for(var f=0;f<3;++f){if(0===u[f]){if(-h[f]-o[f]>0||-h[f]+o[f]<0)return 0;u[f]=1e-7}c[2*f+0]=(h[f]+o[f])/u[f],c[2*f+1]=(h[f]-o[f])/u[f]}var d=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||d>p?0:d>0?d:p}}(),Mo=function(){var e=new Di,t=new Di,i=new Di,n=new Di,r=new Di,s=new Di,a=new Di,o=new co;return function(u,h){var c=h.radius*h.radius,l=Di.normalize(e,u.d),_=h.ellipseCenter0,f=h.ellipseCenter1,d=Di.subtract(t,f,_);if(d.equals(Di.ZERO))return o.radius=h.radius,o.center.set(h.ellipseCenter0),pu.raySphere(u,o);var p=u.o,m=Di.subtract(i,p,_),g=Di.cross(n,l,d),v=g.lengthSqr();if(0===v){o.radius=h.radius;var y=Di.subtract(r,f,p);return m.lengthSqr()<y.lengthSqr()?o.center.set(h.ellipseCenter0):o.center.set(h.ellipseCenter1),pu.raySphere(u,o)}var E=Di.cross(r,m,d),T=d.lengthSqr(),A=2*Di.dot(g,E),S=A*A-4*v*(E.lengthSqr()-c*T);if(S<0)return 0;var b=(-A-Math.sqrt(S))/(2*v);if(b<0){o.radius=h.radius;var w=Di.subtract(s,f,p);return m.lengthSqr()<w.lengthSqr()?o.center.set(h.ellipseCenter0):o.center.set(h.ellipseCenter1),pu.raySphere(u,o)}var R=Di.scaleAndAdd(s,u.o,l,b),I=Di.subtract(a,R,_),O=Di.dot(I,d)/T;return O>=0&&O<=1?b:O<0?(o.radius=h.radius,o.center.set(h.ellipseCenter0),pu.raySphere(u,o)):O>1?(o.radius=h.radius,o.center.set(h.ellipseCenter1),pu.raySphere(u,o)):0}}(),xo=(Ro=lo.create(),Io={distance:1/0,doubleSided:!1,mode:ho.ANY},Oo=0,No=function(e,t,i,n,r,s){e===ho.CLOSEST?(Oo>t||0===Oo)&&(Oo=t,s&&(0===s.length?s.push({distance:t,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}):(s[0].distance=t,s[0].vertexIndex0=i/3,s[0].vertexIndex1=n/3,s[0].vertexIndex2=r/3))):(Oo=t,s&&s.push({distance:t,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}))},function(e,t,i){if(Oo=0,0===t.geometricInfo.positions.length)return Oo;var n=void 0===i?Io:i;if(wo(e,t.geometricInfo.boundingBox.min,t.geometricInfo.boundingBox.max)){var r=t.primitiveMode,s=t.geometricInfo;!function(e,t,i,n,r){if(i===Vn.TRIANGLE_LIST)for(var s=t.length,a=0;a<s;a+=3){var o=3*t[a],u=3*t[a+1],h=3*t[a+2];Di.set(Ro.a,e[o],e[o+1],e[o+2]),Di.set(Ro.b,e[u],e[u+1],e[u+2]),Di.set(Ro.c,e[h],e[h+1],e[h+2]);var c=pu.rayTriangle(n,Ro,r.doubleSided);if(!(0===c||c>r.distance)&&(No(r.mode,c,o,u,h,r.result),r.mode===ho.ANY))return c}else if(i===Vn.TRIANGLE_STRIP)for(var l=t.length-2,_=0,f=0;f<l;f+=1){var d=3*t[f-_],p=3*t[f+_+1],m=3*t[f+2];Di.set(Ro.a,e[d],e[d+1],e[d+2]),Di.set(Ro.b,e[p],e[p+1],e[p+2]),Di.set(Ro.c,e[m],e[m+1],e[m+2]),_=~_;var g=pu.rayTriangle(n,Ro,r.doubleSided);if(!(0===g||g>r.distance)&&(No(r.mode,g,d,p,m,r.result),r.mode===ho.ANY))return g}else if(i===Vn.TRIANGLE_FAN){var v=t.length-1,y=3*t[0];Di.set(Ro.a,e[y],e[y+1],e[y+2]);for(var E=1;E<v;E+=1){var T=3*t[E],A=3*t[E+1];Di.set(Ro.b,e[T],e[T+1],e[T+2]),Di.set(Ro.c,e[A],e[A+1],e[A+2]);var S=pu.rayTriangle(n,Ro,r.doubleSided);if(!(0===S||S>r.distance)&&(No(r.mode,S,y,T,A,r.result),r.mode===ho.ANY))return S}}}(s.positions,s.indices,r,e,n)}return Oo}),Fo=function(){var e=0,t={distance:1/0,doubleSided:!1,mode:ho.ANY};return function(i,n,r){e=0;var s=void 0===r?t:r,a=n.renderingSubMeshes.length,o=n.struct.minPosition,u=n.struct.maxPosition;if(o&&u&&!wo(i,o,u))return e;for(var h=0;h<a;h++){var c=n.renderingSubMeshes[h],l=xo(i,c,s);if(l)if(s.mode===ho.CLOSEST)(0===e||e>l)&&(e=l,s.subIndices&&(s.subIndices[0]=h));else if(e=l,s.subIndices&&s.subIndices.push(h),s.mode===ho.ANY)return l}return e&&s.mode===ho.CLOSEST&&(s.result&&(s.result[0].distance=e,s.result.length=1),s.subIndices&&(s.subIndices.length=1)),e}}(),Po=function(){var e=0,t={distance:1/0,doubleSided:!1,mode:ho.ANY},i=new no,n=new Qi;return function(r,s,a){e=0;var o=void 0===a?t:a,u=s.worldBounds;if(u&&!bo(r,u))return e;no.copy(i,r),s.node&&(Qi.invert(n,s.node.getWorldMatrix(n)),Di.transformMat4(i.o,r.o,n),Di.transformMat4Normal(i.d,r.d,n));for(var h=s.subModels,c=0;c<h.length;c++){var l=h[c].subMesh,_=xo(i,l,o);if(_)if(o.mode===ho.CLOSEST)(0===e||e>_)&&(e=_,o.subIndices&&(o.subIndices[0]=c));else if(e=_,o.subIndices&&o.subIndices.push(c),o.mode===ho.ANY)return _}return e&&o.mode===ho.CLOSEST&&(o.result&&(o.result[0].distance=e,o.result.length=1),o.subIndices&&(o.subIndices.length=1)),e}}(),Do=function(){var e=new Di(0,0,0);return function(t,i){Di.subtract(e,t.e,t.s);var n=(i.d-Di.dot(t.s,i.n))/Di.dot(e,i.n);return n<0||n>1?0:n}}(),Lo=function(){var e=new Di(0,0,0),t=new Di(0,0,0),i=new Di(0,0,0),n=new Di(0,0,0),r=new Di(0,0,0),s=new Di(0,0,0);return function(a,o,u){Di.subtract(e,o.b,o.a),Di.subtract(t,o.c,o.a),Di.subtract(i,a.s,a.e),Di.cross(r,e,t);var h=Di.dot(i,r);if(h<=0)return 0;Di.subtract(n,a.s,o.a);var c=Di.dot(n,r);if(c<0||c>h)return 0;Di.cross(s,i,n);var l=Di.dot(t,s);if(l<0||l>h)return 0;var _=-Di.dot(e,s);if(_<0||l+_>h)return 0;if(u){var f=1/h,d=1-(l*=f)-(_*=f);Di.set(u,o.a.x*d+o.b.x*l+o.c.x*_,o.a.y*d+o.b.y*l+o.c.y*_,o.a.z*d+o.b.z*l+o.c.z*_)}return 1}}(),Bo=new no;function Uo(e,t){Bo.o.set(e.s),Di.subtract(Bo.d,e.e,e.s),Bo.d.normalize();var i=bo(Bo,t);return i<=e.length()?i:0}function Go(e,t){Bo.o.set(e.s),Di.subtract(Bo.d,e.e,e.s),Bo.d.normalize();var i=Co(Bo,t);return i<=e.length()?i:0}function zo(e,t){Bo.o.set(e.s),Di.subtract(Bo.d,e.e,e.s),Bo.d.normalize();var i=So(Bo,t);return i<=e.length()?i:0}var ko,Ho,Vo,Wo,jo=(ko=new Di,Ho=new Di,Vo=new Di,Wo=new Di,function(e,t){return Di.subtract(ko,e.center,e.halfExtents),Di.add(Ho,e.center,e.halfExtents),Di.subtract(Vo,t.center,t.halfExtents),Di.add(Wo,t.center,t.halfExtents),ko.x<=Wo.x&&Ho.x>=Vo.x&&ko.y<=Wo.y&&Ho.y>=Vo.y&&ko.z<=Wo.z&&Ho.z>=Vo.z});function Xo(e,t,i,n,r,s){Di.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),Di.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),Di.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),Di.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),Di.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),Di.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),Di.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),Di.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 Yo(e,t){for(var i=Di.dot(t,e[0]),n=i,r=1;r<8;++r){var s=Di.dot(t,e[r]);i=s<i?s:i,n=s>n?s:n}return[i,n]}var qo,Ko,Qo,Zo=function(){for(var e=new Array(15),t=0;t<15;t++)e[t]=new Di(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new Di(0,0,0),n[r]=new Di(0,0,0);var s=new Di,a=new Di;return function(t,r){Di.set(e[0],1,0,0),Di.set(e[1],0,1,0),Di.set(e[2],0,0,1),Di.set(e[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),Di.set(e[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),Di.set(e[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var o=0;o<3;++o)Di.cross(e[6+3*o],e[o],e[3]),Di.cross(e[7+3*o],e[o],e[4]),Di.cross(e[7+3*o],e[o],e[5]);Di.subtract(s,t.center,t.halfExtents),Di.add(a,t.center,t.halfExtents),function(e,t,i){Di.set(i[0],e.x,t.y,t.z),Di.set(i[1],e.x,t.y,e.z),Di.set(i[2],e.x,e.y,t.z),Di.set(i[3],e.x,e.y,e.z),Di.set(i[4],t.x,t.y,t.z),Di.set(i[5],t.x,t.y,e.z),Di.set(i[6],t.x,e.y,t.z),Di.set(i[7],t.x,e.y,e.z)}(s,a,i),Xo(r.center,r.halfExtents,e[3],e[4],e[5],n);for(var u=0;u<15;++u){var h=Yo(i,e[u]),c=Yo(n,e[u]);if(c[0]>h[1]||h[0]>c[1])return 0}return 1}}(),Jo=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=Di.dot(t.n,e.center);return n+i<t.d?-1:n-i>t.d?0:1},$o=function(e,t){for(var i=0;i<t.planes.length;i++)if(-1===Jo(e,t.planes[i]))return 0;return 1},eu=function(){for(var e=new Array(8),t=0,i=0,n=0;n<e.length;n++)e[n]=new Di(0,0,0);return function(n,r){for(var s=0,a=!1,o=0;o<r.planes.length;o++){if(-1===(s=Jo(n,r.planes[o])))return 0;1===s&&(a=!0)}if(!a)return 1;for(var u=0;u<r.vertices.length;u++)Di.subtract(e[u],r.vertices[u],n.center);t=0,i=0;for(var h=0;h<r.vertices.length;h++)e[h].x>n.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;c<r.vertices.length;c++)e[c].y>n.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;l<r.vertices.length;l++)e[l].z>n.halfExtents.z?t++:e[l].z<-n.halfExtents.z&&i++;return t===r.vertices.length||i===r.vertices.length?0:1}}(),tu=(qo=new Di(0,0,0),Ko=new Gi,function(e,t){return Di.subtract(qo,t,e.center),Di.transformMat3(qo,qo,Gi.transpose(Ko,e.orientation)),i=qo,n=e.halfExtents,Math.abs(i.x)<n.x&&Math.abs(i.y)<n.y&&Math.abs(i.z)<n.z;var i,n}),iu=(Qo=function(e,t,i,n){return Math.abs(e.x*t+e.y*i+e.z*n)},function(e,t){var i=e.halfExtents.x*Qo(t.n,e.orientation.m00,e.orientation.m01,e.orientation.m02)+e.halfExtents.y*Qo(t.n,e.orientation.m03,e.orientation.m04,e.orientation.m05)+e.halfExtents.z*Qo(t.n,e.orientation.m06,e.orientation.m07,e.orientation.m08),n=Di.dot(t.n,e.center);return n+i<t.d?-1:n-i>t.d?0:1}),nu=function(e,t){for(var i=0;i<t.planes.length;i++)if(-1===iu(e,t.planes[i]))return 0;return 1},ru=function(){for(var e=new Array(8),t=0,i=0,n=0,r=0;r<e.length;r++)e[r]=new Di(0,0,0);var s=function(e,t,i,n){return e.x*t+e.y*i+e.z*n};return function(r,a){for(var o=0,u=!1,h=0;h<a.planes.length;h++){if(-1===(o=iu(r,a.planes[h])))return 0;1===o&&(u=!0)}if(!u)return 1;for(var c=0;c<a.vertices.length;c++)Di.subtract(e[c],a.vertices[c],r.center);i=0,n=0;for(var l=0;l<a.vertices.length;l++)(t=s(e[l],r.orientation.m00,r.orientation.m01,r.orientation.m02))>r.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;_<a.vertices.length;_++)(t=s(e[_],r.orientation.m03,r.orientation.m04,r.orientation.m05))>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 f=0;f<a.vertices.length;f++)(t=s(e[f],r.orientation.m06,r.orientation.m07,r.orientation.m08))>r.halfExtents.z?i++:t<-r.halfExtents.z&&n++;return i===a.vertices.length||n===a.vertices.length?0:1}}(),su=function(){for(var e=new Array(15),t=0;t<15;t++)e[t]=new Di(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new Di(0,0,0),n[r]=new Di(0,0,0);return function(t,r){Di.set(e[0],t.orientation.m00,t.orientation.m01,t.orientation.m02),Di.set(e[1],t.orientation.m03,t.orientation.m04,t.orientation.m05),Di.set(e[2],t.orientation.m06,t.orientation.m07,t.orientation.m08),Di.set(e[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),Di.set(e[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),Di.set(e[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var s=0;s<3;++s)Di.cross(e[6+3*s],e[s],e[3]),Di.cross(e[7+3*s],e[s],e[4]),Di.cross(e[8+3*s],e[s],e[5]);Xo(t.center,t.halfExtents,e[0],e[1],e[2],i),Xo(r.center,r.halfExtents,e[3],e[4],e[5],n);for(var a=0;a<15;++a){var o=Yo(i,e[a]),u=Yo(n,e[a]);if(u[0]>o[1]||o[0]>u[1])return 0}return 1}}(),au=function(){for(var e=new co,t=new Di,i=new Di,n=new Di,r=new Array(8),s=0;s<8;s++)r[s]=new Di;for(var a=new Array(8),o=0;o<8;o++)a[o]=new Di;return function(s,o){if(0===Di.squaredDistance(o.ellipseCenter0,o.ellipseCenter1))return e.radius=o.radius,e.center.set(o.ellipseCenter0),pu.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,Xo(s.center,s.halfExtents,t,i,n,r);var u=a,h=Di.copy(u[0],t),c=Di.copy(u[1],i),l=Di.copy(u[2],n);Di.subtract(u[3],o.center,s.center).normalize();var _=Di.subtract(u[4],o.ellipseCenter0,o.ellipseCenter1);_.normalize(),Di.cross(u[5],h,_),Di.cross(u[6],c,_),Di.cross(u[7],l,_);for(var f=0;f<8;++f){var d=Yo(r,u[f]),p=Di.dot(u[f],o.ellipseCenter0),m=Di.dot(u[f],o.ellipseCenter1),g=Math.max(p,m),v=Math.min(p,m)-o.radius,y=g+o.radius;if(v>d[1]||d[0]>y)return 0}return 1}}(),ou=function(e,t){var i=Di.dot(t.n,e.center),n=e.radius*t.n.length();return i+n<t.d?-1:i-n>t.d?0:1},uu=function(e,t){for(var i=0;i<t.planes.length;i++)if(-1===ou(e,t.planes[i]))return 0;return 1},hu=function(){var e=new Di(0,0,0),t=[1,-1,1,-1,1,-1];return function(i,n){for(var r=0;r<6;r++){var s=n.planes[r],a=i.radius,o=i.center,u=s.n,h=s.d,c=Di.dot(u,o);if(c+a<h)return 0;if(!(c-a>h)){Di.add(e,o,Di.multiplyScalar(e,u,a));for(var l=0;l<6;l++)if(l!==r&&l!==r+t[r]){var _=n.planes[l];if(Di.dot(_.n,e)<_.d)return 0}}}return 1}}(),cu=function(e,t){var i=e.radius+t.radius;return Di.squaredDistance(e.center,t.center)<i*i},lu=function(){var e=new Di;return function(t,i){return $a(e,t.center,i),Di.squaredDistance(t.center,e)<t.radius*t.radius}}(),_u=function(){var e=new Di;return function(t,i){return eo(e,t.center,i),Di.squaredDistance(t.center,e)<t.radius*t.radius}}(),fu=function(){var e=new Di,t=new Di;return function(i,n){var r=i.radius+n.radius,s=r*r,a=Di.squaredDistance(n.ellipseCenter0,n.ellipseCenter1);if(0===a)return Di.squaredDistance(i.center,n.center)<s;Di.subtract(e,i.center,n.ellipseCenter0),Di.subtract(t,n.ellipseCenter1,n.ellipseCenter0);var o=Di.dot(e,t)/a;return o<0?Di.squaredDistance(i.center,n.ellipseCenter0)<s:o>1?Di.squaredDistance(i.center,n.ellipseCenter1)<s:(Di.scaleAndAdd(e,n.ellipseCenter0,t,o),Di.squaredDistance(i.center,e)<s)}}(),du=function(){var e=new Di,t=new Di,i=new Di,n=new Di,r=new Di,s=new Di;return function(a,o){var u,h,c=Di.subtract(e,a.ellipseCenter1,a.ellipseCenter0),l=Di.subtract(t,o.ellipseCenter1,o.ellipseCenter0),_=Di.subtract(i,a.ellipseCenter0,o.ellipseCenter0),f=Di.dot(c,c),d=Di.dot(c,l),p=Di.dot(l,l),m=Di.dot(c,_),g=Di.dot(l,_),v=f*p-d*d,y=v,E=v;v<gi?(u=0,y=1,h=g,E=p):(h=f*g-d*m,(u=d*g-p*m)<0?(u=0,h=g,E=p):u>y&&(u=y,h=g+d,E=p)),h<0?(h=0,-m<0?u=0:-m>f?u=y:(u=-m,y=f)):h>E&&(h=E,-m+d<0?u=0:-m+d>f?u=y:(u=-m+d,y=f));var T=Math.abs(u)<gi?0:u/y,A=Math.abs(h)<gi?0:h/E,S=n;S.set(_),S.add(Di.multiplyScalar(r,c,T)),S.subtract(Di.multiplyScalar(s,l,A));var b=a.radius+o.radius;return S.lengthSqr()<b*b}}(),pu=e("c6",{raySphere:So,rayAABB:bo,rayOBB:Co,rayPlane:To,rayTriangle:Ao,rayCapsule:Mo,raySubMesh:xo,rayMesh:Fo,rayModel:Po,lineSphere:zo,lineAABB:Uo,lineOBB:Go,linePlane:Do,lineTriangle:Lo,sphereWithSphere:cu,sphereAABB:lu,sphereOBB:_u,spherePlane:ou,sphereFrustum:uu,sphereFrustumAccurate:hu,sphereCapsule:fu,aabbWithAABB:jo,aabbWithOBB:Zo,aabbPlane:Jo,aabbFrustum:$o,aabbFrustumAccurate:eu,obbWithOBB:su,obbPlane:iu,obbFrustum:nu,obbFrustumAccurate:ru,obbPoint:tu,obbCapsule:au,aabbFrustumCompletelyInside:function(e,t){for(var i=0;i<t.planes.length;i++)if(0!==Jo(e,t.planes[i]))return 0;return 1},capsuleWithCapsule:du,resolve:function(e,t,i){void 0===i&&(i=null);var n=e._type,r=t._type,s=this[n|r];return n<r?s(e,t,i):s(t,e,i)}});pu[to.SHAPE_RAY|to.SHAPE_SPHERE]=So,pu[to.SHAPE_RAY|to.SHAPE_AABB]=bo,pu[to.SHAPE_RAY|to.SHAPE_OBB]=Co,pu[to.SHAPE_RAY|to.SHAPE_PLANE]=To,pu[to.SHAPE_RAY|to.SHAPE_TRIANGLE]=Ao,pu[to.SHAPE_RAY|to.SHAPE_CAPSULE]=Mo,pu[to.SHAPE_LINE|to.SHAPE_SPHERE]=zo,pu[to.SHAPE_LINE|to.SHAPE_AABB]=Uo,pu[to.SHAPE_LINE|to.SHAPE_OBB]=Go,pu[to.SHAPE_LINE|to.SHAPE_PLANE]=Do,pu[to.SHAPE_LINE|to.SHAPE_TRIANGLE]=Lo,pu[to.SHAPE_SPHERE]=cu,pu[to.SHAPE_SPHERE|to.SHAPE_AABB]=lu,pu[to.SHAPE_SPHERE|to.SHAPE_OBB]=_u,pu[to.SHAPE_SPHERE|to.SHAPE_PLANE]=ou,pu[to.SHAPE_SPHERE|to.SHAPE_FRUSTUM]=uu,pu[to.SHAPE_SPHERE|to.SHAPE_FRUSTUM_ACCURATE]=hu,pu[to.SHAPE_SPHERE|to.SHAPE_CAPSULE]=fu,pu[to.SHAPE_AABB]=jo,pu[to.SHAPE_AABB|to.SHAPE_OBB]=Zo,pu[to.SHAPE_AABB|to.SHAPE_PLANE]=Jo,pu[to.SHAPE_AABB|to.SHAPE_FRUSTUM]=$o,pu[to.SHAPE_AABB|to.SHAPE_FRUSTUM_ACCURATE]=eu,pu[to.SHAPE_OBB]=su,pu[to.SHAPE_OBB|to.SHAPE_PLANE]=iu,pu[to.SHAPE_OBB|to.SHAPE_FRUSTUM]=nu,pu[to.SHAPE_OBB|to.SHAPE_FRUSTUM_ACCURATE]=ru,pu[to.SHAPE_OBB|to.SHAPE_CAPSULE]=au,pu[to.SHAPE_CAPSULE]=du,ie(io.prototype,"line",[{name:"mag",newName:"len"},{name:"magnitude",newName:"len"}]),ne(pu,"intersect",[{name:"line_quad"}]);var mu=new Di(0,0,0),gu=new Di(0,0,0),vu=R.mat4(),yu=R.v4(),Eu=e("c8",function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=1),void 0===i&&(i=0),void 0===n&&(n=0),this.n=void 0,this.d=void 0,this._type=void 0,this._type=to.SHAPE_PLANE,this.n=new Di(e,t,i),this.d=n}return e.create=function(t,i,n,r){return new e(t,i,n,r)},e.clone=function(t){return new e(t.n.x,t.n.y,t.n.z,t.d)},e.copy=function(e,t){return Di.copy(e.n,t.n),e.d=t.d,e},e.fromPoints=function(e,t,i,n){return Di.subtract(mu,i,t),Di.subtract(gu,n,t),Di.normalize(e.n,Di.cross(e.n,mu,gu)),e.d=Di.dot(e.n,t),e},e.set=function(e,t,i,n,r){return e.n.x=t,e.n.y=i,e.n.z=n,e.d=r,e},e.fromNormalAndPoint=function(e,t,i){return Di.copy(e.n,t),e.d=Di.dot(t,i),e},e.normalize=function(e,t){var i=t.n.length();return Di.normalize(e.n,t.n),i>0&&(e.d=t.d/i),e},e.prototype.transform=function(e){Qi.invert(vu,e),Qi.transpose(vu,vu),sn.set(yu,this.n.x,this.n.y,this.n.z,this.d),sn.transformMat4(yu,yu,vu),Di.set(this.n,yu.x,yu.y,yu.z),this.d=yu.w},c(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}()),Tu=new Di,Au=new Di,Su=new Di,bu=new Di,wu=new Gi,Ru=function(e,t,i){wu.m00=Math.abs(i.m00),wu.m01=Math.abs(i.m01),wu.m02=Math.abs(i.m02),wu.m03=Math.abs(i.m04),wu.m04=Math.abs(i.m05),wu.m05=Math.abs(i.m06),wu.m06=Math.abs(i.m08),wu.m07=Math.abs(i.m09),wu.m08=Math.abs(i.m10),Di.transformMat3(e,t,wu)},Iu=e("cc",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=to.SHAPE_AABB,this.center=new Di(e,t,i),this.halfExtents=new Di(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 Di.copy(e.center,t.center),Di.copy(e.halfExtents,t.halfExtents),e},e.fromPoints=function(e,t,i){return Di.add(Tu,i,t),Di.subtract(Au,i,t),Di.multiplyScalar(e.center,Tu,.5),Di.multiplyScalar(e.halfExtents,Au,.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 Di.subtract(Tu,i.center,i.halfExtents),Di.subtract(Au,n.center,n.halfExtents),Di.add(Su,i.center,i.halfExtents),Di.add(bu,n.center,n.halfExtents),Di.max(bu,Su,bu),Di.min(Su,Tu,Au),e.fromPoints(t,Su,bu)},e.toBoundingSphere=function(e,t){return e.center.set(t.center),e.radius=t.halfExtents.length(),e},e.transform=function(e,t,i){return Di.transformMat4(e.center,t.center,i),Ru(e.halfExtents,t.halfExtents,i),e};var t=e.prototype;return t.getBoundary=function(e,t){Di.subtract(e,this.center,this.halfExtents),Di.add(t,this.center,this.halfExtents)},t.transform=function(e,t,i,n,r){Di.transformMat4(r.center,this.center,e),Ru(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(Tu,Au),e.x<Tu.x&&(Tu.x=e.x),e.y<Tu.y&&(Tu.y=e.y),e.z<Tu.z&&(Tu.z=e.z),e.x>Au.x&&(Au.x=e.x),e.y>Au.y&&(Au.y=e.y),e.z>Au.z&&(Au.z=e.z),Di.add(Su,Tu,Au),this.center.set(Di.multiplyScalar(Su,Su,.5)),this.halfExtents.set(Au.x-Su.x,Au.y-Su.y,Au.z-Su.z)},t.mergePoints=function(e){if(!(e.length<1))for(var t=0;t<e.length;t++)this.mergePoint(e[t])},t.mergeFrustum=function(e){return this.mergePoints(e.vertices)},c(e,[{key:"type",get:function(){return this._type}}]),e}()),Ou=new Di,Nu=new Di,Cu=new Gi,Mu=e("cd",function(){function e(e,t,i,n,r,s,a,o,u,h,c,l,_,f,d){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),void 0===a&&(a=1),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===f&&(f=0),void 0===d&&(d=1),this.center=void 0,this.halfExtents=void 0,this.orientation=void 0,this._type=void 0,this._type=to.SHAPE_OBB,this.center=new Di(e,t,i),this.halfExtents=new Di(n,r,s),this.orientation=new Gi(a,o,u,h,c,l,_,f,d)}e.create=function(t,i,n,r,s,a,o,u,h,c,l,_,f,d,p){return new e(t,i,n,r,s,a,o,u,h,c,l,_,f,d,p)},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,t.orientation.m00,t.orientation.m01,t.orientation.m02,t.orientation.m03,t.orientation.m04,t.orientation.m05,t.orientation.m06,t.orientation.m07,t.orientation.m08)},e.copy=function(e,t){return Di.copy(e.center,t.center),Di.copy(e.halfExtents,t.halfExtents),Gi.copy(e.orientation,t.orientation),e},e.fromPoints=function(e,t,i){return Di.multiplyScalar(e.center,Di.add(Ou,t,i),.5),Di.multiplyScalar(e.halfExtents,Di.subtract(Nu,i,t),.5),Gi.identity(e.orientation),e},e.set=function(e,t,i,n,r,s,a,o,u,h,c,l,_,f,d,p){return Di.set(e.center,t,i,n),Di.set(e.halfExtents,r,s,a),Gi.set(e.orientation,o,u,h,c,l,_,f,d,p),e};var t=e.prototype;return t.getBoundary=function(e,t){!function(e,t,i){Cu.m00=Math.abs(i.m00),Cu.m01=Math.abs(i.m01),Cu.m02=Math.abs(i.m02),Cu.m03=Math.abs(i.m03),Cu.m04=Math.abs(i.m04),Cu.m05=Math.abs(i.m05),Cu.m06=Math.abs(i.m06),Cu.m07=Math.abs(i.m07),Cu.m08=Math.abs(i.m08),Di.transformMat3(e,t,Cu)}(Ou,this.halfExtents,this.orientation),Di.subtract(e,this.center,Ou),Di.add(t,this.center,Ou)},t.transform=function(e,t,i,n,r){Di.transformMat4(r.center,this.center,e),Gi.fromQuat(r.orientation,i),Di.multiply(r.halfExtents,this.halfExtents,n)},t.translateAndRotate=function(e,t,i){Di.transformMat4(i.center,this.center,e),Gi.fromQuat(i.orientation,t)},t.setScale=function(e,t){Di.multiply(t.halfExtents,this.halfExtents,e)},c(e,[{key:"type",get:function(){return this._type}}]),e}()),xu=e("ce",function(){function e(e,t,i){void 0===e&&(e=.5),void 0===t&&(t=.5),void 0===i&&(i=1),this._type=void 0,this.radius=void 0,this.halfHeight=void 0,this.axis=void 0,this.center=void 0,this.rotation=void 0,this.ellipseCenter0=void 0,this.ellipseCenter1=void 0,this._type=to.SHAPE_CAPSULE,this.radius=e,this.halfHeight=t,this.axis=i,this.center=new Di,this.rotation=new Hi,this.ellipseCenter0=new Di(0,t,0),this.ellipseCenter1=new Di(0,-t,0),this.updateCache()}var t=e.prototype;return t.transform=function(e,t,i,n,r){var s=n,a=Mi(s);r.radius=this.radius*Math.abs(a);var o=(this.halfHeight+this.radius)*Math.abs(s.y)-r.radius;o<0&&(o=0),r.halfHeight=o,Di.transformMat4(r.center,this.center,e),Hi.multiply(r.rotation,this.rotation,i),r.updateCache()},t.updateCache=function(){this.updateLocalCenter(),Di.transformQuat(this.ellipseCenter0,this.ellipseCenter0,this.rotation),Di.transformQuat(this.ellipseCenter1,this.ellipseCenter1,this.rotation),this.ellipseCenter0.add(this.center),this.ellipseCenter1.add(this.center)},t.updateLocalCenter=function(){var e=this.halfHeight;switch(this.axis){case 0:this.ellipseCenter0.set(e,0,0),this.ellipseCenter1.set(-e,0,0);break;case 1:this.ellipseCenter0.set(0,e,0),this.ellipseCenter1.set(0,-e,0);break;case 2:this.ellipseCenter0.set(0,0,e),this.ellipseCenter1.set(0,0,-e)}},c(e,[{key:"type",get:function(){return this._type}}]),e}()),Fu=new Array(8);Fu[0]=new Di(1,1,1),Fu[1]=new Di(-1,1,1),Fu[2]=new Di(-1,-1,1),Fu[3]=new Di(1,-1,1),Fu[4]=new Di(1,1,-1),Fu[5]=new Di(-1,1,-1),Fu[6]=new Di(-1,-1,-1),Fu[7]=new Di(1,-1,-1);var Pu,Du,Lu,Bu=new Di,Uu=new Di,Gu=new Di,zu=e("cf",function(){function e(){this.planes=void 0,this.vertices=void 0,this._type=void 0,this._type=to.SHAPE_FRUSTUM,this.planes=new Array(6);for(var e=0;e<6;++e)this.planes[e]=Eu.create(0,0,0,0);this.vertices=new Array(8);for(var t=0;t<8;++t)this.vertices[t]=new Di}e.createFromAABB=function(e,t){var i=new Di,n=new Di;return Di.subtract(i,t.center,t.halfExtents),Di.add(n,t.center,t.halfExtents),e.vertices[0].set(i.x,n.y,i.z),e.vertices[1].set(n.x,n.y,i.z),e.vertices[2].set(n.x,i.y,i.z),e.vertices[3].set(i.x,i.y,i.z),e.vertices[4].set(i.x,n.y,n.z),e.vertices[5].set(n.x,n.y,n.z),e.vertices[6].set(n.x,i.y,n.z),e.vertices[7].set(i.x,i.y,n.z),e._type!==to.SHAPE_FRUSTUM_ACCURATE||e.updatePlanes(),e},e.split=function(e,t,i,n,r){var s=Math.tan(.5*t.fov),a=s*t.aspect;Bu.set(n*a,n*s,n),Uu.set(r*a,r*s,r);var o=e.vertices;return Gu.set(Bu.x,Bu.y,Bu.z),Di.transformMat4(o[0],Gu,i),Gu.set(-Bu.x,Bu.y,Bu.z),Di.transformMat4(o[1],Gu,i),Gu.set(-Bu.x,-Bu.y,Bu.z),Di.transformMat4(o[2],Gu,i),Gu.set(Bu.x,-Bu.y,Bu.z),Di.transformMat4(o[3],Gu,i),Gu.set(Uu.x,Uu.y,Uu.z),Di.transformMat4(o[4],Gu,i),Gu.set(-Uu.x,Uu.y,Uu.z),Di.transformMat4(o[5],Gu,i),Gu.set(-Uu.x,-Uu.y,Uu.z),Di.transformMat4(o[6],Gu,i),Gu.set(Uu.x,-Uu.y,Uu.z),Di.transformMat4(o[7],Gu,i),e.updatePlanes(),e},e.create=function(){return new e},e.clone=function(t){return e.copy(new e,t)},e.copy=function(e,t){e._type=t.type;for(var i=0;i<6;++i)Eu.copy(e.planes[i],t.planes[i]);for(var n=0;n<8;++n)Di.copy(e.vertices[n],t.vertices[n]);return e};var t=e.prototype;return t.update=function(e,t){if(Di.set(this.planes[0].n,e.m03+e.m00,e.m07+e.m04,e.m11+e.m08),this.planes[0].d=-(e.m15+e.m12),Di.set(this.planes[1].n,e.m03-e.m00,e.m07-e.m04,e.m11-e.m08),this.planes[1].d=-(e.m15-e.m12),Di.set(this.planes[2].n,e.m03+e.m01,e.m07+e.m05,e.m11+e.m09),this.planes[2].d=-(e.m15+e.m13),Di.set(this.planes[3].n,e.m03-e.m01,e.m07-e.m05,e.m11-e.m09),this.planes[3].d=-(e.m15-e.m13),Di.set(this.planes[4].n,e.m03+e.m02,e.m07+e.m06,e.m11+e.m10),this.planes[4].d=-(e.m15+e.m14),Di.set(this.planes[5].n,e.m03-e.m02,e.m07-e.m06,e.m11-e.m10),this.planes[5].d=-(e.m15-e.m14),this._type===to.SHAPE_FRUSTUM_ACCURATE){for(var i=0;i<6;i++){var n=this.planes[i],r=1/n.n.length();Di.multiplyScalar(n.n,n.n,r),n.d*=r}for(var s=0;s<8;s++)Di.transformMat4(this.vertices[s],Fu[s],t)}},t.transform=function(e){if(this._type===to.SHAPE_FRUSTUM_ACCURATE){for(var t=0;t<8;t++)Di.transformMat4(this.vertices[t],this.vertices[t],e);this.updatePlanes()}},t.zero=function(){for(var e=0;e<8;e++)this.vertices[e].set(0,0,0);this.updatePlanes()},t.updatePlanes=function(){Eu.fromPoints(this.planes[0],this.vertices[1],this.vertices[6],this.vertices[5]),Eu.fromPoints(this.planes[1],this.vertices[3],this.vertices[4],this.vertices[7]),Eu.fromPoints(this.planes[2],this.vertices[6],this.vertices[3],this.vertices[7]),Eu.fromPoints(this.planes[3],this.vertices[0],this.vertices[5],this.vertices[4]),Eu.fromPoints(this.planes[4],this.vertices[2],this.vertices[0],this.vertices[3]),Eu.fromPoints(this.planes[5],this.vertices[7],this.vertices[5],this.vertices[6])},c(e,[{key:"accurate",set:function(e){this._type=e?to.SHAPE_FRUSTUM_ACCURATE:to.SHAPE_FRUSTUM}},{key:"type",get:function(){return this._type}}]),e}());function ku(e,t,i){void 0===i&&(i=1e-6);for(var n=0,r=e.length-1,s=r>>>1;n<=r;s=n+r>>>1){var a=e[s];if(a>t+i)r=s-1;else{if(!(a<t-i))return s;n=s+1}}return~n}zu.createOrtho=function(e,t,i,n,r,s){var a=t/2,o=i/2;Di.set(Gu,a,o,-n),Di.transformMat4(e.vertices[0],Gu,s),Di.set(Gu,-a,o,-n),Di.transformMat4(e.vertices[1],Gu,s),Di.set(Gu,-a,-o,-n),Di.transformMat4(e.vertices[2],Gu,s),Di.set(Gu,a,-o,-n),Di.transformMat4(e.vertices[3],Gu,s),Di.set(Gu,a,o,-r),Di.transformMat4(e.vertices[4],Gu,s),Di.set(Gu,-a,o,-r),Di.transformMat4(e.vertices[5],Gu,s),Di.set(Gu,-a,-o,-r),Di.transformMat4(e.vertices[6],Gu,s),Di.set(Gu,a,-o,-r),Di.transformMat4(e.vertices[7],Gu,s),Eu.fromPoints(e.planes[0],e.vertices[1],e.vertices[6],e.vertices[5]),Eu.fromPoints(e.planes[1],e.vertices[3],e.vertices[4],e.vertices[7]),Eu.fromPoints(e.planes[2],e.vertices[6],e.vertices[3],e.vertices[7]),Eu.fromPoints(e.planes[3],e.vertices[0],e.vertices[5],e.vertices[4]),Eu.fromPoints(e.planes[4],e.vertices[2],e.vertices[0],e.vertices[3]),Eu.fromPoints(e.planes[5],e.vertices[7],e.vertices[5],e.vertices[6])},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"}(Pu||(Pu=e("fk",{}))),function(e){e[e.Default=Pu.Default]="Default",e[e.Normal=Pu.Normal]="Normal",e[e.Reverse=Pu.Reverse]="Reverse",e[e.Loop=Pu.Loop]="Loop",e[e.LoopReverse=Pu.Loop|Pu.Reverse]="LoopReverse",e[e.PingPong=Pu.PingPong]="PingPong",e[e.PingPongReverse=Pu.PingPong|Pu.Reverse]="PingPongReverse"}(Du||(Du=e("fm",{}))),gt(Du),e("fl",function(){function e(e){this.ratio=0,this.time=0,this.direction=1,this.stopped=!0,this.iterations=0,this.frameIndex=void 0,e&&this.set(e)}return e.prototype.set=function(e){this.ratio=e.ratio,this.time=e.time,this.direction=e.direction,this.stopped=e.stopped,this.iterations=e.iterations,this.frameIndex=e.frameIndex},e}()),Lu=Symbol.iterator;var Hu,Vu,Wu,ju=function(){function e(){this._times=[],this._values=[]}var t=e.prototype;return t[Lu]=function(){var e=this,t=0;return{next:function(){if(t>=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 ku(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 ku(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]||vi(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=ku(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},c(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 Xu(e){return e>-1e-9&&e<1e-9}li.fastDefine("cc.KeyframeCurve",ju,{_times:[],_values:[]}),function(e){e[e.LINEAR=0]="LINEAR",e[e.CONSTANT=1]="CONSTANT",e[e.CUBIC=2]="CUBIC"}(Hu||(Hu=e("fF",{}))),function(e){e[e.LINEAR=0]="LINEAR",e[e.CLAMP=1]="CLAMP",e[e.LOOP=2]="LOOP",e[e.PING_PONG=3]="PING_PONG"}(Vu||(Vu=e("hM",{}))),function(e){e[e.NONE=0]="NONE",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.BOTH=3]="BOTH"}(Wu||(Wu=e("fG",{})));var Yu=function(){},qu=function(){return Yu},Ku=Qu((function(){}));function Qu(e){return function(t){return"function"==typeof t?e(t):function(i){return e(i,t)}}}function Zu(e){return function(t){return function(i){!function(e,t,i){var n=$u(e);if(n){var r=eh(n,"proto");eh(r,"editor")[t]=i}}(i,e,t)}}}var Ju="__ccclassCache__";function $u(e){return eh(e,Ju)}function eh(e,t){return e[t]||(e[t]={})}var th=e("dO",Qu((function(e,t){var i=_t.getSuper(e);i===Object&&(i=null);var n={name:t,extends:i,ctor:e},r=e[Ju];if(r){var s=r.proto;s&&_t.mixin(n,s),e[Ju]=void 0}return li(n)}))),ih=e("en",Zu("requireComponent")),nh=e("ec",Zu("executionOrder")),rh=e("e8",Ku);function sh(e,t,i){var n=null;function r(e,t,i){!function(e,t,i,n,r,s){var a,o=s&&(s.get||s.set);r&&(a=ei(r,o));var u=_t.mixin(t,a||r||{});o?(s.get&&(u.get=s.get),s.set&&(u.set=s.set)):oh(e,u,i,n,s)}(function(e){return $u(e.constructor)}(e),function(e,t){var i,n,r=eh($u(e.constructor),"proto"),s=eh(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?sh({type:void 0}):void 0===t?(n=e,r):void r(e,t,i)}function ah(e,t,i){var n,r,s=$u(e.constructor),a=eh(s,"proto"),o=eh(a,"properties"),u=null!==(r=o[n=t])&&void 0!==r?r:o[n]={};return u.__internalFlags|=ti.STANDALONE,i&&(i.get||i.set)?(i.get&&(u.get=i.get),i.set&&(u.set=i.set)):oh(s,u,e.constructor,t,i),u}function oh(e,t,i,n,r){if(r)r.initializer&&(t.default=function(e){var t;try{t=e()}catch(t){return e}return"object"!=typeof t||null===t?t:e}(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 uh=Symbol("cc:SerializationMetadata"),hh=e("dV",(function(e,t,i){_h(ah(e,t,i))}));function ch(e){return function(t,i,n){var r=ah(t,i,n);r.formerlySerializedAs=e,_h(r)}}var lh=e("gE",(function(e,t,i){var n=ah(e,t,i);n.editorOnly=!0,_h(n)}));function _h(e){e.__internalFlags|=ti.IMPLICIT_SERIALIZABLE}var fh=e("fo",Yu),dh=e("e9",Ku),ph=e("ed",qu),mh=e("gd",Ku),gh=qu,vh=qu,yh=e("eb",qu),Eh=e("e1",Yu),Th=e("eo",qu),Ah=e("gi",Yu),Sh=e("ep",qu),bh=e("ef",qu),wh=e("eN",qu),Rh=e("gs",qu),Ih=(e("gt",qu),e("ga",qu)),Oh=e("eQ",Yu),Nh=e("ee",qu),Ch=(e("g7",Yu),e("er",Yu),e("em",Yu)),Mh=Dh(Wt),xh=e("fq",Dh(jt)),Fh=Dh(Xt),Ph=e("e3",Dh(Yt));function Dh(e){return sh({type:e})}var Lh=e("e2",(function(e,t,i){ah(e,t,i).override=!0})),Bh=e("fj",(function(){})),Uh=Object.freeze({__proto__:null,uniquelyReferenced:fh,ccclass:th,property:sh,requireComponent:ih,executionOrder:nh,disallowMultiple:rh,allowReplicated:function(e){li.Attr.setClassAttr(e,"replicated","visible",!0)},executeInEditMode:dh,menu:ph,playOnFocus:mh,inspector:gh,icon:vh,help:yh,type:Dh,integer:Mh,float:xh,boolean:Fh,string:Ph});e("gT",Uh);var Gh=e("dp",function(){function e(e){this._map=null,this._count=0,e?(this._map=e,this._count=Object.keys(e).length):(this._map=_t.createMap(!0),this._count=0)}var t=e.prototype;return t.add=function(e,t){return e in this._map||this._count++,this._map[e]=t},t.get=function(e){return this._map[e]},t.has=function(e){return e in this._map},t.remove=function(e){var t=this._map[e];return e in this._map&&(delete this._map[e],this._count--),t},t.clear=function(){0!==this._count&&(this._map=_t.createMap(!0),this._count=0)},t.forEach=function(e){for(var t in this._map)e(this._map[t],t)},t.find=function(e){for(var t in this._map)if(e(this._map[t],t))return this._map[t];return null},t.destroy=function(){this._map=null},c(e,[{key:"count",get:function(){return this._count}}]),e}()),zh=function(){function e(t,i){this.id=e._pipelineId++,this.name="",this.pipes=[],this.name=t;for(var n=0,r=i.length;n<r;n++)this.pipes.push(i[n])}var t=e.prototype;return t.insert=function(e,t){return t>this.pipes.length?(Y(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.isFinish=!1;for(var i=0,n=t.length;i<n;){var r=(0,t[i])(e);if(r)return e.isFinish=!0,r;++i!==n&&(e.input=e.output,e.output=null)}return e.isFinish=!0,e.output},t.async=function(e){0!==this.pipes.length&&(e.isFinish=!1,this._flow(0,e))},t._flow=function(e,t){var i=this;(0,this.pipes[e])(t,(function(n){n?(t.isFinish=!0,t.dispatch("complete",n)):++e<i.pipes.length?(t.input=t.output,t.output=null,i._flow(e,t)):(t.isFinish=!0,t.dispatch("complete",n,t.output))}))},e}();zh._pipelineId=0,function(){function e(e){if(this._weakMap={},void 0===window.WeakRef)throw new Error("this platform does not support WeakRef!");if(e)for(var t in e)this._weakMap[t]=new WeakRef(e[t])}var t=e.prototype;t.add=function(e,t){return this._weakMap[e]=new WeakRef(t),t},t.has=function(e){return e in this._weakMap&&!!this._weakMap[e].deref()},t.get=function(e){return this._weakMap[e]&&this._weakMap[e].deref()},t.remove=function(e){var t=this._weakMap[e];return delete this._weakMap[e],t&&t.deref()},t.clear=function(){this._weakMap=_t.createMap(!0)},t.forEach=function(e){for(var t in this._weakMap){var i=this.get(t);i&&e(i,t)}},t.find=function(e){for(var t in this._weakMap){var i=this.get(t);if(i&&e(i,t))return this._weakMap[t].deref()}return null},t.destroy=function(){this._weakMap={}},c(e,[{key:"count",get:function(){return Object.values(this._weakMap).filter((function(e){return e.deref()})).length}}])}();var kh,Hh=e("d7",new Gh),Vh=new Gh,Wh=new Gh,jh=e("dr",new Gh),Xh=new zh("normal load",[]),Yh=new zh("fetch",[]),qh=new zh("transform url",[]);!function(e){e.UUID="uuid",e.PATH="path",e.DIR="dir",e.URL="url",e.SCENE="scene"}(kh||(kh={}));var Kh,Qh={default:{priority:0},preload:{maxConcurrency:6,maxRequestsPerFrame:2,priority:-1},scene:{maxConcurrency:20,maxRequestsPerFrame:20,priority:1},bundle:{maxConcurrency:20,maxRequestsPerFrame:20,priority:2},remote:{maxRetryCount:4}};!function(e){e.INTERNAL="internal",e.RESOURCES="resources",e.MAIN="main",e.START_SCENE="start-scene"}(Kh||(Kh=e("dc",{})));var Zh=function(){function e(t){this.id=e._taskId++,this.onComplete=null,this.onProgress=null,this.onError=null,this.source=null,this.output=null,this.input=null,this.progress=null,this.options=null,this.isFinish=!0,this.set(t)}e.create=function(t){var i;return 0!==e._deadPool.length?(i=e._deadPool.pop()).set(t):i=new e(t),i};var t=e.prototype;return t.set=function(e){void 0===e&&(e=Object.create(null)),this.onComplete=e.onComplete||null,this.onProgress=e.onProgress||null,this.onError=e.onError||null,this.source=this.input=e.input,this.output=null,this.progress=e.progress,this.options=e.options||Object.create(null)},t.dispatch=function(e,t,i,n,r){switch(e){case"complete":this.onComplete&&this.onComplete(t,i);break;case"progress":this.onProgress&&this.onProgress(t,i,n,r);break;case"error":this.onError&&this.onError(t,i,n,r);break;default:var s="on"+e[0].toUpperCase()+e.substr(1);"function"==typeof this[s]&&this[s](t,i,n,r)}},t.recycle=function(){e._deadPool.length!==e.MAX_DEAD_NUM&&(this.onComplete=null,this.onProgress=null,this.onError=null,this.source=this.output=this.input=null,this.progress=null,this.options=null,e._deadPool.push(this))},e}();Zh.MAX_DEAD_NUM=500,Zh._taskId=0,Zh._deadPool=[];var Jh="0123456789abcdef".split(""),$h=["","","",""],ec=$h.concat($h,"-",$h,"-",$h,"-",$h,"-",$h,$h,$h),tc=ec.map((function(e,t){return"-"===e?NaN:t})).filter(isFinite);function ic(e){var t=e.split("@")[0];if(22!==t.length)return e;ec[0]=e[0],ec[1]=e[1];for(var i=2,n=2;i<22;i+=2){var r=It[e.charCodeAt(i)],s=It[e.charCodeAt(i+1)];ec[tc[n++]]=Jh[r>>2],ec[tc[n++]]=Jh[(3&r)<<2|s>>4],ec[tc[n++]]=Jh[15&s]}return e.replace(t,ec.join(""))}var nc=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;function rc(e){var t=nc.exec(e);return t?t[1]:""}function sc(e,t){(t=t||Object.create(null)).__isNative__=t.isNative,t.nativeExt&&(t.ext=t.nativeExt);var i=jh.find((function(t){return!!t.getAssetInfo(e)}));return i&&(t.bundle=i.name),uc(e,t)}function ac(e){return!!e&&(e instanceof R.SceneAsset||e instanceof R.Scene)}function oc(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 uc(e,t){var i=Zh.create({input:e,options:t}),n=[];try{for(var r,s=E(qh.sync(i));!(r=s()).done;){var a=r.value,o=a.url;a.recycle(),n.push(o)}}catch(e){for(var u,h=E(i.output);!(u=h()).done;)u.value.recycle();U(e.message,e.stack)}return i.recycle(),n.length>1?n:n[0]}var hc,cc,lc,_c,fc=Object.freeze({__proto__:null,getUuidFromURL:rc,getUrlWithUuid:sc,isScene:ac,normalize:oc,transform:uc,decodeUuid:ic}),dc=/(\.[^\.\/\?\\]*)(\?.*)?$/,pc=/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,mc=/[^\.\/]+\/\.\.\//;function gc(){for(var e="",t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];for(var r=0,s=i;r<s.length;r++){var a=s[r];e=(e+(""===e?"":"/")+a).replace(/(\/|\\\\)$/,"")}return e}function vc(e){var t=dc.exec(e);return t?t[1]:""}function yc(e){if(e){var t=e.lastIndexOf(".");if(-1!==t)return e.substring(0,t)}return e}function Ec(e,t){var i=e.indexOf("?");i>0&&(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 Tc(e){var t=pc.exec(e);return t?t[2]:""}function Ac(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 Ac(e,t);var n=e.indexOf("?"),r="",s=i?vc(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 bc(e){var t=e=String(e);do{t=e,e=e.replace(mc,"")}while(t.length!==e.length);return e}function wc(e){return e.replace(/[\/\\]$/,"")}function Rc(){return xa.os===Ra.WINDOWS?"\\":"/"}e("gL",Object.freeze({__proto__:null,join:gc,extname:vc,mainFileName:yc,basename:Ec,dirname:Tc,changeExtname:Ac,changeBasename:Sc,_normalize:bc,stripSep:wc,getSeperator:Rc}));var Ic,Oc,Nc,Cc=e("dl",th("cc.Asset")((_c=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).loaded=!0,T(t,"_native",lc,v(t)),t._nativeUrl="",t._file=null,t._ref=0,Object.defineProperty(v(t),"_uuid",{value:"",writable:!0}),t}_(t,e),t.deserialize=function(e){return R.deserialize(e)};var i=t.prototype;return i.toString=function(){return this.nativeUrl},i.serialize=function(){},i._setRawAsset=function(e,t){void 0===t&&(t=!0),this._native=!1!==t?e||"":"/"+e},i.addRef=function(){return this._ref++,this},i.decRef=function(e){return void 0===e&&(e=!0),this._ref>0&&this._ref--,e&&R.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($(12101,this._uuid)),e.prototype.destroy.call(this)},c(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=sc(this._uuid,{nativeExt:e,isNative:!0}):this._nativeUrl=sc(this._uuid,{__nativeName__:e,nativeExt:vc(e),isNative:!0})}return this._nativeUrl}},{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}(Ta(ca)),lc=A((cc=_c).prototype,"_native",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),A(cc.prototype,"_nativeAsset",[sh],Object.getOwnPropertyDescriptor(cc.prototype,"_nativeAsset"),cc.prototype),hc=cc))||hc);Cc.prototype.createNode=null,R.Asset=Cc;var Mc=e("h5",th("cc.Script")(Ic=function(e){function t(){return e.apply(this,arguments)||this}return _(t,e),t}(Cc))||Ic);R._Script=Mc;var xc=e("h6",th("cc.JavaScript")(Oc=function(e){function t(){return e.apply(this,arguments)||this}return _(t,e),t}(Mc))||Oc);R._JavaScript=xc;var Fc,Pc,Dc,Lc,Bc,Uc,Gc,zc,kc,Hc,Vc,Wc,jc,Xc=e("h7",th("cc.TypeScript")(Nc=function(e){function t(){return e.apply(this,arguments)||this}return _(t,e),t}(Mc))||Nc);R._TypeScript=Xc;var Yc,qc,Kc,Qc,Zc,Jc,$c,el,tl,il,nl,rl,sl,al,ol,ul=e("gr",(Fc=th("cc.ClickEvent"),Pc=bh(),Dc=bh(),Lc=bh(),Bc=bh(),Fc((jc=function(){function e(){T(this,"target",zc,this),T(this,"component",kc,this),T(this,"_componentId",Hc,this),T(this,"handler",Vc,this),T(this,"customEventData",Wc,this)}e.emitEvents=function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];for(var s=0,a=t.length;s<a;s++){var o=t[s];o instanceof e&&o.emit(n)}};var t=e.prototype;return t.emit=function(e){var t=this.target;if(R.isValid(t)){this._genCompIdIfNeeded();var i=R.js.getClassById(this._componentId),n=t.getComponent(i);if(R.isValid(n)){var r=n[this.handler];"function"==typeof r&&(null!=this.customEventData&&""!==this.customEventData&&(e=e.slice()).push(this.customEventData),r.apply(n,e))}}},t._compName2Id=function(e){var t=R.js.getClassByName(e);return R.js.getClassId(t)},t._compId2Name=function(e){var t=R.js.getClassById(e);return R.js.getClassName(t)},t._genCompIdIfNeeded=function(){this._componentId||(this._componentName=this.component,this.component="")},c(e,[{key:"_componentName",get:function(){return this._genCompIdIfNeeded(),this._compId2Name(this._componentId)},set:function(e){this._componentId=this._compName2Id(e)}}]),e}(),zc=A((Gc=jc).prototype,"target",[hh,Pc],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),kc=A(Gc.prototype,"component",[hh,Eh,Dc],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),Hc=A(Gc.prototype,"_componentId",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),Vc=A(Gc.prototype,"handler",[hh,Eh,Lc],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),Wc=A(Gc.prototype,"customEventData",[hh,Eh,Bc],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),Uc=Gc))||Uc)),hl=new Ae("Comp"),cl=ca.Flags.IsOnLoadCalled,ll=e("eh",(Yc=th("cc.Component"),qc=Sh(),Kc=Dh(Mc),Qc=bh(),Yc((nl=il=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return T(t=e.call.apply(e,[this].concat(n))||this,"node",$c,v(t)),T(t,"_enabled",el,v(t)),T(t,"__prefab",tl,v(t)),t._sceneGetter=null,t._id=hl.getNewId(),t}_(t,e);var i=t.prototype;return i._getRenderScene=function(){return this._sceneGetter?this._sceneGetter():this.node.scene.renderScene},i.addComponent=function(e){return this.node.addComponent(e)},i.getComponent=function(e){return this.node.getComponent(e)},i.getComponents=function(e){return this.node.getComponents(e)},i.getComponentInChildren=function(e){return this.node.getComponentInChildren(e)},i.getComponentsInChildren=function(e){return this.node.getComponentsInChildren(e)},i.destroy=function(){return!!e.prototype.destroy.call(this)&&(this._enabled&&this.node.activeInHierarchy&&R.director._compScheduler.disableComp(this),!0)},i._onPreDestroy=function(){this.unscheduleAllCallbacks(),R.director._nodeActivator.destroyComp(this),this.node._removeComponent(this)},i._instantiate=function(e){return e||(e=R.instantiate._clone(this,this)),e&&(e.node=null),e},i.schedule=function(e,t,i,n){void 0===t&&(t=0),void 0===i&&(i=R.macro.REPEAT_FOREVER),void 0===n&&(n=0),J(e,1619),J((t=t||0)>=0,1620),i=Number.isNaN(i)?R.macro.REPEAT_FOREVER:i,n=n||0;var r=R.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&&R.director.getScheduler().unschedule(e,this)},i.unscheduleAllCallbacks=function(){R.director.getScheduler().unscheduleAllForTarget(this)},c(t,[{key:"name",get:function(){if(this._name)return this._name;var e=De(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=R.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&cl}}]),t}(ca),il.EventHandler=ul,il.system=null,A((Jc=nl).prototype,"__scriptAsset",[qc,Kc,Qc,Ch],Object.getOwnPropertyDescriptor(Jc.prototype,"__scriptAsset"),Jc.prototype),$c=A(Jc.prototype,"node",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),el=A(Jc.prototype,"_enabled",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),tl=A(Jc.prototype,"__prefab",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Zc=Jc))||Zc)),_l=ll.prototype;_l.update=null,_l.lateUpdate=null,_l.__preload=null,_l.onLoad=null,_l.start=null,_l.onEnable=null,_l.onDisable=null,_l.onDestroy=null,_l.onFocusInEditor=null,_l.onLostFocusInEditor=null,_l.resetInEditor=null,_l._getLocalBounds=null,_l.onRestore=null,ll._requireComponent=null,ll._executionOrder=0,Ce(ll,"_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)})),R.Component=ll;var fl=e("hL",th("cc.MissingScript")(rl=gh()((ol=function(e){function t(){var t;return T(t=e.call(this)||this,"_$erialized",al,v(t)),t}return _(t,e),t.safeFindClass=function(e){var t=at(e);if(t)return t;R.deserialize.reportMissingClass(e)},t.prototype.onLoad=function(){Y(4600,this.node.name)},t}(ll),al=A((sl=ol).prototype,"_$erialized",[hh,lh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),rl=sl))||rl)||rl);R._MissingScript=fl;try{var dl=fl.__values__;0!==dl.length&&"_$erialized"===dl[dl.length-1]||(U("The '_$erialized' prop in MissingScript is missing. Please contact jare."),U(" Error props: ['"+dl+"']"))}catch(Za){U("Error when checking MissingScript 5, "+Za)}var pl=e("g_",Symbol("[[Serialize]]")),ml=e("gZ",Symbol("[[Deserialize]]")),gl=function(){function e(e,t){this._document=void 0,this._chunks=void 0,this._document=e,this._chunks=t}return c(e,[{key:"document",get:function(){return this._document}},{key:"chunks",get:function(){return this._chunks}}]),e}();function vl(e){var t=e;return{chunks:t.chunks,document:t.document}}function yl(e){if(e.length<16)throw new El($(13102));var t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(1313817411!==t.getUint32(0,!0))throw new El($(13100));var i=t.getUint32(4,!0);if(1!==i)throw new El($(13101,i));if(t.getUint32(8,!0)!==t.byteLength)throw new El($(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($(13104))}(s);try{a=JSON.parse(o)}catch(e){throw new El(e)}for(var u=[];n<t.byteLength;){n%8!=0&&(n+=8-n%8);var h=t.getUint32(n,!0);n+=4,u.push(new Uint8Array(t.buffer,n+t.byteOffset,h)),n+=h}if(n!==t.byteLength)throw new El($(13102));return new gl(a,u)}var El=function(e){function t(){return e.apply(this,arguments)||this}return _(t,e),t}(g(Error));function Tl(e,t,i,n,r){if(t instanceof R.ValueType){r||e.push("if(prop){");var s=De(t);e.push("s._deserializeFastDefinedObject(o"+i+",prop,"+s+");"),r||e.push("}else o"+i+"=null;")}else e.push("\nif (prop) {\n s._deserializeAndAssignField(o, prop, "+n+");\n} else {\n o"+i+"=null;\n}\n")}!function(){function e(){this._viewOrPaddings=[],this._length=0}var t=e.prototype;t.alignAs=function(e){if(0!==e){var t=this._length%e;if(0!==t){var i=e-t;return this._viewOrPaddings.push(i),this._length+=i,i}}return 0},t.append=function(e){var t=this._length;return this._viewOrPaddings.push(e),this._length+=e.byteLength,t},t.get=function(){var e=new Uint8Array(this._length),t=0;return this._viewOrPaddings.forEach((function(i){"number"==typeof i?t+=i:(e.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),t),t+=i.byteLength)})),e},c(e,[{key:"byteLength",get:function(){return this._length}}])}(),R.internal.parseCCONJson=vl,R.internal.decodeCCONBinary=yl,R.internal.CCON=gl;var Al="$_$default",Sl="$_$formerlySerializedAs",bl=function(e){function t(){return e.call(this,(function(e){e.clear()}),1)||this}return _(t,e),t.prototype.get=function(e,t,i,n,r){var s=this._get();return s?(s.reset(e,t,i,n,r),s):new wl(e,t,i,n,r)},t}(ct),wl=function(){function e(e,t,i,n){this.deserializedList=void 0,this.deserializedData=void 0,this._ignoreEditorOnly=void 0,this.result=e,this.customEnv=n,this.deserializedList=[],this.deserializedData=null,this._classFinder=t,this._reportMissingClass=i,this._onDereferenced=null==t?void 0:t.onDereferenced}var t=e.prototype;return t.reset=function(e,t,i,n){this.result=e,this.customEnv=n,this._classFinder=t,this._reportMissingClass=i,this._onDereferenced=null==t?void 0:t.onDereferenced},t.clear=function(){this.result=null,this.customEnv=null,this.deserializedList.length=0,this.deserializedData=null,this._classFinder=null,this._reportMissingClass=null,this._onDereferenced=null},t.deserialize=function(e){var t,i=!1;e instanceof gl?(i=!0,t=e.document,e.chunks.length>0&&(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<e.length;n++)"object"==typeof(t=e[n])&&t?this._deserializeAndAssignField(i,t,""+n)&&(i[n]=null):i[n]=t;return i},t._deserializePlainObject=function(e){var t={};return this._fillPlainObject(t,e),t},t._deserializeTypeTaggedObject=function(e,t,i,n){var r=this,s=e.__type__,a=this._classFinder(s,e,i,n);if(!a)return this._classFinder===at&&this._reportMissingClass(s),null;var o=function(e){var i=new e;return t>=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[ml]?t._deserialize?t._deserialize(e.content,this):R.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=Ye(i);r&&n._deserializeInto(e,t,r)}};t[ml](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=kt(t),n=t.__values__,r=["var prop;"],s=St.test(ht(t)),a=0;a<n.length;a++){var o=n[a],u=void 0,h=void 0;li.IDENTIFIER_RE.test(o)?(h='"'+o+'"',u="."+o):u="["+(h=li.escapeForJS(o))+"]";var c=u;if(i[o+Sl]){var l=i[o+Sl];c=li.IDENTIFIER_RE.test(l)?"."+l:"["+li.escapeForJS(l)+"]"}r.push("prop=d"+c+";"),r.push('if(typeof prop!=="undefined"){');var _=li.getDefault(i[o+Al]),f=i[o+"$_$type"];if(s&&(void 0!==_||f)){var d=void 0;if(void 0===_)d=f instanceof Vt||f===ai||f===oi;else{var p=typeof _;d="string"===p||"number"===p||"boolean"===p}d?r.push("o"+u+"=prop;"):Tl(r,_,u,h,!0)}else r.push('if(typeof prop!=="object"){o'+u+"=prop;}else{"),Tl(r,_,u,h,!1),r.push("}");r.push("}")}return(R.js.isChildClassOf(t,R._BaseNode)||R.js.isChildClassOf(t,R.Component))&&r.push("d._id&&(o._id=d._id);"),"_$erialized"===n[n.length-1]&&(r.push("o._$erialized=JSON.parse(JSON.stringify(d));"),r.push("s._fillPlainObject(o._$erialized,d);")),Function("s","o","d","k",r.join(""))}(0,i);try{if(i===fl){var r=i.__values__;0!==r.length&&"_$erialized"===r[r.length-1]||(U("The '_$erialized' prop of MissingScript is missing. Will force the raw data to be save."),U(" Error props: ['"+r+"']. Please contact jare."));var s=n;n=function(e,t,i,n){s(e,t,i,n),t._$erialized||U("Unable to stash previously serialized data. "+JSON.stringify(i))}}}catch(e){U("Error when checking MissingScript 6, "+e)}Ce(i,"__deserialize__",n,!0)}n(this,e,t,i)},t._deserializeAndAssignField=function(e,t,i){var n=t.__id__;if("number"==typeof n){var r=this.deserializedList[n];if(r)e[i]=r;else{var s,a=this._serializedData[n];e[i]=this._deserializeObject(a,n,void 0,i),null===(s=this._onDereferenced)||void 0===s||s.call(this,this.deserializedList,n,e,i)}}else{var o=t.__uuid__;if(o){var u=t.__expectedType__;this.result.push(e,i,o,u)}else e[i]=this._deserializeObject(t,-1)}return!1},t._deserializeObjectField=function(e){var t=e.__id__;if("number"==typeof t){var i=this.deserializedList[t];if(i)return i;var n=this._serializedData[t];return this._deserializeObject(n,t,void 0,void 0)}if(e.__uuid__)throw e.__expectedType__,new Error("Asset reference field serialization is currently not supported in custom serialization.");return this._deserializeObject(e,-1)},t._fillPlainObject=function(e,t){for(var i in t)if(t.hasOwnProperty(i)){var n=t[i];"object"!=typeof n?"__type__"!==i&&(e[i]=n):n?this._deserializeAndAssignField(e,n,i)&&(e[i]=null):e[i]=null}},t._deserializeFastDefinedObject=function(e,t,i){if(i===R.Vec2)return e.x=t.x||0,void(e.y=t.y||0);if(i===R.Vec3)return e.x=t.x||0,e.y=t.y||0,void(e.z=t.z||0);if(i!==R.Color){if(i===R.Size)return e.width=t.width||0,void(e.height=t.height||0);for(var n=kt(i),r=i.__values__,s=0;s<r.length;s++){var a=r[s],o=t[a];void 0!==o||t.hasOwnProperty(a)||(o=li.getDefault(n[a+Al])),"object"!=typeof o?e[a]=o:o?this._deserializeAndAssignField(e,o,a):e[a]=null}}else{e.r=t.r||0,e.g=t.g||0,e.b=t.b||0;var u=t.a;e.a=void 0===u?255:u}},e}();wl.pool=new bl;var Rl=[en,Di,sn,Hi,Fi,un,cn,Qi];function Il(e,t){e.x=t[1],e.y=t[2],e.z=t[3],e.w=t[4]}var Ol=[function(e,t){e.x=t[1],e.y=t[2]},function(e,t){e.x=t[1],e.y=t[2],e.z=t[3]},Il,Il,function(e,t){e._val=t[1]},function(e,t){e.width=t[1],e.height=t[2]},function(e,t){e.x=t[1],e.y=t[2],e.width=t[3],e.height=t[4]},function(e,t){Qi.fromArray(e,t,1)}],Nl=e("gV",function(){function e(){this.uuidObjList=null,this.uuidPropList=null,this.uuidList=null,this.uuidTypeList=[]}var t=e.prototype;return t.init=function(e){e?(this.uuidObjList=e[8],this.uuidPropList=e[9],this.uuidList=e[10]):this.uuidList||(this.uuidList=[],this.uuidObjList=[],this.uuidPropList=[],this.uuidTypeList=[])},t.reset=function(){this.uuidList&&(this.uuidList.length=0,this.uuidObjList.length=0,this.uuidPropList.length=0,this.uuidTypeList.length=0)},t.push=function(e,t,i,n){this.uuidObjList.push(e),this.uuidPropList.push(t),this.uuidList.push(i),this.uuidTypeList.push(n||"")},e}());function Cl(e,t){for(var i=e[4][t[0]],n=i[0],r=new(0,n[0]),s=n[1],a=n[2],o=i[i.length-1],u=1;u<o;++u)r[s[i[u]]]=t[u];for(;u<t.length;++u){var h=s[i[u]],c=n[i[u]+a];(0,Ll[c])(e,r,h,t[u])}return r}function Ml(e,t,i){var n=new t;return n._deserialize?n._deserialize(i,e[0]):K(5303,De(t)),n}function xl(e,t,i,n){n>=0?t[i]=e[5][n]:e[7][3*~n]=t}function Fl(e){return function(t,i,n,r){i[n]=r;for(var s=0;s<r.length;++s)e(t,r,s,r[s])}}function Pl(e,t,i,n){t[i]=null,e[8][n]=t}function Dl(e,t,i,n){t[i]=Cl(e,n)}Nl.pool=new ct((function(e){e.reset()}),5),Nl.pool.get=function(){return this._get()||new Nl};var Ll=new Array(13);function Bl(e,t,i){return e||i(t),Object}function Ul(e,t,i,n,r,s,a){var o=e(t);if(!o){if(r)return void(i[n]=function(t,i,n){return function(){var r=e(n)||Bl(s,n,a);return t[i]=r,new r}}(i,n,t));o=Bl(s,t,a)}i[n]=o}function Gl(e,t,i,n){for(var r=i||at,s=e[3],a=0;a<s.length;++a){var o=s[a];"string"!=typeof o?Ul(r,o[0],o,0,t,i,n):Ul(r,o,s,a,t,i,n)}}function zl(e){var t=e[4];if(t)for(var i=e[3],n=0;n<t.length;++n){var r=t[n];r[0]=i[r[0]]}}function kl(e,t,i){"string"==typeof e&&(e=JSON.parse(e));var n,r=!t;if(t=t||Nl.pool.get(),function(e){if(Array.isArray(e)){var t=e[0];return"number"==typeof t||t instanceof Hl}return!1}(e)){t.init(e),i=i||{};var s,a=e[0],o=!1;if("object"==typeof a&&(o=a.preprocessed,a=a.version),a<1)throw new Error($(5304,a));i._version=a,i.result=t,e[0]=i,o||(Gl(e,!1,i.classFinder,null!==(s=i.reportMissingClass)&&void 0!==s?s:kl.reportMissingClass),zl(e)),R.game._isCloning=!0;var u=e[5],h=function(e){var t=e[5],i=e[6],n=0===i?0:i.length,r=t[t.length-1],s=t.length-n;"number"!=typeof r?r=0:(r<0&&(r=~r),--s);for(var a=0;a<s;++a)t[a]=Cl(e,t[a]);for(var o=e[3],u=0;u<n;++u,++a){var h=i[u],c=t[a];if(h>=0){var l=o[h];t[a]=Ml(e,l,c)}else(0,Ll[h=~h])(e,t,a,c)}return r}(e);R.game._isCloning=!1,e[7]&&function(e,t,i){for(var n=e.length-1,r=0,s=3*e[n];r<s;r+=3){var a=e[r],o=t[e[r+2]],u=e[r+1];u>=0?a[i[u]]=o:a[~u]=o}for(;r<n;r+=3){var h=t[e[r]],c=t[e[r+2]],l=e[r+1];l>=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<r.length;++o){var u=r[o];"number"==typeof u&&(r[o]=t[u]);var h=s[o];"number"==typeof h&&(h=h>=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||at,s=i.createAssetRefs||ka.platform===Ia.EDITOR_CORE,a=i.customEnv,o=i.ignoreEditorOnly,u=null!==(n=i.reportMissingClass)&&void 0!==n?n:R.deserialize.reportMissingClass;t.init();var h=wl.pool.get(t,r,u,a,o);R.game._isCloning=!0;var c=h.deserialize(e);return R.game._isCloning=!1,wl.pool.put(h),s&&t.assignAssetsBy((function(e,t){return EditorExtends.serialize.asAsset(e,t.type)})),c}(e,t,i);return r&&Nl.pool.put(t),n}Ll[0]=function(e,t,i,n){t[i]=n},Ll[1]=xl,Ll[2]=Fl(xl),Ll[3]=Fl(Pl),Ll[4]=Dl,Ll[5]=function(e,t,i,n){Ol[n[0]](t[i],n)},Ll[6]=Pl,Ll[7]=function(e,t,i,n){t[i].set(n)},Ll[8]=function(e,t,i,n){var r=new Rl[n[0]];Ol[n[0]](r,n),t[i]=r},Ll[9]=Fl(Dl),Ll[10]=function(e,t,i,n){var r=e[3][n[0]];t[i]=Ml(e,r,n[1])},Ll[11]=function(e,t,i,n){var r=n[0];t[i]=r;for(var s=1;s<n.length;s+=3){var a=n[s],o=n[s+1],u=n[s+2];(0,Ll[o])(e,r,a,u)}},Ll[12]=function(e,t,i,n){var r=n[0];t[i]=r;for(var s=0;s<r.length;++s){var a=r[s],o=n[s+1];0!==o&&(0,Ll[o])(e,r,s,a)}},kl.Details=Nl,kl.reportMissingClass=function(e){K(5302,e)};var Hl=function(e){this.preprocessed=!0,this.version=e};function Vl(e,t,i){return[1,0,0,[e],0,i?[t,-1]:[t],[0],0,[],[],[]]}R.deserialize=kl;var Wl,jl,Xl,Yl,ql,Kl,Ql,Zl,Jl,$l,e_,t_=ca.Flags.Destroyed,i_=ca.Flags.PersistentMask,n_=[];function r_(e){var t;if(_a(e)){if(e._instantiate)return R.game._isCloning=!0,t=e._instantiate(null,!0),R.game._isCloning=!1,t;if(e instanceof R.Asset)throw new TypeError($(6903))}return R.game._isCloning=!0,t=s_(e),R.game._isCloning=!1,t}function s_(e,t){var i;a_(e,i=e._iN$t?e._iN$t:e.constructor?new(0,e.constructor):Object.create(null),t);for(var n=0,r=n_.length;n<r;++n)n_[n]._iN$t=null;return n_.length=0,i}function a_(e,t,i){_t.value(e,"_iN$t",t,!0),n_.push(e);var n=e.constructor;if(_i(n))!function(e,t,i,n){for(var r=e.__values__,s=0;s<r.length;s++){var a=r[s],o=t[a];if("object"==typeof o&&o){var u=i[a];u instanceof yt&&u.constructor===o.constructor?u.set(o):i[a]=o._iN$t||o_(o,n)}else i[a]=o}}(n,e,t,i);else for(var r in e)if(e.hasOwnProperty(r)&&(95!==r.charCodeAt(0)||95!==r.charCodeAt(1)||"__type__"===r||"__prefab"===r)){var s=e[r];if("object"==typeof s&&s){if(s===t)continue;t[r]=s._iN$t||o_(s,i)}else t[r]=s}_a(e)&&(t._objFlags&=i_)}function o_(e,t){if(e instanceof yt)return e.clone();if(e instanceof R.Asset)return e;var i;if(ArrayBuffer.isView(e)){var n=e.length;i=new e.constructor(n),e._iN$t=i,n_.push(e);for(var r=0;r<n;++r)i[r]=e[r];return i}if(Array.isArray(e)){var s=e.length;i=new Array(s),e._iN$t=i,n_.push(e);for(var a=0;a<s;++a){var o=e[a];i[a]="object"==typeof o&&o?o._iN$t||o_(o,t):o}return i}if(e._objFlags&t_)return null;var u=e.constructor;if(_i(u)){if(t)if(t instanceof R.Component){if(e instanceof R._BaseNode||e instanceof R.Component)return e}else if(t instanceof R._BaseNode)if(e instanceof R._BaseNode){if(!e.isChildOf(t))return e}else if(e instanceof R.Component&&e.node&&!e.node.isChildOf(t))return e;i=new u}else if(u===Object)i={};else{if(u)return e;i=Object.create(null)}return a_(e,i,t),i}function u_(e,t){return(t<<3)+e}function h_(e){return l_[e]}function c_(e){switch(e){case $l.Uint8:return Uint8Array;case $l.Uint16:return Uint16Array;case $l.Uint32:return Uint32Array;case $l.Int8:return Int8Array;case $l.Int16:return Int16Array;case $l.Int32:return Int32Array;case $l.Float32:return Float32Array;case $l.Float64:return Float64Array}}r_._clone=s_,R.instantiate=r_,function(e){e[e.Uint8=0]="Uint8",e[e.Uint16=1]="Uint16",e[e.Uint32=2]="Uint32",e[e.Int8=3]="Int8",e[e.Int16=4]="Int16",e[e.Int32=5]="Int32",e[e.Float32=6]="Float32",e[e.Float64=7]="Float64"}($l||($l={})),function(e){e[e.Scalar=0]="Scalar",e[e.Vec2=1]="Vec2",e[e.Vec3=2]="Vec3",e[e.Vec4=3]="Vec4",e[e.Quat=4]="Quat",e[e.Mat4=5]="Mat4"}(e_||(e_={})),e("gX",th("cc.CompactValueTypeArray")((Zl=Ql=function(){function e(){T(this,"_byteOffset",Xl,this),T(this,"_unitCount",Yl,this),T(this,"_unitElement",ql,this),T(this,"_length",Kl,this)}return e.lengthFor=function(e,t,i){return h_(t).requiredUnits*e.length*c_(i).BYTES_PER_ELEMENT},e.compress=function(t,i,n,r,s,a){for(var o=h_(i),u=c_(n),h=o.requiredUnits*t.length,c=new u(r,s,h),l=0;l<t.length;++l)o.compress(c,l,t[l]);var _=new e;return _._unitElement=u_(n,i),_._byteOffset=a,_._unitCount=h,_._length=t.length,_},e.prototype.decompress=function(e){for(var t,i={storageUnit:7&(t=this._unitElement),elementType:t>>3},n=i.storageUnit,r=h_(i.elementType),s=new(c_(n))(e,this._byteOffset,this._unitCount),a=new Array(this._length),o=0;o<this._length;++o)a[o]=r.decompress(s,o);return a},e}(),Ql.StorageUnit=$l,Ql.ElementType=e_,Xl=A((jl=Zl).prototype,"_byteOffset",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Yl=A(jl.prototype,"_unitCount",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),ql=A(jl.prototype,"_unitElement",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return u_($l.Uint8,e_.Scalar)}}),Kl=A(jl.prototype,"_length",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Wl=jl))||Wl);var l_=((Jl={})[e_.Scalar]={requiredUnits:1,compress:function(e,t,i){e[t]=i},decompress:function(e,t){return e[t]}},Jl[e_.Vec2]={requiredUnits:2,compress:function(e,t,i){e[2*t]=i.x,e[2*t+1]=i.y},decompress:function(e,t){return new Di(e[2*t],e[2*t+1])}},Jl[e_.Vec3]={requiredUnits:3,compress:function(e,t,i){e[3*t]=i.x,e[3*t+1]=i.y,e[3*t+2]=i.z},decompress:function(e,t){return new Di(e[3*t],e[3*t+1],e[3*t+2])}},Jl[e_.Vec4]={requiredUnits:4,compress:function(e,t,i){e[4*t]=i.x,e[4*t+1]=i.y,e[4*t+2]=i.z,e[4*t+3]=i.w},decompress:function(e,t){return new sn(e[4*t],e[4*t+1],e[4*t+2],e[4*t+3])}},Jl[e_.Quat]={requiredUnits:4,compress:function(e,t,i){e[4*t]=i.x,e[4*t+1]=i.y,e[4*t+2]=i.z,e[4*t+3]=i.w},decompress:function(e,t){return new Hi(e[4*t],e[4*t+1],e[4*t+2],e[4*t+3])}},Jl[e_.Mat4]={requiredUnits:16,compress:function(e,t,i){Qi.toArray(e,i,16*t)},decompress:function(e,t){return Qi.fromArray(new Qi,e,16*t)}},Jl);function __(){return 0}function f_(e){return e}function d_(e){return e*e}function p_(e){return e*(2-e)}function m_(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}function g_(e){return e*e*e}function v_(e){return--e*e*e+1}function y_(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}function E_(e){return e*e*e*e}function T_(e){return 1- --e*e*e*e}function A_(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}function S_(e){return e*e*e*e*e}function b_(e){return--e*e*e*e*e+1}function w_(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}function R_(e){return 1===e?1:1-Math.cos(e*Math.PI/2)}function I_(e){return Math.sin(e*Math.PI/2)}function O_(e){return.5*(1-Math.cos(Math.PI*e))}function N_(e){return 0===e?0:Math.pow(1024,e-1)}function C_(e){return 1===e?1:1-Math.pow(2,-10*e)}function M_(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}function x_(e){return 1-Math.sqrt(1-e*e)}function F_(e){return Math.sqrt(1- --e*e)}function P_(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}function D_(e){var t,i=.1;return 0===e?0:1===e?1:(!i||i<1?(i=1,t=.1):t=.4*Math.asin(1/i)/(2*Math.PI),-i*Math.pow(2,10*(e-=1))*Math.sin(2*(e-t)*Math.PI/.4))}function L_(e){var t,i=.1;return 0===e?0:1===e?1:(!i||i<1?(i=1,t=.1):t=.4*Math.asin(1/i)/(2*Math.PI),i*Math.pow(2,-10*e)*Math.sin(2*(e-t)*Math.PI/.4)+1)}function B_(e){var t,i=.1;return 0===e?0:1===e?1:(!i||i<1?(i=1,t=.1):t=.4*Math.asin(1/i)/(2*Math.PI),(e*=2)<1?i*Math.pow(2,10*(e-=1))*Math.sin(2*(e-t)*Math.PI/.4)*-.5:i*Math.pow(2,-10*(e-=1))*Math.sin(2*(e-t)*Math.PI/.4)*.5+1)}function U_(e){if(1===e)return 1;var t=1.70158;return e*e*((t+1)*e-t)}function G_(e){if(0===e)return 0;var t=1.70158;return--e*e*((t+1)*e+t)+1}function z_(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}function k_(e){return 1-H_(1-e)}function H_(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function V_(e){return e<.5?.5*k_(2*e):.5*H_(2*e-1)+.5}function W_(e){return e<=0?0:e>=1?1:e*e*(3-2*e)}function j_(e){return e<=0?0:e>=1?1:e*e*e*(e*(6*e-15)+10)}R._decorator=Uh;var X_,Y_,q_=sf(d_,p_),K_=sf(g_,v_),Q_=sf(E_,T_),Z_=sf(S_,b_),J_=sf(R_,I_),$_=sf(N_,C_),ef=sf(x_,F_),tf=sf(D_,L_),nf=sf(U_,G_),rf=sf(k_,H_);function sf(e,t){return function(i){return i<.5?t(2*i)/2:e(2*i-1)/2+.5}}e("fz",Object.freeze({__proto__:null,constant:__,linear:f_,quadIn:d_,quadOut:p_,quadInOut:m_,cubicIn:g_,cubicOut:v_,cubicInOut:y_,quartIn:E_,quartOut:T_,quartInOut:A_,quintIn:S_,quintOut:b_,quintInOut:w_,sineIn:R_,sineOut:I_,sineInOut:O_,expoIn:N_,expoOut:C_,expoInOut:M_,circIn:x_,circOut:F_,circInOut:P_,elasticIn:D_,elasticOut:L_,elasticInOut:B_,backIn:U_,backOut:G_,backInOut:z_,bounceIn:k_,bounceOut:H_,bounceInOut:V_,smooth:W_,fade:j_,quadOutIn:q_,cubicOutIn:K_,quartOutIn:Q_,quintOutIn:Z_,sineOutIn:J_,expoOutIn:$_,circOutIn:ef,elasticOutIn:tf,backOutIn:nf,bounceOutIn:rf})),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"}(Y_||(Y_=e("fE",{})));var af,of=((X_={})[Y_.CONSTANT]=__,X_[Y_.LINEAR]=f_,X_[Y_.QUAD_IN]=d_,X_[Y_.QUAD_OUT]=p_,X_[Y_.QUAD_IN_OUT]=m_,X_[Y_.QUAD_OUT_IN]=q_,X_[Y_.CUBIC_IN]=g_,X_[Y_.CUBIC_OUT]=v_,X_[Y_.CUBIC_IN_OUT]=y_,X_[Y_.CUBIC_OUT_IN]=K_,X_[Y_.QUART_IN]=E_,X_[Y_.QUART_OUT]=T_,X_[Y_.QUART_IN_OUT]=A_,X_[Y_.QUART_OUT_IN]=Q_,X_[Y_.QUINT_IN]=S_,X_[Y_.QUINT_OUT]=b_,X_[Y_.QUINT_IN_OUT]=w_,X_[Y_.QUINT_OUT_IN]=Z_,X_[Y_.SINE_IN]=R_,X_[Y_.SINE_OUT]=I_,X_[Y_.SINE_IN_OUT]=O_,X_[Y_.SINE_OUT_IN]=J_,X_[Y_.EXPO_IN]=N_,X_[Y_.EXPO_OUT]=C_,X_[Y_.EXPO_IN_OUT]=M_,X_[Y_.EXPO_OUT_IN]=$_,X_[Y_.CIRC_IN]=x_,X_[Y_.CIRC_OUT]=F_,X_[Y_.CIRC_IN_OUT]=P_,X_[Y_.CIRC_OUT_IN]=ef,X_[Y_.ELASTIC_IN]=D_,X_[Y_.ELASTIC_OUT]=L_,X_[Y_.ELASTIC_IN_OUT]=B_,X_[Y_.ELASTIC_OUT_IN]=tf,X_[Y_.BACK_IN]=U_,X_[Y_.BACK_OUT]=G_,X_[Y_.BACK_IN_OUT]=z_,X_[Y_.BACK_OUT_IN]=nf,X_[Y_.BOUNCE_IN]=k_,X_[Y_.BOUNCE_OUT]=H_,X_[Y_.BOUNCE_IN_OUT]=V_,X_[Y_.BOUNCE_OUT_IN]=rf,X_[Y_.SMOOTH]=W_,X_[Y_.FADE]=j_,X_);function uf(e){return of[e]}s(255),s(65280);var hf,cf,lf,_f=Hu.LINEAR<<0|Wu.NONE<<8|Y_.LINEAR<<16,ff=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).value=0,t.rightTangent=0,t.rightTangentWeight=0,t.leftTangent=0,t.leftTangentWeight=0,t._flags=_f,t}return _(t,e),c(t,[{key:"interpolationMode",get:function(){return(255&this._flags)>>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}(Bh);function df(e){var t=new ff;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[oa];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[oa]=c)}return t}li.fastDefine("cc.RealKeyframeValue",ff,((af={interpolationMode:Hu.LINEAR,tangentWeightMode:Wu.NONE,value:0,rightTangent:0,rightTangentWeight:0,leftTangent:0,leftTangentWeight:0,easingMethod:Y_.LINEAR})[oa]=void 0,af)),li.Attr.setClassAttr(ff,oa,"editorOnly",!0),(hf=ff,null!==(lf=(cf=hf)[uh])&&void 0!==lf?lf:cf[uh]={}).uniquelyReferenced=!0;var pf,mf=e("fp",function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).preExtrapolation=Vu.CLAMP,t.postExtrapolation=Vu.CLAMP,t}_(t,e);var i=t.prototype;return i.evaluate=function(e){var t=this._times,i=this._values,n=t.length;if(0===n)return 0;var r=t[0],s=t[n-1];if(e<r){var a=this.preExtrapolation,o=i[0];if(a===Vu.CLAMP||n<2)return o.value;switch(a){case Vu.LINEAR:return xf(r,i[0].value,t[1],i[1].value,e);case Vu.LOOP:e=Cf(e,r,s);break;case Vu.PING_PONG:e=Mf(e,r,s);break;default:return o.value}}else if(e>s){var u=this.postExtrapolation,h=i[n-1];if(u===Vu.CLAMP||n<2)return h.value;switch(u){case Vu.LINEAR:return xf(s,h.value,t[n-2],i[n-2].value,e);case Vu.LOOP:e=Cf(e,r,s);break;case Vu.PING_PONG:e=Mf(e,r,s);break;default:return h.value}}var c=ku(t,e);if(c>=0)return i[c].value;var l=~c,_=l-1,f=t[_],d=i[_],p=t[l];return function(e,t,i,n,r){var s=i-e;switch(t.interpolationMode){default:case Hu.CONSTANT:return t.value;case Hu.LINEAR:var a=t.easingMethod===Y_.LINEAR?r:uf(t.easingMethod)(r);return Ti(t.value,n.value,a);case Hu.CUBIC:var o=1/3,u=t.rightTangent,h=t.rightTangentWeight,c=0!=(t.tangentWeightMode&Wu.RIGHT),l=n.leftTangent,_=n.leftTangentWeight,f=0!=(n.tangentWeightMode&Wu.LEFT);if(c||f){var d=0;if(c)d=h;else{var p=s,m=s*u;d=Math.sqrt(p*p+m*m)*o}var g=Math.atan(u),v=Math.cos(g)*d+e,y=Math.sin(g)*d+t.value,E=0;if(f)E=_;else{var T=s,A=s*l;E=Math.sqrt(T*T+A*A)*o}var S=Math.atan(l),b=(v-e)/s,w=(-Math.cos(S)*E+i-e)/s,R=y,I=-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(Xu(l)){if(Xu(h))return r[0]=0,1;var f=Math.cbrt(-h);return r[0]=2*f,r[1]=-f,2}if(l<0){var d=1/3*Math.acos(-h/Math.sqrt(-c)),p=2*Math.sqrt(-u);r[0]=p*Math.cos(d),r[1]=-p*Math.cos(d+Math.PI/3),r[2]=-p*Math.cos(d-Math.PI/3),_=3}else{var m=Math.sqrt(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*b,3*w-6*b,3*(b-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<t;++r){var s=e[r];s>=0&&s<=1&&s>n&&(n=s)}n===-1/0&&(n=0)}return n}(O,N,r);return Ff(t.value,R,I,n.value,C)}var M=t.value+o*u*s,x=n.value-o*l*s;return Ff(t.value,M,x,n.value,r)}}(f,d,p,i[l],(e-f)/(p-f))},i.addKeyFrame=function(t,i){return e.prototype.addKeyFrame.call(this,t,df(i))},i.assignSorted=function(e,t){if(void 0!==t)this.setKeyframes(e.slice(),t.map((function(e){return df(e)})));else{var i=Array.from(e);this.setKeyframes(i.map((function(e){return e[0]})),i.map((function(e){return df(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 vi(i.value,t,e)}))},i[pl]=function(e,t){if(t.toCCON){var i=this._times,n=this._values,r=i.length,s=new DataView(new ArrayBuffer(0+gf+gf+vf+yf*r+If*r)),a=0;s.setUint8(a,this.preExtrapolation),a+=gf,s.setUint8(a,this.postExtrapolation),a+=gf,s.setUint32(a,r,!0),a+=vf,i.forEach((function(e,t){return s.setFloat32(a+yf*t,e,!0)})),a+=yf*r;for(var o,u=E(n);!(o=u()).done;){var h=o.value;a=Of(s,h,a)}var c=new Uint8Array(s.buffer,0,a);e.writeProperty("bytes",c);var l=n.map((function(e){return e[oa]}));l.some((function(e){return void 0!==e}))&&e.writeProperty("keyframeValueEditorExtras",l)}else e.writeThis()},i[ml]=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+=gf,this.postExtrapolation=n.getUint8(r),r+=gf;var s=n.getUint32(r,!0);r+=vf;var a=Array.from({length:s},(function(e,t){return n.getFloat32(r+yf*t,!0)}));r+=yf*s;for(var o=new Array(s),u=0;u<s;++u){var h=df({});r=Nf(n,h,r),o[u]=h}i.byteLength;var c=e.readProperty("keyframeValueEditorExtras");c&&(c.length,c.forEach((function(e,t){return o[t][oa]=e}))),this._times=a,this._values=o}else e.readThis()},t}(ju));li.fastDefine("cc.RealCurve",mf,{_times:[],_values:[],preExtrapolation:Vu.CLAMP,postExtrapolation:Vu.CLAMP}),function(e){e[e.VALUE=1]="VALUE",e[e.INTERPOLATION_MODE=2]="INTERPOLATION_MODE",e[e.TANGENT_WEIGHT_MODE=4]="TANGENT_WEIGHT_MODE",e[e.LEFT_TANGENT=8]="LEFT_TANGENT",e[e.LEFT_TANGENT_WEIGHT=16]="LEFT_TANGENT_WEIGHT",e[e.RIGHT_TANGENT=32]="RIGHT_TANGENT",e[e.RIGHT_TANGENT_WEIGHT=64]="RIGHT_TANGENT_WEIGHT"}(pf||(pf={}));var gf=1,vf=4,yf=4,Ef=df({}),Tf=Ef.interpolationMode,Af=Ef.tangentWeightMode,Sf=Ef.leftTangent,bf=Ef.leftTangentWeight,wf=Ef.rightTangent,Rf=Ef.rightTangentWeight,If=26;function Of(e,t,i){var n=0,r=i,s=r;r+=4;var a=t.value,o=t.interpolationMode,u=t.tangentWeightMode,h=t.rightTangent,c=t.rightTangentWeight,l=t.leftTangent,_=t.leftTangentWeight,f=t.easingMethod;return e.setFloat32(r,a,!0),r+=4,o!==Tf&&(n|=pf.INTERPOLATION_MODE,e.setUint8(r,o),r+=1),u!==Af&&(n|=pf.TANGENT_WEIGHT_MODE,e.setUint8(r,u),r+=1),l!==Sf&&(n|=pf.LEFT_TANGENT,e.setFloat32(r,l,!0),r+=4),_!==bf&&(n|=pf.LEFT_TANGENT_WEIGHT,e.setFloat32(r,_,!0),r+=4),h!==wf&&(n|=pf.RIGHT_TANGENT,e.setFloat32(r,h,!0),r+=4),c!==Rf&&(n|=pf.RIGHT_TANGENT_WEIGHT,e.setFloat32(r,c,!0),r+=4),n|=f<<8,e.setUint32(s,n,!0),r}function Nf(e,t,i){var n=i,r=e.getUint32(n,!0);n+=4,t.value=e.getFloat32(n,!0),n+=4,r&pf.INTERPOLATION_MODE&&(t.interpolationMode=e.getUint8(n),n+=1),r&pf.TANGENT_WEIGHT_MODE&&(t.tangentWeightMode=e.getUint8(n),n+=1),r&pf.LEFT_TANGENT&&(t.leftTangent=e.getFloat32(n,!0),n+=4),r&pf.LEFT_TANGENT_WEIGHT&&(t.leftTangentWeight=e.getFloat32(n,!0),n+=4),r&pf.RIGHT_TANGENT&&(t.rightTangent=e.getFloat32(n,!0),n+=4),r&pf.RIGHT_TANGENT_WEIGHT&&(t.rightTangentWeight=e.getFloat32(n,!0),n+=4);var s=(65280&r)>>8;return t.easingMethod=s,n}function Cf(e,t,i){return t+Ni(e-t,i-t)}function Mf(e,t,i){return t+Ci(e-t,i-t)}function xf(e,t,i,n,r){return t+(n-t)/(i-e)*(r-e)}function Ff(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 Pf(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}R.bezier=Pf;var Df,Lf,Bf,Uf,Gf,zf,kf,Hf,Vf,Wf,jf,Xf=Math.cos,Yf=Math.acos,qf=Math.max,Kf=2*Math.PI,Qf=Math.sqrt;function Zf(e){return e<0?-Math.pow(-e,1/3):Math.pow(e,1/3)}function Jf(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,f=(u-6*o+c)*l,d=f*_,p=(-u+h)*l,m=(3*p-f*f)*_,g=m*_,v=(2*f*f*f-9*f*p+a*l*27)/27,y=v/2,E=y*y+g*g*g;if(E<0){var T=-m*_,A=Qf(T*T*T),S=-v/(2*A),b=Yf(S<-1?-1:S>1?1:S),w=2*Zf(A);return n=w*Xf(b*_)-d,r=w*Xf((b+Kf)*_)-d,s=w*Xf((b+2*Kf)*_)-d,n>=0&&n<=1?r>=0&&r<=1?s>=0&&s<=1?qf(n,r,s):qf(n,r):s>=0&&s<=1?qf(n,s):n:r>=0&&r<=1?s>=0&&s<=1?qf(r,s):r:s}if(0===E)return r=-(i=y<0?Zf(-y):-Zf(y))-d,(n=2*i-d)>=0&&n<=1?r>=0&&r<=1?qf(n,r):n:r;var R=Qf(E);return(i=Zf(-y+R))-Zf(y+R)-d}(e,t),n=e[1];return((1-i)*(n+(e[3]-n)*i)*3+i*i)*i}R.bezierByTime=Jf,function(e){e[e.SLERP=0]="SLERP",e[e.CONSTANT=1]="CONSTANT"}(jf||(jf=e("fH",{})));var $f,ed=th("cc.QuatKeyframeValue")(Df=fh((Bf=A((Lf=function(e){var t=void 0===e?{}:e,i=t.value,n=t.interpolationMode,r=t.easingMethod;T(this,"interpolationMode",Bf,this),T(this,"value",Uf,this),T(this,"easingMethod",Gf,this),this.value=i?Hi.clone(i):this.value,this.interpolationMode=null!=n?n:this.interpolationMode,this.easingMethod=null!=r?r:this.easingMethod}).prototype,"interpolationMode",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return jf.SLERP}}),Uf=A(Lf.prototype,"value",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Hi.clone(Hi.IDENTITY)}}),Gf=A(Lf.prototype,"easingMethod",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Y_.LINEAR}}),Df=Lf))||Df)||Df;function td(e){return new ed(e)}e("fr",th("cc.QuatCurve")((Wf=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return T(t=e.call.apply(e,[this].concat(n))||this,"preExtrapolation",Hf,v(t)),T(t,"postExtrapolation",Vf,v(t)),t}_(t,e);var i=t.prototype;return i.evaluate=function(e,t){var i;null!==(i=t)&&void 0!==i||(t=new Hi);var n=this._times,r=this._values,s=this.postExtrapolation,a=this.preExtrapolation,o=n.length;if(0===o)return t;var u=n[0],h=n[o-1];if(e<u){var c=r[0];switch(a){case Vu.LOOP:e=u+Ni(e-u,h-u);break;case Vu.PING_PONG:e=u+Ci(e-u,h-u);break;case Vu.CLAMP:default:return Hi.copy(t,c.value)}}else if(e>h){var l=r[o-1];switch(s){case Vu.LOOP:e=u+Ni(e-u,h-u);break;case Vu.PING_PONG:e=u+Ci(e-u,h-u);break;case Vu.CLAMP:default:return Hi.copy(t,l.value)}}var _=ku(n,e);if(_>=0)return Hi.copy(t,r[_].value);var f=~_,d=f-1,p=n[d],m=r[d],g=n[f],v=r[f],y=(e-p)/(g-p);switch(m.interpolationMode){default:case jf.CONSTANT:return Hi.copy(t,m.value);case jf.SLERP:var E=m.easingMethod,T=E===Y_.LINEAR?y:Array.isArray(E)?Jf(E,y):uf(E)(y);return Hi.slerp(t,m.value,v.value,T)}},i.addKeyFrame=function(t,i){var n=new ed(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 td(e)})));else{var i=Array.from(e);this.setKeyframes(i.map((function(e){return e[0]})),i.map((function(e){return td(e[1])})))}},i[pl]=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=od*(r?1:s),o=n.reduce((function(e,t){var i=t.easingMethod;return e+(Array.isArray(i)?ud+4*cd:ud)}),0),u=0,h=new DataView(new ArrayBuffer(u+=nd+rd+sd*s+4*ad*s+o+a+0)),c=0,l=0;r&&(l|=$f.INTERPOLATION_MODE),h.setUint32(c,l,!0),c+=nd,h.setUint32(c,s,!0),c+=rd,i.forEach((function(e,t){return h.setFloat32(c+sd*t,e,!0)})),c+=sd*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*ad*t;h.setFloat32(o+0*ad,n,!0),h.setFloat32(o+1*ad,r,!0),h.setFloat32(o+2*ad,s,!0),h.setFloat32(o+3*ad,a,!0)})),c+=4*ad*s,n.forEach((function(e){var t=e.easingMethod;Array.isArray(t)?(h.setUint8(c,hd),++c,h.setFloat32(c+0*cd,t[0],!0),h.setFloat32(c+1*cd,t[1],!0),h.setFloat32(c+2*cd,t[2],!0),h.setFloat32(c+3*cd,t[3],!0),c+=4*cd):(h.setUint8(c,t),++c)}));var _=c;c+=a;var f=_;n.forEach((function(e){var t=e.interpolationMode;h.setUint8(f,t),r||(f+=od)}));var d=new Uint8Array(h.buffer);e.writeProperty("bytes",d)}else e.writeThis()},i[ml]=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+=nd;var a=s&$f.INTERPOLATION_MODE,o=n.getUint32(r,!0);r+=rd;var u=Array.from({length:o},(function(e,t){return n.getFloat32(r+sd*t,!0)})),h=r+=sd*o;r+=4*ad*o;var c=Array.from({length:o},(function(e,t){var i=h+4*ad*t,s=n.getFloat32(i+0*ad,!0),a=n.getFloat32(i+1*ad,!0),o=n.getFloat32(i+2*ad,!0),u=n.getFloat32(i+3*ad,!0),c=n.getUint8(r);++r;var l=td({value:{x:s,y:a,z:o,w:u}});return c!==hd?l.easingMethod=c:(l.easingMethod=[n.getFloat32(r+0*cd,!0),n.getFloat32(r+1*cd,!0),n.getFloat32(r+2*cd,!0),n.getFloat32(r+3*cd,!0)],r+=4*cd),l}));if(a){var l=n.getUint8(r);++r;for(var _=0;_<o;++_)c[_].interpolationMode=l}else{for(var f=0;f<o;++f){var d=n.getUint8(r+f);c[f].interpolationMode=d}r+=o}this._times=u,this._values=c}else e.readThis()},t}(ju),Hf=A((kf=Wf).prototype,"preExtrapolation",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Vu.CLAMP}}),Vf=A(kf.prototype,"postExtrapolation",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Vu.CLAMP}}),zf=kf))||zf),function(e){e[e.INTERPOLATION_MODE=1]="INTERPOLATION_MODE"}($f||($f={}));var id,nd=1,rd=4,sd=4,ad=4,od=1,ud=1,hd=255,cd=4,ld=(e("fs",th("cc.ObjectCurve")(id=function(e){function t(){return e.apply(this,arguments)||this}return _(t,e),t.prototype.evaluate=function(e){var t=this.searchKeyframe(e);if(t>=0)return this._values[t];var i=yi(~t-1,0,this._values.length-1);return this._values[i]},t}(ju))||id),e("cg",(function(){this.time=0,this.value=0,this.inTangent=0,this.outTangent=0})));li.fastDefine("cc.Keyframe",ld,{time:0,value:0,inTangent:0,outTangent:0});var _d,fd=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 t=e-this.time,i=this.coefficient,t*(t*(t*i[0]+i[1])+i[2])+i[3];var t,i},e}(),dd=e("ch",function(){function e(e){if(void 0===e&&(e=null),this.cachedKey=void 0,e instanceof mf)this._curve=e;else{var t=new mf;this._curve=t,t.preExtrapolation=Vu.LOOP,t.postExtrapolation=Vu.CLAMP,e?t.assignSorted(e.map((function(e){return[e.time,{interpolationMode:Hu.CUBIC,value:e.value,leftTangent:e.inTangent,rightTangent:e.outTangent}]}))):t.assignSorted([[0,{interpolationMode:Hu.CUBIC,value:1}],[1,{interpolationMode:Hu.CUBIC,value:1}]])}this.cachedKey=new fd}var t=e.prototype;return t.addKey=function(e){e?this._curve.addKeyFrame(e.time,{interpolationMode:Hu.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 Vu.LOOP:r=Ni(e-a,o-a)+a;break;case Vu.PING_PONG:r=Ci(e-a,o-a)+a;break;case Vu.CLAMP:default:r=yi(e,a,o)}if(r>=t.time&&r<t.endTime)return t.evaluate(r);var u=this.findIndex(t,r),h=Math.min(u+1,n);return this.calcOptimizedKey(t,u,h),t.evaluate(r)},t.calcOptimizedKey=function(e,t,i){var n=this._curve.getKeyframeTime(t),r=this._curve.getKeyframeTime(i),s=this._curve.getKeyframeValue(t),a=s.value,o=s.leftTangent,u=this._curve.getKeyframeValue(i),h=u.value,c=u.rightTangent;e.index=t,e.time=n,e.endTime=r;var l=r-n,_=h-a,f=1/(l*l),d=o*l,p=c*l;e.coefficient[0]=(d+p-_-_)*f/l,e.coefficient[1]=(_+_+_-d-d-p)*f,e.coefficient[2]=o,e.coefficient[3]=a},t.findIndex=function(e,t){var i=this._curve,n=i.keyFramesCount,r=e.index;if(-1!==r)if(t>i.getKeyframeTime(r))for(var s=0;s<3;s++){var a=r+s;if(a+1<n&&i.getKeyframeTime(a+1)>t)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},c(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 ld;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:Hu.CUBIC,value:e.value,leftTangent:e.inTangent,rightTangent:e.outTangent}]})))}},{key:"preWrapMode",get:function(){return md(this._curve.preExtrapolation)},set:function(e){this._curve.preExtrapolation=pd(e)}},{key:"postWrapMode",get:function(){return md(this._curve.postExtrapolation)},set:function(e){this._curve.postExtrapolation=pd(e)}}]),e}());function pd(e){switch(e){default:case Pu.Default:case Pu.Normal:case Pu.Clamp:return Vu.CLAMP;case Pu.PingPong:return Vu.PING_PONG;case Pu.Loop:return Vu.LOOP}}function md(e){switch(e){default:case Vu.LINEAR:case Vu.CLAMP:return Pu.Clamp;case Vu.PING_PONG:return Pu.PingPong;case Vu.LOOP:return Pu.Loop}}dd.defaultKF=[{time:0,value:1,inTangent:0,outTangent:0},{time:1,value:1,inTangent:0,outTangent:0}],li.fastDefine("cc.AnimationCurve",dd,{_curve:null}),function(e){e[e.LINEAR=0]="LINEAR",e[e.BEZIER=1]="BEZIER",e[e.CATMULL_ROM=2]="CATMULL_ROM"}(_d||(_d=e("ci",{})));var gd=4294967295,vd=new Di,yd=new Di,Ed=new Di,Td=new Di;function Ad(e,t){console.warn(e+" is deprecated, please use "+t+" instead.")}e("cj",function(){function e(e,t){void 0===e&&(e=_d.CATMULL_ROM),void 0===t&&(t=[]),this._type=void 0,this._mode=_d.CATMULL_ROM,this._knots=[],this._type=to.SHAPE_SPLINE,this._mode=e;for(var i=0;i<t.length;i++)this._knots[i]=new Di(t[i])}e.create=function(t,i){return void 0===i&&(i=[]),new e(t,i)},e.clone=function(t){return new e(t.mode,t.knots)},e.copy=function(e,t){e._mode=t.mode,e._knots.length=0;for(var i=t.knots,n=i.length,r=0;r<n;r++)e._knots[r]=new Di(i[r]);return e};var t=e.prototype;return t.setModeAndKnots=function(e,t){this._mode=e,this._knots.length=0;for(var i=0;i<t.length;i++)this._knots[i]=new Di(t[i])},t.clearKnots=function(){this._knots.length=0},t.getKnotCount=function(){return this._knots.length},t.addKnot=function(e){this._knots.push(new Di(e))},t.insertKnot=function(e,t){var i=new Di(t);e>=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=gd),t=yi(t,0,1);var n=this.getSegments();if(0==n)return new Di(0,0,0);if(i==gd){var r=1/n;i=Math.floor(t/r),t=t%r/r}if(i>=n)return new Di(this._knots[this._knots.length-1]);switch(this._mode){case _d.LINEAR:return e.calcLinear(this._knots[i],this._knots[i+1],t);case _d.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 _d.CATMULL_ROM:var s=i>0?this._knots[i-1]:this._knots[i],a=i+2<this._knots.length?this._knots[i+2]:this._knots[i+1];return e.calcCatmullRom(s,this._knots[i],this._knots[i+1],a,t);default:return new Di(0,0,0)}},t.getPoints=function(e,t){if(void 0===t&&(t=gd),0==e)return[];if(1==e)return[this.getPoint(0,t)];for(var i=[],n=1/(e-1),r=0;r<e;r++){var s=r*n,a=this.getPoint(s,t);i.push(a)}return i},t.getSegments=function(){var e=this._knots.length;switch(this._mode){case _d.LINEAR:case _d.CATMULL_ROM:return e<2?(Y(14300),0):e-1;case _d.BEZIER:return e<4||e%4!=0?(Y(14301),0):e/4}},e.calcLinear=function(e,t,i){var n=new Di;return Di.multiplyScalar(vd,e,1-i),Di.multiplyScalar(yd,t,i),Di.add(n,vd,yd),n},e.calcBezier=function(e,t,i,n,r){var s=new Di,a=1-r;return Di.multiplyScalar(vd,e,a*a*a),Di.multiplyScalar(yd,t,3*r*a*a),Di.multiplyScalar(Ed,i,3*r*r*a),Di.multiplyScalar(Td,n,r*r*r),Di.add(vd,vd,yd),Di.add(Ed,Ed,Td),Di.add(s,vd,Ed),s},e.calcCatmullRom=function(e,t,i,n,r){var s=new Di,a=r*r,o=a*r;return Di.multiplyScalar(vd,e,-.5*o+a-.5*r),Di.multiplyScalar(yd,t,1.5*o-2.5*a+1),Di.multiplyScalar(Ed,i,-1.5*o+2*a+.5*r),Di.multiplyScalar(Td,n,.5*o-.5*a),Di.add(vd,vd,yd),Di.add(Ed,Ed,Td),Di.add(s,vd,Ed),s},c(e,[{key:"type",get:function(){return this._type}},{key:"mode",get:function(){return this._mode}},{key:"knots",get:function(){return this._knots}}]),e}()),ie(pu,"intersect",[{name:"ray_aabb",newName:"rayAABB"},{name:"ray_plane",newName:"rayPlane"},{name:"ray_triangle",newName:"rayTriangle"},{name:"ray_sphere",newName:"raySphere"},{name:"ray_obb",newName:"rayOBB"},{name:"ray_capsule",newName:"rayCapsule"},{name:"ray_subMesh",newName:"raySubMesh"},{name:"ray_mesh",newName:"rayMesh"},{name:"ray_model",newName:"rayModel"},{name:"line_plane",newName:"linePlane"},{name:"line_triangle",newName:"lineTriangle"},{name:"line_aabb",newName:"lineAABB"},{name:"line_obb",newName:"lineOBB"},{name:"line_sphere",newName:"lineSphere"},{name:"aabb_aabb",newName:"aabbWithAABB"},{name:"aabb_obb",newName:"aabbWithOBB"},{name:"aabb_plane",newName:"aabbPlane"},{name:"aabb_frustum",newName:"aabbFrustum"},{name:"aabbFrustum_accurate",newName:"aabbFrustumAccurate"},{name:"obb_point",newName:"obbPoint"},{name:"obb_plane",newName:"obbPlane"},{name:"obb_frustum",newName:"obbFrustum"},{name:"obbFrustum_accurate",newName:"obbFrustumAccurate"},{name:"obb_obb",newName:"obbWithOBB"},{name:"obb_capsule",newName:"obbCapsule"},{name:"sphere_plane",newName:"spherePlane"},{name:"sphere_frustum",newName:"sphereFrustum"},{name:"sphereFrustum_accurate",newName:"sphereFrustumAccurate"},{name:"sphere_sphere",newName:"sphereWithSphere"},{name:"sphere_aabb",newName:"sphereAABB"},{name:"sphere_obb",newName:"sphereOBB"},{name:"sphere_capsule",newName:"sphereCapsule"},{name:"capsule_capsule",newName:"capsuleWithCapsule"}]),e("cl",function(e){function t(){var t;return t=e.call(this)||this,Ad("line","Line"),t}return _(t,e),t}(io)),e("cm",function(e){function t(){var t;return t=e.call(this)||this,Ad("plane","Plane"),t}return _(t,e),t}(Eu)),e("cn",function(e){function t(){var t;return t=e.call(this)||this,Ad("ray","Ray"),t}return _(t,e),t}(no)),e("co",function(e){function t(){var t;return t=e.call(this)||this,Ad("triangle","Triangle"),t}return _(t,e),t}(lo)),e("cp",function(e){function t(){var t;return t=e.call(this)||this,Ad("sphere","Sphere"),t}return _(t,e),t}(co)),e("cq",function(e){function t(){var t;return t=e.call(this)||this,Ad("aabb","AABB"),t}return _(t,e),t}(Iu)),e("cr",function(e){function t(){var t;return t=e.call(this)||this,Ad("obb","OBB"),t}return _(t,e),t}(Mu)),e("cs",function(e){function t(){var t;return t=e.call(this)||this,Ad("capsule","Capsule"),t}return _(t,e),t}(xu)),e("ct",function(e){function t(){var t;return t=e.call(this)||this,Ad("frustum","Frustum"),t}return _(t,e),t}(zu));var Sd={NONE:0,IGNORE_RAYCAST:1<<20,GIZMOS:1<<21,EDITOR:1<<22,UI_3D:1<<23,SCENE_GIZMO:1<<24,UI_2D:1<<25,PROFILER:1<<28,DEFAULT:1<<30,ALL:4294967295},bd=e("eu",function(){function e(){}return e.init=function(){var t=Tt.querySettings(Et.Category.ENGINE,"customLayers");if(t)for(var i=0;i<t.length;i++){var n=t[i];e.addLayer(n.name,n.bit)}},e.makeMaskInclude=function(e){for(var t,i=0,n=E(e);!(t=n()).done;)i|=t.value;return i},e.makeMaskExclude=function(t){return~e.makeMaskInclude(t)},e.addLayer=function(t,i){if(void 0!==i)if(i>19||i<0)console.warn("maximum layers reached.");else{var n=1<<i;e.Enum[t],$(2104,t),e.Enum[t]=n,_t.value(e.Enum,String(n),t),e.BitMask[t]=n,_t.value(e.BitMask,String(n),t)}else console.warn("bitNum can't be undefined")},e.deleteLayer=function(t){if(t>19||t<0)console.warn("do not change buildin layers.");else{var i=1<<t;delete e.Enum[e.Enum[i]],delete e.Enum[i],delete e.BitMask[e.BitMask[i]],delete e.BitMask[i]}},e.nameToLayer=function(t){return void 0===t?(console.warn("name can't be undefined"),-1):r(e.Enum[t])},e.layerToName=function(t){return t>31||t<0?(console.warn("Unable to access unknown layer."),""):e.Enum[1<<t]},e}());bd.Enum=dt(Sd),bd.BitMask=ft(l({},Sd)),R.Layers=bd;var wd,Rd,Id="MainFlow",Od="ForwardFlow",Nd="ShadowFlow";!function(e){e[e.DEFAULT=100]="DEFAULT",e[e.UI=200]="UI"}(wd||(wd={})),R.RenderPassStage=wd,function(e){e[e.MIN=0]="MIN",e[e.MAX=255]="MAX",e[e.DEFAULT=128]="DEFAULT"}(Rd||(Rd=e("eZ",{})));var Cd,Md={bindings:[],layouts:{}},xd={bindings:[],layouts:{}};!function(e){e[e.UBO_GLOBAL=0]="UBO_GLOBAL",e[e.UBO_CAMERA=1]="UBO_CAMERA",e[e.UBO_SHADOW=2]="UBO_SHADOW",e[e.UBO_CSM=3]="UBO_CSM",e[e.SAMPLER_SHADOWMAP=4]="SAMPLER_SHADOWMAP",e[e.SAMPLER_ENVIRONMENT=5]="SAMPLER_ENVIRONMENT",e[e.SAMPLER_SPOT_SHADOW_MAP=6]="SAMPLER_SPOT_SHADOW_MAP",e[e.SAMPLER_DIFFUSEMAP=7]="SAMPLER_DIFFUSEMAP",e[e.COUNT=8]="COUNT"}(Cd||(Cd={}));var Fd,Pd=Cd.SAMPLER_SHADOWMAP,Dd=Cd.COUNT-Pd;!function(e){e[e.UBO_LOCAL=0]="UBO_LOCAL",e[e.UBO_FORWARD_LIGHTS=1]="UBO_FORWARD_LIGHTS",e[e.UBO_SKINNING_ANIMATION=2]="UBO_SKINNING_ANIMATION",e[e.UBO_SKINNING_TEXTURE=3]="UBO_SKINNING_TEXTURE",e[e.UBO_MORPH=4]="UBO_MORPH",e[e.UBO_UI_LOCAL=5]="UBO_UI_LOCAL",e[e.SAMPLER_JOINTS=6]="SAMPLER_JOINTS",e[e.SAMPLER_MORPH_POSITION=7]="SAMPLER_MORPH_POSITION",e[e.SAMPLER_MORPH_NORMAL=8]="SAMPLER_MORPH_NORMAL",e[e.SAMPLER_MORPH_TANGENT=9]="SAMPLER_MORPH_TANGENT",e[e.SAMPLER_LIGHTMAP=10]="SAMPLER_LIGHTMAP",e[e.SAMPLER_SPRITE=11]="SAMPLER_SPRITE",e[e.SAMPLER_REFLECTION=12]="SAMPLER_REFLECTION",e[e.STORAGE_REFLECTION=13]="STORAGE_REFLECTION",e[e.COUNT=14]="COUNT"}(Fd||(Fd=e("eX",{})));var Ld,Bd=Fd.SAMPLER_JOINTS,Ud=Fd.STORAGE_REFLECTION-Bd,Gd=Fd.COUNT-Bd-Ud;!function(e){e[e.GLOBAL=0]="GLOBAL",e[e.MATERIAL=1]="MATERIAL",e[e.LOCAL=2]="LOCAL"}(Ld||(Ld={}));var zd=new Er([Pd,0,Bd],[Dd,0,Ud],[0,0,0],[0,0,0],[0,0,0],[0,0,Gd],[0,0,0],[0,2,1]),kd=function(){};kd.SIZE=4*(kd.COUNT=4+(kd.DEBUG_VIEW_COMPOSITE_PACK_3_OFFSET=4+(kd.DEBUG_VIEW_COMPOSITE_PACK_2_OFFSET=4+(kd.DEBUG_VIEW_COMPOSITE_PACK_1_OFFSET=4+(kd.DEBUG_VIEW_MODE_OFFSET=4+(kd.NATIVE_SIZE_OFFSET=4+(kd.SCREEN_SIZE_OFFSET=4+(kd.TIME_OFFSET=0)))))))),kd.NAME="CCGlobal",kd.BINDING=Cd.UBO_GLOBAL,kd.DESCRIPTOR=new Jr(kd.BINDING,Kn.UNIFORM_BUFFER,1,Bn.ALL),kd.LAYOUT=new xr(Ld.GLOBAL,kd.BINDING,kd.NAME,[new Mr("cc_time",yn.FLOAT4,1),new Mr("cc_screenSize",yn.FLOAT4,1),new Mr("cc_nativeSize",yn.FLOAT4,1),new Mr("cc_debug_view_mode",yn.FLOAT,4),new Mr("cc_debug_view_composite_pack_1",yn.FLOAT,4),new Mr("cc_debug_view_composite_pack_2",yn.FLOAT,4),new Mr("cc_debug_view_composite_pack_3",yn.FLOAT,4)],1),Md.layouts[kd.NAME]=kd.LAYOUT,Md.bindings[kd.BINDING]=kd.DESCRIPTOR;var Hd=function(){};Hd.SIZE=4*(Hd.COUNT=4+(Hd.VIEW_PORT_OFFSET=4+(Hd.NEAR_FAR_OFFSET=4+(Hd.GLOBAL_FOG_ADD_OFFSET=4+(Hd.GLOBAL_FOG_BASE_OFFSET=4+(Hd.GLOBAL_FOG_COLOR_OFFSET=4+(Hd.AMBIENT_GROUND_OFFSET=4+(Hd.AMBIENT_SKY_OFFSET=4+(Hd.MAIN_LIT_COLOR_OFFSET=4+(Hd.MAIN_LIT_DIR_OFFSET=4+(Hd.EXPOSURE_OFFSET=4+(Hd.SCREEN_SCALE_OFFSET=4+(Hd.SURFACE_TRANSFORM_OFFSET=4+(Hd.CAMERA_POS_OFFSET=16+(Hd.MAT_VIEW_PROJ_INV_OFFSET=16+(Hd.MAT_VIEW_PROJ_OFFSET=16+(Hd.MAT_PROJ_INV_OFFSET=16+(Hd.MAT_PROJ_OFFSET=16+(Hd.MAT_VIEW_INV_OFFSET=16+(Hd.MAT_VIEW_OFFSET=0)))))))))))))))))))),Hd.NAME="CCCamera",Hd.BINDING=Cd.UBO_CAMERA,Hd.DESCRIPTOR=new Jr(Hd.BINDING,Kn.UNIFORM_BUFFER,1,Bn.ALL),Hd.LAYOUT=new xr(Ld.GLOBAL,Hd.BINDING,Hd.NAME,[new Mr("cc_matView",yn.MAT4,1),new Mr("cc_matViewInv",yn.MAT4,1),new Mr("cc_matProj",yn.MAT4,1),new Mr("cc_matProjInv",yn.MAT4,1),new Mr("cc_matViewProj",yn.MAT4,1),new Mr("cc_matViewProjInv",yn.MAT4,1),new Mr("cc_cameraPos",yn.FLOAT4,1),new Mr("cc_surfaceTransform",yn.FLOAT4,1),new Mr("cc_screenScale",yn.FLOAT4,1),new Mr("cc_exposure",yn.FLOAT4,1),new Mr("cc_mainLitDir",yn.FLOAT4,1),new Mr("cc_mainLitColor",yn.FLOAT4,1),new Mr("cc_ambientSky",yn.FLOAT4,1),new Mr("cc_ambientGround",yn.FLOAT4,1),new Mr("cc_fogColor",yn.FLOAT4,1),new Mr("cc_fogBase",yn.FLOAT4,1),new Mr("cc_fogAdd",yn.FLOAT4,1),new Mr("cc_nearFar",yn.FLOAT4,1),new Mr("cc_viewPort",yn.FLOAT4,1)],1),Md.layouts[Hd.NAME]=Hd.LAYOUT,Md.bindings[Hd.BINDING]=Hd.DESCRIPTOR;var Vd=function(){};Vd.SIZE=4*(Vd.COUNT=4+(Vd.PLANAR_NORMAL_DISTANCE_INFO_OFFSET=4+(Vd.SHADOW_COLOR_OFFSET=4+(Vd.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET=4+(Vd.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET=4+(Vd.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET=4+(Vd.SHADOW_PROJ_INFO_OFFSET=4+(Vd.SHADOW_PROJ_DEPTH_INFO_OFFSET=4+(Vd.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET=16+(Vd.MAT_LIGHT_VIEW_PROJ_OFFSET=16+(Vd.MAT_LIGHT_VIEW_OFFSET=0))))))))))),Vd.NAME="CCShadow",Vd.BINDING=Cd.UBO_SHADOW,Vd.DESCRIPTOR=new Jr(Vd.BINDING,Kn.UNIFORM_BUFFER,1,Bn.ALL),Vd.LAYOUT=new xr(Ld.GLOBAL,Vd.BINDING,Vd.NAME,[new Mr("cc_matLightView",yn.MAT4,1),new Mr("cc_matLightViewProj",yn.MAT4,1),new Mr("cc_shadowInvProjDepthInfo",yn.FLOAT4,1),new Mr("cc_shadowProjDepthInfo",yn.FLOAT4,1),new Mr("cc_shadowProjInfo",yn.FLOAT4,1),new Mr("cc_shadowNFLSInfo",yn.FLOAT4,1),new Mr("cc_shadowWHPBInfo",yn.FLOAT4,1),new Mr("cc_shadowLPNNInfo",yn.FLOAT4,1),new Mr("cc_shadowColor",yn.FLOAT4,1),new Mr("cc_planarNDInfo",yn.FLOAT4,1)],1),Md.layouts[Vd.NAME]=Vd.LAYOUT,Md.bindings[Vd.BINDING]=Vd.DESCRIPTOR;var Wd=function(){};Wd.CSM_LEVEL_COUNT=4,Wd.SIZE=4*(Wd.COUNT=4+(Wd.CSM_SPLITS_INFO_OFFSET=(Wd.CSM_PROJ_INFO_OFFSET=(Wd.CSM_PROJ_DEPTH_INFO_OFFSET=(Wd.MAT_CSM_VIEW_PROJ_OFFSET=(Wd.CSM_ATLAS_OFFSET=(Wd.CSM_VIEW_DIR_2_OFFSET=(Wd.CSM_VIEW_DIR_1_OFFSET=(Wd.CSM_VIEW_DIR_0_OFFSET=0)+4*Wd.CSM_LEVEL_COUNT)+4*Wd.CSM_LEVEL_COUNT)+4*Wd.CSM_LEVEL_COUNT)+4*Wd.CSM_LEVEL_COUNT)+16*Wd.CSM_LEVEL_COUNT)+4*Wd.CSM_LEVEL_COUNT)+4*Wd.CSM_LEVEL_COUNT)),Wd.NAME="CCCSM",Wd.BINDING=Cd.UBO_CSM,Wd.DESCRIPTOR=new Jr(Wd.BINDING,Kn.UNIFORM_BUFFER,1,Bn.ALL),Wd.LAYOUT=new xr(Ld.GLOBAL,Wd.BINDING,Wd.NAME,[new Mr("cc_csmViewDir0",yn.FLOAT4,Wd.CSM_LEVEL_COUNT),new Mr("cc_csmViewDir1",yn.FLOAT4,Wd.CSM_LEVEL_COUNT),new Mr("cc_csmViewDir2",yn.FLOAT4,Wd.CSM_LEVEL_COUNT),new Mr("cc_csmAtlas",yn.FLOAT4,Wd.CSM_LEVEL_COUNT),new Mr("cc_matCSMViewProj",yn.MAT4,Wd.CSM_LEVEL_COUNT),new Mr("cc_csmProjDepthInfo",yn.FLOAT4,Wd.CSM_LEVEL_COUNT),new Mr("cc_csmProjInfo",yn.FLOAT4,Wd.CSM_LEVEL_COUNT),new Mr("cc_csmSplitsInfo",yn.FLOAT4,1)],1),Md.layouts[Wd.NAME]=Wd.LAYOUT,Md.bindings[Wd.BINDING]=Wd.DESCRIPTOR;var jd=Cd.SAMPLER_SHADOWMAP,Xd=new Jr(jd,Kn.SAMPLER_TEXTURE,1,Bn.FRAGMENT),Yd=new Fr(Ld.GLOBAL,jd,"cc_shadowMap",yn.SAMPLER2D,1);Md.layouts.cc_shadowMap=Yd,Md.bindings[jd]=Xd;var qd=Cd.SAMPLER_ENVIRONMENT,Kd=new Jr(qd,Kn.SAMPLER_TEXTURE,1,Bn.FRAGMENT),Qd=new Fr(Ld.GLOBAL,qd,"cc_environment",yn.SAMPLER_CUBE,1);Md.layouts.cc_environment=Qd,Md.bindings[qd]=Kd;var Zd=Cd.SAMPLER_DIFFUSEMAP,Jd=new Jr(Zd,Kn.SAMPLER_TEXTURE,1,Bn.FRAGMENT),$d=new Fr(Ld.GLOBAL,Zd,"cc_diffuseMap",yn.SAMPLER_CUBE,1);Md.layouts.cc_diffuseMap=$d,Md.bindings[Zd]=Jd;var ep=Cd.SAMPLER_SPOT_SHADOW_MAP,tp=new Jr(ep,Kn.SAMPLER_TEXTURE,1,Bn.FRAGMENT),ip=new Fr(Ld.GLOBAL,ep,"cc_spotShadowMap",yn.SAMPLER2D,1);Md.layouts.cc_spotShadowMap=ip,Md.bindings[ep]=tp;var np=e("f7",(function(){}));np.MAT_WORLD_OFFSET=0,np.MAT_WORLD_IT_OFFSET=np.MAT_WORLD_OFFSET+16,np.LIGHTINGMAP_UVPARAM=np.MAT_WORLD_IT_OFFSET+16,np.LOCAL_SHADOW_BIAS=np.LIGHTINGMAP_UVPARAM+4,np.COUNT=np.LOCAL_SHADOW_BIAS+4,np.SIZE=4*np.COUNT,np.NAME="CCLocal",np.BINDING=Fd.UBO_LOCAL,np.DESCRIPTOR=new Jr(np.BINDING,Kn.UNIFORM_BUFFER,1,Bn.VERTEX|Bn.COMPUTE),np.LAYOUT=new xr(Ld.LOCAL,np.BINDING,np.NAME,[new Mr("cc_matWorld",yn.MAT4,1),new Mr("cc_matWorldIT",yn.MAT4,1),new Mr("cc_lightingMapUVParam",yn.FLOAT4,1),new Mr("cc_localShadowBias",yn.FLOAT4,1)],1),xd.layouts[np.NAME]=np.LAYOUT,xd.bindings[np.BINDING]=np.DESCRIPTOR;var rp=function(){};rp.SIZE=4*(rp.COUNT=4+(rp.WORLD_BOUND_HALF_EXTENTS=4+(rp.WORLD_BOUND_CENTER=0))),rp.NAME="CCWorldBound",rp.BINDING=Fd.UBO_LOCAL,rp.DESCRIPTOR=new Jr(rp.BINDING,Kn.UNIFORM_BUFFER,1,Bn.VERTEX|Bn.COMPUTE),rp.LAYOUT=new xr(Ld.LOCAL,rp.BINDING,rp.NAME,[new Mr("cc_worldBoundCenter",yn.FLOAT4,1),new Mr("cc_worldBoundHalfExtents",yn.FLOAT4,1)],1),xd.layouts[rp.NAME]=rp.LAYOUT,xd.bindings[rp.BINDING]=rp.DESCRIPTOR;var sp="a_matWorld0",ap=function(){};ap.BATCHING_COUNT=10,ap.MAT_WORLDS_OFFSET=0,ap.SIZE=4*(ap.COUNT=16*ap.BATCHING_COUNT),ap.NAME="CCLocalBatched",ap.BINDING=Fd.UBO_LOCAL,ap.DESCRIPTOR=new Jr(ap.BINDING,Kn.UNIFORM_BUFFER,1,Bn.VERTEX|Bn.COMPUTE),ap.LAYOUT=new xr(Ld.LOCAL,ap.BINDING,ap.NAME,[new Mr("cc_matWorlds",yn.MAT4,ap.BATCHING_COUNT)],1),xd.layouts[ap.NAME]=ap.LAYOUT,xd.bindings[ap.BINDING]=ap.DESCRIPTOR;var op=function(){};op.LIGHTS_PER_PASS=1,op.SIZE=4*(op.COUNT=(op.LIGHT_DIR_OFFSET=(op.LIGHT_SIZE_RANGE_ANGLE_OFFSET=(op.LIGHT_COLOR_OFFSET=(op.LIGHT_POS_OFFSET=0)+4*op.LIGHTS_PER_PASS)+4*op.LIGHTS_PER_PASS)+4*op.LIGHTS_PER_PASS)+4*op.LIGHTS_PER_PASS),op.NAME="CCForwardLight",op.BINDING=Fd.UBO_FORWARD_LIGHTS,op.DESCRIPTOR=new Jr(op.BINDING,Kn.DYNAMIC_UNIFORM_BUFFER,1,Bn.FRAGMENT),op.LAYOUT=new xr(Ld.LOCAL,op.BINDING,op.NAME,[new Mr("cc_lightPos",yn.FLOAT4,op.LIGHTS_PER_PASS),new Mr("cc_lightColor",yn.FLOAT4,op.LIGHTS_PER_PASS),new Mr("cc_lightSizeRangeAngle",yn.FLOAT4,op.LIGHTS_PER_PASS),new Mr("cc_lightDir",yn.FLOAT4,op.LIGHTS_PER_PASS)],1),xd.layouts[op.NAME]=op.LAYOUT,xd.bindings[op.BINDING]=op.DESCRIPTOR;var up=function(){};up.LIGHTS_PER_PASS=10;var hp=e("fg",(function(){}));hp.JOINTS_TEXTURE_INFO_OFFSET=0,hp.COUNT=hp.JOINTS_TEXTURE_INFO_OFFSET+4,hp.SIZE=4*hp.COUNT,hp.NAME="CCSkinningTexture",hp.BINDING=Fd.UBO_SKINNING_TEXTURE,hp.DESCRIPTOR=new Jr(hp.BINDING,Kn.UNIFORM_BUFFER,1,Bn.VERTEX),hp.LAYOUT=new xr(Ld.LOCAL,hp.BINDING,hp.NAME,[new Mr("cc_jointTextureInfo",yn.FLOAT4,1)],1),xd.layouts[hp.NAME]=hp.LAYOUT,xd.bindings[hp.BINDING]=hp.DESCRIPTOR;var cp=e("fd",(function(){}));cp.JOINTS_ANIM_INFO_OFFSET=0,cp.COUNT=cp.JOINTS_ANIM_INFO_OFFSET+4,cp.SIZE=4*cp.COUNT,cp.NAME="CCSkinningAnimation",cp.BINDING=Fd.UBO_SKINNING_ANIMATION,cp.DESCRIPTOR=new Jr(cp.BINDING,Kn.UNIFORM_BUFFER,1,Bn.VERTEX),cp.LAYOUT=new xr(Ld.LOCAL,cp.BINDING,cp.NAME,[new Mr("cc_jointAnimInfo",yn.FLOAT4,1)],1),xd.layouts[cp.NAME]=cp.LAYOUT,xd.bindings[cp.BINDING]=cp.DESCRIPTOR;var lp=e("fi","a_jointAnimInfo"),_p=e("fe",function(){function e(){}return e.initLayout=function(t){e._jointUniformCapacity=t,e._count=12*t,e._size=4*e._count,e.LAYOUT.members[0].count=3*t},c(e,null,[{key:"JOINT_UNIFORM_CAPACITY",get:function(){return e._jointUniformCapacity}},{key:"COUNT",get:function(){return e._count}},{key:"SIZE",get:function(){return e._size}}]),e}());function fp(e){_p.initLayout(e),xd.layouts[_p.NAME]=_p.LAYOUT,xd.bindings[_p.BINDING]=_p.DESCRIPTOR}_p._jointUniformCapacity=0,_p._count=0,_p._size=0,_p.NAME="CCSkinning",_p.BINDING=Fd.UBO_SKINNING_TEXTURE,_p.DESCRIPTOR=new Jr(_p.BINDING,Kn.UNIFORM_BUFFER,1,Bn.VERTEX),_p.LAYOUT=new xr(Ld.LOCAL,_p.BINDING,_p.NAME,[new Mr("cc_joints",yn.FLOAT4,1)],1);var dp=e("dF",(function(){}));dp.MAX_MORPH_TARGET_COUNT=60,dp.OFFSET_OF_WEIGHTS=0,dp.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH=4*dp.MAX_MORPH_TARGET_COUNT,dp.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT=dp.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH+4,dp.OFFSET_OF_VERTICES_COUNT=dp.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT+4,dp.COUNT_BASE_4_BYTES=4*Math.ceil(dp.MAX_MORPH_TARGET_COUNT/4)+4,dp.SIZE=4*dp.COUNT_BASE_4_BYTES,dp.NAME="CCMorph",dp.BINDING=Fd.UBO_MORPH,dp.DESCRIPTOR=new Jr(dp.BINDING,Kn.UNIFORM_BUFFER,1,Bn.VERTEX),dp.LAYOUT=new xr(Ld.LOCAL,dp.BINDING,dp.NAME,[new Mr("cc_displacementWeights",yn.FLOAT4,dp.MAX_MORPH_TARGET_COUNT/4),new Mr("cc_displacementTextureInfo",yn.FLOAT4,1)],1),xd.layouts[dp.NAME]=dp.LAYOUT,xd.bindings[dp.BINDING]=dp.DESCRIPTOR;var pp=function(){};pp.NAME="CCUILocal",pp.BINDING=Fd.UBO_UI_LOCAL,pp.DESCRIPTOR=new Jr(pp.BINDING,Kn.DYNAMIC_UNIFORM_BUFFER,1,Bn.VERTEX),pp.LAYOUT=new xr(Ld.LOCAL,pp.BINDING,pp.NAME,[new Mr("cc_local_data",yn.FLOAT4,1)],1),xd.layouts[pp.NAME]=pp.LAYOUT,xd.bindings[pp.BINDING]=pp.DESCRIPTOR;var mp=e("fh",Fd.SAMPLER_JOINTS),gp=new Jr(mp,Kn.SAMPLER_TEXTURE,1,Bn.VERTEX),vp=new Fr(Ld.LOCAL,mp,"cc_jointTexture",yn.SAMPLER2D,1);xd.layouts.cc_jointTexture=vp,xd.bindings[mp]=gp;var yp=e("ff",Fd.SAMPLER_JOINTS),Ep=new Jr(yp,Kn.SAMPLER_TEXTURE,1,Bn.VERTEX),Tp=new Fr(Ld.LOCAL,yp,"cc_realtimeJoint",yn.SAMPLER2D,1);xd.layouts.cc_realtimeJoint=Tp,xd.bindings[yp]=Ep;var Ap=e("dN",Fd.SAMPLER_MORPH_POSITION),Sp=new Jr(Ap,Kn.SAMPLER_TEXTURE,1,Bn.VERTEX),bp=new Fr(Ld.LOCAL,Ap,"cc_PositionDisplacements",yn.SAMPLER2D,1);xd.layouts.cc_PositionDisplacements=bp,xd.bindings[Ap]=Sp;var wp=e("dM",Fd.SAMPLER_MORPH_NORMAL),Rp=new Jr(wp,Kn.SAMPLER_TEXTURE,1,Bn.VERTEX),Ip=new Fr(Ld.LOCAL,wp,"cc_NormalDisplacements",yn.SAMPLER2D,1);xd.layouts.cc_NormalDisplacements=Ip,xd.bindings[wp]=Rp;var Op=e("dL",Fd.SAMPLER_MORPH_TANGENT),Np=new Jr(Op,Kn.SAMPLER_TEXTURE,1,Bn.VERTEX),Cp=new Fr(Ld.LOCAL,Op,"cc_TangentDisplacements",yn.SAMPLER2D,1);xd.layouts.cc_TangentDisplacements=Cp,xd.bindings[Op]=Np;var Mp=Fd.SAMPLER_LIGHTMAP,xp=new Jr(Mp,Kn.SAMPLER_TEXTURE,1,Bn.FRAGMENT),Fp=new Fr(Ld.LOCAL,Mp,"cc_lightingMap",yn.SAMPLER2D,1);xd.layouts.cc_lightingMap=Fp,xd.bindings[Mp]=xp;var Pp=Fd.SAMPLER_SPRITE,Dp=new Jr(Pp,Kn.SAMPLER_TEXTURE,1,Bn.FRAGMENT),Lp=new Fr(Ld.LOCAL,Pp,"cc_spriteTexture",yn.SAMPLER2D,1);xd.layouts.cc_spriteTexture=Lp,xd.bindings[Pp]=Dp;var Bp=Fd.SAMPLER_REFLECTION,Up=new Jr(Bp,Kn.SAMPLER_TEXTURE,1,Bn.FRAGMENT),Gp=new Fr(Ld.LOCAL,Bp,"cc_reflectionTexture",yn.SAMPLER2D,1);xd.layouts.cc_reflectionTexture=Gp,xd.bindings[Bp]=Up;var zp=Fd.STORAGE_REFLECTION,kp=new Jr(zp,Kn.STORAGE_IMAGE,1,Bn.COMPUTE),Hp=new Lr(Ld.LOCAL,zp,"cc_reflectionStorage",yn.IMAGE2D,1);xd.layouts.cc_reflectionStorage=Hp,xd.bindings[zp]=kp;var Vp,Wp,jp=bd.makeMaskExclude([bd.BitMask.UI_2D,bd.BitMask.GIZMOS,bd.BitMask.EDITOR,bd.BitMask.SCENE_GIZMO,bd.BitMask.PROFILER]),Xp=bd.makeMaskExclude([bd.BitMask.UI_2D,bd.BitMask.PROFILER]),Yp=bd.Enum.ALL;function qp(e){return(e.getFormatFeatures(gn.R32F)&(In.RENDER_TARGET|In.SAMPLED_TEXTURE))==(In.RENDER_TARGET|In.SAMPLED_TEXTURE)}e("hc",Object.freeze({__proto__:null,PIPELINE_FLOW_MAIN:Id,PIPELINE_FLOW_FORWARD:Od,PIPELINE_FLOW_SHADOW:Nd,PIPELINE_FLOW_SMAA:"SMAAFlow",PIPELINE_FLOW_TONEMAP:"ToneMapFlow",get RenderPassStage(){return wd},get RenderPriority(){return Rd},globalDescriptorSetLayout:Md,localDescriptorSetLayout:xd,get PipelineGlobalBindings(){return Cd},get ModelLocalBindings(){return Fd},get SetIndex(){return Ld},bindingMappingInfo:zd,UBOGlobal:kd,UBOCamera:Hd,UBOShadow:Vd,UBOCSM:Wd,UNIFORM_SHADOWMAP_BINDING:jd,UNIFORM_ENVIRONMENT_BINDING:qd,UNIFORM_DIFFUSEMAP_BINDING:Zd,UNIFORM_SPOT_SHADOW_MAP_TEXTURE_BINDING:ep,UBOLocal:np,UBOWorldBound:rp,INST_MAT_WORLD:sp,UBOLocalBatched:ap,UBOForwardLight:op,UBODeferredLight:up,JOINT_UNIFORM_CAPACITY:30,UBOSkinningTexture:hp,UBOSkinningAnimation:cp,INST_JOINT_ANIM_INFO:lp,UBOSkinning:_p,localDescriptorSetLayout_ResizeMaxJoints:fp,UBOMorph:dp,UBOUILocal:pp,UNIFORM_JOINT_TEXTURE_BINDING:mp,UNIFORM_REALTIME_JOINT_TEXTURE_BINDING:yp,UNIFORM_POSITION_MORPH_TEXTURE_BINDING:Ap,UNIFORM_NORMAL_MORPH_TEXTURE_BINDING:wp,UNIFORM_TANGENT_MORPH_TEXTURE_BINDING:Op,UNIFORM_LIGHTMAP_TEXTURE_BINDING:Mp,UNIFORM_SPRITE_TEXTURE_BINDING:Pp,UNIFORM_REFLECTION_TEXTURE_BINDING:Bp,UNIFORM_REFLECTION_STORAGE_BINDING:zp,CAMERA_DEFAULT_MASK:jp,CAMERA_EDITOR_MASK:Xp,MODEL_ALWAYS_MASK:Yp,supportsR16HalfFloatTexture:function(e){return(e.getFormatFeatures(gn.R16F)&(In.RENDER_TARGET|In.SAMPLED_TEXTURE))==(In.RENDER_TARGET|In.SAMPLED_TEXTURE)},supportsR32FloatTexture:qp}));var Kp=4227858432,Qp=66060288,Zp=1044480,Jp=e("ew",(function(e,t,i,n){return void 0===n&&(n=0),t<<26&Kp|e<<20&Qp|i<<12&Zp|4095&n})),$p=e("ex",(function(e){return(e&Kp)>>>26})),em=e("ey",(function(e){return(e&Qp)>>>20})),tm=e("ez",(function(e){return(e&Zp)>>>12})),im=e("eA",(function(e){return 4095&e})),nm=e("eB",(function(e,t){return 67108863&e|t<<26&Kp})),rm=e("eC",((Vp={})[yn.UNKNOWN]=function(){return console.warn("illegal uniform handle")},Vp[yn.INT]=function(e,t,i){return void 0===i&&(i=0),e[i]},Vp[yn.INT2]=function(e,t,i){return void 0===i&&(i=0),en.fromArray(t,e,i)},Vp[yn.INT3]=function(e,t,i){return void 0===i&&(i=0),Di.fromArray(t,e,i)},Vp[yn.INT4]=function(e,t,i){return void 0===i&&(i=0),sn.fromArray(t,e,i)},Vp[yn.FLOAT]=function(e,t,i){return void 0===i&&(i=0),e[i]},Vp[yn.FLOAT2]=function(e,t,i){return void 0===i&&(i=0),en.fromArray(t,e,i)},Vp[yn.FLOAT3]=function(e,t,i){return void 0===i&&(i=0),Di.fromArray(t,e,i)},Vp[yn.FLOAT4]=function(e,t,i){return void 0===i&&(i=0),sn.fromArray(t,e,i)},Vp[yn.MAT3]=function(e,t,i){return void 0===i&&(i=0),Gi.fromArray(t,e,i)},Vp[yn.MAT4]=function(e,t,i){return void 0===i&&(i=0),Qi.fromArray(t,e,i)},Vp)),sm=e("eD",((Wp={})[yn.UNKNOWN]=function(){return console.warn("illegal uniform handle")},Wp[yn.INT]=function(e,t,i){return void 0===i&&(i=0),e[i]=t},Wp[yn.INT2]=function(e,t,i){return void 0===i&&(i=0),en.toArray(e,t,i)},Wp[yn.INT3]=function(e,t,i){return void 0===i&&(i=0),Di.toArray(e,t,i)},Wp[yn.INT4]=function(e,t,i){return void 0===i&&(i=0),sn.toArray(e,t,i)},Wp[yn.FLOAT]=function(e,t,i){return void 0===i&&(i=0),e[i]=t},Wp[yn.FLOAT2]=function(e,t,i){return void 0===i&&(i=0),en.toArray(e,t,i)},Wp[yn.FLOAT3]=function(e,t,i){return void 0===i&&(i=0),Di.toArray(e,t,i)},Wp[yn.FLOAT4]=function(e,t,i){return void 0===i&&(i=0),sn.toArray(e,t,i)},Wp[yn.MAT3]=function(e,t,i){return void 0===i&&(i=0),Gi.toArray(e,t,i)},Wp[yn.MAT4]=function(e,t,i){return void 0===i&&(i=0),Qi.toArray(e,t,i)},Wp)),am=[Object.freeze([0]),Object.freeze([0,0]),Object.freeze([0,0,0,0]),Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])];function om(e){switch(e){case yn.BOOL:case yn.INT:case yn.UINT:case yn.FLOAT:return am[0];case yn.BOOL2:case yn.INT2:case yn.UINT2:case yn.FLOAT2:return am[1];case yn.BOOL4:case yn.INT4:case yn.UINT4:case yn.FLOAT4:return am[2];case yn.MAT4:return am[3];case yn.SAMPLER2D:return"default-texture";case yn.SAMPLER_CUBE:return"default-cube-texture"}return am[0]}function um(e,t){for(var i=Object.entries(t),n=!1,r=0;r<i.length;r++)e[i[r][0]]!==i[r][1]&&(e[i[r][0]]=i[r][1],n=!0);return n}var hm=new $r;function cm(e){return Math.ceil(Math.log2(Math.max(e,2)))}function lm(e,t){switch(e.type){case"boolean":return"number"==typeof t?t.toString():t?"1":"0";case"string":return void 0!==t?t:e.options[0];case"number":return void 0!==t?t.toString():e.range[0].toString();default:return console.warn("unknown define type '"+e.type+"'"),"-1"}}function _m(e,t,i,n,r){for(var s=e.builtins[n],a=[],o=function(e){var t=s.blocks[e],n=i.layouts[t.name],o=n&&i.bindings.find((function(e){return e.binding===n.binding}));if(!(n&&o&&o.descriptorType&_s))return console.warn("builtin UBO '"+t.name+"' not available!"),"continue";a.push(n),r&&!r.includes(o)&&r.push(o)},u=0;u<s.blocks.length;u++)o(u);Array.prototype.unshift.apply(t.shaderInfo.blocks,a);for(var h=[],c=function(e){var t=s.samplerTextures[e],n=i.layouts[t.name],a=n&&i.bindings.find((function(e){return e.binding===n.binding}));if(!(n&&a&&a.descriptorType&fs))return console.warn("builtin samplerTexture '"+t.name+"' not available!"),"continue";h.push(n),r&&!r.includes(a)&&r.push(a)},l=0;l<s.samplerTextures.length;l++)c(l);Array.prototype.unshift.apply(t.shaderInfo.samplerTextures,h),r&&r.sort((function(e,t){return e.binding-t.binding}))}function fm(e){return e.members.reduce((function(e,t){return e+Es(t.type)*t.count}),0)}function dm(e,t){for(var i=0;i<e.length;i++){var n=e[i];if("!"===n[0]){if(t[n.slice(1)])return!1}else if(!t[n])return!1}return!0}var pm=function(){function e(){this._templates={},this._cache={},this._templateInfos={}}var t=e.prototype;return t.register=function(e){for(var t=0;t<e.shaders.length;t++)this.define(e.shaders[t]).effectName=e.name;for(var i=0;i<e.techniques.length;i++)for(var n=e.techniques[i],r=0;r<n.passes.length;r++){var s=n.passes[r];void 0!==s.propertyIndex&&void 0===s.properties&&(s.properties=n.passes[s.propertyIndex].properties)}},t.define=function(e){var t=this._templates[e.name];if(t&&t.hash===e.hash)return t;for(var i=l({},e),n=0,r=function(e){var t=i.defines[e],r=1;if("number"===t.type){var s=t.range;r=cm(s[1]-s[0]+1),t._map=function(e){return e-s[0]}}else"string"===t.type?(r=cm(t.options.length),t._map=function(e){return Math.max(0,t.options.findIndex((function(t){return t===e})))}):"boolean"===t.type&&(t._map=function(e){return e?1:0});t._offset=n,n+=r},s=0;s<i.defines.length;s++)r(s);for(var a in n>31&&(i.uber=!0),i.constantMacros="",i.builtins.statistics)i.constantMacros+="#define "+a+" "+i.builtins.statistics[a]+"\n";if(this._templates[e.name]=i,!this._templateInfos[i.hash]){var o={};o.samplerStartBinding=i.blocks.length,o.shaderInfo=new kr,o.blockSizes=[],o.bindings=[];for(var u=0;u<i.blocks.length;u++){var h=i.blocks[u];o.blockSizes.push(fm(h)),o.bindings.push(new Jr(h.binding,Kn.UNIFORM_BUFFER,1,h.stageFlags)),o.shaderInfo.blocks.push(new xr(Ld.MATERIAL,h.binding,h.name,h.members.map((function(e){return new Mr(e.name,e.type,e.count)})),1))}for(var c=0;c<i.samplerTextures.length;c++){var _=i.samplerTextures[c];o.bindings.push(new Jr(_.binding,Kn.SAMPLER_TEXTURE,_.count,_.stageFlags)),o.shaderInfo.samplerTextures.push(new Fr(Ld.MATERIAL,_.binding,_.name,_.type,_.count))}for(var f=0;f<i.samplers.length;f++){var d=i.samplers[f];o.bindings.push(new Jr(d.binding,Kn.SAMPLER,d.count,d.stageFlags)),o.shaderInfo.samplers.push(new Pr(Ld.MATERIAL,d.binding,d.name,d.count))}for(var p=0;p<i.textures.length;p++){var m=i.textures[p];o.bindings.push(new Jr(m.binding,Kn.TEXTURE,m.count,m.stageFlags)),o.shaderInfo.textures.push(new Dr(Ld.MATERIAL,m.binding,m.name,m.type,m.count))}for(var g=0;g<i.buffers.length;g++){var v=i.buffers[g];o.bindings.push(new Jr(v.binding,Kn.STORAGE_BUFFER,1,v.stageFlags)),o.shaderInfo.buffers.push(new Br(Ld.MATERIAL,v.binding,v.name,1,v.memoryAccess))}for(var y=0;y<i.images.length;y++){var E=i.images[y];o.bindings.push(new Jr(E.binding,Kn.STORAGE_IMAGE,E.count,E.stageFlags)),o.shaderInfo.images.push(new Lr(Ld.MATERIAL,E.binding,E.name,E.type,E.count,E.memoryAccess))}for(var T=0;T<i.subpassInputs.length;T++){var A=i.subpassInputs[T];o.bindings.push(new Jr(A.binding,Kn.INPUT_ATTACHMENT,A.count,A.stageFlags)),o.shaderInfo.subpassInputs.push(new Ur(Ld.MATERIAL,A.binding,A.name,A.count))}o.gfxAttributes=[];for(var S=0;S<i.attributes.length;S++){var b=i.attributes[S];o.gfxAttributes.push(new zr(b.name,b.format,b.isNormalized,0,b.isInstanced,b.location))}_m(i,o,xd,"locals"),o.shaderInfo.stages.push(new Gr(Bn.VERTEX,"")),o.shaderInfo.stages.push(new Gr(Bn.FRAGMENT,"")),o.handleMap=function(e){for(var t={},i=0;i<e.blocks.length;i++)for(var n=e.blocks[i],r=n.members,s=0,a=0;a<r.length;a++){var o=r[a];t[o.name]=Jp(n.binding,o.type,o.count,s),s+=(Es(o.type)>>2)*o.count}for(var u=0;u<e.samplerTextures.length;u++){var h=e.samplerTextures[u];t[h.name]=Jp(h.binding,h.type,h.count)}return t}(i),o.setLayouts=[],this._templateInfos[i.hash]=o}return i},t.getTemplate=function(e){return this._templates[e]},t.getTemplateInfo=function(e){var t=this._templates[e].hash;return this._templateInfos[t]},t.getDescriptorSetLayout=function(e,t,i){void 0===i&&(i=!1);var n=this._templates[t],r=this._templateInfos[n.hash];return r.setLayouts.length||(hm.bindings=r.bindings,r.setLayouts[Ld.MATERIAL]=e.createDescriptorSetLayout(hm),hm.bindings=xd.bindings,r.setLayouts[Ld.LOCAL]=e.createDescriptorSetLayout(hm)),r.setLayouts[i?Ld.LOCAL:Ld.MATERIAL]},t.hasProgram=function(e){return void 0!==this._templates[e]},t.getKey=function(e,t){var i=this._templates[e],n=i.defines;if(i.uber){for(var r="",s=0;s<n.length;s++){var a=n[s],o=t[a.name];if(o&&a._map){var u=a._map(o);r+=""+a._offset+u+"|"}}return""+r+i.hash}for(var h=0,c=0;c<n.length;c++){var l=n[c],_=t[l.name];_&&l._map&&(h|=l._map(_)<<l._offset)}return h.toString(16)+"|"+i.hash},t.destroyShaderByDefines=function(e){var t=this,i=Object.keys(e);if(i.length)for(var n=i.map((function(t){var i=e[t];return"boolean"==typeof i&&(i=i?"1":"0"),new RegExp(""+t+i)})),r=Object.keys(this._cache).filter((function(e){return n.every((function(i){return i.test(t._cache[e].name)}))})),s=0;s<r.length;s++){var a=r[s],o=this._cache[a];z("destroyed shader "+o.name),o.destroy(),delete this._cache[a]}},t.getGFXShader=function(e,t,i,n,r){Object.assign(i,n.macros),r||(r=this.getKey(t,i));var s=this._cache[r];if(s)return s;var a=this._templates[t],o=this._templateInfos[a.hash];o.pipelineLayout||(this.getDescriptorSetLayout(e,t),_m(a,o,Md,"globals"),o.setLayouts[Ld.GLOBAL]=n.descriptorSetLayout,o.pipelineLayout=e.createPipelineLayout(new ts(o.setLayouts)));var u=function(e,t){for(var i=[],n=0;n<t.length;n++){var r=t[n],s=r.name,a=e[s],o=lm(r,a),u=!a||"0"===a;i.push({name:s,value:o,isDefault:u})}return i}(i,a.defines),h=n.constantMacros+a.constantMacros+u.reduce((function(e,t){return e+"#define "+t.name+" "+t.value+"\n"}),""),c=a.glsl3,l=mm(e);return l?c=a[l]:console.error("Invalid GFX API!"),o.shaderInfo.stages[0].source=h+c.vert,o.shaderInfo.stages[1].source=h+c.frag,o.shaderInfo.attributes=function(e,t,i){for(var n=[],r=e.attributes,s=t.gfxAttributes,a=0;a<r.length;a++)dm(r[a].defines,i)&&n.push(s[a]);return n}(a,o,i),o.shaderInfo.name=function(e,t){return e+t.reduce((function(e,t){return t.isDefault?e:e+"|"+t.name+t.value}),"")}(t,u),this._cache[r]=e.createShader(o.shaderInfo)},e}();function mm(e){switch(e.gfxAPI){case dn.GLES2:case dn.WEBGL:return"glsl1";case dn.GLES3:case dn.WEBGL2:return"glsl3";default:return"glsl4"}}var gm,vm,ym,Em,Tm,Am,Sm,bm,wm=e("eI",new pm);R.programLib=wm;var Rm=["planar-shadow","skybox","deferred-lighting","bloom","post-process","profiler","splash-screen","standard","unlit","sprite","particle","particle-gpu","particle-trail","billboard","terrain","graphics","clear-stencil","spine","occlusion-query","geometry-renderer","debug-renderer"],Im=e("gk",th("cc.EffectAsset")((bm=Sm=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return T(t=e.call.apply(e,[this].concat(n))||this,"techniques",ym,v(t)),T(t,"shaders",Em,v(t)),T(t,"combinations",Tm,v(t)),T(t,"hideInEditor",Am,v(t)),t}_(t,e),t.register=function(e){t._effects[e.name]=e,t._layoutValid=!1},t.remove=function(e){if("string"!=typeof e)t._effects[e.name]&&t._effects[e.name]===e&&delete t._effects[e.name];else{if(t._effects[e])return void delete t._effects[e];for(var i in t._effects)if(t._effects[i]._uuid===e)return void delete t._effects[i]}},t.get=function(e){if(t._effects[e])return t._effects[e];for(var i in t._effects)if(t._effects[i]._uuid===e)return t._effects[i];return Rm.includes(e)&&Y(16101,e),null},t.getAll=function(){return t._effects},t.isLayoutValid=function(){return t._layoutValid},t.setLayoutValid=function(){t._layoutValid=!0};var i=t.prototype;return i.onLoaded=function(){wm.register(this),t.register(this),R.game.once(R.Game.EVENT_RENDERER_INITED,this._precompile,this)},i._precompile=function(){for(var e=this,t=R.director.root,i=function(i){var n=e.shaders[i],r=e.combinations[i];if(!r)return"continue";Object.keys(r).reduce((function(e,t){return e.reduce((function(e,i){for(var n=r[t],s=0;s<n.length;++s){var a=l({},i);a[t]=n[s],e.push(a)}return e}),[])}),[{}]).forEach((function(e){return wm.getGFXShader(Va.gfxDevice,n.name,e,t.pipeline)}))},n=0;n<this.shaders.length;n++)i(n)},i.destroy=function(){return t.remove(this),e.prototype.destroy.call(this)},i.initDefault=function(i){e.prototype.initDefault.call(this,i);var n=t.get("builtin-unlit");this.name="builtin-unlit",this.shaders=n.shaders,this.combinations=n.combinations,this.techniques=n.techniques},i.validate=function(){return this.techniques.length>0&&this.shaders.length>0},t}(Cc),Sm._effects={},Sm._layoutValid=!0,ym=A((vm=bm).prototype,"techniques",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Em=A(vm.prototype,"shaders",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Tm=A(vm.prototype,"combinations",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Am=A(vm.prototype,"hideInEditor",[hh,lh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),gm=vm))||gm);R.EffectAsset=Im;var Om,Nm,Cm,Mm,xm,Fm,Pm,Dm,Lm,Bm,Um,Gm,zm,km,Hm;!function(e){e[e.RGB565=gn.R5G6B5]="RGB565",e[e.RGB5A1=gn.RGB5A1]="RGB5A1",e[e.RGBA4444=gn.RGBA4]="RGBA4444",e[e.RGB888=gn.RGB8]="RGB888",e[e.RGB32F=gn.RGB32F]="RGB32F",e[e.RGBA8888=gn.RGBA8]="RGBA8888",e[e.RGBA32F=gn.RGBA32F]="RGBA32F",e[e.A8=gn.A8]="A8",e[e.I8=gn.L8]="I8",e[e.AI8=gn.LA8]="AI8",e[e.RGB_PVRTC_2BPPV1=gn.PVRTC_RGB2]="RGB_PVRTC_2BPPV1",e[e.RGBA_PVRTC_2BPPV1=gn.PVRTC_RGBA2]="RGBA_PVRTC_2BPPV1",e[e.RGB_A_PVRTC_2BPPV1=1024]="RGB_A_PVRTC_2BPPV1",e[e.RGB_PVRTC_4BPPV1=gn.PVRTC_RGB4]="RGB_PVRTC_4BPPV1",e[e.RGBA_PVRTC_4BPPV1=gn.PVRTC_RGBA4]="RGBA_PVRTC_4BPPV1",e[e.RGB_A_PVRTC_4BPPV1=1025]="RGB_A_PVRTC_4BPPV1",e[e.RGB_ETC1=gn.ETC_RGB8]="RGB_ETC1",e[e.RGBA_ETC1=1026]="RGBA_ETC1",e[e.RGB_ETC2=gn.ETC2_RGB8]="RGB_ETC2",e[e.RGBA_ETC2=gn.ETC2_RGBA8]="RGBA_ETC2",e[e.RGBA_ASTC_4x4=gn.ASTC_RGBA_4X4]="RGBA_ASTC_4x4",e[e.RGBA_ASTC_5x4=gn.ASTC_RGBA_5X4]="RGBA_ASTC_5x4",e[e.RGBA_ASTC_5x5=gn.ASTC_RGBA_5X5]="RGBA_ASTC_5x5",e[e.RGBA_ASTC_6x5=gn.ASTC_RGBA_6X5]="RGBA_ASTC_6x5",e[e.RGBA_ASTC_6x6=gn.ASTC_RGBA_6X6]="RGBA_ASTC_6x6",e[e.RGBA_ASTC_8x5=gn.ASTC_RGBA_8X5]="RGBA_ASTC_8x5",e[e.RGBA_ASTC_8x6=gn.ASTC_RGBA_8X6]="RGBA_ASTC_8x6",e[e.RGBA_ASTC_8x8=gn.ASTC_RGBA_8X8]="RGBA_ASTC_8x8",e[e.RGBA_ASTC_10x5=gn.ASTC_RGBA_10X5]="RGBA_ASTC_10x5",e[e.RGBA_ASTC_10x6=gn.ASTC_RGBA_10X6]="RGBA_ASTC_10x6",e[e.RGBA_ASTC_10x8=gn.ASTC_RGBA_10X8]="RGBA_ASTC_10x8",e[e.RGBA_ASTC_10x10=gn.ASTC_RGBA_10X10]="RGBA_ASTC_10x10",e[e.RGBA_ASTC_12x10=gn.ASTC_RGBA_12X10]="RGBA_ASTC_12x10",e[e.RGBA_ASTC_12x12=gn.ASTC_RGBA_12X12]="RGBA_ASTC_12x12"}(Om||(Om=e("dz",{}))),function(e){e[e.REPEAT=Mn.WRAP]="REPEAT",e[e.CLAMP_TO_EDGE=Mn.CLAMP]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=Mn.MIRROR]="MIRRORED_REPEAT",e[e.CLAMP_TO_BORDER=Mn.BORDER]="CLAMP_TO_BORDER"}(Nm||(Nm=e("f0",{}))),function(e){e[e.NONE=Cn.NONE]="NONE",e[e.LINEAR=Cn.LINEAR]="LINEAR",e[e.NEAREST=Cn.POINT]="NEAREST"}(Cm||(Cm=e("dB",{}))),gt(gn);var Vm,Wm,jm,Xm,Ym=new Ae("Tex"),qm=e("eq",th("cc.TextureBase")((Hm=km=function(e){function t(){var t;return T(t=e.call(this)||this,"_format",Fm,v(t)),T(t,"_minFilter",Pm,v(t)),T(t,"_magFilter",Dm,v(t)),T(t,"_mipFilter",Lm,v(t)),T(t,"_wrapS",Bm,v(t)),T(t,"_wrapT",Um,v(t)),T(t,"_wrapR",Gm,v(t)),T(t,"_anisotropy",zm,v(t)),t._width=1,t._height=1,t._id=void 0,t._samplerInfo=new Cr,t._gfxSampler=null,t._gfxDevice=null,t._textureHash=0,t._id=Ym.getNewId(),t._gfxDevice=t._getGFXDevice(),t._textureHash=xs(t._id,666),t}_(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=R.director.root)||void 0===t?void 0:t.batcher2D)&&R.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):K(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 Va.gfxDevice},i._getGFXFormat=function(){return this._getGFXPixelFormat(this._format)},i._setGFXFormat=function(e){this._format=void 0===e?Om.RGBA8888:e},i._getGFXPixelFormat=function(e){return e===Om.RGBA_ETC1?e=Om.RGB_ETC1:e===Om.RGB_A_PVRTC_4BPPV1?e=Om.RGB_PVRTC_4BPPV1:e===Om.RGB_A_PVRTC_2BPPV1&&(e=Om.RGB_PVRTC_2BPPV1),e},c(t,[{key:"isCompressed",get:function(){return this._format>=Om.RGB_ETC1&&this._format<=Om.RGBA_ASTC_12x12||this._format>=Om.RGB_A_PVRTC_2BPPV1&&this._format<=Om.RGBA_ETC1}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),t}(Cc),km.PixelFormat=Om,km.WrapMode=Nm,km.Filter=Cm,Fm=A((xm=Hm).prototype,"_format",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Om.RGBA8888}}),Pm=A(xm.prototype,"_minFilter",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Cm.LINEAR}}),Dm=A(xm.prototype,"_magFilter",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Cm.LINEAR}}),Lm=A(xm.prototype,"_mipFilter",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Cm.NONE}}),Bm=A(xm.prototype,"_wrapS",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Nm.REPEAT}}),Um=A(xm.prototype,"_wrapT",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Nm.REPEAT}}),Gm=A(xm.prototype,"_wrapR",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Nm.REPEAT}}),zm=A(xm.prototype,"_anisotropy",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Mm=xm))||Mm);function Km(e){return!!(ka.hasFeature(ka.Feature.IMAGE_BITMAP)&&e instanceof ImageBitmap)}R.TextureBase=qm;var Qm=e("dG",th("cc.ImageAsset")((Xm=jm=function(e){function t(t){var i;return(i=e.call(this)||this)._nativeData=void 0,i._exportedExts=void 0,i._format=Om.RGBA8888,i._width=0,i._height=0,i._nativeData={_data:null,width:0,height:0,format:0,_compressed:!1},void 0!==t&&i.reset(t),i}_(t,e);var i=t.prototype;return i.reset=function(e){Km(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("")):Km(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=Va.gfxDevice,s=i.split("_"),a=Number.MAX_VALUE,o=this._format,u="",h=At.SUPPORT_TEXTURE_FORMATS,c=E(s);!(n=c()).done;){var l=n.value.split("@"),_=parseInt(l[0],void 0),f=t.extnames[_]||l[0],d=h.indexOf(f);if(-1!==d&&d<a){var p=l[1]?parseInt(l[1]):this._format;if(!(".astc"!==f||r&&r.getFormatFeatures(gn.ASTC_RGBA_4X4)&In.SAMPLED_TEXTURE))continue;if(!(".pvr"!==f||r&&r.getFormatFeatures(gn.PVRTC_RGBA4)&In.SAMPLED_TEXTURE))continue;if(!(p!==Om.RGB_ETC1&&p!==Om.RGBA_ETC1||r&&r.getFormatFeatures(gn.ETC_RGB8)&In.SAMPLED_TEXTURE))continue;if(!(p!==Om.RGB_ETC2&&p!==Om.RGBA_ETC2||r&&r.getFormatFeatures(gn.ETC2_RGB8)&In.SAMPLED_TEXTURE))continue;if(".webp"===f&&!ka.hasFeature(ka.Feature.WEBP))continue;a=d,u=f,o=p}}u?(this._setRawAsset(u),this._format=o):Y(3121)},i.initDefault=function(i){if(e.prototype.initDefault.call(this,i),t._sharedPlaceHolderCanvas)this.reset(t._sharedPlaceHolderCanvas);else{var n=document.createElement("canvas"),r=n.getContext("2d"),s=n.width=n.height=2;r.fillStyle="#ff00ff",r.fillRect(0,0,s,s),this.reset(n),t._sharedPlaceHolderCanvas=n}},i.validate=function(){return!!this.data},c(t,[{key:"_nativeAsset",get:function(){return this._nativeData},set:function(e){e instanceof HTMLElement||Km(e)||(e.format=e.format||this._format),this.reset(e)}},{key:"data",get:function(){return this._nativeData&&((e=this._nativeData)instanceof HTMLImageElement||e instanceof HTMLCanvasElement||Km(e))?this._nativeData:this._nativeData&&this._nativeData._data;var e}},{key:"width",get:function(){return this._nativeData.width||this._width}},{key:"height",get:function(){return this._nativeData.height||this._height}},{key:"format",get:function(){return this._format}},{key:"isCompressed",get:function(){return this._format>=Om.RGB_ETC1&&this._format<=Om.RGBA_ASTC_12x12||this._format>=Om.RGB_A_PVRTC_2BPPV1&&this._format<=Om.RGBA_ETC1}},{key:"url",get:function(){return this.nativeUrl}}]),t}(Cc),jm.extnames=[".png",".jpg",".jpeg",".bmp",".webp",".pvr",".pkm",".astc"],jm._sharedPlaceHolderCanvas=null,A((Wm=Xm).prototype,"_nativeAsset",[Lh],Object.getOwnPropertyDescriptor(Wm.prototype,"_nativeAsset"),Wm.prototype),Vm=Wm))||Vm);R.ImageAsset=Qm;var Zm=new WeakMap,Jm=new WeakSet,$m=new WeakSet;function eg(e,t){var i;i=fl.safeFindClass;var n,r=Nl.pool.get();try{n=kl(e,r,{classFinder:i,customEnv:t})}catch(e){throw U(e),Nl.pool.put(r),e}n._uuid=t.__uuid__||"";for(var s=r.uuidList,a=r.uuidObjList,o=r.uuidPropList,u=r.uuidTypeList||[],h=[],c=0;c<s.length;c++){var l=s[c];h[c]={uuid:ic(l),owner:a[c],prop:o[c],type:_t.getClassById(u[c])}}return Zm.set(n,h),n._native&&Jm.add(n),Nl.pool.put(r),n}var tg,ig=function(){function e(){this._depends=new Gh}var t=e.prototype;return t.init=function(){this._depends.clear()},t.getNativeDep=function(e){var t=this._depends.get(e);return t&&t.nativeDep?l({},t.nativeDep):null},t.getDeps=function(e){return this._depends.has(e)?this._depends.get(e).deps:[]},t.getDepsRecursively=function(e){var t=Object.create(null),i=[];return this._descend(e,t,i),i},t.remove=function(e){this._depends.remove(e)},t.parse=function(e,t){var i,n,r=null;if(Array.isArray(t)||t.__type__||t instanceof gl){if(this._depends.has(e))return this._depends.get(e);if(!Array.isArray(t)||"number"==typeof(n=(i=t[5])[i.length-1])&&n<0)try{var s=eg(t,{__uuid__:e});(r=this._parseDepsFromAsset(s)).nativeDep&&(r.nativeDep.uuid=e),Wh.add(e+"@import",s)}catch(t){Vh.remove(e+"@import"),r={deps:[]}}else r={deps:this._parseDepsFromJson(t)}}else{if(this._depends.has(e)&&(r=this._depends.get(e)).parsedFromExistAsset)return r;r=this._parseDepsFromAsset(t)}return this._depends.add(e,r),r},t._parseDepsFromAsset=function(e){for(var t={deps:[],parsedFromExistAsset:!0},i=Zm.get(e),n=0,r=i.length;n<r;n++)t.deps.push(i[n].uuid);return Jm.has(e)&&(t.nativeDep=e._nativeDep),t},t._parseDepsFromJson=function(e){var t=function(e){return i=(t=e)[1],t[10].map((function(e){return i[e]}));var t,i}(e);return t.forEach((function(e,i){return t[i]=ic(e)})),t},t._descend=function(e,t,i){for(var n=this.getDeps(e),r=0;r<n.length;r++){var s=n[r];t[s]||(t[s]=!0,i.push(s),this._descend(s,t,i))}},e}(),ng=e("d8",new ig),rg=[new gr];function sg(e){return e&&0==(e&e-1)}var ag,og,ug,hg,cg,lg,_g=th("cc.SimpleTexture")(tg=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._gfxTexture=null,t._gfxTextureView=null,t._mipmapLevel=1,t._textureWidth=0,t._textureHeight=0,t._baseLevel=0,t._maxLevel=1e3,t}_(t,e);var i=t.prototype;return i.getGFXTexture=function(){return this._gfxTextureView},i.destroy=function(){return this._tryDestroyTextureView(),this._tryDestroyTexture(),e.prototype.destroy.call(this)},i.updateImage=function(){this.updateMipmaps(0)},i.updateMipmaps=function(){},i.uploadData=function(e,t,i){if(void 0===t&&(t=0),void 0===i&&(i=0),this._gfxTexture&&!(this._mipmapLevel<=t)){var n=this._getGFXDevice();if(n){var r=rg[0];r.texExtent.width=this._textureWidth>>t,r.texExtent.height=this._textureHeight>>t,r.texSubres.mipLevel=t,r.texSubres.baseArrayLayer=i,ArrayBuffer.isView(e)?n.copyBuffersToTexture([e],this._gfxTexture,rg):n.copyTexImagesToTexture([e],this._gfxTexture,rg)}}},i._assignImage=function(e,t,i){var n=e.data;if(n&&(this.uploadData(n,t,i),this._checkTextureLoaded(),At.CLEANUP_IMAGE_CACHE)){var r=ng.getDeps(this._uuid),s=r.indexOf(e._uuid);-1!==s&&(ge(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){J(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=Rn.NONE;this._mipFilter!==Cm.NONE&&function(e,t,i){return!(e.gfxAPI===dn.WEBGL)||sg(t)&&sg(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()||(t=Rn.GEN_MIPMAP));var i=this._getGfxTextureCreateInfo({usage:wn.SAMPLED|wn.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._maxLevel<this._mipmapLevel?this._maxLevel:this._mipmapLevel-1,i=this._getGfxTextureViewCreateInfo({texture:this._gfxTexture,format:this._getGFXFormat(),baseLevel:this._baseLevel,levelCount:t-this._baseLevel+1});return i?e.createTexture(i):null},i._tryDestroyTexture=function(){this._gfxTexture&&(this._gfxTexture.destroy(),this._gfxTexture=null)},i._tryDestroyTextureView=function(){this._gfxTextureView&&(this._gfxTextureView.destroy(),this._gfxTextureView=null)},c(t,[{key:"mipmapLevel",get:function(){return this._mipmapLevel}}]),t}(qm))||tg;R.SimpleTexture=_g;var fg,dg,pg,mg,gg,vg,yg,Eg,Tg,Ag,Sg=e("dA",(ag=th("cc.Texture2D"),og=Dh([Qm]),ag((lg=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return T(t=e.call.apply(e,[this].concat(n))||this,"_mipmaps",cg,v(t)),t}_(t,e);var i=t.prototype;return 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=Om.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;++n){var r=e+n;this._assignImage(this._mipmaps[r],r)}},i.getHtmlElementObj=function(){return this._mipmaps[0]&&this._mipmaps[0].data instanceof HTMLElement?this._mipmaps[0].data:null},i.destroy=function(){return this._mipmaps=[],e.prototype.destroy.call(this)},i.description=function(){return"<cc.Texture2D | Name = "+(this._mipmaps[0]?this._mipmaps[0].url:"")+" | Dimension = "+this.width+" x "+this.height+">"},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;r<n.mipmaps.length;++r)if(this._mipmaps[r]=new Qm,n.mipmaps[r]){var s=n.mipmaps[r];i.result.push(this._mipmaps,""+r,s,_t.getClassId(Qm))}},i._getGfxTextureCreateInfo=function(e){var t=new Or(bn.TEX2D);return t.width=this._width,t.height=this._height,Object.assign(t,e),t},i._getGfxTextureViewCreateInfo=function(e){var t=new Nr;return t.type=bn.TEX2D,Object.assign(t,e),t},i.initDefault=function(t){e.prototype.initDefault.call(this,t);var i=new Qm;i.initDefault(),this.image=i},i.validate=function(){return this.mipmaps&&0!==this.mipmaps.length},c(t,[{key:"mipmaps",get:function(){return this._mipmaps},set:function(e){var t=this;if(this._mipmaps=e,this._setMipmapLevel(this._mipmaps.length),this._mipmaps.length>0){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})}},{key:"image",get:function(){return 0===this._mipmaps.length?null:this._mipmaps[0]},set:function(e){this.mipmaps=e?[e]:[]}}]),t}(_g),cg=A((hg=lg).prototype,"_mipmaps",[og],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),ug=hg))||ug));R.Texture2D=Sg,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"}(Tg||(Tg={})),function(e){e[e.NONE=0]="NONE",e[e.AUTO=1]="AUTO",e[e.BAKED_CONVOLUTION_MAP=2]="BAKED_CONVOLUTION_MAP"}(Ag||(Ag={}));var bg=e("h4",th("cc.TextureCube")((Eg=yg=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return T(t=e.call.apply(e,[this].concat(n))||this,"isRGBE",pg,v(t)),T(t,"_mipmapAtlas",mg,v(t)),T(t,"_mipmapMode",gg,v(t)),T(t,"_mipmaps",vg,v(t)),t}_(t,e);var i=t.prototype;return i.isUsingOfflineMipmaps=function(){return this._mipmapMode===Ag.BAKED_CONVOLUTION_MAP},t.fromTexture2DArray=function(e,i){for(var n=[],r=e.length/6,s=0;s<r;s++){var a=6*s;n.push({front:e[a+Tg.front].image,back:e[a+Tg.back].image,left:e[a+Tg.left].image,right:e[a+Tg.right].image,top:e[a+Tg.top].image,bottom:e[a+Tg.bottom].image})}return(i=i||new t).mipmaps=n,i},i.onLoaded=function(){this._mipmapMode===Ag.BAKED_CONVOLUTION_MAP?this.mipmapAtlas=this._mipmapAtlas:this.mipmaps=this._mipmaps},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.updateMipmaps=function(e,t){var i=this;if(void 0===e&&(e=0),!(e>=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;wg(i._mipmaps[n],(function(e,t){i._assignImage(e,n,t)}))},s=0;s<n;++s)r(s)},i.destroy=function(){return this._mipmaps=[],this._mipmapAtlas=null,e.prototype.destroy.call(this)},i.releaseTexture=function(){this.mipmaps=[],this._mipmapAtlas=null},i._serialize=function(){return null},i._deserialize=function(t,i){var n=t;if(e.prototype._deserialize.call(this,n.base,i),this.isRGBE=n.rgbe,this._mipmapMode=n.mipmapMode,this._mipmapMode===Ag.BAKED_CONVOLUTION_MAP){var r=n.mipmapAtlas,s=n.mipmapLayout;this._mipmapAtlas={atlas:{},layout:s},this._mipmapAtlas.atlas={front:new Qm,back:new Qm,left:new Qm,right:new Qm,top:new Qm,bottom:new Qm};var a=_t.getClassId(Qm);i.result.push(this._mipmapAtlas.atlas,"front",r.front,a),i.result.push(this._mipmapAtlas.atlas,"back",r.back,a),i.result.push(this._mipmapAtlas.atlas,"left",r.left,a),i.result.push(this._mipmapAtlas.atlas,"right",r.right,a),i.result.push(this._mipmapAtlas.atlas,"top",r.top,a),i.result.push(this._mipmapAtlas.atlas,"bottom",r.bottom,a)}else{this._mipmaps=new Array(n.mipmaps.length);for(var o=0;o<n.mipmaps.length;++o){this._mipmaps[o]={front:new Qm,back:new Qm,left:new Qm,right:new Qm,top:new Qm,bottom:new Qm};var u=n.mipmaps[o],h=_t.getClassId(Qm);i.result.push(this._mipmaps[o],"front",u.front,h),i.result.push(this._mipmaps[o],"back",u.back,h),i.result.push(this._mipmaps[o],"left",u.left,h),i.result.push(this._mipmaps[o],"right",u.right,h),i.result.push(this._mipmaps[o],"top",u.top,h),i.result.push(this._mipmaps[o],"bottom",u.bottom,h)}}},i._getGfxTextureCreateInfo=function(e){var t=new Or(bn.CUBE);return t.width=this._width,t.height=this._height,t.layerCount=6,Object.assign(t,e),t},i._getGfxTextureViewCreateInfo=function(e){var t=new Nr;return t.type=bn.CUBE,t.baseLayer=0,t.layerCount=6,Object.assign(t,e),t},i.initDefault=function(t){e.prototype.initDefault.call(this,t);var i=new Qm;i.initDefault(),this.mipmaps=[{front:i,back:i,top:i,bottom:i,left:i,right:i}]},i.validate=function(){if(this._mipmapMode===Ag.BAKED_CONVOLUTION_MAP){if(null===this.mipmapAtlas||0===this.mipmapAtlas.layout.length)return!1;var e=this.mipmapAtlas.atlas;return!!(e.top&&e.bottom&&e.front&&e.back&&e.left&&e.right)}return 0!==this._mipmaps.length&&!this._mipmaps.find((function(e){return!(e.top&&e.bottom&&e.front&&e.back&&e.left&&e.right)}))},c(t,[{key:"mipmaps",get:function(){return this._mipmaps},set:function(e){var t=this;if(this._mipmaps=e,this._setMipmapLevel(this._mipmaps.length),this._mipmaps.length>0){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){wg(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(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];wg(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 Qm({_data:o.data,_compressed:e.isCompressed,width:o.width,height:o.height,format:e.format});t._assignImage(u,s.level,n)}))},u=0;u<r.length;u++)o(u)}}else this.reset({width:0,height:0,mipmapLevel:0})}},{key:"image",get:function(){return 0===this._mipmaps.length?null:this._mipmaps[0]},set:function(e){this.mipmaps=e?[e]:[]}}]),t}(_g),yg.FaceIndex=Tg,pg=A((dg=Eg).prototype,"isRGBE",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),mg=A(dg.prototype,"_mipmapAtlas",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),gg=A(dg.prototype,"_mipmapMode",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Ag.NONE}}),vg=A(dg.prototype,"_mipmaps",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),fg=dg))||fg);function wg(e,t){t(e.front,Tg.front),t(e.back,Tg.back),t(e.left,Tg.left),t(e.right,Tg.right),t(e.top,Tg.top),t(e.bottom,Tg.bottom)}R.TextureCube=bg;var Rg=function(){function e(){this.name="",this.base="",this.importBase="",this.nativeBase="",this.deps=null,this.assetInfos=new Gh,this.scenes=new Gh,this.paths=new Gh}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;a<o;a++)t[a]=ic(t[a]);for(var u in i){var h=i[u],c=h[1];h[1]=n[c]}}else{for(var l=Object.create(null),_=0,f=t.length;_<f;_++){var d=t[_];t[_]=l[d]=ic(d)}t=l}for(var p in i){var m=i[p];s[t[p]]=m}var g=e.scenes;for(var v in g){var y=g[v];g[v]=t[y]}var E=e.packs;for(var T in E)for(var A=E[T],S=0;S<A.length;++S)A[S]=t[A[S]];var b=e.versions;if(b)for(var w in b)for(var R=b[w],I=0;I<R.length;I+=2){var O=R[I];R[I]=t[O]||O}var N=e.redirect;if(N)for(var C=0;C<N.length;C+=2)N[C]=t[N[C]],N[C+1]=r[N[C+1]];if(e.extensionMap){var M=function(i){if(!Object.prototype.hasOwnProperty.call(e.extensionMap,i))return"continue";e.extensionMap[i].forEach((function(n,r){e.extensionMap[i][r]=t[n]||n}))};for(var x in e.extensionMap)M(x)}}(e),this.importBase=e.importBase||"",this.nativeBase=e.nativeBase||"",this.base=e.base||"",this.name=e.name||"",this.deps=e.deps||[],this._initUuid(e.uuids),this._initPath(e.paths),this._initScene(e.scenes),this._initPackage(e.packs),this._initVersion(e.versions),this._initRedirect(e.redirect);var i=function(i){if(!Object.prototype.hasOwnProperty.call(e.extensionMap,i))return"continue";e.extensionMap[i].forEach((function(e){var n=t.assetInfos.get(e);n&&(n.extension=i)}))};for(var n in e.extensionMap)i(n)},t.getInfoWithPath=function(e,t){if(!e)return null;e=oc(e);var i=this.paths.get(e);if(i){if(!t)return i[0];for(var n=0,r=i.length;n<r;n++){var s=i[n];if(_t.isChildClassOf(s.ctor,t))return s}}return null},t.getDirWithPath=function(e,t,i){"/"===(e=oc(e))[e.length-1]&&(e=e.slice(0,-1));var n=i||[];return this.paths.forEach((function(i,r){if(r.startsWith(e)&&function(e,t){return!(e.length>t.length)||47===e.charCodeAt(t.length)}(r,e)||!e)for(var s=0,a=i.length;s<a;s++){var o=i[s];t&&!_t.isChildClassOf(o.ctor,t)||n.push(o)}})),n},t.getAssetInfo=function(e){return this.assetInfos.get(e)||null},t.getSceneInfo=function(e){return e.endsWith(".scene")||(e+=".scene"),"/"===e[0]||e.startsWith("db://")||(e="/"+e),this.scenes.find((function(t,i){return i.endsWith(e)}))},t.destroy=function(){this.paths.destroy(),this.scenes.destroy(),this.assetInfos.destroy()},t._initUuid=function(e){if(e){this.assetInfos.clear();for(var t=0,i=e.length;t<i;t++){var n=e[t];this.assetInfos.add(n,{uuid:n})}}},t._initPath=function(e){if(e){var t=this.paths;for(var i in t.clear(),e){var n=e[i],r=n[0],s=n[1],a=3===n.length,o=this.assetInfos.get(i);o.path=r,o.ctor=_t.getClassById(s),t.has(r)?a?t.get(r).push(o):t.get(r).unshift(o):t.add(r,[o])}}},t._initScene=function(e){if(e){var t=this.scenes;t.clear();var i=this.assetInfos;for(var n in e){var r=e[n],s=i.get(r);s.url=n,t.add(n,s)}}},t._initPackage=function(e){if(e){var t=this.assetInfos;for(var i in e){var n=e[i],r={uuid:i,packedUuids:n,ext:".json"};t.add(i,r);for(var s=0,a=n.length;s<a;s++){var o=n[s],u=t.get(o),h=u.packs;h?1===a?h.unshift(r):h.push(r):u.packs=[r]}}}},t._initVersion=function(e){if(e){var t=this.assetInfos,i=e.import;if(i)for(var n=0,r=i.length;n<r;n+=2){var s=i[n];t.get(s).ver=i[n+1]}if(i=e.native)for(var a=0,o=i.length;a<o;a+=2){var u=i[a];t.get(u).nativeVer=i[a+1]}}},t._initRedirect=function(e){if(e)for(var t=this.assetInfos,i=0,n=e.length;i<n;i+=2){var r=e[i];t.get(r).redirect=e[i+1]}},e}();function Ig(e,t){e._uuid&&t.push(e._uuid)}function Og(e,t){for(var i=Object.getOwnPropertyNames(e),n=0;n<i.length;n++){var r=i[n];if("node"!==r&&"__eventTargets"!==r){var s=e[r];if("object"==typeof s&&s)if(Array.isArray(s))for(var a=0;a<s.length;a++){var o=s[a];o instanceof Cc&&Ig(o,t)}else if(s.constructor&&s.constructor!==Object)s instanceof Cc&&Ig(s,t);else for(var u=Object.getOwnPropertyNames(s),h=0;h<u.length;h++){var c=s[u[h]];c instanceof Cc&&Ig(c,t)}}}}function Ng(e,t){for(var i=0;i<e._components.length;i++)Og(e._components[i],t);for(var n=0;n<e._children.length;n++)Ng(e._children[n],t)}function Cg(e,t,i,n){i.push(e._uuid);for(var r=ng.getDeps(e._uuid),s=0,a=r.length;s<a;s++){var o=Hh.get(r[s]);if(o){var u=o._uuid;u in t?t[u]+=n:t[u]=o.refCount+n,i.includes(u)||Cg(o,t,i,n)}}}var Mg=[],xg=function(){function e(){this._persistNodeDeps=new Gh,this._toDelete=new Gh,this._eventListener=!1,this._dontDestroyAssets=[]}var t=e.prototype;return t.addIgnoredAsset=function(e){this._dontDestroyAssets.push(e._uuid)},t.init=function(){this._persistNodeDeps.clear(),this._toDelete.clear()},t._addPersistNodeRef=function(e){var t=[];Ng(e,t);for(var i=0,n=t.length;i<n;i++){var r=Hh.get(t[i]);r&&r.addRef()}this._persistNodeDeps.add(e.uuid,t)},t._removePersistNodeRef=function(e){if(this._persistNodeDeps.has(e.uuid)){for(var t=this._persistNodeDeps.get(e.uuid),i=0,n=t.length;i<n;i++){var r=Hh.get(t[i]);r&&r.decRef()}this._persistNodeDeps.remove(e.uuid)}},t._autoRelease=function(e,t,i){if(e){for(var n=ng.getDeps(e.uuid),r=0,s=n.length;r<s;r++){var a=Hh.get(n[r]);a&&a.decRef(e.autoReleaseAssets)}var o=ng._depends.get(e.uuid);if(o&&o.persistDeps)for(var u=o.persistDeps,h=0,c=u.length;h<c;h++){var l=Hh.get(u[h]);l&&l.decRef(e.autoReleaseAssets)}e.uuid!==t.uuid&&ng.remove(e.uuid)}var _=ng._depends.get(t.uuid);for(var f in _&&(_.persistDeps=[]),i){for(var d,p,m=i[f],g=this._persistNodeDeps.get(m.uuid),v=E(g);!(p=v()).done;){var y=p.value,T=Hh.get(y);T&&T.addRef()}_&&(d=_.persistDeps).push.apply(d,g)}},t.tryRelease=function(e,t){void 0===t&&(t=!1),e instanceof Cc&&(t?this._free(e,t):(this._toDelete.add(e._uuid,e),this._eventListener||(this._eventListener=!0,xt(this._freeAssets.bind(this)))))},t._freeAssets=function(){var e=this;this._eventListener=!1,this._toDelete.forEach((function(t){e._free(t)})),this._toDelete.clear()},t._free=function(e,t){void 0===t&&(t=!1);var i=e._uuid;if(this._toDelete.remove(i),fa(e,!0)&&-1===this._dontDestroyAssets.indexOf(i)&&!(!t&&e.refCount>0&&function(e){var t=Object.create(null);if(t[e._uuid]=e.refCount,Cg(e,t,Mg,-1),Mg.length=0,0!==t[e._uuid])return t[e._uuid];for(var i in t)0!==t[i]&&Cg(Hh.get(i),t,Mg,1);return Mg.length=0,t[e._uuid]}(e)>0)){Hh.remove(i);for(var n=ng.getDeps(i),r=0,s=n.length;r<s;r++){var a=Hh.get(n[r]);a&&(a.decRef(!1),this._free(a,!1))}e.destroy(),ng.remove(i)}},e}(),Fg=e("dj",new xg),Pg=null;function Dg(e,t){for(var i=0,n=e.input.length;i<n;i++){var r=e.input[i];t&&!r.isNative&&r.content instanceof Cc&&r.content.decRef(!1),r.recycle()}e.input=null}function Lg(e,t){return t?/\?/.test(e)?e+"&_t="+Date.now():e+"?_t="+Date.now():e}function Bg(e,t,i,n,r){void 0===r&&(r=0),e(r,(function(s,a){r++,!s||r>t?n&&n(s,a):setTimeout((function(){Bg(e,t,i,n,r)}),i)}))}function Ug(e,t,i,n,r){try{for(var s=ng.parse(e,t),a=0,o=s.deps.length;a<o;a++){var u=s.deps[a];u in i||(i[u]=!0,n.push({uuid:u,bundle:r&&r.name}))}s.nativeDep&&(r&&(s.nativeDep.bundle=r.name),n.push(l({},s.nativeDep)))}catch(e){U(e.message,e.stack)}}function Gg(e,t,i){t&&(i=void 0!==i?i:R.assetManager.cacheAsset,ac(t)||!i||t.isDefault||Hh.add(e,t))}function zg(e,t,i){var n=0,r=[],s=e.length;0===s&&i&&i(r);for(var a=function(e){e&&r.push(e),++n===s&&i&&i(r)},o=0;o<s;o++)t(e[o],a)}function kg(e,t,i){var n=e,r=t,s=i;if(void 0===i){var a="function"==typeof e;t?(s=t,a||(r=null)):void 0===t&&a&&(s=e,n=null,r=null),void 0!==t&&a&&(r=e,n=null)}return{options:n||Object.create(null),onProgress:r,onComplete:s}}function Hg(e,t,i){var n=e,r=t,s=i;if(void 0===i){var a=_t.isChildClassOf(e,Cc);t?(s=t,a&&(r=null)):void 0!==t||a||(s=e,r=null,n=null),void 0===t||a||(r=e,n=null)}return{type:n,onProgress:r||Pg,onComplete:s}}function Vg(e,t,i,n){if(void 0===n&&(n={}),!i[t]||n[t])return!1;n[t]=!0;var r=!1,s=ng.getDeps(t);if(s)for(var a=0,o=s.length;a<o;a++){var u=s[a];if(u===e||Vg(e,u,i,n)){r=!0;break}}return r}function Wg(e){return function(t,i){if(e){var n=[];Array.isArray(i)?i.forEach((function(e){return e instanceof Cc&&n.push(e.addRef())})):i instanceof Cc&&n.push(i.addRef()),xt((function(){n.forEach((function(e){return e.decRef(!1)})),e(t,i)}))}}}var jg=function(){function e(){this._config=new Rg}var t=e.prototype;return t.getInfoWithPath=function(e,t){return this._config.getInfoWithPath(e,t)},t.getDirWithPath=function(e,t,i){return this._config.getDirWithPath(e,t,i)},t.getAssetInfo=function(e){return this._config.getAssetInfo(e)},t.getSceneInfo=function(e){return this._config.getSceneInfo(e)},t.init=function(e){this._config.init(e),jh.add(e.name,this)},t.load=function(e,t,i,n){var r=Hg(t,i,n),s=r.type,a=r.onProgress,o=r.onComplete,u={__requestType__:kh.PATH,type:s,bundle:this.name,__outputAsArray__:Array.isArray(e)};R.assetManager.loadAny(e,u,a,o)},t.preload=function(e,t,i,n){var r=Hg(t,i,n),s=r.type,a=r.onProgress,o=r.onComplete;R.assetManager.preloadAny(e,{__requestType__:kh.PATH,type:s,bundle:this.name},a,o)},t.loadDir=function(e,t,i,n){var r=Hg(t,i,n),s=r.type,a=r.onProgress,o=r.onComplete;R.assetManager.loadAny(e,{__requestType__:kh.DIR,type:s,bundle:this.name,__outputAsArray__:!0},a,o)},t.preloadDir=function(e,t,i,n){var r=Hg(t,i,n),s=r.type,a=r.onProgress,o=r.onComplete;R.assetManager.preloadAny(e,{__requestType__:kh.DIR,type:s,bundle:this.name},a,o)},t.loadScene=function(e,t,i,n){var r=kg(t,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"scene",s.bundle=this.name,R.assetManager.loadAny({scene:e},s,a,(function(e,t){if(e)U(e.message,e.stack);else if(t.scene){var i=t.scene;i._id=t._uuid,i.name=t.name}else e=new Error("The asset "+t._uuid+" is not a scene");o&&o(e,t)}))},t.preloadScene=function(e,t,i,n){var r=kg(t,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.bundle=this.name,R.assetManager.preloadAny({scene:e},s,a,(function(t){t&&K(1210,e,t.message),o&&o(t)}))},t.get=function(e,t){var i=this.getInfoWithPath(e,t);return i&&Hh.get(i.uuid)||null},t.release=function(e,t){var i=this.get(e,t);i&&Fg.tryRelease(i,!0)},t.releaseUnusedAssets=function(){var e=this;Hh.forEach((function(t){var i=e.getAssetInfo(t._uuid);i&&!i.redirect&&Fg.tryRelease(t)}))},t.releaseAll=function(){var e=this;Hh.forEach((function(t){var i=e.getAssetInfo(t._uuid);i&&!i.redirect&&Fg.tryRelease(t,!0)}))},t._destroy=function(){this._config.destroy()},c(e,[{key:"config",get:function(){return this._config}},{key:"name",get:function(){return this._config.name}},{key:"deps",get:function(){return this._config.deps}},{key:"base",get:function(){return this._config.base}}]),e}(),Xg=e("d6",new jg);function Yg(e,t,i){var n=new Image;function r(){n.removeEventListener("load",r),n.removeEventListener("error",s),i&&i(null,n)}function s(){n.removeEventListener("load",r),n.removeEventListener("error",s),i&&i(new Error($(4930,e)))}return"file:"!==window.location.protocol&&(n.crossOrigin="anonymous"),n.addEventListener("load",r),n.addEventListener("error",s),n.src=e,n}function qg(e,t,i,n){var r=new XMLHttpRequest,s="download failed: "+e+", status: ";if(r.open("GET",e,!0),void 0!==t.xhrResponseType&&(r.responseType=t.xhrResponseType),void 0!==t.xhrWithCredentials&&(r.withCredentials=t.xhrWithCredentials),void 0!==t.xhrMimeType&&r.overrideMimeType&&r.overrideMimeType(t.xhrMimeType),void 0!==t.xhrTimeout&&(r.timeout=t.xhrTimeout),t.xhrHeader)for(var a in t.xhrHeader)r.setRequestHeader(a,t.xhrHeader[a]);return r.onload=function(){200===r.status||0===r.status?n&&n(null,r.response):n&&n(new Error(""+s+r.status+"(no response)"))},i&&(r.onprogress=function(e){e.lengthComputable&&i(e.loaded,e.total)}),r.onerror=function(){n&&n(new Error(""+s+r.status+"(error)"))},r.ontimeout=function(){n&&n(new Error(""+s+r.status+"(time out)"))},r.onabort=function(){n&&n(new Error(""+s+r.status+"(abort)"))},r.send(null),r}R.resources=Xg;var Kg={};function Qg(e,t,i){if(Kg[e])return i&&i(null),null;var n=document.createElement("script");function r(){n.parentNode.removeChild(n),n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1),Kg[e]=!0,i&&i(null)}function s(){n.parentNode.removeChild(n),n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1),i&&i(new Error($(4928,e)))}return"file:"!==window.location.protocol&&(n.crossOrigin="anonymous"),n.async=t.scriptAsyncLoading||!1,n.src=e,n.addEventListener("load",r,!1),n.addEventListener("error",s,!1),document.body.appendChild(n),n}var Zg,Jg,$g,ev,tv,iv,nv,rv,sv=/^(?:\w+:\/\/|\.+\/).+/,av=function(e,t,i){(ka.hasFeature(ka.Feature.IMAGE_BITMAP)&&R.assetManager.allowImageBitmap?ov:Yg)(e,t,i)},ov=function(e,t,i){t.xhrResponseType="blob",qg(e,t,t.onFileProgress,i)},uv=function(e,t,i){t.xhrResponseType="json",qg(e,t,t.onFileProgress,i)},hv=function(e,t,i){t.xhrResponseType="arraybuffer",qg(e,t,t.onFileProgress,i)},cv=function(e,t,i){uv(e,t,(function(t,n){if(t)i(t);else{var r=vl(n);Promise.all(r.chunks.map((function(i){return new Promise((function(n,r){hv(""+yc(e)+i,{},(function(e,i){t?r(t):n(new Uint8Array(i))}))}))}))).then((function(e){var t=new gl(r.document,e);i(null,t)})).catch((function(e){i(e)}))}}))},lv=function(e,t,i){hv(e,t,(function(e,t){if(e)i(e);else try{var n=yl(new Uint8Array(t));i(null,n)}catch(e){i(e)}}))},_v=function(e,t,i){t.xhrResponseType="text",qg(e,t,t.onFileProgress,i)},fv=function(e,t,i){var n=Ec(e),r=e;sv.test(r)||(r=-1!==pv.remoteBundles.indexOf(n)?pv.remoteServerAddress+"remote/"+n:"assets/"+n);var s=t.version||pv.bundleVers[n],a=0,o=null,u=null;uv(r+"/config."+(s?s+".":"")+"json",t,(function(e,t){u=e,(o=t)&&(o.base=r+"/"),2==++a&&i(u,o)})),Qg(r+"/index."+(s?s+".":"")+"js",t,(function(e){u=e,2==++a&&i(e,o)}))},dv=function(){function e(){this.maxConcurrency=6,this.maxRequestsPerFrame=6,this.maxRetryCount=3,this.appendTimeStamp=!!b,this.limited=!b,this.retryInterval=2e3,this.bundleVers=null,this.remoteBundles=[],this.downloadDomImage=Yg,this.downloadDomAudio=null,this.downloadFile=qg,this.downloadScript=Qg,this._downloaders={".png":av,".jpg":av,".bmp":av,".jpeg":av,".gif":av,".ico":av,".tiff":av,".webp":av,".image":av,".pvr":hv,".pkm":hv,".astc":hv,".txt":_v,".xml":_v,".vsh":_v,".fsh":_v,".atlas":_v,".tmx":_v,".tsx":_v,".json":uv,".ExportJson":uv,".plist":_v,".ccon":cv,".cconb":lv,".fnt":_v,".binary":hv,".bin":hv,".dbbin":hv,".skel":hv,".js":Qg,bundle:fv,default:_v},this._downloading=new Gh,this._queue=[],this._queueDirty=!1,this._totalNum=0,this._totalNumThisPeriod=0,this._lastDate=-1,this._checkNextPeriod=!1,this._remoteServerAddress="",this._maxInterval=1/30}var t=e.prototype;return t.init=function(e,t,i){void 0===e&&(e=""),void 0===t&&(t={}),void 0===i&&(i=[]),this._downloading.clear(),this._queue.length=0,this._remoteServerAddress=e,this.bundleVers=t,this.remoteBundles=i},t.register=function(e,t){"object"==typeof e?_t.mixin(this._downloaders,e):this._downloaders[e]=t},t.download=function(e,t,i,n,r){var s=this,a=Vh.get(e);if(a)r(null,a);else{var o=this._downloading.get(e);if(o){o.push(r);var u=this._queue.find((function(t){return t.id===e}));if(!u)return;var h=n.priority||0;u.priority<h&&(u.priority=h,this._queueDirty=!0)}else{var c=void 0!==n.maxRetryCount?n.maxRetryCount:this.maxRetryCount,l=void 0!==n.maxConcurrency?n.maxConcurrency:this.maxConcurrency,_=void 0!==n.maxRequestsPerFrame?n.maxRequestsPerFrame:this.maxRequestsPerFrame,f=this._downloaders[i]||this._downloaders.default;Bg((function(i,a){if(0===i&&s._downloading.add(e,[r]),s.limited){s._updateTime();var o=function(e,t){s._totalNum--,s._handleQueueInNextFrame(l,_),a(e,t)};s._totalNum<l&&s._totalNumThisPeriod<_?(f(Lg(t,s.appendTimeStamp),n,o),s._totalNum++,s._totalNumThisPeriod++):(s._queue.push({id:e,priority:n.priority||0,url:t,options:n,done:o,handler:f}),s._queueDirty=!0,s._totalNum<l&&s._handleQueueInNextFrame(l,_))}else f(Lg(t,s.appendTimeStamp),n,a)}),c,this.retryInterval,(function(t,i){t||Vh.add(e,i);for(var n=s._downloading.remove(e),r=0,a=n.length;r<a;r++)n[r](t,i)}))}}},t.loadSubpackage=function(e,t){R.assetManager.loadBundle(e,null,t)},t._updateTime=function(){var e=performance.now(),t=R.game.deltaTime,i=t>this._maxInterval?this._maxInterval:t;e-this._lastDate>1e3*i&&(this._totalNumThisPeriod=0,this._lastDate=e)},t._handleQueue=function(e,t){for(this._checkNextPeriod=!1,this._updateTime();this._queue.length>0&&this._totalNum<e&&this._totalNumThisPeriod<t;){this._queueDirty&&(this._queue.sort((function(e,t){return e.priority-t.priority})),this._queueDirty=!1);var i=this._queue.pop();if(!i)break;this._totalNum++,this._totalNumThisPeriod++,i.handler(Lg(i.url,this.appendTimeStamp),i.options,i.done)}this._handleQueueInNextFrame(e,t)},t._handleQueueInNextFrame=function(e,t){!this._checkNextPeriod&&this._queue.length>0&&(xt(this._handleQueue.bind(this),e,t),this._checkNextPeriod=!0)},c(e,[{key:"remoteServerAddress",get:function(){return this._remoteServerAddress}}]),e}(),pv=e("d9",new dv),mv=e("h3",th("cc.JsonAsset")((ev=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return T(t=e.call.apply(e,[this].concat(n))||this,"json",$g,v(t)),t}return _(t,e),t}(Cc),$g=A((Jg=ev).prototype,"json",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Zg=Jg))||Zg);R.JsonAsset=mv;var gv,vv,yv=e("go",th("cc.TextAsset")((rv=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return T(t=e.call.apply(e,[this].concat(n))||this,"text",nv,v(t)),t}return _(t,e),t.prototype.toString=function(){return this.text},t}(Cc),nv=A((iv=rv).prototype,"text",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),tv=iv))||tv);R.TextAsset=yv;var Ev=e("h0",th("cc.BufferAsset")((A((vv=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._buffer=null,t}_(t,e);var i=t.prototype;return i.buffer=function(){return this._buffer,this._buffer},i.validate=function(){return!!this.buffer},c(t,[{key:"_nativeAsset",get:function(){return this._buffer},set:function(e){e instanceof ArrayBuffer?this._buffer=e:this._buffer=e.buffer}}]),t}(Cc)).prototype,"_nativeAsset",[Lh],Object.getOwnPropertyDescriptor(vv.prototype,"_nativeAsset"),vv.prototype),gv=vv))||gv);function Tv(e,t,i,n){var r=null,s=null;try{(r=new Qm)._nativeUrl=e,r._nativeAsset=t}catch(e){s=e}n(s,r)}function Av(e,t,i,n){var r=new mv;r.json=t,n(null,r)}function Sv(e,t,i,n){var r=new yv;r.text=t,n(null,r)}function bv(e,t,i,n){var r=new Ev;r._nativeUrl=e,r._nativeAsset=t,n(null,r)}function wv(e,t,i,n){var r=new Cc;r._nativeUrl=e,r._nativeAsset=t,n(null,r)}function Rv(e,i,n,r){var s=jh.get(i.name);s||(s=i.name===Kh.RESOURCES?Xg:new jg,i.base=i.base||e+"/",s.init(i)),t.import("virtual:///prerequisite-imports/"+s.name).then((function(){r(null,s)})).catch(r)}R.BufferAsset=Ev;var Iv=function(){function e(){this._creating=new Gh,this._producers={".png":Tv,".jpg":Tv,".bmp":Tv,".jpeg":Tv,".gif":Tv,".ico":Tv,".tiff":Tv,".webp":Tv,".image":Tv,".pvr":Tv,".pkm":Tv,".txt":Sv,".xml":Sv,".vsh":Sv,".fsh":Sv,".atlas":Sv,".tmx":Sv,".tsx":Sv,".fnt":Sv,".json":Av,".ExportJson":Av,".binary":bv,".bin":bv,".dbbin":bv,".skel":bv,bundle:Rv,default:wv}}var t=e.prototype;return t.register=function(e,t){"object"==typeof e?_t.mixin(this._producers,e):this._producers[e]=t},t.create=function(e,t,i,n,r){var s=this,a=this._producers[i]||this._producers.default,o=Hh.get(e);if(n.reloadAsset||!o){var u=this._creating.get(e);u?u.push(r):(this._creating.add(e,[r]),a(e,t,n,(function(t,i){!t&&i instanceof Cc&&(i._uuid=e,Gg(e,i,n.cacheAsset));for(var r=s._creating.remove(e),a=0,o=r.length;a<o;a++)r[a](t,i)})))}else r(null,o)},e}(),Ov=e("dm",new Iv),Nv=new(function(){function e(){this._loading=new Gh,this._unpackers={".json":this.unpackJson}}var t=e.prototype;return t.unpackJson=function(e,t,i,n){var r=_t.createMap(!0),s=null;if(Array.isArray(t)){(t=function(e){if(e[0]<1)throw new Error($(5304,e[0]));Gl(e,!0,void 0,kl.reportMissingClass),zl(e);for(var t=new Hl(e[0]),i=e[1],n=e[2],r=e[3],s=e[4],a=e[5],o=0;o<a.length;++o)a[o].unshift(t,i,n,r,s);return a}(t)).length!==e.length&&K(4915);for(var a=0;a<e.length;a++)r[e[a]+"@import"]=t[a]}else{var o=_t.getClassId(Sg),u=_t.getClassId(Qm);if(t.type===o&&t.data){var h=t.data;h.length!==e.length&&K(4915);for(var c=0;c<e.length;c++)r[e[c]+"@import"]=Vl(o,{base:h[c][0],mipmaps:h[c][1]})}else if(t.type===u&&t.data){var l=t.data;l.length!==e.length&&K(4915);for(var _=0;_<e.length;_++)r[e[_]+"@import"]=l[_]}else s=new Error("unmatched type pack!"),r=null}n(s,r)},t.init=function(){this._loading.clear()},t.register=function(e,t){"object"==typeof e?_t.mixin(this._unpackers,e):this._unpackers[e]=t},t.unpack=function(e,t,i,n,r){t?(0,this._unpackers[i])(e,t,n,r):r(new Error("package data is wrong!"))},t.load=function(e,t,i){var n=this;if(!e.isNative&&e.info&&e.info.packs)if(Vh.has(e.id))i(null,Vh.get(e.id));else{var r=e.info.packs,s=r.find((function(e){return n._loading.has(e.uuid)}));if(s)this._loading.get(s.uuid).push({onComplete:i,id:e.id});else{s=r[0],this._loading.add(s.uuid,[{onComplete:i,id:e.id}]);var a=uc(s.uuid,{ext:s.ext,bundle:e.config.name});pv.download(s.uuid,a,s.ext,e.options,(function(t,i){Vh.remove(s.uuid),t&&U(t.message,t.stack),n.unpack(s.packedUuids,i,s.ext,e.options,(function(e,i){if(!e)for(var r in i)Vh.add(r,i[r]);for(var a=n._loading.remove(s.uuid),o=0,u=a.length;o<u;o++){var h=a[o];if(t||e)h.onComplete(t||e);else{var c=i[h.id];c?h.onComplete(null,c):h.onComplete(new Error("can not retrieve data from package"))}}}))}))}}else pv.download(e.id,e.url,e.ext,e.options,i)},e}());function Cv(e,t){var i=!1;e.progress||(e.progress={finish:0,total:e.input.length,canInvoke:!0},i=!0);var n=e.options,r=e.progress,s=[],a=r.total,o=n.__exclude__=n.__exclude__||Object.create(null);e.output=[],zg(e.input,(function(n,u){if(!n.isNative&&Hh.has(n.uuid)){var h=Hh.get(n.uuid);return n.content=h.addRef(),e.output.push(n),r.canInvoke&&e.dispatch("progress",++r.finish,r.total,n),void u()}Nv.load(n,e.options,(function(h,c){h?e.isFinish||(!R.assetManager.force||i?(U(h.message,h.stack),r.canInvoke=!1,t(h)):(e.output.push(n),r.canInvoke&&e.dispatch("progress",++r.finish,r.total,n))):e.isFinish||(n.file=c,e.output.push(n),n.isNative||(o[n.uuid]=!0,Ug(n.uuid,c,o,s,n.config),r.total=a+s.length),r.canInvoke&&e.dispatch("progress",++r.finish,r.total,n)),u()}))}),(function(){if(e.isFinish)return Dg(e,!0),void e.dispatch("error");if(s.length>0){var a=Zh.create({input:s,progress:r,options:n,onProgress:e.onProgress,onError:Zh.prototype.recycle,onComplete:function(n){var r;n||((r=e.output).push.apply(r,a.output),a.recycle()),i&&Mv(e),t(n)}});Yh.async(a)}else i&&Mv(e),t()}))}function Mv(e){for(var t=e.output,i=0,n=t.length;i<n;i++)t[i].content&&t[i].content.decRef(!1)}var xv=new(function(e){function t(){return e.apply(this,arguments)||this}_(t,e);var i=t.prototype;return i.parse=function(e){var t=this._parseXML(e).documentElement;if("plist"!==t.tagName)return Y(5100),{};for(var i=null,n=0,r=t.childNodes.length;n<r&&1!==(i=t.childNodes[n]).nodeType;n++);return this._parseNode(i)},i._parseNode=function(e){var t=null,i=e.tagName;if("dict"===i)t=this._parseDict(e);else if("array"===i)t=this._parseArray(e);else if("string"===i)if(1===e.childNodes.length)t=e.firstChild.nodeValue;else{t="";for(var n=0;n<e.childNodes.length;n++)t+=e.childNodes[n].nodeValue}else"false"===i?t=!1:"true"===i?t=!0:"real"===i?t=parseFloat(e.firstChild.nodeValue):"integer"===i&&(t=parseInt(e.firstChild.nodeValue,10));return t},i._parseArray=function(e){for(var t=[],i=0,n=e.childNodes.length;i<n;i++){var r=e.childNodes[i];1===r.nodeType&&t.push(this._parseNode(r))}return t},i._parseDict=function(e){for(var t={},i="",n=0,r=e.childNodes.length;n<r;n++){var s=e.childNodes[n];1===s.nodeType&&("key"===s.tagName?i=s.firstChild.nodeValue:t[i]=this._parseNode(s))}return t},t}(e("gn",function(){function e(){this._parser=null,window.DOMParser&&(this._parser=new DOMParser)}var t=e.prototype;return t.parse=function(e){return this._parseXML(e)},t._parseXML=function(e){if(this._parser)return this._parser.parseFromString(e,"text/xml");throw new Error("Dom parser is not supported in this platform!")},e}())));function Fv(e,t){return e[t]<<8|e[t+1]}var Pv=function(){function e(){this._parsing=new Gh,this._parsers={".png":this.parseImage,".jpg":this.parseImage,".bmp":this.parseImage,".jpeg":this.parseImage,".gif":this.parseImage,".ico":this.parseImage,".tiff":this.parseImage,".webp":this.parseImage,".image":this.parseImage,".pvr":this.parsePVRTex,".pkm":this.parsePKMTex,".astc":this.parseASTCTex,".plist":this.parsePlist,import:this.parseImport,".ccon":this.parseImport,".cconb":this.parseImport}}var t=e.prototype;return t.parseImage=function(e,t,i){e instanceof HTMLImageElement?i(null,e):createImageBitmap(e,{premultiplyAlpha:"none"}).then((function(e){i(null,e)}),(function(e){i(e,null)}))},t.parsePVRTex=function(e,t,i){var n=null,r=null;try{var s=e instanceof ArrayBuffer?e:e.buffer,a=new Int32Array(s,0,13);if(55727696===a[0]){var o=a[7],u=a[6],h=a[12]+52;r={_data:new Uint8Array(s,h),_compressed:!0,width:o,height:u,format:0}}else{if(559044176!==a[11])throw new Error("Invalid magic number in PVR header");var c=a[0],l=a[1],_=a[2];r={_data:new Uint8Array(s,c),_compressed:!0,width:_,height:l,format:0}}}catch(e){n=e}i(n,r)},t.parsePKMTex=function(e,t,i){var n=null,r=null;try{var s=e instanceof ArrayBuffer?e:e.buffer,a=new Uint8Array(s),o=Fv(a,6);if(0!==o&&1!==o&&3!==o)throw new Error("Invalid magic number in ETC header");var u=Fv(a,12),h=Fv(a,14);Fv(a,8),Fv(a,10),r={_data:new Uint8Array(s,16),_compressed:!0,width:u,height:h,format:0}}catch(e){n=e}i(n,r)},t.parseASTCTex=function(e,t,i){var n=null,r=null;try{var s=e instanceof ArrayBuffer?e:e.buffer,a=new Uint8Array(s);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?Om.RGBA_ASTC_4x4:5===e?4===t?Om.RGBA_ASTC_5x4:Om.RGBA_ASTC_5x5:6===e?5===t?Om.RGBA_ASTC_6x5:Om.RGBA_ASTC_6x6:8===e?5===t?Om.RGBA_ASTC_8x5:6===t?Om.RGBA_ASTC_8x6:Om.RGBA_ASTC_8x8:10===e?5===t?Om.RGBA_ASTC_10x5:6===t?Om.RGBA_ASTC_10x6:8===t?Om.RGBA_ASTC_10x8:Om.RGBA_ASTC_10x10:10===t?Om.RGBA_ASTC_12x10:Om.RGBA_ASTC_12x12}(o,u),l=a[7]+(a[8]<<8)+(a[9]<<16),_=a[10]+(a[11]<<8)+(a[12]<<16);a[13],a[14],a[15],r={_data:new Uint8Array(s,16),_compressed:!0,width:l,height:_,format:c}}catch(e){n=e}i(n,r)},t.parsePlist=function(e,t,i){var n=null,r=xv.parse(e);r||(n=new Error("parse failed")),i(n,r)},t.parseImport=function(e,t,i){if(e){var n=null,r=null;try{n=eg(e,t)}catch(e){r=e}i(r,n)}else i(new Error("The json file of asset "+t.__uuid__+" is empty or missing"))},t.init=function(){this._parsing.clear()},t.register=function(e,t){"object"==typeof e?_t.mixin(this._parsers,e):this._parsers[e]=t},t.parse=function(e,t,i,n,r){var s=this,a=Wh.get(e);if(a)r(null,a);else{var o=this._parsing.get(e);if(o)o.push(r);else{var u=this._parsers[i];u?(this._parsing.add(e,[r]),u(t,n,(function(t,i){t?Vh.remove(e):ac(i)||Wh.add(e,i);for(var n=s._parsing.remove(e),r=0,a=n.length;r<a;r++)n[r](t,i)}))):r(null,t)}}},e}(),Dv=e("da",new Pv);function Lv(e,t){var i=!1;e.progress||(e.progress={finish:0,total:e.input.length,canInvoke:!0},i=!0);var n=e.options,r=e.progress;n.__exclude__=n.__exclude__||Object.create(null),e.output=[],zg(e.input,(function(s,a){var o=Zh.create({input:s,onProgress:e.onProgress,options:n,progress:r,onComplete:function(n,u){n&&!e.isFinish&&(!R.assetManager.force||i?(U(n.message,n.stack),r.canInvoke=!1,t(n)):r.canInvoke&&e.dispatch("progress",++r.finish,r.total,s)),e.output.push(u),o.recycle(),a(null)}});Bv.async(o)}),(function(){if(n.__exclude__=null,e.isFinish)return Dg(e,!0),void e.dispatch("error");!function(e){var t=e.source;if(e.options.__outputAsArray__||1!==t.length)for(var i=e.output=[],n=0,r=t.length;n<r;n++)i.push(t[n].content);else e.output=t[0].content}(e),Dg(e,!0),t()}))}var Bv=new zh("loadOneAsset",[function(e,t){var i=e.output=e.input,n=i.options,r=i.isNative,s=i.uuid,a=i.file,o=n.reloadAsset;a||!o&&!r&&Hh.has(s)?t():Nv.load(i,e.options,(function(e,n){i.file=n,t(e)}))},function(e,t){var i=e.output=e.input,n=e.progress,r=e.options.__exclude__,s=i.id,a=i.file,o=i.options;if(i.isNative)Dv.parse(s,a,i.ext,o,(function(r,a){r?t(r):(i.content=a,n.canInvoke&&e.dispatch("progress",++n.finish,n.total,i),Vh.remove(s),Wh.remove(s),t())}));else{var u=i.uuid;if(u in r){var h=r[u],c=h.finish,l=h.content,_=h.err,f=h.callbacks;n.canInvoke&&e.dispatch("progress",++n.finish,n.total,i),c||Vg(u,u,r)?(l&&l.addRef(),i.content=l,t(_)):f.push({done:t,item:i})}else if(!o.reloadAsset&&Hh.has(u)){var d=Hh.get(u);i.content=d.addRef(),n.canInvoke&&e.dispatch("progress",++n.finish,n.total,i),t()}else o.__uuid__=u,Dv.parse(s,a,"import",o,(function(i,n){i?t(i):function(e,t,i){var n=e.input,r=e.progress,s=n,a=s.uuid,o=s.id,u=s.options,h=s.config,c=u.cacheAsset,l=[];t.addRef&&t.addRef(),Ug(a,t,Object.create(null),l,h),r.canInvoke&&e.dispatch("progress",++r.finish,r.total+=l.length,n);var _=e.options.__exclude__[a]={content:t,finish:!1,callbacks:[{done:i,item:n}]},f=Zh.create({input:l,options:e.options,onProgress:e.onProgress,onError:Zh.prototype.recycle,progress:r,onComplete:function(e){if(t.decRef&&t.decRef(!1),_.finish=!0,_.err=e,!e){for(var i,n=Array.isArray(f.output)?f.output:[f.output],r=Object.create(null),s=E(n);!(i=s()).done;){var u=i.value;u&&(r[u instanceof Cc?u._uuid+"@import":a+"@native"]=u)}!function(e,t,i){var n=Zm.get(t);if(n){for(var r=0,s=n.length;r<s;r++){var a=n[r],o=i[a.uuid+"@import"];if(o)a.owner[a.prop]=o.addRef();else{if(U("The asset "+a.uuid+" is missing!"),a.type&&a.type!==Cc){var u=new a.type;u.initDefault(a.uuid),a.owner[a.prop]=u}!0}}Zm.delete(t)}Jm.has(t)&&(i[e+"@native"]?t._nativeAsset=i[e+"@native"]:(!0,console.error("the native asset of "+e+" is missing!")),Jm.delete(t))}(a,t,r);try{"function"!=typeof t.onLoaded||$m.has(t)||Jm.has(t)||(t.onLoaded(),$m.add(t))}catch(e){U("The asset "+a+" is invalid for some reason, detail message: "+e.message+", stack: "+e.stack)}Vh.remove(o),Wh.remove(o),Gg(a,t,c),f.recycle()}for(var h=_.callbacks,l=0,d=h.length;l<d;l++){var p=h[l];t.addRef&&t.addRef(),p.item.content=t,p.done(e)}h.length=0}});Xh.async(f)}(e,n,t)}))}}]);function Uv(e,t){var i=e.options,n=Object.create(null),r=Object.create(null);for(var s in i)switch(s){case kh.PATH:case kh.UUID:case kh.DIR:case kh.SCENE:case kh.URL:break;case"__requestType__":case"__isNative__":case"ext":case"type":case"__nativeName__":case"audioLoadMode":case"bundle":n[s]=i[s];break;case"__exclude__":case"__outputAsArray__":r[s]=i[s];break;default:n[s]=i[s],r[s]=i[s]}e.options=r;var a=Zh.create({input:e.input,options:n}),o=null;try{e.output=e.source=qh.sync(a)}catch(e){o=e;for(var u=0,h=a.output.length;u<h;u++)a.output[u].recycle()}a.recycle(),t(o)}var Gv=function(){function e(){this.uuid="",this.url="",this.ext=".json",this.content=null,this.file=null,this.info=null,this.config=null,this.isNative=!1,this.options=Object.create(null),this._id=""}return e.create=function(){return 0!==e._deadPool.length?e._deadPool.pop():new e},e.prototype.recycle=function(){e._deadPool.length!==e.MAX_DEAD_NUM&&(this._id="",this.uuid="",this.url="",this.ext=".json",this.content=null,this.file=null,this.info=null,this.config=null,this.isNative=!1,this.options=Object.create(null),e._deadPool.push(this))},c(e,[{key:"id",get:function(){return this._id||(this._id=this.uuid+"@"+(this.isNative?"native":"import")),this._id}}]),e}();Gv.MAX_DEAD_NUM=500,Gv._deadPool=[];var zv=[];function kv(e){var t=e.options,i=Array.isArray(e.input)?e.input:[e.input];e.output=[];for(var n=function(n){var r,s=i[n],a=Gv.create(),o=null,u=null;if("string"==typeof s&&((s=Object.create(null))[t.__requestType__||kh.UUID]=i[n]),"object"==typeof s)for(var h in _t.addon(s,t),s.preset&&_t.addon(s,Qh[s.preset]),s){switch(h){case kh.UUID:if("break"===function(){var e,t=a.uuid=ic(s.uuid);if(!s.bundle){var i=jh.find((function(e){return!!e.getAssetInfo(t)}));s.bundle=i&&i.name}if(jh.has(s.bundle)){if(o=jh.get(s.bundle).config,(u=o.getAssetInfo(t))&&u.redirect){if(!jh.has(u.redirect))throw new Error("Please load bundle "+u.redirect+" first");o=jh.get(u.redirect).config,u=o.getAssetInfo(t)}a.config=o,a.info=u}return a.ext=s.ext||(null===(e=u)||void 0===e?void 0:e.extension)||".json","break"}())break;case"__requestType__":case"ext":case"bundle":case"preset":case"type":break;case kh.DIR:if(jh.has(s.bundle)){jh.get(s.bundle).config.getDirWithPath(s.dir,s.type,zv);for(var c,l=E(zv);!(c=l()).done;){var _=c.value;i.push({uuid:_.uuid,__isNative__:!1,ext:_.extension||".json",bundle:s.bundle})}zv.length=0}a.recycle(),a=null;break;case kh.PATH:if(jh.has(s.bundle)){if(o=jh.get(s.bundle).config,(u=o.getInfoWithPath(s.path,s.type))&&u.redirect){if(!jh.has(u.redirect))throw new Error("you need to load bundle "+u.redirect+" first");o=jh.get(u.redirect).config,u=o.getAssetInfo(u.uuid)}if(!u)throw a.recycle(),new Error("Bundle "+s.bundle+" doesn't contain "+s.path);a.config=o,a.uuid=u.uuid,a.info=u}a.ext=s.ext||(null===(r=u)||void 0===r?void 0:r.extension)||".json";break;case kh.SCENE:if(!s.bundle){var f=jh.find((function(e){return!!e.getSceneInfo(s.scene)}));s.bundle=f&&f.name}if(jh.has(s.bundle)){if(o=jh.get(s.bundle).config,(u=o.getSceneInfo(s.scene))&&u.redirect){if(!jh.has(u.redirect))throw new Error("you need to load bundle "+u.redirect+" first");o=jh.get(u.redirect).config,u=o.getAssetInfo(u.uuid)}if(!u)throw a.recycle(),new Error("Bundle "+o.name+" doesn't contain scene "+s.scene);a.config=o,a.uuid=u.uuid,a.info=u}break;case"__isNative__":a.isNative=s.__isNative__;break;case kh.URL:a.url=s.url,a.uuid=s.uuid||s.url,a.ext=s.ext||vc(s.url),a.isNative=void 0===s.__isNative__||s.__isNative__;break;default:a.options[h]=s[h]}if(!a)break}if(!a)return"continue";if(e.output.push(a),!a.uuid&&!a.url)throw new Error("Can not parse this input:"+JSON.stringify(s))},r=0;r<i.length;r++)n(r);return null}function Hv(e){for(var t=e.output=e.input,i=0;i<t.length;i++){var n=t[i];if(!n.url){var r,s,a=n.config;s=n.isNative?a&&a.nativeBase?a.base+a.nativeBase:R.assetManager.generalNativeBase:a&&a.importBase?a.base+a.importBase:R.assetManager.generalImportBase;var o=n.uuid,u="";n.info&&(u=n.isNative?n.info.nativeVer?"."+n.info.nativeVer:"":n.info.ver?"."+n.info.ver:""),r=".ttf"===n.ext?s+"/"+o.slice(0,2)+"/"+o+u+"/"+n.options.__nativeName__:s+"/"+o.slice(0,2)+"/"+o+u+n.ext,n.url=r}}return null}var Vv=e("df",function(){function e(){this.pipeline=Xh.append(Uv).append(Lv),this.fetchPipeline=Yh.append(Uv).append(Cv),this.transformPipeline=qh.append(kv).append(Hv),this.bundles=jh,this.assets=Hh,this.generalImportBase="",this.generalNativeBase="",this.dependUtil=ng,this.force=!1,this.allowImageBitmap=!ka.isMobile,this.utils=fc,this.downloader=pv,this.parser=Dv,this.packManager=Nv,this.cacheAsset=!0,this.cacheManager=null,this.presets=Qh,this.factory=Ov,this.preprocessPipe=Uv,this.fetchPipe=Cv,this.loadPipe=Lv,this.references=null,this._releaseManager=Fg,this._files=Vh,this._parsed=Wh,this._parsePipeline=null,this._projectBundles=[]}var t=e.prototype;return t.init=function(e){void 0===e&&(e={});var t=e.server||Tt.querySettings(Et.Category.ASSETS,"server")||"",i=e.bundleVers||Tt.querySettings(Et.Category.ASSETS,"bundleVers")||{},n=e.remoteBundles||Tt.querySettings(Et.Category.ASSETS,"remoteBundles")||[];this._files.clear(),this._parsed.clear(),this._releaseManager.init(),this.assets.clear(),this.bundles.clear(),this.packManager.init(),this.downloader.init(t,i,n),this.parser.init(),this.dependUtil.init();var r=e.importBase||Tt.querySettings(Et.Category.ASSETS,"importBase")||"";r&&r.endsWith("/")&&(r=r.substr(0,r.length-1));var s=e.nativeBase||Tt.querySettings(Et.Category.ASSETS,"nativeBase")||"";s&&s.endsWith("/")&&(s=s.substr(0,s.length-1)),this.generalImportBase=r,this.generalNativeBase=s,this._projectBundles=Tt.querySettings(Et.Category.ASSETS,"projectBundles")||[]},t.getBundle=function(e){return jh.get(e)||null},t.removeBundle=function(e){e._destroy(),jh.remove(e.name)},t.loadAny=function(e,t,i,n){var r=kg(t,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"default",e=Array.isArray(e)?e.slice():e;var u=Zh.create({input:e,onProgress:a,onComplete:Wg(o),options:s});Xh.async(u)},t.preloadAny=function(e,t,i,n){var r=kg(t,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"preload",e=Array.isArray(e)?e.slice():e;var u=Zh.create({input:e,onProgress:a,onComplete:Wg(o),options:s});Yh.async(u)},t.loadRemote=function(e,t,i){var n=kg(t,void 0,i),r=n.options,s=n.onComplete;r.reloadAsset||!this.assets.has(e)?(r.__isNative__=!0,r.preset=r.preset||"remote",this.loadAny({url:e},r,null,(function(t,i){t?(U(t.message,t.stack),s&&s(t,i)):Ov.create(e,i,r.ext||vc(e),r,(function(e,t){s&&s(e,t)}))}))):Wg(s)(null,this.assets.get(e))},t.loadBundle=function(e,t,i){var n=kg(t,void 0,i),r=n.options,s=n.onComplete,a=Ec(e);this.bundles.has(a)?Wg(s)(null,this.getBundle(a)):(r.preset=r.preset||"bundle",r.ext="bundle",r.__isNative__=!0,this.loadAny({url:e},r,null,(function(t,i){t?(U(t.message,t.stack),s&&s(t,i)):Ov.create(e,i,"bundle",r,(function(e,t){s&&s(e,t)}))})))},t.releaseAsset=function(e){Fg.tryRelease(e,!0)},t.releaseUnusedAssets=function(){Hh.forEach((function(e){Fg.tryRelease(e)}))},t.releaseAll=function(){Hh.forEach((function(e){Fg.tryRelease(e,!0)}))},t.loadWithJson=function(){throw new Error("Only valid in Editor")},c(e,[{key:"main",get:function(){return jh.get(Kh.MAIN)||null}},{key:"resources",get:function(){return jh.get(Kh.RESOURCES)||null}}]),e}());Vv.Pipeline=zh,Vv.Task=Zh,Vv.Cache=Gh,Vv.RequestItem=Gv,Vv.Bundle=jg,Vv.BuiltinBundleName=Kh;var Wv=e("d4",R.assetManager=new Vv);R.AssetManager=Vv;var jv,Xv,Yv,qv=function(){function e(){this._resources={},this._materialsToBeCompiled=[]}var t=e.prototype;return t.init=function(){for(var e=this._resources,t=new Uint8Array(16),i=new Uint8Array(16),n=new Uint8Array(16),r=new Uint8Array(16),s=new Uint8Array(16),a=0,o=0;o<4;o++)t[a]=0,t[a+1]=0,t[a+2]=0,t[a+3]=255,i[a]=0,i[a+1]=0,i[a+2]=0,i[a+3]=0,n[a]=119,n[a+1]=119,n[a+2]=119,n[a+3]=255,r[a]=255,r[a+1]=255,r[a+2]=255,r[a+3]=255,s[a]=127,s[a+1]=127,s[a+2]=255,s[a+3]=255,a+=4;var u=new Uint8Array(1024);a=0;for(var h=0;h<256;h++)u[a]=221,u[a+1]=221,u[a+2]=221,u[a+3]=255,a+=4;a=0;for(var c=0;c<8;c++){for(var l=0;l<8;l++)u[a]=85,u[a+1]=85,u[a+2]=85,u[a+3]=255,a+=4;a+=32}a+=32;for(var _=0;_<8;_++){for(var f=0;f<8;f++)u[a]=85,u[a+1]=85,u[a+2]=85,u[a+3]=255,a+=4;a+=32}var d={width:2,height:2,_data:t,_compressed:!1,format:Sg.PixelFormat.RGBA8888},p={width:2,height:2,_data:i,_compressed:!1,format:Sg.PixelFormat.RGBA8888},m={width:2,height:2,_data:n,_compressed:!1,format:Sg.PixelFormat.RGBA8888},g={width:2,height:2,_data:r,_compressed:!1,format:Sg.PixelFormat.RGBA8888},v={width:2,height:2,_data:s,_compressed:!1,format:Sg.PixelFormat.RGBA8888},y={width:16,height:16,_data:u,_compressed:!1,format:Sg.PixelFormat.RGBA8888},E=new Qm(d),T=new Sg;T._uuid="black-texture",T.image=E,e[T._uuid]=T;var A=new Qm(p),S=new Sg;S._uuid="empty-texture",S.image=A,e[S._uuid]=S;var b=new bg;b._uuid="black-cube-texture",b.setMipFilter(bg.Filter.NEAREST),b.image={front:new Qm(d),back:new Qm(d),left:new Qm(d),right:new Qm(d),top:new Qm(d),bottom:new Qm(d)},e[b._uuid]=b;var w=new Qm(m),I=new Sg;I._uuid="grey-texture",I.image=w,e[I._uuid]=I;var O=new Qm(g),N=new Sg;N._uuid="white-texture",N.image=O,e[N._uuid]=N;var C=new bg;C._uuid="white-cube-texture",C.setMipFilter(bg.Filter.NEAREST),C.image={front:new Qm(g),back:new Qm(g),left:new Qm(g),right:new Qm(g),top:new Qm(g),bottom:new Qm(g)},e[C._uuid]=C;var M=new Qm(v),x=new Sg;x._uuid="normal-texture",x.image=M,e[x._uuid]=x;var F=new Qm(y),P=new Sg;P._uuid="default-texture",P.image=F,e[P._uuid]=P;var D=new bg;if(D.setMipFilter(bg.Filter.NEAREST),D._uuid="default-cube-texture",D.image={front:new Qm(y),back:new Qm(y),left:new Qm(y),right:new Qm(y),top:new Qm(y),bottom:new Qm(y)},e[D._uuid]=D,R.SpriteFrame){var L=new R.SpriteFrame,B=E,U=new Sg;U.image=B,L.texture=U,L._uuid="default-spriteframe",e[L._uuid]=L}},t.addAsset=function(e,t){this._resources[e]=t},t.get=function(e){return this._resources[e]},t.loadBuiltinAssets=function(){var e=this,t=Tt.querySettings(Et.Category.ENGINE,"builtinAssets");if(!t)return Promise.resolve();var i=this._resources;return new Promise((function(n,r){Wv.loadBundle(Kh.INTERNAL,(function(s){s?r(s):Wv.loadAny(t,(function(t,s){t?r(t):(s.forEach((function(t){i[t.name]=t,Fg.addIgnoredAsset(t),t instanceof R.Material&&e._materialsToBeCompiled.push(t)})),n())}))}))}))},t.compileBuiltinMaterial=function(){for(var e=0;e<this._materialsToBeCompiled.length;++e)for(var t=this._materialsToBeCompiled[e],i=0;i<t.passes.length;++i)t.passes[i].tryCompile();this._materialsToBeCompiled.length=0},e}(),Kv=e("ek",R.builtinResMgr=new qv),Qv=e("hx",(jv=new Map,Xv=0,function(e){return"number"==typeof e?e:(jv.has(e)||(jv.set(e,1<<Xv),Xv++),jv.get(e))})),Zv=e("ht",function(){function e(e){this.instances=[],this.pass=void 0,this.hasPendingModels=!1,this.dynamicOffsets=[],this._device=void 0,this._device=e.device,this.pass=e}var t=e.prototype;return t.destroy=function(){for(var e=0;e<this.instances.length;++e){var t=this.instances[e];t.vb.destroy(),t.ia.destroy()}this.instances.length=0},t.merge=function(e,t,i,n){void 0===n&&(n=null);var r=t.buffer.length;if(r){var s=e.inputAssembler,a=e.descriptorSet.getTexture(Mp),o=n;o||(o=e.shaders[i]);for(var u=e.descriptorSet,h=0;h<this.instances.length;++h){var c=this.instances[h];if(!(c.ia.indexBuffer!==s.indexBuffer||c.count>=1024)&&c.lightingMap===a&&c.stride===r){if(c.count>=c.capacity){c.capacity<<=1;var l=c.stride*c.capacity,_=c.data;c.data=new Uint8Array(l),c.data.set(_),c.vb.resize(l)}return c.shader!==o&&(c.shader=o),c.descriptorSet!==u&&(c.descriptorSet=u),c.data.set(t.buffer,c.stride*c.count++),void(this.hasPendingModels=!0)}}for(var f=this._device.createBuffer(new Sr(En.VERTEX|En.TRANSFER_DST,Sn.HOST|Sn.DEVICE,32*r,r)),d=new Uint8Array(32*r),p=s.vertexBuffers.slice(),m=s.attributes.slice(),g=s.indexBuffer,v=0;v<t.attributes.length;v++){var y=t.attributes[v],E=new zr(y.name,y.format,y.isNormalized,p.length,!0);m.push(E)}d.set(t.buffer),p.push(f);var T=new Hr(m,p,g),A=this._device.createInputAssembler(T);this.instances.push({count:1,capacity:32,vb:f,data:d,ia:A,stride:r,shader:o,descriptorSet:u,lightingMap:a}),this.hasPendingModels=!0}},t.uploadBuffers=function(e){for(var t=0;t<this.instances.length;++t){var i=this.instances[t];i.count&&(i.ia.instanceCount=i.count,e.updateBuffer(i.vb,i.data))}},t.clear=function(){for(var e=0;e<this.instances.length;++e)this.instances[e].count=0;this.hasPendingModels=!1},e}()),Jv=function(){function e(e){this.batches=[],this.dynamicOffsets=[],this._device=void 0,this._device=e.device}var t=e.prototype;return t.destroy=function(){for(var e=0;e<this.batches.length;++e){for(var t=this.batches[e],i=0;i<t.vbs.length;++i)t.vbs[i].destroy();t.vbIdx.destroy(),t.ia.destroy(),t.ubo.destroy()}this.batches.length=0},t.merge=function(e,t,i){var n=e.subMesh.flatBuffers;if(0!==n.length){for(var r=0,s=0,a=n[0].count,o=e.passes[t],u=e.shaders[t],h=e.descriptorSet,c=!1,l=0;l<this.batches.length;++l){var _=this.batches[l];if(_.vbs.length===n.length&&_.mergeCount<ap.BATCHING_COUNT){c=!0;for(var f=0;f<_.vbs.length;++f)if(_.vbs[f].stride!==n[f].stride){c=!1;break}if(c){for(var d=0;d<_.vbs.length;++d){var p=n[d],m=_.vbs[d],g=_.vbDatas[d];(r=(a+_.vbCount)*p.stride)>m.size&&(m.resize(r),_.vbDatas[d]=new Uint8Array(r),_.vbDatas[d].set(g)),_.vbDatas[d].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<E;A++)v[A]=T+.1;return Qi.toArray(_.uboData,i.transform.worldMatrix,ap.MAT_WORLDS_OFFSET+16*_.mergeCount),_.mergeCount||(h.bindBuffer(ap.BINDING,_.ubo),h.update(),_.pass=o,_.shader=u,_.descriptorSet=h),++_.mergeCount,_.vbCount+=a,void(_.ia.vertexCount+=a)}}}for(var S=[],b=[],w=[],R=0;R<n.length;++R){var I=n[R],O=this._device.createBuffer(new Sr(En.VERTEX|En.TRANSFER_DST,Sn.HOST|Sn.DEVICE,I.count*I.stride,I.stride));O.update(I.buffer.buffer),S.push(O),b.push(new Uint8Array(O.size)),w.push(O)}var N=this._device.createBuffer(new Sr(En.VERTEX|En.TRANSFER_DST,Sn.HOST|Sn.DEVICE,4*a,4)),C=new Float32Array(a);C.fill(0),N.update(C),w.push(N);for(var M=e.inputAssembler.attributes,x=new Array(M.length+1),F=0;F<M.length;++F)x[F]=M[F];x[M.length]=new zr("a_dyn_batch_id",gn.R32F,!1,n.length);var P=new Hr(x,w),D=this._device.createInputAssembler(P),L=this._device.createBuffer(new Sr(En.UNIFORM|En.TRANSFER_DST,Sn.HOST|Sn.DEVICE,ap.SIZE,ap.SIZE));h.bindBuffer(ap.BINDING,L),h.update();var B=new Float32Array(ap.COUNT);Qi.toArray(B,i.transform.worldMatrix,ap.MAT_WORLDS_OFFSET),this.batches.push({mergeCount:1,vbs:S,vbDatas:b,vbIdx:N,vbIdxData:C,vbCount:a,ia:D,ubo:L,uboData:B,pass:o,shader:u,descriptorSet:h})}},t.clear=function(){for(var e=0;e<this.batches.length;++e){var t=this.batches[e];t.vbCount=0,t.mergeCount=0,t.ia.vertexCount=0}},e}(),$v=new Sr(En.UNIFORM|En.TRANSFER_DST,Sn.DEVICE),ey=new br(null),ty=new es(null);!function(e){e[e.NONE=0]="NONE",e[e.INSTANCING=1]="INSTANCING",e[e.VB_MERGING=2]="VB_MERGING"}(Yv||(Yv=e("eG",{})));var iy=e("ev",function(){function e(e){this._rootBuffer=null,this._buffers=[],this._descriptorSet=null,this._pipelineLayout=null,this._passIndex=0,this._propertyIndex=0,this._programName="",this._dynamics={},this._propertyHandleMap={},this._rootBlock=null,this._blocksInt=[],this._blocks=[],this._shaderInfo=null,this._defines={},this._properties={},this._shader=null,this._bs=new zs,this._dss=new Us,this._rs=new Bs,this._priority=Rd.DEFAULT,this._stage=wd.DEFAULT,this._phase=Qv("default"),this._primitive=Vn.TRIANGLE_LIST,this._batchingScheme=Yv.NONE,this._dynamicStates=Yn.NONE,this._instancedBuffers={},this._batchedBuffers={},this._hash=0,this._root=void 0,this._device=void 0,this._rootBufferDirty=!1,this._root=e,this._device=Va.gfxDevice}e.fillPipelineInfo=function(e,t){void 0!==t.priority&&(e._priority=t.priority),void 0!==t.primitive&&(e._primitive=t.primitive),void 0!==t.stage&&(e._stage=t.stage),void 0!==t.dynamicStates&&(e._dynamicStates=t.dynamicStates),void 0!==t.phase&&(e._phase=Qv(t.phase));var i=e._bs;if(t.blendState){var n=t.blendState,r=n.targets;r&&r.forEach((function(e,t){i.setTarget(t,e)})),void 0!==n.isA2C&&(i.isA2C=n.isA2C),void 0!==n.isIndepend&&(i.isIndepend=n.isIndepend),void 0!==n.blendColor&&(i.blendColor=n.blendColor)}e._rs.assign(t.rasterizerState),e._dss.assign(t.depthStencilState)},e.getPassHash=function(e){var t,i=wm.getKey(e.program,e.defines)+","+e._primitive+","+e._dynamicStates;return i+=function(e){for(var t,i=",bs,"+e.isA2C,n=E(e.targets);!(t=n()).done;){var r=t.value;i+=",bt,"+r.blend+","+r.blendEq+","+r.blendAlphaEq+","+r.blendColorMask,i+=","+r.blendSrc+","+r.blendDst+","+r.blendSrcAlpha+","+r.blendDstAlpha}return i}(e._bs),i+=function(e){var t=",dss,"+e.depthTest+","+e.depthWrite+","+e.depthFunc;return t+=","+e.stencilTestFront+","+e.stencilFuncFront+","+e.stencilRefFront+","+e.stencilReadMaskFront,t+=","+e.stencilFailOpFront+","+e.stencilZFailOpFront+","+e.stencilPassOpFront+","+e.stencilWriteMaskFront,(t+=","+e.stencilTestBack+","+e.stencilFuncBack+","+e.stencilRefBack+","+e.stencilReadMaskBack)+","+e.stencilFailOpBack+","+e.stencilZFailOpBack+","+e.stencilPassOpBack+","+e.stencilWriteMaskBack}(e._dss),xs(i+=",rs,"+(t=e._rs).cullMode+","+t.depthBias+","+t.isFrontFaceCCW,666)};var t=e.prototype;return t.initialize=function(e){this._doInit(e),this.resetUBOs(),this.resetTextures(),this.tryCompile()},t.getHandle=function(e,t,i){void 0===t&&(t=0),void 0===i&&(i=yn.UNKNOWN);var n=this._propertyHandleMap[e];return n?(i?n=nm(n,i):t&&(n=nm(n,$p(n)-t)),n+t):0},t.getBinding=function(t){var i=this.getHandle(t);return i?e.getBindingFromHandle(i):-1},t.setUniform=function(t,i){var n=e.getBindingFromHandle(t),r=e.getTypeFromHandle(t),s=e.getOffsetFromHandle(t),a=this._getBlockView(r,n);sm[r](a,i,s),this._rootBufferDirty=!0},t.getUniform=function(t,i){var n=e.getBindingFromHandle(t),r=e.getTypeFromHandle(t),s=e.getOffsetFromHandle(t),a=this._getBlockView(r,n);return rm[r](a,i,s)},t.setUniformArray=function(t,i){for(var n=e.getBindingFromHandle(t),r=e.getTypeFromHandle(t),s=Es(r)>>2,a=this._getBlockView(r,n),o=e.getOffsetFromHandle(t),u=0;u<i.length;u++,o+=s)null!==i[u]&&sm[r](a,i[u],o);this._rootBufferDirty=!0},t.bindTexture=function(e,t,i){this._descriptorSet.bindTexture(e,t,i||0)},t.bindSampler=function(e,t,i){this._descriptorSet.bindSampler(e,t,i||0)},t.setDynamicState=function(e,t){var i=this._dynamics[e];i&&i.value===t||(i.value=t,i.dirty=!0)},t.overridePipelineStates=function(){console.warn("base pass cannot override states, please use pass instance instead.")},t._setRootBufferDirty=function(e){this._rootBufferDirty=e},t.update=function(){this._descriptorSet?(this._rootBuffer&&this._rootBufferDirty&&(this._rootBuffer.update(this._rootBlock),this._rootBufferDirty=!1),this._descriptorSet.update()):K(12006)},t.getInstancedBuffer=function(e){return void 0===e&&(e=0),this._instancedBuffers[e]||(this._instancedBuffers[e]=new Zv(this))},t.getBatchedBuffer=function(e){return void 0===e&&(e=0),this._batchedBuffers[e]||(this._batchedBuffers[e]=new Jv(this))},t.destroy=function(){for(var e=0;e<this._shaderInfo.blocks.length;e++){var t=this._shaderInfo.blocks[e];this._buffers[t.binding].destroy()}for(var i in this._buffers=[],this._rootBuffer&&(this._rootBuffer.destroy(),this._rootBuffer=null),this._instancedBuffers)this._instancedBuffers[i].destroy();for(var n in this._batchedBuffers)this._batchedBuffers[n].destroy();this._descriptorSet.destroy(),this._rs.destroy(),this._dss.destroy(),this._bs.destroy()},t.resetUniform=function(t){var i=this.getHandle(t);if(i){for(var n=e.getTypeFromHandle(i),r=e.getBindingFromHandle(i),s=e.getOffsetFromHandle(i),a=e.getCountFromHandle(i),o=this._getBlockView(n,r),u=this._properties[t],h=u&&u.value||om(n),c=(Es(n)>>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+"-texture":om(r),h=Kv.get(u),c=h&&h.getGFXTexture(),l=a&&void 0!==a.samplerHash?js.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<this._shaderInfo.blocks.length;e++)for(var t=this._shaderInfo.blocks[e],i=0,n=0;n<t.members.length;n++){for(var r=t.members[n],s=this._getBlockView(r.type,t.binding),a=this._properties[r.name],o=a&&a.value||om(r.type),u=(Es(r.type)>>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._shaderInfo.samplerTextures.length;e++)for(var t=this._shaderInfo.samplerTextures[e],i=0;i<t.count;i++)this.resetTexture(t.name,i)},t.tryCompile=function(){var t=this._root.pipeline;if(!t)return!1;this._syncBatchingScheme();var i=wm.getGFXShader(this._device,this._programName,this._defines,t);return i?(this._shader=i,this._pipelineLayout=wm.getTemplateInfo(this._programName).pipelineLayout,this._hash=e.getPassHash(this),!0):(console.warn("create shader "+this._programName+" failed"),!1)},t.getShaderVariant=function(e){if(void 0===e&&(e=null),!this._shader&&!this.tryCompile())return console.warn("pass resources incomplete"),null;if(!e)return this._shader;for(var t=this._root.pipeline,i=0;i<e.length;i++){var n=e[i];this._defines[n.name]=n.value}for(var r=wm.getGFXShader(this._device,this._programName,this._defines,t),s=0;s<e.length;s++){var a=e[s];delete this._defines[a.name]}return r},t.beginChangeStatesSilently=function(){},t.endChangeStatesSilently=function(){},t._doInit=function(t,i){void 0===i&&(i=!1),this._priority=Rd.DEFAULT,this._stage=wd.DEFAULT,this._phase=Qv("default"),this._primitive=Vn.TRIANGLE_LIST,this._passIndex=t.passIndex,this._propertyIndex=void 0!==t.propertyIndex?t.propertyIndex:t.passIndex,this._programName=t.program,this._defines=i?l({},t.defines):t.defines,this._shaderInfo=wm.getTemplate(t.program),this._properties=t.properties||this._properties;var n=this._device;e.fillPipelineInfo(this,t),t.stateOverrides&&e.fillPipelineInfo(this,t.stateOverrides),ty.layout=wm.getDescriptorSetLayout(this._device,t.program),this._descriptorSet=this._device.createDescriptorSet(ty);for(var r=this._shaderInfo.blocks,s=wm.getTemplateInfo(t.program),a=s.blockSizes,o=s.handleMap,u=n.capabilities.uboOffsetAlignment,h=[],c=0,_=0,f=0;f<r.length;f++){var d=a[f];h.push(_),_+=Math.ceil(d/u)*u,c=d}var p=h[h.length-1]+c;p&&($v.size=16*Math.ceil(p/16),this._rootBuffer=n.createBuffer($v),this._rootBlock=new ArrayBuffer(p));for(var m=0,g=0;m<r.length;m++){var v=r[m].binding,y=a[m];ey.buffer=this._rootBuffer,ey.offset=h[g++],ey.range=16*Math.ceil(y/16);var E=this._buffers[v]=n.createBuffer(ey);this._blocks[v]=new Float32Array(this._rootBlock,ey.offset,y/Float32Array.BYTES_PER_ELEMENT),this._blocksInt[v]=new Int32Array(this._blocks[v].buffer,this._blocks[v].byteOffset,this._blocks[v].length),this._descriptorSet.bindBuffer(v,E)}var T=this._propertyHandleMap=o,A={};for(var S in this._properties){var b=this._properties[S];b.handleInfo&&(A[S]=this.getHandle.apply(this,b.handleInfo))}Object.assign(T,A)},t._syncBatchingScheme=function(){this._defines.USE_INSTANCING?this._device.hasFeature(mn.INSTANCED_ARRAYS)?this._batchingScheme=Yv.INSTANCING:(this._defines.USE_INSTANCING=!1,this._batchingScheme=Yv.NONE):this._defines.USE_BATCHING?this._batchingScheme=Yv.VB_MERGING:this._batchingScheme=Yv.NONE},t._getBlockView=function(e,t){return e<yn.FLOAT?this._blocksInt[t]:this._blocks[t]},t._initPassFromTarget=function(e,t,i){this._priority=e.priority,this._stage=e.stage,this._phase=e.phase,this._batchingScheme=e.batchingScheme,this._primitive=e.primitive,this._dynamicStates=e.dynamicStates,this._bs=e.blendState,this._dss=t,this._descriptorSet=e.descriptorSet,this._rs=e.rasterizerState,this._passIndex=e.passIndex,this._propertyIndex=e.propertyIndex,this._programName=e.program,this._defines=e.defines,this._shaderInfo=e._shaderInfo,this._properties=e._properties,this._blocks=e._blocks,this._blocksInt=e._blocksInt,this._dynamics=e._dynamics,this._shader=e._shader,this._pipelineLayout=wm.getTemplateInfo(this._programName).pipelineLayout,this._hash=e._hash^i},t._updatePassHash=function(){this._hash=e.getPassHash(this)},c(e,[{key:"root",get:function(){return this._root}},{key:"device",get:function(){return this._device}},{key:"shaderInfo",get:function(){return this._shaderInfo}},{key:"localSetLayout",get:function(){return wm.getDescriptorSetLayout(this._device,this._programName,!0)}},{key:"program",get:function(){return this._programName}},{key:"properties",get:function(){return this._properties}},{key:"defines",get:function(){return this._defines}},{key:"passIndex",get:function(){return this._passIndex}},{key:"propertyIndex",get:function(){return this._propertyIndex}},{key:"dynamics",get:function(){return this._dynamics}},{key:"blocks",get:function(){return this._blocks}},{key:"blocksInt",get:function(){return this._blocksInt}},{key:"rootBufferDirty",get:function(){return this._rootBufferDirty}},{key:"priority",get:function(){return this._priority}},{key:"primitive",get:function(){return this._primitive}},{key:"stage",get:function(){return this._stage}},{key:"phase",get:function(){return this._phase}},{key:"rasterizerState",get:function(){return this._rs}},{key:"depthStencilState",get:function(){return this._dss}},{key:"blendState",get:function(){return this._bs}},{key:"dynamicStates",get:function(){return this._dynamicStates}},{key:"batchingScheme",get:function(){return this._batchingScheme}},{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"hash",get:function(){return this._hash}},{key:"pipelineLayout",get:function(){return this._pipelineLayout}}]),e}());iy.getTypeFromHandle=$p,iy.getBindingFromHandle=em,iy.getCountFromHandle=tm,iy.getOffsetFromHandle=im;var ny=e("hu",function(){function e(){}return e.getOrCreatePipelineState=function(e,t,i,n,r){var s=t.hash^n.hash^r.attributesHash^i.typedID,a=this._PSOHashMap.get(s);if(!a){var o=t.pipelineLayout,u=new is(r.attributes),h=new ks(i,o,n,u,t.rasterizerState,t.depthStencilState,t.blendState,t.primitive,t.dynamicStates);a=e.createPipelineState(h),this._PSOHashMap.set(s,a)}return a},e}());ny._PSOHashMap=new Map;var ry=new vr,sy=new lr;function ay(e,t){e.x=t.x*t.x,e.y=t.y*t.y,e.z=t.z*t.z}var oy,uy,hy,cy,ly,_y,fy,dy,py,my,gy=null;function vy(e,t,i,n,r){if(n&&n.enabled&&r===gy){var s=n.subModels[0],a=s.inputAssembler,o=s.passes,u=s.shaders,h=s.descriptorSet;ry.width=sy.width=r.window.width,ry.height=sy.height=r.window.height;var c=ny.getOrCreatePipelineState(e,o[0],u[0],t,a);i.setViewport(ry),i.setScissor(sy),i.bindPipelineState(c),i.bindDescriptorSet(Ld.MATERIAL,o[0].descriptorSet),i.bindDescriptorSet(Ld.LOCAL,h),i.bindInputAssembler(a),i.draw(a)}}var yy=new sn,Ey=e("dy",(oy=th("cc.Material"),uy=Dh(Im),oy((my=function(e){function t(){var t;return T(t=e.call(this)||this,"_effectAsset",ly,v(t)),T(t,"_techIdx",_y,v(t)),T(t,"_defines",fy,v(t)),T(t,"_states",dy,v(t)),T(t,"_props",py,v(t)),t._passes=[],t._hash=0,t}_(t,e),t.getHash=function(e){for(var t,i=0,n=E(e.passes);!(t=n()).done;)i^=t.value.hash;return i};var i=t.prototype;return i.initialize=function(e){this._passes.length?Y(12005):(this._defines||(this._defines=[]),this._states||(this._states=[]),this._props||(this._props=[]),this._fillInfo(e),this._update())},i.reset=function(e){this.initialize(e)},i.destroy=function(){return this._doDestroy(),e.prototype.destroy.call(this)},i.recompileShaders=function(){console.warn("Shaders in material asset '"+this.name+"' cannot be modified at runtime, please instantiate the material first.")},i.overridePipelineStates=function(){console.warn("Pipeline states in material asset '"+this.name+"' cannot be modified at runtime, please instantiate the material first.")},i.onLoaded=function(){this._update()},i.resetUniforms=function(e){void 0===e&&(e=!0),this._props.length=this._passes.length;for(var t=0;t<this._props.length;t++)this._props[t]={};if(e)for(var i,n=E(this._passes);!(i=n()).done;){var r=i.value;r.resetUBOs(),r.resetTextures()}},i.setProperty=function(e,t,i){var n=!1;if(void 0===i)for(var r=this._passes,s=r.length,a=0;a<s;a++){var o=r[a];this._uploadProperty(o,e,t)&&(this._props[o.propertyIndex][e]=t,n=!0)}else{if(i>=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<n;r++){var s=i[r];if(e in s)return s[e]}else{if(t>=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;i<e._props.length;i++)this._props[i]=l({},e._props[i]);this._defines.length=e._defines.length;for(var n=0;n<e._defines.length;n++)this._defines[n]=l({},e._defines[n]);this._states.length=e._states.length;for(var r=0;r<e._states.length;r++)this._states[r]=l({},e._states[r]);this._effectAsset=e._effectAsset,t&&this._fillInfo(t),this._update()},i._fillInfo=function(e){void 0!==e.technique&&(this._techIdx=e.technique),e.effectAsset?this._effectAsset=e.effectAsset:e.effectName&&(this._effectAsset=Im.get(e.effectName)),e.defines&&this._prepareInfo(e.defines,this._defines),e.states&&this._prepareInfo(e.states,this._states)},i._prepareInfo=function(e,t){var i=e;if(!Array.isArray(i)){var n=this._effectAsset?this._effectAsset.techniques[this._techIdx].passes.length:1;i=Array(n).fill(i)}for(var r=0;r<i.length;++r)Object.assign(t[r]||(t[r]={}),i[r])},i._createPasses=function(){var e=this._effectAsset.techniques[this._techIdx||0];if(!e)return[];for(var t=e.passes.length,i=[],n=0;n<t;++n){var r=e.passes[n],s=r.passIndex=n,a=r.defines=this._defines[s]||(this._defines[s]={});if(r.stateOverrides=this._states[s]||(this._states[s]={}),void 0!==r.propertyIndex&&Object.assign(a,this._defines[r.propertyIndex]),void 0!==r.embeddedMacros&&Object.assign(a,r.embeddedMacros),!r.switch||a[r.switch]){var o=new iy(R.director.root);o.initialize(r),i.push(o)}}return i},i._update=function(e){var i=this;if(void 0===e&&(e=!0),this._effectAsset){this._passes=this._createPasses();var n=this._effectAsset.techniques[this._techIdx].passes.length;if(this._props.length=n,e)this._passes.forEach((function(e,t){var n=i._props[t];for(var r in n||(n=i._props[t]={}),void 0!==e.propertyIndex&&Object.assign(n,i._props[e.propertyIndex]),n)i._uploadProperty(e,r,n[r])}));else for(var r=0;r<this._props.length;r++)this._props[r]={}}this._hash=t.getHash(this)},i._uploadProperty=function(e,t,i){var n=e.getHandle(t);if(!n)return!1;if(iy.getTypeFromHandle(n)<yn.SAMPLER1D)if(Array.isArray(i))e.setUniformArray(n,i);else if(null!==i){var r;if(null===(r=e.properties[t])||void 0===r?void 0:r.linear){var s=i;ay(yy,s),yy.w=s.w,i=yy}e.setUniform(n,i)}else e.resetUniform(t);else if(Array.isArray(i))for(var a=0;a<i.length;a++)this._bindTexture(e,n,i[a],a);else i?this._bindTexture(e,n,i):e.resetTexture(t);return!0},i._bindTexture=function(e,t,i,n){var r=iy.getBindingFromHandle(t);if(i instanceof Ys)e.bindTexture(r,i,n);else if(i instanceof qm){var s=i.getGFXTexture();if(!s||!s.width||!s.height)return;e.bindTexture(r,s,n),e.bindSampler(r,i.getGFXSampler(),n)}},i._doDestroy=function(){if(this._passes&&this._passes.length)for(var e,t=E(this._passes);!(e=t()).done;)e.value.destroy();this._passes.length=0},i.initDefault=function(t){e.prototype.initDefault.call(this,t),this.initialize({effectName:"builtin-unlit",defines:{USE_COLOR:!0},technique:0}),this.setProperty("mainColor",new Fi("#ff00ff"))},i.validate=function(){return!!this._effectAsset&&!this._effectAsset.isDefault&&this.passes.length>0},c(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}(Cc),ly=A((cy=my).prototype,"_effectAsset",[uy],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),_y=A(cy.prototype,"_techIdx",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),fy=A(cy.prototype,"_defines",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),dy=A(cy.prototype,"_states",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),py=A(cy.prototype,"_props",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),hy=cy))||hy));function Ty(e,t){for(var i,n=E(t);!(i=n()).done;){var r=i.value;Array.isArray(r)?Ty(e,r):e.push(r)}}function Ay(e){var t=[];return Ty(t,e),t.join("")}R.Material=Ey,fe({replaceProperty:{since:"3.6.0",removed:!1},removeProperty:{since:"3.6.0",removed:!1},markAsWarning:{since:"3.6.0",removed:!1},setDefaultLogTimes:{since:"3.6.0",removed:!1}});var Sy=ca.Flags.Destroyed,by=ca.Flags.PersistentMask,wy=li.IDENTIFIER_RE,Ry="var ",Iy="o",Oy={"cc.ClickEvent":!1,"cc.PrefabInfo":!1},Ny=li.escapeForJS,Cy=function(){function e(e,t){this.varName=void 0,this.expression=void 0,this.varName=e,this.expression=t}return e.prototype.toString=function(){return Ry+this.varName+"="+this.expression+";"},e}();function My(e,t){return t instanceof Cy?new Cy(t.varName,e+t.expression):e+t}function xy(e,t,i){Array.isArray(i)?(i[0]=My(t,i[0]),e.push(i)):e.push(My(t,i)+";")}var Fy=function(){function e(e){this._exps=void 0,this._targetExp=void 0,this._exps=[],this._targetExp=e}var t=e.prototype;return t.append=function(e,t){this._exps.push([e,t])},t.writeCode=function(e){var t;if(this._exps.length>1)e.push("t="+this._targetExp+";"),t="t";else{if(1!==this._exps.length)return;t=this._targetExp}for(var i=0;i<this._exps.length;i++){var n=this._exps[i];xy(e,t+Py(n[0])+"=",n[1])}},e}();function Py(e){return wy.test(e)?"."+e:"["+Ny(e)+"]"}Fy.pool=void 0,Fy.pool=new ct((function(e){e._exps.length=0,e._targetExp=null}),1),Fy.pool.get=function(e){var t=this._get()||new Fy;return t._targetExp=e,t};var Dy=function(){function e(e,t){var i;this.parent=void 0,this.objsToClear_iN$t=void 0,this.codeArray=void 0,this.objs=void 0,this.funcs=void 0,this.funcModuleCache=void 0,this.globalVariables=void 0,this.globalVariableId=void 0,this.localVariableId=void 0,this.result=void 0,this.parent=t,this.objsToClear_iN$t=[],this.codeArray=[],this.objs=[],this.funcs=[],this.funcModuleCache=Pe(),je(this.funcModuleCache,Oy),this.globalVariables=[],this.globalVariableId=0,this.localVariableId=0,this.codeArray.push("var o,t;","if(R){","o=R;","}else{","o=R=new "+this.getFuncModule(e.constructor,!0)+"();","}"),e._iN$t={globalVar:"R"},this.objsToClear_iN$t.push(e),this.enumerateObject(this.codeArray,e),this.globalVariables.length>0&&(i=Ry+this.globalVariables.join(",")+";");var n=Ay(["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<s;++r)this.objsToClear_iN$t[r]._iN$t=null;this.objsToClear_iN$t.length=0}var t=e.prototype;return t.getFuncModule=function(e,t){var i=De(e);if(i){var n=this.funcModuleCache[i];if(n)return n;if(void 0===n){var r=-1!==i.indexOf(".");if(r)try{if(r=e===Function("return "+i)())return this.funcModuleCache[i]=i,i}catch(e){}}}var s=this.funcs.indexOf(e);s<0&&(s=this.funcs.length,this.funcs.push(e));var a="F["+s+"]";return t&&(a="("+a+")"),this.funcModuleCache[i]=a,a},t.getObjRef=function(e){var t=this.objs.indexOf(e);return t<0&&(t=this.objs.length,this.objs.push(e)),"O["+t+"]"},t.setValueType=function(e,t,i,n){var r=Fy.pool.get(n),s=t.constructor.__props__;s||(s=Object.keys(t));for(var a=0;a<s.length;a++){var o=s[a],u=i[o];if(t[o]!==u){var h=this.enumerateField(i,o,u);r.append(o,h)}}r.writeCode(e),Fy.pool.put(r)},t.enumerateCCClass=function(e,t,i){for(var n=i.__values__,r=kt(i),s=0;s<n.length;s++){var a=n[s],o=t[a],u=r[a+"$_$default"];if(!Ly(u,o))if("object"==typeof o&&o instanceof R.ValueType&&(u=li.getDefault(u))&&u.constructor===o.constructor){var h=Iy+Py(a);this.setValueType(e,u,o,h)}else this.setObjProp(e,t,a,o)}},t.instantiateArray=function(e){if(0===e.length)return"[]";var t="a"+ ++this.localVariableId,i=[new Cy(t,"new Array("+e.length+")")];e._iN$t={globalVar:"",source:i},this.objsToClear_iN$t.push(e);for(var n=0;n<e.length;++n)xy(i,t+"["+n+"]=",this.enumerateField(e,n,e[n]));return i},t.instantiateTypedArray=function(e){var t=e.constructor.name;if(0===e.length)return"new "+t;var i="a"+ ++this.localVariableId,n=[new Cy(i,"new "+t+"("+e.length+")")];e._iN$t={globalVar:"",source:n},this.objsToClear_iN$t.push(e);for(var r=0;r<e.length;++r)0!==e[r]&&xy(n,i+"["+r+"]=",e[r]);return n},t.enumerateField=function(e,t,i){if("object"==typeof i&&i){var n=i._iN$t;if(n){var r=n.globalVar;if(!r){r=n.globalVar="v"+ ++this.globalVariableId,this.globalVariables.push(r);var s=n.source[0];n.source[0]=My(r+"=",s)}return r}return ArrayBuffer.isView(i)?this.instantiateTypedArray(i):Array.isArray(i)?this.instantiateArray(i):this.instantiateObj(i)}return"function"==typeof i?this.getFuncModule(i):"string"==typeof i?Ny(i):("_objFlags"===t&&_a(e)&&(i&=by),i)},t.setObjProp=function(e,t,i,n){xy(e,Iy+Py(i)+"=",this.enumerateField(t,i,n))},t.enumerateObject=function(e,t){var i=t.constructor;if(_i(i))this.enumerateCCClass(e,t,i);else for(var n in t)if(t.hasOwnProperty(n)&&(95!==n.charCodeAt(0)||95!==n.charCodeAt(1)||"__type__"===n)){var r=t[n];"object"==typeof r&&r&&r===t._iN$t||this.setObjProp(e,t,n,r)}},t.instantiateObj=function(e){if(e instanceof R.ValueType)return li.getNewValueTypeCode(e);if(e instanceof R.Asset)return this.getObjRef(e);if(e._objFlags&Sy)return null;var t,i=e.constructor;if(_i(i)){if(this.parent)if(this.parent instanceof R.Component){if(e instanceof R._BaseNode||e instanceof R.Component)return this.getObjRef(e)}else if(this.parent instanceof R._BaseNode)if(e instanceof R._BaseNode){if(!e.isChildOf(this.parent))return this.getObjRef(e)}else if(e instanceof R.Component){var n;if(!(null===(n=e.node)||void 0===n?void 0:n.isChildOf(this.parent)))return this.getObjRef(e)}t=new Cy(Iy,"new "+this.getFuncModule(i,!0)+"()")}else if(i===Object)t=new Cy(Iy,"{}");else{if(i)return this.getObjRef(e);t=new Cy(Iy,"Object.create(null)")}var r=[t];return e._iN$t={globalVar:"",source:r},this.objsToClear_iN$t.push(e),this.enumerateObject(r,e),["(function(){",r,"return o;})();"]},e}();function Ly(e,t){if("function"==typeof e)try{e=e()}catch(e){return!1}if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t&&e.constructor===t.constructor)if(e instanceof R.ValueType){if(e.equals(t))return!0}else{if(Array.isArray(e))return 0===e.length&&0===t.length;if(e.constructor===Object)return Oe(e)&&Oe(t)}return!1}var By,Uy,Gy,zy,ky,Hy,Vy,Wy,jy,Xy,Yy=function(){function e(e){this._uiComp=null,this._opacity=1,this._localOpacity=1,this.colorDirty=!0,this._uiTransformComp=null,this._node=void 0,this._node=e}return e.prototype.applyOpacity=function(e){this._opacity=this._localOpacity*e},e.markOpacityTree=function(){},c(e,[{key:"uiTransformComp",get:function(){return this._uiTransformComp||(this._uiTransformComp=this._node.getComponent("cc.UITransform")),this._uiTransformComp},set:function(e){this._uiTransformComp=e}},{key:"uiComp",get:function(){return this._uiComp},set:function(e){this._uiComp&&e?Y(12002):this._uiComp=e}},{key:"opacity",get:function(){return this._opacity}},{key:"localOpacity",get:function(){return this._localOpacity},set:function(e){this._localOpacity=e,this.colorDirty=!0}}]),e}();ca.Flags.Destroying,function(e){e.TOUCH_START="touch-start",e.TOUCH_MOVE="touch-move",e.TOUCH_END="touch-end",e.TOUCH_CANCEL="touch-cancel",e.MOUSE_DOWN="mouse-down",e.MOUSE_MOVE="mouse-move",e.MOUSE_UP="mouse-up",e.MOUSE_WHEEL="mouse-wheel",e.MOUSE_ENTER="mouse-enter",e.MOUSE_LEAVE="mouse-leave",e.KEY_DOWN="keydown",e.KEY_UP="keyup",e.DEVICEMOTION="devicemotion",e.TRANSFORM_CHANGED="transform-changed",e.SCENE_CHANGED_FOR_PERSISTS="scene-changed-for-persists",e.SIZE_CHANGED="size-changed",e.ANCHOR_CHANGED="anchor-changed",e.COLOR_CHANGED="color-changed",e.CHILD_ADDED="child-added",e.CHILD_REMOVED="child-removed",e.PARENT_CHANGED="parent-changed",e.NODE_DESTROYED="node-destroyed",e.LAYER_CHANGED="layer-changed",e.SIBLING_ORDER_CHANGED="sibling-order-changed",e.ACTIVE_IN_HIERARCHY_CHANGED="active-in-hierarchy-changed",e.COMPONENT_ADDED="component-added",e.COMPONENT_REMOVED="component-removed"}(By||(By=e("ea",{})));var qy=ca.Flags.Destroying,Ky=ca.Flags.DontDestroy,Qy=ca.Flags.Deactivating,Zy=new Ae("Node");function Jy(e){return e?"string"==typeof e?ot(e):e:(K(3804),null)}var $y,eE,tE,iE,nE,rE,sE,aE,oE,uE,hE,cE,lE,_E=e("hy",th("cc.BaseNode")((Xy=jy=function(e){_(i,e),i._setScene=function(e){e._updateScene()},i._findComponent=function(e,t){var i=t,n=e._components;if(i._sealed)for(var r=0;r<n.length;++r){var s=n[r];if(s.constructor===t)return s}else for(var a=0;a<n.length;++a){var o=n[a];if(o instanceof t)return o}return null},i._findComponents=function(e,t,i){var n=t,r=e._components;if(n._sealed)for(var s=0;s<r.length;++s){var a=r[s];a.constructor===t&&i.push(a)}else for(var o=0;o<r.length;++o){var u=r[o];u instanceof t&&i.push(u)}},i._findChildComponent=function(e,t){for(var n=0;n<e.length;++n){var r=e[n],s=i._findComponent(r,t);if(s)return s;if(r._children.length>0&&(s=i._findChildComponent(r._children,t)))return s}return null},i._findChildComponents=function(e,t,n){for(var r=0;r<e.length;++r){var s=e[r];i._findComponents(s,t,n),s._children.length>0&&i._findChildComponents(s._children,t,n)}};var t=i.prototype;function i(t){var i;return T(i=e.call(this,t)||this,"_parent",zy,v(i)),T(i,"_children",ky,v(i)),T(i,"_active",Hy,v(i)),T(i,"_components",Vy,v(i)),T(i,"_prefab",Wy,v(i)),i._scene=null,i._activeInHierarchy=!1,i._id=Zy.getNewId(),i._name=void 0,i._eventProcessor=new R.NodeEventProcessor(v(i)),i._eventMask=0,i._siblingIndex=0,i._originalSceneId="",i._name=void 0!==t?t:"New Node",i}return t._updateScene=function(){null==this._parent?U("Node %s(%s) has not attached to a scene.",this.name,this.uuid):this._scene=this._parent._scene},t.attr=function(e){je(this,e)},t.getParent=function(){return this._parent},t.setParent=function(e,t){if(void 0===t&&(t=!1),this._parent!==e){var i=this._parent,n=e;if(this._parent=n,this._siblingIndex=0,this._onSetParent(i,t),this.emit&&this.emit(By.PARENT_CHANGED,i),i&&!(i._objFlags&qy)){var r=i._children.indexOf(this);i._children.splice(r,1),i._updateSiblingIndex(),i.emit&&i.emit(By.CHILD_REMOVED,this)}n&&(n._children.push(this),this._siblingIndex=n._children.length-1,n.emit&&n.emit(By.CHILD_ADDED,this)),this._onHierarchyChanged(i)}},t.getChildByUuid=function(e){if(!e)return L("Invalid uuid"),null;for(var t=this._children,i=0,n=t.length;i<n;i++)if(t[i]._id===e)return t[i];return null},t.getChildByName=function(e){if(!e)return L("Invalid name"),null;for(var t=this._children,i=0,n=t.length;i<n;i++)if(t[i]._name===e)return t[i];return null},t.getChildByPath=function(e){for(var t=e.split("/"),i=this,n=function(e){var n=t[e];if(0===n.length)return"continue";var r=i.children.find((function(e){return e.name===n}));if(!r)return{v:null};i=r},r=0;r<t.length;++r){var s=n(r);if("continue"!==s&&"object"==typeof s)return s.v}return i},t.addChild=function(e){e.setParent(this)},t.insertChild=function(e,t){e.setParent(this),e.setSiblingIndex(t)},t.getSiblingIndex=function(){return this._siblingIndex},t.setSiblingIndex=function(e){if(this._parent)if(this._parent._objFlags&Qy)K(3821);else{var t=this._parent._children;e=-1!==e?e:t.length-1;var i=t.indexOf(this);e!==i&&(t.splice(i,1),e<t.length?t.splice(e,0,this):t.push(this),this._parent._updateSiblingIndex(),this._onSiblingIndexChanged&&this._onSiblingIndexChanged(e))}},t.walk=function(e,t){var n=1,r=null,s=null,a=0,o=i._stacks[i._stackId];o||(o=[],i._stacks.push(o)),i._stackId++,o.length=0,o[0]=this;for(var u=null,h=!1;n;)if(s=o[--n])if(!h&&e?e(s):h&&t&&t(s),o[n]=null,h){if(u===this._parent)break;if(h=!1,r)if(r[++a])o[n]=r[a],n++;else if(u&&(o[n]=u,n++,h=!0,u._parent?(a=(r=u._parent._children).indexOf(u),u=u._parent):(u=null,r=null),a<0))break}else s._children.length>0?(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=Jy(e);return t?i._findComponent(this,t):null},t.getComponents=function(e){var t=Jy(e),n=[];return t&&i._findComponents(this,t,n),n},t.getComponentInChildren=function(e){var t=Jy(e);return t?i._findChildComponent(this._children,t):null},t.getComponentsInChildren=function(e){var t=Jy(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=ot(e)))throw R._RF.peek()&&K(3808,e),TypeError($(3807,e))}else{if(!e)throw TypeError($(3804));t=e}if("function"!=typeof t)throw TypeError($(3809));if(!qe(t,R.Component))throw TypeError($(3810));var i=t._requireComponent;if(i)if(Array.isArray(i))for(var n=0;n<i.length;n++){var r=i[n];this.getComponent(r)||this.addComponent(r)}else{var s=i;this.getComponent(s)||this.addComponent(s)}var a=new t;return a.node=this,this._components.push(a),this.emit(By.COMPONENT_ADDED,a),this._activeInHierarchy&&R.director._nodeActivator.activateComp(a),a},t.removeComponent=function(e){if(e){var t=null;(t=e instanceof ll?e:this.getComponent(e))&&t.destroy()}else K(3813)},t.on=function(e,t,i,n){switch(void 0===n&&(n=!1),e){case By.TRANSFORM_CHANGED:this._eventMask|=1}this._eventProcessor.on(e,t,i,n)},t.off=function(e,t,i,n){if(void 0===n&&(n=!1),this._eventProcessor.off(e,t,i,n),!this._eventProcessor.hasEventListener(e))switch(e){case By.TRANSFORM_CHANGED:this._eventMask&=-2}},t.once=function(e,t,i,n){this._eventProcessor.once(e,t,i,n)},t.emit=function(e,t,i,n,r,s){this._eventProcessor.emit(e,t,i,n,r,s)},t.dispatchEvent=function(e){this._eventProcessor.dispatchEvent(e)},t.hasEventListener=function(e,t,i){return this._eventProcessor.hasEventListener(e,t,i)},t.targetOff=function(e){this._eventProcessor.targetOff(e),1&this._eventMask&&!this._eventProcessor.hasEventListener(By.TRANSFORM_CHANGED)&&(this._eventMask&=-2)},t.destroy=function(){return!!e.prototype.destroy.call(this)&&(this.active=!1,!0)},t.destroyAllChildren=function(){for(var e=this._children,t=0;t<e.length;++t)e[t].destroy()},t._removeComponent=function(e){if(e){if(!(this._objFlags&qy)){var t=this._components.indexOf(e);-1!==t?(this._components.splice(t,1),this.emit(By.COMPONENT_REMOVED,e)):e.node!==this&&K(3815)}}else K(3814)},t._updateSiblingIndex=function(){for(var e=0;e<this._children.length;++e)this._children[e]._siblingIndex=e;this.emit(By.SIBLING_ORDER_CHANGED)},t._onSetParent=function(e){this._parent&&(null!=e&&e._scene===this._parent._scene||null==this._parent._scene||this.walk(i._setScene))},t._onPostActivated=function(){},t._onBatchCreated=function(){this._parent&&(this._siblingIndex=this._parent._children.indexOf(this))},t._onPreDestroy=function(){this._onPreDestroyBase()},t._onHierarchyChanged=function(e){return this._onHierarchyChangedBase(e)},t._instantiate=function(e,t){return e||(e=R.instantiate._clone(this,this)),e._prefab,e._parent=null,e._onBatchCreated(t),e},t._onHierarchyChangedBase=function(){var e=this._parent;!this._persistNode||e instanceof R.Scene||R.game.removePersistRootNode(this);var t=this._active&&!(!e||!e._activeInHierarchy);this._activeInHierarchy!==t&&R.director._nodeActivator.activateNode(this,t)},t._onPreDestroyBase=function(){this._objFlags|=qy;var e=this._parent,t=!!e&&0!=(e._objFlags&qy);if(!t&&b&&this._registerIfAttached(!1),this._persistNode&&R.game.removePersistRootNode(this),!t&&e){this.emit(By.PARENT_CHANGED,this);var i=e._children.indexOf(this);e._children.splice(i,1),this._siblingIndex=0,e._updateSiblingIndex(),e.emit&&e.emit(By.CHILD_REMOVED,this)}this.emit(By.NODE_DESTROYED,this),this._eventProcessor.destroy();for(var n=this._children,r=0;r<n.length;++r)n[r]._destroyImmediate();for(var s=this._components,a=0;a<s.length;++a)s[a]._destroyImmediate();return t},c(i,[{key:"components",get:function(){return this._components}},{key:"_persistNode",get:function(){return(this._objFlags&Ky)>0},set:function(e){e?this._objFlags|=Ky:this._objFlags&=~Ky}},{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&&R.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}}]),i}(ca),jy.idGenerator=Zy,jy._stacks=[[]],jy._stackId=0,A((Gy=Xy).prototype,"_persistNode",[sh],Object.getOwnPropertyDescriptor(Gy.prototype,"_persistNode"),Gy.prototype),A(Gy.prototype,"name",[Eh],Object.getOwnPropertyDescriptor(Gy.prototype,"name"),Gy.prototype),A(Gy.prototype,"children",[Eh],Object.getOwnPropertyDescriptor(Gy.prototype,"children"),Gy.prototype),A(Gy.prototype,"active",[Eh],Object.getOwnPropertyDescriptor(Gy.prototype,"active"),Gy.prototype),A(Gy.prototype,"activeInHierarchy",[Eh],Object.getOwnPropertyDescriptor(Gy.prototype,"activeInHierarchy"),Gy.prototype),A(Gy.prototype,"parent",[Eh],Object.getOwnPropertyDescriptor(Gy.prototype,"parent"),Gy.prototype),zy=A(Gy.prototype,"_parent",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ky=A(Gy.prototype,"_children",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Hy=A(Gy.prototype,"_active",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),Vy=A(Gy.prototype,"_components",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Wy=A(Gy.prototype,"_prefab",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Uy=Gy))||Uy);R._BaseNode=_E,function(e){e[e.LOCAL=0]="LOCAL",e[e.WORLD=1]="WORLD"}($y||($y=e("hA",{}))),function(e){e[e.NONE=0]="NONE",e[e.POSITION=1]="POSITION",e[e.ROTATION=2]="ROTATION",e[e.SCALE=4]="SCALE",e[e.RS=e.ROTATION|e.SCALE]="RS",e[e.TRS=e.POSITION|e.ROTATION|e.SCALE]="TRS",e[e.TRS_MASK=~e.TRS]="TRS_MASK"}(eE||(eE=e("eW",{}))),R.internal.TransformBit=eE;var fE=new Di,dE=new Hi,pE=new Hi,mE=new Hi,gE=new Gi,vE=new Gi,yE=new Qi,EE=[],TE=Symbol("ReserveContentsForAllSyncablePrefab"),AE=0,SE=e("eO",(tE=th("cc.Node"),iE=Dh(Di),tE((lE=cE=function(e){function t(t){var i;return(i=e.call(this,t)||this)._uiProps=new Yy(v(i)),i._static=!1,T(i,"_lpos",sE,v(i)),T(i,"_lrot",aE,v(i)),T(i,"_lscale",oE,v(i)),T(i,"_layer",uE,v(i)),T(i,"_euler",hE,v(i)),i._dirtyFlags=eE.NONE,i._eulerDirty=!1,i._flagChangeVersion=0,i._hasChangedFlags=0,i._pos=new Di,i._rot=new Hi,i._scale=new Di(1,1,1),i._mat=new Qi,i}_(t,e),t.isNode=function(e){return e instanceof t&&(e.constructor===t||!(e instanceof R.Scene))};var i=t.prototype;return i._onPreDestroy=function(){return this._onPreDestroyBase()},i[pl]=function(e){e.writeThis()},i.setParent=function(t,i){void 0===i&&(i=!1),i&&this.updateWorldTransform(),e.prototype.setParent.call(this,t,i)},i._onSetParent=function(t,i){if(e.prototype._onSetParent.call(this,t,i),i){var n=this._parent;n?(n.updateWorldTransform(),vi(Qi.determinant(n._mat),0,gi)?(Y(14300),this._dirtyFlags|=eE.TRS,this.updateWorldTransform()):(Qi.multiply(yE,Qi.invert(yE,n._mat),this._mat),Qi.toRTS(yE,this._lrot,this._lpos,this._lscale))):(Di.copy(this._lpos,this._pos),Hi.copy(this._lrot,this._rot),Di.copy(this._lscale,this._scale)),this._eulerDirty=!0}this.invalidateChildren(eE.TRS)},i._onHierarchyChanged=function(t){this.eventProcessor.reattach(),e.prototype._onHierarchyChangedBase.call(this,t)},i._onBatchCreated=function(e){this.hasChangedFlags=eE.TRS,this._dirtyFlags|=eE.TRS;for(var t=this._children.length,i=0;i<t;++i)this._children[i]._siblingIndex=i,this._children[i]._onBatchCreated(e)},i._onBeforeSerialize=function(){this.eulerAngles},i._onPostActivated=function(e){e?(this._eventProcessor.setEnabled(!0),this.invalidateChildren(eE.TRS),this._uiProps&&this._uiProps.uiComp&&(this._uiProps.uiComp.setNodeDirty(),this._uiProps.uiComp.setTextureDirty(),this._uiProps.uiComp.markForUpdateRenderData())):this._eventProcessor.setEnabled(!1)},i.translate=function(e,t){var i=t||$y.LOCAL;if(i===$y.LOCAL)Di.transformQuat(fE,e,this._lrot),this._lpos.x+=fE.x,this._lpos.y+=fE.y,this._lpos.z+=fE.z;else if(i===$y.WORLD)if(this._parent){Hi.invert(dE,this._parent.worldRotation),Di.transformQuat(fE,e,dE);var n=this.worldScale;this._lpos.x+=fE.x/n.x,this._lpos.y+=fE.y/n.y,this._lpos.z+=fE.z/n.z}else this._lpos.x+=e.x,this._lpos.y+=e.y,this._lpos.z+=e.z;this.invalidateChildren(eE.POSITION),1&this._eventMask&&this.emit(By.TRANSFORM_CHANGED,eE.POSITION)},i.rotate=function(e,t){var i=t||$y.LOCAL;if(Hi.normalize(dE,e),i===$y.LOCAL)Hi.multiply(this._lrot,this._lrot,dE);else if(i===$y.WORLD){var n=this.worldRotation;Hi.multiply(pE,dE,n),Hi.invert(dE,n),Hi.multiply(pE,dE,pE),Hi.multiply(this._lrot,this._lrot,pE)}this._eulerDirty=!0,this.invalidateChildren(eE.ROTATION),1&this._eventMask&&this.emit(By.TRANSFORM_CHANGED,eE.ROTATION)},i.lookAt=function(e,t){this.getWorldPosition(fE),Di.subtract(fE,fE,e),Di.normalize(fE,fE),Hi.fromViewUp(dE,fE,t),this.setWorldRotation(dE)},i.invalidateChildren=function(e){var t,i,n=0,r=0,s=0,a=0,o=e|eE.POSITION;for(EE[0]=this;n>=0;){if(a=(t=EE[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<s;r++)EE[++n]=i[r];e=o}},i.updateWorldTransform=function(){if(this._dirtyFlags){for(var e,t=this,i=0;t&&t._dirtyFlags;)EE[i++]=t,t=t._parent;for(var n=0;i;)n|=(e=EE[--i])._dirtyFlags,t?(n&eE.POSITION&&(Di.transformMat4(e._pos,e._lpos,t._mat),e._mat.m12=e._pos.x,e._mat.m13=e._pos.y,e._mat.m14=e._pos.z),n&eE.RS&&(Qi.fromRTS(e._mat,e._lrot,e._lpos,e._lscale),Qi.multiply(e._mat,t._mat,e._mat),n&eE.ROTATION&&Hi.multiply(e._rot,t._rot,e._lrot),Gi.fromQuat(gE,Hi.conjugate(mE,e._rot)),Gi.multiplyMat4(gE,gE,e._mat),e._scale.x=gE.m00,e._scale.y=gE.m04,e._scale.z=gE.m08)):(n&eE.POSITION&&(Di.copy(e._pos,e._lpos),e._mat.m12=e._pos.x,e._mat.m13=e._pos.y,e._mat.m14=e._pos.z),n&eE.RS&&(n&eE.ROTATION&&Hi.copy(e._rot,e._lrot),n&eE.SCALE&&(Di.copy(e._scale,e._lscale),Qi.fromRTS(e._mat,e._rot,e._pos,e._scale)))),e._dirtyFlags=eE.NONE,t=e}},i.setPosition=function(e,t,i){void 0===t&&void 0===i?Di.copy(this._lpos,e):void 0===i?Di.set(this._lpos,e,t,this._lpos.z):Di.set(this._lpos,e,t,i),this.invalidateChildren(eE.POSITION),1&this._eventMask&&this.emit(By.TRANSFORM_CHANGED,eE.POSITION)},i.getPosition=function(e){return e?Di.set(e,this._lpos.x,this._lpos.y,this._lpos.z):Di.copy(new Di,this._lpos)},i.setRotation=function(e,t,i,n){void 0===t||void 0===i||void 0===n?Hi.copy(this._lrot,e):Hi.set(this._lrot,e,t,i,n),this._eulerDirty=!0,this.invalidateChildren(eE.ROTATION),1&this._eventMask&&this.emit(By.TRANSFORM_CHANGED,eE.ROTATION)},i.setRotationFromEuler=function(e,t,i){var n=void 0===i?this._euler.z:i;void 0===t?(Di.copy(this._euler,e),Hi.fromEuler(this._lrot,e.x,e.y,e.z)):(Di.set(this._euler,e,t,n),Hi.fromEuler(this._lrot,e,t,n)),this._eulerDirty=!1,this.invalidateChildren(eE.ROTATION),1&this._eventMask&&this.emit(By.TRANSFORM_CHANGED,eE.ROTATION)},i.getRotation=function(e){return e?Hi.set(e,this._lrot.x,this._lrot.y,this._lrot.z,this._lrot.w):Hi.copy(new Hi,this._lrot)},i.setScale=function(e,t,i){void 0===t&&void 0===i?Di.copy(this._lscale,e):void 0===i?Di.set(this._lscale,e,t,this._lscale.z):Di.set(this._lscale,e,t,i),this.invalidateChildren(eE.SCALE),1&this._eventMask&&this.emit(By.TRANSFORM_CHANGED,eE.SCALE)},i.getScale=function(e){return e?Di.set(e,this._lscale.x,this._lscale.y,this._lscale.z):Di.copy(new Di,this._lscale)},i.inverseTransformPoint=function(e,t){Di.copy(e,t);for(var i=this,n=0;i._parent;)EE[n++]=i,i=i._parent;for(;n>=0;)Di.transformInverseRTS(e,e,i._lrot,i._lpos,i._lscale),i=EE[--n];return e},i.setWorldPosition=function(e,t,i){void 0===t||void 0===i?Di.copy(this._pos,e):Di.set(this._pos,e,t,i);var n=this._parent,r=this._lpos;n?(n.updateWorldTransform(),Di.transformMat4(r,this._pos,Qi.invert(yE,n._mat))):Di.copy(r,this._pos),this.invalidateChildren(eE.POSITION),1&this._eventMask&&this.emit(By.TRANSFORM_CHANGED,eE.POSITION)},i.getWorldPosition=function(e){return this.updateWorldTransform(),e?Di.copy(e,this._pos):Di.copy(new Di,this._pos)},i.setWorldRotation=function(e,t,i,n){void 0===t||void 0===i||void 0===n?Hi.copy(this._rot,e):Hi.set(this._rot,e,t,i,n),this._parent?(this._parent.updateWorldTransform(),Hi.multiply(this._lrot,Hi.conjugate(this._lrot,this._parent._rot),this._rot)):Hi.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(eE.ROTATION),1&this._eventMask&&this.emit(By.TRANSFORM_CHANGED,eE.ROTATION)},i.setWorldRotationFromEuler=function(e,t,i){Hi.fromEuler(this._rot,e,t,i),this._parent?(this._parent.updateWorldTransform(),Hi.multiply(this._lrot,Hi.conjugate(this._lrot,this._parent._rot),this._rot)):Hi.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(eE.ROTATION),1&this._eventMask&&this.emit(By.TRANSFORM_CHANGED,eE.ROTATION)},i.getWorldRotation=function(e){return this.updateWorldTransform(),e?Hi.copy(e,this._rot):Hi.copy(new Hi,this._rot)},i.setWorldScale=function(e,t,i){void 0===t||void 0===i?Di.copy(this._scale,e):Di.set(this._scale,e,t,i);var n=this._parent;n?(n.updateWorldTransform(),Gi.fromQuat(gE,Hi.conjugate(mE,n._rot)),Gi.multiplyMat4(gE,gE,n._mat),vE.m00=this._scale.x,vE.m04=this._scale.y,vE.m08=this._scale.z,Gi.multiply(gE,vE,Gi.invert(gE,gE)),this._lscale.x=Di.set(fE,gE.m00,gE.m01,gE.m02).length(),this._lscale.y=Di.set(fE,gE.m03,gE.m04,gE.m05).length(),this._lscale.z=Di.set(fE,gE.m06,gE.m07,gE.m08).length()):Di.copy(this._lscale,this._scale),this.invalidateChildren(eE.SCALE),1&this._eventMask&&this.emit(By.TRANSFORM_CHANGED,eE.SCALE)},i.getWorldScale=function(e){return this.updateWorldTransform(),e?Di.copy(e,this._scale):Di.copy(new Di,this._scale)},i.getWorldMatrix=function(e){this.updateWorldTransform();var t=e||new Qi;return Qi.copy(t,this._mat)},i.getWorldRS=function(e){this.updateWorldTransform();var t=e||new Qi;return Qi.copy(t,this._mat),t.m12=0,t.m13=0,t.m14=0,t},i.getWorldRT=function(e){this.updateWorldTransform();var t=e||new Qi;return Qi.fromRT(t,this._rot,this._pos)},i.setRTS=function(e,t,i){var n=0;e&&(n|=eE.ROTATION,void 0!==e.w?(Hi.copy(this._lrot,e),this._eulerDirty=!0):(Di.copy(this._euler,e),Hi.fromEuler(this._lrot,e.x,e.y,e.z),this._eulerDirty=!1)),t&&(Di.copy(this._lpos,t),n|=eE.POSITION),i&&(Di.copy(this._lscale,i),n|=eE.SCALE),n&&(this.invalidateChildren(n),1&this._eventMask&&this.emit(By.TRANSFORM_CHANGED,n))},i.pauseSystemEvents=function(e){this._eventProcessor.setEnabled(!1,e)},i.resumeSystemEvents=function(e){this._eventProcessor.setEnabled(!0,e)},t.resetHasChangedFlags=function(){AE+=1},t.clearNodeArray=function(){t.ClearFrame<t.ClearRound&&!b?t.ClearFrame++:(t.ClearFrame=0,EE.length=0)},i.getPathInHierarchy=function(){for(var e=this.name,i=this.parent;i&&i instanceof t;)e=i.name+"/"+e,i=i.parent;return e},c(t,[{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&&(Hi.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){Di.set(this._euler,0,0,e),Hi.fromAngleZ(this._lrot,e),this._eulerDirty=!1,this.invalidateChildren(eE.ROTATION),1&this._eventMask&&this.emit(By.TRANSFORM_CHANGED,eE.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){Qi.toRTS(e,this._lrot,this._lpos,this._lscale),this.invalidateChildren(eE.TRS),this._eulerDirty=!0,1&this._eventMask&&this.emit(By.TRANSFORM_CHANGED,eE.TRS)}},{key:"worldMatrix",get:function(){return this.updateWorldTransform(),this._mat}},{key:"forward",get:function(){return Di.transformQuat(new Di,Di.FORWARD,this.worldRotation)},set:function(e){var t=e.length();Di.multiplyScalar(fE,e,-1/t),Hi.fromViewUp(dE,fE),this.setWorldRotation(dE)}},{key:"up",get:function(){return Di.transformQuat(new Di,Di.UP,this.worldRotation)}},{key:"right",get:function(){return Di.transformQuat(new Di,Di.RIGHT,this.worldRotation)}},{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(By.LAYER_CHANGED,this._layer)}},{key:"hasChangedFlags",get:function(){return this._flagChangeVersion===AE?this._hasChangedFlags:0},set:function(e){this._flagChangeVersion=AE,this._hasChangedFlags=e}}]),t}(_E),cE.EventType=By,cE.NodeSpace=$y,cE.TransformDirtyBit=eE,cE.TransformBit=eE,cE.reserveContentsForAllSyncablePrefabTag=TE,cE.ClearFrame=0,cE.ClearRound=1e3,sE=A((rE=lE).prototype,"_lpos",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Di}}),aE=A(rE.prototype,"_lrot",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Hi}}),oE=A(rE.prototype,"_lscale",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Di(1,1,1)}}),uE=A(rE.prototype,"_layer",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return bd.Enum.DEFAULT}}),hE=A(rE.prototype,"_euler",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Di}}),A(rE.prototype,"eulerAngles",[iE],Object.getOwnPropertyDescriptor(rE.prototype,"eulerAngles"),rE.prototype),A(rE.prototype,"angle",[Eh],Object.getOwnPropertyDescriptor(rE.prototype,"angle"),rE.prototype),A(rE.prototype,"layer",[Eh],Object.getOwnPropertyDescriptor(rE.prototype,"layer"),rE.prototype),nE=rE))||nE));R.Node=SE,li.Attr.setClassAttr(ul,"target","type","Object"),li.Attr.setClassAttr(ul,"target","ctor",SE);var bE,wE=e("c_",function(){function e(){this._id="",this._priority=0,this._executeInEditMode=!1}e.sortByPriority=function(e,t){return e._priority<t._priority?1:e._priority>t.priority?-1:0};var t=e.prototype;return t.init=function(){},t.update=function(){},t.postUpdate=function(){},t.destroy=function(){},c(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}());wE.Priority=dt({LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:1<<31>>>0});var RE=new Vr;RE.format=gn.RGBA8;var IE=new Wr;IE.format=gn.DEPTH_STENCIL;var OE,NE,CE,ME,xE,FE=new Yr([RE],IE),PE={width:1,height:1,renderPassInfo:FE},DE=e("eL",th("cc.RenderTexture")(bE=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._window=null,t}_(t,e);var i=t.prototype;return i.initialize=function(e){this._name=e.name||"",this._width=e.width,this._height=e.height,this._initWindow(e)},i.reset=function(e){this.initialize(e)},i.destroy=function(){if(this._window){var t=R.director.root;null==t||t.destroyWindow(this._window),this._window=null}return e.prototype.destroy.call(this)},i.resize=function(e,t){this._width=Math.floor(yi(e,1,2048)),this._height=Math.floor(yi(t,1,2048)),this._window&&this._window.resize(this._width,this._height),this.emit("resize",this._window)},i._serialize=function(){return{}},i._deserialize=function(t,i){var n=t;this._width=n.w,this._height=n.h,this._name=n.n,e.prototype._deserialize.call(this,n.base,i)},i.getGFXTexture=function(){return this._window&&this._window.framebuffer.colorTextures[0]},i.onLoaded=function(){this._initWindow()},i._initWindow=function(e){var t=R.director.root;PE.title=this._name,PE.width=this._width,PE.height=this._height,PE.renderPassInfo=e&&e.passInfo?e.passInfo:FE,RE.barrier=Va.gfxDevice.getGeneralBarrier(new qr(zn.FRAGMENT_SHADER_READ_TEXTURE,zn.FRAGMENT_SHADER_READ_TEXTURE)),this._window?(this._window.destroy(),this._window.initialize(Va.gfxDevice,PE)):this._window=t.createWindow(PE)},i.initDefault=function(t){e.prototype.initDefault.call(this,t),this._width=this._height=1,this._initWindow()},i.validate=function(){return this.width>=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 K(7606),null;var a=4*i*n;if(void 0===r)r=new Uint8Array(a);else if(r.length<a)return K(7607,a),null;var o=this._getGFXDevice(),u=[],h=[],c=new gr;return c.texOffset.x=e,c.texOffset.y=t,c.texExtent.width=i,c.texExtent.height=n,h.push(c),u.push(r),null==o||o.copyTextureToBuffers(s,u,h),r},c(t,[{key:"window",get:function(){return this._window}}]),t}(qm))||bE);R.RenderTexture=DE,function(e){e[e.VERTICAL=0]="VERTICAL",e[e.HORIZONTAL=1]="HORIZONTAL"}(OE||(OE=e("cu",{}))),function(e){e[e.ORTHO=0]="ORTHO",e[e.PERSPECTIVE=1]="PERSPECTIVE"}(NE||(NE=e("cv",{}))),function(e){e[e.F1_8=0]="F1_8",e[e.F2_0=1]="F2_0",e[e.F2_2=2]="F2_2",e[e.F2_5=3]="F2_5",e[e.F2_8=4]="F2_8",e[e.F3_2=5]="F3_2",e[e.F3_5=6]="F3_5",e[e.F4_0=7]="F4_0",e[e.F4_5=8]="F4_5",e[e.F5_0=9]="F5_0",e[e.F5_6=10]="F5_6",e[e.F6_3=11]="F6_3",e[e.F7_1=12]="F7_1",e[e.F8_0=13]="F8_0",e[e.F9_0=14]="F9_0",e[e.F10_0=15]="F10_0",e[e.F11_0=16]="F11_0",e[e.F13_0=17]="F13_0",e[e.F14_0=18]="F14_0",e[e.F16_0=19]="F16_0",e[e.F18_0=20]="F18_0",e[e.F20_0=21]="F20_0",e[e.F22_0=22]="F22_0"}(CE||(CE=e("cw",{}))),function(e){e[e.ISO100=0]="ISO100",e[e.ISO200=1]="ISO200",e[e.ISO400=2]="ISO400",e[e.ISO800=3]="ISO800"}(ME||(ME=e("cx",{}))),function(e){e[e.D1=0]="D1",e[e.D2=1]="D2",e[e.D4=2]="D4",e[e.D8=3]="D8",e[e.D15=4]="D15",e[e.D30=5]="D30",e[e.D60=6]="D60",e[e.D125=7]="D125",e[e.D250=8]="D250",e[e.D500=9]="D500",e[e.D1000=10]="D1000",e[e.D2000=11]="D2000",e[e.D4000=12]="D4000"}(xE||(xE=e("cy",{})));var LE,BE,UE,GE,zE,kE,HE,VE,WE,jE,XE,YE,qE,KE,QE,ZE,JE,$E,eT,tT,iT,nT,rT,sT,aT,oT,uT,hT,cT,lT,_T,fT,dT,pT,mT,gT,vT,yT,ET,TT,AT,ST,bT,wT,RT,IT,OT,NT,CT,MT,xT,FT,PT,DT,LT,BT,UT,GT,zT,kT,HT,VT,WT,jT,XT,YT,qT,KT,QT,ZT,JT=[1.8,2,2.2,2.5,2.8,3.2,3.5,4,4.5,5,5.6,6.3,7.1,8,9,10,11,13,14,16,18,20,22],$T=[1,.5,1/4,1/8,1/15,1/30,1/60,.008,.004,.002,.001,5e-4,1/4e3],eA=[100,200,400,800],tA=new Di,iA=new Di,nA=new Qi,rA=e("cz",$n.STENCIL<<1),sA=[],aA=e("cA",function(){function e(e){if(this.isWindowSize=!0,this.screenScale=void 0,this._device=void 0,this._scene=null,this._node=null,this._name=null,this._enabled=!1,this._proj=-1,this._aspect=void 0,this._orthoHeight=10,this._fovAxis=OE.VERTICAL,this._fov=Ai(45),this._nearClip=1,this._farClip=1e3,this._clearColor=new yr(.2,.2,.2,1),this._viewport=new cn(0,0,1,1),this._orientedViewport=new cn(0,0,1,1),this._curTransform=pn.IDENTITY,this._isProjDirty=!0,this._matView=new Qi,this._matProj=new Qi,this._matProjInv=new Qi,this._matViewProj=new Qi,this._matViewProjInv=new Qi,this._frustum=new zu,this._forward=new Di,this._position=new Di,this._priority=0,this._aperture=CE.F16_0,this._apertureValue=void 0,this._shutter=xE.D125,this._shutterValue=0,this._iso=ME.ISO100,this._isoValue=0,this._window=null,this._width=1,this._height=1,this._clearFlag=$n.NONE,this._clearDepth=1,this._visibility=jp,this._exposure=0,this._clearStencil=0,this._geometryRenderer=null,this._device=e,this._apertureValue=JT[this._aperture],this._shutterValue=$T[this._shutter],this._isoValue=eA[this._iso],this._aspect=this.screenScale=1,this._frustum.accurate=!0,!sA.length){var t=e.capabilities.clipSpaceSignY;sA[pn.IDENTITY]=new Qi(1,0,0,0,0,t),sA[pn.ROTATE_90]=new Qi(0,1,0,0,-t,0),sA[pn.ROTATE_180]=new Qi(-1,0,0,0,0,-t),sA[pn.ROTATE_270]=new Qi(0,-1,0,0,t,0)}}var t=e.prototype;return t._updateAspect=function(e){if(void 0===e&&(e=!0),this._aspect=this.window.width*this._viewport.width/(this.window.height*this._viewport.height),e){var t=this.window.swapchain;(t&&t.surfaceTransform||pn.IDENTITY)%2&&(this._aspect=1/this._aspect)}this._isProjDirty=!0},t.initialize=function(e){this.node=e.node,this._width=1,this._height=1,this.clearFlag=$n.NONE,this.clearDepth=1,this.visibility=jp,this._name=e.name,this._proj=e.projection,this._priority=e.priority||0,this._aspect=this.screenScale=1,this.updateExposure(),this.changeTargetWindow(e.window)},t.destroy=function(){var e;this._node=null,this.detachFromScene(),this._window&&(this._window.detachCamera(this),this.window=null),this._name=null,null===(e=this._geometryRenderer)||void 0===e||e.destroy()},t.attachToScene=function(e){this._enabled=!0,this._scene=e},t.detachFromScene=function(){this._enabled=!1,this._scene=null},t.resize=function(e,t){this._window&&(this._width=e,this._width=e,this._height=t,this._aspect=e*this._viewport.width/(t*this._viewport.height),this._isProjDirty=!0)},t.setFixedSize=function(e,t){this._width=e,this._height=t,this._updateAspect(),this.isWindowSize=!1},t.syncCameraEditor=function(){},t.update=function(e){var t;if(void 0===e&&(e=!1),this._node){var i=!1;(this._node.hasChangedFlags||e)&&(Qi.invert(this._matView,this._node.worldMatrix),this._forward.x=-this._matView.m02,this._forward.y=-this._matView.m06,this._forward.z=-this._matView.m10,Qi.multiply(this._matView,(new Qi).scale(this._node.worldScale),this._matView),this._node.getWorldPosition(this._position),i=!0);var n=null===(t=this.window)||void 0===t?void 0:t.swapchain,r=n&&n.surfaceTransform||pn.IDENTITY;if(this._isProjDirty||this._curTransform!==r){this._curTransform=r;var s=this._device.capabilities.clipSpaceSignY;if(this._proj===NE.PERSPECTIVE)Qi.perspective(this._matProj,this._fov,this._aspect,this._nearClip,this._farClip,this._fovAxis===OE.VERTICAL,this._device.capabilities.clipSpaceMinZ,s,r);else{var a=this._orthoHeight*this._aspect,o=this._orthoHeight;Qi.ortho(this._matProj,-a,a,-o,o,this._nearClip,this._farClip,this._device.capabilities.clipSpaceMinZ,s,r)}Qi.invert(this._matProjInv,this._matProj),i=!0,this._isProjDirty=!1}i&&(Qi.multiply(this._matViewProj,this._matProj,this._matView),Qi.invert(this._matViewProjInv,this._matViewProj),this._frustum.update(this._matViewProj,this._matViewProjInv))}},t.setViewportInOrientedSpace=function(e){var t,i=e.x,n=e.width,r=e.height,s=this._device.capabilities.screenSpaceSignY<0?1-e.y-r:e.y,a=null===(t=this.window)||void 0===t?void 0:t.swapchain;switch(a&&a.surfaceTransform||pn.IDENTITY){case pn.ROTATE_90:this._viewport.x=1-s-r,this._viewport.y=i,this._viewport.width=r,this._viewport.height=n;break;case pn.ROTATE_180:this._viewport.x=1-i-n,this._viewport.y=1-s-r,this._viewport.width=n,this._viewport.height=r;break;case pn.ROTATE_270:this._viewport.x=s,this._viewport.y=1-i-n,this._viewport.width=r,this._viewport.height=n;break;case pn.IDENTITY:this._viewport.x=i,this._viewport.y=s,this._viewport.width=n,this._viewport.height=r}this._orientedViewport.x=i,this._orientedViewport.y=s,this._orientedViewport.width=n,this._orientedViewport.height=r,this.resize(this.width,this.height)},t.initGeometryRenderer=function(){var e;this._geometryRenderer||(this._geometryRenderer=R.internal.GeometryRenderer?new R.internal.GeometryRenderer:null,null===(e=this._geometryRenderer)||void 0===e||e.activate(this._device))},t.changeTargetWindow=function(e){void 0===e&&(e=null),this._window&&this._window.detachCamera(this);var t=e||R.director.root.mainWindow;if(t){t.attachCamera(this),this.window=t;var i=t.swapchain;(i&&i.surfaceTransform||pn.IDENTITY)%2?this.resize(t.height,t.width):this.resize(t.width,t.height)}},t.detachCamera=function(){this._window&&this._window.detachCamera(this)},t.screenPointToRay=function(e,t,i){if(!this._node)return null;var n=this.width,r=this.height,s=this._orientedViewport.x*n,a=this._orientedViewport.y*r,o=this._orientedViewport.width*n,u=this._orientedViewport.height*r,h=this._proj===NE.PERSPECTIVE,c=this._device.capabilities.clipSpaceSignY,l=Ki[this._curTransform];Di.set(tA,(t-s)/o*2-1,(i-a)/u*2-1,h?1:-1);var _=tA.x,f=tA.y;return tA.x=_*l[0]+f*l[2]*c,tA.y=_*l[1]+f*l[3]*c,Di.transformMat4(h?tA:e.o,tA,this._matViewProjInv),h?(this._node.getWorldPosition(iA),no.fromPoints(e,iA,tA)):Di.transformQuat(e.d,Di.FORWARD,this._node.worldRotation),e},t.screenToWorld=function(e,t){var i=this.width,n=this.height,r=this._orientedViewport.x*i,s=this._orientedViewport.y*n,a=this._orientedViewport.width*i,o=this._orientedViewport.height*n,u=this._device.capabilities.clipSpaceSignY,h=Ki[this._curTransform];if(this._proj===NE.PERSPECTIVE){Di.set(e,(t.x-r)/a*2-1,(t.y-s)/o*2-1,1);var c=e.x,l=e.y;e.x=c*h[0]+l*h[2]*u,e.y=c*h[1]+l*h[3]*u,Di.transformMat4(e,e,this._matViewProjInv),this._node&&this._node.getWorldPosition(tA),Di.lerp(e,tA,e,Ti(this._nearClip/this._farClip,1,t.z))}else{Di.set(e,(t.x-r)/a*2-1,(t.y-s)/o*2-1,2*t.z-1);var _=e.x,f=e.y;e.x=_*h[0]+f*h[2]*u,e.y=_*h[1]+f*h[3]*u,Di.transformMat4(e,e,this._matViewProjInv)}return e},t.worldToScreen=function(e,t){var i=this._device.capabilities.clipSpaceSignY,n=Ki[this._curTransform];Di.transformMat4(e,t,this._matViewProj);var r=e.x,s=e.y;e.x=r*n[0]+s*n[2]*i,e.y=r*n[1]+s*n[3]*i;var a=this.width,o=this.height,u=this._orientedViewport.x*a,h=this._orientedViewport.y*o,c=this._orientedViewport.width*a,l=this._orientedViewport.height*o;return e.x=u+.5*(e.x+1)*c,e.y=h+.5*(e.y+1)*l,e.z=.5*e.z+.5,e},t.worldMatrixToScreen=function(e,t,i,n){Qi.multiply(e,this._matViewProj,t),Qi.multiply(e,sA[this._curTransform],e);var r=i/2,s=n/2;return Qi.identity(nA),Qi.transform(nA,nA,Di.set(tA,r,s,0)),Qi.scale(nA,nA,Di.set(tA,r,s,1)),Qi.multiply(e,nA,e),e},t.setExposure=function(e){this._exposure=.833333/Math.pow(2,e)},t.updateExposure=function(){var e=Math.log2(this._apertureValue*this._apertureValue/this._shutterValue*100/this._isoValue);this.setExposure(e)},c(e,[{key:"name",get:function(){return this._name}},{key:"scene",get:function(){return this._scene}},{key:"node",get:function(){return this._node},set:function(e){this._node=e}},{key:"window",get:function(){return this._window},set:function(e){this._window=e}},{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e}},{key:"visibility",get:function(){return this._visibility},set:function(e){this._visibility=e}},{key:"priority",get:function(){return this._priority},set:function(e){this._priority=e}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"position",get:function(){return this._position},set:function(e){this._position=e}},{key:"forward",get:function(){return this._forward},set:function(e){this._forward=e}},{key:"aperture",get:function(){return this._aperture},set:function(e){this._aperture=e,this._apertureValue=JT[this._aperture],this.updateExposure()}},{key:"apertureValue",get:function(){return this._apertureValue}},{key:"shutter",get:function(){return this._shutter},set:function(e){this._shutter=e,this._shutterValue=$T[this._shutter],this.updateExposure()}},{key:"shutterValue",get:function(){return this._shutterValue}},{key:"iso",get:function(){return this._iso},set:function(e){this._iso=e,this._isoValue=eA[this._iso],this.updateExposure()}},{key:"isoValue",get:function(){return this._isoValue}},{key:"exposure",get:function(){return this._exposure}},{key:"clearFlag",get:function(){return this._clearFlag},set:function(e){this._clearFlag=e}},{key:"clearColor",get:function(){return this._clearColor},set:function(e){this._clearColor.x=e.x,this._clearColor.y=e.y,this._clearColor.z=e.z,this._clearColor.w=e.w}},{key:"clearDepth",get:function(){return this._clearDepth},set:function(e){this._clearDepth=e}},{key:"clearStencil",get:function(){return this._clearStencil},set:function(e){this._clearStencil=e}},{key:"projectionType",get:function(){return this._proj},set:function(e){this._proj=e,this._isProjDirty=!0}},{key:"aspect",get:function(){return this._aspect}},{key:"orthoHeight",get:function(){return this._orthoHeight},set:function(e){this._orthoHeight=e,this._isProjDirty=!0}},{key:"fovAxis",get:function(){return this._fovAxis},set:function(e){this._fovAxis=e,this._isProjDirty=!0}},{key:"fov",get:function(){return this._fov},set:function(e){this._fov=e,this._isProjDirty=!0}},{key:"nearClip",get:function(){return this._nearClip},set:function(e){this._nearClip=e,this._isProjDirty=!0}},{key:"farClip",get:function(){return this._farClip},set:function(e){this._farClip=e,this._isProjDirty=!0}},{key:"viewport",get:function(){return this._viewport},set:function(e){Y(8302),this.setViewportInOrientedSpace(e)}},{key:"frustum",get:function(){return this._frustum},set:function(e){this._frustum=e}},{key:"matView",get:function(){return this._matView}},{key:"matProj",get:function(){return this._matProj}},{key:"matProjInv",get:function(){return this._matProjInv}},{key:"matViewProj",get:function(){return this._matViewProj}},{key:"matViewProjInv",get:function(){return this._matViewProjInv}},{key:"surfaceTransform",get:function(){return this._curTransform}},{key:"geometryRenderer",get:function(){return this._geometryRenderer}}],[{key:"standardExposureValue",get:function(){return 1/38400}},{key:"standardLightMeterScale",get:function(){return 1e4}}]),e}()),oA=new Di,uA=dt(NE),hA=dt(OE),cA=dt(CE),lA=dt(xE),_A=dt(ME),fA=dt({SKYBOX:rA|$n.DEPTH_STENCIL,SOLID_COLOR:$n.ALL,DEPTH_ONLY:$n.DEPTH_STENCIL,DONT_CLEAR:$n.NONE}),dA=e("eT",(LE=th("cc.Camera"),BE=yh(),UE=ph(),GE=Nh(),zE=bh(),kE=Dh(bd.BitMask),HE=Nh(),VE=bh(),WE=Dh(fA),jE=Nh(),XE=bh(),YE=Nh(),qE=bh(),KE=Nh(),QE=bh(),ZE=Nh(),JE=bh(),$E=Dh(uA),eT=Nh(),tT=bh(),iT=Dh(hA),nT=Nh(),rT=Th(),sT=bh(),aT=Nh(),oT=Th(),uT=bh(),hT=Nh(),cT=Th(),lT=bh(),_T=Nh(),fT=bh(),dT=Nh(),pT=bh(),mT=Dh(cA),gT=Nh(),vT=bh(),yT=Dh(lA),ET=Nh(),TT=bh(),AT=Dh(_A),ST=Nh(),bT=bh(),wT=Nh(),RT=bh(),IT=Dh(DE),OT=Nh(),NT=bh(),LE(CT=BE(CT=UE(CT=dh((ZT=QT=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return T(t=e.call.apply(e,[this].concat(n))||this,"_projection",xT,v(t)),T(t,"_priority",FT,v(t)),T(t,"_fov",PT,v(t)),T(t,"_fovAxis",DT,v(t)),T(t,"_orthoHeight",LT,v(t)),T(t,"_near",BT,v(t)),T(t,"_far",UT,v(t)),T(t,"_color",GT,v(t)),T(t,"_depth",zT,v(t)),T(t,"_stencil",kT,v(t)),T(t,"_clearFlags",HT,v(t)),T(t,"_rect",VT,v(t)),T(t,"_aperture",WT,v(t)),T(t,"_shutter",jT,v(t)),T(t,"_iso",XT,v(t)),T(t,"_screenScale",YT,v(t)),T(t,"_visibility",qT,v(t)),T(t,"_targetTexture",KT,v(t)),t._camera=null,t._inEditorMode=!1,t._flows=void 0,t}_(t,e);var i=t.prototype;return i.onLoad=function(){this._createCamera()},i.onEnable=function(){this.node.hasChangedFlags|=eE.POSITION,this._camera&&this._attachToScene()},i.onDisable=function(){this._camera&&this._detachFromScene()},i.onDestroy=function(){this._camera&&(this._camera.destroy(),this._camera=null),this._targetTexture&&this._targetTexture.off("resize")},i.screenPointToRay=function(e,t,i){return i||(i=no.create()),this._camera&&this._camera.screenPointToRay(i,e,t),i},i.worldToScreen=function(e,t){return t||(t=new Di),this._camera&&this._camera.worldToScreen(t,e),t},i.screenToWorld=function(e,t){return t||(t=this.node.getWorldPosition()),this._camera&&this._camera.screenToWorld(t,e),t},i.convertToUINode=function(e,t,i){if(i||(i=new Di),!this._camera)return i;this.worldToScreen(e,oA);var n=t.getComponent("cc.UITransform"),r=R.view.getVisibleSize(),s=oA.x-.5*this._camera.width,a=oA.y-.5*this._camera.height;return oA.x=s/R.view.getScaleX()+.5*r.width,oA.y=a/R.view.getScaleY()+.5*r.height,n&&n.convertToNodeSpaceAR(oA,i),i},i._createCamera=function(){this._camera||(this._camera=R.director.root.createCamera(),this._camera.initialize({name:this.node.name,node:this.node,projection:this._projection,window:this._inEditorMode?R.director.root&&R.director.root.mainWindow:R.director.root&&R.director.root.tempWindow,priority:this._priority}),this._camera.setViewportInOrientedSpace(this._rect),this._camera.fovAxis=this._fovAxis,this._camera.fov=Ai(this._fov),this._camera.orthoHeight=this._orthoHeight,this._camera.nearClip=this._near,this._camera.farClip=this._far,this._camera.clearColor=this._color,this._camera.clearDepth=this._depth,this._camera.clearStencil=this._stencil,this._camera.clearFlag=this._clearFlags,this._camera.visibility=this._visibility,this._camera.aperture=this._aperture,this._camera.shutter=this._shutter,this._camera.iso=this._iso),this._updateTargetTexture()},i._attachToScene=function(){this.node.scene&&this._camera&&(this._camera&&this._camera.scene&&this._camera.scene.removeCamera(this._camera),this._getRenderScene().addCamera(this._camera))},i._detachFromScene=function(){this._camera&&this._camera.scene&&this._camera.scene.removeCamera(this._camera)},i._checkTargetTextureEvent=function(e){var t=this;e&&e.off("resize"),this._targetTexture&&this._targetTexture.on("resize",(function(e){t._camera&&t._camera.setFixedSize(e.width,e.height)}),this)},i._updateTargetTexture=function(){if(this._camera&&this._targetTexture){var e=this._targetTexture.window;this._camera.changeTargetWindow(e),this._camera.setFixedSize(e.width,e.height)}},c(t,[{key:"camera",get:function(){return this._camera}},{key:"priority",get:function(){return this._priority},set:function(e){this._priority=e,this._camera&&(this._camera.priority=e)}},{key:"visibility",get:function(){return this._visibility},set:function(e){this._visibility=e,this._camera&&(this._camera.visibility=e)}},{key:"clearFlags",get:function(){return this._clearFlags},set:function(e){this._clearFlags=e,this._camera&&(this._camera.clearFlag=e)}},{key:"clearColor",get:function(){return this._color},set:function(e){this._color.set(e),this._camera&&(this._camera.clearColor=this._color)}},{key:"clearDepth",get:function(){return this._depth},set:function(e){this._depth=e,this._camera&&(this._camera.clearDepth=e)}},{key:"clearStencil",get:function(){return this._stencil},set:function(e){this._stencil=e,this._camera&&(this._camera.clearStencil=e)}},{key:"projection",get:function(){return this._projection},set:function(e){this._projection=e,this._camera&&(this._camera.projectionType=e)}},{key:"fovAxis",get:function(){return this._fovAxis},set:function(e){e!==this._fovAxis&&(this._fovAxis=e,this._camera&&(this._camera.fovAxis=e,e===OE.VERTICAL?this.fov=this._fov*this._camera.aspect:this.fov=this._fov/this._camera.aspect))}},{key:"fov",get:function(){return this._fov},set:function(e){this._fov=e,this._camera&&(this._camera.fov=Ai(e))}},{key:"orthoHeight",get:function(){return this._orthoHeight},set:function(e){this._orthoHeight=e,this._camera&&(this._camera.orthoHeight=e)}},{key:"near",get:function(){return this._near},set:function(e){this._near=e,this._camera&&(this._camera.nearClip=e)}},{key:"far",get:function(){return this._far},set:function(e){this._far=e,this._camera&&(this._camera.farClip=e)}},{key:"aperture",get:function(){return this._aperture},set:function(e){this._aperture=e,this._camera&&(this._camera.aperture=e)}},{key:"shutter",get:function(){return this._shutter},set:function(e){this._shutter=e,this._camera&&(this._camera.shutter=e)}},{key:"iso",get:function(){return this._iso},set:function(e){this._iso=e,this._camera&&(this._camera.iso=e)}},{key:"rect",get:function(){return this._rect},set:function(e){this._rect=e,this._camera&&this._camera.setViewportInOrientedSpace(e)}},{key:"targetTexture",get:function(){return this._targetTexture},set:function(e){if(this._targetTexture!==e){var i=this._targetTexture;this._targetTexture=e,this._checkTargetTextureEvent(i),this._updateTargetTexture(),!e&&this._camera&&(this._camera.changeTargetWindow(null),this._camera.isWindowSize=!0),this.node.emit(t.TARGET_TEXTURE_CHANGE,this)}}},{key:"screenScale",get:function(){return this._screenScale},set:function(e){this._screenScale=e,this._camera&&(this._camera.screenScale=e)}},{key:"inEditorMode",get:function(){return this._inEditorMode},set:function(e){this._inEditorMode=e,this._camera&&this._camera.changeTargetWindow(e?R.director.root&&R.director.root.mainWindow:R.director.root&&R.director.root.tempWindow)}}]),t}(ll),QT.ProjectionType=uA,QT.FOVAxis=hA,QT.ClearFlag=fA,QT.Aperture=cA,QT.Shutter=lA,QT.ISO=_A,QT.TARGET_TEXTURE_CHANGE="tex-change",xT=A((MT=ZT).prototype,"_projection",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return uA.PERSPECTIVE}}),FT=A(MT.prototype,"_priority",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),PT=A(MT.prototype,"_fov",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 45}}),DT=A(MT.prototype,"_fovAxis",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return hA.VERTICAL}}),LT=A(MT.prototype,"_orthoHeight",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 10}}),BT=A(MT.prototype,"_near",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),UT=A(MT.prototype,"_far",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1e3}}),GT=A(MT.prototype,"_color",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Fi("#333333")}}),zT=A(MT.prototype,"_depth",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),kT=A(MT.prototype,"_stencil",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),HT=A(MT.prototype,"_clearFlags",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return fA.SOLID_COLOR}}),VT=A(MT.prototype,"_rect",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new cn(0,0,1,1)}}),WT=A(MT.prototype,"_aperture",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return cA.F16_0}}),jT=A(MT.prototype,"_shutter",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return lA.D125}}),XT=A(MT.prototype,"_iso",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return _A.ISO100}}),YT=A(MT.prototype,"_screenScale",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),qT=A(MT.prototype,"_visibility",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return jp}}),KT=A(MT.prototype,"_targetTexture",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),A(MT.prototype,"priority",[GE,zE],Object.getOwnPropertyDescriptor(MT.prototype,"priority"),MT.prototype),A(MT.prototype,"visibility",[kE,HE,VE],Object.getOwnPropertyDescriptor(MT.prototype,"visibility"),MT.prototype),A(MT.prototype,"clearFlags",[WE,jE,XE],Object.getOwnPropertyDescriptor(MT.prototype,"clearFlags"),MT.prototype),A(MT.prototype,"clearColor",[YE,qE],Object.getOwnPropertyDescriptor(MT.prototype,"clearColor"),MT.prototype),A(MT.prototype,"clearDepth",[KE,QE],Object.getOwnPropertyDescriptor(MT.prototype,"clearDepth"),MT.prototype),A(MT.prototype,"clearStencil",[ZE,JE],Object.getOwnPropertyDescriptor(MT.prototype,"clearStencil"),MT.prototype),A(MT.prototype,"projection",[$E,eT,tT],Object.getOwnPropertyDescriptor(MT.prototype,"projection"),MT.prototype),A(MT.prototype,"fovAxis",[iT,nT,rT,sT],Object.getOwnPropertyDescriptor(MT.prototype,"fovAxis"),MT.prototype),A(MT.prototype,"fov",[aT,oT,uT],Object.getOwnPropertyDescriptor(MT.prototype,"fov"),MT.prototype),A(MT.prototype,"orthoHeight",[hT,cT,lT],Object.getOwnPropertyDescriptor(MT.prototype,"orthoHeight"),MT.prototype),A(MT.prototype,"near",[_T,fT],Object.getOwnPropertyDescriptor(MT.prototype,"near"),MT.prototype),A(MT.prototype,"far",[dT,pT],Object.getOwnPropertyDescriptor(MT.prototype,"far"),MT.prototype),A(MT.prototype,"aperture",[mT,gT,vT],Object.getOwnPropertyDescriptor(MT.prototype,"aperture"),MT.prototype),A(MT.prototype,"shutter",[yT,ET,TT],Object.getOwnPropertyDescriptor(MT.prototype,"shutter"),MT.prototype),A(MT.prototype,"iso",[AT,ST,bT],Object.getOwnPropertyDescriptor(MT.prototype,"iso"),MT.prototype),A(MT.prototype,"rect",[wT,RT],Object.getOwnPropertyDescriptor(MT.prototype,"rect"),MT.prototype),A(MT.prototype,"targetTexture",[IT,OT,NT],Object.getOwnPropertyDescriptor(MT.prototype,"targetTexture"),MT.prototype),CT=MT))||CT)||CT)||CT)||CT));R.Camera=dA;var pA,mA,gA,vA,yA,EA,TA,AA,SA,bA,wA,RA,IA=e("eK",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;r<n._shaderInfo.blocks.length;r++){var s=n._shaderInfo.blocks[r],a=n._blocks[s.binding],o=n._parent.blocks[s.binding];a.set(o)}n._rootBufferDirty=!0;for(var u=n._parent,h=0;h<n._shaderInfo.samplerTextures.length;h++)for(var c=n._shaderInfo.samplerTextures[h],l=0;l<c.count;l++){var _=u._descriptorSet.getSampler(c.binding,l),f=u._descriptorSet.getTexture(c.binding,l);n._descriptorSet.bindSampler(c.binding,_,l),n._descriptorSet.bindTexture(c.binding,f,l)}return e.prototype.tryCompile.call(v(n)),n}_(t,e);var i=t.prototype;return i.overridePipelineStates=function(e,t){this._bs.reset(),this._rs.reset(),this._dss.reset(),iy.fillPipelineInfo(this,e),iy.fillPipelineInfo(this,t),this._onStateChange()},i.tryCompile=function(t){if(t&&!um(this._defines,t))return!1;var i=e.prototype.tryCompile.call(this);return this._onStateChange(),i},i.beginChangeStatesSilently=function(){this._dontNotify=!0},i.endChangeStatesSilently=function(){this._dontNotify=!1},i._syncBatchingScheme=function(){this._defines.USE_BATCHING=this._defines.USE_INSTANCING=!1,this._batchingScheme=Yv.NONE},i._onStateChange=function(){this._hash=iy.getPassHash(this),this._owner.onPassStateChange(this._dontNotify)},c(t,[{key:"parent",get:function(){return this._parent}}]),t}(iy)),OA=e("eJ",function(e){function t(t){var i;return(i=e.call(this)||this)._passes=[],i._parent=void 0,i._owner=void 0,i._subModelIdx=0,i._parent=t.parent,i._owner=t.owner||null,i._subModelIdx=t.subModelIdx||0,i.copy(i._parent),i}_(t,e);var i=t.prototype;return i.recompileShaders=function(e,t){if(this._passes&&this.effectAsset)if(void 0===t)for(var i,n=E(this._passes);!(i=n()).done;)i.value.tryCompile(e);else this._passes[t].tryCompile(e)},i.overridePipelineStates=function(e,t){if(this._passes&&this.effectAsset){var i=this.effectAsset.techniques[this.technique].passes;if(void 0===t)for(var n=0;n<this._passes.length;n++){var r=this._passes[n],s=this._states[n]||(this._states[n]={});for(var a in e)s[a]=e[a];r.overridePipelineStates(i[r.passIndex],s)}else{var o=this._states[t]||(this._states[t]={});for(var u in e)o[u]=e[u];this._passes[t].overridePipelineStates(i[t],o)}}},i.destroy=function(){return this._doDestroy(),!0},i.onPassStateChange=function(e){this._hash=Ey.getHash(this),!e&&this._owner&&this._owner._onRebuildPSO(this._subModelIdx,this)},i._createPasses=function(){var e=[],t=this._parent.passes;if(!t)return e;for(var i=0;i<t.length;++i)e.push(new IA(t[i],this));return e},c(t,[{key:"parent",get:function(){return this._parent}},{key:"owner",get:function(){return this._owner}}]),t}(Ey)),NA={parent:null,owner:null,subModelIdx:0},CA=e("el",(pA=th("cc.Renderer"),mA=Dh(Ey),gA=Nh(),vA=Sh(),yA=Dh([Ey]),pA(EA=rh((A((TA=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return T(t=e.call.apply(e,[this].concat(n))||this,"_materials",AA,v(t)),t._materialInstances=[],t}_(t,e);var i=t.prototype;return i.getMaterial=function(e){return e<0||e>=this._materials.length?null:this._materials[e]},i.setMaterial=function(e,t){e&&e instanceof OA&&console.error("Can't set a material instance to a sharedMaterial slot"),this._materials[t]=e;var i=this._materialInstances[t];i&&(i.destroy(),this._materialInstances[t]=null),this._onMaterialModified(t,this._materials[t])},i.getMaterialInstance=function(e){if(!this._materials[e])return null;if(!this._materialInstances[e]){NA.parent=this._materials[e],NA.owner=this,NA.subModelIdx=e;var t=new OA(NA);NA.parent=null,NA.owner=null,NA.subModelIdx=0,this.setMaterialInstance(t,e)}return this._materialInstances[e]},i.setMaterialInstance=function(e,t){if("number"==typeof e){Y(12007);var i=e;e=t,t=i}var n=this._materialInstances[t];e&&e.parent?e!==n&&(this._materialInstances[t]=e,this._onMaterialModified(t,e)):(e!==this._materials[t]||n)&&this.setMaterial(e,t)},i.getRenderMaterial=function(e){return this._materialInstances[e]||this._materials[e]},i._onMaterialModified=function(){},i._onRebuildPSO=function(){},i._clearMaterials=function(){},c(t,[{key:"sharedMaterial",get:function(){return this.getMaterial(0)}},{key:"sharedMaterials",get:function(){return this._materials},set:function(e){for(var t=0;t<e.length;t++)e[t]!==this._materials[t]&&this.setMaterial(e[t],t);if(e.length<this._materials.length){for(var i=e.length;i<this._materials.length;i++)this.setMaterial(null,i);this._materials.splice(e.length)}}},{key:"material",get:function(){return this.getMaterialInstance(0)},set:function(e){(1!==this._materials.length||this._materialInstances[0]||this._materials[0]!==e)&&this.setMaterialInstance(e,0)}},{key:"materials",get:function(){for(var e=0;e<this._materials.length;e++)this._materialInstances[e]=this.getMaterialInstance(e);return this._materialInstances},set:function(e){for(var t=e.length,i=this._materials.length,n=t;n<i;n++)this.setMaterialInstance(null,n);this._materials.length=t,this._materialInstances.length=t;for(var r=0;r<t;r++)this._materialInstances[r]!=e[r]&&this.setMaterialInstance(e[r],r)}}]),t}(ll)).prototype,"sharedMaterials",[mA,gA,vA],Object.getOwnPropertyDescriptor(TA.prototype,"sharedMaterials"),TA.prototype),AA=A(TA.prototype,"_materials",[yA],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),EA=TA))||EA)||EA)),MA=e("eY",th("cc.ModelRenderer")((RA=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return T(t=e.call.apply(e,[this].concat(n))||this,"_visFlags",wA,v(t)),t._models=[],t._priority=0,t}_(t,e);var i=t.prototype;return i._collectModels=function(){return this._models},i.onEnable=function(){this._updatePriority()},i._attachToScene=function(){},i._detachFromScene=function(){},i._onVisibilityChange=function(){},i._updatePriority=function(){if(this._models.length>0)for(var e=0;e<this._models.length;e++)this._models[e].priority=this._priority},c(t,[{key:"visibility",get:function(){return this._visFlags},set:function(e){this._visFlags=e,this._onVisibilityChange(e)}},{key:"priority",get:function(){return this._priority},set:function(e){e!==this._priority&&(this._priority=e,this._updatePriority())}}]),t}(CA),wA=A((bA=RA).prototype,"_visFlags",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return bd.Enum.NONE}}),SA=bA))||SA);ie(dA,"Camera",[{name:"CameraClearFlag",newName:"ClearFlag"}]),ie(dA.prototype,"Camera.prototype",[{name:"color",newName:"clearColor"},{name:"depth",newName:"clearDepth"},{name:"stencil",newName:"clearStencil"}]),R.CameraComponent=dA,_t.setClassAlias(dA,"cc.CameraComponent"),R.RenderableComponent=MA,_t.setClassAlias(MA,"cc.RenderableComponent");var xA,FA,PA=e("gC",function(){function e(e,t){this.type=void 0,this.bubbles=void 0,this.target=null,this.currentTarget=null,this.eventPhase=0,this.propagationStopped=!1,this.propagationImmediateStopped=!1,this.type=e,this.bubbles=!!t}var t=e.prototype;return t.unuse=function(){this.type=e.NO_TYPE,this.target=null,this.currentTarget=null,this.eventPhase=e.NONE,this.propagationStopped=!1,this.propagationImmediateStopped=!1},t.reuse=function(e,t){this.type=e,this.bubbles=t||!1},t.isStopped=function(){return this.propagationStopped||this.propagationImmediateStopped},t.getCurrentTarget=function(){return this.currentTarget},t.getType=function(){return this.type},e}());PA.NO_TYPE="no_type",PA.TOUCH="touch",PA.MOUSE="mouse",PA.KEYBOARD="keyboard",PA.ACCELERATION="acceleration",PA.NONE=0,PA.CAPTURING_PHASE=1,PA.AT_TARGET=2,PA.BUBBLING_PHASE=3,R.Event=PA,function(e){e.TOUCH_START="touch-start",e.TOUCH_MOVE="touch-move",e.TOUCH_END="touch-end",e.TOUCH_CANCEL="touch-cancel",e.MOUSE_DOWN="mouse-down",e.MOUSE_MOVE="mouse-move",e.MOUSE_UP="mouse-up",e.MOUSE_WHEEL="mouse-wheel",e.MOUSE_ENTER="mouse-enter",e.MOUSE_LEAVE="mouse-leave",e.KEY_DOWN="keydown",e.KEY_UP="keyup",e.DEVICEMOTION="devicemotion",e.TRANSFORM_CHANGED="transform-changed",e.SCENE_CHANGED_FOR_PERSISTS="scene-changed-for-persists",e.SIZE_CHANGED="size-changed",e.ANCHOR_CHANGED="anchor-changed",e.COLOR_CHANGED="color-changed",e.CHILD_ADDED="child-added",e.CHILD_REMOVED="child-removed",e.PARENT_CHANGED="parent-changed",e.NODE_DESTROYED="node-destroyed",e.LAYER_CHANGED="layer-changed",e.SIBLING_ORDER_CHANGED="sibling-order-changed"}(xA||(xA=e("gB",{}))),function(e){e.TOUCH_START="touch-start",e.TOUCH_MOVE="touch-move",e.TOUCH_END="touch-end",e.TOUCH_CANCEL="touch-cancel",e.MOUSE_DOWN="mouse-down",e.MOUSE_MOVE="mouse-move",e.MOUSE_UP="mouse-up",e.MOUSE_WHEEL="mouse-wheel",e.KEY_DOWN="keydown",e.KEY_PRESSING="key-pressing",e.KEY_UP="keyup",e.DEVICEMOTION="devicemotion"}(FA||(FA=e("f6",{}))),R.SystemEventType=xA;var DA=e("hN",function(e){function t(t,i){var n;return(n=e.call(this,xA.DEVICEMOTION,i)||this).acc=void 0,n.acc=t,n}return _(t,e),t}(PA));PA.EventAcceleration=DA;var LA=e("hO",function(e){function t(t,i,n){var r;return"boolean"==typeof i&&(i=i?xA.KEY_DOWN:xA.KEY_UP),(r=e.call(this,i,n)||this).keyCode=void 0,r.rawEvent=void 0,r._isPressed=void 0,r._isPressed=i!==xA.KEY_UP,"number"==typeof t?r.keyCode=t:(r.keyCode=t.keyCode,r.rawEvent=t),r}return _(t,e),c(t,[{key:"isPressed",get:function(){return this._isPressed}}]),t}(PA));PA.EventKeyboard=LA;var BA=e("hP",function(e){function t(i,n,r){var s;return(s=e.call(this,i,n)||this).movementX=0,s.movementY=0,s.preventSwallow=!1,s._eventType=void 0,s._button=t.BUTTON_MISSING,s._x=0,s._y=0,s._prevX=0,s._prevY=0,s._scrollX=0,s._scrollY=0,s._eventType=i,r&&(s._prevX=r.x,s._prevY=r.y),s}_(t,e);var i=t.prototype;return i.setScrollData=function(e,t){this._scrollX=e,this._scrollY=t},i.getScrollX=function(){return this._scrollX},i.getScrollY=function(){return this._scrollY},i.setLocation=function(e,t){this._x=e,this._y=t},i.getLocation=function(e){return e||(e=new en),en.set(e,this._x,this._y),e},i.getLocationInView=function(e){return e||(e=new en),en.set(e,this._x,R.view._designResolutionSize.height-this._y),e},i.getUILocation=function(e){return e||(e=new en),en.set(e,this._x,this._y),R.view._convertToUISpace(e),e},i.getPreviousLocation=function(e){return e||(e=new en),en.set(e,this._prevX,this._prevY),e},i.getUIPreviousLocation=function(e){return e||(e=new en),en.set(e,this._prevX,this._prevY),R.view._convertToUISpace(e),e},i.getDelta=function(e){return e||(e=new en),en.set(e,this._x-this._prevX,this._y-this._prevY),e},i.getDeltaX=function(){return this._x-this._prevX},i.getDeltaY=function(){return this._y-this._prevY},i.getUIDelta=function(e){return e||(e=new en),en.set(e,(this._x-this._prevX)/R.view.getScaleX(),(this._y-this._prevY)/R.view.getScaleY()),e},i.getUIDeltaX=function(){return(this._x-this._prevX)/R.view.getScaleX()},i.getUIDeltaY=function(){return(this._y-this._prevY)/R.view.getScaleY()},i.setButton=function(e){this._button=e},i.getButton=function(){return this._button},i.getLocationX=function(){return this._x},i.getLocationY=function(){return this._y},i.getUILocationX=function(){var e=R.view.getViewportRect();return(this._x-e.x)/R.view.getScaleX()},i.getUILocationY=function(){var e=R.view.getViewportRect();return(this._y-e.y)/R.view.getScaleY()},c(t,[{key:"eventType",get:function(){return this._eventType}}]),t}(PA));BA.BUTTON_MISSING=-1,BA.BUTTON_LEFT=0,BA.BUTTON_RIGHT=2,BA.BUTTON_MIDDLE=1,BA.BUTTON_4=3,BA.BUTTON_5=4,BA.BUTTON_6=5,BA.BUTTON_7=6,BA.BUTTON_8=7,PA.EventMouse=BA;var UA=new en,GA=e("gA",function(e){function t(t,i,n,r){var s;return void 0===r&&(r=[]),(s=e.call(this,n,i)||this).touch=null,s.simulate=!1,s.preventSwallow=!1,s._eventCode=void 0,s._touches=void 0,s._allTouches=void 0,s._eventCode=n,s._touches=t||[],s._allTouches=r,s}_(t,e);var i=t.prototype;return i.getEventCode=function(){return this._eventCode},i.getTouches=function(){return this._touches},i.getAllTouches=function(){return this._allTouches},i.setLocation=function(e,t){this.touch&&this.touch.setTouchInfo(this.touch.getID(),e,t)},i.getLocation=function(e){return this.touch?this.touch.getLocation(e):new en},i.getUILocation=function(e){return this.touch?this.touch.getUILocation(e):new en},i.getLocationInView=function(e){return this.touch?this.touch.getLocationInView(e):new en},i.getPreviousLocation=function(e){return this.touch?this.touch.getPreviousLocation(e):new en},i.getStartLocation=function(e){return this.touch?this.touch.getStartLocation(e):new en},i.getUIStartLocation=function(e){return this.touch?this.touch.getUIStartLocation(e):new en},i.getID=function(){return this.touch?this.touch.getID():null},i.getDelta=function(e){return this.touch?this.touch.getDelta(e):new en},i.getUIDelta=function(e){return this.touch?this.touch.getUIDelta(e):new en},i.getDeltaX=function(){return this.touch?this.touch.getDelta(UA).x:0},i.getDeltaY=function(){return this.touch?this.touch.getDelta(UA).y:0},i.getLocationX=function(){return this.touch?this.touch.getLocationX():0},i.getLocationY=function(){return this.touch?this.touch.getLocationY():0},t}(PA));GA.MAX_TOUCHES=5,PA.EventTouch=GA;var zA,kA=e("hQ",(function(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=void 0,this.y=void 0,this.z=void 0,this.timestamp=void 0,this.x=e,this.y=t,this.z=i,this.timestamp=n}));!function(e){e[e.NONE=0]="NONE",e[e.MOBILE_BACK=6]="MOBILE_BACK",e[e.BACKSPACE=8]="BACKSPACE",e[e.TAB=9]="TAB",e[e.ENTER=13]="ENTER",e[e.SHIFT_LEFT=16]="SHIFT_LEFT",e[e.CTRL_LEFT=17]="CTRL_LEFT",e[e.ALT_LEFT=18]="ALT_LEFT",e[e.PAUSE=19]="PAUSE",e[e.CAPS_LOCK=20]="CAPS_LOCK",e[e.ESCAPE=27]="ESCAPE",e[e.SPACE=32]="SPACE",e[e.PAGE_UP=33]="PAGE_UP",e[e.PAGE_DOWN=34]="PAGE_DOWN",e[e.END=35]="END",e[e.HOME=36]="HOME",e[e.ARROW_LEFT=37]="ARROW_LEFT",e[e.ARROW_UP=38]="ARROW_UP",e[e.ARROW_RIGHT=39]="ARROW_RIGHT",e[e.ARROW_DOWN=40]="ARROW_DOWN",e[e.INSERT=45]="INSERT",e[e.DELETE=46]="DELETE",e[e.DIGIT_0=48]="DIGIT_0",e[e.DIGIT_1=49]="DIGIT_1",e[e.DIGIT_2=50]="DIGIT_2",e[e.DIGIT_3=51]="DIGIT_3",e[e.DIGIT_4=52]="DIGIT_4",e[e.DIGIT_5=53]="DIGIT_5",e[e.DIGIT_6=54]="DIGIT_6",e[e.DIGIT_7=55]="DIGIT_7",e[e.DIGIT_8=56]="DIGIT_8",e[e.DIGIT_9=57]="DIGIT_9",e[e.KEY_A=65]="KEY_A",e[e.KEY_B=66]="KEY_B",e[e.KEY_C=67]="KEY_C",e[e.KEY_D=68]="KEY_D",e[e.KEY_E=69]="KEY_E",e[e.KEY_F=70]="KEY_F",e[e.KEY_G=71]="KEY_G",e[e.KEY_H=72]="KEY_H",e[e.KEY_I=73]="KEY_I",e[e.KEY_J=74]="KEY_J",e[e.KEY_K=75]="KEY_K",e[e.KEY_L=76]="KEY_L",e[e.KEY_M=77]="KEY_M",e[e.KEY_N=78]="KEY_N",e[e.KEY_O=79]="KEY_O",e[e.KEY_P=80]="KEY_P",e[e.KEY_Q=81]="KEY_Q",e[e.KEY_R=82]="KEY_R",e[e.KEY_S=83]="KEY_S",e[e.KEY_T=84]="KEY_T",e[e.KEY_U=85]="KEY_U",e[e.KEY_V=86]="KEY_V",e[e.KEY_W=87]="KEY_W",e[e.KEY_X=88]="KEY_X",e[e.KEY_Y=89]="KEY_Y",e[e.KEY_Z=90]="KEY_Z",e[e.NUM_0=96]="NUM_0",e[e.NUM_1=97]="NUM_1",e[e.NUM_2=98]="NUM_2",e[e.NUM_3=99]="NUM_3",e[e.NUM_4=100]="NUM_4",e[e.NUM_5=101]="NUM_5",e[e.NUM_6=102]="NUM_6",e[e.NUM_7=103]="NUM_7",e[e.NUM_8=104]="NUM_8",e[e.NUM_9=105]="NUM_9",e[e.NUM_MULTIPLY=106]="NUM_MULTIPLY",e[e.NUM_PLUS=107]="NUM_PLUS",e[e.NUM_SUBTRACT=109]="NUM_SUBTRACT",e[e.NUM_DECIMAL=110]="NUM_DECIMAL",e[e.NUM_DIVIDE=111]="NUM_DIVIDE",e[e.F1=112]="F1",e[e.F2=113]="F2",e[e.F3=114]="F3",e[e.F4=115]="F4",e[e.F5=116]="F5",e[e.F6=117]="F6",e[e.F7=118]="F7",e[e.F8=119]="F8",e[e.F9=120]="F9",e[e.F10=121]="F10",e[e.F11=122]="F11",e[e.F12=123]="F12",e[e.NUM_LOCK=144]="NUM_LOCK",e[e.SCROLL_LOCK=145]="SCROLL_LOCK",e[e.SEMICOLON=186]="SEMICOLON",e[e.EQUAL=187]="EQUAL",e[e.COMMA=188]="COMMA",e[e.DASH=189]="DASH",e[e.PERIOD=190]="PERIOD",e[e.SLASH=191]="SLASH",e[e.BACK_QUOTE=192]="BACK_QUOTE",e[e.BRACKET_LEFT=219]="BRACKET_LEFT",e[e.BACKSLASH=220]="BACKSLASH",e[e.BRACKET_RIGHT=221]="BRACKET_RIGHT",e[e.QUOTE=222]="QUOTE",e[e.SHIFT_RIGHT=2e3]="SHIFT_RIGHT",e[e.CTRL_RIGHT=2001]="CTRL_RIGHT",e[e.ALT_RIGHT=2002]="ALT_RIGHT",e[e.NUM_ENTER=2003]="NUM_ENTER"}(zA||(zA=e("gw",{})));var HA=new en,VA=e("hR",function(){function e(e,t,i){void 0===i&&(i=0),this._point=new en,this._prevPoint=new en,this._lastModified=0,this._id=0,this._startPoint=new en,this._startPointCaptured=!1,this.setTouchInfo(i,e,t)}var t=e.prototype;return t.getLocation=function(e){return e||(e=new en),e.set(this._point.x,this._point.y),e},t.getLocationX=function(){return this._point.x},t.getLocationY=function(){return this._point.y},t.getUILocation=function(e){return e||(e=new en),e.set(this._point.x,this._point.y),R.view._convertToUISpace(e),e},t.getUILocationX=function(){var e=R.view.getViewportRect();return(this._point.x-e.x)/R.view.getScaleX()},t.getUILocationY=function(){var e=R.view.getViewportRect();return(this._point.y-e.y)/R.view.getScaleY()},t.getPreviousLocation=function(e){return e||(e=new en),e.set(this._prevPoint.x,this._prevPoint.y),e},t.getUIPreviousLocation=function(e){return e||(e=new en),e.set(this._prevPoint.x,this._prevPoint.y),R.view._convertToUISpace(e),e},t.getStartLocation=function(e){return e||(e=new en),e.set(this._startPoint.x,this._startPoint.y),e},t.getUIStartLocation=function(e){return e||(e=new en),e.set(this._startPoint.x,this._startPoint.y),R.view._convertToUISpace(e),e},t.getDelta=function(e){return e||(e=new en),e.set(this._point),e.subtract(this._prevPoint),e},t.getUIDelta=function(e){return e||(e=new en),HA.set(this._point),HA.subtract(this._prevPoint),e.set(R.view.getScaleX(),R.view.getScaleY()),en.divide(e,HA,e),e},t.getLocationInView=function(e){return e||(e=new en),e.set(this._point.x,R.view._designResolutionSize.height-this._point.y),e},t.getPreviousLocationInView=function(e){return e||(e=new en),e.set(this._prevPoint.x,R.view._designResolutionSize.height-this._prevPoint.y),e},t.getStartLocationInView=function(e){return e||(e=new en),e.set(this._startPoint.x,R.view._designResolutionSize.height-this._startPoint.y),e},t.getID=function(){return this._id},t.setTouchInfo=function(e,t,i){void 0===e&&(e=0),this._prevPoint=this._point,this._point=new en(t||0,i||0),this._id=e,this._startPointCaptured||(this._startPoint=new en(this._point),this._startPointCaptured=!0)},t.setPoint=function(e,t){"object"==typeof e?(this._point.x=e.x,this._point.y=e.y):(this._point.x=e||0,this._point.y=t||0),this._lastModified=R.game.frameStartTime},t.setPrevPoint=function(e,t){this._prevPoint="object"==typeof e?new en(e.x,e.y):new en(e||0,t||0),this._lastModified=R.game.frameStartTime},c(e,[{key:"lastModified",get:function(){return this._lastModified}}]),e}());R.Touch=VA;var WA,jA=new Array(16),XA=null,YA=new en,qA=[By.TOUCH_START,By.TOUCH_MOVE,By.TOUCH_END,By.TOUCH_CANCEL],KA=[By.MOUSE_DOWN,By.MOUSE_ENTER,By.MOUSE_MOVE,By.MOUSE_LEAVE,By.MOUSE_UP,By.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"}(WA||(WA=e("f5",{})));var QA=e("eR",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(WA.MARK_LIST_DIRTY),i&&n.length>0)for(var r=0;r<n.length;++r)n[r]._eventProcessor.setEnabled(t,!0)}},t.reattach=function(){var t,i=this;this.node.walk((function(n){t||(t=i._searchComponentsInParent(e._maskComp)),n.eventProcessor.maskList=t}))},t.destroy=function(){if(XA===this._node&&(XA=null),this.capturingTarget&&this.capturingTarget.clear(),this.bubblingTarget&&this.bubblingTarget.clear(),e.callbacksInvoker.emit(WA.REMOVE_POINTER_EVENT_PROCESSOR,this),this._dispatchingTouch){var t=new GA([this._dispatchingTouch],!0,FA.TOUCH_CANCEL);t.touch=this._dispatchingTouch,this.dispatchEvent(t),this._dispatchingTouch=null}},t.on=function(e,t,i,n){var r,s;return this._tryEmittingAddEvent(e),((n=!!n)?null!==(r=this.capturingTarget)&&void 0!==r?r:this.capturingTarget=this._newCallbacksInvoker():null!==(s=this.bubblingTarget)&&void 0!==s?s:this.bubblingTarget=this._newCallbacksInvoker()).on(e,t,i),t},t.once=function(e,t,i,n){var r,s;return this._tryEmittingAddEvent(e),((n=!!n)?null!==(r=this.capturingTarget)&&void 0!==r?r:this.capturingTarget=this._newCallbacksInvoker():null!==(s=this.bubblingTarget)&&void 0!==s?s:this.bubblingTarget=this._newCallbacksInvoker()).on(e,t,i,!0),t},t.off=function(e,t,i,n){var r;null===(r=(n=!!n)?this.capturingTarget:this.bubblingTarget)||void 0===r||r.off(e,t,i)},t.targetOff=function(t){var i,n;null===(i=this.capturingTarget)||void 0===i||i.removeAll(t),null===(n=this.bubblingTarget)||void 0===n||n.removeAll(t),this.shouldHandleEventTouch&&!this._hasTouchListeners()&&(this.shouldHandleEventTouch=!1),this.shouldHandleEventMouse&&!this._hasMouseListeners()&&(this.shouldHandleEventMouse=!1),this._hasPointerListeners()||e.callbacksInvoker.emit(WA.REMOVE_POINTER_EVENT_PROCESSOR,this)},t.emit=function(e,t,i,n,r,s){var a;null===(a=this.bubblingTarget)||void 0===a||a.emit(e,t,i,n,r,s)},t.dispatchEvent=function(e){var t,i=this.node,n=0;for(e.target=i,jA.length=0,this.getCapturingTargets(e.type,jA),e.eventPhase=1,n=jA.length-1;n>=0;--n)if((t=jA[n]).eventProcessor.capturingTarget&&(e.currentTarget=t,t.eventProcessor.capturingTarget.emit(e.type,e,jA),e.propagationStopped))return void(jA.length=0);if(jA.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,jA),e.eventPhase=3,n=0;n<jA.length;++n)if((t=jA[n]).eventProcessor.bubblingTarget&&(e.currentTarget=t,t.eventProcessor.bubblingTarget.emit(e.type,e),e.propagationStopped))return void(jA.length=0);jA.length=0},t.hasEventListener=function(e,t,i){var n=!1;return this.bubblingTarget&&(n=this.bubblingTarget.hasEventListener(e,t,i)),!n&&this.capturingTarget&&(n=this.capturingTarget.hasEventListener(e,t,i)),n},t.getCapturingTargets=function(e,t){for(var i=this._node.parent;i;){var n;(null===(n=i.eventProcessor.capturingTarget)||void 0===n?void 0:n.hasEventListener(e))&&t.push(i),i=i.parent}},t.getBubblingTargets=function(e,t){for(var i=this._node.parent;i;){var n;(null===(n=i.eventProcessor.bubblingTarget)||void 0===n?void 0:n.hasEventListener(e))&&t.push(i),i=i.parent}},t._searchComponentsInParent=function(e){var t=this.node;if(e){for(var i=0,n=[],r=t;r&&SE.isNode(r);r=r.parent,++i){var s=r.getComponent(e);if(s){var a={index:i,comp:s};n?n.push(a):n=[a]}}return n.length>0?n:null}return null},t._attachMask=function(){this.maskList=this._searchComponentsInParent(e._maskComp)},t._isTouchEvent=function(e){return-1!==qA.indexOf(e)},t._isMouseEvent=function(e){return-1!==KA.indexOf(e)},t._hasTouchListeners=function(){for(var e=0;e<qA.length;++e){var t=qA[e];if(this.hasEventListener(t))return!0}return!1},t._hasMouseListeners=function(){for(var e=0;e<KA.length;++e){var t=KA[e];if(this.hasEventListener(t))return!0}return!1},t._hasPointerListeners=function(){return!!this._hasTouchListeners()||this._hasMouseListeners()},t._tryEmittingAddEvent=function(t){var i=this._isTouchEvent(t),n=this._isMouseEvent(t);i?this.shouldHandleEventTouch=!0:n&&(this.shouldHandleEventMouse=!0),!i&&!n||this._hasPointerListeners()||e.callbacksInvoker.emit(WA.ADD_POINTER_EVENT_PROCESSOR,this)},t._newCallbacksInvoker=function(){var t=this,i=new Ea;return i._registerOffCallback((function(){t.shouldHandleEventTouch&&!t._hasTouchListeners()&&(t.shouldHandleEventTouch=!1),t.shouldHandleEventMouse&&!t._hasMouseListeners()&&(t.shouldHandleEventMouse=!1),t._hasPointerListeners()||e.callbacksInvoker.emit(WA.REMOVE_POINTER_EVENT_PROCESSOR,t)})),i},t._handleEventMouse=function(e){switch(e.type){case FA.MOUSE_DOWN:return this._handleMouseDown(e);case FA.MOUSE_MOVE:return this._handleMouseMove(e);case FA.MOUSE_UP:return this._handleMouseUp(e);case FA.MOUSE_WHEEL:return this._handleMouseWheel(e);default:return!1}},t._handleMouseDown=function(e){var t=this._node;return!(!t||!t._uiProps.uiTransformComp||(e.getLocation(YA),!t._uiProps.uiTransformComp.hitTest(YA)||(e.type=By.MOUSE_DOWN,e.bubbles=!0,t.dispatchEvent(e),e.propagationStopped=!0,0)))},t._handleMouseMove=function(e){var t=this._node;return!(!t||!t._uiProps.uiTransformComp||(e.getLocation(YA),t._uiProps.uiTransformComp.hitTest(YA)?(this.previousMouseIn||(XA&&XA!==t&&(e.type=By.MOUSE_LEAVE,XA.dispatchEvent(e),XA.eventProcessor.previousMouseIn=!1),XA=t,e.type=By.MOUSE_ENTER,t.dispatchEvent(e),this.previousMouseIn=!0),e.type=By.MOUSE_MOVE,e.bubbles=!0,t.dispatchEvent(e),e.propagationStopped=!0,0):(this.previousMouseIn&&(e.type=By.MOUSE_LEAVE,t.dispatchEvent(e),this.previousMouseIn=!1,XA=null),1)))},t._handleMouseUp=function(e){var t=this._node;return!(!t||!t._uiProps.uiTransformComp||(e.getLocation(YA),!t._uiProps.uiTransformComp.hitTest(YA)||(e.type=By.MOUSE_UP,e.bubbles=!0,t.dispatchEvent(e),e.propagationStopped=!0,0)))},t._handleMouseWheel=function(e){var t=this._node;return!(!t||!t._uiProps.uiTransformComp||(e.getLocation(YA),!t._uiProps.uiTransformComp.hitTest(YA)||(e.type=By.MOUSE_WHEEL,e.bubbles=!0,t.dispatchEvent(e),e.propagationStopped=!0,0)))},t._handleEventTouch=function(e){switch(e.type){case FA.TOUCH_START:return this._handleTouchStart(e);case FA.TOUCH_MOVE:return this._handleTouchMove(e);case FA.TOUCH_END:return this._handleTouchEnd(e);case FA.TOUCH_CANCEL:return this._handleTouchCancel(e);default:return!1}},t._handleTouchStart=function(e){var t=this.node;return!(!t||!t._uiProps.uiTransformComp||(e.getLocation(YA),!t._uiProps.uiTransformComp.hitTest(YA)||(e.type=By.TOUCH_START,e.bubbles=!0,this._dispatchingTouch=e.touch,t.dispatchEvent(e),0)))},t._handleTouchMove=function(e){var t=this.node;return!(!t||!t._uiProps.uiTransformComp||(e.type=By.TOUCH_MOVE,e.bubbles=!0,this._dispatchingTouch=e.touch,t.dispatchEvent(e),0))},t._handleTouchEnd=function(e){var t=this.node;t&&t._uiProps.uiTransformComp&&(e.getLocation(YA),t._uiProps.uiTransformComp.hitTest(YA)?e.type=By.TOUCH_END:e.type=By.TOUCH_CANCEL,e.bubbles=!0,t.dispatchEvent(e),this._dispatchingTouch=null)},t._handleTouchCancel=function(e){var t=this.node;t&&t._uiProps.uiTransformComp&&(e.type=By.TOUCH_CANCEL,e.bubbles=!0,t.dispatchEvent(e))},c(e,[{key:"isEnabled",get:function(){return this._isEnabled}},{key:"node",get:function(){return this._node}}]),e}());QA._maskComp=null,QA.callbacksInvoker=new Ea,R.NodeEventProcessor=QA;var ZA=e("cE",function(){function e(){this._groundAlbedoHDR=new sn(.2,.2,.2,1),this._skyColorHDR=new sn(.2,.5,.8,1),this._skyIllumHDR=0,this._groundAlbedoLDR=new sn(.2,.2,.2,1),this._skyColorLDR=new sn(.2,.5,.8,1),this._skyIllumLDR=0,this._mipmapCount=1,this._enabled=!1}return e.prototype.initialize=function(e){this._skyColorHDR=e.skyColorHDR,this._groundAlbedoHDR.set(e.groundAlbedoHDR),this._skyIllumHDR=e.skyIllumHDR,this._skyColorLDR=e.skyColorLDR,this._groundAlbedoLDR.set(e.groundAlbedoLDR),this._skyIllumLDR=e.skyIllumLDR},c(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e}},{key:"skyColor",get:function(){return R.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR:this._skyColorLDR},set:function(e){R.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(e):this._skyColorLDR.set(e)}},{key:"skyIllum",get:function(){return R.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR:this._skyIllumLDR},set:function(e){R.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR=e:this._skyIllumLDR=e}},{key:"groundAlbedo",get:function(){return R.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR:this._groundAlbedoLDR},set:function(e){R.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(e):this._groundAlbedoLDR.set(e)}}]),e}());ZA.SUN_ILLUM=65e3,ZA.SKY_ILLUM=2e4,R.Ambient=ZA;var JA=e("cH",dt({Low_256x256:256,Medium_512x512:512,High_1024x1024:1024,Ultra_2048x2048:2048})),$A=e("cI",dt({Planar:0,ShadowMap:1})),eS=e("cJ",dt({HARD:0,SOFT:1,SOFT_2X:2})),tS=e("cK",dt({LEVEL_1:1,LEVEL_2:2,LEVEL_3:3,LEVEL_4:4})),iS=e("cL",dt({NONE:1,RemoveDuplicates:2,DisableRotationFix:3})),nS=$A.ShadowMap+1,rS=e("cM",function(){function e(){this.fixedSphere=new co(0,0,0,.01),this.maxReceived=4,this._matLight=new Qi,this._material=null,this._instancingMaterial=null,this._enabled=!1,this._type=nS,this._distance=0,this._normal=new Di(0,1,0),this._shadowColor=new Fi(0,0,0,76),this._size=new en(1024,1024),this._shadowMapDirty=!1}var t=e.prototype;return t.getPlanarShader=function(e){this._material||(this._material=new Ey,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 Ey,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:nS,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(){this.enabled&&this.type===$A.Planar&&this._updatePlanarInfo()},t._updatePlanarInfo=function(){this._material||(this._material=new Ey,this._material.initialize({effectName:"pipeline/planar-shadow"})),this._instancingMaterial||(this._instancingMaterial=new Ey,this._instancingMaterial.initialize({effectName:"pipeline/planar-shadow",defines:{USE_INSTANCING:!0}}))},t.destroy=function(){this._material&&this._material.destroy(),this._instancingMaterial&&this._instancingMaterial.destroy(),this.fixedSphere.destroy()},c(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:nS,this.activate()}},{key:"normal",get:function(){return this._normal},set:function(e){Di.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}());rS.MAX_FAR=2e3,rS.COEFFICIENT_OF_EXPANSION=2*Math.sqrt(3),R.Shadows=rS;var sS=null,aS=null,oS=e("cF",dt({HEMISPHERE_DIFFUSE:0,AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION:1,DIFFUSEMAP_WITH_REFLECTION:2})),uS=e("cG",function(){function e(){this._envmapLDR=null,this._envmapHDR=null,this._diffuseMapLDR=null,this._diffuseMapHDR=null,this._globalDSManager=null,this._model=null,this._default=null,this._enabled=!1,this._useIBL=!1,this._useHDR=!0,this._useDiffuseMap=!1,this._editableMaterial=null,this._activated=!1,this._reflectionHDR=null,this._reflectionLDR=null}var t=e.prototype;return t.initialize=function(e){this._activated=!1,this._enabled=e.enabled,this._useIBL=e.useIBL,this._useDiffuseMap=e.applyDiffuseMap,this._useHDR=e.useHDR},t.setEnvMaps=function(e,t){this._envmapHDR=e,this._envmapLDR=t,this._updateGlobalBinding(),this._updatePipeline()},t.setDiffuseMaps=function(e,t){this._diffuseMapHDR=e,this._diffuseMapLDR=t,this._updateGlobalBinding(),this._updatePipeline()},t.setSkyboxMaterial=function(e){e?(this._editableMaterial=new OA({parent:e}),this._editableMaterial.recompileShaders({USE_RGBE_CUBEMAP:this.isRGBE})):this._editableMaterial=null,this._updatePipeline()},t.setReflectionMaps=function(e,t){this._reflectionHDR=e,this._reflectionLDR=t,this._updateGlobalBinding(),this._updatePipeline()},t.updateMaterialRenderInfo=function(){this._updateGlobalBinding(),this._updatePipeline()},t.activate=function(){var e=R.director.root.pipeline;this._globalDSManager=e.globalDSManager,this._default=Kv.get("default-cube-texture"),this._model||(this._model=R.director.root.createModel(R.renderer.scene.Model));var t=this._default.isRGBE;if(this._default.isUsingOfflineMipmaps(),this.envmap&&(t=this.envmap.isRGBE,this.envmap.isUsingOfflineMipmaps()),!aS){var i=new Ey;i.initialize({effectName:"pipeline/skybox",defines:{USE_RGBE_CUBEMAP:t}}),aS=new OA({parent:i})}this.enabled&&(sS||(sS=R.utils.createMesh(R.primitives.box({width:2,height:2,length:2}))),this._editableMaterial?this._model.initSubModel(0,sS.renderingSubMeshes[0],this._editableMaterial):this._model.initSubModel(0,sS.renderingSubMeshes[0],aS)),this.envmap||(this.envmap=this._default),this.diffuseMap||(this.diffuseMap=this._default),this._updateGlobalBinding(),this._updatePipeline(),this._activated=!0},t._updatePipeline=function(){var e=R.director.root,t=e.pipeline,i=this.useIBL?this.isRGBE?2:1:0,n=this.useIBL&&this.useDiffuseMap&&this.diffuseMap?this.isRGBE?2:1:0,r=this.useHDR,s=this.useConvolutionMap;if(t.macros.CC_USE_IBL===i&&t.macros.CC_USE_DIFFUSEMAP===n&&t.macros.CC_USE_HDR===r&&t.macros.CC_IBL_CONVOLUTED===s||(t.macros.CC_USE_IBL=i,t.macros.CC_USE_DIFFUSEMAP=n,t.macros.CC_USE_HDR=r,t.macros.CC_IBL_CONVOLUTED=s,this._activated&&e.onGlobalPipelineStateChanged()),this.enabled){var a=this.envmap?this.envmap:this._default;this._editableMaterial?(this._editableMaterial.setProperty("environmentMap",a),this._editableMaterial.recompileShaders({USE_RGBE_CUBEMAP:this.isRGBE})):aS&&(aS.setProperty("environmentMap",a),aS.recompileShaders({USE_RGBE_CUBEMAP:this.isRGBE})),this._model&&(this._editableMaterial?this._model.setSubModelMaterial(0,this._editableMaterial):this._model.setSubModelMaterial(0,aS),this._updateSubModes())}},t._updateGlobalBinding=function(){if(this._globalDSManager){var e=Va.gfxDevice;if(this.reflectionMap){var t=this.reflectionMap.getGFXTexture(),i=e.getSampler(this.reflectionMap.getSamplerInfo());this._globalDSManager.bindSampler(qd,i),this._globalDSManager.bindTexture(qd,t)}else{var n=this.envmap?this.envmap:this._default;if(n){var r=n.getGFXTexture(),s=e.getSampler(n.getSamplerInfo());this._globalDSManager.bindSampler(qd,s),this._globalDSManager.bindTexture(qd,r)}}var a=this.diffuseMap?this.diffuseMap:this._default;if(a){var o=a.getGFXTexture(),u=e.getSampler(a.getSamplerInfo());this._globalDSManager.bindSampler(Zd,u),this._globalDSManager.bindTexture(Zd,o)}this._globalDSManager.update()}},t._updateSubModes=function(){if(this._model)for(var e=this._model.subModels,t=0;t<e.length;t++)e[t].update()},c(e,[{key:"model",get:function(){return this._model}},{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e,e?this.activate():this._updatePipeline()}},{key:"useHDR",get:function(){return this._useHDR},set:function(e){this._useHDR=e,this.setEnvMaps(this._envmapHDR,this._envmapLDR)}},{key:"useIBL",get:function(){return this._useIBL},set:function(e){this._useIBL=e,this._updatePipeline()}},{key:"useDiffuseMap",get:function(){return this._useDiffuseMap},set:function(e){this._useDiffuseMap=e,this._updatePipeline()}},{key:"isRGBE",get:function(){return!!this.envmap&&this.envmap.isRGBE}},{key:"useConvolutionMap",get:function(){return this.reflectionMap?this.reflectionMap.isUsingOfflineMipmaps():!!this.envmap&&this.envmap.isUsingOfflineMipmaps()}},{key:"envmap",get:function(){return R.director.root.pipeline.pipelineSceneData.isHDR?this._envmapHDR:this._envmapLDR},set:function(e){R.director.root.pipeline.pipelineSceneData.isHDR?this.setEnvMaps(e,this._envmapLDR):this.setEnvMaps(this._envmapHDR,e)}},{key:"diffuseMap",get:function(){return R.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR:this._diffuseMapLDR},set:function(e){R.director.root.pipeline.pipelineSceneData.isHDR?this.setDiffuseMaps(e,this._diffuseMapLDR):this.setDiffuseMaps(this._diffuseMapHDR,e)}},{key:"reflectionMap",get:function(){return R.director.root.pipeline.pipelineSceneData.isHDR?this._reflectionHDR:this._reflectionLDR}}]),e}());R.Skybox=uS;var hS,cS,lS,_S,fS,dS,pS,mS,gS,vS,yS,ES,TS,AS,SS,bS,wS,RS,IS,OS,NS,CS,MS,xS,FS,PS,DS,LS,BS,US,GS,zS,kS,HS,VS,WS,jS,XS,YS,qS,KS,QS,ZS,JS,$S,eb,tb,ib,nb,rb,sb,ab,ob,ub,hb,cb,lb,_b,fb,db,pb,mb,gb,vb,yb,Eb,Tb,Ab,Sb,bb,wb,Rb,Ib,Ob,Nb,Cb,Mb,xb,Fb,Pb,Db,Lb,Bb,Ub,Gb,zb,kb,Hb,Vb,Wb,jb,Xb,Yb,qb,Kb,Qb,Zb,Jb,$b,ew,tw,iw,nw,rw,sw,aw,ow,uw,hw,cw,lw,_w,fw,dw,pw,mw,gw,vw,yw,Ew,Tw,Aw,Sw,bw,ww,Rw,Iw,Ow,Nw,Cw,Mw,xw,Fw,Pw,Dw,Lw,Bw,Uw,Gw,zw,kw,Hw,Vw,Ww,jw,Xw,Yw,qw,Kw,Qw,Zw,Jw=new sn,$w=e("cN",dt({LINEAR:0,EXP:1,EXP_SQUARED:2,LAYERED:3})),eR=$w.LAYERED+1,tR=e("cO",function(){function e(){this._fogColor=new Fi("#C8C8C8"),this._colorArray=new sn(.2,.2,.2,1),this._enabled=!1,this._accurate=!1,this._type=0,this._fogDensity=.3,this._fogStart=.5,this._fogEnd=300,this._fogAtten=5,this._fogTop=1.5,this._fogRange=1.2,this._activated=!1}var t=e.prototype;return t.initialize=function(e){this._activated=!1,this.fogColor=e.fogColor,this._enabled=e.enabled,this._type=this.enabled?e.type:eR,this._accurate=e.accurate,this.fogDensity=e.fogDensity,this.fogStart=e.fogStart,this.fogEnd=e.fogEnd,this.fogAtten=e.fogAtten,this.fogTop=e.fogTop,this.fogRange=e.fogRange},t.activate=function(){this._updatePipeline(),this._activated=!0},t._updatePipeline=function(){var e=R.director.root,t=this.enabled?this.type:eR,i=this.accurate?1:0,n=e.pipeline;n.macros.CC_USE_FOG===t&&n.macros.CC_USE_ACCURATE_FOG===i||(n.macros.CC_USE_FOG=t,n.macros.CC_USE_ACCURATE_FOG=i,this._activated&&e.onGlobalPipelineStateChanged())},c(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e,e?this.activate():(this._type=eR,this._updatePipeline())}},{key:"accurate",get:function(){return this._accurate},set:function(e){this._accurate=e,this._updatePipeline()}},{key:"fogColor",get:function(){return this._fogColor},set:function(e){this._fogColor.set(e),Jw.set(e.x,e.y,e.z,e.w),ay(this._colorArray,Jw)}},{key:"type",get:function(){return this._type},set:function(e){this._type=this.enabled?e:eR,this.enabled&&this._updatePipeline()}},{key:"fogDensity",get:function(){return this._fogDensity},set:function(e){this._fogDensity=e}},{key:"fogStart",get:function(){return this._fogStart},set:function(e){this._fogStart=e}},{key:"fogEnd",get:function(){return this._fogEnd},set:function(e){this._fogEnd=e}},{key:"fogAtten",get:function(){return this._fogAtten},set:function(e){this._fogAtten=e}},{key:"fogTop",get:function(){return this._fogTop},set:function(e){this._fogTop=e}},{key:"fogRange",get:function(){return this._fogRange},set:function(e){this._fogRange=e}},{key:"colorArray",get:function(){return this._colorArray}}]),e}());R.Fog=tR;var iR=new Di(0,1,0),nR=new Di,rR=new sn,sR=new Fi,aR=new Hi,oR=function(e){var t=1/Math.max(Math.max(Math.max(e.x,e.y),e.z),1e-4);t<1&&(e.x*=t,e.y*=t,e.z*=t)},uR=e("hB",(hS=th("cc.AmbientInfo"),cS=Th(),lS=bh(),_S=Dh(jt),fS=bh(),dS=Th(),pS=bh(),mS=ch("_skyColor"),gS=ch("_skyIllum"),vS=ch("_groundAlbedo"),hS((A((ES=function(){function e(){T(this,"_skyColorHDR",TS,this),T(this,"_skyIllumHDR",AS,this),T(this,"_groundAlbedoHDR",SS,this),T(this,"_skyColorLDR",bS,this),T(this,"_skyIllumLDR",wS,this),T(this,"_groundAlbedoLDR",RS,this),this._resource=null}return e.prototype.activate=function(e){this._resource=e,this._resource.initialize(this)},c(e,[{key:"skyColorHDR",get:function(){return this._skyColorHDR}},{key:"groundAlbedoHDR",get:function(){return this._groundAlbedoHDR}},{key:"skyIllumHDR",get:function(){return this._skyIllumHDR}},{key:"skyColorLDR",get:function(){return this._skyColorLDR}},{key:"groundAlbedoLDR",get:function(){return this._groundAlbedoLDR}},{key:"skyIllumLDR",get:function(){return this._skyIllumLDR}},{key:"skyLightingColor",get:function(){var e=R.director.root.pipeline.pipelineSceneData.isHDR;return rR.set(e?this._skyColorHDR:this._skyColorLDR),oR(rR),sR.set(255*rR.x,255*rR.y,255*rR.z,255)},set:function(e){rR.set(e.x,e.y,e.z,e.w),R.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(rR):this._skyColorLDR.set(rR),this._resource&&this._resource.skyColor.set(rR)}},{key:"skyColor",set:function(e){R.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(e):this._skyColorLDR.set(e),this._resource&&this._resource.skyColor.set(e)}},{key:"skyIllum",get:function(){return R.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR:this._skyIllumLDR},set:function(e){R.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR=e:this._skyIllumLDR=e,this._resource&&(this._resource.skyIllum=e)}},{key:"groundLightingColor",get:function(){var e=R.director.root.pipeline.pipelineSceneData.isHDR;return rR.set(e?this._groundAlbedoHDR:this._groundAlbedoLDR),oR(rR),sR.set(255*rR.x,255*rR.y,255*rR.z,255)},set:function(e){rR.set(e.x,e.y,e.z,e.w),R.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(rR):this._groundAlbedoLDR.set(rR),this._resource&&this._resource.groundAlbedo.set(rR)}},{key:"groundAlbedo",set:function(e){R.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(e):this._groundAlbedoLDR.set(e),this._resource&&this._resource.groundAlbedo.set(e)}}]),e}()).prototype,"skyLightingColor",[cS,Eh,lS],Object.getOwnPropertyDescriptor(ES.prototype,"skyLightingColor"),ES.prototype),A(ES.prototype,"skyIllum",[Eh,_S,fS],Object.getOwnPropertyDescriptor(ES.prototype,"skyIllum"),ES.prototype),A(ES.prototype,"groundLightingColor",[dS,Eh,pS],Object.getOwnPropertyDescriptor(ES.prototype,"groundLightingColor"),ES.prototype),TS=A(ES.prototype,"_skyColorHDR",[hh,mS],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new sn(.2,.5,.8,1)}}),AS=A(ES.prototype,"_skyIllumHDR",[hh,gS],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ZA.SKY_ILLUM}}),SS=A(ES.prototype,"_groundAlbedoHDR",[hh,vS],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new sn(.2,.2,.2,1)}}),bS=A(ES.prototype,"_skyColorLDR",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new sn(.2,.5,.8,1)}}),wS=A(ES.prototype,"_skyIllumLDR",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ZA.SKY_ILLUM}}),RS=A(ES.prototype,"_groundAlbedoLDR",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new sn(.2,.2,.2,1)}}),yS=ES))||yS));R.AmbientInfo=uR;var hR=e("hC",(IS=th("cc.SkyboxInfo"),OS=bh(),NS=Dh(oS),CS=bh(),MS=bh(),xS=Dh(bg),FS=bh(),PS=Th(),DS=Dh(bg),LS=Nh(),BS=Th(),US=Dh(bg),GS=Nh(),zS=Dh(Ey),kS=bh(),HS=Dh(bg),VS=ch("_envmap"),WS=Dh(bg),jS=Dh(bg),XS=Dh(bg),YS=Dh(Ey),qS=Dh(bg),KS=Dh(bg),IS((A((ZS=function(){function e(){T(this,"_envLightingType",JS,this),T(this,"_envmapHDR",$S,this),T(this,"_envmapLDR",eb,this),T(this,"_diffuseMapHDR",tb,this),T(this,"_diffuseMapLDR",ib,this),T(this,"_enabled",nb,this),T(this,"_useHDR",rb,this),T(this,"_editableMaterial",sb,this),T(this,"_reflectionHDR",ab,this),T(this,"_reflectionLDR",ob,this),this._resource=null}return e.prototype.activate=function(e){this.envLightingType=this._envLightingType,this._resource=e,this._resource.initialize(this),this._resource.setEnvMaps(this._envmapHDR,this._envmapLDR),this._resource.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR),this._resource.setSkyboxMaterial(this._editableMaterial),this._resource.setReflectionMaps(this._reflectionHDR,this._reflectionLDR),this._resource.activate()},c(e,[{key:"applyDiffuseMap",get:function(){return oS.DIFFUSEMAP_WITH_REFLECTION===this._envLightingType},set:function(e){this._resource&&(this._resource.useDiffuseMap=e)}},{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e,this._resource&&(this._resource.enabled=this._enabled))}},{key:"envLightingType",get:function(){return this._envLightingType},set:function(e){this.envmap||oS.HEMISPHERE_DIFFUSE===e?(oS.HEMISPHERE_DIFFUSE===e?(this.useIBL=!1,this.applyDiffuseMap=!1):oS.AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION===e?(this.useIBL=!0,this.applyDiffuseMap=!1):oS.DIFFUSEMAP_WITH_REFLECTION===e&&(this.useIBL=!0,this.applyDiffuseMap=!0),this._envLightingType=e):(this.useIBL=!1,this.applyDiffuseMap=!1,this._envLightingType=oS.HEMISPHERE_DIFFUSE,Y(15001))}},{key:"useIBL",get:function(){return oS.HEMISPHERE_DIFFUSE!==this._envLightingType},set:function(e){this._resource&&(this._resource.useIBL=e)}},{key:"useHDR",get:function(){return R.director.root.pipeline.pipelineSceneData.isHDR=this._useHDR,this._useHDR},set:function(e){R.director.root.pipeline.pipelineSceneData.isHDR=e,this._useHDR=e,this._resource&&this.envLightingType===oS.DIFFUSEMAP_WITH_REFLECTION&&(null===this.diffuseMap?(this.envLightingType=oS.AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION,Y(15e3)):this.diffuseMap.isDefault&&Y(15002)),this._resource&&(this._resource.useHDR=this._useHDR,this._resource.updateMaterialRenderInfo())}},{key:"envmap",get:function(){return R.director.root.pipeline.pipelineSceneData.isHDR?this._envmapHDR:this._envmapLDR},set:function(e){var t=R.director.root.pipeline.pipelineSceneData.isHDR;t?(this._envmapHDR=e,this._reflectionHDR=null):(this._envmapLDR=e,this._reflectionLDR=null),e||(t?this._diffuseMapHDR=null:this._diffuseMapLDR=null,this.applyDiffuseMap=!1,this.useIBL=!1,this.envLightingType=oS.HEMISPHERE_DIFFUSE,Y(15001)),this._resource&&(this._resource.setEnvMaps(this._envmapHDR,this._envmapLDR),this._resource.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR),this._resource.setReflectionMaps(this._reflectionHDR,this._reflectionLDR),this._resource.useDiffuseMap=this.applyDiffuseMap,this._resource.envmap=e)}},{key:"diffuseMap",get:function(){return R.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR:this._diffuseMapLDR},set:function(e){R.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR=e:this._diffuseMapLDR=e,this._resource&&this._resource.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR)}},{key:"reflectionMap",get:function(){return R.director.root.pipeline.pipelineSceneData.isHDR?this._reflectionHDR:this._reflectionLDR},set:function(e){R.director.root.pipeline.pipelineSceneData.isHDR?this._reflectionHDR=e:this._reflectionLDR=e,this._resource&&this._resource.setReflectionMaps(this._reflectionHDR,this._reflectionLDR)}},{key:"skyboxMaterial",get:function(){return this._editableMaterial},set:function(e){this._editableMaterial=e,this._resource&&this._resource.setSkyboxMaterial(this._editableMaterial)}}]),e}()).prototype,"enabled",[Eh,OS],Object.getOwnPropertyDescriptor(ZS.prototype,"enabled"),ZS.prototype),A(ZS.prototype,"envLightingType",[Eh,NS,CS],Object.getOwnPropertyDescriptor(ZS.prototype,"envLightingType"),ZS.prototype),A(ZS.prototype,"useHDR",[Eh,MS],Object.getOwnPropertyDescriptor(ZS.prototype,"useHDR"),ZS.prototype),A(ZS.prototype,"envmap",[Eh,xS,FS],Object.getOwnPropertyDescriptor(ZS.prototype,"envmap"),ZS.prototype),A(ZS.prototype,"diffuseMap",[PS,Eh,Ah,DS,LS],Object.getOwnPropertyDescriptor(ZS.prototype,"diffuseMap"),ZS.prototype),A(ZS.prototype,"reflectionMap",[BS,Eh,Ah,US,GS],Object.getOwnPropertyDescriptor(ZS.prototype,"reflectionMap"),ZS.prototype),A(ZS.prototype,"skyboxMaterial",[Eh,zS,kS],Object.getOwnPropertyDescriptor(ZS.prototype,"skyboxMaterial"),ZS.prototype),JS=A(ZS.prototype,"_envLightingType",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return oS.HEMISPHERE_DIFFUSE}}),$S=A(ZS.prototype,"_envmapHDR",[hh,HS,VS],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),eb=A(ZS.prototype,"_envmapLDR",[hh,WS],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),tb=A(ZS.prototype,"_diffuseMapHDR",[hh,jS],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ib=A(ZS.prototype,"_diffuseMapLDR",[hh,XS],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),nb=A(ZS.prototype,"_enabled",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),rb=A(ZS.prototype,"_useHDR",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),sb=A(ZS.prototype,"_editableMaterial",[hh,YS],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ab=A(ZS.prototype,"_reflectionHDR",[hh,qS],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ob=A(ZS.prototype,"_reflectionLDR",[hh,KS],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),QS=ZS))||QS));R.SkyboxInfo=hR;var cR=e("hD",(ub=th("cc.FogInfo"),hb=bh(),cb=Nh(),lb=bh(),_b=Nh(),fb=bh(),db=Dh($w),pb=Nh(),mb=bh(),gb=Th(),vb=Dh(jt),yb=wh(),Eb=Ih(),Tb=bh(),Ab=Th(),Sb=Dh(jt),bb=Ih(),wb=bh(),Rb=Th(),Ib=Dh(jt),Ob=Ih(),Nb=bh(),Cb=Th(),Mb=Dh(jt),xb=Rh(),Fb=Ih(),Pb=bh(),Db=Th(),Lb=Dh(jt),Bb=Ih(),Ub=bh(),Gb=Th(),zb=Dh(jt),kb=Ih(),Hb=bh(),ub((iw=tw=function(){function e(){T(this,"_type",jb,this),T(this,"_fogColor",Xb,this),T(this,"_enabled",Yb,this),T(this,"_fogDensity",qb,this),T(this,"_fogStart",Kb,this),T(this,"_fogEnd",Qb,this),T(this,"_fogAtten",Zb,this),T(this,"_fogTop",Jb,this),T(this,"_fogRange",$b,this),T(this,"_accurate",ew,this),this._resource=null}return e.prototype.activate=function(e){this._resource=e,this._resource.initialize(this),this._resource.activate()},c(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e,this._resource&&(this._resource.enabled=e,e&&(this._resource.type=this._type)))}},{key:"accurate",get:function(){return this._accurate},set:function(e){this._accurate!==e&&(this._accurate=e,this._resource&&(this._resource.accurate=e,e&&(this._resource.type=this._type)))}},{key:"fogColor",get:function(){return this._fogColor},set:function(e){this._fogColor.set(e),this._resource&&(this._resource.fogColor=this._fogColor)}},{key:"type",get:function(){return this._type},set:function(e){this._type=e,this._resource&&(this._resource.type=e)}},{key:"fogDensity",get:function(){return this._fogDensity},set:function(e){this._fogDensity=e,this._resource&&(this._resource.fogDensity=e)}},{key:"fogStart",get:function(){return this._fogStart},set:function(e){this._fogStart=e,this._resource&&(this._resource.fogStart=e)}},{key:"fogEnd",get:function(){return this._fogEnd},set:function(e){this._fogEnd=e,this._resource&&(this._resource.fogEnd=e)}},{key:"fogAtten",get:function(){return this._fogAtten},set:function(e){this._fogAtten=e,this._resource&&(this._resource.fogAtten=e)}},{key:"fogTop",get:function(){return this._fogTop},set:function(e){this._fogTop=e,this._resource&&(this._resource.fogTop=e)}},{key:"fogRange",get:function(){return this._fogRange},set:function(e){this._fogRange=e,this._resource&&(this._resource.fogRange=e)}}]),e}(),tw.FogType=$w,A((Wb=iw).prototype,"enabled",[Eh,hb,cb],Object.getOwnPropertyDescriptor(Wb.prototype,"enabled"),Wb.prototype),A(Wb.prototype,"accurate",[Eh,lb,_b],Object.getOwnPropertyDescriptor(Wb.prototype,"accurate"),Wb.prototype),A(Wb.prototype,"fogColor",[Eh,fb],Object.getOwnPropertyDescriptor(Wb.prototype,"fogColor"),Wb.prototype),A(Wb.prototype,"type",[Eh,db,pb,mb],Object.getOwnPropertyDescriptor(Wb.prototype,"type"),Wb.prototype),A(Wb.prototype,"fogDensity",[gb,vb,yb,Eb,Oh,Tb],Object.getOwnPropertyDescriptor(Wb.prototype,"fogDensity"),Wb.prototype),A(Wb.prototype,"fogStart",[Ab,Sb,bb,wb],Object.getOwnPropertyDescriptor(Wb.prototype,"fogStart"),Wb.prototype),A(Wb.prototype,"fogEnd",[Rb,Ib,Ob,Nb],Object.getOwnPropertyDescriptor(Wb.prototype,"fogEnd"),Wb.prototype),A(Wb.prototype,"fogAtten",[Cb,Mb,xb,Fb,Pb],Object.getOwnPropertyDescriptor(Wb.prototype,"fogAtten"),Wb.prototype),A(Wb.prototype,"fogTop",[Db,Lb,Bb,Ub],Object.getOwnPropertyDescriptor(Wb.prototype,"fogTop"),Wb.prototype),A(Wb.prototype,"fogRange",[Gb,zb,kb,Hb],Object.getOwnPropertyDescriptor(Wb.prototype,"fogRange"),Wb.prototype),jb=A(Wb.prototype,"_type",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return $w.LINEAR}}),Xb=A(Wb.prototype,"_fogColor",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Fi("#C8C8C8")}}),Yb=A(Wb.prototype,"_enabled",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),qb=A(Wb.prototype,"_fogDensity",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return.3}}),Kb=A(Wb.prototype,"_fogStart",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return.5}}),Qb=A(Wb.prototype,"_fogEnd",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 300}}),Zb=A(Wb.prototype,"_fogAtten",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 5}}),Jb=A(Wb.prototype,"_fogTop",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1.5}}),$b=A(Wb.prototype,"_fogRange",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1.2}}),ew=A(Wb.prototype,"_accurate",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Vb=Wb))||Vb)),lR=e("hE",(nw=th("cc.ShadowsInfo"),rw=bh(),sw=Dh($A),aw=Th(),ow=Th(),uw=bh(),hw=Dh(jt),cw=Th(),lw=bh(),_w=Dh(Wt),fw=bh(),dw=Th(),pw=Dh(JA),mw=bh(),gw=Th(),nw((A((yw=function(){function e(){T(this,"_enabled",Ew,this),T(this,"_type",Tw,this),T(this,"_normal",Aw,this),T(this,"_distance",Sw,this),T(this,"_shadowColor",bw,this),T(this,"_maxReceived",ww,this),T(this,"_size",Rw,this),this._resource=null}var t=e.prototype;return t.setPlaneFromNode=function(e){e.getWorldRotation(aR),this.planeDirection=Di.transformQuat(nR,iR,aR),e.getWorldPosition(nR),this.planeHeight=Di.dot(this._normal,nR)},t.activate=function(e){this._resource=e,this._resource.initialize(this),this._resource.activate()},c(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e,this._resource&&(this._resource.enabled=e,e&&(this._resource.type=this._type)))}},{key:"type",get:function(){return this._type},set:function(e){this._type=e,this._resource&&(this._resource.type=e)}},{key:"shadowColor",get:function(){return this._shadowColor},set:function(e){this._shadowColor.set(e),this._resource&&(this._resource.shadowColor=e)}},{key:"planeDirection",get:function(){return this._normal},set:function(e){Di.copy(this._normal,e),this._resource&&(this._resource.normal=e)}},{key:"planeHeight",get:function(){return this._distance},set:function(e){this._distance=e,this._resource&&(this._resource.distance=e)}},{key:"maxReceived",get:function(){return this._maxReceived},set:function(e){this._maxReceived=e,this._resource&&(this._resource.maxReceived=e)}},{key:"shadowMapSize",get:function(){return this._size.x},set:function(e){this._size.set(e,e),this._resource&&(this._resource.size.set(e,e),this._resource.shadowMapDirty=!0)}}]),e}()).prototype,"enabled",[Eh,rw],Object.getOwnPropertyDescriptor(yw.prototype,"enabled"),yw.prototype),A(yw.prototype,"type",[Eh,sw],Object.getOwnPropertyDescriptor(yw.prototype,"type"),yw.prototype),A(yw.prototype,"shadowColor",[aw],Object.getOwnPropertyDescriptor(yw.prototype,"shadowColor"),yw.prototype),A(yw.prototype,"planeDirection",[ow,uw],Object.getOwnPropertyDescriptor(yw.prototype,"planeDirection"),yw.prototype),A(yw.prototype,"planeHeight",[Eh,hw,cw,lw],Object.getOwnPropertyDescriptor(yw.prototype,"planeHeight"),yw.prototype),A(yw.prototype,"maxReceived",[_w,fw,dw],Object.getOwnPropertyDescriptor(yw.prototype,"maxReceived"),yw.prototype),A(yw.prototype,"shadowMapSize",[pw,mw,gw],Object.getOwnPropertyDescriptor(yw.prototype,"shadowMapSize"),yw.prototype),Ew=A(yw.prototype,"_enabled",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Tw=A(yw.prototype,"_type",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return $A.Planar}}),Aw=A(yw.prototype,"_normal",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Di(0,1,0)}}),Sw=A(yw.prototype,"_distance",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),bw=A(yw.prototype,"_shadowColor",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Fi(0,0,0,76)}}),ww=A(yw.prototype,"_maxReceived",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 4}}),Rw=A(yw.prototype,"_size",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new en(1024,1024)}}),vw=yw))||vw));R.ShadowsInfo=lR;var _R=e("hF",new Di(-1024,-1024,-1024)),fR=e("hG",new Di(1024,1024,1024)),dR=e("hH",8),pR=e("hI",(Iw=th("cc.OctreeInfo"),Ow=bh(),Nw=bh(),Cw=Sh(),Mw=bh(),xw=Sh(),Fw=wh(),Pw=Dh(Wt),Dw=bh(),Iw((A((Bw=function(){function e(){T(this,"_enabled",Uw,this),T(this,"_minPos",Gw,this),T(this,"_maxPos",zw,this),T(this,"_depth",kw,this),this._resource=null}return e.prototype.activate=function(e){this._resource=e,this._resource.initialize(this)},c(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e,this._resource&&(this._resource.enabled=e))}},{key:"minPos",get:function(){return this._minPos},set:function(e){this._minPos=e,this._resource&&(this._resource.minPos=e)}},{key:"maxPos",get:function(){return this._maxPos},set:function(e){this._maxPos=e,this._resource&&(this._resource.maxPos=e)}},{key:"depth",get:function(){return this._depth},set:function(e){this._depth=e,this._resource&&(this._resource.depth=e)}}]),e}()).prototype,"enabled",[Eh,Ow],Object.getOwnPropertyDescriptor(Bw.prototype,"enabled"),Bw.prototype),A(Bw.prototype,"minPos",[Eh,Nw,Cw],Object.getOwnPropertyDescriptor(Bw.prototype,"minPos"),Bw.prototype),A(Bw.prototype,"maxPos",[Eh,Mw,xw],Object.getOwnPropertyDescriptor(Bw.prototype,"maxPos"),Bw.prototype),A(Bw.prototype,"depth",[Eh,Fw,Oh,Pw,Dw],Object.getOwnPropertyDescriptor(Bw.prototype,"depth"),Bw.prototype),Uw=A(Bw.prototype,"_enabled",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Gw=A(Bw.prototype,"_minPos",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Di(_R)}}),zw=A(Bw.prototype,"_maxPos",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Di(fR)}}),kw=A(Bw.prototype,"_depth",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return dR}}),Lw=Bw))||Lw)),mR=e("hJ",(Hw=th("cc.SceneGlobals"),Vw=Dh(hR),Hw((Zw=function(){function e(){T(this,"ambient",Xw,this),T(this,"shadows",Yw,this),T(this,"_skybox",qw,this),T(this,"fog",Kw,this),T(this,"octree",Qw,this)}return e.prototype.activate=function(){var e=R.director.root.pipeline.pipelineSceneData;this.skybox.activate(e.skybox),this.ambient.activate(e.ambient),this.shadows.activate(e.shadows),this.fog.activate(e.fog),this.octree.activate(e.octree),R.director.root.onGlobalPipelineStateChanged()},c(e,[{key:"skybox",get:function(){return this._skybox},set:function(e){this._skybox=e}}]),e}(),Xw=A((jw=Zw).prototype,"ambient",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new uR}}),Yw=A(jw.prototype,"shadows",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new lR}}),qw=A(jw.prototype,"_skybox",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new hR}}),Kw=A(jw.prototype,"fog",[Eh,hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new cR}}),A(jw.prototype,"skybox",[Eh,Vw],Object.getOwnPropertyDescriptor(jw.prototype,"skybox"),jw.prototype),Qw=A(jw.prototype,"octree",[Eh,hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new pR}}),Ww=jw))||Ww));R.SceneGlobals=mR,fe({SystemEventType:{newName:"Input.EventType",since:"3.3.0",removed:!1}}),fe({SystemEvent:{newName:"Input",since:"3.4.0",removed:!1},systemEvent:{newName:"input",since:"3.4.0",removed:!1}});var gR,vR,yR=function(){function e(){this._intervalInMileSeconds=200,this._accelTimer=0,this._eventTarget=new Aa,this._deviceEventName=void 0,this._globalEventClass=void 0,this._didAccelerateFunc=void 0,this._globalEventClass=window.DeviceMotionEvent||window.DeviceOrientationEvent,xa.browserType===Sa.MOBILE_QQ&&(this._globalEventClass=window.DeviceOrientationEvent),this._deviceEventName=this._globalEventClass===window.DeviceMotionEvent?"devicemotion":"deviceorientation",this._didAccelerateFunc=this._didAccelerate.bind(this)}var t=e.prototype;return t._registerEvent=function(){this._accelTimer=performance.now(),window.addEventListener(this._deviceEventName,this._didAccelerateFunc,!1)},t._unregisterEvent=function(){this._accelTimer=0,window.removeEventListener(this._deviceEventName,this._didAccelerateFunc,!1)},t._didAccelerate=function(e){var t=performance.now();if(!(t-this._accelTimer<this._intervalInMileSeconds)){this._accelTimer=t;var i=0,n=0,r=0;if(this._globalEventClass===window.DeviceMotionEvent){var s=e.accelerationIncludingGravity;i=.1*((null==s?void 0:s.x)||0),n=.1*((null==s?void 0:s.y)||0),r=.1*((null==s?void 0:s.z)||0)}else{var a=e;i=(a.gamma||0)/90*.981,n=-(a.beta||0)/90*.981,r=(a.alpha||0)/90*.981}if(La.isFrameRotated){var o=i;i=-n,n=o}var u=i;90===window.orientation?(i=-n,n=u):-90===window.orientation?(i=n,n=-u):180===window.orientation&&(i=-i,n=-n),xa.os===Ra.ANDROID&&xa.browserType!==Sa.MOBILE_QQ&&(i=-i,n=-n);var h=performance.now(),c=new kA(i,n,r,h),l=new DA(c);this._eventTarget.emit(FA.DEVICEMOTION,l)}},t.start=function(){var e=this;window.DeviceMotionEvent&&"function"==typeof DeviceMotionEvent.requestPermission?DeviceMotionEvent.requestPermission().then((function(t){"granted"===t&&e._registerEvent()})).catch((function(){})):this._registerEvent()},t.stop=function(){this._unregisterEvent()},t.setInterval=function(e){this._intervalInMileSeconds=e},t.on=function(e,t,i){this._eventTarget.on(e,t,i)},e}(),ER={Backspace:zA.BACKSPACE,Tab:zA.TAB,Enter:zA.ENTER,ShiftLeft:zA.SHIFT_LEFT,ControlLeft:zA.CTRL_LEFT,AltLeft:zA.ALT_LEFT,ShiftRight:zA.SHIFT_RIGHT,ControlRight:zA.CTRL_RIGHT,AltRight:zA.ALT_RIGHT,Pause:zA.PAUSE,CapsLock:zA.CAPS_LOCK,Escape:zA.ESCAPE,Space:zA.SPACE,PageUp:zA.PAGE_UP,PageDown:zA.PAGE_DOWN,End:zA.END,Home:zA.HOME,ArrowLeft:zA.ARROW_LEFT,ArrowUp:zA.ARROW_UP,ArrowRight:zA.ARROW_RIGHT,ArrowDown:zA.ARROW_DOWN,Insert:zA.INSERT,Delete:zA.DELETE,Digit0:zA.DIGIT_0,Digit1:zA.DIGIT_1,Digit2:zA.DIGIT_2,Digit3:zA.DIGIT_3,Digit4:zA.DIGIT_4,Digit5:zA.DIGIT_5,Digit6:zA.DIGIT_6,Digit7:zA.DIGIT_7,Digit8:zA.DIGIT_8,Digit9:zA.DIGIT_9,KeyA:zA.KEY_A,KeyB:zA.KEY_B,KeyC:zA.KEY_C,KeyD:zA.KEY_D,KeyE:zA.KEY_E,KeyF:zA.KEY_F,KeyG:zA.KEY_G,KeyH:zA.KEY_H,KeyI:zA.KEY_I,KeyJ:zA.KEY_J,KeyK:zA.KEY_K,KeyL:zA.KEY_L,KeyM:zA.KEY_M,KeyN:zA.KEY_N,KeyO:zA.KEY_O,KeyP:zA.KEY_P,KeyQ:zA.KEY_Q,KeyR:zA.KEY_R,KeyS:zA.KEY_S,KeyT:zA.KEY_T,KeyU:zA.KEY_U,KeyV:zA.KEY_V,KeyW:zA.KEY_W,KeyX:zA.KEY_X,KeyY:zA.KEY_Y,KeyZ:zA.KEY_Z,Numpad0:zA.NUM_0,Numpad1:zA.NUM_1,Numpad2:zA.NUM_2,Numpad3:zA.NUM_3,Numpad4:zA.NUM_4,Numpad5:zA.NUM_5,Numpad6:zA.NUM_6,Numpad7:zA.NUM_7,Numpad8:zA.NUM_8,Numpad9:zA.NUM_9,NumpadMultiply:zA.NUM_MULTIPLY,NumpadAdd:zA.NUM_PLUS,NumpadSubtract:zA.NUM_SUBTRACT,NumpadDecimal:zA.NUM_DECIMAL,NumpadDivide:zA.NUM_DIVIDE,NumpadEnter:zA.NUM_ENTER,F1:zA.F1,F2:zA.F2,F3:zA.F3,F4:zA.F4,F5:zA.F5,F6:zA.F6,F7:zA.F7,F8:zA.F8,F9:zA.F9,F10:zA.F10,F11:zA.F11,F12:zA.F12,NumLock:zA.NUM_LOCK,ScrollLock:zA.SCROLL_LOCK,Semicolon:zA.SEMICOLON,Equal:zA.EQUAL,Comma:zA.COMMA,Minus:zA.DASH,Period:zA.PERIOD,Slash:zA.SLASH,Backquote:zA.BACK_QUOTE,BracketLeft:zA.BRACKET_LEFT,Backslash:zA.BACKSLASH,BracketRight:zA.BRACKET_RIGHT,Quote:zA.QUOTE},TR=function(){function e(){this._eventTarget=new Aa,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,ER[i]||zA.NONE);return new LA(n,t)},t._handleKeyboardDown=function(e){if(e.stopPropagation(),e.preventDefault(),e.repeat){var t=this._getInputEvent(e,FA.KEY_PRESSING);this._eventTarget.emit(FA.KEY_PRESSING,t)}else{var i=this._getInputEvent(e,FA.KEY_DOWN);this._eventTarget.emit(FA.KEY_DOWN,i)}},t._handleKeyboardUp=function(e){var t=this._getInputEvent(e,FA.KEY_UP);e.stopPropagation(),e.preventDefault(),this._eventTarget.emit(FA.KEY_UP,t)},e}(),AR=function(){function e(){this._canvas=void 0,this._eventTarget=new Aa,this._pointLocked=!1,this._isPressed=!1,this._preMousePos=new en,this._handleMouseDown=void 0,this._handleMouseMove=void 0,this._handleMouseUp=void 0,xa.hasFeature(Oa.EVENT_MOUSE)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||b||console.warn("failed to access canvas"),this._handleMouseDown=this._createCallback(FA.MOUSE_DOWN),this._handleMouseMove=this._createCallback(FA.MOUSE_MOVE),this._handleMouseUp=this._createCallback(FA.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 cn(t.x,t.y,t.width,t.height):new cn(0,0,0,0)},t._getLocation=function(e){var t=this._getCanvasRect(),i=La.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 en(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 FA.MOUSE_DOWN:null===(n=t._canvas)||void 0===n||n.focus(),t._isPressed=!0;break;case FA.MOUSE_UP:t._isPressed=!1;break;case FA.MOUSE_MOVE:o=1&a?BA.BUTTON_LEFT:2&a?BA.BUTTON_RIGHT:4&a?BA.BUTTON_MIDDLE:BA.BUTTON_MISSING}var u=new BA(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=FA.MOUSE_WHEEL,i=this._getLocation(e),n=e.button,r=new BA(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}(),SR=new en,bR=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(SR);var i=new VA(SR.x,SR.y,t);return e.getLocation(SR),i.setPoint(SR.x,SR.y),e.getPreviousLocation(SR),i.setPrevPoint(SR),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 VA(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(SR),e.setPrevPoint(SR),e.setPoint(t,i)},t._checkTouchMapSizeMoreThanMax=function(e){var t=this;if(this._touchMap.has(e))return!1;var i=At.ENABLE_MULTI_TOUCH?this._maxTouches:1;if(this._touchMap.size<i)return!1;var n=performance.now();return this._touchMap.forEach((function(e){n-e.lastModified>At.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}()),wR=function(){function e(){this._canvas=void 0,this._eventTarget=new Aa,xa.hasFeature(Oa.INPUT_TOUCH)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||b||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(FA.TOUCH_START)),null===(t=this._canvas)||void 0===t||t.addEventListener("touchmove",this._createCallback(FA.TOUCH_MOVE)),null===(i=this._canvas)||void 0===i||i.addEventListener("touchend",this._createCallback(FA.TOUCH_END)),null===(n=this._canvas)||void 0===n||n.addEventListener("touchcancel",this._createCallback(FA.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;o<a;++o){var u=i.changedTouches[o],h=u.identifier;if(null!==h){var c=t._getLocation(u,r),l=bR.getTouch(h,c.x,c.y);l&&(e!==FA.TOUCH_END&&e!==FA.TOUCH_CANCEL||bR.releaseTouch(h),s.push(l))}}if(i.stopPropagation(),i.target===t._canvas&&i.preventDefault(),e===FA.TOUCH_START&&(null===(n=t._canvas)||void 0===n||n.focus()),s.length>0){var _=new GA(s,!1,e,At.ENABLE_MULTI_TOUCH?bR.getAllTouches():s);t._eventTarget.emit(e,_)}}},t._getCanvasRect=function(){var e=this._canvas,t=null==e?void 0:e.getBoundingClientRect();return t?new cn(t.x,t.y,t.width,t.height):new cn(0,0,0,0)},t._getLocation=function(e,t){var i=e.clientX-t.x,n=t.y+t.height-e.clientY;if(La.isFrameRotated){var r=i;i=t.height-n,n=r}var s=La.devicePixelRatio;return new en(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"}(vR||(vR=e("f3",{})));var RR=function(){function e(e){this.priority=vR.GLOBAL,this._inputEventTarget=void 0,this._inputEventTarget=e}return e.prototype.dispatchEvent=function(e){return this._inputEventTarget.emit(e.type,e),!0},e}(),IR=((gR={})[FA.MOUSE_DOWN]=FA.TOUCH_START,gR[FA.MOUSE_MOVE]=FA.TOUCH_MOVE,gR[FA.MOUSE_UP]=FA.TOUCH_END,gR),OR=e("f2",function(){function e(){this._dispatchImmediately=!0,this._eventTarget=new Aa,this._touchInput=new wR,this._mouseInput=new AR,this._keyboardInput=new TR,this._accelerometerInput=new yR,this._eventTouchList=[],this._eventMouseList=[],this._eventKeyboardList=[],this._eventAccelerationList=[],this._needSimulateTouchMoveEvent=!1,this._inputEventDispatcher=void 0,this._eventDispatcherList=[],this._registerEvent(),this._inputEventDispatcher=new RR(this._eventTarget),this._registerEventDispatcher(this._inputEventDispatcher)}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=IR[e.type],i=bR.getTouch(0,e.getLocationX(),e.getLocationY());if(i){var n=[i],r=new GA(n,!1,t,n);t===FA.TOUCH_END&&bR.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;i<t&&this._eventDispatcherList[i].dispatchEvent(e);++i);},t._registerEvent=function(){var e=this;if(ka.hasFeature(ka.Feature.INPUT_TOUCH)){var t=this._eventTouchList;this._touchInput.on(FA.TOUCH_START,(function(i){e._dispatchOrPushEventTouch(i,t)})),this._touchInput.on(FA.TOUCH_MOVE,(function(i){e._dispatchOrPushEventTouch(i,t)})),this._touchInput.on(FA.TOUCH_END,(function(i){e._dispatchOrPushEventTouch(i,t)})),this._touchInput.on(FA.TOUCH_CANCEL,(function(i){e._dispatchOrPushEventTouch(i,t)}))}if(ka.hasFeature(ka.Feature.EVENT_MOUSE)){var i=this._eventMouseList;this._mouseInput.on(FA.MOUSE_DOWN,(function(t){e._needSimulateTouchMoveEvent=!0,e._simulateEventTouch(t),e._dispatchOrPushEvent(t,i)})),this._mouseInput.on(FA.MOUSE_MOVE,(function(t){e._needSimulateTouchMoveEvent&&e._simulateEventTouch(t),e._dispatchOrPushEvent(t,i)})),this._mouseInput.on(FA.MOUSE_UP,(function(t){e._needSimulateTouchMoveEvent=!1,e._simulateEventTouch(t),e._dispatchOrPushEvent(t,i)})),this._mouseInput.on(FA.MOUSE_WHEEL,(function(t){e._dispatchOrPushEvent(t,i)}))}if(ka.hasFeature(ka.Feature.EVENT_KEYBOARD)){var n=this._eventKeyboardList;this._keyboardInput.on(FA.KEY_DOWN,(function(t){e._dispatchOrPushEvent(t,n)})),this._keyboardInput.on(FA.KEY_PRESSING,(function(t){e._dispatchOrPushEvent(t,n)})),this._keyboardInput.on(FA.KEY_UP,(function(t){e._dispatchOrPushEvent(t,n)}))}if(ka.hasFeature(ka.Feature.EVENT_ACCELEROMETER)){var r=this._eventAccelerationList;this._accelerometerInput.on(FA.DEVICEMOTION,(function(t){e._dispatchOrPushEvent(t,r)}))}},t._clearEvents=function(){this._eventMouseList.length=0,this._eventTouchList.length=0,this._eventKeyboardList.length=0,this._eventAccelerationList.length=0},t._dispatchOrPushEvent=function(e,t){this._dispatchImmediately?this._emitEvent(e):t.push(e)},t._dispatchOrPushEventTouch=function(e,t){if(this._dispatchImmediately)for(var i=e.getTouches(),n=i.length,r=0;r<n;++r)e.touch=i[r],e.propagationStopped=e.propagationImmediateStopped=!1,this._emitEvent(e);else t.push(e)},t._frameDispatchEvents=function(){for(var e=this._eventMouseList,t=0,i=e.length;t<i;++t){var n=e[t];this._emitEvent(n)}for(var r=this._eventTouchList,s=0,a=r.length;s<a;++s)for(var o=r[s],u=o.getTouches(),h=u.length,c=0;c<h;++c)o.touch=u[c],o.propagationStopped=o.propagationImmediateStopped=!1,this._emitEvent(o);for(var l=this._eventKeyboardList,_=0,f=l.length;_<f;++_){var d=l[_];this._emitEvent(d)}for(var p=this._eventAccelerationList,m=0,g=p.length;m<g;++m){var v=p[m];this._emitEvent(v)}this._clearEvents()},e}());OR.EventType=FA;var NR=e("f4",new OR),CR=e("hT",function(e){function t(){var t;return t=e.call(this)||this,NR.on(FA.MOUSE_DOWN,(function(e){t.emit(xA.MOUSE_DOWN,e)})),NR.on(FA.MOUSE_MOVE,(function(e){t.emit(xA.MOUSE_MOVE,e)})),NR.on(FA.MOUSE_UP,(function(e){t.emit(xA.MOUSE_UP,e)})),NR.on(FA.MOUSE_WHEEL,(function(e){t.emit(xA.MOUSE_WHEEL,e)})),NR.on(FA.TOUCH_START,(function(e){t.emit(xA.TOUCH_START,e.touch,e)})),NR.on(FA.TOUCH_MOVE,(function(e){t.emit(xA.TOUCH_MOVE,e.touch,e)})),NR.on(FA.TOUCH_END,(function(e){t.emit(xA.TOUCH_END,e.touch,e)})),NR.on(FA.TOUCH_CANCEL,(function(e){t.emit(xA.TOUCH_CANCEL,e.touch,e)})),NR.on(FA.KEY_DOWN,(function(e){t.emit(xA.KEY_DOWN,e)})),NR.on(FA.KEY_PRESSING,(function(e){t.emit(xA.KEY_DOWN,e)})),NR.on(FA.KEY_UP,(function(e){t.emit(xA.KEY_UP,e)})),NR.on(FA.DEVICEMOTION,(function(e){t.emit(xA.DEVICEMOTION,e)})),t}_(t,e);var i=t.prototype;return i.setAccelerometerEnabled=function(e){NR.setAccelerometerEnabled(e)},i.setAccelerometerInterval=function(e){NR.setAccelerometerInterval(e)},i.on=function(t,i,n,r){return e.prototype.on.call(this,t,i,n,r),i},i.off=function(t,i,n){e.prototype.off.call(this,t,i,n)},t}(Aa));CR.EventType=xA,R.SystemEvent=CR;var MR,xR=e("hS",new CR);R.systemEvent=xR,ie(xA,"Node.EventType",[{name:"POSITION_PART",newName:"TRANSFORM_CHANGED"},{name:"ROTATION_PART",newName:"TRANSFORM_CHANGED"},{name:"SCALE_PART",newName:"TRANSFORM_CHANGED"}]),ie(PA,"Event",[{name:"ACCELERATION",newName:"DEVICEMOTION",target:CR.EventType,targetName:"SystemEvent.EventType"}]),re(PA,"Event",[{name:"TOUCH",suggest:"please use SystemEvent.EventType.TOUCH_START, SystemEvent.EventType.TOUCH_MOVE, SystemEvent.EventType.TOUCH_END and SystemEvent.EventType.TOUCH_CANCEL instead"},{name:"MOUSE",suggest:"please use SystemEvent.EventType.MOUSE_DOWN, SystemEvent.EventType.MOUSE_MOVE, SystemEvent.EventType.MOUSE_UP, SystemEvent.EventType.MOUSE_WHEEL, Node.EventType.MOUSE_ENTER and Node.EventType.MOUSE_LEAVE instead"},{name:"KEYBOARD",suggest:"please use SystemEvent.EventType.KEY_DOWN and SystemEvent.EventType.KEY_UP instead"}]),ie(BA,"EventMouse",["DOWN","UP","MOVE"].map((function(e){return{name:e,newName:"MOUSE_"+e,target:CR.EventType,targetName:"SystemEvent.EventType"}}))),ie(BA,"EventMouse",[{name:"SCROLL",newName:"MOUSE_WHEEL",target:CR.EventType,targetName:"SystemEvent.EventType"}]),re(BA.prototype,"EventMouse.prototype",[{name:"eventType",suggest:"please use EventMouse.prototype.type instead"}]),ie(GA,"EventTouch",[{name:"BEGAN",newName:"TOUCH_START",target:CR.EventType,targetName:"SystemEvent.EventType"}]),ie(GA,"EventTouch",[{name:"MOVED",newName:"TOUCH_MOVE",target:CR.EventType,targetName:"SystemEvent.EventType"}]),ie(GA,"EventTouch",[{name:"ENDED",newName:"TOUCH_END",target:CR.EventType,targetName:"SystemEvent.EventType"}]),ie(GA,"EventTouch",[{name:"CANCELLED",newName:"TOUCH_CANCEL",target:CR.EventType,targetName:"SystemEvent.EventType"}]),re(GA.prototype,"EventTouch.prototype",[{name:"getEventCode",suggest:"please use EventTouch.prototype.type instead"}]),ie(GA.prototype,"EventTouch.prototype",[{name:"getUILocationInView",newName:"getLocationInView",target:GA,targetName:"EventTouch"}]),re(At.KEY,"macro.KEY",["back","menu","0","1","2","3","4","5","6","7","8","9","0","*","+","-","/",";","=",",",".","[","]","dpadLeft","dpadRight","dpadUp","dpadDown","dpadCenter"].map((function(e){return{name:e}}))),re(At.KEY,"macro.KEY",[{name:"shift",suggest:"please use KeyCode.SHIFT_LEFT instead"}]),re(At.KEY,"macro.KEY",[{name:"ctrl",suggest:"please use KeyCode.CTRL_LEFT instead"}]),re(At.KEY,"macro.KEY",[{name:"alt",suggest:"please use KeyCode.ALT_LEFT instead"}]),re(At,"macro",[{name:"KEY",suggest:"please use KeyCode instead"}]),ie(_E.prototype,"BaseNode",[{name:"childrenCount",newName:"children.length",customGetter:function(){return this.children.length}}]),ie(SE.prototype,"Node",[{name:"width",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._uiProps.uiTransformComp.width},customSetter:function(e){this._uiProps.uiTransformComp.width=e}},{name:"height",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._uiProps.uiTransformComp.height},customSetter:function(e){this._uiProps.uiTransformComp.height=e}},{name:"anchorX",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._uiProps.uiTransformComp.anchorX},customSetter:function(e){this._uiProps.uiTransformComp.anchorX=e}},{name:"anchorY",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._uiProps.uiTransformComp.anchorY},customSetter:function(e){this._uiProps.uiTransformComp.anchorY=e}},{name:"getAnchorPoint",targetName:"node.getComponent(UITransform)",customFunction:function(e){return e||(e=new en),e.set(this._uiProps.uiTransformComp.anchorPoint),e}},{name:"setAnchorPoint",targetName:"node.getComponent(UITransform)",customFunction:function(e,t){this._uiProps.uiTransformComp.setAnchorPoint(e,t)}},{name:"getContentSize",targetName:"node.getComponent(UITransform)",customFunction:function(e){return e||(e=new un),e.set(this._uiProps.uiTransformComp.contentSize),e}},{name:"setContentSize",targetName:"node.getComponent(UITransform)",customFunction:function(e,t){"number"==typeof e?this._uiProps.uiTransformComp.setContentSize(e,t):this._uiProps.uiTransformComp.setContentSize(e)}}]),ne(mR.prototype,"SceneGlobals.prototype",[{name:"aspect"},{name:"selfShadow"},{name:"linear"},{name:"packing"},{name:"autoAdapt"},{name:"fixedArea"},{name:"pcf"},{name:"bias"},{name:"normalBias"},{name:"near"},{name:"far"},{name:"shadowDistance"},{name:"invisibleOcclusionRange"},{name:"orthoSize"},{name:"saturation"}]),ie(mR.prototype,"SceneGlobals.prototype",[{name:"distance",newName:"planeHeight"},{name:"normal",newName:"planeDirection"},{name:"size",newName:"shadowMapSize"}]),ne(SE.prototype,"Node.prototype",[{name:"addLayer"},{name:"removeLayer"}]),ie(Yy.prototype,"NodeUIProperties",[{name:"opacityDirty",newName:"colorDirty"}]),ne(bd,"Layers",[{name:"All"},{name:"RaycastMask"},{name:"check"}]),ie(bd,"Layers",[{name:"Default",newName:"DEFAULT",target:bd.Enum,targetName:"Layers.Enum"},{name:"Always",newName:"ALWAYS",target:bd.Enum,targetName:"Layers.Enum"},{name:"IgnoreRaycast",newName:"IGNORE_RAYCAST",target:bd.Enum,targetName:"Layers.Enum"},{name:"Gizmos",newName:"GIZMOS",target:bd.Enum,targetName:"Layers.Enum"},{name:"Editor",newName:"EDITOR",target:bd.Enum,targetName:"Layers.Enum"},{name:"UI",newName:"UI_3D",target:bd.Enum,targetName:"Layers.Enum"},{name:"UI2D",newName:"UI_2D",target:bd.Enum,targetName:"Layers.Enum"},{name:"SceneGizmo",newName:"SCENE_GIZMO",target:bd.Enum,targetName:"Layers.Enum"},{name:"makeInclusiveMask",newName:"makeMaskInclude",target:bd,targetName:"Layers"},{name:"makeExclusiveMask",newName:"makeMaskExclude",target:bd,targetName:"Layers"}]),ne(bd.Enum,"Layers.Enum",[{name:"ALWAYS"}]),ne(bd.BitMask,"Layers.BitMask",[{name:"ALWAYS"}]);var FR,PR,DR,LR,BR=ca.Flags.HideInHierarchy,UR=ca.Flags.DontSave,GR=e("hK",th("cc.PrivateNode")(MR=function(e){function t(t){var i;return Y(12003,(i=e.call(this,t)||this).name),i.hideFlags|=UR|BR,i}return _(t,e),t}(SE))||MR);function zR(e){var t=e._prefab;if(t&&t.instance){if(!t.asset)return K(3701,e.name),void(t.instance=void 0);var i=e._objFlags,n=e._parent,r=e._id,s=e._prefab;e[oa],R.game._isCloning=!0,t.asset._doInstantiate(e),R.game._isCloning=!1,e._objFlags=i,e._parent=n,e._id=r,e._prefab&&(e._prefab.instance=null==s?void 0:s.instance)}}function kR(e,t,i){var n;if(t&&e){var r=t,s=null===(n=e._prefab)||void 0===n?void 0:n.instance;!i&&s&&(t[s.fileId]={},r=t[s.fileId]);var a=e._prefab;a&&(r[a.fileId]=e);for(var o=e.components,u=0;u<o.length;u++){var h=o[u];h.__prefab&&(r[h.__prefab.fileId]=h)}for(var c=0;c<e.children.length;c++)kR(e.children[c],r,!1)}}function HR(e,t){if(!e)return null;for(var i=t,n=0;n<e.length;n++){if(!i)return null;i=i[e[n]]}return i}function VR(e,t,i){if(t)for(var n=0;n<t.length;n++){var r=t[n];if(r&&r.targetInfo){var s=HR(r.targetInfo.localID,i);if(!s)continue;var a=i,o=r.targetInfo.localID;if(o.length>0)for(var u=0;u<o.length-1;u++)a=a[o[u]];if(r.nodes)for(var h=0;h<r.nodes.length;h++){var c=r.nodes[h];c&&!s._children.includes(c)&&(s._children.push(c),c._parent=s,kR(c,a,!1),c._siblingIndex=s._children.length-1,qR(c,!0))}}}}function WR(e,t,i){if(t)for(var n=0;n<t.length;n++){var r=t[n];if(r&&r.targetInfo){var s=HR(r.targetInfo.localID,i);if(!s)continue;if(r.components)for(var a=0;a<r.components.length;a++){var o=r.components[a];o&&(o.node=s,s._components.push(o))}}}}function jR(e,t,i){if(t)for(var n=0;n<t.length;n++){var r=t[n];if(r){var s=HR(r.localID,i);if(!s||!s.node)continue;var a=s.node.components.indexOf(s);a>=0&&s.node._components.splice(a,1)}}}function XR(e,t,i){if(!(t.length<=0))for(var n=null,r=0;r<t.length;r++){var s=t[r];if(s&&s.targetInfo){if(!(n=HR(s.targetInfo.localID,i)))continue;var a=n,o=s.propertyPath.slice();if(o.length>0){var u=o.pop();if(!u)continue;for(var h=0;h<o.length&&(a=a[o[h]]);h++);if(!a)continue;if(Array.isArray(a))if("length"===u)a[u]=s.value;else{var c=Number.parseInt(u);Number.isInteger(c)&&c<a.length&&(a[u]=s.value)}else a[u]instanceof yt?a[u].set(s.value):a[u]=s.value}}}}function YR(e){var t,i=null===(t=e._prefab)||void 0===t?void 0:t.targetOverrides;if(i)for(var n=0;n<i.length;n++){var r,s,a=i[n],o=a.source,u=a.sourceInfo;if(u){var h,c,l=null===(h=a.source)||void 0===h||null===(c=h._prefab)||void 0===c?void 0:c.instance;l&&l.targetMap&&(o=HR(u.localID,l.targetMap))}if(o){var _,f=a.targetInfo;if(f){var d=null===(r=a.target)||void 0===r||null===(s=r._prefab)||void 0===s?void 0:s.instance;if(d&&d.targetMap&&(_=HR(f.localID,d.targetMap))){var p=a.propertyPath.slice(),m=o;if(p.length>0){var g=p.pop();if(!g)return;for(var v=0;v<p.length&&(m=m[p[v]]);v++);if(!m)continue;m[g]=_}}}}}}function qR(e,t){void 0===t&&(t=!1);var i=e._prefab,n=null==i?void 0:i.instance;if(n&&!n.expanded){zR(e),t&&e&&e.children&&e.children.forEach((function(e){qR(e,!0)}));var r={};n.targetMap=r,kR(e,r,!0),VR(0,n.mountedChildren,r),jR(0,n.removedComponents,r),WR(0,n.mountedComponents,r),XR(0,n.propertyOverrides,r),n.expanded=!0}else t&&e&&e.children&&e.children.forEach((function(e){qR(e,!0)}))}function KR(e){var t=e._prefab;t&&t.nestedPrefabInstanceRoots&&t.nestedPrefabInstanceRoots.forEach((function(e){qR(e)}))}ie(xA,"SystemEventType",["MOUSE_ENTER","MOUSE_LEAVE","TRANSFORM_CHANGED","SCENE_CHANGED_FOR_PERSISTS","SIZE_CHANGED","ANCHOR_CHANGED","COLOR_CHANGED","CHILD_ADDED","CHILD_REMOVED","PARENT_CHANGED","NODE_DESTROYED","LAYER_CHANGED","SIBLING_ORDER_CHANGED"].map((function(e){return{name:e,target:SE.EventType,targetName:"Node.EventType"}}))),ie(SE.EventType,"Node.EventType",[{name:"DEVICEMOTION",target:CR.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_DOWN",target:CR.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_UP",target:CR.EventType,targetName:"SystemEvent.EventType"}]),R.PrivateNode=GR;var QR=e("gD",th("cc.Scene")((A((PR=function(e){_(i,e);var t=i.prototype;function i(t){var i;return T(i=e.call(this,t)||this,"autoReleaseAssets",DR,v(i)),T(i,"_globals",LR,v(i)),i.dependAssets=null,i._renderScene=null,i._inited=void 0,i._prefabSyncedInLiveReload=!1,i._pos=Di.ZERO,i._rot=Hi.IDENTITY,i._scale=Di.ONE,i._mat=Qi.IDENTITY,i._dirtyFlags=0,i._lpos=Di.ZERO,i._lrot=Hi.IDENTITY,i._lscale=Di.ONE,i._activeInHierarchy=!1,R.director&&R.director.root&&(i._renderScene=R.director.root.createScene({})),i._inited=!R.game||!R.game._isCloning,i}return t._updateScene=function(){this._scene=this},t.destroy=function(){var e=ca.prototype.destroy.call(this);if(e)for(var t=this._children,i=0;i<t.length;++i)t[i].active=!1;return this._renderScene&&R.director.root.destroyScene(this._renderScene),this._active=!1,this._activeInHierarchy=!1,e},t.addComponent=function(){throw new Error($(3822))},t._onHierarchyChanged=function(){},t._onBatchCreated=function(t){e.prototype._onBatchCreated.call(this,t);for(var i=this._children.length,n=0;n<i;++n)this._children[n]._siblingIndex=n,this._children[n]._onBatchCreated(t)},t.getPosition=function(e){return Di.copy(e||new Di,Di.ZERO)},t.getRotation=function(e){return Hi.copy(e||new Hi,Hi.IDENTITY)},t.getScale=function(e){return Di.copy(e||new Di,Di.ONE)},t.getWorldPosition=function(e){return Di.copy(e||new Di,Di.ZERO)},t.getWorldRotation=function(e){return Hi.copy(e||new Hi,Hi.IDENTITY)},t.getWorldScale=function(e){return Di.copy(e||new Di,Di.ONE)},t.getWorldMatrix=function(e){return Qi.copy(e||new Qi,Qi.IDENTITY)},t.getWorldRS=function(e){return Qi.copy(e||new Qi,Qi.IDENTITY)},t.getWorldRT=function(e){return Qi.copy(e||new Qi,Qi.IDENTITY)},t.updateWorldTransform=function(){},t._instantiate=function(){},t._load=function(){this._inited||(KR(this),YR(this),this._onBatchCreated(b),this._inited=!0),this.walk(_E._setScene)},t._activate=function(e){e=!1!==e,R.director._nodeActivator.activateNode(this,e),this._globals.activate()},c(i,[{key:"renderScene",get:function(){return this._renderScene}},{key:"globals",get:function(){return this._globals}},{key:"position",get:function(){return Di.ZERO}},{key:"worldPosition",get:function(){return Di.ZERO}},{key:"rotation",get:function(){return Hi.IDENTITY}},{key:"worldRotation",get:function(){return Hi.IDENTITY}},{key:"scale",get:function(){return Di.ONE}},{key:"worldScale",get:function(){return Di.ONE}},{key:"eulerAngles",get:function(){return Di.ZERO}},{key:"worldMatrix",get:function(){return Qi.IDENTITY}}]),i}(_E)).prototype,"globals",[Eh],Object.getOwnPropertyDescriptor(PR.prototype,"globals"),PR.prototype),DR=A(PR.prototype,"autoReleaseAssets",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),LR=A(PR.prototype,"_globals",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new mR}}),FR=PR))||FR);function ZR(e,t){if(!t){var i=R.director.getScene();if(!i)return null;t=i}return t.getChildByPath(e)}R.Scene=QR,R.find=ZR;var JR=lt.fastRemoveAt,$R=ca.Flags.IsStartCalled,eI=ca.Flags.IsOnEnableCalled;function tI(e,t){for(var i=t.constructor._executionOrder,n=t._id,r=0,s=e.length-1,a=s>>>1;r<=s;a=r+s>>>1){var o=e[a],u=o.constructor._executionOrder;if(u>i)s=a-1;else if(u<i)r=a+1;else{var h=o._id;if(h>n)s=a-1;else{if(!(h<n))return a;r=a+1}}}return~r}function iI(e,t){for(var i=e.array,n=e.i+1;n<i.length;){var r=i[n];r.node._activeInHierarchy?++n:(e.removeAt(n),t&&(r._objFlags&=~t))}}ca.Flags.IsEditorOnEnableCalled;var nI=function(e){this._zero=void 0,this._neg=void 0,this._pos=void 0,this._invoke=void 0;var t=pe;this._zero=new t([]),this._neg=new t([]),this._pos=new t([]),this._invoke=e};function rI(e,t){return e.constructor._executionOrder-t.constructor._executionOrder}nI.stableRemoveInactive=iI;var sI=function(e){function t(){return e.apply(this,arguments)||this}_(t,e);var i=t.prototype;return i.add=function(e){var t=e.constructor._executionOrder;(0===t?this._zero:t<0?this._neg:this._pos).array.push(e)},i.remove=function(e){var t=e.constructor._executionOrder;(0===t?this._zero:t<0?this._neg:this._pos).fastRemove(e)},i.cancelInactive=function(e){iI(this._zero,e),iI(this._neg,e),iI(this._pos,e)},i.invoke=function(){var e=this._neg;e.array.length>0&&(e.array.sort(rI),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(rI),this._invoke(t),t.array.length=0)},t}(nI),aI=function(e){function t(){return e.apply(this,arguments)||this}_(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=tI(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=tI(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}(nI);function oI(e,t,i){var n="var a=it.array;for(it.i=0;it.i<a.length;++it.i){var c=a[it.i];"+e+"}",r=t?Function("it","dt",n):Function("it",n);return function(e,t,i){return function(n,r){try{t(n,r)}catch(t){R._throw(t);var s=n.array;for(i&&(s[n.i]._objFlags|=i),++n.i;n.i<s.length;++n.i)try{e(s[n.i],r)}catch(e){R._throw(e),i&&(s[n.i]._objFlags|=i)}}}}(Function("c","dt",e),r,i)}var uI=oI("c.start();c._objFlags|="+$R,!1,$R),hI=oI("c.update(dt)",!0),cI=oI("c.lateUpdate(dt)",!0),lI=function(e){var t=R.director._compScheduler,i=e.array;for(e.i=0;e.i<i.length;++e.i){var n=i[e.i];n._enabled&&(n.onEnable(),!n.node._activeInHierarchy||t._onEnabled(n))}},_I=function(){function e(){this._deferredComps=[],this.unscheduleAll()}var t=e.prototype;return t.unscheduleAll=function(){this.startInvoker=new sI(uI),this.updateInvoker=new aI(hI),this.lateUpdateInvoker=new aI(cI),this._updating=!1},t._onEnabled=function(e){R.director.getScheduler().resumeTarget(e),e._objFlags|=eI,this._updating?this._deferredComps.push(e):this._scheduleImmediate(e)},t._onDisabled=function(e){R.director.getScheduler().pauseTarget(e),e._objFlags&=~eI;var t=this._deferredComps.indexOf(e);t>=0?JR(this._deferredComps,t):(!e.start||e._objFlags&$R||this.startInvoker.remove(e),e.update&&this.updateInvoker.remove(e),e.lateUpdate&&this.lateUpdateInvoker.remove(e))},t.enableComp=function(e,t){if(!(e._objFlags&eI)){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&eI&&(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&$R||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;t<i;t++)this._scheduleImmediate(e[t]);e.length=0},e}(),fI=ca.Flags.IsPreloadStarted,dI=ca.Flags.IsOnLoadStarted,pI=ca.Flags.IsOnLoadCalled,mI=ca.Flags.Deactivating,gI=function(e){function t(){return e.apply(this,arguments)||this}_(t,e);var i=t.prototype;return i.add=function(e){this._zero.array.push(e)},i.remove=function(e){this._zero.fastRemove(e)},i.cancelInactive=function(e){nI.stableRemoveInactive(this._zero,e)},i.invoke=function(){this._invoke(this._zero),this._zero.array.length=0},t}(nI),vI=oI("c.__preload();"),yI=oI("c.onLoad();c._objFlags|="+pI,!1,pI),EI=new ct(4);function TI(e,t,i){K(3817,e.name,i),console.log("Corrupted component value:",t),t?e._removeComponent(t):lt.removeAt(e._components,i)}EI.get=function(){var e=this._get()||{preload:new gI(vI),onLoad:new sI(yI),onEnable:new sI(lI)};e.preload._zero.i=-1;var t=e.onLoad;return t._zero.i=-1,t._neg.i=-1,t._pos.i=-1,(t=e.onEnable)._zero.i=-1,t._neg.i=-1,t._pos.i=-1,e};var AI,SI,bI,wI,RI,II,OI,NI,CI,MI,xI,FI,PI,DI,LI,BI,UI,GI,zI,kI,HI,VI,WI,jI,XI,YI,qI,KI,QI,ZI,JI,$I,eO,tO,iO,nO,rO,sO,aO,oO,uO,hO,cO,lO,_O,fO,dO,pO,mO,gO,vO,yO,EO,TO,AO,SO,bO,wO,RO,IO,OO,NO,CO,MO,xO,FO,PO,DO,LO,BO=e("hz",function(){function e(){this.resetComp=void 0,this.reset()}var t=e.prototype;return t.reset=function(){this._activatingStack=[]},t.activateNode=function(e,t){if(t){var i=EI.get();this._activatingStack.push(i),this._activateNodeRecursively(e,i.preload,i.onLoad,i.onEnable),i.preload.invoke(),i.onLoad.invoke(),i.onEnable.invoke(),this._activatingStack.pop(),EI.put(i)}else{this._deactivateNodeRecursively(e);for(var n,r=E(this._activatingStack);!(n=r()).done;){var s=n.value;s.preload.cancelInactive(fI),s.onLoad.cancelInactive(dI),s.onEnable.cancelInactive()}}e.emit(By.ACTIVE_IN_HIERARCHY_CHANGED,e)},t.activateComp=function(e,t,i,n){if(fa(e,!0)&&(e._objFlags&fI||(e._objFlags|=fI,e.__preload&&(t?t.add(e):e.__preload())),e._objFlags&dI||(e._objFlags|=dI,e.onLoad?i?i.add(e):(e.onLoad(),e._objFlags|=pI):e._objFlags|=pI),e._enabled)){if(!e.node._activeInHierarchy)return;R.director._compScheduler.enableComp(e,n)}},t.destroyComp=function(e){R.director._compScheduler.disableComp(e),e.onDestroy&&e._objFlags&pI&&e.onDestroy()},t._activateNodeRecursively=function(e,t,i,n){if(e._objFlags&mI)K(3816,e.name);else{e._activeInHierarchy=!0;for(var r=e._components.length,s=0;s<r;++s){var a=e._components[s];a instanceof R.Component?this.activateComp(a,t,i,n):(TI(e,a,s),--s,--r)}for(var o=0,u=e._children.length;o<u;++o){var h=e._children[o];h._active&&this._activateNodeRecursively(h,t,i,n)}e._onPostActivated(!0)}},t._deactivateNodeRecursively=function(e){e._objFlags|=mI,e._activeInHierarchy=!1;for(var t=e._components.length,i=0;i<t;++i){var n=e._components[i];if(n._enabled&&(R.director._compScheduler.disableComp(n),e._activeInHierarchy))return void(e._objFlags&=~mI)}for(var r=0,s=e._children.length;r<s;++r){var a=e._children[r];if(a._activeInHierarchy&&(this._deactivateNodeRecursively(a),e._activeInHierarchy))return void(e._objFlags&=~mI)}e._onPostActivated(!1),e._objFlags&=~mI},e}()),UO=th("cc.TargetInfo")((bI=A((SI=function(){T(this,"localID",bI,this)}).prototype,"localID",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),AI=SI))||AI,GO=(wI=th("cc.TargetOverrideInfo"),RI=Dh(ca),II=Dh(UO),OI=Dh(SE),NI=Dh(UO),wI((xI=A((MI=function(){T(this,"source",xI,this),T(this,"sourceInfo",FI,this),T(this,"propertyPath",PI,this),T(this,"target",DI,this),T(this,"targetInfo",LI,this)}).prototype,"source",[hh,RI],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),FI=A(MI.prototype,"sourceInfo",[hh,II],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),PI=A(MI.prototype,"propertyPath",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),DI=A(MI.prototype,"target",[hh,OI],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),LI=A(MI.prototype,"targetInfo",[hh,NI],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),CI=MI))||CI),zO=th("cc.CompPrefabInfo")((GI=A((UI=function(){T(this,"fileId",GI,this)}).prototype,"fileId",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),BI=UI))||BI,kO=(zI=th("CCPropertyOverrideInfo"),kI=Dh(UO),zI((YI=function(){function e(){T(this,"targetInfo",WI,this),T(this,"propertyPath",jI,this),T(this,"value",XI,this)}return e.prototype.isTarget=function(){},e}(),WI=A((VI=YI).prototype,"targetInfo",[hh,kI],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),jI=A(VI.prototype,"propertyPath",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),XI=A(VI.prototype,"value",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),HI=VI))||HI),HO=(qI=th("cc.MountedChildrenInfo"),KI=Dh(UO),QI=Dh([SE]),qI((tO=function(){function e(){T(this,"targetInfo",$I,this),T(this,"nodes",eO,this)}return e.prototype.isTarget=function(){},e}(),$I=A((JI=tO).prototype,"targetInfo",[hh,KI],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),eO=A(JI.prototype,"nodes",[hh,QI],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),ZI=JI))||ZI),VO=(iO=th("cc.MountedComponentsInfo"),nO=Dh(UO),rO=Dh([ll]),iO((hO=function(){function e(){T(this,"targetInfo",oO,this),T(this,"components",uO,this)}return e.prototype.isTarget=function(){},e}(),oO=A((aO=hO).prototype,"targetInfo",[hh,nO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),uO=A(aO.prototype,"components",[hh,rO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),sO=aO))||sO),WO=(cO=th("cc.PrefabInstance"),lO=Dh(SE),_O=Dh([HO]),fO=Dh([VO]),dO=Dh([kO]),pO=Dh([UO]),cO((bO=function(){function e(){T(this,"fileId",vO,this),T(this,"prefabRootNode",yO,this),T(this,"mountedChildren",EO,this),T(this,"mountedComponents",TO,this),T(this,"propertyOverrides",AO,this),T(this,"removedComponents",SO,this),this.targetMap={},this.expanded=!1}var t=e.prototype;return t.findPropertyOverride=function(){},t.removePropertyOverride=function(){},e}(),vO=A((gO=bO).prototype,"fileId",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),yO=A(gO.prototype,"prefabRootNode",[hh,lO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),EO=A(gO.prototype,"mountedChildren",[hh,_O],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),TO=A(gO.prototype,"mountedComponents",[hh,fO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),AO=A(gO.prototype,"propertyOverrides",[hh,dO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),SO=A(gO.prototype,"removedComponents",[hh,pO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),mO=gO))||mO),jO=(wO=th("cc.PrefabInfo"),RO=Dh(SE),IO=Dh(WO),OO=Dh([GO]),wO((MO=A((CO=function(){T(this,"root",MO,this),T(this,"asset",xO,this),T(this,"fileId",FO,this),T(this,"instance",PO,this),T(this,"targetOverrides",DO,this),T(this,"nestedPrefabInstanceRoots",LO,this)}).prototype,"root",[hh,RO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),xO=A(CO.prototype,"asset",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),FO=A(CO.prototype,"fileId",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),PO=A(CO.prototype,"instance",[hh,IO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),DO=A(CO.prototype,"targetOverrides",[hh,OO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),LO=A(CO.prototype,"nestedPrefabInstanceRoots",[hh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),NO=CO))||NO);R._PrefabInfo=jO;var XO,YO,qO,KO,QO,ZO,JO,$O,eN,tN,iN,nN,rN,sN,aN=Object.freeze({__proto__:null,TargetInfo:UO,TargetOverrideInfo:GO,CompPrefabInfo:zO,PropertyOverrideInfo:kO,MountedChildrenInfo:HO,MountedComponentsInfo:VO,PrefabInstance:WO,PrefabInfo:jO,createNodeWithPrefab:zR,generateTargetMap:kR,getTarget:HR,applyMountedChildren:VR,applyMountedComponents:WR,applyRemovedComponents:jR,applyPropertyOverrides:XR,applyTargetOverrides:YR,expandPrefabInstanceNode:qR,expandNestedPrefabInstanceNode:KR,applyNodeAndComponentId:function e(t,i){for(var n=t.components,r=t.children,s=0;s<n.length;s++){var a,o=n[s];o._id=""+i+(null===(a=o.__prefab)||void 0===a?void 0:a.fileId)}for(var u=0;u<r.length;u++){var h,c=r[u];c._id=""+i+(null===(h=c._prefab)||void 0===h?void 0:h.fileId),e(c,i)}}}),oN=dt({AUTO:0,SINGLE_INSTANCE:1,MULTI_INSTANCE:2}),uN=e("h1",th("cc.Prefab")((JO=ZO=function(e){function t(){var t;return T(t=e.call(this)||this,"data",qO,v(t)),T(t,"optimizationPolicy",KO,v(t)),T(t,"persistent",QO,v(t)),t._createFunction=void 0,t._instantiatedTimes=void 0,t._createFunction=null,t._instantiatedTimes=0,t}_(t,e);var i=t.prototype;return i.createNode=function(e){var t=R.instantiate(this);t.name=this.name,e(null,t)},i.compileCreateFunction=function(){var e,t;this._createFunction=(t=(e=this.data)instanceof R._BaseNode&&e,new Dy(e,t).result)},i._doInstantiate=function(e){return this.data._prefab||Y(3700),this._createFunction||this.compileCreateFunction(),this._createFunction(e)},i._instantiate=function(){var e;return this.optimizationPolicy!==oN.SINGLE_INSTANCE&&(this.optimizationPolicy===oN.MULTI_INSTANCE||this._instantiatedTimes+1>=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 SE,this.data.name="(Missing Node)";var i=new R._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;KR(e),YR(e)},t}(Cc),ZO.OptimizationPolicy=oN,ZO.OptimizationPolicyThreshold=3,qO=A((YO=JO).prototype,"data",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),KO=A(YO.prototype,"optimizationPolicy",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return oN.AUTO}}),QO=A(YO.prototype,"persistent",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),XO=YO))||XO);_t.value(uN,"_utils",aN),R.Prefab=uN,Le(R,"cc._Prefab","Prefab"),e("gM",($O=th("cc.PrefabLink"),eN=Dh(uN),tN=Th(),$O((sN=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return T(t=e.call.apply(e,[this].concat(n))||this,"prefab",rN,v(t)),t}return _(t,e),t}(ll),rN=A((nN=sN).prototype,"prefab",[eN,hh,tN],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),iN=nN))||iN));var hN=new Di;function cN(e,t,i,n){n||(n=new Di),e.convertToUINode(t,i,n);var r=i.position;return n.add(r),n}function lN(e,t,i){return i||(i=new Di),e.worldToScreen(t,i),i.x/=R.view.getScaleX(),i.y/=R.view.getScaleY(),i}var _N=e("gS",{WorldNode3DToLocalNodeUI:cN,WorldNode3DToWorldNodeUI:lN});R.pipelineUtils=_N,ie(R.pipelineUtils,"cc.pipelineUtils",[{name:"WorldNode3DToLocalNodeUI",newName:"convertToUINode",targetName:"cc.Camera.prototype",customFunction:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var n=t[0],r=t[3]||hN;return n.convertToUINode(t[1],t[2],r),r.add(t[2].position),t[3]||r.clone()}}]);var fN=new Di,dN=co.create(0,0,0,1),pN=new ra((function(){return{model:null,depth:0}}),128);function mN(e,t){var i=0;e.node&&(Di.subtract(fN,e.node.worldPosition,t.position),i=Di.dot(fN,t.forward));var n=pN.alloc();return n.model=e,n.depth=i,n}function gN(e,t){var i=e.pipelineSceneData.validPunctualLights;i.length=0;for(var n=t.scene.spotLights,r=0;r<n.length;r++){var s=n[r];s.baked||(co.set(dN,s.position.x,s.position.y,s.position.z,s.range),pu.sphereFrustum(dN,t.frustum)&&i.push(s))}for(var a=t.scene.sphereLights,o=0;o<a.length;o++){var u=a[o];u.baked||(co.set(dN,u.position.x,u.position.y,u.position.z,u.range),pu.sphereFrustum(dN,t.frustum)&&i.push(u))}}function vN(e,t){var i=t.scene,n=i.mainLight,r=e.pipelineSceneData,s=r.shadows,a=r.skybox,o=r.csmLayers,u=r.renderObjects;pN.freeArray(u),u.length=0;var h=o.castShadowObjects;h.length=0;var c=o.layerObjects;c.clear(),s.enabled&&(e.pipelineUBO.updateShadowUBORange(Vd.SHADOW_COLOR_OFFSET,s.shadowColor),s.type===$A.ShadowMap&&n&&n.node&&o.update(r,t)),a.enabled&&a.model&&t.clearFlag&rA&&u.push(mN(a.model,t));for(var l=i.models,_=t.visibility,f=0;f<l.length;f++){var d=l[f];if(d.enabled&&(d.castShadow&&(h.push(mN(d,t)),c.push(mN(d,t))),d.node&&(_&d.node.layer)===d.node.layer||_&d.visFlags)){if(d.worldBounds&&!pu.aabbFrustum(d.worldBounds,t.frustum))continue;u.push(mN(d,t))}}}var yN,EN=new Cr(Cn.LINEAR,Cn.LINEAR,Cn.NONE,Mn.CLAMP,Mn.CLAMP,Mn.CLAMP),TN=new Cr(Cn.POINT,Cn.POINT,Cn.NONE,Mn.CLAMP,Mn.CLAMP,Mn.CLAMP),AN=function(){function e(e){this._device=void 0,this._descriptorSetMap=new Map,this._globalDescriptorSet=void 0,this._descriptorSetLayout=void 0,this._linearSampler=void 0,this._pointSampler=void 0,this._device=e,this._linearSampler=this._device.getSampler(EN),this._pointSampler=this._device.getSampler(TN);var t=new $r(Md.bindings);this._descriptorSetLayout=this._device.createDescriptorSetLayout(t),this._globalDescriptorSet=this._device.createDescriptorSet(new es(this._descriptorSetLayout))}var t=e.prototype;return t.bindBuffer=function(e,t){this._globalDescriptorSet.bindBuffer(e,t);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindBuffer(e,t),n=i.next()},t.bindSampler=function(e,t){this._globalDescriptorSet.bindSampler(e,t);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindSampler(e,t),n=i.next()},t.bindTexture=function(e,t){this._globalDescriptorSet.bindTexture(e,t);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindTexture(e,t),n=i.next()},t.update=function(){this._globalDescriptorSet.update();for(var e=this._descriptorSetMap.values(),t=e.next();!t.done;)t.value.update(),t=e.next()},t.getOrCreateDescriptorSet=function(e){var t=this._device;if(!this._descriptorSetMap.has(e)){var i=this._globalDescriptorSet,n=t.createDescriptorSet(new es(this._descriptorSetLayout));this._descriptorSetMap.set(e,n);for(var r=Cd.UBO_GLOBAL;r<Cd.COUNT;r++)n.bindBuffer(r,i.getBuffer(r)),n.bindSampler(r,i.getSampler(r)),n.bindTexture(r,i.getTexture(r));var s=t.createBuffer(new Sr(En.UNIFORM|En.TRANSFER_DST,Sn.HOST|Sn.DEVICE,Vd.SIZE,Vd.SIZE));n.bindBuffer(Vd.BINDING,s),n.update()}return this._descriptorSetMap.get(e)},t.destroy=function(){this._descriptorSetLayout.destroy()},c(e,[{key:"descriptorSetMap",get:function(){return this._descriptorSetMap}},{key:"linearSampler",get:function(){return this._linearSampler}},{key:"pointSampler",get:function(){return this._pointSampler}},{key:"descriptorSetLayout",get:function(){return this._descriptorSetLayout}},{key:"globalDescriptorSet",get:function(){return this._globalDescriptorSet}}]),e}();function SN(e,t){t<1e3?t=1e3:t>15e3&&(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"}(yN||(yN=e("cR",{})));var bN,wN,RN,IN,ON,NN,CN,MN,xN,FN,PN=e("cS",(function(e){return 4*Math.PI*Math.PI*e*e})),DN=e("cT",function(){function e(){this._baked=!1,this._color=new Di(1,1,1),this._colorTemp=6550,this._colorTempRGB=new Di(1,1,1),this._scene=null,this._node=null,this._name=null,this._useColorTemperature=!1,this._type=yN.UNKNOWN}var t=e.prototype;return t.initialize=function(){this.color=new Di(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(){},c(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,SN(this._colorTempRGB,this._colorTemp)}},{key:"colorTemperatureRGB",get:function(){return this._colorTempRGB}},{key:"node",get:function(){return this._node},set:function(e){this._node=e,this._node&&(this._node.hasChangedFlags|=eE.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}()),LN=e("hw",function(){function e(){this._singleMode=0,this._compositeModeValue=0,this._lightingWithAlbedo=!0,this._csmLayerColoration=!1,this._nativeConfig=null,this._activate()}var t=e.prototype;return t.isCompositeModeEnabled=function(e){return 0!=(this._compositeModeValue&1<<e)},t.enableCompositeMode=function(e,t){this._enableCompositeMode(e,t),this._updatePipeline()},t.enableAllCompositeMode=function(e){this._enableAllCompositeMode(e),this._updatePipeline()},t.isEnabled=function(){return 0!==this._getType()},t.reset=function(){this._activate(),this._updatePipeline()},t._activate=function(){this._singleMode=0,this._enableAllCompositeMode(!0),this._lightingWithAlbedo=!0,this._csmLayerColoration=!1},t._updatePipeline=function(){var e=R.director.root,t=e.pipeline,i=this._getType();t.macros.CC_USE_DEBUG_VIEW!==i&&(t.macros.CC_USE_DEBUG_VIEW=i,e.onGlobalPipelineStateChanged())},t._enableCompositeMode=function(e,t){t?this._compositeModeValue|=1<<e:this._compositeModeValue&=~(1<<e)},t._enableAllCompositeMode=function(e){for(var t=0;t<12;t++)e?this._compositeModeValue|=1<<t:this._compositeModeValue&=~(1<<t)},t._getType=function(){if(0!==this._singleMode)return 1;if(!0!==this._lightingWithAlbedo||!1!==this._csmLayerColoration)return 2;for(var e=0;e<12;e++)if(!this.isCompositeModeEnabled(e))return 2;return 0},c(e,[{key:"singleMode",get:function(){return this._singleMode},set:function(e){this._singleMode=e,this._updatePipeline()}},{key:"lightingWithAlbedo",get:function(){return this._lightingWithAlbedo},set:function(e){this._lightingWithAlbedo=e,this._updatePipeline()}},{key:"csmLayerColoration",get:function(){return this._csmLayerColoration},set:function(e){this._csmLayerColoration=e,this._updatePipeline()}}]),e}()),BN=new Qi,UN=new Qi,GN=new Qi,zN=new sn,kN=new sn(0,0,1,0),HN=new Di,VN=function(){function e(){this._globalUBO=new Float32Array(kd.COUNT),this._cameraUBO=new Float32Array(Hd.COUNT),this._shadowUBO=new Float32Array(Vd.COUNT),this._csmUBO=new Float32Array(Wd.COUNT)}e.updateGlobalUBOView=function(e,t){var i=R.director,n=i.root,r=t,s=Math.floor(e.width),a=Math.floor(e.height);r[kd.TIME_OFFSET]=n.cumulativeTime,r[kd.TIME_OFFSET+1]=n.frameTime,r[kd.TIME_OFFSET+2]=i.getTotalFrames(),r[kd.SCREEN_SIZE_OFFSET]=s,r[kd.SCREEN_SIZE_OFFSET+1]=a,r[kd.SCREEN_SIZE_OFFSET+2]=1/s,r[kd.SCREEN_SIZE_OFFSET+3]=1/a,r[kd.NATIVE_SIZE_OFFSET]=s,r[kd.NATIVE_SIZE_OFFSET+1]=a,r[kd.NATIVE_SIZE_OFFSET+2]=1/r[kd.NATIVE_SIZE_OFFSET],r[kd.NATIVE_SIZE_OFFSET+3]=1/r[kd.NATIVE_SIZE_OFFSET+1];var o=n.debugView;if(o){r[kd.DEBUG_VIEW_MODE_OFFSET]=o.singleMode,r[kd.DEBUG_VIEW_MODE_OFFSET+1]=o.lightingWithAlbedo?1:0,r[kd.DEBUG_VIEW_MODE_OFFSET+2]=o.csmLayerColoration?1:0;for(var u=0;u<12;u++)r[kd.DEBUG_VIEW_COMPOSITE_PACK_1_OFFSET+u]=o.isCompositeModeEnabled(u)?1:0}else{r[kd.DEBUG_VIEW_MODE_OFFSET]=0,r[kd.DEBUG_VIEW_MODE_OFFSET+1]=1,r[kd.DEBUG_VIEW_MODE_OFFSET+2]=0;for(var h=0;h<12;h++)r[kd.DEBUG_VIEW_COMPOSITE_PACK_1_OFFSET+h]=1}},e.updateCameraUBOView=function(e,t,i){var n,r=(i.scene?i.scene:R.director.getScene().renderScene).mainLight,s=e.pipelineSceneData,a=s.ambient,o=s.skybox,u=s.fog,h=s.shadows,c=t,l=i.exposure,_=s.isHDR;if(c[Hd.SCREEN_SCALE_OFFSET]=s.shadingScale,c[Hd.SCREEN_SCALE_OFFSET+1]=s.shadingScale,c[Hd.SCREEN_SCALE_OFFSET+2]=1/c[Hd.SCREEN_SCALE_OFFSET],c[Hd.SCREEN_SCALE_OFFSET+3]=1/c[Hd.SCREEN_SCALE_OFFSET+1],c[Hd.EXPOSURE_OFFSET]=l,c[Hd.EXPOSURE_OFFSET+1]=1/l,c[Hd.EXPOSURE_OFFSET+2]=_?1:0,c[Hd.EXPOSURE_OFFSET+3]=1/aA.standardExposureValue,r){var f=r.shadowEnabled&&h.type===$A.ShadowMap?1:0,d=r.direction;if(kN.set(d.x,d.y,d.z,f),sn.toArray(c,kN,Hd.MAIN_LIT_DIR_OFFSET),Di.toArray(c,r.color,Hd.MAIN_LIT_COLOR_OFFSET),r.useColorTemperature){var p=r.colorTemperatureRGB;c[Hd.MAIN_LIT_COLOR_OFFSET]*=p.x,c[Hd.MAIN_LIT_COLOR_OFFSET+1]*=p.y,c[Hd.MAIN_LIT_COLOR_OFFSET+2]*=p.z}c[Hd.MAIN_LIT_COLOR_OFFSET+3]=_?r.illuminance*l:r.illuminance}else kN.set(0,0,1,0),sn.toArray(c,kN,Hd.MAIN_LIT_DIR_OFFSET),sn.toArray(c,sn.ZERO,Hd.MAIN_LIT_COLOR_OFFSET);var m=a.skyColor;m.w=_?a.skyIllum*l:a.skyIllum,c[Hd.AMBIENT_SKY_OFFSET+0]=m.x,c[Hd.AMBIENT_SKY_OFFSET+1]=m.y,c[Hd.AMBIENT_SKY_OFFSET+2]=m.z,c[Hd.AMBIENT_SKY_OFFSET+3]=m.w,c[Hd.AMBIENT_GROUND_OFFSET+0]=a.groundAlbedo.x,c[Hd.AMBIENT_GROUND_OFFSET+1]=a.groundAlbedo.y,c[Hd.AMBIENT_GROUND_OFFSET+2]=a.groundAlbedo.z,c[Hd.AMBIENT_GROUND_OFFSET+3]=o.envmap?null===(n=o.envmap)||void 0===n?void 0:n.mipmapLevel:1,Qi.toArray(c,i.matView,Hd.MAT_VIEW_OFFSET),Qi.toArray(c,i.node.worldMatrix,Hd.MAT_VIEW_INV_OFFSET),Di.toArray(c,i.position,Hd.CAMERA_POS_OFFSET),Qi.toArray(c,i.matProj,Hd.MAT_PROJ_OFFSET),Qi.toArray(c,i.matProjInv,Hd.MAT_PROJ_INV_OFFSET),Qi.toArray(c,i.matViewProj,Hd.MAT_VIEW_PROJ_OFFSET),Qi.toArray(c,i.matViewProjInv,Hd.MAT_VIEW_PROJ_INV_OFFSET),c[Hd.CAMERA_POS_OFFSET+3]=this.getCombineSignY(),c[Hd.SURFACE_TRANSFORM_OFFSET]=i.surfaceTransform;var g=u.colorArray;c[Hd.GLOBAL_FOG_COLOR_OFFSET]=g.x,c[Hd.GLOBAL_FOG_COLOR_OFFSET+1]=g.y,c[Hd.GLOBAL_FOG_COLOR_OFFSET+2]=g.z,c[Hd.GLOBAL_FOG_COLOR_OFFSET+3]=g.z,c[Hd.GLOBAL_FOG_BASE_OFFSET]=u.fogStart,c[Hd.GLOBAL_FOG_BASE_OFFSET+1]=u.fogEnd,c[Hd.GLOBAL_FOG_BASE_OFFSET+2]=u.fogDensity,c[Hd.GLOBAL_FOG_ADD_OFFSET]=u.fogTop,c[Hd.GLOBAL_FOG_ADD_OFFSET+1]=u.fogRange,c[Hd.GLOBAL_FOG_ADD_OFFSET+2]=u.fogAtten,c[Hd.NEAR_FAR_OFFSET]=i.nearClip,c[Hd.NEAR_FAR_OFFSET+1]=i.farClip,c[Hd.VIEW_PORT_OFFSET]=s.shadingScale*i.window.width*i.viewport.x,c[Hd.VIEW_PORT_OFFSET+1]=s.shadingScale*i.window.height*i.viewport.y,c[Hd.VIEW_PORT_OFFSET+2]=s.shadingScale*i.window.width*i.viewport.z,c[Hd.VIEW_PORT_OFFSET+3]=s.shadingScale*i.window.height*i.viewport.w},e.getPCFRadius=function(e,t){var i=e.size.x;switch(t.shadowPcf){case eS.HARD:return 0;case eS.SOFT:return 1/(.5*i);case eS.SOFT_2X:return 2/(.5*i)}return 0},e.updatePlanarNormalAndDistance=function(e,t){Di.normalize(HN,e.normal),t[Vd.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+0]=HN.x,t[Vd.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+1]=HN.y,t[Vd.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+2]=HN.z,t[Vd.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+3]=-e.distance},e.updateShadowUBOView=function(t,i,n,r){var s=t.device,a=r.scene.mainLight,o=t.pipelineSceneData,u=o.shadows,h=o.csmLayers,c=i,l=n,_=o.csmSupported,f=qp(s)?0:1;if(a&&u.enabled){if(u.type===$A.ShadowMap){if(a.shadowEnabled){if(a.shadowFixedArea||a.csmLevel===tS.LEVEL_1||!_){var d=h.specialLayer.matShadowView,p=h.specialLayer.matShadowProj,m=h.specialLayer.matShadowViewProj,g=a.shadowNear,v=a.shadowFar;Qi.toArray(c,d,Vd.MAT_LIGHT_VIEW_OFFSET),c[Vd.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=p.m10,c[Vd.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=p.m14,c[Vd.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=p.m11,c[Vd.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=p.m15,c[Vd.SHADOW_PROJ_INFO_OFFSET+0]=p.m00,c[Vd.SHADOW_PROJ_INFO_OFFSET+1]=p.m05,c[Vd.SHADOW_PROJ_INFO_OFFSET+2]=1/p.m00,c[Vd.SHADOW_PROJ_INFO_OFFSET+3]=1/p.m05,Qi.toArray(c,m,Vd.MAT_LIGHT_VIEW_PROJ_OFFSET),zN.set(g,v,0,1-a.shadowSaturation),sn.toArray(c,zN,Vd.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),zN.set(0,f,a.shadowNormalBias,0),sn.toArray(c,zN,Vd.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET)}else{for(var y=this.getPCFRadius(u,a),E=0;E<a.csmLevel;E++){var T=h.layers[E].matShadowView;zN.set(T.m00,T.m04,T.m08,y),sn.toArray(l,zN,Wd.CSM_VIEW_DIR_0_OFFSET+4*E),zN.set(T.m01,T.m05,T.m09,0),sn.toArray(l,zN,Wd.CSM_VIEW_DIR_1_OFFSET+4*E),zN.set(T.m02,T.m06,T.m10,0),sn.toArray(l,zN,Wd.CSM_VIEW_DIR_2_OFFSET+4*E);var A=h.layers[E].csmAtlas;sn.toArray(l,A,Wd.CSM_ATLAS_OFFSET+4*E),l[Wd.CSM_SPLITS_INFO_OFFSET+E]=h.layers[E].splitCameraFar/a.shadowDistance;var S=h.layers[E].matShadowViewProj;Qi.toArray(l,S,Wd.MAT_CSM_VIEW_PROJ_OFFSET+16*E);var b=h.layers[E].matShadowProj;l[Wd.CSM_PROJ_DEPTH_INFO_OFFSET+0+4*E]=b.m10,l[Wd.CSM_PROJ_DEPTH_INFO_OFFSET+1+4*E]=b.m14,l[Wd.CSM_PROJ_DEPTH_INFO_OFFSET+2+4*E]=b.m11,l[Wd.CSM_PROJ_DEPTH_INFO_OFFSET+3+4*E]=b.m15,l[Wd.CSM_PROJ_INFO_OFFSET+0+4*E]=b.m00,l[Wd.CSM_PROJ_INFO_OFFSET+1+4*E]=b.m05,l[Wd.CSM_PROJ_INFO_OFFSET+2+4*E]=1/b.m00,l[Wd.CSM_PROJ_INFO_OFFSET+3+4*E]=1/b.m05}zN.set(0,0,0,1-a.shadowSaturation),sn.toArray(c,zN,Vd.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),zN.set(0,f,a.shadowNormalBias,a.csmLevel),sn.toArray(c,zN,Vd.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET)}zN.set(u.size.x,u.size.y,a.shadowPcf,a.shadowBias),sn.toArray(c,zN,Vd.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET)}}else e.updatePlanarNormalAndDistance(u,c);Fi.toArray(c,u.shadowColor,Vd.SHADOW_COLOR_OFFSET)}},e.updateShadowUBOLightView=function(e,t,i,n){var r=e.device,s=e.pipelineSceneData,a=s.shadows,o=s.csmLayers,u=t,h=qp(r)?0:1,c=e.device.capabilities;switch(i.type){case yN.DIRECTIONAL:var l=i;if(a.enabled&&l&&l.shadowEnabled&&a.type===$A.ShadowMap){var _,f,d,p=.1,m=0,g=0;if(l.shadowFixedArea||l.csmLevel===tS.LEVEL_1)_=o.specialLayer.matShadowView,f=o.specialLayer.matShadowProj,d=o.specialLayer.matShadowViewProj,l.shadowFixedArea?(p=l.shadowNear,m=l.shadowFar,g=0):(p=.1,m=o.specialLayer.shadowCameraFar,g=1),zN.set(0,h,l.shadowNormalBias,0),sn.toArray(u,zN,Vd.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET);else{var v=o.layers[n];_=v.matShadowView,f=v.matShadowProj,d=v.matShadowViewProj,p=v.splitCameraNear,m=v.splitCameraFar,g=l.csmLevel}Qi.toArray(u,_,Vd.MAT_LIGHT_VIEW_OFFSET),u[Vd.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=f.m10,u[Vd.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=f.m14,u[Vd.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=f.m11,u[Vd.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=f.m15,u[Vd.SHADOW_PROJ_INFO_OFFSET+0]=f.m00,u[Vd.SHADOW_PROJ_INFO_OFFSET+1]=f.m05,u[Vd.SHADOW_PROJ_INFO_OFFSET+2]=1/f.m00,u[Vd.SHADOW_PROJ_INFO_OFFSET+3]=1/f.m05,Qi.toArray(u,d,Vd.MAT_LIGHT_VIEW_PROJ_OFFSET),zN.set(p,m,0,1-l.shadowSaturation),sn.toArray(u,zN,Vd.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),zN.set(0,h,l.shadowNormalBias,g),sn.toArray(u,zN,Vd.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET),zN.set(a.size.x,a.size.y,l.shadowPcf,l.shadowBias),sn.toArray(u,zN,Vd.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET)}break;case yN.SPOT:var y=i;a.enabled&&y&&y.shadowEnabled&&(Qi.invert(BN,i.node.getWorldMatrix()),Qi.toArray(u,BN,Vd.MAT_LIGHT_VIEW_OFFSET),Qi.perspective(UN,i.angle,1,.001,i.range,!0,c.clipSpaceMinZ,c.clipSpaceSignY,0),Qi.multiply(GN,UN,BN),Qi.toArray(u,GN,Vd.MAT_LIGHT_VIEW_PROJ_OFFSET),zN.set(.01,i.range,0,0),sn.toArray(u,zN,Vd.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),zN.set(a.size.x,a.size.y,y.shadowPcf,y.shadowBias),sn.toArray(u,zN,Vd.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET),zN.set(1,h,y.shadowNormalBias,0),sn.toArray(u,zN,Vd.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET))}Fi.toArray(u,a.shadowColor,Vd.SHADOW_COLOR_OFFSET)},e.getCombineSignY=function(){return e._combineSignY};var t=e.prototype;return t._initCombineSignY=function(){var t=this._device;e._combineSignY=.5*t.capabilities.screenSpaceSignY+.5<<1|.5*t.capabilities.clipSpaceSignY+.5},t.activate=function(e,t){this._device=e,this._pipeline=t;var i=this._pipeline.descriptorSet;this._initCombineSignY();var n=e.createBuffer(new Sr(En.UNIFORM|En.TRANSFER_DST,Sn.HOST|Sn.DEVICE,kd.SIZE,kd.SIZE));i.bindBuffer(kd.BINDING,n);var r=e.createBuffer(new Sr(En.UNIFORM|En.TRANSFER_DST,Sn.HOST|Sn.DEVICE,Hd.SIZE,Hd.SIZE));i.bindBuffer(Hd.BINDING,r);var s=e.createBuffer(new Sr(En.UNIFORM|En.TRANSFER_DST,Sn.HOST|Sn.DEVICE,Vd.SIZE,Vd.SIZE));i.bindBuffer(Vd.BINDING,s);var a=e.createBuffer(new Sr(En.UNIFORM|En.TRANSFER_DST,Sn.HOST|Sn.DEVICE,Wd.SIZE,Wd.SIZE));i.bindBuffer(Wd.BINDING,a)},t.updateGlobalUBO=function(t){var i=this._pipeline.globalDSManager,n=this._pipeline.descriptorSet,r=this._pipeline.commandBuffers;n.update(),e.updateGlobalUBOView(t,this._globalUBO),r[0].updateBuffer(n.getBuffer(kd.BINDING),this._globalUBO),i.bindBuffer(kd.BINDING,n.getBuffer(kd.BINDING)),i.update()},t.updateCameraUBO=function(t){var i=this._pipeline.globalDSManager,n=this._pipeline.descriptorSet,r=this._pipeline.commandBuffers;e.updateCameraUBOView(this._pipeline,this._cameraUBO,t),r[0].updateBuffer(n.getBuffer(Hd.BINDING),this._cameraUBO),i.bindBuffer(Hd.BINDING,n.getBuffer(Hd.BINDING)),i.update()},t.updateShadowUBO=function(t){var i=this._pipeline.pipelineSceneData;if(i.shadows.enabled){var n=this._pipeline.descriptorSet,r=this._pipeline.commandBuffers,s=i.shadowFrameBufferMap,a=t.scene.mainLight;a&&s.has(a)&&n.bindTexture(jd,s.get(a).colorTextures[0]),e.updateShadowUBOView(this._pipeline,this._shadowUBO,this._csmUBO,t),n.update(),r[0].updateBuffer(n.getBuffer(Vd.BINDING),this._shadowUBO),r[0].updateBuffer(n.getBuffer(Wd.BINDING),this._csmUBO)}},t.updateShadowUBOLight=function(t,i,n){void 0===n&&(n=0),e.updateShadowUBOLightView(this._pipeline,this._shadowUBO,i,n),t.bindTexture(jd,Kv.get("default-texture").getGFXTexture()),t.bindTexture(ep,Kv.get("default-texture").getGFXTexture()),t.update(),t.getBuffer(Vd.BINDING).update(this._shadowUBO)},t.updateShadowUBORange=function(e,t){t instanceof Qi?Qi.toArray(this._shadowUBO,t,e):t instanceof Fi&&Fi.toArray(this._shadowUBO,t,e)},t.destroy=function(){},e}();VN._combineSignY=0;var WN,jN,XN,YN,qN,KN,QN,ZN,JN,$N,eC,tC,iC,nC=e("hg",(bN=th("RenderStage"),wN=Nh(),RN=Nh(),IN=Nh(),bN((FN=function(){function e(){T(this,"_name",CN,this),T(this,"_priority",MN,this),this._enabled=!0,T(this,"_tag",xN,this)}var t=e.prototype;return t.initialize=function(e){return this._name=e.name,this._priority=e.priority,e.tag&&(this._tag=e.tag),!0},t.activate=function(e,t){this._pipeline=e,this._flow=t},c(e,[{key:"name",get:function(){return this._name}},{key:"priority",get:function(){return this._priority}},{key:"tag",get:function(){return this._tag}},{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e}}]),e}(),CN=A((NN=FN).prototype,"_name",[wN,hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),MN=A(NN.prototype,"_priority",[RN,hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),xN=A(NN.prototype,"_tag",[IN,hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),ON=NN))||ON));R.RenderStage=nC;var rC,sC=e("hf",(WN=th("RenderFlow"),jN=Nh(),XN=Nh(),YN=Nh(),qN=Nh(),KN=Dh([nC]),WN((iC=function(){function e(){T(this,"_name",JN,this),T(this,"_priority",$N,this),T(this,"_tag",eC,this),T(this,"_stages",tC,this)}var t=e.prototype;return t.initialize=function(e){return this._name=e.name,this._priority=e.priority,this._stages=e.stages,e.tag&&(this._tag=e.tag),!0},t.activate=function(e){this._pipeline=e,this._stages.sort((function(e,t){return e.priority-t.priority}));for(var t=0,i=this._stages.length;t<i;t++)this._stages[t].activate(e,this)},t.render=function(e){for(var t=0,i=this._stages.length;t<i;t++)this._stages[t].enabled&&this._stages[t].render(e)},t.destroy=function(){for(var e=0,t=this._stages.length;e<t;e++)this._stages[e].destroy();this._stages.length=0},c(e,[{key:"name",get:function(){return this._name}},{key:"priority",get:function(){return this._priority}},{key:"tag",get:function(){return this._tag}},{key:"stages",get:function(){return this._stages}},{key:"pipeline",get:function(){return this._pipeline}}]),e}(),JN=A((ZN=iC).prototype,"_name",[jN,hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),$N=A(ZN.prototype,"_priority",[XN,hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),eC=A(ZN.prototype,"_tag",[YN,hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),tC=A(ZN.prototype,"_stages",[qN,KN,hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),QN=ZN))||QN));R.RenderFlow=sC,function(e){e.RENDER_FRAME_BEGIN="render-frame-begin",e.RENDER_FRAME_END="render-frame-end",e.RENDER_CAMERA_BEGIN="render-camera-begin",e.RENDER_CAMERA_END="render-camera-end",e.ATTACHMENT_SCALE_CAHNGED="attachment-scale-changed"}(rC||(rC=e("gm",{})));var aC,oC,uC,hC,cC,lC,_C,fC,dC,pC,mC,gC,vC,yC,EC,TC,AC,SC,bC,wC,RC,IC,OC,NC,CC,MC,xC,FC,PC,DC,LC,BC,UC,GC,zC,kC,HC,VC,WC,jC,XC,YC,qC,KC,QC,ZC,JC,$C,eM,tM,iM,nM,rM,sM,aM,oM,uM,hM,cM,lM,_M,fM,dM,pM,mM,gM,vM,yM,EM,TM,AM,SM,bM,wM,RM,IM,OM,NM,CM,MM,xM,FM,PM,DM,LM,BM,UM,GM,zM,kM,HM,VM,WM,jM=e("hv",function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).eventTargetOn=e.prototype.on,t.eventTargetOnce=e.prototype.once,t}_(t,e);var i=t.prototype;return i.on=function(e,t,i,n){return this.eventTargetOn(e,t,i,n)},i.once=function(e,t,i){return this.eventTargetOnce(e,t,i)},t}(Aa)),XM=new lr,YM=new vr,qM=function(){this.renderPass=null,this.sampler=null,this.prefiterTex=null,this.downsampleTexs=[],this.upsampleTexs=[],this.combineTex=null,this.prefilterFramebuffer=null,this.downsampleFramebuffers=[],this.upsampleFramebuffers=[],this.combineFramebuffer=null},KM=function(){this.quadIB=null,this.quadVB=null,this.quadIA=null},QM=e("he",(aC=th("cc.RenderPipeline"),oC=Nh(),uC=Nh(),hC=Dh([sC]),aC((dC=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return T(t=e.call.apply(e,[this].concat(n))||this,"_tag",_C,v(t)),T(t,"_flows",fC,v(t)),t._quadIB=null,t._quadVBOnscreen=null,t._quadVBOffscreen=null,t._quadIAOnscreen=null,t._quadIAOffscreen=null,t._eventProcessor=new jM,t._commandBuffers=[],t._pipelineUBO=new VN,t._macros={},t._constantMacros="",t._profiler=null,t._geometryRenderer=null,t._pipelineRenderData=null,t._renderPasses=new Map,t._width=0,t._height=0,t._lastUsedRenderArea=new lr,t._clusterEnabled=!1,t._bloomEnabled=!1,t}_(t,e);var i=t.prototype;return i.getPipelineRenderData=function(){return this._pipelineRenderData},i.initialize=function(e){return this._flows=e.flows,e.tag&&(this._tag=e.tag),!0},i.createRenderPass=function(e,t,i){var n=this._device,r=new Vr,s=new Wr;r.format=t,s.format=i,s.stencilStoreOp=Gn.DISCARD,s.depthStoreOp=Gn.DISCARD,e&$n.COLOR||(e&rA?r.loadOp=Un.DISCARD:(r.loadOp=Un.LOAD,r.barrier=n.getGeneralBarrier(new qr(zn.COLOR_ATTACHMENT_WRITE,zn.COLOR_ATTACHMENT_WRITE)))),(e&$n.DEPTH_STENCIL)!==$n.DEPTH_STENCIL&&(e&$n.DEPTH||(s.depthLoadOp=Un.LOAD),e&$n.STENCIL||(s.stencilLoadOp=Un.LOAD)),s.barrier=n.getGeneralBarrier(new qr(zn.DEPTH_STENCIL_ATTACHMENT_WRITE,zn.DEPTH_STENCIL_ATTACHMENT_WRITE));var a=new Yr([r],s);return n.createRenderPass(a)},i.getRenderPass=function(e,t){var i=this._renderPasses.get(e);return i||(i=this.createRenderPass(e,t.colorTextures[0].format,t.depthStencilTexture.format),this._renderPasses.set(e,i),i)},i.applyFramebufferRatio=function(e){for(var t=this.pipelineSceneData,i=this._width*t.shadingScale,n=this._height*t.shadingScale,r=e.colorTextures,s=0;s<r.length;s++)r[s].resize(i,n);e.depthStencilTexture&&e.depthStencilTexture.resize(i,n),e.destroy(),e.initialize(new Zr(e.renderPass,r,e.depthStencilTexture))},i.generateRenderArea=function(e,t){var i=e.viewport,n=e.window.width,r=e.window.height;t.x=i.x*n,t.y=i.y*r,t.width=i.width*n,t.height=i.height*r},i.generateViewport=function(e,t){this.generateRenderArea(e,XM),t||(t=YM);var i=this.pipelineSceneData.shadingScale;return t.left=XM.x*i,t.top=XM.y*i,t.width=XM.width*i,t.height=XM.height*i,t},i.generateScissor=function(e,t){t||(t=XM),this.generateRenderArea(e,t);var i=this.pipelineSceneData.shadingScale;return t.x*=i,t.y*=i,t.width*=i,t.height*=i,t},i.getMacroString=function(e){var t=this._macros[e];return void 0===t?"":t},i.getMacroInt=function(e){var t=this._macros[e];return void 0===t?0:t},i.getMacroBool=function(e){var t=this._macros[e];return void 0!==t&&t},i.setMacroString=function(e,t){this._macros[e]=t},i.setMacroInt=function(e,t){this._macros[e]=t},i.setMacroBool=function(e,t){this._macros[e]=t},i.activate=function(){this._device=Va.gfxDevice,this._generateConstantMacros(),this._globalDSManager=new AN(this._device),this._descriptorSet=this._globalDSManager.globalDescriptorSet,this._pipelineUBO.activate(this._device,this),this._macros.CC_USE_HDR=this._pipelineSceneData.isHDR,this._macros.CC_USE_DEBUG_VIEW=0,this._generateConstantMacros(),this._pipelineSceneData.activate(this._device);for(var e=0;e<this._flows.length;e++)this._flows[e].activate(this);return!0},i._ensureEnoughSize=function(){},i.render=function(e){if(0!==e.length){this.updateGeometryRenderer(e),this._commandBuffers[0].begin(),this.emit(rC.RENDER_FRAME_BEGIN,e),this._ensureEnoughSize(e),function(e){for(var t=e.length-1;t>=0;--t){var i=e[t];if(i.window.swapchain)return void(gy=i)}gy=null}(e);for(var t=0;t<e.length;t++){var i=e[t];if(i.scene){this.emit(rC.RENDER_CAMERA_BEGIN,i),gN(this,i),vN(this,i),this._pipelineUBO.updateGlobalUBO(i.window),this._pipelineUBO.updateCameraUBO(i);for(var n=0;n<this._flows.length;n++)this._flows[n].render(i);this.emit(rC.RENDER_CAMERA_END,i)}}this.emit(rC.RENDER_FRAME_END,e),this._commandBuffers[0].end(),this._device.queue.submit(this._commandBuffers)}},i._destroyQuadInputAssembler=function(){this._quadIB&&(this._quadIB.destroy(),this._quadIB=null),this._quadVBOnscreen&&(this._quadVBOnscreen.destroy(),this._quadVBOnscreen=null),this._quadVBOffscreen&&(this._quadVBOffscreen.destroy(),this._quadVBOffscreen=null),this._quadIAOnscreen&&(this._quadIAOnscreen.destroy(),this._quadIAOnscreen=null),this._quadIAOffscreen&&(this._quadIAOffscreen.destroy(),this._quadIAOffscreen=null)},i._destroyBloomData=function(){var e,t=this._pipelineRenderData.bloom;if(null!==t){t.prefiterTex&&t.prefiterTex.destroy(),t.prefilterFramebuffer&&t.prefilterFramebuffer.destroy();for(var i=0;i<t.downsampleTexs.length;++i)t.downsampleTexs[i].destroy(),t.downsampleFramebuffers[i].destroy();t.downsampleTexs.length=0,t.downsampleFramebuffers.length=0;for(var n=0;n<t.upsampleTexs.length;++n)t.upsampleTexs[n].destroy(),t.upsampleFramebuffers[n].destroy();t.upsampleTexs.length=0,t.upsampleFramebuffers.length=0,t.combineTex&&t.combineTex.destroy(),t.combineFramebuffer&&t.combineFramebuffer.destroy(),null===(e=t.renderPass)||void 0===e||e.destroy(),this._pipelineRenderData.bloom=null}},i._genQuadVertexData=function(e,t){var i=new Float32Array(16),n=t.x/this._width,r=(t.x+t.width)/this._width,s=t.y/this._height,a=(t.y+t.height)/this._height;if(this.device.capabilities.screenSpaceSignY>0){var o=a;a=s,s=o}var u=0;switch(e){case pn.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 pn.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 pn.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 pn.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 KM,t=4*Float32Array.BYTES_PER_ELEMENT,i=4*t,n=this._device.createBuffer(new Sr(En.VERTEX|En.TRANSFER_DST,Sn.DEVICE|Sn.HOST,i,t));if(!n)return e;var r=Uint8Array.BYTES_PER_ELEMENT,s=6*r,a=this._device.createBuffer(new Sr(En.INDEX|En.TRANSFER_DST,Sn.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 zr("a_position",gn.RG32F),u[1]=new zr("a_texCoord",gn.RG32F);var h=this._device.createInputAssembler(new Hr(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(pn.IDENTITY,e);this._quadVBOffscreen.update(n);var r=this._genQuadVertexData(t.swapchain&&t.swapchain.surfaceTransform||pn.IDENTITY,e);this._quadVBOnscreen.update(r),i.copy(e)}},i.destroy=function(){for(var t,i,n=0;n<this._flows.length;n++)this._flows[n].destroy();this._flows.length=0,this._descriptorSet&&this._descriptorSet.destroy(),null===(t=this._globalDSManager)||void 0===t||t.destroy();for(var r=0;r<this._commandBuffers.length;r++)this._commandBuffers[r].destroy();return this._commandBuffers.length=0,this._pipelineUBO.destroy(),null===(i=this._pipelineSceneData)||void 0===i||i.destroy(),e.prototype.destroy.call(this)},i.onGlobalPipelineStateChanged=function(){},i._generateConstantMacros=function(){var e="";e+="#define CC_DEVICE_SUPPORT_FLOAT_TEXTURE "+(this.device.getFormatFeatures(gn.RGBA32F)&(In.RENDER_TARGET|In.SAMPLED_TEXTURE)?1:0)+"\n",e+="#define CC_ENABLE_CLUSTERED_LIGHT_CULLING "+(this._clusterEnabled?1:0)+"\n",e+="#define CC_DEVICE_MAX_VERTEX_UNIFORM_VECTORS "+this.device.capabilities.maxVertexUniformVectors+"\n",e+="#define CC_DEVICE_MAX_FRAGMENT_UNIFORM_VECTORS "+this.device.capabilities.maxFragmentUniformVectors+"\n",e+="#define CC_DEVICE_CAN_BENEFIT_FROM_INPUT_ATTACHMENT "+(this.device.hasFeature(mn.INPUT_ATTACHMENT_BENEFIT)?1:0)+"\n",e+="#define CC_PLATFORM_ANDROID_AND_WEBGL "+(xa.os===Ra.ANDROID&&xa.isBrowser?1:0)+"\n",e+="#define CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES "+(At.ENABLE_WEBGL_HIGHP_STRUCT_VALUES?1:0)+"\n",e+="#define CC_JOINT_UNIFORM_CAPACITY "+_p.JOINT_UNIFORM_CAPACITY+"\n",this._constantMacros=e},i.updateGeometryRenderer=function(e){if(!this._geometryRenderer)for(var t=0;t<e.length;t++){var i=e[t];if(i&&i.window&&i.window.swapchain)return i.initGeometryRenderer(),void(this._geometryRenderer=i.geometryRenderer)}},i.generateBloomRenderData=function(){if(null==this._pipelineRenderData.bloom){var e=this._pipelineRenderData.bloom=new qM,t=this.device,i=new Vr;i.format=gn.RGBA8,i.loadOp=Un.CLEAR,i.storeOp=Gn.STORE,i.barrier=t.getGeneralBarrier(new qr(zn.NONE,zn.COLOR_ATTACHMENT_WRITE)),e.renderPass=t.createRenderPass(new Yr([i]));var n=this._width,r=this._height;e.prefiterTex=t.createTexture(new Or(bn.TEX2D,wn.COLOR_ATTACHMENT|wn.SAMPLED,gn.RGBA8,n>>1,r>>1)),e.prefilterFramebuffer=t.createFramebuffer(new Zr(e.renderPass,[e.prefiterTex])),n>>=1,r>>=1;for(var s=0;s<6;++s)e.downsampleTexs.push(t.createTexture(new Or(bn.TEX2D,wn.COLOR_ATTACHMENT|wn.SAMPLED,gn.RGBA8,n>>1,r>>1))),e.downsampleFramebuffers[s]=t.createFramebuffer(new Zr(e.renderPass,[e.downsampleTexs[s]])),e.upsampleTexs.push(t.createTexture(new Or(bn.TEX2D,wn.COLOR_ATTACHMENT|wn.SAMPLED,gn.RGBA8,n,r))),e.upsampleFramebuffers[s]=t.createFramebuffer(new Zr(e.renderPass,[e.upsampleTexs[s]])),n>>=1,r>>=1;e.combineTex=t.createTexture(new Or(bn.TEX2D,wn.COLOR_ATTACHMENT|wn.SAMPLED,gn.RGBA8,this._width,this._height)),e.combineFramebuffer=t.createFramebuffer(new Zr(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)},c(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(rC.ATTACHMENT_SCALE_CAHNGED,e))}}]),t}(Cc),_C=A((lC=dC).prototype,"_tag",[oC,hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),fC=A(lC.prototype,"_flows",[uC,hC,hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),cC=lC))||cC));R.RenderPipeline=QM,re(QM.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"}(pC||(pC={})),function(e){e[e.FORWARD=10]="FORWARD"}(mC||(mC={})),function(e){e[e.SHADOW=0]="SHADOW",e[e.FORWARD=1]="FORWARD",e[e.UI=10]="UI"}(gC||(gC={})),function(e){e[e.GBUFFER=10]="GBUFFER",e[e.LIGHTING=15]="LIGHTING",e[e.TRANSPARENT=18]="TRANSPARENT"}(vC||(vC={})),function(e){e[e.SHADOW=0]="SHADOW",e[e.MAIN=1]="MAIN",e[e.UI=10]="UI"}(yC||(yC={})),gt(bn),gt(wn),gt(Gn),gt(Un),gt(zn),gt(gn),function(e){e[e.SCENE=0]="SCENE",e[e.POSTPROCESS=1]="POSTPROCESS",e[e.UI=2]="UI"}(WM||(WM={})),gt(WM),EC=th("RenderTextureDesc"),TC=Dh(bn),AC=Dh(wn),SC=Dh(gn),EC((wC=A((bC=function(){T(this,"name",wC,this),T(this,"type",RC,this),T(this,"usage",IC,this),T(this,"format",OC,this),T(this,"width",NC,this),T(this,"height",CC,this)}).prototype,"name",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),RC=A(bC.prototype,"type",[TC],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return bn.TEX2D}}),IC=A(bC.prototype,"usage",[AC],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return wn.COLOR_ATTACHMENT}}),OC=A(bC.prototype,"format",[SC],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return gn.UNKNOWN}}),NC=A(bC.prototype,"width",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return-1}}),CC=A(bC.prototype,"height",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return-1}}),bC));var ZM,JM=(MC=th("RenderTextureConfig"),xC=Dh(DE),MC((DC=A((PC=function(){T(this,"name",DC,this),T(this,"texture",LC,this)}).prototype,"name",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),LC=A(PC.prototype,"texture",[xC],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),FC=PC))||FC),$M=(BC=th("MaterialConfig"),UC=Dh(Ey),BC((zC=A((GC=function(){T(this,"name",zC,this),T(this,"material",kC,this)}).prototype,"name",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),kC=A(GC.prototype,"material",[UC],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),GC)),HC=th("FrameBufferDesc"),VC=Dh([Yt]),WC=Dh(DE),HC((XC=A((jC=function(){T(this,"name",XC,this),T(this,"renderPass",YC,this),T(this,"colorTextures",qC,this),T(this,"depthStencilTexture",KC,this),T(this,"texture",QC,this)}).prototype,"name",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),YC=A(jC.prototype,"renderPass",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),qC=A(jC.prototype,"colorTextures",[VC],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),KC=A(jC.prototype,"depthStencilTexture",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),QC=A(jC.prototype,"texture",[WC],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),jC)),ZC=th("ColorDesc"),JC=Dh(gn),$C=Dh(Un),eM=Dh(Gn),tM=Dh([zn]),iM=Dh([zn]),ZC((sM=A((rM=function(){T(this,"format",sM,this),T(this,"loadOp",aM,this),T(this,"storeOp",oM,this),T(this,"sampleCount",uM,this),T(this,"beginAccesses",hM,this),T(this,"endAccesses",cM,this)}).prototype,"format",[JC],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return gn.UNKNOWN}}),aM=A(rM.prototype,"loadOp",[$C],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Un.CLEAR}}),oM=A(rM.prototype,"storeOp",[eM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Gn.STORE}}),uM=A(rM.prototype,"sampleCount",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),hM=A(rM.prototype,"beginAccesses",[tM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return zn.NONE}}),cM=A(rM.prototype,"endAccesses",[iM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return zn.COLOR_ATTACHMENT_WRITE}}),nM=rM))||nM),ex=(lM=th("DepthStencilDesc"),_M=Dh(gn),fM=Dh(Un),dM=Dh(Gn),pM=Dh(Un),mM=Dh(Gn),gM=Dh(zn),vM=Dh(zn),lM((TM=A((EM=function(){T(this,"format",TM,this),T(this,"depthLoadOp",AM,this),T(this,"depthStoreOp",SM,this),T(this,"stencilLoadOp",bM,this),T(this,"stencilStoreOp",wM,this),T(this,"sampleCount",RM,this),T(this,"beginAccesses",IM,this),T(this,"endAccesses",OM,this)}).prototype,"format",[_M],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return gn.UNKNOWN}}),AM=A(EM.prototype,"depthLoadOp",[fM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Un.CLEAR}}),SM=A(EM.prototype,"depthStoreOp",[dM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Gn.STORE}}),bM=A(EM.prototype,"stencilLoadOp",[pM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Un.CLEAR}}),wM=A(EM.prototype,"stencilStoreOp",[mM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Gn.STORE}}),RM=A(EM.prototype,"sampleCount",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),IM=A(EM.prototype,"beginAccesses",[gM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return zn.NONE}}),OM=A(EM.prototype,"endAccesses",[vM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return zn.DEPTH_STENCIL_ATTACHMENT_WRITE}}),yM=EM))||yM);NM=th("RenderPassDesc"),CM=Dh([$M]),MM=Dh(ex),NM((FM=A((xM=function(){T(this,"index",FM,this),T(this,"colorAttachments",PM,this),T(this,"depthStencilAttachment",DM,this)}).prototype,"index",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return-1}}),PM=A(xM.prototype,"colorAttachments",[CM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),DM=A(xM.prototype,"depthStencilAttachment",[MM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new ex}}),xM)),function(e){e[e.FRONT_TO_BACK=0]="FRONT_TO_BACK",e[e.BACK_TO_FRONT=1]="BACK_TO_FRONT"}(ZM||(ZM={})),gt(ZM);var tx=(LM=th("RenderQueueDesc"),BM=Dh(ZM),UM=Dh([Yt]),LM((kM=A((zM=function(){T(this,"isTransparent",kM,this),T(this,"sortMode",HM,this),T(this,"stages",VM,this)}).prototype,"isTransparent",[hh,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),HM=A(zM.prototype,"sortMode",[BM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ZM.FRONT_TO_BACK}}),VM=A(zM.prototype,"stages",[UM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),GM=zM))||GM);function ix(e,t){return e.hash-t.hash||e.depth-t.depth||e.shaderId-t.shaderId}function nx(e,t){return e.priority-t.priority||e.hash-t.hash||t.depth-e.depth||e.shaderId-t.shaderId}var rx=function(){function e(e){this.queue=void 0,this._passDesc=void 0,this._passPool=void 0,this._passDesc=e,this._passPool=new sa((function(){return{priority:0,hash:0,depth:0,shaderId:0,subModel:null,passIdx:0}}),64),this.queue=new aa(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;n<this.queue.length;++n){var r=this.queue.array[n],s=r.subModel,a=r.passIdx,o=s.inputAssembler,u=s.passes[a],h=s.shaders[a],c=ny.getOrCreatePipelineState(e,u,h,t,o);i.bindPipelineState(c),i.bindDescriptorSet(Ld.MATERIAL,u.descriptorSet),i.bindDescriptorSet(Ld.LOCAL,s.descriptorSet),i.bindInputAssembler(o),i.draw(o)}},e}();function sx(e){for(var t=0,i=0;i<e.stages.length;i++)t|=Qv(e.stages[i]);var n=ix;switch(e.sortMode){case ZM.BACK_TO_FRONT:n=nx;break;case ZM.FRONT_TO_BACK:n=ix}return new rx({isTransparent:e.isTransparent,phases:t,sortFunc:n})}function ax(e){e.clear()}function ox(e){e.sort()}var ux,hx=function(){function e(){this.queue=new Set}var t=e.prototype;return t.clear=function(){for(var e=this.queue.values(),t=e.next();!t.done;)t.value.clear(),t=e.next();this.queue.clear()},t.uploadBuffers=function(e){for(var t=this.queue.values(),i=t.next();!i.done;){for(var n=0;n<i.value.batches.length;++n){var r=i.value.batches[n];if(r.mergeCount){for(var s=0;s<r.vbs.length;++s)r.vbs[s].update(r.vbDatas[s]);e.updateBuffer(r.vbIdx,r.vbIdxData.buffer),e.updateBuffer(r.ubo,r.uboData)}}i=t.next()}},t.recordCommandBuffer=function(e,t,i,n,r){void 0===n&&(n=null);for(var s=this.queue.values(),a=s.next();!a.done;){for(var o=!1,u=0;u<a.value.batches.length;++u){var h=a.value.batches[u];if(h.mergeCount){if(!o){var c=h.shader,l=ny.getOrCreatePipelineState(e,h.pass,c,t,h.ia);i.bindPipelineState(l),i.bindDescriptorSet(Ld.MATERIAL,h.pass.descriptorSet),o=!0}n&&i.bindDescriptorSet(Ld.GLOBAL,n),r?i.bindDescriptorSet(Ld.LOCAL,h.descriptorSet,r):i.bindDescriptorSet(Ld.LOCAL,h.descriptorSet,a.value.dynamicOffsets),i.bindInputAssembler(h.ia),i.draw(h.ia)}}a=s.next()}},e}(),cx=function(){function e(){this.queue=new Set,this._renderQueue=[]}var t=e.prototype;return t.clear=function(){for(var e=this.queue.values(),t=e.next();!t.done;)t.value.clear(),t=e.next();this._renderQueue=[],this.queue.clear()},t.sort=function(){for(var e=this.queue.values(),t=e.next();!t.done;)t.value.pass.blendState.targets[0].blend||this._renderQueue.push(t.value),t=e.next();for(t=(e=this.queue.values()).next();!t.done;)t.value.pass.blendState.targets[0].blend&&this._renderQueue.push(t.value),t=e.next()},t.uploadBuffers=function(e){for(var t=this.queue.values(),i=t.next();!i.done;)i.value.hasPendingModels&&i.value.uploadBuffers(e),i=t.next()},t.recordCommandBuffer=function(e,t,i,n,r){void 0===n&&(n=null);for(var s=0===this._renderQueue.length?this.queue.values():this._renderQueue.values(),a=s.next();!a.done;){var o=a.value,u=o.instances,h=o.pass;if(o.hasPendingModels){i.bindDescriptorSet(Ld.MATERIAL,h.descriptorSet);for(var c=null,l=0;l<u.length;++l){var _=u[l];if(_.count){var f=_.shader,d=ny.getOrCreatePipelineState(e,h,f,t,_.ia);c!==d&&(i.bindPipelineState(d),c=d),n&&i.bindDescriptorSet(Ld.GLOBAL,n),r?i.bindDescriptorSet(Ld.LOCAL,_.descriptorSet,r):i.bindDescriptorSet(Ld.LOCAL,_.descriptorSet,a.value.dynamicOffsets),i.bindInputAssembler(_.ia),i.draw(_.ia)}}}a=s.next()}},e}(),lx=new es(null),_x=e("cD",function(){function e(){this._device=null,this._passes=null,this._shaders=null,this._subMesh=null,this._patches=null,this._priority=Rd.DEFAULT,this._inputAssembler=null,this._descriptorSet=null,this._worldBoundDescriptorSet=null,this._planarInstanceShader=null,this._planarShader=null,this._reflectionTex=null,this._reflectionSampler=null}var t=e.prototype;return t.initialize=function(e,t,i){void 0===i&&(i=null);var n=R.director.root;this._device=Va.gfxDevice,lx.layout=t[0].localSetLayout,this._inputAssembler=this._device.createInputAssembler(e.iaInfo),this._descriptorSet=this._device.createDescriptorSet(lx);var r=R.director.root.pipeline.pipelineSceneData.getOcclusionQueryPass();if(r){var s=new es(null);s.layout=r.localSetLayout,this._worldBoundDescriptorSet=this._device.createDescriptorSet(s)}if(this._subMesh=e,this._patches=i,this._passes=t,this._flushPassInfo(),t[0].batchingScheme===Yv.VB_MERGING&&this.subMesh.genFlatBuffers(),this.priority=Rd.DEFAULT,t[0].phase===Qv("reflection")){var a=n.mainWindow.width,o=n.mainWindow.height,u=512;o<a?(a=u*a/o,o=u):o=u*o/(a=u),this._reflectionTex=this._device.createTexture(new Or(bn.TEX2D,wn.STORAGE|wn.TRANSFER_SRC|wn.SAMPLED,gn.RGBA8,a,o)),this.descriptorSet.bindTexture(Bp,this._reflectionTex),this._reflectionSampler=this._device.getSampler(new Cr(Cn.LINEAR,Cn.LINEAR,Cn.NONE,Mn.CLAMP,Mn.CLAMP,Mn.CLAMP)),this.descriptorSet.bindSampler(Bp,this._reflectionSampler),this.descriptorSet.bindTexture(zp,this._reflectionTex)}},t.initPlanarShadowShader=function(){var e=R.director.root.pipeline.pipelineSceneData.shadows;this._planarShader=e.getPlanarShader(this._patches)},t.initPlanarShadowInstanceShader=function(){var e=R.director.root.pipeline.pipelineSceneData.shadows;this._planarInstanceShader=e.getPlanarInstanceShader(this._patches)},t.destroy=function(){var e;this._descriptorSet.destroy(),this._descriptorSet=null,this._inputAssembler.destroy(),this._inputAssembler=null,null===(e=this._worldBoundDescriptorSet)||void 0===e||e.destroy(),this._worldBoundDescriptorSet=null,this.priority=Rd.DEFAULT,this._patches=null,this._subMesh=null,this._passes=null,this._shaders=null,this._reflectionTex&&this._reflectionTex.destroy(),this._reflectionTex=null,this._reflectionSampler=null},t.update=function(){for(var e,t=0;t<this._passes.length;++t)this._passes[t].update();this._descriptorSet.update(),null===(e=this._worldBoundDescriptorSet)||void 0===e||e.update()},t.onPipelineStateChanged=function(){var e=this._passes;if(e){for(var t=0;t<e.length;t++){var i=e[t];i.beginChangeStatesSilently(),i.tryCompile(),i.endChangeStatesSilently()}this._flushPassInfo()}},t.onMacroPatchesStateChanged=function(e){this._patches=e;var t=this._passes;if(t){for(var i=0;i<t.length;i++){var n=t[i];n.beginChangeStatesSilently(),n.tryCompile(),n.endChangeStatesSilently()}this._flushPassInfo()}},t.onGeometryChanged=function(){if(this._subMesh){var e=this._subMesh.drawInfo;this._inputAssembler&&e&&this._inputAssembler.drawInfo.copy(e)}},t._flushPassInfo=function(){var e=this._passes;if(e){this._shaders||(this._shaders=[]),this._shaders.length=e.length;for(var t=0,i=e.length;t<i;t++)this._shaders[t]=e[t].getShaderVariant(this.patches)}},c(e,[{key:"passes",get:function(){return this._passes},set:function(e){e.length>8?K(12004,8):(this._passes=e,this._flushPassInfo(),this._passes[0].batchingScheme===Yv.VB_MERGING&&this.subMesh.genFlatBuffers(),this._descriptorSet&&(this._descriptorSet.destroy(),lx.layout=e[0].localSetLayout,this._descriptorSet=this._device.createDescriptorSet(lx)))}},{key:"shaders",get:function(){return this._shaders}},{key:"subMesh",get:function(){return this._subMesh},set:function(e){this._inputAssembler.destroy(),this._inputAssembler.initialize(e.iaInfo),this._passes[0].batchingScheme===Yv.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}}]),e}()),fx=new Qi,dx=[{name:"CC_RECEIVE_SHADOW",value:!0}],px=[{name:"CC_USE_LIGHTMAP",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"}(ux||(ux=e("cB",{})));var mx=new Cr(Cn.LINEAR,Cn.LINEAR,Cn.NONE,Mn.CLAMP,Mn.CLAMP,Mn.CLAMP),gx=new Cr(Cn.LINEAR,Cn.LINEAR,Cn.LINEAR,Mn.CLAMP,Mn.CLAMP,Mn.CLAMP),vx=(e("cC",function(){function e(){this.type=ux.DEFAULT,this.scene=null,this.isDynamicBatching=!1,this.instancedAttributes={buffer:null,views:[],attributes:[]},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(np.COUNT),this._localBuffer=null,this._instMatWorldIdx=-1,this._lightmap=null,this._lightmapUVParam=new sn,this._worldBoundBuffer=null,this._receiveShadow=!1,this._castShadow=!1,this._shadowBias=0,this._shadowNormalBias=0,this._enabled=!0,this._visFlags=bd.Enum.NONE,this._priority=0,this._device=Va.gfxDevice}var t=e.prototype;return t.initialize=function(){this._inited||(this._receiveShadow=!0,this.castShadow=!1,this.enabled=!0,this.visFlags=bd.Enum.NONE,this._inited=!0)},t.destroy=function(){for(var e=this._subModels,t=0;t<e.length;t++)this._subModels[t].destroy();this._localBuffer&&(this._localBuffer.destroy(),this._localBuffer=null),this._worldBoundBuffer&&(this._worldBoundBuffer.destroy(),this._worldBoundBuffer=null),this._worldBounds=null,this._modelBounds=null,this._subModels.length=0,this._inited=!1,this._localDataUpdated=!0,this._transform=null,this._node=null,this.isDynamicBatching=!1},t.attachToScene=function(e){this.scene=e,this._localDataUpdated=!0},t.detachFromScene=function(){this.scene=null},t.updateTransform=function(){var e=this.transform;if(e.hasChangedFlags||e._dirtyFlags){e.updateWorldTransform(),this._localDataUpdated=!0;var t=this._worldBounds;this._modelBounds&&t&&this._modelBounds.transform(e._mat,e._pos,e._rot,e._scale,t)}},t.updateWorldBound=function(){var e=this.transform;if(null!==e){e.updateWorldTransform(),this._localDataUpdated=!0;var t=this._worldBounds;this._modelBounds&&t&&this._modelBounds.transform(e._mat,e._pos,e._rot,e._scale,t)}},t.updateUBOs=function(e){for(var t=this._subModels,i=0;i<t.length;i++)t[i].update();if(this._updateStamp=e,this._localDataUpdated){this._localDataUpdated=!1;var n=this.transform._mat,r=this._instMatWorldIdx;if(r>=0){var s=this.instancedAttributes.views;!function(e,t,i,n){t[0]=e.m00,t[1]=e.m01,t[2]=e.m02,t[3]=e.m12,i[0]=e.m04,i[1]=e.m05,i[2]=e.m06,i[3]=e.m13,n[0]=e.m08,n[1]=e.m09,n[2]=e.m10,n[3]=e.m14}(n,s[r],s[r+1],s[r+2])}else this._localBuffer&&(Qi.toArray(this._localData,n,np.MAT_WORLD_OFFSET),Qi.inverseTranspose(fx,n),Qi.toArray(this._localData,fx,np.MAT_WORLD_IT_OFFSET),this._localBuffer.update(this._localData))}},t.createBoundingShape=function(e,t){e&&t&&(this._modelBounds=Iu.fromPoints(Iu.create(),e,t),this._worldBounds=Iu.clone(this._modelBounds))},t._createSubModel=function(){return new _x},t.initSubModel=function(e,t,i){this.initialize(),null==this._subModels[e]?this._subModels[e]=this._createSubModel():this._subModels[e].destroy(),this._subModels[e].initialize(t,i.passes,this.getMacroPatches(e)),this._subModels[e].initPlanarShadowShader(),this._subModels[e].initPlanarShadowInstanceShader(),this._updateAttributesAndBinding(e)},t.setSubModelMesh=function(e,t){this._subModels[e]&&(this._subModels[e].subMesh=t)},t.setSubModelMaterial=function(e,t){this._subModels[e]&&(this._subModels[e].passes=t.passes,this._updateAttributesAndBinding(e))},t.onGlobalPipelineStateChanged=function(){for(var e=this._subModels,t=0;t<e.length;t++)e[t].onPipelineStateChanged()},t.onMacroPatchesStateChanged=function(){for(var e=this._subModels,t=0;t<e.length;t++)e[t].onMacroPatchesStateChanged(this.getMacroPatches(t))},t.onGeometryChanged=function(){for(var e=this._subModels,t=0;t<e.length;t++)e[t].onGeometryChanged()},t.initLightingmap=function(e,t){this._lightmap=e,this._lightmapUVParam=t},t.updateLightingmap=function(e,t){sn.toArray(this._localData,t,np.LIGHTINGMAP_UVPARAM),this._localDataUpdated=!0,this._lightmap=e,this._lightmapUVParam=t,this.onMacroPatchesStateChanged(),null===e&&(e=Kv.get("empty-texture"));var i=e.getGFXTexture();if(i)for(var n=this._device.getSampler(e.mipmaps.length>1?gx:mx),r=this._subModels,s=0;s<r.length;s++){var a=r[s].descriptorSet;a.bindTexture(Mp,i),a.bindSampler(Mp,n),a.update()}},t.updateLocalShadowBias=function(){var e=this._localData;e[np.LOCAL_SHADOW_BIAS+0]=this._shadowBias,e[np.LOCAL_SHADOW_BIAS+1]=this._shadowNormalBias,e[np.LOCAL_SHADOW_BIAS+2]=0,e[np.LOCAL_SHADOW_BIAS+3]=0,this._localDataUpdated=!0},t.getMacroPatches=function(){var e=this.receiveShadow?dx:null;return null!=this._lightmap&&(e=e?e.concat(px):px),e},t._updateAttributesAndBinding=function(e){var t=this._subModels[e];if(t){this._initLocalDescriptors(e),this._updateLocalDescriptors(e,t.descriptorSet),this._initWorldBoundDescriptors(e),t.worldBoundDescriptorSet&&this._updateWorldBoundDescriptors(e,t.worldBoundDescriptorSet);var i=t.passes[0].getShaderVariant(t.patches);this._updateInstancedAttributes(i.attributes,t.passes[0])}},t._getInstancedAttributeIndex=function(e){for(var t=this.instancedAttributes.attributes,i=0;i<t.length;i++)if(t[i].name===e)return i;return-1},t._setInstMatWorldIdx=function(e){this._instMatWorldIdx=e},t._updateInstancedAttributes=function(e,t){if(t.device.hasFeature(mn.INSTANCED_ARRAYS)){for(var i=0,n=0;n<e.length;n++){var r=e[n];r.isInstanced&&(i+=ls[r.format].size)}var s=this.instancedAttributes;s.buffer=new Uint8Array(i),s.views.length=s.attributes.length=0;for(var a=0,o=0;o<e.length;o++){var u=e[o];if(u.isInstanced){var h=new zr;h.format=u.format,h.name=u.name,h.isNormalized=u.isNormalized,h.location=u.location,s.attributes.push(h);var c=ls[u.format],l=new(Ts(c))(s.buffer.buffer,a,c.count);s.views.push(l),a+=c.size}}t.batchingScheme===Yv.INSTANCING&&t.getInstancedBuffer().destroy(),this._setInstMatWorldIdx(this._getInstancedAttributeIndex(sp)),this._localDataUpdated=!0}},t._initLocalDescriptors=function(){this._localBuffer||(this._localBuffer=this._device.createBuffer(new Sr(En.UNIFORM|En.TRANSFER_DST,Sn.DEVICE,np.SIZE,np.SIZE)))},t._initWorldBoundDescriptors=function(){this._worldBoundBuffer||(this._worldBoundBuffer=this._device.createBuffer(new Sr(En.UNIFORM|En.TRANSFER_DST,Sn.DEVICE,rp.SIZE,rp.SIZE)))},t._updateLocalDescriptors=function(e,t){this._localBuffer&&t.bindBuffer(np.BINDING,this._localBuffer)},t._updateWorldBoundDescriptors=function(e,t){this._worldBoundBuffer&&t.bindBuffer(rp.BINDING,this._worldBoundBuffer)},c(e,[{key:"subModels",get:function(){return this._subModels}},{key:"inited",get:function(){return this._inited}},{key:"worldBounds",get:function(){return this._worldBounds}},{key:"modelBounds",get:function(){return this._modelBounds}},{key:"localBuffer",get:function(){return this._localBuffer}},{key:"worldBoundBuffer",get:function(){return this._worldBoundBuffer}},{key:"updateStamp",get:function(){return this._updateStamp}},{key:"isInstancingEnabled",get:function(){return this._instMatWorldIdx>=0}},{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:"receiveShadow",get:function(){return this._receiveShadow},set:function(e){this._receiveShadow=e,this.onMacroPatchesStateChanged()}},{key:"castShadow",get:function(){return this._castShadow},set:function(e){this._castShadow=e}},{key:"node",get:function(){return this._node},set:function(e){this._node=e}},{key:"transform",get:function(){return this._transform},set:function(e){this._transform=e}},{key:"visFlags",get:function(){return this._visFlags},set:function(e){this._visFlags=e}},{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e}},{key:"priority",get:function(){return this._priority},set:function(e){this._priority=e}}]),e}()),e("cP",function(){function e(){this._enabled=!1,this._minPos=new Di(0,0,0),this._maxPos=new Di(0,0,0),this._depth=0}return e.prototype.initialize=function(e){this._enabled=e.enabled,this._minPos=e.minPos,this._maxPos=e.maxPos,this._depth=e.depth},c(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e}},{key:"minPos",get:function(){return this._minPos},set:function(e){this._minPos=e}},{key:"maxPos",get:function(){return this._maxPos},set:function(e){this._maxPos=e}},{key:"depth",get:function(){return this._depth},set:function(e){this._depth=e}}]),e}())),yx=new Di(0,0,-1),Ex=new Di,Tx=(e("cU",function(e){function t(){var t;return(t=e.call(this)||this)._dir=new Di(1,-1,-1),t._illuminanceHDR=ZA.SUN_ILLUM,t._illuminanceLDR=1,t._shadowEnabled=!1,t._shadowPcf=eS.HARD,t._shadowBias=1e-5,t._shadowNormalBias=0,t._shadowSaturation=1,t._shadowDistance=50,t._shadowInvisibleOcclusionRange=200,t._csmLevel=tS.LEVEL_4,t._csmNeedUpdate=!1,t._csmLayerLambda=.75,t._csmOptimizationMode=iS.DisableRotationFix,t._shadowFixedArea=!1,t._shadowNear=.1,t._shadowFar=10,t._shadowOrthoSize=5,t._type=yN.DIRECTIONAL,t}_(t,e);var i=t.prototype;return i.initialize=function(){e.prototype.initialize.call(this),this.illuminance=ZA.SUN_ILLUM,this.direction=new Di(1,-1,-1)},i.update=function(){this._node&&this._node.hasChangedFlags&&(this.direction=Di.transformQuat(Ex,yx,this._node.worldRotation))},c(t,[{key:"direction",get:function(){return this._dir},set:function(e){Di.normalize(this._dir,e)}},{key:"illuminance",get:function(){return R.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(e){R.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}},{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}},{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,rS.MAX_FAR)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(e){this._shadowInvisibleOcclusionRange=Math.min(e,rS.MAX_FAR)}},{key:"csmLevel",get:function(){return this._csmLevel},set:function(e){this._csmLevel=e}},{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}},{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,rS.MAX_FAR)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(e){this._shadowOrthoSize=e}}]),t}(DN)),e("cV",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=Iu.create(),t._pos=new Di,t._type=yN.SPHERE,t}_(t,e);var i=t.prototype;return i.initialize=function(){e.prototype.initialize.call(this),this.size=.15,this.range=1,this.luminanceHDR=1700/PN(.15),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var e=this._range;Iu.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,e,e,e),this._needUpdate=!1}},c(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 R.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(e){R.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}(DN)),new Di(0,0,-1)),Ax=new Hi,Sx=new Qi,bx=new Qi,wx=new Qi,Rx=new Qi,Ix=(e("cW",function(e){function t(){var t;return(t=e.call(this)||this)._dir=new Di(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=eS.HARD,t._shadowBias=1e-5,t._shadowNormalBias=0,t._aabb=Iu.create(),t._frustum=zu.create(),t._pos=new Di,t._type=yN.SPOT,t}_(t,e);var i=t.prototype;return i.initialize=function(){e.prototype.initialize.call(this),this.size=.15,this.luminanceHDR=1700/PN(.15),this.luminanceLDR=1,this.range=Math.cos(Math.PI/6),this._dir.set(new Di(1,-1,-1))},i.update=function(){this._node&&(this._node.hasChangedFlags||this._needUpdate)&&(this._node.getWorldPosition(this._pos),Di.transformQuat(this._dir,Tx,this._node.getWorldRotation(Ax)),Di.normalize(this._dir,this._dir),Iu.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,this._range,this._range,this._range),this._node.getWorldRT(Sx),Qi.invert(Sx,Sx),Qi.perspective(bx,this._angle,1,.001,this._range),Qi.multiply(wx,bx,Sx),this._frustum.update(wx,Rx),this._needUpdate=!1)},c(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 R.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(e){R.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}(DN)),new ra((function(){return{subModel:null,passIdx:-1,dynamicOffsets:[],lights:[]}}),16)),Ox=new Float32Array(4),Nx=[],Cx=[],Mx=new Qi,xx=new Qi;function Fx(e,t){return!(!t.worldBounds||pu.aabbWithAABB(t.worldBounds,e.aabb))}function Px(e,t){return!(!t.worldBounds||pu.aabbWithAABB(t.worldBounds,e.aabb)&&pu.aabbFrustum(t.worldBounds,e.frustum))}var Dx=Qv("forward-add"),Lx=[];function Bx(e,t){t.length=0;for(var i=!1,n=0;n<e.length;n++){for(var r=e[n].passes,s=-1,a=0;a<r.length;a++)if(r[a].phase===Dx){s=a,i=!0;break}t.push(s)}return i}var Ux,Gx,zx,kx,Hx,Vx,Wx,jx,Xx,Yx,qx,Kx=function(){function e(e){this._pipeline=void 0,this._device=void 0,this._lightPasses=[],this._instancedLightPassPool=Ix.alloc(),this._batchedLightPassPool=Ix.alloc(),this._shadowUBO=new Float32Array(Vd.COUNT),this._lightBufferCount=16,this._lightBufferStride=void 0,this._lightBufferElementCount=void 0,this._lightBuffer=void 0,this._firstLightBufferView=void 0,this._lightBufferData=void 0,this._instancedQueue=void 0,this._batchedQueue=void 0,this._lightMeterScale=1e4,this._pipeline=e,this._device=e.device,this._instancedQueue=new cx,this._batchedQueue=new hx;var t=this._device.capabilities.uboOffsetAlignment;this._lightBufferStride=Math.ceil(op.SIZE/t)*t,this._lightBufferElementCount=this._lightBufferStride/Float32Array.BYTES_PER_ELEMENT,this._lightBuffer=this._device.createBuffer(new Sr(En.UNIFORM|En.TRANSFER_DST,Sn.HOST|Sn.DEVICE,this._lightBufferStride*this._lightBufferCount,this._lightBufferStride)),this._firstLightBufferView=this._device.createBuffer(new br(this._lightBuffer,0,op.SIZE)),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount)}var t=e.prototype;return t.clear=function(){this._instancedQueue.clear(),this._batchedQueue.clear();for(var e=0;e<this._lightPasses.length;e++){var t=this._lightPasses[e];t.dynamicOffsets.length=0,t.lights.length=0}Ix.freeArray(this._lightPasses),this._lightPasses.length=0,this._instancedLightPassPool.dynamicOffsets.length=0,this._instancedLightPassPool.lights.length=0,this._batchedLightPassPool.dynamicOffsets.length=0,this._batchedLightPassPool.lights.length=0},t.destroy=function(){for(var e=this._pipeline.globalDSManager.descriptorSetMap,t=e.keys,i=0;i<t.length;i++){var n=t[i],r=e.get(n);r&&(r.getBuffer(Vd.BINDING).destroy(),r.getTexture(jd).destroy(),r.getTexture(ep).destroy(),r.destroy()),e.delete(n)}},t.gatherLightPasses=function(e,t){this.clear();var i=this._pipeline.pipelineSceneData.validPunctualLights;if(i.length){this._updateUBOs(e,t),this._updateLightDescriptorSet(e,t);for(var n=this._pipeline.pipelineSceneData.renderObjects,r=0;r<n.length;r++){var s=n[r].model,a=s.subModels;if(Bx(a,Lx)&&(Cx.length=0,this._lightCulling(s,i),Cx.length))for(var o=0;o<a.length;o++){var u=Lx[o];if(!(u<0)){var h=a[o],c=h.passes[u];h.passes[0].blendState.targets[0].blend||(h.descriptorSet.bindBuffer(op.BINDING,this._firstLightBufferView),h.descriptorSet.update(),this._addRenderQueue(c,h,s,u))}}}for(var l=0;l<i.length;l++){var _=i[l];this._instancedLightPassPool.lights.push(_),this._instancedLightPassPool.dynamicOffsets.push(this._lightBufferStride*l),this._batchedLightPassPool.lights.push(_),this._batchedLightPassPool.dynamicOffsets.push(this._lightBufferStride*l)}this._instancedQueue.uploadBuffers(t),this._batchedQueue.uploadBuffers(t)}},t.recordCommandBuffer=function(e,t,i){for(var n=this._pipeline.globalDSManager,r=0;r<this._instancedLightPassPool.lights.length;++r){var s=this._instancedLightPassPool.lights[r];Nx[0]=this._instancedLightPassPool.dynamicOffsets[r];var a=n.getOrCreateDescriptorSet(s);this._instancedQueue.recordCommandBuffer(e,t,i,a,Nx)}for(var o=0;o<this._batchedLightPassPool.lights.length;++o){var u=this._batchedLightPassPool.lights[o];Nx[0]=this._batchedLightPassPool.dynamicOffsets[o];var h=n.getOrCreateDescriptorSet(u);this._batchedQueue.recordCommandBuffer(e,t,i,h,Nx)}for(var c=0;c<this._lightPasses.length;c++){var l=this._lightPasses[c],_=l.subModel,f=l.passIdx,d=l.dynamicOffsets,p=l.lights,m=_.passes[f],g=_.shaders[f],v=_.inputAssembler,y=ny.getOrCreatePipelineState(e,m,g,t,v),E=m.descriptorSet,T=_.descriptorSet;i.bindPipelineState(y),i.bindDescriptorSet(Ld.MATERIAL,E),i.bindInputAssembler(v);for(var A=0;A<d.length;++A){var S=p[A],b=n.getOrCreateDescriptorSet(S);Nx[0]=d[A],i.bindDescriptorSet(Ld.GLOBAL,b),i.bindDescriptorSet(Ld.LOCAL,T,Nx),i.draw(v)}}},t._lightCulling=function(e,t){for(var i=!1,n=!function(e){for(var t=e.subModels,i=0;i<t.length;++i)for(var n=t[i].passes,r=0;r<n.length;++r){var s=n[r].batchingScheme;if(s===Yv.INSTANCING)return!0;if(s===Yv.VB_MERGING)return!0}return!1}(e),r=0;r<t.length;r++){var s=t[r];switch(s.type){case yN.SPHERE:n&&(i=Fx(s,e));break;case yN.SPOT:n&&(i=Px(s,e))}i||Cx.push(r)}},t._addRenderQueue=function(e,t,i,n){var r=this._pipeline.pipelineSceneData.validPunctualLights,s=e.batchingScheme;if(s===Yv.INSTANCING){var a=e.getInstancedBuffer();a.merge(t,i.instancedAttributes,n),a.dynamicOffsets[0]=this._lightBufferStride,this._instancedQueue.queue.add(a)}else if(s===Yv.VB_MERGING){var o=e.getBatchedBuffer();o.merge(t,n,i),o.dynamicOffsets[0]=this._lightBufferStride,this._batchedQueue.queue.add(o)}else{var u=Ix.alloc();u.subModel=t,u.passIdx=n;for(var h=0;h<Cx.length;h++){var c=Cx[h],l=r[c];u.lights.push(l),u.dynamicOffsets.push(this._lightBufferStride*c)}this._lightPasses.push(u)}},t._updateLightDescriptorSet=function(e,t){for(var i=this._pipeline.device,n=this._pipeline.pipelineSceneData,r=n.shadows,s=n.shadowFrameBufferMap,a=e.scene.mainLight,o=qp(i)?0:1,u=this._pipeline.globalDSManager,h=n.validPunctualLights,c=this._pipeline.device.capabilities,l=0;l<h.length;l++){var _=h[l],f=u.getOrCreateDescriptorSet(_);if(f){var d=void 0,p=void 0;switch(_.type){case yN.SPHERE:a&&VN.updatePlanarNormalAndDistance(r,this._shadowUBO),this._shadowUBO[Vd.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+0]=r.size.x,this._shadowUBO[Vd.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+1]=r.size.y,this._shadowUBO[Vd.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+2]=1,this._shadowUBO[Vd.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+3]=0,this._shadowUBO[Vd.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+0]=2,this._shadowUBO[Vd.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+1]=o,this._shadowUBO[Vd.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+2]=0,this._shadowUBO[Vd.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+3]=0,Fi.toArray(this._shadowUBO,r.shadowColor,Vd.SHADOW_COLOR_OFFSET);break;case yN.SPOT:var m=_;if(a&&VN.updatePlanarNormalAndDistance(r,this._shadowUBO),Qi.invert(Mx,_.node.getWorldMatrix()),Qi.perspective(xx,_.angle,1,.001,_.range,!0,c.clipSpaceMinZ,c.clipSpaceSignY,0),d=xx.clone(),p=xx.clone().invert(),Qi.multiply(xx,xx,Mx),Qi.toArray(this._shadowUBO,Mx,Vd.MAT_LIGHT_VIEW_OFFSET),Qi.toArray(this._shadowUBO,xx,Vd.MAT_LIGHT_VIEW_PROJ_OFFSET),this._shadowUBO[Vd.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+0]=.01,this._shadowUBO[Vd.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+1]=_.range,this._shadowUBO[Vd.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+2]=0,this._shadowUBO[Vd.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+3]=0,this._shadowUBO[Vd.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+0]=r.size.x,this._shadowUBO[Vd.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+1]=r.size.y,this._shadowUBO[Vd.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+2]=m.shadowPcf,this._shadowUBO[Vd.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+3]=m.shadowBias,this._shadowUBO[Vd.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+0]=1,this._shadowUBO[Vd.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+1]=o,this._shadowUBO[Vd.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+2]=m.shadowNormalBias,this._shadowUBO[Vd.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+3]=0,this._shadowUBO[Vd.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=d.m10,this._shadowUBO[Vd.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=d.m14,this._shadowUBO[Vd.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=d.m11,this._shadowUBO[Vd.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=d.m15,this._shadowUBO[Vd.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+0]=p.m10,this._shadowUBO[Vd.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+1]=p.m14,this._shadowUBO[Vd.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+2]=p.m11,this._shadowUBO[Vd.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+3]=p.m15,this._shadowUBO[Vd.SHADOW_PROJ_INFO_OFFSET+0]=d.m00,this._shadowUBO[Vd.SHADOW_PROJ_INFO_OFFSET+1]=d.m05,this._shadowUBO[Vd.SHADOW_PROJ_INFO_OFFSET+2]=1/d.m00,this._shadowUBO[Vd.SHADOW_PROJ_INFO_OFFSET+3]=1/d.m05,Fi.toArray(this._shadowUBO,r.shadowColor,Vd.SHADOW_COLOR_OFFSET),s.has(_)){var g,v=null===(g=s.get(_))||void 0===g?void 0:g.colorTextures[0];v&&f.bindTexture(ep,v)}}f.update(),t.updateBuffer(f.getBuffer(Vd.BINDING),this._shadowUBO)}}},t._updateUBOs=function(e,t){var i=e.exposure,n=this._pipeline.pipelineSceneData,r=n.isHDR,s=n.shadows,a=n.validPunctualLights;a.length>this._lightBufferCount&&(this._firstLightBufferView.destroy(),this._lightBufferCount=Oi(a.length),this._lightBuffer.resize(this._lightBufferStride*this._lightBufferCount),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount),this._firstLightBufferView.initialize(new br(this._lightBuffer,0,op.SIZE)));for(var o=0,u=0;o<a.length;o++,u+=this._lightBufferElementCount){var h=a[o];switch(h.type){case yN.SPHERE:if(Di.toArray(Ox,h.position),Ox[3]=0,this._lightBufferData.set(Ox,u+op.LIGHT_POS_OFFSET),Ox[0]=h.size,Ox[1]=h.range,Ox[2]=0,Ox[3]=0,this._lightBufferData.set(Ox,u+op.LIGHT_SIZE_RANGE_ANGLE_OFFSET),Di.toArray(Ox,h.color),h.useColorTemperature){var c=h.colorTemperatureRGB;Ox[0]*=c.x,Ox[1]*=c.y,Ox[2]*=c.z}Ox[3]=r?h.luminance*i*this._lightMeterScale:h.luminance,this._lightBufferData.set(Ox,u+op.LIGHT_COLOR_OFFSET);break;case yN.SPOT:if(Di.toArray(Ox,h.position),Ox[3]=1,this._lightBufferData.set(Ox,u+op.LIGHT_POS_OFFSET),Ox[0]=h.size,Ox[1]=h.range,Ox[2]=h.spotAngle,Ox[3]=s.enabled&&h.shadowEnabled&&s.type===$A.ShadowMap?1:0,this._lightBufferData.set(Ox,u+op.LIGHT_SIZE_RANGE_ANGLE_OFFSET),Di.toArray(Ox,h.direction),this._lightBufferData.set(Ox,u+op.LIGHT_DIR_OFFSET),Di.toArray(Ox,h.color),h.useColorTemperature){var l=h.colorTemperatureRGB;Ox[0]*=l.x,Ox[1]*=l.y,Ox[2]*=l.z}Ox[3]=r?h.luminance*i*this._lightMeterScale:h.luminance,this._lightBufferData.set(Ox,u+op.LIGHT_COLOR_OFFSET)}}t.updateBuffer(this._lightBuffer,this._lightBufferData)},e}(),Qx=new Iu,Zx=function(){function e(e){this._pendingModels=[],this._castModels=[],this._instancedQueue=new cx,this._pipeline=void 0,this._pipeline=e}var t=e.prototype;return t.gatherShadowPasses=function(e,t){var i=this._pipeline.pipelineSceneData.shadows;if(this._instancedQueue.clear(),this._pendingModels.length=0,this._castModels.length=0,i.enabled&&i.type===$A.Planar&&!(i.normal.length()<1e-6)){var n=e.scene,r=e.frustum,s=0!=(e.visibility&bd.BitMask.DEFAULT);if(n.mainLight&&s){for(var a=n.models,o=0;o<a.length;o++){var u=a[o];u.enabled&&u.node&&u.castShadow&&this._castModels.push(u)}var h=i.instancingMaterial.passes[0].getInstancedBuffer();this._instancedQueue.queue.add(h);for(var c=0;c<this._castModels.length;c++){var l=this._castModels[c];if(!l.worldBounds||(Iu.transform(Qx,l.worldBounds,i.matLight),pu.aabbFrustum(Qx,r)))if(l.isInstancingEnabled)for(var _=l.subModels,f=0;f<_.length;f++){var d=_[f];h.merge(d,l.instancedAttributes,0,d.planarInstanceShader)}else this._pendingModels.push(l)}this._instancedQueue.uploadBuffers(t)}}},t.recordCommandBuffer=function(e,t,i){var n=this._pipeline.pipelineSceneData.shadows;if(n.enabled&&n.type===$A.Planar&&(this._instancedQueue.recordCommandBuffer(e,t,i),this._pendingModels.length)){var r=n.material.passes[0],s=r.descriptorSet;i.bindDescriptorSet(Ld.MATERIAL,s);for(var a=this._pendingModels.length,o=0;o<a;o++)for(var u=this._pendingModels[o],h=0;h<u.subModels.length;h++){var c=u.subModels[h],l=c.planarShader,_=c.inputAssembler,f=ny.getOrCreatePipelineState(e,r,l,t,_);i.bindPipelineState(f),i.bindDescriptorSet(Ld.LOCAL,c.descriptorSet),i.bindInputAssembler(_),i.draw(_)}}},e}(),Jx=function(){function e(){this._phaseID=Qv("default")}var t=e.prototype;return t.activate=function(e){this._pipeline=e},t.render=function(e,t){for(var i=this._pipeline,n=i.device,r=i.commandBuffers[0],s=e.scene.batches,a=0;a<s.length;a++){var o=s[a],u=!1;if(e.visibility&o.visFlags&&(u=!0),u)for(var h=o.shaders.length,c=0;c<h;c++){var l=o.passes[c];if(l.phase===this._phaseID){var _=o.shaders[c],f=o.inputAssembler,d=ny.getOrCreatePipelineState(n,l,_,t,f);r.bindPipelineState(d),r.bindDescriptorSet(Ld.MATERIAL,l.descriptorSet);var p=o.descriptorSet;r.bindDescriptorSet(Ld.LOCAL,p),r.bindInputAssembler(f),r.draw(f)}}}},e}(),$x=[new yr(0,0,0,1)],eF=e("hk",(Ux=th("ForwardStage"),Gx=Dh([tx]),zx=Nh(),Ux((jx=Wx=function(e){function t(){var t;return T(t=e.call(this)||this,"renderQueues",Vx,v(t)),t._renderQueues=[],t._renderArea=new lr,t._batchedQueue=void 0,t._instancedQueue=void 0,t._phaseID=Qv("default"),t._clearFlag=4294967295,t._batchedQueue=new hx,t._instancedQueue=new cx,t._uiPhase=new Jx,t}_(t,e);var i=t.prototype;return 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<this.renderQueues.length;n++)this._renderQueues[n]=sx(this.renderQueues[n]);this._additiveLightQueue=new Kx(this._pipeline),this._planarQueue=new Zx(this._pipeline),this._uiPhase.activate(t)},i.destroy=function(){},i.render=function(e){var t;this._instancedQueue.clear(),this._batchedQueue.clear();var i=this._pipeline,n=i.device;this._renderQueues.forEach(ax);for(var r=i.pipelineSceneData.renderObjects,s=0,a=0,o=0,u=0;u<r.length;++u){var h=r[u],c=h.model.subModels;for(s=0;s<c.length;++s){var l=c[s],_=l.passes;for(a=0;a<_.length;++a){var f=_[a];if(f.phase===this._phaseID){var d=f.batchingScheme;if(d===Yv.INSTANCING){var p=f.getInstancedBuffer();p.merge(l,h.model.instancedAttributes,a),this._instancedQueue.queue.add(p)}else if(d===Yv.VB_MERGING){var m=f.getBatchedBuffer();m.merge(l,a,h.model),this._batchedQueue.queue.add(m)}else for(o=0;o<this._renderQueues.length;o++)this._renderQueues[o].insertRenderPass(h,s,a)}}}}this._instancedQueue.sort(),this._renderQueues.forEach(ox);var g=i.commandBuffers[0];i.pipelineUBO.updateShadowUBO(e),this._instancedQueue.uploadBuffers(g),this._batchedQueue.uploadBuffers(g),this._additiveLightQueue.gatherLightPasses(e,g),this._planarQueue.gatherShadowPasses(e,g),e.clearFlag&$n.COLOR&&($x[0].x=e.clearColor.x,$x[0].y=e.clearColor.y,$x[0].z=e.clearColor.z,$x[0].w=e.clearColor.w),i.generateRenderArea(e,this._renderArea);var v=e.window.framebuffer,y=i.getRenderPass(e.clearFlag&this._clearFlag,v);g.beginRenderPass(y,v,this._renderArea,$x,e.clearDepth,e.clearStencil),g.bindDescriptorSet(Ld.GLOBAL,i.descriptorSet),this._renderQueues[0].recordCommandBuffer(n,y,g),this._instancedQueue.recordCommandBuffer(n,y,g),this._batchedQueue.recordCommandBuffer(n,y,g),this._additiveLightQueue.recordCommandBuffer(n,y,g),g.bindDescriptorSet(Ld.GLOBAL,i.descriptorSet),this._planarQueue.recordCommandBuffer(n,y,g),this._renderQueues[1].recordCommandBuffer(n,y,g),null===(t=e.geometryRenderer)||void 0===t||t.render(y,g,i.pipelineSceneData),this._uiPhase.render(e,y),vy(n,y,g,i.profiler,e),g.endRenderPass()},t}(nC),Wx.initInfo={name:"ForwardStage",priority:mC.FORWARD,tag:0,renderQueues:[{isTransparent:!1,sortMode:ZM.FRONT_TO_BACK,stages:["default"]},{isTransparent:!0,sortMode:ZM.BACK_TO_FRONT,stages:["default","planarShadow"]}]},Vx=A((Hx=jx).prototype,"renderQueues",[Gx,hh,zx],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),kx=Hx))||kx)),tF=e("hj",th("ForwardFlow")((qx=Yx=function(e){function t(){return e.apply(this,arguments)||this}_(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 eF;i.initialize(eF.initInfo),this._stages.push(i)}return!0},i.activate=function(t){e.prototype.activate.call(this,t)},i.render=function(t){e.prototype.render.call(this,t)},i.destroy=function(){e.prototype.destroy.call(this)},t}(sC),Yx.initInfo={name:Od,priority:gC.FORWARD,stages:[]},Xx=qx))||Xx),iF=Qv("shadow-caster");function nF(e){for(var t=e.passes,i=0;i<t.length;i++)if(t[i].phase===iF)return i;return-1}var rF,sF,aF,oF,uF,hF,cF,lF=function(){function e(e){this._pipeline=void 0,this._subModelsArray=[],this._passArray=[],this._shaderArray=[],this._instancedQueue=void 0,this._batchedQueue=void 0,this._pipeline=e,this._instancedQueue=new cx,this._batchedQueue=new hx}var t=e.prototype;return t.gatherLightPasses=function(e,t,i,n){void 0===n&&(n=0),this.clear();var r=this._pipeline.pipelineSceneData,s=r.shadows;if(t&&s.enabled&&s.type===$A.ShadowMap){switch(t.type){case yN.DIRECTIONAL:var a=t;if(a.shadowEnabled){var o,u=r.csmLayers;!function(e,t,i){var n=e.scene.mainLight,r=t.csmLayers.layerObjects,s=i.validFrustum,a=i.shadowObjects;a.length=0;for(var o=e.visibility,u=r.length-1;u>=0;u--){var h=r.array[u];if(h){var c=h.model;c.enabled&&c.node&&(o&c.node.layer)===c.node.layer&&null!=a&&c.castShadow&&c.worldBounds&&pu.aabbFrustum(c.worldBounds,s)&&(a.push(h),i.level<n.csmLevel&&n.csmOptimizationMode===iS.RemoveDuplicates&&pu.aabbFrustumCompletelyInside(c.worldBounds,s)&&r.fastRemove(u))}}}(e,r,o=a.shadowFixedArea?u.specialLayer:u.layers[n]);for(var h=o.shadowObjects,c=0;c<h.length;c++){var l=h[c].model;this.add(l)}}break;case yN.SPOT:var _=t;if(_.shadowEnabled)for(var f=r.csmLayers.castShadowObjects,d=0;d<f.length;d++){var p=f[d].model;p.worldBounds&&!pu.aabbFrustum(p.worldBounds,_.frustum)||this.add(p)}}this._instancedQueue.uploadBuffers(i),this._batchedQueue.uploadBuffers(i)}},t.clear=function(){this._subModelsArray.length=0,this._shaderArray.length=0,this._passArray.length=0,this._instancedQueue.clear(),this._batchedQueue.clear()},t.add=function(e){for(var t=e.subModels,i=0;i<t.length;i++){var n=t[i],r=nF(n);if(!(r<0)){var s=n.passes[r];if(s.batchingScheme===Yv.INSTANCING){var a=s.getInstancedBuffer();a.merge(n,e.instancedAttributes,r),this._instancedQueue.queue.add(a)}else if(s.batchingScheme===Yv.VB_MERGING){var o=s.getBatchedBuffer();o.merge(n,r,e),this._batchedQueue.queue.add(o)}else{var u=n.shaders[r];this._subModelsArray.push(n),u&&this._shaderArray.push(u),this._passArray.push(s)}}}},t.recordCommandBuffer=function(e,t,i){this._instancedQueue.recordCommandBuffer(e,t,i),this._batchedQueue.recordCommandBuffer(e,t,i);for(var n=0;n<this._subModelsArray.length;++n){var r=this._subModelsArray[n],s=this._shaderArray[n],a=this._passArray[n],o=r.inputAssembler,u=ny.getOrCreatePipelineState(e,a,s,t,o),h=a.descriptorSet;i.bindPipelineState(u),i.bindDescriptorSet(Ld.MATERIAL,h),i.bindDescriptorSet(Ld.LOCAL,r.descriptorSet),i.bindInputAssembler(o),i.draw(o)}},e}(),_F=[new yr(1,1,1,1)],fF=e("hs",th("ShadowStage")((aF=sF=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._shadowFrameBuffer=null,t._renderArea=new lr,t._light=null,t._globalDS=null,t._level=0,t}_(t,e);var i=t.prototype;return i.setUsage=function(e,t,i,n){void 0===n&&(n=0),this._globalDS=e,this._light=t,this._shadowFrameBuffer=i,this._level=n},i.destroy=function(){var e;this._shadowFrameBuffer=null,this._globalDS=null,this._light=null,null===(e=this._additiveShadowQueue)||void 0===e||e.clear()},i.clearFramebuffer=function(e){if(this._light&&this._shadowFrameBuffer){_F[0].w=e.clearColor.w;var t=this._pipeline,i=t.pipelineSceneData,n=i.shadingScale,r=i.shadows,s=e.viewport,a=r.size;this._renderArea.x=s.x*a.x,this._renderArea.y=s.y*a.y,this._renderArea.width=s.width*a.x*n,this._renderArea.height=s.height*a.y*n;var o=t.commandBuffers[0],u=this._shadowFrameBuffer.renderPass;o.beginRenderPass(u,this._shadowFrameBuffer,this._renderArea,_F,e.clearDepth,e.clearStencil),o.endRenderPass()}},i.render=function(e){var t=this._pipeline,i=t.pipelineSceneData,n=i.shadows,r=this._globalDS,s=t.commandBuffers[0],a=this._level;if(this._light&&this._shadowFrameBuffer){this._pipeline.pipelineUBO.updateShadowUBOLight(r,this._light,a),this._additiveShadowQueue.gatherLightPasses(e,this._light,s,a);var o=n.size;switch(this._light.type){case yN.DIRECTIONAL:var u=this._light;u.shadowFixedArea||u.csmLevel===tS.LEVEL_1||!i.csmSupported?(this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=o.x,this._renderArea.height=o.y):(this._renderArea.x=a%2*.5*o.x,this._renderArea.y=.5*(1-Math.floor(a/2))*o.y,this._renderArea.width=.5*o.x,this._renderArea.height=.5*o.y);break;case yN.SPOT:this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=o.x,this._renderArea.height=o.y}var h=t.device,c=this._shadowFrameBuffer.renderPass;s.beginRenderPass(c,this._shadowFrameBuffer,this._renderArea,_F,e.clearDepth,e.clearStencil),s.bindDescriptorSet(Ld.GLOBAL,r),this._additiveShadowQueue.recordCommandBuffer(h,c,s),s.endRenderPass()}},i.activate=function(t,i){e.prototype.activate.call(this,t,i),this._additiveShadowQueue=new lF(t)},t}(nC),sF.initInfo={name:"ShadowStage",priority:mC.FORWARD,tag:0},rF=aF))||rF),dF=[],pF=e("hr",th("ShadowFlow")((hF=uF=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._shadowRenderPass=null,t}_(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 fF;i.initialize(fF.initInfo),this._stages.push(i)}return!0},i.activate=function(t){e.prototype.activate.call(this,t);var i=qp(t.device)?0:1;t.macros.CC_SHADOWMAP_FORMAT=i;var n=t.device.gfxAPI===dn.WEBGL?1:0;t.macros.CC_SHADOWMAP_USE_LINEAR_DEPTH=n,t.pipelineSceneData.csmSupported=t.device.capabilities.maxFragmentUniformVectors>=(kd.COUNT+Hd.COUNT+Vd.COUNT+Wd.COUNT)/4,t.macros.CC_SUPPORT_CASCADED_SHADOW_MAP=t.pipelineSceneData.csmSupported,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===$A.ShadowMap){for(var o=0,u=0;o<i.maxReceived&&u<a.length;){var h=a[u];h.type===yN.SPOT&&h.shadowEnabled&&(dF.push(h),o++),u++}if(0!==s.length){i.shadowMapDirty&&this.resizeShadowMap();var c=e.scene.mainLight;if(c&&c.shadowEnabled){var l=t.descriptorSet;r.has(c)||this._initShadowFrameBuffer(t,c,e.window.swapchain);var _=r.get(c);if(c.shadowFixedArea)this._renderStage(e,c,_,l);else for(var f=t.pipelineSceneData.csmSupported?c.csmLevel:1,d=0;d<f;d++)this._renderStage(e,c,_,l,d)}for(var p=0;p<dF.length;p++){var m=dF[p],g=t.globalDSManager.getOrCreateDescriptorSet(m);r.has(m)||this._initShadowFrameBuffer(t,m,e.window.swapchain);var v=r.get(m);this._renderStage(e,m,v,g)}dF.length=0}else this.clearShadowMap(dF,e)}},i.destroy=function(){if(e.prototype.destroy.call(this),this._pipeline){for(var t=this._pipeline.pipelineSceneData.shadowFrameBufferMap,i=Array.from(t.values()),n=0;n<i.length;n++){var r=i[n];if(r){for(var s=r.colorTextures,a=0;a<s.length;a++){var o=s[n];o&&o.destroy()}s.length=0;var u=r.depthStencilTexture;u&&u.destroy(),r.destroy()}}t.clear()}this._shadowRenderPass&&this._shadowRenderPass.destroy()},i._initShadowFrameBuffer=function(e,t){var i=e.device,n=e.pipelineSceneData.shadows.size,r=e.pipelineSceneData.shadowFrameBufferMap,s=qp(i)?gn.R32F:gn.RGBA8;if(!this._shadowRenderPass){var a=new Vr;a.format=s,a.loadOp=Un.CLEAR,a.storeOp=Gn.STORE,a.sampleCount=1;var o=new Wr;o.format=gn.DEPTH_STENCIL,o.depthLoadOp=Un.CLEAR,o.depthStoreOp=Gn.DISCARD,o.stencilLoadOp=Un.CLEAR,o.stencilStoreOp=Gn.DISCARD,o.sampleCount=1;var u=new Yr([a],o);this._shadowRenderPass=i.createRenderPass(u)}var h=[];h.push(i.createTexture(new Or(bn.TEX2D,wn.COLOR_ATTACHMENT|wn.SAMPLED,s,n.x,n.y)));var c=i.createTexture(new Or(bn.TEX2D,wn.DEPTH_STENCIL_ATTACHMENT,gn.DEPTH_STENCIL,n.x,n.y)),l=i.createFramebuffer(new Zr(this._shadowRenderPass,h,c));r.set(t,l)},i._renderStage=function(e,t,i,n,r){void 0===r&&(r=0);for(var s=0;s<this._stages.length;s++){var a=this._stages[s];a.setUsage(n,t,i,r),a.render(e)}},i.clearShadowMap=function(e,t){var i=this._pipeline,n=i.pipelineSceneData,r=t.scene.mainLight;if(r){var s=this._pipeline.descriptorSet;n.shadowFrameBufferMap.has(r)||this._initShadowFrameBuffer(this._pipeline,r,t.window.swapchain);for(var a=n.shadowFrameBufferMap.get(r),o=0;o<this._stages.length;o++){var u=this._stages[o];u.setUsage(s,r,a),u.clearFramebuffer(t)}}for(var h=0;h<e.length;h++){var c=e[h],l=i.globalDSManager.getOrCreateDescriptorSet(c);n.shadowFrameBufferMap.has(c)||this._initShadowFrameBuffer(this._pipeline,c,t.window.swapchain);for(var _=n.shadowFrameBufferMap.get(c),f=0;f<this._stages.length;f++){var d=this._stages[f];d.setUsage(l,c,_),d.clearFramebuffer(t)}}},i.resizeShadowMap=function(){for(var e=this._pipeline.pipelineSceneData.shadows,t=e.size,i=this._pipeline,n=i.device,r=i.pipelineSceneData.shadowFrameBufferMap,s=qp(n)?gn.R32F:gn.RGBA8,a=r.values(),o=a.next();!o.done;){var u=o.value;if(u){var h=[];h.push(i.device.createTexture(new Or(bn.TEX2D,wn.COLOR_ATTACHMENT|wn.SAMPLED,s,t.x,t.y)));var c=u.depthStencilTexture;c&&c.resize(t.x,t.y);var l=u.renderPass;u.destroy(),u.initialize(new Zr(l,h,c)),o=a.next()}else o=a.next()}e.shadowMapDirty=!1},t}(sC),uF.initInfo={name:Nd,priority:gC.SHADOW,tag:WM.SCENE,stages:[]},oF=hF))||oF);ne(qm.prototype,"TextureBase.prototype",[{name:"hasPremultipliedAlpha"},{name:"setPremultiplyAlpha"},{name:"setFlipY"}]),ie(DE.prototype,"RenderTexture.prototype",[{name:"getGFXWindow",customFunction:function(){return this._window}}]);var mF=((cF={})[vn.UNORM]="Uint",cF[vn.SNORM]="Int",cF[vn.UINT]="Uint",cF[vn.INT]="Int",cF[vn.UFLOAT]="Float",cF[vn.FLOAT]="Float",cF.default="Uint",cF);function gF(e){return""+(mF[e.type]||mF.default)+e.size/e.count*8}function vF(e,t,i,n,r,s,a){void 0===i&&(i=gn.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=ls[i];s||(s=o.size);for(var u="set"+gF(o),h="get"+gF(o),c=o.size/o.count,l=Math.floor(r/s),_=ka.isLittleEndian,f=0;f<l;++f)for(var d=n+s*f,p=0;p<o.count;++p){var m=d+c*p,g=e[h](m,_);a[u](m,t(g,p,e),_)}return a}e("dP",function(){function e(e,t,i,n,r,s){void 0===n&&(n=null),void 0===r&&(r=null),void 0===s&&(s=!0),this.mesh=void 0,this.subMeshIdx=void 0,this._flatBuffers=[],this._jointMappedBuffers=void 0,this._jointMappedBufferIndices=void 0,this._vertexIdChannel=void 0,this._geometricInfo=void 0,this._vertexBuffers=void 0,this._attributes=void 0,this._indexBuffer=null,this._indirectBuffer=null,this._primitiveMode=void 0,this._iaInfo=void 0,this._isOwnerOfIndexBuffer=!0,this._drawInfo=null,this._attributes=t,this._vertexBuffers=e,this._indexBuffer=n,this._indirectBuffer=r,this._primitiveMode=i,this._iaInfo=new Hr(t,e,n,r),this._isOwnerOfIndexBuffer=s}var t=e.prototype;return t.invalidateGeometricInfo=function(){this._geometricInfo=void 0},t.genFlatBuffers=function(){if(!this._flatBuffers.length&&this.mesh&&void 0!==this.subMeshIdx){var e=this.mesh,t=0,i=e.struct.primitives[this.subMeshIdx];i.indexView&&(t=i.indexView.count);for(var n=0;n<i.vertexBundelIndices.length;n++){var r=i.vertexBundelIndices[n],s=e.struct.vertexBundles[r],a=i.indexView?i.indexView.count:s.view.count,o=s.view.stride,u=o*a,h=new Uint8Array(e.data.buffer,s.view.offset,s.view.length),c=new Uint8Array(i.indexView?u:s.view.length);if(i.indexView){for(var l=e.readIndices(this.subMeshIdx),_=0;_<t;++_)for(var f=_*o,d=l[_]*o,p=0;p<o;++p)c[f+p]=h[d+p];this._flatBuffers.push({stride:o,count:a,buffer:c})}else c.set(e.data.subarray(s.view.offset,s.view.offset+s.view.length)),this._flatBuffers.push({stride:o,count:a,buffer:c})}}},t.destroy=function(){for(var e=0;e<this.vertexBuffers.length;e++)this.vertexBuffers[e].destroy();if(this.vertexBuffers.length=0,this._indexBuffer&&(this._isOwnerOfIndexBuffer&&this._indexBuffer.destroy(),this._indexBuffer=null),this._jointMappedBuffers&&this._jointMappedBufferIndices){for(var t=0;t<this._jointMappedBufferIndices.length;t++)this._jointMappedBuffers[this._jointMappedBufferIndices[t]].destroy();this._jointMappedBuffers=void 0,this._jointMappedBufferIndices=void 0}this._indirectBuffer&&(this._indirectBuffer.destroy(),this._indirectBuffer=null)},t.enableVertexIdChannel=function(e){if(!this._vertexIdChannel){var t=this.vertexBuffers.length,i=this.attributes.length,n=this._allocVertexIdBuffer(e);this._vertexBuffers.push(n),this._attributes.push(new zr("a_vertexId",gn.R32F,!1,t)),this._iaInfo.attributes=this._attributes,this._iaInfo.vertexBuffers=this._vertexBuffers,this._vertexIdChannel={stream:t,index:i}}},t._allocVertexIdBuffer=function(e){for(var t=0===this.vertexBuffers.length||0===this.vertexBuffers[0].stride?0:this.vertexBuffers[0].size/this.vertexBuffers[0].stride,i=new Float32Array(t),n=0;n<t;++n)i[n]=n+.5;var r=e.createBuffer(new Sr(En.VERTEX|En.TRANSFER_DST,Sn.DEVICE,i.byteLength,i.BYTES_PER_ELEMENT));return r.update(i),r},c(e,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexBuffers",get:function(){return this._vertexBuffers}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"indirectBuffer",get:function(){return this._indirectBuffer}},{key:"primitiveMode",get:function(){return this._primitiveMode}},{key:"geometricInfo",get:function(){if(this._geometricInfo)return this._geometricInfo;if(void 0===this.mesh)return{positions:new Float32Array,indices:new Uint8Array,boundingBox:{min:Di.ZERO,max:Di.ZERO}};if(void 0===this.subMeshIdx)return{positions:new Float32Array,indices:new Uint8Array,boundingBox:{min:Di.ZERO,max:Di.ZERO}};var e=this.mesh,t=this.subMeshIdx,i=e.readAttribute(t,ar.ATTR_POSITION),n=e.readIndices(t),r=new Di,s=new Di,a=this.attributes.find((function(e){return e.name===ar.ATTR_POSITION}));if(a){var o=ls[a.format].count;2===o?(r.set(i[0],i[1],0),s.set(i[0],i[1],0)):(r.set(i[0],i[1],i[2]),s.set(i[0],i[1],i[2]));for(var u=0;u<i.length;u+=o)2===o?(r.x=i[u]>r.x?i[u]:r.x,r.y=i[u+1]>r.y?i[u+1]:r.y,s.x=i[u]<s.x?i[u]:s.x,s.y=i[u+1]<s.y?i[u+1]:s.y):(r.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]<s.x?i[u]:s.x,s.y=i[u+1]<s.y?i[u+1]:s.y,s.z=i[u+2]<s.z?i[u+2]:s.z)}return this._geometricInfo={positions:i,indices:n,boundingBox:{max:r,min:s}},this._geometricInfo}},{key:"drawInfo",get:function(){return this._drawInfo},set:function(e){this._drawInfo=e}},{key:"flatBuffers",get:function(){return this._flatBuffers}},{key:"jointMappedBuffers",get:function(){var e=this;if(this._jointMappedBuffers)return this._jointMappedBuffers;var t=this._jointMappedBuffers=[],i=this._jointMappedBufferIndices=[];if(!this.mesh||void 0===this.subMeshIdx)return this._jointMappedBuffers=this.vertexBuffers;var n,r,s=this.mesh.struct,a=s.primitives[this.subMeshIdx];if(!s.jointMaps||void 0===a.jointMapIndex||!s.jointMaps[a.jointMapIndex])return this._jointMappedBuffers=this.vertexBuffers;for(var o=R.director.root.device,u=0;u<a.vertexBundelIndices.length;u++){var h=s.vertexBundles[a.vertexBundelIndices[u]];r=0,n=gn.UNKNOWN;for(var c=0;c<h.attributes.length;c++){var l=h.attributes[c];if(l.name===ar.ATTR_JOINTS){n=l.format;break}r+=ls[l.format].size}n?function(){var c=new Uint8Array(e.mesh.data.buffer,h.view.offset,h.view.length),l=new DataView(c.slice().buffer),_=s.jointMaps[a.jointMapIndex];vF(l,(function(e){return _.indexOf(e)}),n,r,h.view.length,h.view.stride,l);var f=o.createBuffer(new Sr(En.VERTEX|En.TRANSFER_DST,Sn.DEVICE,h.view.length,h.view.stride));f.update(l.buffer),t.push(f),i.push(u)}():t.push(this.vertexBuffers[a.vertexBundelIndices[u]])}return this._vertexIdChannel&&t.push(this._allocVertexIdBuffer(o)),t}},{key:"iaInfo",get:function(){return this._iaInfo}}]),e}());var yF,EF,TF,AF,SF=e("h2",th("cc.SceneAsset")((AF=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return T(t=e.call.apply(e,[this].concat(n))||this,"scene",TF,v(t)),t}_(t,e);var i=t.prototype;return i.initDefault=function(t){e.prototype.initDefault.call(this,t),this.scene=new QR("New Scene")},i.validate=function(){return!!this.scene},t}(Cc),TF=A((EF=AF).prototype,"scene",[Eh,hh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),yF=EF))||yF);R.SceneAsset=SF;var bF,wF,RF,IF,OF,NF,CF,MF,xF,FF,PF,DF,LF,BF,UF,GF,zF,kF,HF,VF,WF,jF,XF,YF,qF,KF,QF,ZF,JF,$F,eP,tP,iP,nP,rP,sP,aP,oP,uP=new Qi,hP=new Qi,cP=new Qi,lP=new Qi,_P=new Qi,fP=new Qi,dP=new Qi,pP=new Di(0,0,0),mP=new Di,gP=new en,vP=new Di,yP=new Di,EP=new Di(1e7,1e7,1e7),TP=new Di(-1e7,-1e7,-1e7),AP=new Di,SP=0,bP=0,wP=function(){function e(e){this._shadowObjects=[],this._shadowCameraFar=0,this._level=void 0,this._matShadowView=new Qi,this._matShadowProj=new Qi,this._matShadowViewProj=new Qi,this._validFrustum=new zu,this._splitFrustum=new zu,this._lightViewFrustum=new zu,this._castLightViewBoundingBox=new Iu,this._level=e,this._validFrustum.accurate=!0,this._splitFrustum.accurate=!0,this._lightViewFrustum.accurate=!0}var t=e.prototype;return t.copyToValidFrustum=function(e){zu.copy(this._validFrustum,e)},t.calculateValidFrustumOrtho=function(e,t,i,n,r){zu.createOrtho(this._validFrustum,e,t,i,n,r)},t.calculateSplitFrustum=function(e,t,i,n){zu.split(this._splitFrustum,e,t,i,n)},t.destroy=function(){this._shadowObjects.length=0},t.createMatrix=function(e,t,i){var n=R.director.root.device,r=e.shadowInvisibleOcclusionRange;zu.copy(this._lightViewFrustum,this._splitFrustum),Qi.fromRT(hP,e.node.rotation,pP),Qi.invert(cP,hP);var s,a,o=cP.clone();this._lightViewFrustum.transform(cP),Iu.fromPoints(this._castLightViewBoundingBox,EP,TP),this._castLightViewBoundingBox.mergeFrustum(this._lightViewFrustum),e.csmOptimizationMode===iS.DisableRotationFix?(s=2*this._castLightViewBoundingBox.halfExtents.x,a=2*this._castLightViewBoundingBox.halfExtents.y):s=a=Di.distance(this._lightViewFrustum.vertices[0],this._lightViewFrustum.vertices[6]);var u=R.director.root.pipeline.pipelineSceneData.csmSupported?e.csmLevel:1;if(u>1&&e.csmOptimizationMode===iS.RemoveDuplicates)if(this._level>=u-1)bP=this._castLightViewBoundingBox.halfExtents.z,SP=this._castLightViewBoundingBox.center.z;else{var h=Math.abs(this._castLightViewBoundingBox.center.z-SP)+bP;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(AP.set(l.x,l.y,l.z+c+r),Di.transformMat4(AP,AP,hP),Qi.fromRT(hP,e.node.rotation,AP),Qi.invert(cP,hP),!i){var _=.5*s,f=.5*a;Qi.ortho(lP,-_,_,-f,f,.1,this._shadowCameraFar,n.capabilities.clipSpaceMinZ,n.capabilities.clipSpaceSignY),Qi.multiply(fP,lP,o),Di.transformMat4(mP,AP,fP);var d=2/t;gP.set(d,d);var p=mP.x%gP.x,m=mP.y%gP.y;vP.set(mP.x-p,mP.y-m,mP.z),Qi.invert(dP,fP),Di.transformMat4(yP,vP,dP),Qi.fromRT(hP,e.node.rotation,yP),Qi.invert(cP,hP),Qi.multiply(_P,lP,cP),Qi.copy(this._matShadowView,cP),Qi.copy(this._matShadowProj,lP),Qi.copy(this._matShadowViewProj,_P)}zu.createOrtho(this._validFrustum,s,a,.1,this._shadowCameraFar,hP)},c(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}(),RP=function(e){function t(t){var i;return(i=e.call(this,t)||this)._splitCameraNear=0,i._splitCameraFar=0,i._csmAtlas=new sn,i._calculateAtlas(t),i}_(t,e);var i=t.prototype;return i.destroy=function(){e.prototype.destroy.call(this)},i._calculateAtlas=function(e){var t=R.director.root.device.capabilities.clipSpaceSignY,i=e%2-.5,n=(.5-Math.floor(e/2))*t;this._csmAtlas.set(.5,.5,i,n)},c(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}(wP),IP=function(){function e(){this._castShadowObjects=[],this._layerObjects=new aa(64),this._layers=[],this._levelCount=0,this._specialLayer=new wP(1),this._shadowDistance=0;for(var e=0;e<tS.LEVEL_4;e++)this._layers[e]=new RP(e)}var t=e.prototype;return t.update=function(e,t){var i=t.scene.mainLight;if(null!==i){var n=e.shadows,r=R.director.root.pipeline.pipelineSceneData.csmSupported?i.csmLevel:1,s=i.shadowDistance;n.enabled&&i.shadowEnabled&&(i.shadowFixedArea?this._updateFixedArea(i):((i.csmNeedUpdate||this._levelCount!==r||this._shadowDistance!==s)&&(this._splitFrustumLevels(i),this._levelCount=r,this._shadowDistance=s),this._calculateCSM(t,i,n)))}},t.destroy=function(){this._castShadowObjects.length=0;for(var e=0;e<this._layers.length;e++)this._layers[e].destroy();this._layers.length=0},t._updateFixedArea=function(e){var t=R.director.root.device,i=e.shadowOrthoSize,n=e.shadowOrthoSize,r=e.shadowNear,s=e.shadowFar;Qi.fromRT(hP,e.node.getWorldRotation(),e.node.getWorldPosition()),Qi.invert(cP,hP),Qi.ortho(lP,-i,i,-n,n,r,s,t.capabilities.clipSpaceMinZ,t.capabilities.clipSpaceSignY),Qi.multiply(_P,lP,cP),this._specialLayer.matShadowView=cP,this._specialLayer.matShadowProj=lP,this._specialLayer.matShadowViewProj=_P,this._specialLayer.calculateValidFrustumOrtho(2*i,2*n,r,s,hP)},t._splitFrustumLevels=function(e){var t=.1,i=e.shadowDistance,n=i/t,r=R.director.root.pipeline.pipelineSceneData.csmSupported?e.csmLevel:1,s=e.csmLayerLambda;this._layers[0].splitCameraNear=t;for(var a=1;a<r;a++){var o=a/r,u=s*t*Math.pow(n,o)+(1-s)*(t+(i-t)*o),h=1.005*u;this._layers[a].splitCameraNear=u,this._layers[a-1].splitCameraFar=h}this._layers[r-1].splitCameraFar=i,e.csmNeedUpdate=!1},t._calculateCSM=function(e,t,i){var n=R.director.root.pipeline.pipelineSceneData.csmSupported?t.csmLevel:1,r=n>1?.5*i.size.x:i.size.x;if(!(r<0)){this._getCameraWorldMatrix(uP,e);for(var s=n-1;s>=0;s--){var a=this._layers[s],o=a.splitCameraNear,u=a.splitCameraFar;a.calculateSplitFrustum(e,uP,o,u),a.createMatrix(t,r,!1)}n===tS.LEVEL_1?(this._specialLayer.shadowCameraFar=this._layers[0].shadowCameraFar,Qi.copy(this._specialLayer.matShadowView,this._layers[0].matShadowView),Qi.copy(this._specialLayer.matShadowProj,this._layers[0].matShadowProj),Qi.copy(this._specialLayer.matShadowViewProj,this._layers[0].matShadowViewProj),this._specialLayer.copyToValidFrustum(this._layers[0].validFrustum)):(this._specialLayer.calculateSplitFrustum(e,uP,.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();Qi.fromRT(e,r,n),e.m08*=-1,e.m09*=-1,e.m10*=-1}},c(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}(),OP=e("hh",function(){function e(){this.fog=new tR,this.ambient=new ZA,this.skybox=new uS,this.shadows=new rS,this.csmLayers=new IP,this.octree=new vx,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 Ey,this._geometryRendererMaterials[t]._uuid="geometry-renderer-material-"+t,this._geometryRendererMaterials[t].initialize({effectName:"builtin-geometry-renderer",technique:t});for(var i=0;i<this._geometryRendererMaterials[t].passes.length;++i)this._geometryRendererPasses[e]=this._geometryRendererMaterials[t].passes[i],this._geometryRendererShaders[e]=this._geometryRendererMaterials[t].passes[i].getShaderVariant(),e++}},t.initOcclusionQuery=function(){if(this._occlusionQueryInputAssembler||(this._occlusionQueryInputAssembler=this._createOcclusionQueryIA()),!this._occlusionQueryMaterial){var e=new Ey;e._uuid="default-occlusion-query-material",e.initialize({effectName:"builtin-occlusion-query"}),this._occlusionQueryMaterial=e,e.passes.length>0&&(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 Sr(En.VERTEX|En.TRANSFER_DST,Sn.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 Sr(En.INDEX|En.TRANSFER_DST,Sn.DEVICE,a,s)),this._occlusionQueryIndicesBuffer.update(r);var o=[new zr("a_position",gn.RGB32F)],u=new Hr(o,[this._occlusionQueryVertexBuffer],this._occlusionQueryIndicesBuffer);return e.createInputAssembler(u)},c(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}()),NP=e("hi",(bF=th("ForwardPipeline"),wF=Dh([JM]),RF=Nh(),bF((CF=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return T(t=e.call.apply(e,[this].concat(n))||this,"renderTextures",NF,v(t)),t._postRenderPass=null,t}_(t,e);var i=t.prototype;return i.initialize=function(t){if(e.prototype.initialize.call(this,t),0===this._flows.length){var i=new pF;i.initialize(pF.initInfo),this._flows.push(i);var n=new tF;n.initialize(tF.initInfo),this._flows.push(n)}return!0},i.activate=function(t){return this._macros={CC_PIPELINE_TYPE:0},this._pipelineSceneData=new OP,!(!e.prototype.activate.call(this,t)||!this._activeRenderer(t)&&(K(2402),1))},i._ensureEnoughSize=function(e){for(var t=this._width,i=this._height,n=0;n<e.length;++n){var r=e[n].window;t=Math.max(r.width,t),i=Math.max(r.height,i)}t===this._width&&i===this._height||(this._width=t,this._height=i)},i.destroy=function(){this._destroyUBOs(),this._destroyQuadInputAssembler();for(var t=this._renderPasses.values(),i=t.next();!i.done;)i.value.destroy(),i=t.next();return this._commandBuffers.length=0,e.prototype.destroy.call(this)},i._activeRenderer=function(){var e=this.device;this._commandBuffers.push(e.commandBuffer);var t=this.globalDSManager.pointSampler;return this._descriptorSet.bindSampler(jd,t),this._descriptorSet.bindTexture(jd,Kv.get("default-texture").getGFXTexture()),this._descriptorSet.bindSampler(ep,t),this._descriptorSet.bindTexture(ep,Kv.get("default-texture").getGFXTexture()),this._descriptorSet.update(),!0},i._destroyUBOs=function(){this._descriptorSet&&(this._descriptorSet.getBuffer(kd.BINDING).destroy(),this._descriptorSet.getBuffer(Vd.BINDING).destroy(),this._descriptorSet.getBuffer(Hd.BINDING).destroy(),this._descriptorSet.getTexture(jd).destroy(),this._descriptorSet.getTexture(ep).destroy())},c(t,[{key:"postRenderPass",get:function(){return this._postRenderPass}}]),t}(QM),NF=A((OF=CF).prototype,"renderTextures",[wF,hh,RF],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),IF=OF))||IF)),CP=[new yr(0,0,0,0),new yr(0,0,0,0),new yr(0,0,0,0)],MP=e("hn",(MF=th("GbufferStage"),xF=Dh([tx]),FF=Nh(),MF((UF=BF=function(e){function t(){var t;return T(t=e.call(this)||this,"renderQueues",LF,v(t)),t._renderQueues=[],t._renderArea=new lr,t._batchedQueue=void 0,t._instancedQueue=void 0,t._phaseID=Qv("default"),t._batchedQueue=new hx,t._instancedQueue=new cx,t}_(t,e);var i=t.prototype;return 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<this.renderQueues.length;n++)this._renderQueues[n]=sx(this.renderQueues[n])},i.destroy=function(){},i.render=function(e){this._instancedQueue.clear(),this._batchedQueue.clear();var t=this._pipeline,i=t.device;this._renderQueues.forEach(ax),t.generateRenderArea(e,this._renderArea),t.updateQuadVertexData(this._renderArea,e.window);for(var n=t.pipelineSceneData.renderObjects,r=0,s=0,a=0,o=0;o<n.length;++o){var u=n[o],h=u.model.subModels;for(r=0;r<h.length;++r){var c=h[r],l=c.passes;for(s=0;s<l.length;++s){var _=l[s];if(_.phase===this._phaseID){var f=_.batchingScheme;if(f===Yv.INSTANCING){var d=_.getInstancedBuffer();d.merge(c,u.model.instancedAttributes,s),this._instancedQueue.queue.add(d)}else if(f===Yv.VB_MERGING){var p=_.getBatchedBuffer();p.merge(c,s,u.model),this._batchedQueue.queue.add(p)}else for(a=0;a<this._renderQueues.length;a++)this._renderQueues[a].insertRenderPass(u,r,s)}}}}this._renderQueues.forEach(ox);var m=t.commandBuffers[0];this._instancedQueue.uploadBuffers(m),this._batchedQueue.uploadBuffers(m),e.clearFlag&$n.COLOR&&(t.pipelineSceneData.isHDR?ay(CP[0],e.clearColor):(CP[0].x=e.clearColor.x,CP[0].y=e.clearColor.y,CP[0].z=e.clearColor.z)),CP[0].w=e.clearColor.w;var g=t.getPipelineRenderData().gbufferFrameBuffer,v=g.renderPass;m.beginRenderPass(v,g,this._renderArea,CP,e.clearDepth,e.clearStencil),m.setScissor(t.generateScissor(e)),m.setViewport(t.generateViewport(e)),m.bindDescriptorSet(Ld.GLOBAL,t.descriptorSet);for(var y=0;y<this.renderQueues.length;y++)this._renderQueues[y].recordCommandBuffer(i,v,m);this._instancedQueue.recordCommandBuffer(i,v,m),this._batchedQueue.recordCommandBuffer(i,v,m),m.endRenderPass()},t}(nC),BF.initInfo={name:"GbufferStage",priority:vC.GBUFFER,tag:0,renderQueues:[{isTransparent:!1,sortMode:ZM.FRONT_TO_BACK,stages:["default"]},{isTransparent:!0,sortMode:ZM.BACK_TO_FRONT,stages:["default"]}]},LF=A((DF=UF).prototype,"renderQueues",[xF,hh,FF],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),PF=DF))||PF)),xP=[new yr(0,0,0,1)],FP=e("ho",(GF=th("LightingStage"),zF=Dh(Ey),kF=Nh(),HF=Dh([tx]),VF=Nh(),GF((KF=qF=function(e){function t(){var t;return(t=e.call(this)||this)._deferredLitsBufs=null,t._maxDeferredLights=up.LIGHTS_PER_PASS,t._lightMeterScale=1e4,t._descriptorSet=null,t._renderArea=new lr,t._uiPhase=void 0,T(t,"_deferredMaterial",XF,v(t)),T(t,"renderQueues",YF,v(t)),t._phaseID=Qv("default"),t._renderQueues=[],t._uiPhase=new Jx,t}_(t,e);var i=t.prototype;return i.initialize=function(t){return e.prototype.initialize.call(this,t),!0},i.gatherLights=function(e){for(var t=this._pipeline,i=t.commandBuffers[0],n=e.scene.sphereLights,r=e.scene.spotLights,s=co.create(0,0,0,1),a=new Float32Array(4),o=e.exposure,u=0,h=sn.length,c=h*this._maxDeferredLights,l=0;l<n.length&&u<this._maxDeferredLights;l++,++u){var _=n[l];if(co.set(s,_.position.x,_.position.y,_.position.z,_.range),pu.sphereFrustum(s,e.frustum)){if(Di.toArray(a,_.position),a[3]=0,this._lightBufferData.set(a,u*h),Di.toArray(a,_.color),_.useColorTemperature){var f=_.colorTemperatureRGB;a[0]*=f.x,a[1]*=f.y,a[2]*=f.z}t.pipelineSceneData.isHDR?a[3]=_.luminance*o*this._lightMeterScale:a[3]=_.luminance,this._lightBufferData.set(a,u*h+1*c),a[0]=_.size,a[1]=_.range,a[2]=0,this._lightBufferData.set(a,u*h+2*c)}}for(var d=0;d<r.length&&u<this._maxDeferredLights;d++,++u){var p=r[d];if(co.set(s,p.position.x,p.position.y,p.position.z,p.range),pu.sphereFrustum(s,e.frustum)){if(Di.toArray(a,p.position),a[3]=1,this._lightBufferData.set(a,u*h+0*c),Di.toArray(a,p.color),p.useColorTemperature){var m=p.colorTemperatureRGB;a[0]*=m.x,a[1]*=m.y,a[2]*=m.z}t.pipelineSceneData.isHDR?a[3]=p.luminance*o*this._lightMeterScale:a[3]=p.luminance,this._lightBufferData.set(a,u*h+1*c),a[0]=p.size,a[1]=p.range,a[2]=p.spotAngle,this._lightBufferData.set(a,u*h+2*c),Di.toArray(a,p.direction),this._lightBufferData.set(a,u*h+3*c)}}var g=3*c+3;this._lightBufferData.set([u],g),i.updateBuffer(this._deferredLitsBufs,this._lightBufferData)},i._createStageDescriptor=function(e){var t=this._pipeline.device,i=16*Float32Array.BYTES_PER_ELEMENT*this._maxDeferredLights;i=Math.ceil(i/t.capabilities.uboOffsetAlignment)*t.capabilities.uboOffsetAlignment,this._deferredLitsBufs=t.createBuffer(new Sr(En.UNIFORM|En.TRANSFER_DST,Sn.HOST|Sn.DEVICE,i,t.capabilities.uboOffsetAlignment));var n=t.createBuffer(new br(this._deferredLitsBufs,0,i));this._lightBufferData=new Float32Array(i/Float32Array.BYTES_PER_ELEMENT),this._descriptorSet=t.createDescriptorSet(new es(e.localSetLayout)),this._descriptorSet.bindBuffer(op.BINDING,n);var r=t.createBuffer(new Sr(En.UNIFORM|En.TRANSFER_DST,Sn.DEVICE,np.SIZE,np.SIZE));this._descriptorSet.bindBuffer(np.BINDING,r)},i.activate=function(t,i){e.prototype.activate.call(this,t,i),this._uiPhase.activate(t);for(var n=0;n<this.renderQueues.length;n++)this._renderQueues[n]=sx(this.renderQueues[n]);this._planarQueue=new Zx(this._pipeline),this._deferredMaterial&&(t.pipelineSceneData.deferredLightingMaterial=this._deferredMaterial)},i.destroy=function(){var e;null===(e=this._deferredLitsBufs)||void 0===e||e.destroy(),this._deferredLitsBufs=null,this._descriptorSet=null},i.render=function(e){var t,i=this._pipeline,n=i.device,r=i.commandBuffers[0],s=i.pipelineSceneData,a=s.renderObjects;this._planarQueue.gatherShadowPasses(e,r),i.generateRenderArea(e,this._renderArea);for(var o=i.getPipelineRenderData(),u=s.deferredLightingMaterial.passes[0],h=u.getShaderVariant(),c=0;c<3;++c)u.descriptorSet.bindTexture(c,o.gbufferRenderTargets[c]),u.descriptorSet.bindSampler(c,o.sampler);u.descriptorSet.bindTexture(3,o.outputDepth),u.descriptorSet.bindSampler(3,o.sampler),u.descriptorSet.update(),this._descriptorSet||this._createStageDescriptor(u),this.gatherLights(e),e.clearFlag&$n.COLOR&&(xP[0].x=e.clearColor.x,xP[0].y=e.clearColor.y,xP[0].z=e.clearColor.z),xP[0].w=0;var l=o.outputFrameBuffer,_=l.renderPass;i.pipelineUBO.updateShadowUBO(e),r.beginRenderPass(_,l,this._renderArea,xP,e.clearDepth,e.clearStencil),r.setScissor(i.generateScissor(e)),r.setViewport(i.generateViewport(e)),r.bindDescriptorSet(Ld.GLOBAL,i.descriptorSet);var f=i.quadIAOffscreen,d=null;null!=u&&null!=h&&null!=f&&(d=ny.getOrCreatePipelineState(n,u,h,_,f)),null!=d&&(this._descriptorSet.update(),r.bindPipelineState(d),r.bindDescriptorSet(Ld.MATERIAL,u.descriptorSet),r.bindDescriptorSet(Ld.LOCAL,this._descriptorSet),r.bindInputAssembler(f),r.draw(f)),this._renderQueues.forEach(ax);for(var p=0,m=0,g=0,v=0;v<a.length;++v){var y=a[v],E=y.model.subModels;for(p=0;p<E.length;++p){var T=E[p].passes;for(m=0;m<T.length;++m)if(T[m].phase===this._phaseID)for(g=0;g<this._renderQueues.length;g++)this._renderQueues[g].insertRenderPass(y,p,m)}}if(a.length>0){this._renderQueues.forEach(ox);for(var A=0;A<this._renderQueues.length;A++)this._renderQueues[A].recordCommandBuffer(n,_,r);this._planarQueue.recordCommandBuffer(n,_,r)}null===(t=e.geometryRenderer)||void 0===t||t.render(_,r,i.pipelineSceneData),this._uiPhase.render(e,_),r.endRenderPass()},t}(nC),qF.initInfo={name:"LightingStage",priority:vC.LIGHTING,tag:0},XF=A((jF=KF).prototype,"_deferredMaterial",[zF,hh,kF],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),YF=A(jF.prototype,"renderQueues",[HF,hh,VF],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),WF=jF))||WF)),PP=[new yr(0,0,0,1)],DP=e("hq",(QF=th("PostProcessStage"),ZF=Dh(Ey),JF=Nh(),$F=Dh([tx]),eP=Nh(),QF((aP=sP=function(e){function t(){var t;return T(t=e.call(this)||this,"_postProcessMaterial",nP,v(t)),T(t,"renderQueues",rP,v(t)),t._renderArea=new lr,t._stageDesc=void 0,t._localUBO=void 0,t._uiPhase=new Jx,t}_(t,e);var i=t.prototype;return i.initialize=function(t){return e.prototype.initialize.call(this,t),!0},i.activate=function(t,i){e.prototype.activate.call(this,t,i),this._postProcessMaterial&&(t.pipelineSceneData.postprocessMaterial=this._postProcessMaterial),this._uiPhase.activate(t)},i.destroy=function(){},i.render=function(e){var t=this._pipeline,i=t.device,n=t.pipelineSceneData,r=t.commandBuffers[0];t.pipelineUBO.updateCameraUBO(e);var s=e.viewport;this._renderArea.x=s.x*e.window.width,this._renderArea.y=s.y*e.window.height,this._renderArea.width=s.width*e.window.width,this._renderArea.height=s.height*e.window.height;var a=t.getPipelineRenderData(),o=e.window.framebuffer,u=t.getRenderPass(e.clearFlag,o);e.clearFlag&$n.COLOR&&(PP[0].x=e.clearColor.x,PP[0].y=e.clearColor.y,PP[0].z=e.clearColor.z),PP[0].w=e.clearColor.w,r.beginRenderPass(u,o,this._renderArea,PP,e.clearDepth,e.clearStencil),r.bindDescriptorSet(Ld.GLOBAL,t.descriptorSet);var h=n.postprocessMaterial.passes[0],c=h.getShaderVariant();t.bloomEnabled?h.descriptorSet.bindTexture(0,a.bloom.combineTex):h.descriptorSet.bindTexture(0,a.outputRenderTargets[0]),h.descriptorSet.bindSampler(0,a.sampler),h.descriptorSet.update();var l=e.window.swapchain?t.quadIAOnscreen:t.quadIAOffscreen,_=null;null!=h&&null!=c&&null!=l&&(_=ny.getOrCreatePipelineState(i,h,c,u,l));var f=t.pipelineSceneData.renderObjects;null!=_&&f.length>0&&(this._stageDesc||(this._stageDesc=i.createDescriptorSet(new es(h.localSetLayout)),this._localUBO=i.createBuffer(new Sr(En.UNIFORM|En.TRANSFER_DST,Sn.DEVICE,np.SIZE,np.SIZE)),this._stageDesc.bindBuffer(np.BINDING,this._localUBO)),this._stageDesc.update(),r.bindPipelineState(_),r.bindDescriptorSet(Ld.MATERIAL,h.descriptorSet),r.bindDescriptorSet(Ld.LOCAL,this._stageDesc),r.bindInputAssembler(l),r.draw(l)),this._uiPhase.render(e,u),vy(i,u,r,t.profiler,e),r.endRenderPass()},t}(nC),sP.initInfo={name:"PostProcessStage",priority:pC.POST_PROCESS,tag:0},nP=A((iP=aP).prototype,"_postProcessMaterial",[ZF,hh,JF],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),rP=A(iP.prototype,"renderQueues",[$F,hh,eP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),tP=iP))||tP));!function(e){e[e.NONE=0]="NONE",e[e.FXAA=1]="FXAA"}(oP||(oP={}));var LP,BP,UP,GP,zP,kP,HP,VP,WP=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._antiAliasing=oP.NONE,t}_(t,e);var i=t.prototype;return i.updatePipelineSceneData=function(){this.updatePipelinePassInfo()},i.updateBloomPass=function(){if(this._bloomMaterial){var e=this._bloomMaterial.passes[0];e.beginChangeStatesSilently(),e.tryCompile(),e.endChangeStatesSilently();for(var t=0;t<6;++t){var i=this._bloomMaterial.passes[1+t];i.beginChangeStatesSilently(),i.tryCompile(),i.endChangeStatesSilently();var n=this._bloomMaterial.passes[7+t];n.beginChangeStatesSilently(),n.tryCompile(),n.endChangeStatesSilently()}var r=this._bloomMaterial.passes[13];r.beginChangeStatesSilently(),r.tryCompile(),r.endChangeStatesSilently()}},i.updatePostProcessPass=function(){if(this.postprocessMaterial){var e=this.postprocessMaterial.passes[0];e.beginChangeStatesSilently(),e.tryCompile(),e.endChangeStatesSilently()}},i.initPipelinePassInfo=function(){var e=new Ey;e._uuid="builtin-deferred-material",e.initialize({effectName:"pipeline/deferred-lighting"});for(var t=0;t<e.passes.length;++t)e.passes[t].tryCompile();this._deferredLightingMaterial=e;var i=new Ey;i._uuid="builtin-bloom-material",i.initialize({effectName:"pipeline/bloom"});for(var n=0;n<i.passes.length;++n)i.passes[n].tryCompile();this._bloomMaterial=i;var r=new Ey;r._uuid="builtin-post-process-material",At.ENABLE_ANTIALIAS_FXAA&&(this._antiAliasing=oP.FXAA),r.initialize({effectName:"pipeline/post-process",defines:{ANTIALIAS_TYPE:this._antiAliasing}});for(var s=0;s<r.passes.length;++s)r.passes[s].tryCompile();this._postprocessMaterial=r,this.updatePipelinePassInfo()},i.updatePipelinePassInfo=function(){this.updateBloomPass(),this.updatePostProcessPass(),this.updateDeferredPassInfo()},i.activate=function(t){return e.prototype.activate.call(this,t),this.initPipelinePassInfo(),!0},i.updateDeferredPassInfo=function(){this.updateDeferredLightPass()},i.updateDeferredLightPass=function(){if(this._deferredLightingMaterial){R.director.root.pipeline.macros.CC_RECEIVE_SHADOW=1;var e=this._deferredLightingMaterial.passes[0];e.beginChangeStatesSilently(),e.tryCompile(),e.endChangeStatesSilently()}},c(t,[{key:"antiAliasing",get:function(){return this._antiAliasing},set:function(e){if(this._antiAliasing=e,this._postprocessMaterial){var t=this._postprocessMaterial.passes[0].defines;Object.assign(t,{ANTIALIAS_TYPE:e});var i=new Ey;i.initialize({effectAsset:this._postprocessMaterial.effectAsset,defines:t});for(var n=0;n<i.passes.length;++n)i.passes[n].tryCompile();this._postprocessMaterial=i}}},{key:"bloomMaterial",get:function(){return this._bloomMaterial},set:function(e){this._bloomMaterial!==e&&e&&(this._bloomMaterial=e,this.updatePipelinePassInfo())}},{key:"postprocessMaterial",get:function(){return this._postprocessMaterial},set:function(e){this._postprocessMaterial!==e&&e&&(this._postprocessMaterial=e,this.updatePipelinePassInfo())}},{key:"deferredLightingMaterial",get:function(){return this._deferredLightingMaterial},set:function(e){this._deferredLightingMaterial!==e&&e&&(this._deferredLightingMaterial=e,this.updatePipelinePassInfo())}}]),t}(OP),jP=[new yr(0,0,0,1)],XP=function(){};XP.SIZE=4*(XP.COUNT=4+(XP.TEXTURE_SIZE_OFFSET=0));var YP,qP,KP,QP,ZP,JP,$P,eD,tD,iD,nD=e("hp",(LP=th("BloomStage"),BP=Dh(Ey),UP=Nh(),LP((VP=HP=function(e){function t(){var t;return(t=e.call(this)||this).threshold=1,t.intensity=.8,t.iterations=2,T(t,"_bloomMaterial",kP,v(t)),t._renderArea=new lr,t._bloomUBO=[],t}_(t,e);var i=t.prototype;return i.initialize=function(t){return e.prototype.initialize.call(this,t),!0},i.activate=function(t,i){e.prototype.activate.call(this,t,i),this._bloomMaterial&&(t.pipelineSceneData.bloomMaterial=this._bloomMaterial)},i.destroy=function(){},i.render=function(e){var t,i=this._pipeline;if(i.generateBloomRenderData(),((null===(t=e.window)||void 0===t?void 0:t.swapchain)||i.macros.CC_PIPELINE_TYPE)&&i.bloomEnabled&&0!==i.pipelineSceneData.renderObjects.length){if(0===this._bloomUBO.length)for(var n=0;n<14;++n)this._bloomUBO[n]=i.device.createBuffer(new Sr(En.UNIFORM|En.TRANSFER_DST,Sn.HOST|Sn.DEVICE,XP.SIZE,XP.SIZE));e.clearFlag&$n.COLOR&&(jP[0].x=e.clearColor.x,jP[0].y=e.clearColor.y,jP[0].z=e.clearColor.z),jP[0].w=e.clearColor.w,this._prefilterPass(e,i),this._downsamplePass(e,i),this._upsamplePass(e,i),this._combinePass(e,i)}},i._prefilterPass=function(e,t){t.generateRenderArea(e,this._renderArea),this._renderArea.width>>=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(XP.COUNT);a[XP.TEXTURE_SIZE_OFFSET+2]=this.threshold,i.updateBuffer(this._bloomUBO[0],a),i.beginRenderPass(s.renderPass,s.prefilterFramebuffer,this._renderArea,jP,0,0),i.bindDescriptorSet(Ld.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(Ld.MATERIAL,n.descriptorSet);var o=e.window.swapchain?t.quadIAOffscreen:t.quadIAOnscreen,u=null,h=n.getShaderVariant();null!=n&&null!=h&&null!=o&&(u=ny.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(XP.COUNT),a=0;a<this.iterations;++a){s[XP.TEXTURE_SIZE_OFFSET+0]=this._renderArea.width,s[XP.TEXTURE_SIZE_OFFSET+1]=this._renderArea.height,i.updateBuffer(this._bloomUBO[a+1],s),this._renderArea.width>>=1,this._renderArea.height>>=1,i.beginRenderPass(r.renderPass,r.downsampleFramebuffers[a],this._renderArea,jP,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(Ld.MATERIAL,o.descriptorSet);var h=e.window.swapchain?t.quadIAOffscreen:t.quadIAOnscreen,c=null;null!=o&&null!=u&&null!=h&&(c=ny.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(XP.COUNT),a=0;a<this.iterations;++a){var o=a+6+1;s[XP.TEXTURE_SIZE_OFFSET+0]=this._renderArea.width,s[XP.TEXTURE_SIZE_OFFSET+1]=this._renderArea.height,n.updateBuffer(this._bloomUBO[o],s),this._renderArea.width<<=1,this._renderArea.height<<=1,n.beginRenderPass(i.renderPass,i.upsampleFramebuffers[this.iterations-1-a],this._renderArea,jP,0,0);var u=r.passes[7+a],h=u.getShaderVariant();u.descriptorSet.bindBuffer(0,this._bloomUBO[o]),0===a?u.descriptorSet.bindTexture(1,i.downsampleTexs[this.iterations-1]):u.descriptorSet.bindTexture(1,i.upsampleTexs[this.iterations-a]),u.descriptorSet.bindSampler(1,i.sampler),u.descriptorSet.update(),n.bindDescriptorSet(Ld.MATERIAL,u.descriptorSet);var c=e.window.swapchain?t.quadIAOffscreen:t.quadIAOnscreen,l=null;null!=u&&null!=h&&null!=c&&(l=ny.getOrCreatePipelineState(t.device,u,h,i.renderPass,c)),null!=l&&(n.bindPipelineState(l),n.bindInputAssembler(c),n.draw(c)),n.endRenderPass()}},i._combinePass=function(e,t){t.generateRenderArea(e,this._renderArea);var i=t.commandBuffers[0],n=t.pipelineSceneData.bloomMaterial,r=t.getPipelineRenderData(),s=r.bloom,a=new Float32Array(XP.COUNT);a[XP.TEXTURE_SIZE_OFFSET+3]=this.intensity,i.updateBuffer(this._bloomUBO[13],a),i.beginRenderPass(s.renderPass,s.combineFramebuffer,this._renderArea,jP,0,0),i.bindDescriptorSet(Ld.GLOBAL,t.descriptorSet);var o=n.passes[13];o.descriptorSet.bindBuffer(0,this._bloomUBO[13]),o.descriptorSet.bindTexture(1,r.outputRenderTargets[0]),o.descriptorSet.bindTexture(2,s.upsampleTexs[0]),o.descriptorSet.bindSampler(1,s.sampler),o.descriptorSet.bindSampler(2,s.sampler),o.descriptorSet.update(),i.bindDescriptorSet(Ld.MATERIAL,o.descriptorSet);var u=e.window.swapchain?t.quadIAOffscreen:t.quadIAOnscreen,h=null,c=o.getShaderVariant();null!=o&&null!=c&&null!=u&&(h=ny.getOrCreatePipelineState(t.device,o,c,s.renderPass,u)),null!=h&&(i.bindPipelineState(h),i.bindInputAssembler(u),i.draw(u)),i.endRenderPass()},t}(nC),HP.initInfo={name:"BloomStage",priority:pC.BLOOM,tag:0},kP=A((zP=VP).prototype,"_bloomMaterial",[BP,hh,UP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),GP=zP))||GP)),rD=e("hm",th("MainFlow")((KP=qP=function(e){function t(){return e.apply(this,arguments)||this}_(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 MP;i.initialize(MP.initInfo),this._stages.push(i);var n=new FP;n.initialize(FP.initInfo),this._stages.push(n);var r=new nD;r.initialize(nD.initInfo),this._stages.push(r);var s=new DP;s.initialize(DP.initInfo),this._stages.push(s)}return!0},i.activate=function(t){e.prototype.activate.call(this,t)},i.render=function(t){e.prototype.render.call(this,t)},i.destroy=function(){e.prototype.destroy.call(this)},t}(sC),qP.initInfo={name:Id,priority:yC.MAIN,stages:[]},YP=KP))||YP),sD=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).gbufferFrameBuffer=null,t.gbufferRenderTargets=[],t}return _(t,e),t}((function(){this.outputFrameBuffer=null,this.outputRenderTargets=[],this.outputDepth=null,this.sampler=null,this.bloom=null})),aD=e("hl",(QP=th("DeferredPipeline"),ZP=Dh([JM]),JP=Nh(),QP((iD=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._gbufferRenderPass=null,t._lightingRenderPass=null,T(t,"renderTextures",tD,v(t)),t}_(t,e);var i=t.prototype;return i.initialize=function(t){if(e.prototype.initialize.call(this,t),0===this._flows.length){var i=new pF;i.initialize(pF.initInfo),this._flows.push(i);var n=new rD;n.initialize(rD.initInfo),this._flows.push(n)}return!0},i.activate=function(t){return this._macros={CC_PIPELINE_TYPE:1},this._pipelineSceneData=new WP,!(!e.prototype.activate.call(this,t)||!this._activeRenderer(t)&&(K(2402),1))},i.destroy=function(){this._destroyUBOs(),this._destroyQuadInputAssembler(),this._destroyDeferredData();for(var t=this._renderPasses.values(),i=t.next();!i.done;)i.value.destroy(),i=t.next();return this._commandBuffers.length=0,e.prototype.destroy.call(this)},i.onGlobalPipelineStateChanged=function(){this.pipelineSceneData.updatePipelineSceneData()},i.getPipelineRenderData=function(){return this._pipelineRenderData||this._generateDeferredRenderData(),this._pipelineRenderData},i._activeRenderer=function(e){var t=this.device;this._commandBuffers.push(t.commandBuffer);var i=this.globalDSManager.pointSampler;this._descriptorSet.bindSampler(jd,i),this._descriptorSet.bindTexture(jd,Kv.get("default-texture").getGFXTexture()),this._descriptorSet.bindSampler(ep,i),this._descriptorSet.bindTexture(ep,Kv.get("default-texture").getGFXTexture()),this._descriptorSet.update();var n=new KM;if(!(n=this._createQuadInputAssembler()).quadIB||!n.quadVB||!n.quadIA)return!1;this._quadIB=n.quadIB,this._quadVBOffscreen=n.quadVB,this._quadIAOffscreen=n.quadIA;var r=this._createQuadInputAssembler();if(!r.quadIB||!r.quadVB||!r.quadIA)return!1;if(this._quadVBOnscreen=r.quadVB,this._quadIAOnscreen=r.quadIA,!this._gbufferRenderPass){var s=new Vr;s.format=gn.RGBA16F,s.loadOp=Un.CLEAR,s.storeOp=Gn.STORE;var a=new Vr;a.format=gn.RGBA16F,a.loadOp=Un.CLEAR,a.storeOp=Gn.STORE;var o=new Vr;o.format=gn.RGBA16F,o.loadOp=Un.CLEAR,o.storeOp=Gn.STORE;var u=new Wr;u.format=gn.DEPTH_STENCIL,u.depthLoadOp=Un.CLEAR,u.depthStoreOp=Gn.STORE,u.stencilLoadOp=Un.CLEAR,u.stencilStoreOp=Gn.STORE;var h=new Yr([s,a,o],u);this._gbufferRenderPass=t.createRenderPass(h)}if(!this._lightingRenderPass){var c=new Vr;c.format=gn.RGBA8,c.loadOp=Un.CLEAR,c.storeOp=Gn.STORE,c.barrier=t.getGeneralBarrier(new qr(zn.NONE,zn.COLOR_ATTACHMENT_WRITE));var l=new Wr;l.format=gn.DEPTH_STENCIL,l.depthLoadOp=Un.LOAD,l.depthStoreOp=Gn.DISCARD,l.stencilLoadOp=Un.LOAD,l.stencilStoreOp=Gn.DISCARD,c.barrier=t.getGeneralBarrier(new qr(zn.DEPTH_STENCIL_ATTACHMENT_WRITE,zn.DEPTH_STENCIL_ATTACHMENT_WRITE));var _=new Yr([c],l);this._lightingRenderPass=t.createRenderPass(_)}return this._width=e.width,this._height=e.height,this._generateDeferredRenderData(),!0},i._destroyUBOs=function(){this._descriptorSet&&(this._descriptorSet.getBuffer(kd.BINDING).destroy(),this._descriptorSet.getBuffer(Vd.BINDING).destroy(),this._descriptorSet.getBuffer(Hd.BINDING).destroy(),this._descriptorSet.getTexture(jd).destroy(),this._descriptorSet.getTexture(ep).destroy())},i._destroyDeferredData=function(){var e=this._pipelineRenderData;if(e){e.gbufferFrameBuffer&&e.gbufferFrameBuffer.destroy(),e.outputFrameBuffer&&e.outputFrameBuffer.destroy(),e.outputDepth&&e.outputDepth.destroy();for(var t=0;t<e.gbufferRenderTargets.length;t++)e.gbufferRenderTargets[t].destroy();e.gbufferRenderTargets.length=0;for(var i=0;i<e.outputRenderTargets.length;i++)e.outputRenderTargets[i].destroy();e.outputRenderTargets.length=0,this._destroyBloomData()}this._pipelineRenderData=null},i._ensureEnoughSize=function(e){for(var t=this._width,i=this._height,n=0;n<e.length;++n){var r=e[n].window;t=Math.max(r.width,t),i=Math.max(r.height,i)}t===this._width&&i===this._height||(this._width=t,this._height=i,this._destroyDeferredData(),this._generateDeferredRenderData())},i._generateDeferredRenderData=function(){for(var e=this,t=this.device,i=this._pipelineRenderData=new sD,n=this.pipelineSceneData,r=0;r<3;++r)i.gbufferRenderTargets.push(t.createTexture(new Or(bn.TEX2D,wn.COLOR_ATTACHMENT|wn.SAMPLED,gn.RGBA16F,this._width*n.shadingScale,this._height*n.shadingScale)));i.outputDepth=t.createTexture(new Or(bn.TEX2D,wn.DEPTH_STENCIL_ATTACHMENT|wn.SAMPLED,gn.DEPTH_STENCIL,this._width*n.shadingScale,this._height*n.shadingScale)),i.gbufferFrameBuffer=t.createFramebuffer(new Zr(this._gbufferRenderPass,i.gbufferRenderTargets,i.outputDepth)),i.outputRenderTargets.push(t.createTexture(new Or(bn.TEX2D,wn.COLOR_ATTACHMENT|wn.SAMPLED,gn.RGBA16F,this._width*n.shadingScale,this._height*n.shadingScale))),i.outputFrameBuffer=t.createFramebuffer(new Zr(this._lightingRenderPass,i.outputRenderTargets,null)),i.sampler=this.globalDSManager.pointSampler,this.on(rC.ATTACHMENT_SCALE_CAHNGED,(function(t){i.sampler=t<1?e.globalDSManager.pointSampler:e.globalDSManager.linearSampler,e.applyFramebufferRatio(i.gbufferFrameBuffer),e.applyFramebufferRatio(i.outputFrameBuffer)}))},t}(QM),tD=A((eD=iD).prototype,"renderTextures",[ZP,hh,JP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),$P=eD))||$P));function oD(){var e=new NP;return e.initialize({flows:[]}),e}var uD=new en,hD=function(){var e=t.prototype;function t(){this._curTime=0}return e.init=function(){var e,t,i,n,r,s,a,o=this;return this.settings={enabled:null===(e=Tt.querySettings(Et.Category.SPLASH_SCREEN,"enabled"))||void 0===e||e,totalTime:null!==(t=Tt.querySettings(Et.Category.SPLASH_SCREEN,"totalTime"))&&void 0!==t?t:3e3,base64src:null!==(i=Tt.querySettings(Et.Category.SPLASH_SCREEN,"base64src"))&&void 0!==i?i:"",effect:null!==(n=Tt.querySettings(Et.Category.SPLASH_SCREEN,"effect"))&&void 0!==n?n:"FADE-INOUT",clearColor:null!==(r=Tt.querySettings(Et.Category.SPLASH_SCREEN,"clearColor"))&&void 0!==r?r:new yr(.88,.88,.88,1),displayRatio:null!==(s=Tt.querySettings(Et.Category.SPLASH_SCREEN,"displayRatio"))&&void 0!==s?s:.4,displayWatermark:null===(a=Tt.querySettings(Et.Category.SPLASH_SCREEN,"displayWatermark"))||void 0===a||a},this._curTime=0,!this.settings.enabled||""===this.settings.base64src||this.settings.totalTime<=0?(this.settings.totalTime=0,Promise.resolve()):(this.device=R.director.root.device,this.swapchain=R.director.root.mainWindow.swapchain,this.framebuffer=R.director.root.mainWindow.framebuffer,this.preInit(),this.settings.displayWatermark&&this.initWarterMark(),new Promise((function(e,t){o.logoImage=new Image,o.logoImage.onload=function(){o.initLogo(),e()},o.logoImage.onerror=function(){t()},o.logoImage.src=o.settings.base64src})))},e.preInit=function(){var e=this.settings.clearColor;this.clearColors=[new yr(e.x,e.y,e.z,e.w)];var t=this.device,i=this.swapchain;this.renderArea=new lr(0,0,i.width,i.height),this.cmdBuff=t.commandBuffer;var n=new Float32Array([.5,.5,1,0,-.5,.5,0,0,.5,-.5,1,1,-.5,-.5,0,1]),r=4*Float32Array.BYTES_PER_ELEMENT,s=4*r;this.vertexBuffers=t.createBuffer(new Sr(En.VERTEX|En.TRANSFER_DST,Sn.DEVICE,s,r)),this.vertexBuffers.update(n);var a=new Uint16Array([0,1,2,1,3,2]),o=Uint16Array.BYTES_PER_ELEMENT,u=6*o;this.indicesBuffers=t.createBuffer(new Sr(En.INDEX|En.TRANSFER_DST,Sn.DEVICE,u,o)),this.indicesBuffers.update(a);var h=[new zr("a_position",gn.RG32F),new zr("a_texCoord",gn.RG32F)],c=new Hr(h,[this.vertexBuffers],this.indicesBuffers);this.quadAssmebler=t.createInputAssembler(c),this.projection=new Qi,Qi.ortho(this.projection,-1,1,-1,1,-1,1,t.capabilities.clipSpaceMinZ,t.capabilities.clipSpaceSignY,i.surfaceTransform)},e.update=function(e){var t=this.settings,i=this.device,n=this.swapchain;Qi.ortho(this.projection,-1,1,-1,1,-1,1,i.capabilities.clipSpaceMinZ,i.capabilities.clipSpaceSignY,n.surfaceTransform);var r=n.width,s=n.height,a=r<s?r:s;this._curTime+=1e3*e;var o=v_(Ei(this._curTime/t.totalTime));"NONE"===t.effect&&(o=1);var u=this.logoTexture.width,h=this.logoTexture.height,c=a*t.displayRatio,l=c*u/h,_=c;if(n.surfaceTransform!==pn.ROTATE_90&&n.surfaceTransform!==pn.ROTATE_270||(l=c*r/s,_=c*h/u*s/r),this.logoMat.setProperty("resolution",uD.set(r,s),0),this.logoMat.setProperty("scale",uD.set(l,_),0),this.logoMat.setProperty("translate",uD.set(.5*r,.5*s),0),this.logoMat.setProperty("percent",o),this.logoMat.setProperty("u_projection",this.projection),this.logoMat.passes[0].update(),t.displayWatermark&&this.watermarkMat){var f=.5*a,d=this.watermarkTexture.width,p=f,m=f*this.watermarkTexture.height/d;n.surfaceTransform!==pn.ROTATE_90&&n.surfaceTransform!==pn.ROTATE_270||(p=.5*f,m=f*r/s*.5),this.watermarkMat.setProperty("resolution",uD.set(r,s),0),this.watermarkMat.setProperty("scale",uD.set(p,m),0),this.watermarkMat.setProperty("translate",uD.set(.5*r,.1*s),0),this.watermarkMat.setProperty("percent",o),this.watermarkMat.setProperty("u_projection",this.projection),this.watermarkMat.passes[0].update()}this.frame()},e.initLogo=function(){var e=this.device;this.logoMat=new Ey,this.logoMat.initialize({effectName:"util/splash-screen"});var t=new Cr;t.addressU=Mn.CLAMP,t.addressV=Mn.CLAMP,t.addressW=Mn.CLAMP,this.sampler=e.getSampler(t),this.logoTexture=e.createTexture(new Or(bn.TEX2D,wn.SAMPLED|wn.TRANSFER_DST,gn.RGBA8,this.logoImage.width,this.logoImage.height));var i=this.logoMat.passes[0],n=i.getBinding("mainTexture");i.bindTexture(n,this.logoTexture),this.shader=i.getShaderVariant();var r=i.descriptorSet;r.bindSampler(n,this.sampler),r.update();var s=new gr;s.texExtent.width=this.logoImage.width,s.texExtent.height=this.logoImage.height,s.texExtent.depth=1,e.copyTexImagesToTexture([this.logoImage],this.logoTexture,[s])},e.initWarterMark=function(){var e=document.createElement("canvas");e.width=330,e.height=30,e.style.width=""+e.width,e.style.height=""+e.height;var t=e.getContext("2d");t.font="18px Arial",t.textBaseline="top",t.textAlign="left",t.fillStyle="`#424242`";var i="Powered by Cocos Creator",n=t.measureText(i);t.fillText(i,(330-n.width)/2,6);var r=new gr;r.texExtent.width=e.width,r.texExtent.height=e.height,r.texExtent.depth=1,this.watermarkTexture=this.device.createTexture(new Or(bn.TEX2D,wn.SAMPLED|wn.TRANSFER_DST,gn.RGBA8,e.width,e.height)),this.device.copyTexImagesToTexture([e],this.watermarkTexture,[r]),this.watermarkMat=new Ey,this.watermarkMat.initialize({effectName:"util/splash-screen"});var s=this.watermarkMat.passes[0],a=s.getBinding("mainTexture");s.bindTexture(a,this.watermarkTexture),s.descriptorSet.update()},e.frame=function(){var e=this.device,t=this.swapchain;e.acquire([t]);var i=this.cmdBuff,n=this.framebuffer,r=this.renderArea;r.width=t.width,r.height=t.height,i.begin(),i.beginRenderPass(n.renderPass,n,r,this.clearColors,1,0);var s=this.logoMat.passes[0],a=ny.getOrCreatePipelineState(e,s,this.shader,n.renderPass,this.quadAssmebler);if(i.bindPipelineState(a),i.bindDescriptorSet(Ld.MATERIAL,s.descriptorSet),i.bindInputAssembler(this.quadAssmebler),i.draw(this.quadAssmebler),this.settings.displayWatermark&&this.watermarkMat){var o=this.watermarkMat.passes[0],u=ny.getOrCreatePipelineState(e,o,this.shader,n.renderPass,this.quadAssmebler);i.bindPipelineState(u),i.bindDescriptorSet(Ld.MATERIAL,o.descriptorSet),i.bindInputAssembler(this.quadAssmebler),i.draw(this.quadAssmebler)}i.endRenderPass(),i.end(),e.flushCommands([i]),e.queue.submit([i]),e.present()},e.destroy=function(){this.device=null,this.swapchain=null,this.clearColors=null,this.logoImage.destroy&&this.logoImage.destroy(),this.logoImage=null,this.framebuffer=null,this.renderArea=null,this.cmdBuff=null,this.shader=null,this.logoMat.destroy(),this.logoMat=null,this.logoTexture.destroy(),this.logoTexture=null,this.quadAssmebler.destroy(),this.quadAssmebler=null,this.vertexBuffers.destroy(),this.vertexBuffers=null,this.indicesBuffers.destroy(),this.indicesBuffers=null,this.sampler=null,this.watermarkTexture&&(this.watermarkMat.destroy(),this.watermarkMat=null,this.watermarkTexture.destroy(),this.watermarkTexture=null),this.settings=null},c(t,[{key:"isFinished",get:function(){return this._curTime>=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}();hD._ins=void 0,R.internal.SplashScreen=hD;var cD=new Ae("Scheduler"),lD=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};lD.get=function(e,t,i,n){var r=lD._listEntries.pop();return r?(r.target=e,r.priority=t,r.paused=i,r.markedForDeletion=n):r=new lD(e,t,i,n),r},lD.put=function(e){lD._listEntries.length<20&&(e.target=null,lD._listEntries.push(e))},lD._listEntries=[];var _D=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};_D.get=function(e,t,i,n){var r=_D._hashUpdateEntries.pop();return r?(r.list=e,r.entry=t,r.target=i,r.callback=n):r=new _D(e,t,i,n),r},_D.put=function(e){_D._hashUpdateEntries.length<20&&(e.list=e.entry=e.target=e.callback=null,_D._hashUpdateEntries.push(e))},_D._hashUpdateEntries=[];var fD=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};fD.get=function(e,t,i,n,r,s){var a=fD._hashTimerEntries.pop();return a?(a.timers=e,a.target=t,a.timerIndex=i,a.currentTimer=n,a.currentTimerSalvaged=r,a.paused=s):a=new fD(e,t,i,n,r,s),a},fD.put=function(e){fD._hashTimerEntries.length<20&&(e.timers=e.target=e.currentTimer=null,fD._hashTimerEntries.push(e))},fD._hashTimerEntries=[];var dD=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===R.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}();dD._timers=[],dD.get=function(){return dD._timers.pop()||new dD},dD.put=function(e){dD._timers.length<20&&!e._lock&&(e._scheduler=e._target=e._callback=null,dD._timers.push(e))};var pD=e("cZ",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=Pe(!0),t._hashForTimers=Pe(!0),t._currentTarget=null,t._currentTargetSalvaged=!1,t._updateHashLocked=!1,t._arrayForTimers=[],t}_(t,e),t.enableForTarget=function(e){var t=!1;(e.uuid||e.id)&&(t=!0),t||(e.__instanceId?Y(1513):e.id=cD.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<n;t++)(r=i[t]).paused||r.markedForDeletion||r.target.update(e);for(t=0,n=(i=this._updates0List).length;t<n;t++)(r=i[t]).paused||r.markedForDeletion||r.target.update(e);for(t=0,n=(i=this._updatesPosList).length;t<n;t++)(r=i[t]).paused||r.markedForDeletion||r.target.update(e);var a=this._arrayForTimers;for(t=0;t<a.length;t++){if(s=a[t],this._currentTarget=s,this._currentTargetSalvaged=!1,!s.paused)for(s.timerIndex=0;s.timerIndex<s.timers.length;++s.timerIndex)s.currentTimer=s.timers[s.timerIndex],s.currentTimerSalvaged=!1,s.currentTimer.update(e),s.currentTimer=null;this._currentTargetSalvaged&&0===this._currentTarget.timers.length&&(this._removeHashElement(this._currentTarget),--t)}for(t=0,i=this._updatesNegList;t<i.length;)(r=i[t]).markedForDeletion?this._removeUpdateFromHash(r):t++;for(t=0,i=this._updates0List;t<i.length;)(r=i[t]).markedForDeletion?this._removeUpdateFromHash(r):t++;for(t=0,i=this._updatesPosList;t<i.length;)(r=i[t]).markedForDeletion?this._removeUpdateFromHash(r):t++;this._updateHashLocked=!1,this._currentTarget=null},i.schedule=function(e,t,i,n,r,s){if("function"!=typeof e){var a=e;e=t,t=a}3!==arguments.length&&4!==arguments.length&&5!==arguments.length||(s=!!n,n=R.macro.REPEAT_FOREVER,r=0),J(t,1502);var o=t.uuid||t.id;if(o){var u,h,c=this._hashForTimers[o];if(c?c.paused!==s&&Y(1511):(c=fD.get(null,t,0,null,null,s),this._arrayForTimers.push(c),this._hashForTimers[o]=c),null==c.timers)c.timers=[];else for(h=0;h<c.timers.length;++h)if((u=c.timers[h])&&e===u._callback)return j(1507,u.getInterval(),i),void(u._interval=i);(u=dD.get()).initWithCallback(this,e,t,i,n,r),c.timers.push(u),this._currentTarget===c&&this._currentTargetSalvaged&&(this._currentTargetSalvaged=!1)}else K(1510)},i.scheduleUpdate=function(e,t,i){var n=e.uuid||e.id;if(n){var r=this._hashForUpdates[n];if(r&&r.entry){if(r.entry.priority===t)return r.entry.markedForDeletion=!1,void(r.entry.paused=i);if(this._updateHashLocked)return j(1506),r.entry.markedForDeletion=!1,void(r.entry.paused=i);this.unscheduleUpdate(e)}var s,a=lD.get(e,t,i,!1);0===t?(s=this._updates0List,this._appendIn(s,a)):(s=t<0?this._updatesNegList:this._updatesPosList,this._priorityIn(s,a,t)),this._hashForUpdates[n]=_D.get(s,a,e,null)}else K(1510)},i.unschedule=function(e,t){if(t&&e){var i=t.uuid||t.id;if(i){var n=this._hashForTimers[i];if(n)for(var r=n.timers,s=0,a=r.length;s<a;s++){var o=r[s];if(e===o._callback)return o!==n.currentTimer||n.currentTimerSalvaged||(n.currentTimerSalvaged=!0),r.splice(s,1),dD.put(o),n.timerIndex>=s&&n.timerIndex--,void(0===r.length&&(this._currentTarget===n?this._currentTargetSalvaged=!0:this._removeHashElement(n)))}}else K(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 K(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<s;r++)dD.put(n[r]);n.length=0,this._currentTarget===i?this._currentTargetSalvaged=!0:this._removeHashElement(i)}this.unscheduleUpdate(e)}else K(1510)}},i.unscheduleAll=function(){this.unscheduleAllWithMinPriority(wE.Priority.SCHEDULER)},i.unscheduleAllWithMinPriority=function(e){var t,i,n,r=this._arrayForTimers;for(t=r.length-1;t>=0;t--)i=r[t],this.unscheduleAllForTarget(i.target);var s=0;if(e<0)for(t=0;t<this._updatesNegList.length;)s=this._updatesNegList.length,(n=this._updatesNegList[t])&&n.priority>=e&&this.unscheduleUpdate(n.target),s===this._updatesNegList.length&&t++;if(e<=0)for(t=0;t<this._updates0List.length;)s=this._updates0List.length,(n=this._updates0List[t])&&this.unscheduleUpdate(n.target),s===this._updates0List.length&&t++;for(t=0;t<this._updatesPosList.length;)s=this._updatesPosList.length,(n=this._updatesPosList[t])&&n.priority>=e&&this.unscheduleUpdate(n.target),s===this._updatesPosList.length&&t++},i.isScheduled=function(e,t){J(e,1508),J(t,1509);var i=t.uuid||t.id;if(!i)return K(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<r.length;++s)if(e===r[s]._callback)return!0;return!1},i.pauseAllTargets=function(){return this.pauseAllTargetsWithMinPriority(wE.Priority.SCHEDULER)},i.pauseAllTargetsWithMinPriority=function(e){var t,i,n,r,s=[],a=this._arrayForTimers;for(i=0,n=a.length;i<n;i++)(t=a[i])&&(t.paused=!0,s.push(t.target));if(e<0)for(i=0;i<this._updatesNegList.length;i++)(r=this._updatesNegList[i])&&r.priority>=e&&(r.paused=!0,s.push(r.target));if(e<=0)for(i=0;i<this._updates0List.length;i++)(r=this._updates0List[i])&&(r.paused=!0,s.push(r.target));for(i=0;i<this._updatesPosList.length;i++)(r=this._updatesPosList[i])&&r.priority>=e&&(r.paused=!0,s.push(r.target));return s},i.resumeTargets=function(e){if(e)for(var t=0;t<e.length;t++)this.resumeTarget(e[t])},i.pauseTarget=function(e){J(e,1503);var t=e.uuid||e.id;if(t){var i=this._hashForTimers[t];i&&(i.paused=!0);var n=this._hashForUpdates[t];n&&(n.entry.paused=!0)}else K(1510)},i.resumeTarget=function(e){J(e,1504);var t=e.uuid||e.id;if(t){var i=this._hashForTimers[t];i&&(i.paused=!1);var n=this._hashForUpdates[t];n&&(n.entry.paused=!1)}else K(1510)},i.isTargetPaused=function(e){J(e,1505);var t=e.uuid||e.id;if(!t)return K(1510),!1;var i=this._hashForTimers[t];if(i)return i.paused;var n=this._hashForUpdates[t];return!!n&&n.entry.paused},i._removeHashElement=function(e){var t=e.target.uuid||e.target.id;delete this._hashForTimers[t];for(var i=this._arrayForTimers,n=0,r=i.length;n<r;n++)if(i[n]===e){i.splice(n,1);break}fD.put(e)},i._removeUpdateFromHash=function(e){var t=e.target.uuid||e.target.id,i=this._hashForUpdates[t];if(i){for(var n=i.list,r=i.entry,s=0,a=n.length;s<a;s++)if(n[s]===r){n.splice(s,1);break}delete this._hashForUpdates[t],lD.put(r),_D.put(i)}},i._priorityIn=function(e,t,i){for(var n=0;n<e.length;n++)if(i<e[n].priority)return void e.splice(n,0,t);e.push(t)},i._appendIn=function(e,t){e.push(t)},t}(wE));pD.ID="scheduler",R.Scheduler=pD;var mD,gD=e("et",function(){function e(e){this._root=void 0,this._name="",this._cameras=[],this._models=[],this._batches=[],this._directionalLights=[],this._sphereLights=[],this._spotLights=[],this._mainLight=null,this._modelId=0,this._root=e}e.registerCreateFunc=function(t){t._createSceneFun=function(t){return new e(t)}};var t=e.prototype;return t.initialize=function(e){return this._name=e.name,!0},t.update=function(e){var t=this._mainLight;t&&t.update();for(var i=this._sphereLights,n=0;n<i.length;n++)i[n].update();for(var r=this._spotLights,s=0;s<r.length;s++)r[s].update();for(var a=this._models,o=0;o<a.length;o++){var u=a[o];u.enabled&&(u.updateTransform(e),u.updateUBOs(e))}},t.destroy=function(){this.removeCameras(),this.removeSphereLights(),this.removeSpotLights(),this.removeModels()},t.addCamera=function(e){e.attachToScene(this),this._cameras.push(e)},t.removeCamera=function(e){for(var t=0;t<this._cameras.length;++t)if(this._cameras[t]===e)return this._cameras.splice(t,1),void e.detachFromScene()},t.removeCameras=function(){for(var e,t=E(this._cameras);!(e=t()).done;)e.value.detachFromScene();this._cameras.splice(0)},t.setMainLight=function(e){this._mainLight=e},t.unsetMainLight=function(e){if(this._mainLight===e){var t=this._directionalLights;if(t.length)return this.setMainLight(t[t.length-1]),void(this._mainLight.node&&(this._mainLight.node.hasChangedFlags|=eE.ROTATION));this.setMainLight(null)}},t.addDirectionalLight=function(e){e.attachToScene(this),this._directionalLights.push(e)},t.removeDirectionalLight=function(e){for(var t=0;t<this._directionalLights.length;++t)if(this._directionalLights[t]===e)return e.detachFromScene(),void this._directionalLights.splice(t,1)},t.addSphereLight=function(e){e.attachToScene(this),this._sphereLights.push(e)},t.removeSphereLight=function(e){for(var t=0;t<this._sphereLights.length;++t)if(this._sphereLights[t]===e)return e.detachFromScene(),void this._sphereLights.splice(t,1)},t.addSpotLight=function(e){e.attachToScene(this),this._spotLights.push(e)},t.removeSpotLight=function(e){for(var t=0;t<this._spotLights.length;++t)if(this._spotLights[t]===e)return e.detachFromScene(),void this._spotLights.splice(t,1)},t.removeSphereLights=function(){for(var e=0;e<this._sphereLights.length;++e)this._sphereLights[e].detachFromScene();this._sphereLights.length=0},t.removeSpotLights=function(){for(var e=0;e<this._spotLights.length;++e)this._spotLights[e].detachFromScene();this._spotLights=[]},t.addModel=function(e){e.attachToScene(this),this._models.push(e)},t.removeModel=function(e){for(var t=0;t<this._models.length;++t)if(this._models[t]===e)return e.detachFromScene(),void this._models.splice(t,1)},t.removeModels=function(){for(var e,t=E(this._models);!(e=t()).done;){var i=e.value;i.detachFromScene(),i.destroy()}this._models.length=0},t.addBatch=function(e){this._batches.push(e)},t.removeBatch=function(e){for(var t=0;t<this._batches.length;++t)if(this._batches[t]===e)return void this._batches.splice(t,1)},t.removeBatches=function(){this._batches.length=0},t.onGlobalPipelineStateChanged=function(){for(var e,t=E(this._models);!(e=t()).done;)e.value.onGlobalPipelineStateChanged()},t.generateModelId=function(){return this._modelId++},c(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}}]),e}()),vD=((mD={})[Ca.PORTRAIT]=pn.IDENTITY,mD[Ca.LANDSCAPE_RIGHT]=pn.ROTATE_90,mD[Ca.PORTRAIT_UPSIDE_DOWN]=pn.ROTATE_180,mD[Ca.LANDSCAPE_LEFT]=pn.ROTATE_270,mD),yD=function(){function e(){this._title="",this._width=1,this._height=1,this._swapchain=null,this._renderPass=null,this._colorTextures=[],this._depthStencilTexture=null,this._cameras=[],this._hasOnScreenAttachments=!1,this._hasOffScreenAttachments=!1,this._framebuffer=null}e.registerCreateFunc=function(t){t._createWindowFun=function(t){return new e(t)}};var t=e.prototype;return t.initialize=function(e,t){if(void 0!==t.title&&(this._title=t.title),void 0!==t.swapchain&&(this._swapchain=t.swapchain),this._width=t.width,this._height=t.height,this._renderPass=e.createRenderPass(t.renderPassInfo),t.swapchain)this._swapchain=t.swapchain,this._colorTextures.push(t.swapchain.colorTexture),this._depthStencilTexture=t.swapchain.depthStencilTexture;else{for(var i=0;i<t.renderPassInfo.colorAttachments.length;i++)this._colorTextures.push(e.createTexture(new Or(bn.TEX2D,wn.COLOR_ATTACHMENT|wn.SAMPLED|wn.TRANSFER_SRC,t.renderPassInfo.colorAttachments[i].format,this._width,this._height)));t.renderPassInfo.depthStencilAttachment.format!==gn.UNKNOWN&&(this._depthStencilTexture=e.createTexture(new Or(bn.TEX2D,wn.DEPTH_STENCIL_ATTACHMENT|wn.SAMPLED,t.renderPassInfo.depthStencilAttachment.format,this._width,this._height)),this._hasOffScreenAttachments=!0)}return this._framebuffer=e.createFramebuffer(new Zr(this._renderPass,this._colorTextures,this._depthStencilTexture)),!0},t.destroy=function(){this.clearCameras(),this._framebuffer&&(this._framebuffer.destroy(),this._framebuffer=null),this._depthStencilTexture&&(this._depthStencilTexture.destroy(),this._depthStencilTexture=null);for(var e=0;e<this._colorTextures.length;e++){var t=this._colorTextures[e];t&&t.destroy()}this._colorTextures.length=0},t.resize=function(e,t){if(this._swapchain)this._swapchain.resize(e,t,vD[La.orientation]),this._width=this._swapchain.width,this._height=this._swapchain.height;else{for(var i=0;i<this._colorTextures.length;i++)this._colorTextures[i].resize(e,t);this._depthStencilTexture&&this._depthStencilTexture.resize(e,t),this._width=e,this._height=t}this.framebuffer&&(this.framebuffer.destroy(),this.framebuffer.initialize(new Zr(this._renderPass,this._colorTextures,this._depthStencilTexture)));for(var n,r=E(this._cameras);!(n=r()).done;)n.value.resize(e,t)},t.extractRenderCameras=function(e){for(var t=0;t<this._cameras.length;t++){var i=this._cameras[t];i.enabled&&(i.update(),e.push(i))}},t.attachCamera=function(e){for(var t=0;t<this._cameras.length;t++)if(this._cameras[t]===e)return;this._cameras.push(e),this.sortCameras()},t.detachCamera=function(e){for(var t=0;t<this._cameras.length;++t)if(this._cameras[t]===e)return void this._cameras.splice(t,1)},t.clearCameras=function(){this._cameras.length=0},t.sortCameras=function(){this._cameras.sort((function(e,t){return e.priority-t.priority}))},c(e,[{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"swapchain",get:function(){return this._swapchain}},{key:"framebuffer",get:function(){return this._framebuffer}},{key:"cameras",get:function(){return this._cameras}}]),e}(),ED=e("d0",function(){function e(e){var t=this;this._createSceneFun=null,this._createWindowFun=null,this._device=void 0,this._windows=[],this._mainWindow=null,this._curWindow=null,this._tempWindow=null,this._usesCustomPipeline=!0,this._pipeline=null,this._pipelineEvent=null,this._classicPipeline=null,this._customPipeline=null,this._batcher=null,this._dataPoolMgr=void 0,this._scenes=[],this._modelPools=new Map,this._cameraPool=null,this._lightPools=new Map,this._debugView=new LN,this._fpsTime=0,this._frameCount=0,this._fps=0,this._fixedFPS=0,this._useDeferredPipeline=!1,this._fixedFPSFrameTime=0,this._cumulativeTime=0,this._frameTime=0,this._device=e,this._dataPoolMgr=R.internal.DataPoolManager&&new R.internal.DataPoolManager(e),gD.registerCreateFunc(this),yD.registerCreateFunc(this),this._cameraPool=new ra((function(){return new aA(t._device)}),4,(function(e){return e.destroy()}))}var t=e.prototype;return t.initialize=function(){var e,t=Va.swapchain,i=new Vr;i.format=t.colorTexture.format;var n=new Wr;n.format=t.depthStencilTexture.format,n.depthStoreOp=Gn.DISCARD,n.stencilStoreOp=Gn.DISCARD;var r=new Yr([i],n);this._mainWindow=this.createWindow({title:"rootMainWindow",width:t.width,height:t.height,renderPassInfo:r,swapchain:t}),this._curWindow=this._mainWindow;var s=Tt.querySettings(Et.Category.ANIMATION,"customJointTextureLayouts")||[];null===(e=this._dataPoolMgr)||void 0===e||e.jointTexturePool.registerCustomTextureLayouts(s),this._resizeMaxJointForDS()},t.destroy=function(){this.destroyScenes(),this._pipeline&&(this._pipeline.destroy(),this._pipeline=null,this._pipelineEvent=null),this._batcher&&(this._batcher.destroy(),this._batcher=null),this._curWindow=null,this._mainWindow=null,this.dataPoolManager.clear()},t.resize=function(e,t){for(var i,n=E(this._windows);!(i=n()).done;){var r=i.value;r.swapchain&&r.resize(e,t)}},t.setRenderPipeline=function(e){e instanceof aD&&(this._useDeferredPipeline=!0);var t=!1;if(e||(e=oD(),t=!0),this._useDeferredPipeline&&this.device.hasFeature(mn.COMPUTE_SHADER)||(e.clusterEnabled=!1),e.bloomEnabled=!1,this.usesCustomPipeline&&R.internal.createCustomPipeline?(this._customPipeline=R.internal.createCustomPipeline(),t=!0,this._pipeline=this._customPipeline):(this._classicPipeline=e,this._pipeline=this._classicPipeline,this._pipelineEvent=this._classicPipeline,this._usesCustomPipeline=!1),!this._pipeline.activate(this._mainWindow.swapchain))return t&&this._pipeline.destroy(),this._classicPipeline=null,this._customPipeline=null,this._pipeline=null,this._pipelineEvent=null,!1;var i=R.director.getScene();return i&&i.globals.activate(),this.onGlobalPipelineStateChanged(),!(!this._batcher&&R.internal.Batcher2D&&(this._batcher=new R.internal.Batcher2D(this),!this._batcher.initialize())&&(this.destroy(),1))},t.onGlobalPipelineStateChanged=function(){for(var e=0;e<this._scenes.length;e++)this._scenes[e].onGlobalPipelineStateChanged();this._pipeline.onGlobalPipelineStateChanged()},t.activeWindow=function(e){this._curWindow=e},t.resetCumulativeTime=function(){this._cumulativeTime=0},t.frameMove=function(e){this._frameTime=e,++this._frameCount,this._cumulativeTime+=e,this._fpsTime+=e,this._fpsTime>1&&(this._fps=this._frameCount,this._frameCount=0,this._fpsTime=0);for(var t=0;t<this._scenes.length;++t)this._scenes[t].removeBatches();for(var i=this._windows,n=[],r=0;r<i.length;r++)i[r].extractRenderCameras(n);if(this._pipeline&&n.length>0){this._device.acquire([Va.swapchain]);var s=this._scenes,a=R.director.getTotalFrames();this._batcher&&(this._batcher.update(),this._batcher.uploadBuffers());for(var o=0;o<s.length;o++)s[o].update(a);R.director.emit(R.Director.EVENT_BEFORE_COMMIT),n.sort((function(e,t){return e.priority-t.priority}));for(var u=0;u<n.length;++u){var h;null===(h=n[u].geometryRenderer)||void 0===h||h.update()}this._pipeline.render(n),this._device.present()}this._batcher&&this._batcher.reset()},t.createWindow=function(e){var t=this._createWindowFun(this);return t.initialize(this.device,e),this._windows.push(t),t},t.destroyWindow=function(e){for(var t=0;t<this._windows.length;++t)if(this._windows[t]===e)return e.destroy(),void this._windows.splice(t,1)},t.destroyWindows=function(){for(var e,t=E(this._windows);!(e=t()).done;)e.value.destroy();this._windows.length=0},t.createScene=function(e){var t=this._createSceneFun(this);return t.initialize(e),this._scenes.push(t),t},t.destroyScene=function(e){for(var t=0;t<this._scenes.length;++t)if(this._scenes[t]===e)return e.destroy(),void this._scenes.splice(t,1)},t.destroyScenes=function(){for(var e,t=E(this._scenes);!(e=t()).done;)e.value.destroy();this._scenes.length=0},t.createModel=function(e){var t=this._modelPools.get(e);t||(this._modelPools.set(e,new ra((function(){return new e}),10,(function(e){return e.destroy()}))),t=this._modelPools.get(e));var i=t.alloc();return i.initialize(),i},t.destroyModel=function(e){var t=this._modelPools.get(e.constructor);t?(t.free(e),e.scene&&e.scene.removeModel(e)):Y(1300,e.constructor.name),e.destroy()},t.createCamera=function(){return this._cameraPool.alloc()},t.createLight=function(e){var t=this._lightPools.get(e);t||(this._lightPools.set(e,new ra((function(){return new e}),4,(function(e){return e.destroy()}))),t=this._lightPools.get(e));var i=t.alloc();return i.initialize(),i},t.destroyLight=function(e){if(e.scene)switch(e.type){case yN.DIRECTIONAL:e.scene.removeDirectionalLight(e);break;case yN.SPHERE:e.scene.removeSphereLight(e);break;case yN.SPOT:e.scene.removeSpotLight(e)}e.destroy()},t.recycleLight=function(e){var t=this._lightPools.get(e.constructor);if(t&&(t.free(e),e.scene))switch(e.type){case yN.DIRECTIONAL:e.scene.removeDirectionalLight(e);break;case yN.SPHERE:e.scene.removeSphereLight(e);break;case yN.SPOT:e.scene.removeSpotLight(e)}},t._resizeMaxJointForDS=function(){var e=Math.floor((Va.gfxDevice.capabilities.maxVertexUniformVectors-38)/3);fp(e=e<256?e:256)},c(e,[{key:"device",get:function(){return this._device}},{key:"mainWindow",get:function(){return this._mainWindow}},{key:"curWindow",get:function(){return this._curWindow},set:function(e){this._curWindow=e}},{key:"tempWindow",get:function(){return this._tempWindow},set:function(e){this._tempWindow=e}},{key:"windows",get:function(){return this._windows}},{key:"usesCustomPipeline",get:function(){return this._usesCustomPipeline&&""!==At.CUSTOM_PIPELINE_NAME}},{key:"pipeline",get:function(){return this._pipeline}},{key:"customPipeline",get:function(){return this._customPipeline}},{key:"pipelineEvent",get:function(){return this._pipelineEvent}},{key:"batcher2D",get:function(){return this._batcher}},{key:"scenes",get:function(){return this._scenes}},{key:"debugView",get:function(){return this._debugView}},{key:"cumulativeTime",get:function(){return this._cumulativeTime}},{key:"frameTime",get:function(){return this._frameTime}},{key:"frameCount",get:function(){return this._frameCount}},{key:"fps",get:function(){return this._fps}},{key:"fixedFPS",get:function(){return this._fixedFPS},set:function(e){e>0?(this._fixedFPS=e,this._fixedFPSFrameTime=1e3/e):this._fixedFPSFrameTime=0}},{key:"dataPoolManager",get:function(){return this._dataPoolMgr}},{key:"useDeferredPipeline",get:function(){return this._useDeferredPipeline}}]),e}());R.Root=ED;var TD=function(){function e(){this._rafHandle=0,this._stHandle=0,this._onTick=null,this._targetFrameRate=60,this._frameTime=0,this._startTime=0,this._isPlaying=!1,this._rAF=void 0,this._cAF=void 0,this._rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||this._stTime.bind(this),this._cAF=window.cancelAnimationFrame||window.cancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.ocancelAnimationFrame||this._ctTime.bind(this)}var t=e.prototype;return t.start=function(){var e=this;this._isPlaying||(60===this._targetFrameRate?this._rafHandle=this._rAF.call(window,(function t(){e._isPlaying&&(e._rafHandle=e._rAF.call(window,t)),e._onTick&&e._onTick()})):(this._startTime=performance.now(),this._stHandle=this._stTime((function t(){e._startTime=performance.now(),e._isPlaying&&(e._stHandle=e._stTime(t)),e._onTick&&e._onTick()}))),this._isPlaying=!0)},t.stop=function(){this._isPlaying&&(this._cAF.call(window,this._rafHandle),this._ctTime(this._stHandle),this._rafHandle=this._stHandle=0,this._isPlaying=!1)},t._stTime=function(e){var t=performance.now(),i=Math.max(0,t-this._startTime),n=Math.max(0,this._frameTime-i);return setTimeout(e,n)},t._ctTime=function(e){clearTimeout(e)},c(e,[{key:"targetFrameRate",get:function(){return this._targetFrameRate},set:function(e){this._targetFrameRate!==e&&(this._targetFrameRate=e,this._frameTime=1e3/this._targetFrameRate,this._isPlaying&&(this.stop(),this.start()))}},{key:"onTick",get:function(){return this._onTick},set:function(e){this._onTick=e}}]),e}(),AD=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,_t.array.fastRemoveAt(this._allRenderers,t),e._internalId=-1,e._dirtyVersion===this._dirtyVersion&&(_t.array.fastRemove(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;i<e;i++)t[i].updateRenderer();this._dirtyRenderers.length=0,this._dirtyVersion++},e}(),SD=e("ej",new AD),bD=e("d3",function(e){function t(){var t;return(t=e.call(this)||this)._compScheduler=void 0,t._nodeActivator=void 0,t._invalid=void 0,t._paused=void 0,t._root=void 0,t._loadingScene=void 0,t._scene=void 0,t._totalFrames=void 0,t._scheduler=void 0,t._systems=void 0,t._persistRootNodes={},t._invalid=!1,t._paused=!1,t._root=null,t._loadingScene="",t._scene=null,t._totalFrames=0,t._scheduler=new pD,t._compScheduler=new _I,t._nodeActivator=new BO,t._systems=[],t}_(t,e);var i=t.prototype;return i.calculateDeltaTime=function(){},i.end=function(){var e=this;this.once(t.EVENT_END_FRAME,(function(){e.purgeDirector()}))},i.pause=function(){this._paused||(this._paused=!0)},i.purgeDirector=function(){this._scheduler.unscheduleAll(),this._compScheduler.unscheduleAll(),this._nodeActivator.reset(),R.isValid(this._scene)&&this._scene.destroy(),this._scene=null,this.stopAnimation(),R.assetManager.releaseAll()},i.reset=function(){var e;for(var i in this.purgeDirector(),this._persistRootNodes)this.removePersistRootNode(this._persistRootNodes[i]);null===(e=this.getScene())||void 0===e||e.destroy(),this.emit(t.EVENT_RESET),this.startAnimation()},i.runSceneImmediate=function(e,i,n){var r=this;e instanceof SF&&(e=e.scene),J(e instanceof QR,1216),e._load();for(var s=Object.keys(this._persistRootNodes).map((function(e){return r._persistRootNodes[e]})),a=0;a<s.length;a++){var o=s[a];o.emit(SE.EventType.SCENE_CHANGED_FOR_PERSISTS,e.renderScene);var u=e.uuid===o._originalSceneId&&e.getChildByUuid(o.uuid);if(u){var h=u.getSiblingIndex();o.hideFlags&=~ca.Flags.DontSave,o.hideFlags|=ca.Flags.DontSave&u.hideFlags,u._destroyImmediate(),e.insertChild(o,h)}else o.hideFlags|=ca.Flags.DontSave,o.parent=e}var c=this._scene;R.isValid(c)&&c.destroy(),R.assetManager._releaseManager._autoRelease(c,e,this._persistRootNodes),this._scene=null,ca._deferredDestroy(),i&&i(),this.emit(t.EVENT_BEFORE_SCENE_LAUNCH,e),this._scene=e,e._activate(),this._root&&this._root.resetCumulativeTime(),this.startAnimation(),n&&n(null,e),this.emit(t.EVENT_AFTER_SCENE_LAUNCH,e)},i.runScene=function(e,i,n){var r=this;e instanceof SF&&(e=e.scene),J(e,1205),J(e instanceof QR,1216),e._load(),this.once(t.EVENT_END_FRAME,(function(){r.runSceneImmediate(e,i,n)}))},i.loadScene=function(e,i,n){var r=this;if(this._loadingScene)return Y(1208,e,this._loadingScene),!1;var s=R.assetManager.bundles.find((function(t){return!!t.getSceneInfo(e)}));return s?(this.emit(t.EVENT_BEFORE_SCENE_LOADING,e),this._loadingScene=e,console.time("LoadScene "+e),s.loadScene(e,(function(t,s){console.timeEnd("LoadScene "+e),r._loadingScene="",t?(U(t),i&&i(t)):r.runSceneImmediate(s,n,i)})),!0):(K(1209,e),!1)},i.preloadScene=function(e,t,i){var n=R.assetManager.bundles.find((function(t){return!!t.getSceneInfo(e)}));if(n)n.preloadScene(e,null,t,i);else{var r='Can not preload the scene "'+e+'" because it is not in the build settings.';i&&i(new Error(r)),U("preloadScene: "+r)}},i.resume=function(){this._paused&&(this._paused=!1)},i.getScene=function(){return this._scene},i.getDeltaTime=function(){return R.game.deltaTime},i.getTotalTime=function(){return R.game.totalTime},i.getCurrentTime=function(){return R.game.frameStartTime},i.getTotalFrames=function(){return this._totalFrames},i.isPaused=function(){return this._paused},i.getScheduler=function(){return this._scheduler},i.setScheduler=function(e){this._scheduler!==e&&(this.unregisterSystem(this._scheduler),this._scheduler=e,this.registerSystem(pD.ID,e,200))},i.registerSystem=function(e,t,i){t.id=e,t.priority=i,this._systems.push(t),this._systems.sort(wE.sortByPriority)},i.unregisterSystem=function(e){_t.array.fastRemove(this._systems,e),this._systems.sort(wE.sortByPriority)},i.getSystem=function(e){return this._systems.find((function(t){return t.id===e}))},i.getAnimationManager=function(){return this.getSystem(R.AnimationManager.ID)},i.startAnimation=function(){this._invalid=!1},i.stopAnimation=function(){this._invalid=!0},i.mainLoop=function(e){var t;t=R.game._calculateDT(e),this.tick(t)},i.tick=function(e){if(!this._invalid){if(this.emit(t.EVENT_BEGIN_FRAME),NR._frameDispatchEvents(),!this._paused){this.emit(t.EVENT_BEFORE_UPDATE),this._compScheduler.startPhase(),this._compScheduler.updatePhase(e);for(var i=0;i<this._systems.length;++i)this._systems[i].update(e);this._compScheduler.lateUpdatePhase(e),this.emit(t.EVENT_AFTER_UPDATE),ca._deferredDestroy();for(var n=0;n<this._systems.length;++n)this._systems[n].postUpdate(e)}this.emit(t.EVENT_BEFORE_DRAW),SD.updateAllDirtyRenderers(),this._root.frameMove(e),this.emit(t.EVENT_AFTER_DRAW),SE.resetHasChangedFlags(),SE.clearNodeArray(),ia.update(e),this.emit(t.EVENT_END_FRAME),this._totalFrames++}},i.init=function(){this._totalFrames=0,this._paused=!1,this.registerSystem(pD.ID,this._scheduler,200),this._root=new ED(Va.gfxDevice),this._root.initialize({});for(var e=0;e<this._systems.length;e++)this._systems[e].init();this.emit(t.EVENT_INIT)},i.addPersistRootNode=function(e){if(R.Node.isNode(e)&&e.uuid){var t=e.uuid;if(!this._persistRootNodes[t]){var i=this._scene;if(R.isValid(i))if(e.parent){if(!(e.parent instanceof QR))return void Y(3801);if(e.parent!==i)return void Y(3802);e._originalSceneId=i.uuid}else e.parent=i,e._originalSceneId=i.uuid;this._persistRootNodes[t]=e,e._persistNode=!0,R.assetManager._releaseManager._addPersistNodeRef(e)}}else Y(3800)},i.removePersistRootNode=function(e){var t=e.uuid||"";e===this._persistRootNodes[t]&&(delete this._persistRootNodes[t],e._persistNode=!1,e._originalSceneId="",R.assetManager._releaseManager._removePersistNodeRef(e))},i.isPersistRootNode=function(e){return!!e._persistNode},c(t,[{key:"root",get:function(){return this._root}}]),t}(Aa));bD.EVENT_INIT="director_init",bD.EVENT_RESET="director_reset",bD.EVENT_BEFORE_SCENE_LOADING="director_before_scene_loading",bD.EVENT_BEFORE_SCENE_LAUNCH="director_before_scene_launch",bD.EVENT_AFTER_SCENE_LAUNCH="director_after_scene_launch",bD.EVENT_BEFORE_UPDATE="director_before_update",bD.EVENT_AFTER_UPDATE="director_after_update",bD.EVENT_BEFORE_DRAW="director_before_draw",bD.EVENT_AFTER_DRAW="director_after_draw",bD.EVENT_BEFORE_COMMIT="director_before_commit",bD.EVENT_BEFORE_PHYSICS="director_before_physics",bD.EVENT_AFTER_PHYSICS="director_after_physics",bD.EVENT_BEGIN_FRAME="director_begin_frame",bD.EVENT_END_FRAME="director_end_frame",bD.instance=void 0,R.Director=bD;var wD=e("di",bD.instance=R.director=new bD),RD=e("f$",function(e){function i(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).frame=null,t.container=null,t.canvas=null,t.renderType=-1,t.eventTargetOn=e.prototype.on,t.eventTargetOnce=e.prototype.once,t.config={},t.onStart=null,t.frameTime=1e3/60,t._isCloning=!1,t._inited=!1,t._engineInited=!1,t._rendererInitialized=!1,t._paused=!0,t._frameRate=60,t._pacer=null,t._initTime=0,t._startTime=0,t._deltaTime=0,t._shouldLoadLaunchScene=!0,t.onPreBaseInitDelegate=new Na,t.onPostBaseInitDelegate=new Na,t.onPreInfrastructureInitDelegate=new Na,t.onPostInfrastructureInitDelegate=new Na,t.onPreSubsystemInitDelegate=new Na,t.onPostSubsystemInitDelegate=new Na,t.onPreProjectInitDelegate=new Na,t.onPostProjectInitDelegate=new Na,t}_(i,e);var n=i.prototype;return n.setFrameRate=function(e){this.frameRate=e},n.getFrameRate=function(){return this.frameRate},n.step=function(){wD.tick(this.frameTime/1e3)},n.pause=function(){var e;this._paused||(this._paused=!0,null===(e=this._pacer)||void 0===e||e.stop())},n.resume=function(){var e;this._paused&&(NR._clearEvents(),this._paused=!1,null===(e=this._pacer)||void 0===e||e.start())},n.isPaused=function(){return this._paused},n.restart=function(){var e=this;return new Promise((function(e){wD.once(bD.EVENT_END_FRAME,(function(){return e()}))})).then((function(){wD.reset(),R.Object._deferredDestroy(),e.pause(),e.resume(),e._shouldLoadLaunchScene=!0,hD.instance.curTime=0,e._safeEmit(i.EVENT_RESTART)}))},n.end=function(){xa.close()},n.on=function(e,t,n,r){return(this._engineInited&&e===i.EVENT_ENGINE_INITED||this._inited&&e===i.EVENT_GAME_INITED||this._rendererInitialized&&e===i.EVENT_RENDERER_INITED)&&t.call(n),this.eventTargetOn(e,t,n,r)},n.once=function(e,t,n){return this._engineInited&&e===i.EVENT_ENGINE_INITED?t.call(n):this.eventTargetOnce(e,t,n)},n.init=function(e){var n=this;return this._compatibleWithOldParams(e),Promise.resolve().then((function(){return n.emit(i.EVENT_PRE_BASE_INIT),n.onPreBaseInitDelegate.dispatch()})).then((function(){k(e.debugMode||Q.NONE),ka.init(),n._initEvents()})).then((function(){return Tt.init(e.settingsPath,e.overrideSettings)})).then((function(){return n.emit(i.EVENT_POST_BASE_INIT),n.onPostBaseInitDelegate.dispatch()})).then((function(){return n.emit(i.EVENT_PRE_INFRASTRUCTURE_INIT),n.onPreInfrastructureInitDelegate.dispatch()})).then((function(){At.init();var e={frame:document.querySelector("#GameDiv"),container:document.querySelector("#Cocos3dGameContainer"),canvas:document.querySelector("#GameCanvas")};e&&(n.canvas=e.canvas,n.frame=e.frame,n.container=e.container),Ua.init(),nr.init(),Va.init(n.canvas,zd),Wv.init(),Kv.init(),bd.init(),n.initPacer()})).then((function(){return n.emit(i.EVENT_POST_INFRASTRUCTURE_INIT),n.onPostInfrastructureInitDelegate.dispatch()})).then((function(){return n.emit(i.EVENT_PRE_SUBSYSTEM_INIT),n.onPreSubsystemInitDelegate.dispatch()})).then((function(){return wD.init(),Kv.loadBuiltinAssets()})).then((function(){return n.emit(i.EVENT_POST_SUBSYSTEM_INIT),n.onPostSubsystemInitDelegate.dispatch()})).then((function(){L("Cocos Creator v"+I),n.emit(i.EVENT_ENGINE_INITED),n._engineInited=!0})).then((function(){return n.emit(i.EVENT_PRE_PROJECT_INIT),n.onPreProjectInitDelegate.dispatch()})).then((function(){var e=Tt.querySettings(Et.Category.PLUGINS,"jsList"),t=Promise.resolve();return e&&(Tt.querySettings(Et.Category.PATH,"projectPath"),e.forEach((function(e){t=t.then((function(){return t="src/"+e,new Promise((function(e,i){var n;function r(e){e.filename===t&&(n=e.error)}window.addEventListener("error",r);var s=document.createElement("script");s.charset="utf-8",s.async=!0,s.crossOrigin="anonymous",s.addEventListener("error",(function(){window.removeEventListener("error",r),i(Error("Error loading "+t))})),s.addEventListener("load",(function(){window.removeEventListener("error",r),document.head.removeChild(s),n?i(n):e()})),s.src=t.replace("#","%23"),document.head.appendChild(s)}));var t}))}))),t})).then((function(){var e=Tt.querySettings(Et.Category.SCRIPTING,"scriptPackages");return e?Promise.all(e.map((function(e){return t.import(e)}))):Promise.resolve([])})).then((function(){return n._loadProjectBundles()})).then((function(){return n._setupRenderPipeline()})).then((function(){return n._loadPreloadAssets()})).then((function(){return Kv.compileBuiltinMaterial(),hD.instance.init()})).then((function(){return n.emit(i.EVENT_POST_PROJECT_INIT),n.onPostProjectInitDelegate.dispatch()})).then((function(){n._inited=!0,n._safeEmit(i.EVENT_GAME_INITED)}))},n._compatibleWithOldParams=function(e){var t=e.overrideSettings=e.overrideSettings||{};"showFPS"in e&&(t.profiling=t.profiling||{},t.profiling.showFPS=e.showFPS),"frameRate"in e&&(t.screen=t.screen||{},t.screen.frameRate=e.frameRate),"renderMode"in e&&(t.rendering=t.rendering||{},t.rendering.renderMode=e.renderMode),"renderPipeline"in e&&(t.rendering=t.rendering||{},t.rendering.renderPipeline=e.renderPipeline),"assetOptions"in e&&(t.assets=t.assets||{},Object.assign(t.assets,e.assetOptions)),"customJointTextureLayouts"in e&&(t.animation=t.animation||{},t.animation.customJointTextureLayouts=e.customJointTextureLayouts),"physics"in e&&(t.physics=t.physics||{},Object.assign(t.physics,e.physics)),"orientation"in e&&(t.screen=t.screen||{},t.screen.orientation=e.orientation),"exactFitScreen"in e&&(t.screen=t.screen||{},t.screen.exactFitScreen=e.exactFitScreen)},n._loadPreloadAssets=function(){var e=Tt.querySettings(Et.Category.ASSETS,"preloadAssets");return e?Promise.all(e.map((function(e){return new Promise((function(t,i){Wv.loadAny(e,(function(e){e?i(e):t()}))}))}))):Promise.resolve([])},n._loadProjectBundles=function(){var e=Tt.querySettings(Et.Category.ASSETS,"preloadBundles");return e?Promise.all(e.map((function(e){var t=e.bundle,i=e.version;return new Promise((function(e,n){var r={};i&&(r.version=i),Wv.loadBundle(t,r,(function(t){t?n(t):e()}))}))}))):Promise.resolve([])},n.run=function(e){e&&(this.onStart=e),this._inited&&!b&&this.resume()},n._calculateDT=function(){var e=performance.now();return this._deltaTime=e>this._startTime?(e-this._startTime)/1e3:0,this._deltaTime>i.DEBUG_DT_THRESHOLD&&(this._deltaTime=this.frameTime/1e3),this._startTime=e,this._deltaTime},n._updateCallback=function(){var e=this;if(this._inited)if(hD.instance.isFinished)if(this._shouldLoadLaunchScene){this._shouldLoadLaunchScene=!1;var t,i=Tt.querySettings(Et.Category.LAUNCH,"launchScene");i?wD.loadScene(i,(function(){var t;console.log("Success to load scene: "+i),e._initTime=performance.now(),wD.startAnimation(),null===(t=e.onStart)||void 0===t||t.call(e)})):(this._initTime=performance.now(),wD.startAnimation(),null===(t=this.onStart)||void 0===t||t.call(this))}else wD.tick(this._calculateDT());else hD.instance.update(this._calculateDT())},n.initPacer=function(){var e,t=null!==(e=Tt.querySettings(Et.Category.SCREEN,"frameRate"))&&void 0!==e?e:60;G("number"==typeof t),this._pacer=new TD,this._pacer.onTick=this._updateCallback.bind(this),this.frameRate=t},n._initEvents=function(){xa.on("show",this._onShow,this),xa.on("hide",this._onHide,this)},n._onHide=function(){this.emit(i.EVENT_HIDE),this.pause()},n._onShow=function(){this.emit(i.EVENT_SHOW),this.resume()},n.addPersistRootNode=function(e){wD.addPersistRootNode(e)},n.removePersistRootNode=function(e){wD.removePersistRootNode(e)},n.isPersistRootNode=function(e){return wD.isPersistRootNode(e)},n._setupRenderPipeline=function(){var e=this,t=Tt.querySettings(Et.Category.RENDERING,"renderPipeline");return t?new Promise((function(e,i){Wv.loadAny(t,(function(t,n){return!t&&n instanceof QM?e(n):i(t)}))})).then((function(t){e._setRenderPipeline(t)})).catch((function(i){B(i),B("Failed load render pipeline: "+t+", engine failed to initialize, will fallback to default pipeline"),e._setRenderPipeline()})):this._setRenderPipeline()},n._setRenderPipeline=function(e){wD.root.setRenderPipeline(e)||this._setRenderPipeline(),this._rendererInitialized=!0,this._safeEmit(i.EVENT_RENDERER_INITED)},n._safeEmit=function(e){this.emit(e)},c(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}(Aa));RD.EVENT_HIDE="game_on_hide",RD.EVENT_SHOW="game_on_show",RD.EVENT_LOW_MEMORY="game_on_low_memory",RD.EVENT_GAME_INITED="game_inited",RD.EVENT_ENGINE_INITED="engine_inited",RD.EVENT_RENDERER_INITED="renderer_inited",RD.EVENT_PRE_BASE_INIT="pre_base_init",RD.EVENT_POST_BASE_INIT="post_base_init",RD.EVENT_PRE_INFRASTRUCTURE_INIT="pre_infrastructure_init",RD.EVENT_POST_INFRASTRUCTURE_INIT="post_infrastructure_init",RD.EVENT_PRE_SUBSYSTEM_INIT="pre_subsystem_init",RD.EVENT_POST_SUBSYSTEM_INIT="post_subsystem_init",RD.EVENT_PRE_PROJECT_INIT="pre_project_init",RD.EVENT_POST_PROJECT_INIT="post_project_init",RD.EVENT_RESTART="game_on_restart",RD.RENDER_TYPE_CANVAS=0,RD.RENDER_TYPE_WEBGL=1,RD.RENDER_TYPE_OPENGL=2,RD.RENDER_TYPE_HEADLESS=3,RD.DEBUG_DT_THRESHOLD=1,R.Game=RD;var ID,OD=e("d2",R.game=new RD),ND=e("eg",{topLeft:R.v2(0,0),topRight:R.v2(0,0),top:R.v2(0,0),bottomLeft:R.v2(0,0),bottomRight:R.v2(0,0),bottom:R.v2(0,0),center:R.v2(0,0),left:R.v2(0,0),right:R.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}});R.visibleRect=ND;var CD=new un,MD=((ID={})[At.ORIENTATION_AUTO]=Ca.AUTO,ID[At.ORIENTATION_LANDSCAPE]=Ca.LANDSCAPE,ID[At.ORIENTATION_PORTRAIT]=Ca.PORTRAIT,ID),xD=e("gF",function(e){function t(){var t;(t=e.call(this)||this)._designResolutionSize=void 0,t._scaleX=void 0,t._scaleY=void 0,t._viewportRect=void 0,t._visibleRect=void 0,t._autoFullScreen=void 0,t._retinaEnabled=void 0,t._resizeCallback=void 0,t._resolutionPolicy=void 0,t._rpExactFit=void 0,t._rpShowAll=void 0,t._rpNoBorder=void 0,t._rpFixedHeight=void 0,t._rpFixedWidth=void 0;var i=FD,n=PD;return t._designResolutionSize=new un(0,0),t._scaleX=1,t._scaleY=1,t._viewportRect=new cn(0,0,0,0),t._visibleRect=new cn(0,0,0,0),t._autoFullScreen=!1,t._retinaEnabled=!1,t._resizeCallback=null,t._rpExactFit=new DD(i.EQUAL_TO_FRAME,n.EXACT_FIT),t._rpShowAll=new DD(i.EQUAL_TO_FRAME,n.SHOW_ALL),t._rpNoBorder=new DD(i.EQUAL_TO_FRAME,n.NO_BORDER),t._rpFixedHeight=new DD(i.EQUAL_TO_FRAME,n.FIXED_HEIGHT),t._rpFixedWidth=new DD(i.EQUAL_TO_FRAME,n.FIXED_WIDTH),t._resolutionPolicy=t._rpShowAll,t}_(t,e);var i=t.prototype;return i.init=function(){var e=Ua.windowSize,t=e.width,i=e.height;this._designResolutionSize.width=t,this._designResolutionSize.height=i,this._viewportRect.width=t,this._viewportRect.height=i,this._visibleRect.width=t,this._visibleRect.height=i,CD.width=this._visibleRect.width,CD.height=this._visibleRect.height,ND&&ND.init(this._visibleRect),this.resizeWithBrowserSize(!0);var n=Tt.querySettings(Et.Category.SCREEN,"designResolution");n&&this.setDesignResolutionSize(Number(n.width),Number(n.height),n.policy||DD.FIXED_HEIGHT),La.on("window-resize",this._updateAdaptResult,this),La.on("orientation-change",this._updateAdaptResult,this),La.on("fullscreen-change",this._updateAdaptResult,this)},i.resizeWithBrowserSize=function(e){La.handleResizeEvent=e},i.setResizeCallback=function(e){"function"!=typeof e&&null!=e||(this._resizeCallback=e)},i.setOrientation=function(e){La.orientation=MD[e]},i.adjustViewportMeta=function(){},i.enableRetina=function(e){this._retinaEnabled=!!e},i.isRetinaEnabled=function(){return this._retinaEnabled},i.enableAutoFullScreen=function(e){e!==this._autoFullScreen&&(this._autoFullScreen=e,e&&Ua.requestFullScreen().catch((function(){})))},i.isAutoFullScreenEnabled=function(){return this._autoFullScreen},i.setCanvasSize=function(e,t){La.resolutionScale=1;var i=La.devicePixelRatio,n=new un(e*i,t*i);Ua.windowSize=n},i.getCanvasSize=function(){return Ua.windowSize},i.getFrameSize=function(){var e=La.devicePixelRatio,t=Ua.windowSize;return t.width/=e,t.height/=e,t},i.setFrameSize=function(e,t){var i=La.devicePixelRatio;Ua.windowSize=new un(e*i,t*i)},i.getVisibleSize=function(){return new un(this._visibleRect.width,this._visibleRect.height)},i.getVisibleSizeInPixel=function(){return new un(this._visibleRect.width*this._scaleX,this._visibleRect.height*this._scaleY)},i.getVisibleOrigin=function(){return new en(this._visibleRect.x,this._visibleRect.y)},i.getVisibleOriginInPixel=function(){return new en(this._visibleRect.x*this._scaleX,this._visibleRect.y*this._scaleY)},i.getResolutionPolicy=function(){return this._resolutionPolicy},i._updateResolutionPolicy=function(e){if(e instanceof DD)this._resolutionPolicy=e;else{var t=DD;e===t.EXACT_FIT&&(this._resolutionPolicy=this._rpExactFit),e===t.SHOW_ALL&&(this._resolutionPolicy=this._rpShowAll),e===t.NO_BORDER&&(this._resolutionPolicy=this._rpNoBorder),e===t.FIXED_HEIGHT&&(this._resolutionPolicy=this._rpFixedHeight),e===t.FIXED_WIDTH&&(this._resolutionPolicy=this._rpFixedWidth)}},i.setResolutionPolicy=function(e){this._updateResolutionPolicy(e);var t=LD.getDesignResolutionSize();LD.setDesignResolutionSize(t.width,t.height,e)},i.setDesignResolutionSize=function(e,t,i){if(e>0&&t>0){this._updateResolutionPolicy(i);var n=this._resolutionPolicy;n&&n.preApply(this),this._designResolutionSize.width=e,this._designResolutionSize.height=t;var r=n.apply(this,this._designResolutionSize);if(r.scale&&2===r.scale.length&&(this._scaleX=r.scale[0],this._scaleY=r.scale[1]),r.viewport){var s=this._viewportRect,a=this._visibleRect,o=r.viewport;s.x=o.x,s.y=o.y,s.width=o.width,s.height=o.height,a.x=0,a.y=0,a.width=o.width/this._scaleX,a.height=o.height/this._scaleY}n.postApply(this),CD.width=this._visibleRect.width,CD.height=this._visibleRect.height,ND&&ND.init(this._visibleRect),this.emit("design-resolution-changed")}else K(2200)},i.getDesignResolutionSize=function(){return new un(this._designResolutionSize.width,this._designResolutionSize.height)},i.setRealPixelResolution=function(e,t,i){document.documentElement.style.width=e+"px",document.body.style.width=e+"px",document.body.style.left="0px",document.body.style.top="0px",this.setDesignResolutionSize(e,t,i)},i.getViewportRect=function(){return this._viewportRect},i.getScaleX=function(){return this._scaleX},i.getScaleY=function(){return this._scaleY},i.getDevicePixelRatio=function(){return La.devicePixelRatio},i.convertToLocationInView=function(e,t,i,n){void 0===n&&(n=new en);var r=La.devicePixelRatio*(e-i.left),s=La.devicePixelRatio*(i.top+i.height-t);return La.isFrameRotated?(n.x=Ua.windowSize.width-s,n.y=r):(n.x=r,n.y=s),n},i._convertToUISpace=function(e){var t=this._viewportRect;e.x=(e.x-t.x)/this._scaleX,e.y=(e.y-t.y)/this._scaleY},i._updateAdaptResult=function(){var e;R.director.root.resize(Ua.windowSize.width,Ua.windowSize.height);var t=this._designResolutionSize.width,i=this._designResolutionSize.height;t>0&&this.setDesignResolutionSize(t,i,this._resolutionPolicy),this.emit("canvas-resize"),null===(e=this._resizeCallback)||void 0===e||e.call(this)},t}(Ta(wE)));xD.instance=void 0;var FD=function(){function e(){this.name="ContainerStrategy"}var t=e.prototype;return t.preApply=function(){},t.apply=function(){},t.postApply=function(){},t._setupCanvas=function(){var e=R.game.canvas;if(e){var t=Ua.windowSize;e.width=t.width,e.height=t.height}},e}();FD.EQUAL_TO_FRAME=void 0,FD.PROPORTION_TO_FRAME=void 0;var PD=function(){function e(){this.name="ContentStrategy",this._result=void 0,this._result={scale:[1,1],viewport:null}}var t=e.prototype;return t.preApply=function(){},t.apply=function(){return{scale:[1,1]}},t.postApply=function(){},t._buildResult=function(e,t,i,n,r,s){Math.abs(e-i)<2&&(i=e),Math.abs(t-n)<2&&(n=t);var a=new cn(Math.round((e-i)/2),Math.round((t-n)/2),i,n);return this._result.scale=[r,s],this._result.viewport=a,this._result},e}();PD.EXACT_FIT=void 0,PD.SHOW_ALL=void 0,PD.NO_BORDER=void 0,PD.FIXED_HEIGHT=void 0,PD.FIXED_WIDTH=void 0,function(){var e=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).name="EqualToFrame",t}return _(t,e),t.prototype.apply=function(){La.isProportionalToFrame=!1,this._setupCanvas()},t}(FD),t=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).name="ProportionalToFrame",t}return _(t,e),t.prototype.apply=function(){La.isProportionalToFrame=!0,this._setupCanvas()},t}(FD);FD.EQUAL_TO_FRAME=new e,FD.PROPORTION_TO_FRAME=new t;var i=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).name="ExactFit",t}return _(t,e),t.prototype.apply=function(e,t){var i=Ua.windowSize,n=i.width,r=i.height,s=n/t.width,a=r/t.height;return this._buildResult(n,r,n,r,s,a)},t}(PD),n=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).name="ShowAll",t}return _(t,e),t.prototype.apply=function(e,t){var i,n,r=Ua.windowSize,s=r.width,a=r.height,o=t.width,u=t.height,h=s/o,c=a/u,l=0;return h<c?(i=s,n=u*(l=h)):(i=o*(l=c),n=a),this._buildResult(s,a,i,n,l,l)},t}(PD),r=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).name="NoBorder",t}return _(t,e),t.prototype.apply=function(e,t){var i,n,r,s=Ua.windowSize,a=s.width,o=s.height,u=t.width,h=t.height,c=a/u,l=o/h;return c<l?(n=u*(i=l),r=o):(n=a,r=h*(i=c)),this._buildResult(a,o,n,r,i,i)},t}(PD),s=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).name="FixedHeight",t}return _(t,e),t.prototype.apply=function(e,t){var i=Ua.windowSize,n=i.width,r=i.height,s=r/t.height,a=n,o=r;return this._buildResult(n,r,a,o,s,s)},t}(PD),a=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).name="FixedWidth",t}return _(t,e),t.prototype.apply=function(e,t){var i=Ua.windowSize,n=i.width,r=i.height,s=n/t.width,a=n,o=r;return this._buildResult(n,r,a,o,s,s)},t}(PD);PD.EXACT_FIT=new i,PD.SHOW_ALL=new n,PD.NO_BORDER=new r,PD.FIXED_HEIGHT=new s,PD.FIXED_WIDTH=new a}();var DD=e("hb",function(){function e(e,t){this.name="ResolutionPolicy",this._containerStrategy=void 0,this._contentStrategy=void 0,this._containerStrategy=null,this._contentStrategy=null,this.setContainerStrategy(e),this.setContentStrategy(t)}var t=e.prototype;return t.preApply=function(e){this._contentStrategy.preApply(e)},t.apply=function(e,t){return this._containerStrategy.apply(e,t),this._contentStrategy.apply(e,t)},t.postApply=function(e){this._contentStrategy.postApply(e)},t.setContainerStrategy=function(e){e instanceof FD&&(this._containerStrategy=e)},t.setContentStrategy=function(e){e instanceof PD&&(this._contentStrategy=e)},c(e,[{key:"canvasSize",get:function(){return Ua.windowSize}}]),e}());DD.EXACT_FIT=0,DD.NO_BORDER=1,DD.SHOW_ALL=2,DD.FIXED_HEIGHT=3,DD.FIXED_WIDTH=4,DD.UNKNOWN=5,DD.ContainerStrategy=FD,DD.ContentStrategy=PD,R.ResolutionPolicy=DD;var LD=e("eU",xD.instance=R.view=new xD);wD.registerSystem("view",LD,0),R.winSize=CD,ne(xD.prototype,"View.prototype",[{name:"isAntiAliasEnabled",suggest:"The API of Texture2d have been largely modified, no alternative"},{name:"enableAntiAlias",suggest:"The API of Texture2d have been largely modified, no alternative"}]),re(xD.prototype,"View.prototype",[{name:"adjustViewportMeta"},{name:"enableAutoFullScreen",suggest:"use screen.requestFullScreen() instead."},{name:"isAutoFullScreenEnabled"},{name:"setCanvasSize",suggest:"setting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"getCanvasSize",suggest:"please use screen.windowSize instead."},{name:"getFrameSize",suggest:"getting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"setFrameSize",suggest:"setting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"getDevicePixelRatio",suggest:"use screen.devicePixelRatio instead."},{name:"convertToLocationInView"},{name:"enableRetina"},{name:"isRetinaEnabled"},{name:"setRealPixelResolution"}]),re(R,"cc",[{name:"winSize",suggest:"please use view.getVisibleSize() instead."}]),re(ka,"sys",[{name:"capabilities",suggest:"please use sys.hasFeature() method instead."}]),ie(ka,"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:ka.Language,targetName:"sys.Language"}}))),ie(ka,"sys",["UNKNOWN","IOS","ANDROID","WINDOWS","LINUX","OSX"].map((function(e){return{name:"OS_"+e,newName:e,target:ka.OS,targetName:"sys.OS"}}))),ie(ka,"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:ka.BrowserType,targetName:"sys.BrowserType"}}))),ie(ka,"sys",[{name:"BROWSER_TYPE_360",newName:"BROWSER_360",target:ka.BrowserType,targetName:"sys.BrowserType"}]),ie(ka,"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:ka.Platform,targetName:"sys.Platform"}}))),ie(ka,"sys",[{name:"IPHONE",newName:"IOS",target:ka.Platform,targetName:"sys.Platform"},{name:"IPAD",newName:"IOS",target:ka.Platform,targetName:"sys.Platform"}]),ne(ka,"sys",["LINUX","BLACKBERRY","NACL","EMSCRIPTEN","TIZEN","WINRT","WP8","QQ_PLAY","FB_PLAYABLE_ADS"].map((function(e){return{name:e}}))),ie(ka,"sys",[{name:"windowPixelResolution",target:Ua,targetName:"screen",newName:"windowSize"}]),re(Ua,"screen",[{name:"autoFullScreen",suggest:"please use screen.requestFullScreen() instead."},{name:"disableAutoFullScreen"}]);var BD={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.");var UD=e("gh",{});function GD(){var e=function(){if((ka.os===ka.OS.IOS||ka.os===ka.OS.OSX)&&ka.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-f2122cec.js"):await t.import("./bullet.cocos-d2b2dc96.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:BD,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(UD,i),t()}),i)}(e)}),i)}),i)}))}console.info("[Physics][Bullet]: Using asmjs Bullet libs.");var s=BD,a={};a.buffer=new ArrayBuffer(16384e3),s.memory=a;var o=e(s,a);return Object.assign(UD,o),new Promise((function(e){e()}))}))}globalThis.Bullet=UD,UD.BODY_CACHE_NAME="body",OD.onPostInfrastructureInitDelegate.add(GD)}}}));
|