System.register([],(function(e,t){"use strict";return{execute:function(){function n(e,t){const n="undefined"==typeof window?global:window;return void 0===n[e]?n[e]=t:n[e]}e({BitMask:mt,CCClass:En,Enum:yt,Eventify:jn,WorldNode3DToLocalNodeUI:kh,WorldNode3DToWorldNodeUI:zh,__checkObsoleteInNamespace__:function(e){return ga||(ga="undefined"==typeof Proxy?{}:new Proxy(e,{get:function(e,t,n){return ba(t),Reflect.get(e,t,n)}})),ga},__checkObsolete__:function(e){for(var t,n=S(e);!(t=n()).done;)ba(t.value)},_resetDebugSetting:G,absMax:Ka,absMaxComponent:Ya,applyMixins:function(e,t){t.forEach((function(t){Object.getOwnPropertyNames(t.prototype).forEach((function(n){"constructor"!==n&&Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n))}))}))},approx:Ba,assert:z,assertID:$,assertIsNonNullable:function(){},assertIsTrue:function(){},assertsArrayIndex:gt,bezier:pp,bezierByTime:Bp,binarySearch:function(e,t){return yl(e,t,0)},binarySearchBy:function(e,t,n){for(var i=0,r=e.length-1,s=r>>>1;i<=r;s=i+r>>>1){var a=e[s];if(n(a,t)<0)r=s-1;else{if(!(n(a,t)>0))return s;i=s+1}}return~i},binarySearchEpsilon:yl,ccenum:Tt,clamp:Da,clamp01:Pa,color:jo,createDefaultPipeline:sU,debug:U,debugID:q,deprecateModuleExportedName:ya,deserialize:Yy,enumerableProps:Qa,equals:Oa,error:k,errorID:Z,find:jB,flattenCodeArray:A_,floatToHalf:to,formerlySerializedAs:Kl,getError:te,getSerializationMetadata:function(e){return e[ql]},halfToFloat:no,instantiate:JM,inverseLerp:qa,isCCClassOrFastDefined:In,isCCObject:Ln,isDisplayStats:ne,isValid:Nn,lerp:Ma,log:L,logID:j,mat4:Bu,murmurhash2_32_gc:Hs,nextPow2:Wa,pingPong:Xa,pseudoRandom:Ga,pseudoRandomRange:Va,pseudoRandomRangeInt:Ha,quat:yu,random:Na,randomRange:za,randomRangeInt:Ua,rect:$u,repeat:ja,setDefaultLogTimes:function(e){e>0&&(pa=e)},setDisplayStats:ie,setPropertyEnumType:function(e,t,n){fn(Yt(e),t,n)},setPropertyEnumTypeOnAttrs:fn,setRandGenerator:ka,shift:function(e,t,n){if(gt(e,t),gt(e,n),t===n)return e;var i=e[t];if(te.length)&&(t=e.length);for(var n=0,i=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function x(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function E(e){var t=x(e,"string");return"symbol"==typeof t?t:String(t)}function I(e,t,n,i,r){var s={};return Object.keys(i).forEach((function(e){s[e]=i[e]})),s.enumerable=!!s.enumerable,s.configurable=!!s.configurable,("value"in s||s.initializer)&&(s.writable=!0),s=n.slice().reverse().reduce((function(n,i){return i(e,t,n)||n}),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}a.ccwindow=h;var A=h.document,R="https://github.com/cocos/cocos-engine/blob/"+c+"/EngineErrorMap.md",C=null,O=console.log.bind(console),B=O,D=O,P=function(e,t){if(!e){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r2?n-2:0),r=2;r4){var t=function(e){if(u.game.canvas){if(!C){var t=A.createElement("Div");t.setAttribute("id","logInfoDiv"),t.setAttribute("width","200");var n=u.game.canvas.height;t.setAttribute("height",""+n);var i=t.style;i.zIndex="99999",i.position="absolute",i.top=i.left="0",(C=A.createElement("textarea")).setAttribute("rows","20"),C.setAttribute("cols","30"),C.setAttribute("disabled","true");var r=C.style;r.backgroundColor="transparent",r.borderBottom="1px solid #cccccc",r.borderTopWidth=r.borderLeftWidth=r.borderRightWidth="0px",r.borderTopStyle=r.borderLeftStyle=r.borderRightStyle="none",r.padding="0px",r.margin="0px",t.appendChild(C),u.game.canvas.parentNode.appendChild(t)}C.value=C.value+e+"\r\n",C.scrollTop=C.scrollHeight}};D=function(){t("ERROR : "+F.apply(void 0,arguments))},P=function(e,n){if(!e){for(var i=arguments.length,r=new Array(i>2?i-2:0),s=2;s2?n-2:0),r=2;r1?i-1:0),s=1;s1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i2?n-2:0),r=2;r1?t-1:0),i=1;i65535)<<4,t|=n=((e>>>=t)>255)<<3,t|=n=((e>>>=n)>15)<<2,(t|=n=((e>>>=n)>3)<<1)|(e>>>=n)>>1}function oe(e){return 16843009*((e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135)>>>24}function ue(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 ce(e){return--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,1+(e|=e>>>16)}var he=new Array(256);!function(e){for(var t=0;t<256;++t){var n=t,i=t,r=7;for(n>>>=1;n;n>>>=1)i<<=1,i|=1&n,--r;e[t]=i<>31;return(e^t)-t},countTrailingZeros:ue,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},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},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},interleave3:function(e,t,n){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)|(n=1227133513&((n=3272356035&((n=251719695&((n=4278190335&((n&=1023)|n<<16))|n<<8))|n<<4))|n<<2))<<2},isPow2:function(e){return!(e&e-1||!e)},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},log2:ae,max:se,min:function(e,t){return t^(e^t)&-(e>>ue(e)+1},nextPow2:ce,parity:function(e){return e^=e>>>16,e^=e>>>8,e^=e>>>4,27030>>>(e&=15)&1},popCount:oe,prevPow2:function(e){return e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)-(e>>>1)},reverse:function(e){return he[255&e]<<24|he[e>>>8&255]<<16|he[e>>>16&255]<<8|he[e>>>24&255]},sign:function(e){return(e>0)-(e<0)}});e("bits",le);var fe=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)},f(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 de(e,t){e.splice(t,1)}function pe(e,t){var n=e.length;t<0||t>=n||(e[t]=e[n-1],e.length=n-1)}function _e(e,t){var n=e.indexOf(t);return n>=0&&(de(e,n),!0)}function me(e,t){var n=e.indexOf(t);n>=0&&(e[n]=e[e.length-1],--e.length)}var ge,ve=Object.freeze({__proto__:null,MutableForwardIterator:fe,appendObjectsAt:function(e,t,n){return e.splice.apply(e,[n,0].concat(t)),e},contains:function(e,t){return e.indexOf(t)>=0},copy:function(e){for(var t=e.length,n=new Array(t),i=0;i=0){var i=e[n];return de(e,n),i}},verifyType:function(e,t){if(e&&e.length>0)for(var n,i=S(e);!(n=i()).done;)if(!(n.value instanceof t))return j(1300),!1;return!0}}),ye=function(){function e(){this._poolHandle=-1,we.addContainer(this)}return e.prototype.destroy=function(){we.removeContainer(this)},e}(),be=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,pe(this._pools,e._poolHandle),e._poolHandle=-1)},t.tryShrink=function(){for(var e=0;ethis.shrinkTimeSpan&&(this.tryShrink(),this._lastShrinkPassed-=this.shrinkTimeSpan)},e}(),we=new be,Te=e("Pool",function(e){function t(t,n,i,r){var s;(s=e.call(this)||this)._freePool=[],s._ctor=t,s._dtor=i||null,s._elementsPerBatch=Math.max(n,1),s._shrinkThreshold=r?se(r,1):s._elementsPerBatch,s._nextAvail=s._elementsPerBatch-1;for(var a=0;a>1>=this._shrinkThreshold?e>>1:Math.floor((e-this._shrinkThreshold+1)/2),this._dtor)for(var n=this._nextAvail-t+1;n<=this._nextAvail;++n)this._dtor(this._freePool[n]);this._nextAvail-=t,this._freePool.length=this._nextAvail+1}},n.destroy=function(){var t=arguments.length>0?arguments[0]:null;t&&K(14100);var n=t||this._dtor;if(n)for(var i=0;i<=this._nextAvail;i++)n(this._freePool[i]);this._freePool.length=0,this._nextAvail=-1,e.prototype.destroy.call(this)},t}(ye)),Se=e("RecyclePool",function(e){function t(t,n,i){var r;(r=e.call(this)||this)._count=0,r._fn=t,r._dtor=i||null,r._data=new Array(n),r._initSize=n;for(var s=0;sthis._data.length)for(var t=this._data.length;t=this._data.length&&this.resize(this._data.length<<1),this._data[this._count++]},n.destroy=function(){if(this._dtor)for(var t=0;t>2>this._count){var e=Math.max(this._initSize,this._data.length>>1);if(this._dtor)for(var t=e;t=this._count)){var t=this._count-1,n=this._data[e];this._data[e]=this._data[t],this._data[t]=n,this._count-=1}},f(t,[{key:"length",get:function(){return this._count}},{key:"data",get:function(){return this._data}}]),t}(ye)),xe=e("CachedArray",function(e){function t(t,n){var i;return(i=e.call(this)||this).length=0,i._initSize=0,i.array=new Array(t),i._initSize=t,i._compareFn=n,i}p(t,e);var n=t.prototype;return n.push=function(e){this.array[this.length++]=e},n.pop=function(){return this.array[--this.length]},n.get=function(e){return this.array[e]},n.clear=function(){this.length=0},n.destroy=function(){this.length=0,this.array.length=0,e.prototype.destroy.call(this)},n.tryShrink=function(){this.array.length>>2>this.length&&(this.array.length=Math.max(this._initSize,this.array.length>>1))},n.sort=function(){this.array.length=this.length,this.array.sort(this._compareFn)},n.concat=function(e){for(var t=0;t=this.length||e<0)){var t=--this.length;this.array[e]=this.array[t]}},n.indexOf=function(e){for(var t=0,n=this.length;t1?t-1:0),i=1;i0){--this.count;var e=this._pool[this.count];return this._pool[this.count]=null,e}return null},e.put=function(e){var t=this._pool;if(this.count=0&&(this._pool.length=e,this.count>e&&(this.count=e))},t}(),pt={IDGenerator:Ee,Pool:dt,array:ve,isNumber:Oe,isString:Be,isEmptyObject:De,getPropertyDescriptor:Xe,addon:Ye,mixin:Ke,extend:Qe,getSuper:Ze,isChildClassOf:Je,clear:$e,value:Me,getset:Fe,get:Le,set:Ne,unregisterClass:ot,getClassName:ze,setClassName:st,setClassAlias:at,getClassByName:ht,getClassById:ct,get _registeredClassNames(){return d({},tt)},set _registeredClassNames(e){$e(tt),Object.assign(tt,e)},get _registeredClassIds(){return d({},et)},set _registeredClassIds(e){$e(et),Object.assign(et,e)},_getClassId:lt,getClassId:ft,_setClassId:it,_getClassById:ut,obsolete:Ue,obsoletes:Ge,formatStr:We,shiftArguments:je,createMap:ke};u.js=pt;var _t=Object.freeze({__proto__:null,IDGenerator:Ee,Pool:dt,_getClassById:ut,_getClassId:lt,_idToClass:et,_nameToClass:tt,_setClassId:it,addon:Ye,array:ve,clear:$e,copyAllProperties:function(e,t,n){for(var i=Object.getOwnPropertyNames(e),r=0,s=i.length;r=0&&e.length,e.length}e("js",_t),mt.isBitMask=function(e){return e&&Object.prototype.hasOwnProperty.call(e,"__bitmask__")},mt.getList=function(e){return e.__bitmask__?e.__bitmask__:mt.update(e)},mt.update=function(e){Array.isArray(e.__bitmask__)||(e.__bitmask__=[]);var t=e.__bitmask__;for(var n in t.length=0,e){var i=e[n];Number.isInteger(i)&&t.push({name:n,value:i})}return t.sort((function(e,t){return e.value-t.value})),t},u.BitMask=mt;var vt=Object.prototype.hasOwnProperty;function yt(e){return"__enums__"in e?e:(Me(e,"__enums__",null,!0),yt.update(e))}function bt(e){vt.call(e,"__enums__")}function wt(e){bt(e);var t=e.__enums__||[];t.length=0;var n=!0;for(var i in e){var r=e[i],s=Number.isInteger(r);s||(n=!1),(s||"string"==typeof r&&e[r]!==Number.parseInt(i))&&t.push({name:i,value:r})}return n&&t.sort((function(e,t){return e.value-t.value})),e.__enums__=t,t}function Tt(e){"__enums__"in e||Me(e,"__enums__",null,!0)}yt.update=function(e){for(var t=-1,n=Object.keys(e),i=0;i2?n-2:0),r=2;r1?t-1:0),i=1;in){var i=t;t=n,n=i}return e=0;i--){var r=n[i];r.hasOwnProperty("__attrs__")&&r.__attrs__||jt(r,(t=n[i+1])&&t.__attrs__)}return jt(e,(t=n[0])&&t.__attrs__),e.__attrs__}function qt(e,t){var n=Yt(e),i=t+Wt,r={};for(var s in n)s.startsWith(i)&&(r[s.slice(i.length)]=n[s]);return r}function Yt(e){return e.hasOwnProperty("__attrs__")&&e.__attrs__||Xt(e)}function Kt(e,t,n,i){Yt(e)[t+Wt+n]=i}var Qt=function(){function e(e,t){this.name=e,this.default=t}return e.prototype.toString=function(){return this.name},e}(),Zt=e("CCInteger",new Qt("Integer",0));u.Integer=Zt,u.CCInteger=Zt;var Jt=e("CCFloat",new Qt("Float",0));u.Float=Jt,u.CCFloat=Jt;var $t=e("CCBoolean",new Qt("Boolean",!1));u.Boolean=$t,u.CCBoolean=$t;var en=e("CCString",new Qt("String",""));function tn(e,t){return function(n,i){var r='"'+ze(n)+"."+i+'"',s=qt(n,i),a=s.type;if(a===Zt||a===Jt?a="Number":a!==en&&a!==$t||(a=""+a),a===e){if(s.hasOwnProperty("default")){var o=s.default;if(void 0!==o&&!Array.isArray(o)&&!Ut(o)){var u=typeof o,c=e.toLowerCase();if(u===c)if("object"===c){if(!o||o instanceof s.ctor)return;K(3605,r,ze(s.ctor))}else"Number"!==e&&K(3606,t,r,e);else{if("function"===u)return;e===en.default&&null==o?K(3607,r):K(3611,t,r,u)}delete s.type}}}else K(3604,r)}}u.String=en,u.CCString=en;var nn=Object.freeze({__proto__:null,CCBoolean:$t,CCFloat:Jt,CCInteger:Zt,CCString:en,DELIMETER:Wt,PrimitiveType:Qt,attr:qt,createAttrs:Xt,createAttrsSingle:jt,getClassAttrs:Yt,getObjTypeChecker_ET:function(e){return function(t,n){tn("Object","type")(t,n);var i=Yt(t)[n+Wt+"default"],r=u.Class.getDefault(i);if(!Array.isArray(r)&&Je(e,u.ValueType)){var s=ze(e),a=We('No need to specify the "type" of "%s.%s" because %s is a child class of ValueType.',ze(t),n,s);i?L(a):K(3612,a,s,ze(t),n,s)}}},getTypeChecker_ET:tn,setClassAttr:Kt}),rn={default:{},serializable:{},editorOnly:{},formerlySerializedAs:{}};function sn(e,t,n,i){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,n.call(this,t)};var s={};for(var a in i[r]=s,rn){var o=rn[a];e.hasOwnProperty(a)&&(s[a]=e[a],o.canUsedInGet||delete e[a])}}}function an(e,t,n,i){if(Array.isArray(t)){if(!(t.length>0))return Z(5508,n,i);e.type=t=t[0]}"function"==typeof t&&(t===String?e.type=u.String:t===Boolean?e.type=u.Boolean:t===Number&&(e.type=u.Float))}function on(e,t,n){var i=e||void 0===t?{_short:!0}:{_short:!0,default:t};return n&&(i.type=n),i}function un(e,t){if(!e||e.constructor!==Object){if(Array.isArray(e)&&e.length>0)return on(t,[],e);if("function"==typeof e){var n=e;return on(t,Je(n,u.ValueType)?new n:null,n)}return e instanceof Qt?on(t,void 0,e):on(t,e)}return null}function cn(e,t){for(var n in e){var i=e[n],r=un(i,!1);if(r&&(i=e[n]=r),i){var s=i.notify;s&&sn(i,n,s,e),"type"in i&&an(i,i.type,t,n)}}}var hn=[];function ln(){return hn[hn.length-1]}function fn(e,t,n){e[""+t+Wt+"type"]="Enum",e[""+t+Wt+"enumList"]=yt.getList(n)}u._RF={push:function(e,t,n,i){void 0===n&&(n=t,t=""),hn.push({uuid:t,script:n,module:e,exports:e.exports,beh:null,importMeta:i})},pop:function(){var e=hn.pop(),t=e.module,n=t.exports;if(n===e.exports){for(var i in n)return;t.exports=n=e.cls}},peek:ln};var dn=Wt,pn="__ctors__",_n=e("ENUM_TAG","Enum"),mn=e("BITMASK_TAG","BitMask");function gn(e,t){e.indexOf(t)<0&&e.push(t)}function vn(e,t){gn(e.__props__,t)}function yn(e,t,n,i){vn(e,n),Rn(e,i,t,n)}function bn(e,t,n,i){var r=i.get;i.set,r&&(Rn(e,i,t,n),Kt(e,n,"serializable",!1))}function wn(e){return"function"==typeof e?e():e}function Tn(e,t,n){var i=n.ctor;return Me(i,pn,!0,!0),i.prototype,t&&(i.$super=t),st(e,i),i}function Sn(e,t,n){var i=u.Component,r=ln();if(r&&Je(t,i)){if(Je(r.cls,i))return Z(3615),null;e=e||r.script}var s=Tn(e,t,n);if(r)if(Je(t,i)){var a=r.uuid;a&&it(a,s),r.cls=s}else Je(r.cls,i)||(r.cls=s);return s}function xn(e,t,n,i){if(e.__props__=[],i&&i.__props__&&(e.__props__=i.__props__.slice()),n)for(var r in cn(n,t),n){var s=n[r];s.get||s.set?bn(e,t,r,s):yn(e,t,r,s)}var a=Yt(e);e.__values__=e.__props__.filter((function(e){return!1!==a[""+e+dn+"serializable"]}))}function En(e){var t=e.name,n=e.extends,i=Sn(t,n,e);t||(t=u.js.getClassName(i)),i._sealed=!0,n&&(n._sealed=!1),xn(i,t,e.properties,n);var r=e.editor;return r&&Je(n,u.Component)&&u.Component._registerEditorProps(i,r),i}function In(e){return null==e||null==e.hasOwnProperty?void 0:e.hasOwnProperty("__values__")}En._isCCClass=function(e){return null==e||null==e.hasOwnProperty?void 0:e.hasOwnProperty(pn)},En.fastDefine=function(e,t,n){st(e,t);for(var i=t.__props__=t.__values__=Object.keys(n),r=Yt(t),s=0;s=2&&((r||a())[s+"min"]=h[0],r[s+"max"]=h[1],h.length>2&&(r[s+"step"]=h[2])),c("step","number"),c("userData","object")}En.isArray=function(e){return e=wn(e),Array.isArray(e)},En.getDefault=wn,En.escapeForJS=function(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},En.IDENTIFIER_RE=/^[A-Za-z_$][0-9A-Za-z_$]*$/,En.getNewValueTypeCode=function(e){for(var t=ze(e),n=e.constructor,i="new "+t+"(",r=0;r=0;--e)this.callbackInfos[e]||kn(this.callbackInfos,e);this.containCanceled=!1},t.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1},e}(),Hn=new Te((function(){return new Vn}),16),Wn=e("CallbacksInvoker",function(){function e(){this._callbackTable=ke(!0),this._offCallback=void 0}var t=e.prototype;return t.on=function(e,t,n,i){if(!this.hasEventListener(e,t,n)){var r=this._callbackTable[e];r||(r=this._callbackTable[e]=Hn.alloc());var s=Gn.alloc();s.set(t,n,i),r.callbackInfos.push(s)}return t},t.hasEventListener=function(e,t,n){var i=this._callbackTable&&this._callbackTable[e];if(!i)return!1;var r=i.callbackInfos;if(!t){if(i.isInvoking){for(var s=0;s0}for(var a=0;a1)&&(h=!0,l="",f=0);var p=Qn.UNKNOWN;-1!==a.appVersion.indexOf("Win")?p=Qn.WINDOWS:h?p=Qn.IOS:-1!==a.appVersion.indexOf("Mac")?p=Qn.OSX:-1!==a.appVersion.indexOf("X11")&&-1===a.appVersion.indexOf("Linux")?p=Qn.LINUX:c?p=Qn.ANDROID:-1===a.appVersion.indexOf("Linux")&&-1===o.indexOf("ubuntu")||(p=Qn.LINUX),n.os=p,n.osVersion=l,n.osMainVersion=f,n.browserType=qn.UNKNOWN;var _=/wechat|weixin|micromessenger/i.exec(o)||/mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|ucbs|360 aphone|360browser|baiduboxapp|baidubrowser|maxthon|mxbrowser|miuibrowser/i.exec(o)||/qq|qqbrowser|ucbrowser|ubrowser|edge|HuaweiBrowser/i.exec(o)||/chrome|safari|firefox|trident|opera|opr\/|oupeng/i.exec(o),m=_?_[0].toLowerCase():Qn.UNKNOWN;("safari"===m&&c||"qq"===m&&/android.*applewebkit/i.test(o))&&(m=qn.ANDROID);var g={micromessenger:qn.WECHAT,wechat:qn.WECHAT,weixin:qn.WECHAT,trident:qn.IE,edge:qn.EDGE,"360 aphone":qn.BROWSER_360,mxbrowser:qn.MAXTHON,"opr/":qn.OPERA,ubrowser:qn.UC,huaweibrowser:qn.HUAWEI};n.browserType=g[m]||m,n.browserVersion="";var v=/(mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|uc|ucbs|360 aphone|360|baiduboxapp|baidu|maxthon|mxbrowser|miui(?:.hybrid)?)(mobile)?(browser)?\/?([\d.]+)/i.exec(o);v||(v=/(qq|chrome|safari|firefox|trident|opera|opr\/|oupeng)(mobile)?(browser)?\/?([\d.]+)/i.exec(o)),n.browserVersion=v?v[4]:"",n.isXR=!1;var y,b=document.createElement("canvas");b.getContext("2d");try{y=b.toDataURL("image/webp").startsWith("data:image/webp")}catch(e){y=!1}if(n.os===Qn.IOS){var w,T=null==(w=/ applewebkit\/(\d+)/.exec(o))?void 0:w[1];"string"==typeof T&&Number.parseInt(T)>=604&&(y=!0)}else if(n.browserType===qn.SAFARI){var S,x=null==(S=/ version\/(\d+)/.exec(o))?void 0:S[1];"string"==typeof x&&Number.parseInt(x)>=14&&(y=!0)}var E=void 0!==document.documentElement.ontouchstart||void 0!==document.ontouchstart||i,I=void 0!==document.documentElement.onmouseup||i,A=void 0!==navigator.xr,R=function(){if((n.os===Qn.IOS||n.os===Qn.OSX)&&/(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 n._featureMap=((t={})[Jn.WEBP]=y,t[Jn.IMAGE_BITMAP]=!1,t[Jn.WEB_VIEW]=!0,t[Jn.VIDEO_PLAYER]=!0,t[Jn.SAFE_AREA]=!1,t[Jn.HPE]=!1,t[Jn.INPUT_TOUCH]=E,t[Jn.EVENT_KEYBOARD]=void 0!==document.documentElement.onkeyup||i,t[Jn.EVENT_MOUSE]=I,t[Jn.EVENT_TOUCH]=E||I,t[Jn.EVENT_ACCELEROMETER]=void 0!==window.DeviceMotionEvent||void 0!==window.DeviceOrientationEvent,t[Jn.EVENT_GAMEPAD]=void 0!==navigator.getGamepads||void 0!==navigator.webkitGetGamepads||A,t[Jn.EVENT_HANDLE]=r,t[Jn.EVENT_HMD]=A,t[Jn.EVENT_HANDHELD]=A,t[Jn.WASM]=R,t),n._initPromise.push(n._supportsImageBitmapPromise()),n._registerEvent(),n}p(t,e);var n=t.prototype;return n._supportsImageBitmapPromise=function(){var e=this;if("undefined"!=typeof createImageBitmap&&"undefined"!=typeof Blob){var t=document.createElement("canvas");t.width=t.height=2;var n=createImageBitmap(t);if(n instanceof Promise)return n.then((function(t){t&&t.close&&(e._setFeature(Jn.IMAGE_BITMAP,!0),t.close())}))}return Promise.resolve()},n._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 n=!1,i=function(){n||(n=!0,t.emit("hide"))},r=function(e,i,r,s,a){n&&(n=!1,t.emit("show",e,i,r,s,a))};if(e)for(var s=["visibilitychange","mozvisibilitychange","msvisibilitychange","webkitvisibilitychange","qbrowserVisibilityChange"],a=0;a-1&&(window.onfocus=r),"onpageshow"in window&&"onpagehide"in window&&(window.addEventListener("pagehide",i),window.addEventListener("pageshow",r),document.addEventListener("pagehide",i),document.addEventListener("pageshow",r))},n._setFeature=function(e,t){return this._featureMap[e]=t},n.init=function(){return Promise.all(this._initPromise)},n.hasFeature=function(e){return this._featureMap[e]},n.getBatteryLevel=function(){return this._battery?this._battery.level:1},n.triggerGC=function(){},n.openURL=function(e){window.open(e)},n.now=function(){return Date.now?Date.now():+new Date},n.restartJSVM=function(){},n.exit=function(){window.close()},n.close=function(){this.emit("close")},t}(Xn),ti=new ei,ni=/(\.[^./?\\]*)(\?.*)?$/,ii=/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,ri=/[^./]+\/\.\.\//;function si(){for(var e="",t=arguments.length,n=new Array(t),i=0;i0&&(e=e.substring(0,n));var i=/(\/|\\)([^/\\]+)$/g.exec(e.replace(/(\/|\\)$/,""));if(!i)return e;var r=i[2];return t&&e.substring(e.length-t.length).toLowerCase()===t.toLowerCase()?r.substring(0,r.length-t.length):r}function ci(e){var t=ii.exec(e);return t?t[2]:""}function hi(e,t){t=t||"";var n=e.indexOf("?"),i="";return n>0&&(i=e.substring(n),e=e.substring(0,n)),(n=e.lastIndexOf("."))<0?e+t+i:e.substring(0,n)+t+i}function li(e,t,n){if(0===t.indexOf("."))return hi(e,t);var i=e.indexOf("?"),r="",s=n?ai(e):"";return i>0&&(r=e.substring(i),e=e.substring(0,i)),i=(i=e.lastIndexOf("/"))<=0?0:i+1,e.substring(0,i)+t+s+r}function fi(e){var t=e=String(e);do{t=e,e=e.replace(ri,"")}while(t.length!==e.length);return e}function di(e){return e.replace(/[/\\]$/,"")}function pi(){return ti.os===Qn.WINDOWS?"\\":"/"}e("path",Object.freeze({__proto__:null,_normalize:fi,basename:ui,changeBasename:li,changeExtname:hi,dirname:ci,extname:ai,getSeperator:pi,join:si,mainFileName:oi,stripSep:di})),u.log=L,u.warn=N,u.error=k,u.assert=z,u._throw=V,u.logID=j,u.warnID=K,u.errorID=Z,u.assertID=$,u.debug=re,u.path={join:si,extname:ai,mainFileName:oi,basename:ui,dirname:ci,changeExtname:hi,changeBasename:li,_normalize:fi,stripSep:di,get sep(){return pi()}};var _i=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(){},t.destroy=function(){},e}(),mi=e("garbageCollectionManager",new _i),gi=e("GCObject",function(){function e(){return mi.registerGCObject(this)}return e.prototype.destroy=function(){},e}()),vi=function(e,t,n){for(var i=0;i0&&!(e&e-1)}var Is=Math.ceil;function As(e,t,n,i){if(!Ts[e].isCompressed)return t*n*i*Ts[e].size;switch(e){case 56:case 57:case 58:case 59:case 72:case 73:case 74:case 75:case 79:case 80:case 85:case 86:case 88:return Is(t/4)*Is(n/4)*8*i;case 60:case 61:case 62:case 63:case 64:case 65:case 69:case 68:case 70:case 71:case 77:case 76:case 81:case 82:case 89:case 103:return Is(t/4)*Is(n/4)*16*i;case 66:case 67:return Is(t/4)*Is(n/4)*32*i;case 83:case 84:case 87:return Is(t/8)*Is(n/4)*8*i;case 90:case 104:return Is(t/5)*Is(n/4)*16*i;case 91:case 105:return Is(t/5)*Is(n/5)*16*i;case 92:case 106:return Is(t/6)*Is(n/5)*16*i;case 93:case 107:return Is(t/6)*Is(n/6)*16*i;case 94:case 108:return Is(t/8)*Is(n/5)*16*i;case 95:case 109:return Is(t/8)*Is(n/6)*16*i;case 96:case 110:return Is(t/8)*Is(n/8)*16*i;case 97:case 111:return Is(t/10)*Is(n/5)*16*i;case 98:case 112:return Is(t/10)*Is(n/6)*16*i;case 99:case 113:return Is(t/10)*Is(n/8)*16*i;case 100:case 114:return Is(t/10)*Is(n/10)*16*i;case 101:case 115:return Is(t/12)*Is(n/10)*16*i;case 102:case 116:return Is(t/12)*Is(n/12)*16*i;default:return 0}}function Rs(e,t,n,i,r){for(var s=0,a=0;a>1,1),n=Math.max(n>>1,1);return s}var Cs=[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 Os(e){return Cs[e]||0}function Bs(e){if(e.isCompressed)return Uint8Array;var t=e.size/e.count;switch(e.type){case 1:case 3:switch(t){case 1:default:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array}case 2:case 4:switch(t){case 1:default:return Int8Array;case 2:return Int16Array;case 4:return Int32Array}case 6:return 2===t?Uint16Array:Float32Array}return Float32Array}function Ds(e){switch(e){case 56:case 57:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 65:case 69:case 68:case 70:case 71:case 66:case 67:case 72:case 73:case 74:case 75:case 79:case 80:case 77:case 76:case 81:case 82:case 85:case 86:case 88:case 89:case 103:return{width:4,height:4};case 83:case 84:case 87:return{width:8,height:4};case 90:case 104:return{width:5,height:4};case 91:case 105:return{width:5,height:5};case 92:case 106:return{width:6,height:5};case 93:case 107:return{width:6,height:6};case 94:case 108:return{width:8,height:5};case 95:case 109:return{width:8,height:6};case 96:case 110:return{width:8,height:8};case 97:case 111:return{width:10,height:5};case 98:case 112:return{width:10,height:6};case 99:case 113:return{width:10,height:8};case 100:case 114:return{width:10,height:10};case 101:case 115:return{width:12,height:10};case 102:case 116:return{width:12,height:12};default:return{width:1,height:1}}}function Ps(e,t){return Is(e/t)*t}var Ms=Object.freeze({__proto__:null,API:wi,AccessFlagBit:Ki,Address:Ui,Attribute:Xr,AttributeName:vs,BarrierType:cr,BindingMappingInfo:Ir,BlendFactor:Hi,BlendOp:Wi,BufferBarrierInfo:is,BufferFlagBit:Ci,BufferInfo:Cr,BufferTextureCopy:wr,BufferUsageBit:Ri,BufferViewInfo:Or,ClearFlagBit:ur,Color:Sr,ColorAttachment:Kr,ColorMask:ji,CommandBufferInfo:hs,CommandBufferType:or,ComparisonFunc:Gi,CullMode:tr,DESCRIPTOR_BUFFER_TYPE:Ss,DESCRIPTOR_DYNAMIC_TYPE:10,DESCRIPTOR_SAMPLER_TYPE:xs,DESCRIPTOR_STORAGE_BUFFER_TYPE:12,DRAW_INFO_SIZE:28,DepthStencilAttachment:Qr,DescriptorSetInfo:os,DescriptorSetLayoutBinding:ss,DescriptorSetLayoutInfo:as,DescriptorType:rr,DeviceCaps:fr,DeviceInfo:Rr,DeviceOptions:dr,DispatchInfo:Dr,DrawInfo:Br,DynamicStateFlagBit:nr,DynamicStates:ms,DynamicStencilStates:_s,Extent:mr,Feature:Si,Filter:zi,Format:xi,FormatFeatureBit:Li,FormatInfo:ds,FormatInfos:Ts,FormatSize:As,FormatSurfaceSize:Rs,FormatType:Ei,FramebufferInfo:rs,GFXObject:gs,GeneralBarrierInfo:ts,GetTypeSize:Os,IndirectBuffer:Pr,InputAssemblerInfo:Yr,InputState:cs,IsPowerOf2:Es,LoadOp:qi,MarkerInfo:Er,MemoryAccessBit:Oi,MemoryStatus:ps,MemoryUsageBit:Bi,ObjectType:yi,Offset:pr,PassType:hr,PipelineBindPoint:Zi,PipelineLayoutInfo:us,PolygonMode:$i,PrimitiveMode:Ji,QueryPoolInfo:fs,QueryType:ar,QueueInfo:ls,QueueType:sr,Rect:_r,RenderPassInfo:$r,ResolveMode:Qi,ResourceRange:es,SampleCount:Ni,SampleType:Ii,SamplerInfo:Lr,ShadeModel:er,ShaderInfo:qr,ShaderStage:jr,ShaderStageFlagBit:Xi,Size:lr,Status:bi,StencilFace:ir,StencilOp:Vi,StoreOp:Yi,SubpassDependency:Jr,SubpassInfo:Zr,SurfaceTransform:Ti,SwapchainInfo:Ar,TextureBarrierInfo:ns,TextureBlit:br,TextureCopy:yr,TextureFlagBit:Fi,TextureInfo:Mr,TextureSubresLayers:gr,TextureSubresRange:vr,TextureType:Di,TextureUsageBit:Mi,TextureViewInfo:Fr,Type:Ai,Uniform:Nr,UniformBlock:kr,UniformInputAttachment:Wr,UniformSampler:Ur,UniformSamplerTexture:zr,UniformStorageBuffer:Hr,UniformStorageImage:Vr,UniformTexture:Gr,ViewDimension:Pi,Viewport:Tr,VsyncMode:ki,alignTo:Ps,formatAlignment:Ds,getTypedArrayConstructor:Bs}),Fs=function(e){function t(){var t;return(t=e.call(this,2)||this)._usage=0,t._memUsage=0,t._size=0,t._stride=1,t._count=0,t._flags=0,t._isBufferView=!1,t}return p(t,e),f(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}(gs),Ls=function(e){function t(){var t;return(t=e.call(this,13)||this)._queue=null,t._type=0,t._numDrawCalls=0,t._numInstances=0,t._numTris=0,t}return p(t,e),f(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}(gs),Ns=function(){function e(){this._gfxAPI=0,this._renderer="",this._vendor="",this._features=new Array(10),this._formatFeatures=new Array(117),this._queue=null,this._cmdBuff=null,this._numDrawCalls=0,this._numInstances=0,this._numTris=0,this._memoryStatus=new ps,this._caps=new fr,this._bindingMappingInfo=new Ir,this._samplers=new Map,this._generalBarrierss=new Map,this._textureBarriers=new Map,this._bufferBarriers=new Map,this._swapchainFormat=35}var t=e.prototype;return t.hasFeature=function(e){return this._features[e]},t.getFormatFeatures=function(e){return this._formatFeatures[e]},t.enableAutoBarrier=function(){},t.getMaxSampleCount=function(){return 1},f(e,[{key:"gfxAPI",get:function(){return this._gfxAPI}},{key:"queue",get:function(){return this._queue}},{key:"commandBuffer",get:function(){return this._cmdBuff}},{key:"swapchainFormat",get:function(){return this._swapchainFormat}},{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}();Ns.canvas=void 0;var ks=function(){function e(e){this._texture2D=null,this._texture3D=null,this._textureCube=null,this._texture2DArray=null;var t=e.capabilities,n=new Uint8Array(64);if(n.fill(255),t.maxTextureSize>=2){this._texture2D=e.createTexture(new Mr(1,12,35,2,2,0));var i=new wr(0,0,0,new pr(0,0,0),new mr(2,2,1));e.copyBuffersToTexture([n],this._texture2D,[i])}if(t.maxTextureSize>=2){this._textureCube=e.createTexture(new Mr(3,12,35,2,2,0,6));var r=new wr(0,0,0,new pr(0,0,0),new mr(2,2,1));e.copyBuffersToTexture([n],this._textureCube,[r]),r.texSubres.baseArrayLayer=1,e.copyBuffersToTexture([n],this._textureCube,[r]),r.texSubres.baseArrayLayer=2,e.copyBuffersToTexture([n],this._textureCube,[r]),r.texSubres.baseArrayLayer=3,e.copyBuffersToTexture([n],this._textureCube,[r]),r.texSubres.baseArrayLayer=4,e.copyBuffersToTexture([n],this._textureCube,[r]),r.texSubres.baseArrayLayer=5,e.copyBuffersToTexture([n],this._textureCube,[r])}if(t.max3DTextureSize>=2){this._texture3D=e.createTexture(new Mr(2,12,35,2,2,0,1,1,1,2));var s=new wr(0,0,0,new pr(0,0,0),new mr(2,2,2),new gr(0,0,1));e.copyBuffersToTexture([n],this._texture3D,[s])}if(t.maxArrayTextureLayers>=2){this._texture2DArray=e.createTexture(new Mr(5,12,35,2,2,0,2));var a=new wr(0,0,0,new pr(0,0,0),new mr(2,2,1),new gr(0,0,1));e.copyBuffersToTexture([n],this._texture2DArray,[a]),a.texSubres.baseArrayLayer=1,e.copyBuffersToTexture([n],this._texture2DArray,[a])}}return e.prototype.getTexture=function(e){switch(e){case 1:return this._texture2D;case 2:return this._texture3D;case 3:return this._textureCube;case 5:return this._texture2DArray;default:return null}},e}(),zs=function(e){function t(){var t;return(t=e.call(this,1)||this)._transform=0,t._colorTexture=null,t._depthStencilTexture=null,t}return p(t,e),f(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}(gs),Us=function(e){function t(){var t;return(t=e.call(this,5)||this)._renderPass=null,t._colorTextures=[],t._depthStencilTexture=null,t._width=0,t._height=0,t}return p(t,e),f(t,[{key:"renderPass",get:function(){return this._renderPass}},{key:"colorTextures",get:function(){return this._colorTextures}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}},{key:"width",get:function(){var e,t;return this.colorTextures.length>0?null!==(e=null==(t=this.colorTextures[0])?void 0:t.width)&&void 0!==e?e:this._width:this.depthStencilTexture?this.depthStencilTexture.width:this._width}},{key:"height",get:function(){var e,t;return this.colorTextures.length>0?null!==(e=null==(t=this.colorTextures[0])?void 0:t.height)&&void 0!==e?e:this._height:this.depthStencilTexture?this.depthStencilTexture.height:this._height}},{key:"needRebuild",get:function(){return!1}}]),t}(gs),Gs=String.prototype.charCodeAt;function Vs(e){return this[e]}function Hs(e,t){for(var n=e.length,i=t^n,r=0,s="string"==typeof e?Gs:Vs;n>=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),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),n-=4,++r}switch(n){case 3:i^=(255&s.call(e,r+2))<<16;case 2:i^=(255&s.call(e,r+1))<<8;case 1:i=1540483477*(65535&(i^=255&s.call(e,r)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}var Ws=function(e){function t(){var t;return(t=e.call(this,12)||this)._attributes=[],t._attributesHash=0,t._vertexBuffers=[],t._indexBuffer=null,t._indirectBuffer=null,t._drawInfo=new Br,t}p(t,e);var n=t.prototype;return n.getVertexBuffer=function(e){return void 0===e&&(e=0),e=0){var o=this._colorInfos[n.depthStencil];e+="ds,"+o.format+","+o.sampleCount}}else{e+="ca";for(var u=0;u>2&3,t.mipFilter=e>>4&3,t.addressU=e>>6&3,t.addressV=e>>8&3,t.addressW=e>>10&3,t.maxAnisotropy=e>>12&31,t.cmpFunc=e>>17&7,t},f(t,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),t}(gs),ia=function(e){function t(){var t;return(t=e.call(this,7)||this)._name="",t._stages=[],t._attributes=[],t._blocks=[],t._samplers=[],t}return p(t,e),f(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}},{key:"stages",get:function(){return this._stages}}]),t}(gs),ra=function(e){function t(){var t;return(t=e.call(this,3)||this)._info=new Mr,t._viewInfo=new Fr,t._isPowerOf2=!1,t._isTextureView=!1,t._size=0,t}return p(t,e),t.getLevelCount=function(e,t){return Math.floor(Math.log2(Math.max(e,t)))},f(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}(gs),sa=function(e){function t(t,n){var i;return(i=e.call(this,16)||this)._info=new ts,i._hash=0,i._info.copy(t),i._hash=n,i}return p(t,e),t.computeHash=function(e){return Hs(e.prevAccesses+" "+e.nextAccesses+" "+e.type,666)},f(t,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),t}(gs),aa=function(e){function t(t,n){var i;return(i=e.call(this,17)||this)._info=new ns,i._hash=0,i._info.copy(t),i._hash=n,i}return p(t,e),t.computeHash=function(e){var t=e.prevAccesses+" "+e.nextAccesses;return t+=e.type,t+=e.range.mipLevel,t+=e.range.levelCount,t+=e.range.firstSlice,t+=e.range.numSlices,t+=e.range.basePlane,t+=e.range.planeCount,t+=e.discardContents,t+=e.srcQueue?e.srcQueue.type:0,Hs(t+=e.dstQueue?e.dstQueue.type:0,666)},f(t,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),t}(gs),oa=function(e){function t(t,n){var i;return(i=e.call(this,18)||this)._info=new is,i._hash=0,i._info.copy(t),i._hash=n,i}return p(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,Hs(t+=e.dstQueue?e.dstQueue.type:0,666)},f(t,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),t}(gs),ua={Device:Ns,Swapchain:zs,Buffer:Fs,Texture:ra,Sampler:na,Shader:ia,InputAssembler:Ws,RenderPass:ta,Framebuffer:Us,DescriptorSet:js,DescriptorSetLayout:Xs,PipelineLayout:qs,PipelineState:$s,CommandBuffer:Ls,Queue:ea,GeneralBarrier:sa,TextureBarrier:aa,BufferBarrier:oa,RasterizerState:Ys,BlendState:Zs,BlendTarget:Qs,DepthStencilState:Ks,PipelineStateInfo:Js};Object.assign(ua,Ms),o.gfx=ua;var ca,ha,la,fa,da,pa=10;e("replaceProperty",ca),e("removeProperty",ha),e("markAsWarning",la);var _a=0,ma=new Map;fa=function(e,t,n,i,r,s,a){var o=ma.get(s);o&&o.logTimes>o.count&&(r("'%s' is deprecated, please use '%s' instead. "+a,e+"."+t,n+"."+i),o.count++)},e("replaceProperty",ca=function(e,t,n){null!=e&&n.forEach((function(n){var i=_a++;ma.set(i,{id:i,count:0,logTimes:void 0!==n.logTimes?n.logTimes:pa});var r=null!=n.target?n.target:e,s=null!=n.newName?n.newName:n.name,a=null!=n.targetName?n.targetName:t,o=r===e,u=n.suggest?"("+n.suggest+")":"";if(null!=n.customFunction)e[n.name]=function(){var e;return fa(t,n.name,a,s,N,i,u),(e=n.customFunction).call.apply(e,[this].concat(Array.prototype.slice.call(arguments)))};else if(null!=n.customSetter||null!=n.customGetter){var c=null!=n.customSetter,h=null!=n.customGetter;c&&h?Object.defineProperty(e,n.name,{get:function(){return fa(t,n.name,a,s,N,i,u),n.customGetter.call(this)},set:function(e){fa(t,n.name,a,s,N,i,u),n.customSetter.call(this,e)},enumerable:!1}):c?Object.defineProperty(e,n.name,{set:function(e){fa(t,n.name,a,s,N,i,u),n.customSetter.call(this,e)},enumerable:!1}):h&&Object.defineProperty(e,n.name,{get:function(){return fa(t,n.name,a,s,N,i,u),n.customGetter.call(this)},enumerable:!1})}else Object.defineProperty(e,n.name,{get:function(){return fa(t,n.name,a,s,N,i,u),o?this[s]:r[s]},set:function(e){fa(t,n.name,a,s,N,i,u),o?this[s]=e:r[s]=e},enumerable:!1})}))}),da=function(e,t,n,i,r){var s=ma.get(i);s&&s.logTimes>s.count&&(n("'%s' has been removed. "+r,e+"."+t),s.count++)},e("removeProperty",ha=function(e,t,n){null!=e&&n.forEach((function(n){var i=_a++;ma.set(i,{id:i,count:0,logTimes:void 0!==n.logTimes?n.logTimes:pa});var r=n.suggest?"("+n.suggest+")":"";Object.defineProperty(e,n.name,{get:function(){return da(t,n.name,k,i,r)},set:function(){da(t,n.name,k,i,r)},enumerable:!1})}))}),e("markAsWarning",la=function(){});var ga,va={};function ya(e){for(var t in e){var n=e[t];va[t]=n}}function ba(e){var t=va[e];if(t){var n=t.newName,i=t.since;t.removed?n?Z(16003,e,i,n):Z(16002,e,i):n?K(16001,e,i,n):K(16e3,e,i)}}var wa=Math.abs,Ta=Math.floor,Sa=Math.PI,xa=Sa/180,Ea=180/Sa,Ia=Math.random,Aa=e("HALF_PI",.5*Sa),Ra=e("TWO_PI",2*Sa),Ca=e("EPSILON",1e-6);function Oa(e,t){return wa(e-t)<=Ca*Math.max(1,wa(e),wa(t))}function Ba(e,t,n){return n=n||Ca,wa(e-t)<=n}function Da(e,t,n){if(t>n){var i=t;t=n,n=i}return en?n:e}function Pa(e){return e<0?0:e>1?1:e}function Ma(e,t,n){return e+(t-e)*n}function Fa(e){return e*xa}function La(e){return e*Ea}function Na(){return Ia()}function ka(e){Ia=e}function za(e,t){return Na()*(t-e)+e}function Ua(e,t){return Ta(za(e,t))}function Ga(e){return(e=(9301*e+49297)%233280)/233280}function Va(e,t,n){return Ga(e)*(n-t)+t}function Ha(e,t,n){return Ta(Va(e,t,n))}function Wa(e){return ce(e)}function ja(e,t){return e-Ta(e/t)*t}function Xa(e,t){return e=ja(e,2*t),t-wa(e-t)}function qa(e,t,n){return(n-e)/(t-e)}function Ya(e){return wa(e.x)>wa(e.y)?wa(e.x)>wa(e.z)?e.x:e.z:wa(e.y)>wa(e.z)?e.y:e.z}function Ka(e,t){return wa(e)>wa(t)?e:t}function Qa(e,t){t.forEach((function(t){Object.defineProperty(e,t,{enumerable:!0})}))}var Za,Ja,$a=(Za=new Float32Array(1),Ja=new Int32Array(Za.buffer),function(e){Za[0]=e;var t=Ja[0],n=t>>16&32768,i=2147483647&t,r=i-(112<<23)+4096>>13;return r=i<113<<23?0:r,r=i>=143<<23?31744:r,r=i>255<<23?32256:r,Ja[0]=n|r,Ja[0]}),eo=function(){var e=new Float32Array(1),t=new Int32Array(e.buffer);return function(n){var i,r=32767&n,s=r<<13;return 31744!==s?(s+=112<<23,0===r?s=(1048575&s)>>1:32767===r&&(s=2147483647)):s=2139095040,i=(n>>15&1)<<31|s,t[0]=i,e[0]}}();function to(e){return $a(e)}function no(e){return eo(e)}var io=Math.abs,ro=Math.max,so=Math.min,ao=Math.PI,oo=Math.sin,uo=Math.cos,co=Math.atan2,ho=Math.sqrt,lo=Math.ceil,fo=Math.floor,po=Math.round;function _o(e,t,n,i){return Object.freeze(new go(e,t,n,i))}var mo,go=e("Vec4",function(e){function t(t,n,i,r){var s;return s=e.call(this)||this,"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=n||0,s.z=i||0,s.w=r||0),s}p(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,n,i,r){return e.x=t,e.y=n,e.z=i,e.w=r,e},t.fromColor=function(e,t){return e.x=t.r,e.y=t.g,e.z=t.b,e.w=t.a,e},t.angle=function(e,t){var n=e.y*t.z-e.z*t.y,i=e.z*t.x-e.x*t.z,r=e.x*t.y-e.y*t.x,s=e.x*t.x+e.y*t.y+e.z*t.z;return co(ho(n*n+i*i+r*r),s)},t.add=function(e,t,n){return e.x=t.x+n.x,e.y=t.y+n.y,e.z=t.z+n.z,e.w=t.w+n.w,e},t.subtract=function(e,t,n){return e.x=t.x-n.x,e.y=t.y-n.y,e.z=t.z-n.z,e.w=t.w-n.w,e},t.multiply=function(e,t,n){return e.x=t.x*n.x,e.y=t.y*n.y,e.z=t.z*n.z,e.w=t.w*n.w,e},t.divide=function(e,t,n){return e.x=t.x/n.x,e.y=t.y/n.y,e.z=t.z/n.z,e.w=t.w/n.w,e},t.ceil=function(e,t){return e.x=lo(t.x),e.y=lo(t.y),e.z=lo(t.z),e.w=lo(t.w),e},t.floor=function(e,t){return e.x=fo(t.x),e.y=fo(t.y),e.z=fo(t.z),e.w=fo(t.w),e},t.min=function(e,t,n){return e.x=so(t.x,n.x),e.y=so(t.y,n.y),e.z=so(t.z,n.z),e.w=so(t.w,n.w),e},t.max=function(e,t,n){return e.x=ro(t.x,n.x),e.y=ro(t.y,n.y),e.z=ro(t.z,n.z),e.w=ro(t.w,n.w),e},t.round=function(e,t){return e.x=po(t.x),e.y=po(t.y),e.z=po(t.z),e.w=po(t.w),e},t.multiplyScalar=function(e,t,n){return e.x=t.x*n,e.y=t.y*n,e.z=t.z*n,e.w=t.w*n,e},t.scaleAndAdd=function(e,t,n,i){return e.x=t.x+n.x*i,e.y=t.y+n.y*i,e.z=t.z+n.z*i,e.w=t.w+n.w*i,e},t.distance=function(e,t){var n=t.x-e.x,i=t.y-e.y,r=t.z-e.z,s=t.w-e.w;return ho(n*n+i*i+r*r+s*s)},t.squaredDistance=function(e,t){var n=t.x-e.x,i=t.y-e.y,r=t.z-e.z,s=t.w-e.w;return n*n+i*i+r*r+s*s},t.len=function(e){var t=e.x,n=e.y,i=e.z,r=e.w;return ho(t*t+n*n+i*i+r*r)},t.lengthSqr=function(e){var t=e.x,n=e.y,i=e.z,r=e.w;return t*t+n*n+i*i+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 n=t.x,i=t.y,r=t.z,s=t.w;return io(n)0?(a=1/ho(a),e.x=n*a,e.y=i*a,e.z=r*a,e.w=s*a):(e.x=0,e.y=0,e.z=0,e.w=0),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,n,i){return e.x=t.x+i*(n.x-t.x),e.y=t.y+i*(n.y-t.y),e.z=t.z+i*(n.z-t.z),e.w=t.w+i*(n.w-t.w),e},t.scale=function(e,t,n){return e.x=t.x*n,e.y=t.y*n,e.z=t.z*n,e.w=t.w*n,e},t.random=function(e,t){t=t||1;var n=2*Na()*ao,i=2*Na()-1,r=ho(1-i*i);return e.x=r*uo(n)*t,e.y=r*oo(n)*t,e.z=i*t,e.w=0,e},t.transformMat4=function(e,t,n){var i=t.x,r=t.y,s=t.z,a=t.w;return e.x=n.m00*i+n.m04*r+n.m08*s+n.m12*a,e.y=n.m01*i+n.m05*r+n.m09*s+n.m13*a,e.z=n.m02*i+n.m06*r+n.m10*s+n.m14*a,e.w=n.m03*i+n.m07*r+n.m11*s+n.m15*a,e},t.transformAffine=function(e,t,n){var i=t.x,r=t.y,s=t.z,a=t.w;return e.x=n.m00*i+n.m04*r+n.m08*s+n.m12*a,e.y=n.m01*i+n.m05*r+n.m09*s+n.m13*a,e.z=n.m02*i+n.m06*r+n.m10*s+n.m14*a,e.w=t.w,e},t.transformQuat=function(e,t,n){var i=t.x,r=t.y,s=t.z,a=n.x,o=n.y,u=n.z,c=n.w,h=c*i+o*s-u*r,l=c*r+u*i-a*s,f=c*s+a*r-o*i,d=-a*i-o*r-u*s;return e.x=h*c+d*-a+l*-u-f*-o,e.y=l*c+d*-o+f*-a-h*-u,e.z=f*c+d*-u+h*-o-l*-a,e.w=t.w,e},t.toArray=function(e,t,n){return void 0===n&&(n=0),e[n+0]=t.x,e[n+1]=t.y,e[n+2]=t.z,e[n+3]=t.w,e},t.fromArray=function(e,t,n){return void 0===n&&(n=0),e.x=t[n+0],e.y=t[n+1],e.z=t[n+2],e.w=t[n+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,n){void 0===n&&(n=Ca);var i=1/0;return!(io(e.x)===i||io(e.y)===i||io(e.z)===i||io(e.w)===i||io(t.x)===i||io(t.y)===i||io(t.z)===i||io(t.w)===i)&&io(e.x-t.x)<=n*ro(1,io(e.x),io(t.x))&&io(e.y-t.y)<=n*ro(1,io(e.y),io(t.y))&&io(e.z-t.z)<=n*ro(1,io(e.z),io(t.z))&&io(e.w-t.w)<=n*ro(1,io(e.w),io(t.w))};var n=t.prototype;return n.clone=function(){return new t(this.x,this.y,this.z,this.w)},n.set=function(e,t,n,i){return"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=n||0,this.w=i||0),this},n.equals=function(e,t){void 0===t&&(t=Ca);var n=this;return io(n.x-e.x)<=t*ro(1,io(n.x),io(e.x))&&io(n.y-e.y)<=t*ro(1,io(n.y),io(e.y))&&io(n.z-e.z)<=t*ro(1,io(n.z),io(e.z))&&io(n.w-e.w)<=t*ro(1,io(n.w),io(e.w))},n.equals4f=function(e,t,n,i,r){void 0===r&&(r=Ca);var s=this;return io(s.x-e)<=r*ro(1,io(s.x),io(e))&&io(s.y-t)<=r*ro(1,io(s.y),io(t))&&io(s.z-n)<=r*ro(1,io(s.z),io(n))&&io(s.w-i)<=r*ro(1,io(s.w),io(i))},n.strictEquals=function(e){return this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w},n.strictEquals4f=function(e,t,n,i){return this.x===e&&this.y===t&&this.z===n&&this.w===i},n.lerp=function(e,t){var n=this,i=n.x,r=n.y,s=n.z,a=n.w;return n.x=i+t*(e.x-i),n.y=r+t*(e.y-r),n.z=s+t*(e.z-s),n.w=a+t*(e.w-a),n},n.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},n.clampf=function(e,t){var n=this;return n.x=Da(n.x,e.x,t.x),n.y=Da(n.y,e.y,t.y),n.z=Da(n.z,e.z,t.z),n.w=Da(n.w,e.w,t.w),n},n.add=function(e){var t=this;return t.x+=e.x,t.y+=e.y,t.z+=e.z,t.w+=e.w,t},n.add4f=function(e,t,n,i){var r=this;return r.x+=e,r.y+=t,r.z+=n,r.w+=i,r},n.subtract=function(e){var t=this;return t.x-=e.x,t.y-=e.y,t.z-=e.z,t.w-=e.w,t},n.subtract4f=function(e,t,n,i){var r=this;return r.x-=e,r.y-=t,r.z-=n,r.w-=i,r},n.multiplyScalar=function(e){var t=this;return t.x*=e,t.y*=e,t.z*=e,t.w*=e,t},n.multiply=function(e){var t=this;return t.x*=e.x,t.y*=e.y,t.z*=e.z,t.w*=e.w,t},n.multiply4f=function(e,t,n,i){var r=this;return r.x*=e,r.y*=t,r.z*=n,r.w*=i,r},n.divide=function(e){var t=this;return t.x/=e.x,t.y/=e.y,t.z/=e.z,t.w/=e.w,t},n.divide4f=function(e,t,n,i){var r=this;return r.x/=e,r.y/=t,r.z/=n,r.w/=i,r},n.negative=function(){var e=this;return e.x=-e.x,e.y=-e.y,e.z=-e.z,e.w=-e.w,e},n.dot=function(e){var t=this;return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},n.cross=function(e){var t=this,n=t.x,i=t.y,r=t.z,s=e.x,a=e.y,o=e.z;return t.x=i*o-r*a,t.y=r*s-n*o,t.z=n*a-i*s,t},n.length=function(){var e=this,t=e.x,n=e.y,i=e.z,r=e.w;return ho(t*t+n*n+i*i+r*r)},n.lengthSqr=function(){var e=this,t=e.x,n=e.y,i=e.z,r=e.w;return t*t+n*n+i*i+r*r},n.normalize=function(){var e=this,t=e.x,n=e.y,i=e.z,r=e.w,s=t*t+n*n+i*i+r*r;return s>0&&(s=1/ho(s),e.x=t*s,e.y=n*s,e.z=i*s,e.w=r*s),e},n.scale=function(e){var t=this;return t.x*=e,t.y*=e,t.z*=e,t.w*=e,t},n.transformMat4=function(e){var t=this,n=t.x,i=t.y,r=t.z,s=t.w;return t.x=e.m00*n+e.m04*i+e.m08*r+e.m12*s,t.y=e.m01*n+e.m05*i+e.m09*r+e.m13*s,t.z=e.m02*n+e.m06*i+e.m10*r+e.m14*s,t.w=e.m03*n+e.m07*i+e.m11*r+e.m15*s,t},t}(St));function vo(e,t,n,i){return new go(e,t,n,i)}go.ZERO=_o(0,0,0,0),go.ONE=_o(1,1,1,1),go.NEG_ONE=_o(-1,-1,-1,-1),go.UNIT_X=_o(1,0,0,0),go.UNIT_Y=_o(0,1,0,0),go.UNIT_Z=_o(0,0,1,0),go.UNIT_W=_o(0,0,0,1),En.fastDefine("cc.Vec4",go,{x:0,y:0,z:0,w:0}),u.Vec4=go,u.v4=vo;var yo=Math.abs,bo=Math.max,wo=Math.min,To=Math.PI,So=Math.acos,xo=Math.sin,Eo=Math.cos,Io=Math.sqrt,Ao=Math.ceil,Ro=Math.floor,Co=Math.round;function Oo(e,t,n){return Object.freeze(new Fo(e,t,n))}var Bo,Do,Po,Mo,Fo=e("Vec3",function(e){function t(t,n,i){var r;return r=e.call(this)||this,"object"==typeof t?(r.x=t.x,r.y=t.y,r.z=t.z):(r.x=t||0,r.y=n||0,r.z=i||0),r}p(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,n,i){return e.x=t,e.y=n,e.z=i,e},t.add=function(e,t,n){return e.x=t.x+n.x,e.y=t.y+n.y,e.z=t.z+n.z,e},t.subtract=function(e,t,n){return e.x=t.x-n.x,e.y=t.y-n.y,e.z=t.z-n.z,e},t.multiply=function(e,t,n){return e.x=t.x*n.x,e.y=t.y*n.y,e.z=t.z*n.z,e},t.divide=function(e,t,n){return e.x=t.x/n.x,e.y=t.y/n.y,e.z=t.z/n.z,e},t.ceil=function(e,t){return e.x=Ao(t.x),e.y=Ao(t.y),e.z=Ao(t.z),e},t.floor=function(e,t){return e.x=Ro(t.x),e.y=Ro(t.y),e.z=Ro(t.z),e},t.min=function(e,t,n){return e.x=wo(t.x,n.x),e.y=wo(t.y,n.y),e.z=wo(t.z,n.z),e},t.max=function(e,t,n){return e.x=bo(t.x,n.x),e.y=bo(t.y,n.y),e.z=bo(t.z,n.z),e},t.round=function(e,t){return e.x=Co(t.x),e.y=Co(t.y),e.z=Co(t.z),e},t.multiplyScalar=function(e,t,n){return e.x=t.x*n,e.y=t.y*n,e.z=t.z*n,e},t.scaleAndAdd=function(e,t,n,i){return e.x=t.x+n.x*i,e.y=t.y+n.y*i,e.z=t.z+n.z*i,e},t.distance=function(e,t){var n=t.x-e.x,i=t.y-e.y,r=t.z-e.z;return Io(n*n+i*i+r*r)},t.squaredDistance=function(e,t){var n=t.x-e.x,i=t.y-e.y,r=t.z-e.z;return n*n+i*i+r*r},t.len=function(e){var t=e.x,n=e.y,i=e.z;return Io(t*t+n*n+i*i)},t.lengthSqr=function(e){var t=e.x,n=e.y,i=e.z;return t*t+n*n+i*i},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 n=t.x,i=t.y,r=t.z;return yo(n)0?(s=1/Io(s),e.x=n*s,e.y=i*s,e.z=r*s):(e.x=0,e.y=0,e.z=0),e},t.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},t.cross=function(e,t,n){var i=t.x,r=t.y,s=t.z,a=n.x,o=n.y,u=n.z;return e.x=r*u-s*o,e.y=s*a-i*u,e.z=i*o-r*a,e},t.lerp=function(e,t,n,i){return e.x=t.x+i*(n.x-t.x),e.y=t.y+i*(n.y-t.y),e.z=t.z+i*(n.z-t.z),e},t.random=function(e,t){t=t||1;var n=2*Na()*To,i=2*Na()-1,r=Io(1-i*i);return e.x=r*Eo(n)*t,e.y=r*xo(n)*t,e.z=i*t,e},t.transformMat4=function(e,t,n){var i=t.x,r=t.y,s=t.z,a=n.m03*i+n.m07*r+n.m11*s+n.m15;return a=a?1/a:1,e.x=(n.m00*i+n.m04*r+n.m08*s+n.m12)*a,e.y=(n.m01*i+n.m05*r+n.m09*s+n.m13)*a,e.z=(n.m02*i+n.m06*r+n.m10*s+n.m14)*a,e},t.transformMat4Normal=function(e,t,n){var i=t.x,r=t.y,s=t.z,a=n.m03*i+n.m07*r+n.m11*s;return a=a?1/a:1,e.x=(n.m00*i+n.m04*r+n.m08*s)*a,e.y=(n.m01*i+n.m05*r+n.m09*s)*a,e.z=(n.m02*i+n.m06*r+n.m10*s)*a,e},t.transformMat3=function(e,t,n){var i=t.x,r=t.y,s=t.z;return e.x=i*n.m00+r*n.m03+s*n.m06,e.y=i*n.m01+r*n.m04+s*n.m07,e.z=i*n.m02+r*n.m05+s*n.m08,e},t.transformAffine=function(e,t,n){var i=t.x,r=t.y,s=t.z;return e.x=n.m00*i+n.m04*r+n.m08*s+n.m12,e.y=n.m01*i+n.m05*r+n.m09*s+n.m13,e.z=n.m02*i+n.m06*r+n.m10*s+n.m14,e},t.transformQuat=function(e,t,n){var i=n.w*t.x+n.y*t.z-n.z*t.y,r=n.w*t.y+n.z*t.x-n.x*t.z,s=n.w*t.z+n.x*t.y-n.y*t.x,a=-n.x*t.x-n.y*t.y-n.z*t.z;return e.x=i*n.w+a*-n.x+r*-n.z-s*-n.y,e.y=r*n.w+a*-n.y+s*-n.x-i*-n.z,e.z=s*n.w+a*-n.z+i*-n.y-r*-n.x,e},t.transformRTS=function(e,t,n,i,r){var s=t.x*r.x,a=t.y*r.y,o=t.z*r.z,u=n.w*s+n.y*o-n.z*a,c=n.w*a+n.z*s-n.x*o,h=n.w*o+n.x*a-n.y*s,l=-n.x*s-n.y*a-n.z*o;return e.x=u*n.w+l*-n.x+c*-n.z-h*-n.y+i.x,e.y=c*n.w+l*-n.y+h*-n.x-u*-n.z+i.y,e.z=h*n.w+l*-n.z+u*-n.y-c*-n.x+i.z,e},t.transformInverseRTS=function(e,t,n,i,r){var s=t.x-i.x,a=t.y-i.y,o=t.z-i.z,u=n.w*s-n.y*o+n.z*a,c=n.w*a-n.z*s+n.x*o,h=n.w*o-n.x*a+n.y*s,l=n.x*s+n.y*a+n.z*o;return e.x=(u*n.w+l*n.x+c*n.z-h*n.y)/r.x,e.y=(c*n.w+l*n.y+h*n.x-u*n.z)/r.y,e.z=(h*n.w+l*n.z+u*n.y-c*n.x)/r.z,e},t.rotateX=function(e,t,n,i){var r=t.x-n.x,s=t.y-n.y,a=t.z-n.z,o=Eo(i),u=xo(i),c=r,h=s*o-a*u,l=s*u+a*o;return e.x=c+n.x,e.y=h+n.y,e.z=l+n.z,e},t.rotateY=function(e,t,n,i){var r=t.x-n.x,s=t.y-n.y,a=t.z-n.z,o=Eo(i),u=xo(i),c=a*u+r*o,h=s,l=a*o-r*u;return e.x=c+n.x,e.y=h+n.y,e.z=l+n.z,e},t.rotateZ=function(e,t,n,i){var r=t.x-n.x,s=t.y-n.y,a=t.z-n.z,o=Eo(i),u=xo(i),c=r*o-s*u,h=r*u+s*o,l=a;return e.x=c+n.x,e.y=h+n.y,e.z=l+n.z,e},t.rotateN=function(e,t,n,i,r){var s=t.x-n.x,a=t.y-n.y,o=t.z-n.z,u=i.x,c=i.y,h=i.z,l=Eo(r),f=xo(r),d=s*(u*u*(1-l)+l)+a*(u*c*(1-l)-h*f)+o*(u*h*(1-l)+c*f),p=s*(u*c*(1-l)+h*f)+a*(c*c*(1-l)+l)+o*(c*h*(1-l)-u*f),_=s*(u*h*(1-l)-c*f)+a*(c*h*(1-l)+u*f)+o*(h*h*(1-l)+l);return e.x=d+n.x,e.y=p+n.y,e.z=_+n.z,e},t.toArray=function(e,t,n){return void 0===n&&(n=0),e[n+0]=t.x,e[n+1]=t.y,e[n+2]=t.z,e},t.fromArray=function(e,t,n){return void 0===n&&(n=0),e.x=t[n+0],e.y=t[n+1],e.z=t[n+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,n){void 0===n&&(n=Ca);var i=e.x,r=e.y,s=e.z,a=t.x,o=t.y,u=t.z;return yo(i-a)<=n*bo(1,yo(i),yo(a))&&yo(r-o)<=n*bo(1,yo(r),yo(o))&&yo(s-u)<=n*bo(1,yo(s),yo(u))},t.angle=function(e,t){var n=e.x*e.x+e.y*e.y+e.z*e.z,i=t.x*t.x+t.y*t.y+t.z*t.z;if(0===n||0===i)return 0;var r=(e.x*t.x+e.y*t.y+e.z*t.z)/Io(n*i);return r=Da(r,-1,1),So(r)},t.projectOnPlane=function(e,n,i){return t.subtract(e,n,t.project(e,n,i))},t.project=function(e,n,i){var r=t.lengthSqr(i);return r<1e-6?t.set(e,0,0,0):t.multiplyScalar(e,i,t.dot(n,i)/r)},t.moveTowards=function(e,t,n,i){var r=n.x-t.x,s=n.y-t.y,a=n.z-t.z,o=r*r+s*s+a*a;if(0===o||i>=0&&o0&&(r=1/Io(r),e.x=t*r,e.y=n*r,e.z=i*r),e},n.transformMat4=function(e){var t=this,n=t.x,i=t.y,r=t.z,s=e.m03*n+e.m07*i+e.m11*r+e.m15;return s=s?1/s:1,t.x=(e.m00*n+e.m04*i+e.m08*r+e.m12)*s,t.y=(e.m01*n+e.m05*i+e.m09*r+e.m13)*s,t.z=(e.m02*n+e.m06*i+e.m10*r+e.m14)*s,t},n.toVec2=function(){return new u.Vec2(this.x,this.y)},t}(St));function Lo(e,t,n){return new Fo(e,t,n)}mo=Fo,Fo.UNIT_X=Oo(1,0,0),Fo.UNIT_Y=Oo(0,1,0),Fo.UNIT_Z=Oo(0,0,1),Fo.RIGHT=Oo(1,0,0),Fo.UP=Oo(0,1,0),Fo.FORWARD=Oo(0,0,-1),Fo.ZERO=Oo(0,0,0),Fo.ONE=Oo(1,1,1),Fo.NEG_ONE=Oo(-1,-1,-1),Fo.slerp=(Bo=new mo,Do=new mo,Po=new mo,function(e,t,n,i){var r=1e-5,s=mo.len(t),a=mo.len(n);if(s.99999)return mo.lerp(e,t,n,i);if(u<-.99999){var c=mo.multiplyScalar(Bo,t,1/s),h=mo.generateOrthogonal(Do,c);return ko(Po,c,h,To*i),mo.multiplyScalar(e,Po,o),e}var l=u,f=So(l)*i,d=mo.multiplyScalar(Bo,t,1/s),p=mo.multiplyScalar(Do,n,1/a);return mo.scaleAndAdd(Po,p,d,-l),mo.normalize(Po,Po),mo.multiplyScalar(Po,Po,xo(f)),mo.scaleAndAdd(Po,Po,d,Eo(f)),mo.multiplyScalar(e,Po,o),e}),Fo.signedAngle=(Mo=new mo,function(e,t,n){var i=mo.angle(e,t),r=mo.cross(Mo,e,t);return mo.dot(r,n)<0?-i:i}),En.fastDefine("cc.Vec3",Fo,{x:0,y:0,z:0}),u.Vec3=Fo;var No,ko=(No={x:0,y:0,z:0,w:0},function(e,t,n,i){var r=.5*i,s=xo(r);return No.x=s*n.x,No.y=s*n.y,No.z=s*n.z,No.w=Eo(r),Fo.transformQuat(e,t,No),e});u.v3=Lo;var zo=1/255,Uo=Math.abs,Go=Math.max;function Vo(e,t,n,i){return Object.freeze(new Wo(e,t,n,i))}var Ho,Wo=e("Color",function(e){function t(t,n,i,r){var s;return(s=e.call(this)||this)._data=new Uint8ClampedArray(4),"string"==typeof t?s.fromHEX(t):void 0!==n?s.set(t,n,i,r):s.set(t),s}p(t,e),t.clone=function(e){var n=new t;return n.r=e.r,n.g=e.g,n.b=e.b,n.a=e.a,n},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,n,i,r){return e.r=t,e.g=n,e.b=i,e.a=r,e},t.toVec4=function(e,t){var n=e._data;return(t=void 0!==t?t:new go).x=n[0]*zo,t.y=n[1]*zo,t.z=n[2]*zo,t.w=n[3]*zo,t},t.fromVec4=function(e,n){var i=(n=void 0===n?new t:n)._data;return i[0]=e.x/zo,i[1]=e.y/zo,i[2]=e.z/zo,i[3]=e.w/zo,n},t.fromHEX=function(e,t){var n;return"string"==typeof t?(6===(t="#"===t[0]?t.substring(1):t).length?t+="FF":3===t.length?t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]+"FF":4===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]),n=Number("0x"+t)):(t<16777216&&(t=255+(t<<8)),n=t),e.r=n>>>24,e.g=(16711680&n)>>>16,e.b=(65280&n)>>>8,e.a=255&n,e},t.add=function(e,t,n){return e.r=t.r+n.r,e.g=t.g+n.g,e.b=t.b+n.b,e.a=t.a+n.a,e},t.subtract=function(e,t,n){return e.r=t.r-n.r,e.g=t.g-n.g,e.b=t.b-n.b,e.a=t.a-n.a,e},t.multiply=function(e,t,n){return e.r=t.r*n.r,e.g=t.g*n.g,e.b=t.b*n.b,e.a=t.a*n.a,e},t.divide=function(e,t,n){return e.r=t.r/n.r,e.g=t.g/n.g,e.b=t.b/n.b,e.a=t.a/n.a,e},t.scale=function(e,t,n){return e.r=t.r*n,e.g=t.g*n,e.b=t.b*n,e.a=t.a*n,e},t.lerp=function(e,t,n,i){var r=t.r,s=t.g,a=t.b,o=t.a;return e.r=r+(n.r-r)*i,e.g=s+(n.g-s)*i,e.b=a+(n.b-a)*i,e.a=o+(n.a-o)*i,e},t.toArray=function(e,n,i){void 0===i&&(i=0);var r=n instanceof t||n.a>1?1/255:1;return e[i+0]=n.r*r,e[i+1]=n.g*r,e[i+2]=n.b*r,e[i+3]=n.a*r,e},t.fromArray=function(e,t,n){return void 0===n&&(n=0),t.r=255*e[n+0],t.g=255*e[n+1],t.b=255*e[n+2],t.a=255*e[n+3],t},t.fromUint32=function(e,t){return t>>>=0,e.r=255&t,e.g=t>>8&255,e.b=t>>16&255,e.a=t>>24&255,e},t.toUint32=function(e){return(e.a<<24|e.b<<16|e.g<<8|e.r)>>>0},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,n){return void 0===n&&(n=Ca),!(Uo(e.r)===1/0||Uo(e.g)===1/0||Uo(e.b)===1/0||Uo(e.a)===1/0)&&Uo(e.r-t.r)<=n*Go(1,Uo(e.r),Uo(t.r))&&Uo(e.g-t.g)<=n*Go(1,Uo(e.g),Uo(t.g))&&Uo(e.b-t.b)<=n*Go(1,Uo(e.b),Uo(t.b))&&Uo(e.a-t.a)<=n*Go(1,Uo(e.a),Uo(t.a))},t.hex=function(e){return(255*e.r<<24|255*e.g<<16|255*e.b<<8|255*e.a)>>>0};var n=t.prototype;return n.clone=function(){var e=new t;return e._data.set(this._data),e},n.equals=function(e){var t=e,n=this._data;return e&&n[0]===t.r&&n[1]===t.g&&n[2]===t.b&&n[3]===t.a},n.lerp=function(e,n){return t.lerp(this,this,e,n),this},n.toString=function(){return"rgba("+this.r.toFixed()+", "+this.g.toFixed()+", "+this.b.toFixed()+", "+this.a.toFixed()+")"},n.toCSS=function(e){return void 0===e&&(e="rgba"),"rgba"===e?"rgba("+this.r+","+this.g+","+this.b+","+(this.a*zo).toFixed(2)+")":"rgb"===e?"rgb("+this.r+","+this.g+","+this.b+")":"#"+this.toHEX(e)},n.fromHEX=function(e){var t;return"string"==typeof e?(6===(e="#"===e[0]?e.substring(1):e).length?e+="FF":3===e.length?e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+"FF":4===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),t=Number("0x"+e)):(e<16777216&&(e=255+(e<<8)),t=e),this.r=t>>>24,this.g=(16711680&t)>>>16,this.b=(65280&t)>>>8,this.a=255&t,this},n.toHEX=function(e){void 0===e&&(e="#rrggbb");var t=this._data,n="0",i=[(t[0]<16?n:"")+t[0].toString(16),(t[1]<16?n:"")+t[1].toString(16),(t[2]<16?n:"")+t[2].toString(16)];return"#rgb"===e?(i[0]=i[0][0],i[1]=i[1][0],i[2]=i[2][0]):"#rrggbbaa"===e&&i.push((t[3]<16?n:"")+t[3].toString(16)),i.join("")},n.toRGBValue=function(){return this._data[2]<<16|this._data[1]<<8|this._data[0]},n.fromHSV=function(e,t,n){var i=0,r=0,s=0;if(0===t)i=r=s=n;else if(0===n)i=r=s=0;else{1===e&&(e=0),e*=6;var a=Math.floor(e),o=e-a,u=n*(1-t),c=n*(1-t*o),h=n*(1-t*(1-o));switch(a){default:case 0:i=n,r=h,s=u;break;case 1:i=c,r=n,s=u;break;case 2:i=u,r=n,s=h;break;case 3:i=u,r=c,s=n;break;case 4:i=h,r=u,s=n;break;case 5:i=n,r=u,s=c}}var l=this._data;return l[0]=255*i,l[1]=255*r,l[2]=255*s,this},n.toHSV=function(){var e=this._data[0]*zo,t=this._data[1]*zo,n=this._data[2]*zo,i={h:0,s:0,v:0},r=Math.max(e,t,n),s=Math.min(e,t,n),a=0;return i.v=r,i.s=r?(r-s)/r:0,i.s?(a=r-s,i.h=e===r?(t-n)/a:t===r?2+(n-e)/a:4+(e-t)/a,i.h/=6,i.h<0&&(i.h+=1)):i.h=0,i},n.set=function(e,t,n,i){var r=this._data;if("object"==typeof e){var s,a,o,u,c=e;c._data?r.set(c._data):(r[0]=null!==(s=c.r)&&void 0!==s?s:0,r[1]=null!==(a=c.g)&&void 0!==a?a:0,r[2]=null!==(o=c.b)&&void 0!==o?o:0,r[3]=null!==(u=c.a)&&void 0!==u?u:255)}else r[0]=null!=e?e:0,r[1]=null!=t?t:0,r[2]=null!=n?n:0,r[3]=null!=i?i:255;return this},n.multiply=function(e){var t=this._data;return t[0]*=e.r/255,t[1]*=e.g/255,t[2]*=e.b/255,t[3]*=e.a/255,this},n.getModifiableProperties=function(){return["r","g","b","a"]},f(t,[{key:"r",get:function(){return this._data[0]},set:function(e){this._data[0]=e}},{key:"g",get:function(){return this._data[1]},set:function(e){this._data[1]=e}},{key:"b",get:function(){return this._data[2]},set:function(e){this._data[2]=e}},{key:"a",get:function(){return this._data[3]},set:function(e){this._data[3]=e}},{key:"x",get:function(){return this._data[0]*zo},set:function(e){this._data[0]=255*e}},{key:"y",get:function(){return this._data[1]*zo},set:function(e){this._data[1]=255*e}},{key:"z",get:function(){return this._data[2]*zo},set:function(e){this._data[2]=255*e}},{key:"w",get:function(){return this._data[3]*zo},set:function(e){this._data[3]=255*e}}]),t}(St));function jo(e,t,n,i){return new Wo(e,t,n,i)}function Xo(e,t,n){if(t>n){var i=t;t=n,n=i}return en?n:e}function qo(e){var t=e.clone();return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t}function Yo(e){var t=Math.max(Math.max(e.x,e.y),e.z),n=128;t>1e-4&&(n=Math.log(t)/Math.log(1.1),n=Da((n=Math.ceil(n))+128,0,255));var i=1/Math.pow(1.1,n-128),r=Xo(e.multiplyScalar(i),new Fo(0,0,0),new Fo(1,1,1));r.multiplyScalar(255);var s,a,o=qo(r).add((s=r.subtract(qo(r)))<(a=new Fo(.5,.5,.5))?a:s);return new go(o.x/255,o.y/255,o.z/255,n/255)}Wo.WHITE=Vo(255,255,255,255),Wo.GRAY=Vo(127,127,127,255),Wo.BLACK=Vo(0,0,0,255),Wo.TRANSPARENT=Vo(0,0,0,0),Wo.RED=Vo(255,0,0,255),Wo.GREEN=Vo(0,255,0,255),Wo.BLUE=Vo(0,0,255,255),Wo.CYAN=Vo(0,255,255,255),Wo.MAGENTA=Vo(255,0,255,255),Wo.YELLOW=Vo(255,255,0,255),En.fastDefine("cc.Color",Wo,{r:0,g:0,b:0,a:255}),u.Color=Wo,u.color=jo;var Ko=Math.abs,Qo=Math.max,Zo=e("Mat3",function(e){function t(t,n,i,r,s,a,o,u,c){var h;void 0===t&&(t=1),void 0===n&&(n=0),void 0===i&&(i=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===c&&(c=1);var l=b(h=e.call(this)||this);return"object"==typeof t?(l.m00=t.m00,l.m01=t.m01,l.m02=t.m02,l.m03=t.m03,l.m04=t.m04,l.m05=t.m05,l.m06=t.m06,l.m07=t.m07,l.m08=t.m08):(l.m00=t,l.m01=n,l.m02=i,l.m03=r,l.m04=s,l.m05=a,l.m06=o,l.m07=u,l.m08=c),h}p(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,n,i,r,s,a,o,u,c){return e.m00=t,e.m01=n,e.m02=i,e.m03=r,e.m04=s,e.m05=a,e.m06=o,e.m07=u,e.m08=c,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 n=t.m01,i=t.m02,r=t.m05;e.m01=t.m03,e.m02=t.m06,e.m03=n,e.m05=t.m07,e.m06=i,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,n){var i=n.m00,r=n.m01,s=n.m02,a=n.m03,o=n.m04,u=n.m05,c=n.m06,h=n.m07,l=n.m08,f=l*o-u*h,d=-l*a+u*c,p=h*a-o*c,_=i*f+r*d+s*p;return 0===_?(t.set(e,0,0,0,0,0,0,0,0,0),e):(_=1/_,e.m00=f*_,e.m01=(-l*r+s*h)*_,e.m02=(u*r-s*o)*_,e.m03=d*_,e.m04=(l*i-s*c)*_,e.m05=(-u*i+s*a)*_,e.m06=p*_,e.m07=(-h*i+r*c)*_,e.m08=(o*i-r*a)*_,e)},t.determinant=function(e){var t=e.m00,n=e.m01,i=e.m02,r=e.m03,s=e.m04,a=e.m05,o=e.m06,u=e.m07,c=e.m08;return t*(c*s-a*u)+n*(-c*r+a*o)+i*(u*r-s*o)},t.multiply=function(e,t,n){var i=t.m00,r=t.m01,s=t.m02,a=t.m03,o=t.m04,u=t.m05,c=t.m06,h=t.m07,l=t.m08,f=n.m00,d=n.m01,p=n.m02,_=n.m03,m=n.m04,g=n.m05,v=n.m06,y=n.m07,b=n.m08;return e.m00=f*i+d*a+p*c,e.m01=f*r+d*o+p*h,e.m02=f*s+d*u+p*l,e.m03=_*i+m*a+g*c,e.m04=_*r+m*o+g*h,e.m05=_*s+m*u+g*l,e.m06=v*i+y*a+b*c,e.m07=v*r+y*o+b*h,e.m08=v*s+y*u+b*l,e},t.multiplyMat4=function(e,t,n){var i=t.m00,r=t.m01,s=t.m02,a=t.m03,o=t.m04,u=t.m05,c=t.m06,h=t.m07,l=t.m08,f=n.m00,d=n.m01,p=n.m02,_=n.m04,m=n.m05,g=n.m06,v=n.m08,y=n.m09,b=n.m10;return e.m00=f*i+d*a+p*c,e.m01=f*r+d*o+p*h,e.m02=f*s+d*u+p*l,e.m03=_*i+m*a+g*c,e.m04=_*r+m*o+g*h,e.m05=_*s+m*u+g*l,e.m06=v*i+y*a+b*c,e.m07=v*r+y*o+b*h,e.m08=v*s+y*u+b*l,e},t.transform=function(e,t,n){this.translate(e,t,n)},t.translate=function(e,t,n){var i=t.m00,r=t.m01,s=t.m02,a=t.m03,o=t.m04,u=t.m05,c=t.m06,h=t.m07,l=t.m08,f=n.x,d=n.y;return e.m00=i,e.m01=r,e.m02=s,e.m03=a,e.m04=o,e.m05=u,e.m06=f*i+d*a+c,e.m07=f*r+d*o+h,e.m08=f*s+d*u+l,e},t.scale=function(e,t,n){var i=n.x,r=n.y;return e.m00=i*t.m00,e.m01=i*t.m01,e.m02=i*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,n){var i=t.m00,r=t.m01,s=t.m02,a=t.m03,o=t.m04,u=t.m05,c=t.m06,h=t.m07,l=t.m08,f=Math.sin(n),d=Math.cos(n);return e.m00=d*i+f*a,e.m01=d*r+f*o,e.m02=d*s+f*u,e.m03=d*a-f*i,e.m04=d*o-f*r,e.m05=d*u-f*s,e.m06=c,e.m07=h,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,n,i){return Fo.lengthSqr(n)-.999?(t.x=Math.asin(-o),t.y=Math.atan2(a,u),t.z=Math.atan2(i,s),!0):(t.x=Aa,t.y=Math.atan2(r,n),t.z=0,!1):(t.x=-Aa,t.y=Math.atan2(-r,n),t.z=0,!1)};var n=t.prototype;return n.clone=function(){return new t(this)},n.set=function(e,t,n,i,r,s,a,o,u){void 0===e&&(e=1),void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=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);var c=this;return"object"==typeof e?(c.m00=e.m00,c.m01=e.m01,c.m02=e.m02,c.m03=e.m03,c.m04=e.m04,c.m05=e.m05,c.m06=e.m06,c.m07=e.m07,c.m08=e.m08):(c.m00=e,c.m01=t,c.m02=n,c.m03=i,c.m04=r,c.m05=s,c.m06=a,c.m07=o,c.m08=u),c},n.equals=function(e,n){return void 0===n&&(n=Ca),t.equals(this,e,n)},n.strictEquals=function(e){return t.strictEquals(this,e)},n.toString=function(){var e=this;return"[\n"+e.m00+", "+e.m01+", "+e.m02+",\n"+e.m03+", "+e.m04+", "+e.m05+",\n"+e.m06+", "+e.m07+", "+e.m08+"\n]"},n.identity=function(){return t.identity(this)},n.transpose=function(){var e=this,t=e.m01,n=e.m02,i=e.m05;return e.m01=e.m03,e.m02=e.m06,e.m03=t,e.m05=e.m07,e.m06=n,e.m07=i,e},n.invert=function(){return t.invert(this,this)},n.determinant=function(){return t.determinant(this)},n.add=function(e){var t=this;return t.m00+=e.m00,t.m01+=e.m01,t.m02+=e.m02,t.m03+=e.m03,t.m04+=e.m04,t.m05+=e.m05,t.m06+=e.m06,t.m07+=e.m07,t.m08+=e.m08,t},n.subtract=function(e){var t=this;return t.m00-=e.m00,t.m01-=e.m01,t.m02-=e.m02,t.m03-=e.m03,t.m04-=e.m04,t.m05-=e.m05,t.m06-=e.m06,t.m07-=e.m07,t.m08-=e.m08,t},n.multiply=function(e){return t.multiply(this,this,e)},n.multiplyScalar=function(e){var t=this;return t.m00*=e,t.m01*=e,t.m02*=e,t.m03*=e,t.m04*=e,t.m05*=e,t.m06*=e,t.m07*=e,t.m08*=e,t},n.scale=function(e){var t=e.x,n=e.y,i=this;return i.m00*=t,i.m01*=t,i.m02*=t,i.m03*=n,i.m04*=n,i.m05*=n,i},n.rotate=function(e){var t=this,n=t.m00,i=t.m01,r=t.m02,s=t.m03,a=t.m04,o=t.m05,u=t.m06,c=t.m07,h=t.m08,l=Math.sin(e),f=Math.cos(e);return t.m00=f*n+l*s,t.m01=f*i+l*a,t.m02=f*r+l*o,t.m03=f*s-l*n,t.m04=f*a-l*i,t.m05=f*o-l*r,t.m06=u,t.m07=c,t.m08=h,t},n.fromQuat=function(e){var t=e.x,n=e.y,i=e.z,r=e.w,s=t+t,a=n+n,o=i+i,u=t*s,c=n*s,h=n*a,l=i*s,f=i*a,d=i*o,p=r*s,_=r*a,m=r*o,g=this;return g.m00=1-h-d,g.m03=c-m,g.m06=l+_,g.m01=c+m,g.m04=1-u-d,g.m07=f-p,g.m02=l-_,g.m05=f+p,g.m08=1-u-h,g},t}(St));Ho=Zo,Zo.IDENTITY=Object.freeze(new Ho);var Jo,$o=new Fo,eu=new Fo;En.fastDefine("cc.Mat3",Zo,{m00:1,m01:0,m02:0,m03:0,m04:1,m05:0,m06:0,m07:0,m08:1}),u.Mat3=Zo;var tu=Math.abs,nu=Math.max,iu=Math.min,ru=Math.PI,su=Math.acos,au=Math.sin,ou=Math.cos,uu=Math.sqrt,cu=Math.atan2,hu=Math.asin,lu=Math.sign,fu=e("Quat",function(e){function t(t,n,i,r){var s;return s=e.call(this)||this,"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=n||0,s.z=i||0,s.w=null!=r?r:1),s}p(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,n,i,r){return e.x=t,e.y=n,e.z=i,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,n,i){var r=Fo.dot(n,i);return r<-.999999?(Fo.cross(mu,Fo.UNIT_X,n),mu.length()<1e-6&&Fo.cross(mu,Fo.UNIT_Y,n),Fo.normalize(mu,mu),t.fromAxisAngle(e,mu,ru),e):r>.999999?(e.x=0,e.y=0,e.z=0,e.w=1,e):(Fo.cross(mu,n,i),e.x=mu.x,e.y=mu.y,e.z=mu.z,e.w=1+r,t.normalize(e,e))},t.getAxisAngle=function(e,t){var n=2*su(t.w),i=au(n/2);return 0!==i?(e.x=t.x/i,e.y=t.y/i,e.z=t.z/i):(e.x=1,e.y=0,e.z=0),n},t.multiply=function(e,t,n){var i=t.x*n.w+t.w*n.x+t.y*n.z-t.z*n.y,r=t.y*n.w+t.w*n.y+t.z*n.x-t.x*n.z,s=t.z*n.w+t.w*n.z+t.x*n.y-t.y*n.x,a=t.w*n.w-t.x*n.x-t.y*n.y-t.z*n.z;return e.x=i,e.y=r,e.z=s,e.w=a,e},t.multiplyScalar=function(e,t,n){return e.x=t.x*n,e.y=t.y*n,e.z=t.z*n,e.w=t.w*n,e},t.scaleAndAdd=function(e,t,n,i){return e.x=t.x+n.x*i,e.y=t.y+n.y*i,e.z=t.z+n.z*i,e.w=t.w+n.w*i,e},t.rotateX=function(e,t,n){var i=au(n*=.5),r=ou(n),s=t.x,a=t.y,o=t.z,u=t.w;return e.x=s*r+u*i,e.y=a*r+o*i,e.z=o*r-a*i,e.w=u*r-s*i,e},t.rotateY=function(e,t,n){var i=au(n*=.5),r=ou(n),s=t.x,a=t.y,o=t.z,u=t.w;return e.x=s*r-o*i,e.y=a*r+u*i,e.z=o*r+s*i,e.w=u*r-a*i,e},t.rotateZ=function(e,t,n){var i=au(n*=.5),r=ou(n),s=t.x,a=t.y,o=t.z,u=t.w;return e.x=s*r+a*i,e.y=a*r-s*i,e.z=o*r+u*i,e.w=u*r-o*i,e},t.rotateAround=function(e,n,i,r){return t.invert(pu,n),Fo.transformQuat(mu,i,pu),t.fromAxisAngle(pu,mu,r),t.multiply(e,n,pu),e},t.rotateAroundLocal=function(e,n,i,r){return t.fromAxisAngle(pu,i,r),t.multiply(e,n,pu),e},t.calculateW=function(e,t){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=uu(tu(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,n,i){return e.x=t.x+i*(n.x-t.x),e.y=t.y+i*(n.y-t.y),e.z=t.z+i*(n.z-t.z),e.w=t.w+i*(n.w-t.w),e},t.slerp=function(e,t,n,i){var r=0,s=0,a=n.x,o=n.y,u=n.z,c=n.w,h=t.x*n.x+t.y*n.y+t.z*n.z+t.w*n.w;if(h<0&&(h=-h,a=-a,o=-o,u=-u,c=-c),1-h>1e-6){var l=su(h),f=au(l);r=au((1-i)*l)/f,s=au(i*l)/f}else r=1-i,s=i;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*c,e},t.sqlerp=function(e,n,i,r,s,a){return t.slerp(pu,n,s,a),t.slerp(_u,i,r,a),t.slerp(e,pu,_u,2*a*(1-a)),e},t.invert=function(e,t){var n=t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w,i=n?1/n:0;return e.x=-t.x*i,e.y=-t.y*i,e.z=-t.z*i,e.w=t.w*i,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 uu(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 n=t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w;return n>0?(n=1/uu(n),e.x=t.x*n,e.y=t.y*n,e.z=t.z*n,e.w=t.w*n):(e.x=0,e.y=0,e.z=0,e.w=0),e},t.fromAxes=function(e,n,i,r){return Zo.set(gu,n.x,n.y,n.z,i.x,i.y,i.z,r.x,r.y,r.z),t.normalize(e,t.fromMat3(e,gu))},t.fromViewUp=function(e,n,i){return Zo.fromViewUp(gu,n,i),t.normalize(e,t.fromMat3(e,gu))},t.fromAxisAngle=function(e,t,n){var i=au(n*=.5);return e.x=i*t.x,e.y=i*t.y,e.z=i*t.z,e.w=ou(n),e},t.fromMat3=function(e,t){var n=t.m00,i=t.m01,r=t.m02,s=t.m03,a=t.m04,o=t.m05,u=t.m06,c=t.m07,h=t.m08,l=n-a-h,f=a-n-h,d=h-n-a,p=0,_=n+a+h;l>_&&(_=l,p=1),f>_&&(_=f,p=2),d>_&&(_=d,p=3);var m=.5*uu(_+1),g=.25/m;switch(p){case 0:e.w=m,e.x=(o-c)*g,e.y=(u-r)*g,e.z=(i-s)*g;break;case 1:e.w=(o-c)*g,e.x=m,e.y=(i+s)*g,e.z=(u+r)*g;break;case 2:e.w=(u-r)*g,e.x=(i+s)*g,e.y=m,e.z=(o+c)*g;break;case 3:e.w=(i-s)*g,e.x=(u+r)*g,e.y=(o+c)*g,e.z=m;break;default:e.w=1,e.x=0,e.y=0,e.z=0}return e},t.fromEuler=function(e,t,n,i){n*=vu,i*=vu;var r=au(t*=vu),s=ou(t),a=au(n),o=ou(n),u=au(i),c=ou(i);return e.x=r*o*c+s*a*u,e.y=s*a*c+r*o*u,e.z=s*o*u-r*a*c,e.w=s*o*c-r*a*u,e},t.fromAngleZ=function(e,t){return t*=vu,e.x=e.y=0,e.z=au(t),e.w=ou(t),e},t.toAxisX=function(e,t){var n=2*t.y,i=2*t.z;return e.x=1-n*t.y-i*t.z,e.y=n*t.x+i*t.w,e.z=i*t.x-n*t.w,e},t.toAxisY=function(e,t){var n=2*t.x,i=2*t.y,r=2*t.z;return e.x=i*t.x-r*t.w,e.y=1-n*t.x-r*t.z,e.z=r*t.y+n*t.w,e},t.toAxisZ=function(e,t){var n=2*t.x,i=2*t.y,r=2*t.z;return e.x=r*t.x+i*t.w,e.y=r*t.y-n*t.w,e.z=1-n*t.x-i*t.y,e},t.toEuler=function(e,t,n){var i=t.x,r=t.y,s=t.z,a=t.w,o=0,u=0,c=0,h=i*r+s*a;if(h>.499999)o=0,u=La(2*cu(i,a)),c=90;else if(h<-.499999)o=0,u=-La(2*cu(i,a)),c=-90;else{var l=r*r,f=s*s;o=La(cu(2*i*a-2*r*s,1-i*i*2-2*f)),u=La(cu(2*r*a-2*i*s,1-2*l-2*f)),c=La(hu(2*h)),n&&(o=-180*lu(o+1e-6)+o,u=-180*lu(u+1e-6)+u,c=180*lu(c+1e-6)-c)}return e.x=o,e.y=u,e.z=c,e},t.toEulerInYXZOrder=function(e,t){Zo.fromQuat(gu,t),Zo.toEuler(gu,e),e.x=La(e.x),e.y=La(e.y),e.z=La(e.z)},t.toArray=function(e,t,n){return void 0===n&&(n=0),e[n+0]=t.x,e[n+1]=t.y,e[n+2]=t.z,e[n+3]=t.w,e},t.fromArray=function(e,t,n){return void 0===n&&(n=0),e.x=t[n+0],e.y=t[n+1],e.z=t[n+2],e.w=t[n+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,n){return void 0===n&&(n=Ca),tu(e.x-t.x)<=n*nu(1,tu(e.x),tu(t.x))&&tu(e.y-t.y)<=n*nu(1,tu(e.y),tu(t.y))&&tu(e.z-t.z)<=n*nu(1,tu(e.z),tu(t.z))&&tu(e.w-t.w)<=n*nu(1,tu(e.w),tu(t.w))},t.angle=function(e,n){var i=iu(tu(t.dot(e,n)),1);return 2*su(i)},t.rotateTowards=function(e,n,i,r){var s=t.angle(n,i);if(0===s)return e.x=i.x,e.y=i.y,e.z=i.z,e.w=i.w,e;var a=iu(r/La(s),1);return t.slerp(e,n,i,a)};var n=t.prototype;return n.clone=function(){return new t(this.x,this.y,this.z,this.w)},n.set=function(e,t,n,i){return"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=n||0,this.w=null!=i?i:1),this},n.equals=function(e,n){return void 0===n&&(n=Ca),t.equals(this,e,n)},n.strictEquals=function(e){return e&&this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w},n.getEulerAngles=function(e){return t.toEuler(e,this)},n.lerp=function(e,t){var n=this;return n.x+=t*(e.x-n.x),n.y+=t*(e.y-n.y),n.z+=t*(e.z-n.z),n.w+=t*(e.w-n.w),n},n.slerp=function(e,n){return t.slerp(this,this,e,n)},n.length=function(){var e=this,t=e.x,n=e.y,i=e.z,r=e.w;return uu(t*t+n*n+i*i+r*r)},n.lengthSqr=function(){var e=this,t=e.x,n=e.y,i=e.z,r=e.w;return t*t+n*n+i*i+r*r},n.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},t}(St));Jo=fu,fu.IDENTITY=Object.freeze(new Jo);var du,pu=new fu,_u=new fu,mu=new Fo,gu=new Zo,vu=.5*ru/180;function yu(e,t,n,i){return void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=1),new fu(e,t,n,i)}En.fastDefine("cc.Quat",fu,{x:0,y:0,z:0,w:1}),u.Quat=fu,u.quat=yu;var bu=Object.freeze,wu=e("preTransforms",bu([bu([1,0,0,1]),bu([0,1,-1,0]),bu([-1,0,0,-1]),bu([0,-1,1,0])])),Tu=Math.abs,Su=Math.max,xu=Math.sqrt,Eu=Math.sin,Iu=Math.cos,Au=Math.tan,Ru=e("Mat4",function(e){function t(t,n,i,r,s,a,o,u,c,h,l,f,d,p,_,m){var g;void 0===t&&(t=1),void 0===n&&(n=0),void 0===i&&(i=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===c&&(c=0),void 0===h&&(h=0),void 0===l&&(l=1),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===_&&(_=0),void 0===m&&(m=1);var v=b(g=e.call(this)||this);return"object"==typeof t?(v.m00=t.m00,g.m01=t.m01,g.m02=t.m02,g.m03=t.m03,v.m04=t.m04,g.m05=t.m05,g.m06=t.m06,g.m07=t.m07,v.m08=t.m08,g.m09=t.m09,g.m10=t.m10,g.m11=t.m11,v.m12=t.m12,g.m13=t.m13,g.m14=t.m14,g.m15=t.m15):(v.m00=t,g.m01=n,g.m02=i,g.m03=r,v.m04=s,g.m05=a,g.m06=o,g.m07=u,v.m08=c,g.m09=h,g.m10=l,g.m11=f,v.m12=d,g.m13=p,g.m14=_,g.m15=m),g}p(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,n,i,r,s,a,o,u,c,h,l,f,d,p,_,m){return e.m00=t,e.m01=n,e.m02=i,e.m03=r,e.m04=s,e.m05=a,e.m06=o,e.m07=u,e.m08=c,e.m09=h,e.m10=l,e.m11=f,e.m12=d,e.m13=p,e.m14=_,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.zero=function(e){return 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},t.transpose=function(e,t){if(e===t){var n=t.m01,i=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=n,e.m06=t.m09,e.m07=t.m13,e.m08=i,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,n){var i=n.m00,r=n.m01,s=n.m02,a=n.m03,o=n.m04,u=n.m05,c=n.m06,h=n.m07,l=n.m08,f=n.m09,d=n.m10,p=n.m11,_=n.m12,m=n.m13,g=n.m14,v=n.m15,y=i*u-r*o,b=i*c-s*o,w=i*h-a*o,T=r*c-s*u,S=r*h-a*u,x=s*h-a*c,E=l*m-f*_,I=l*g-d*_,A=l*v-p*_,R=f*g-d*m,C=f*v-p*m,O=d*v-p*g,B=y*O-b*C+w*R+T*A-S*I+x*E;return 0===B?t.zero(e):(B=1/B,e.m00=(u*O-c*C+h*R)*B,e.m01=(s*C-r*O-a*R)*B,e.m02=(m*x-g*S+v*T)*B,e.m03=(d*S-f*x-p*T)*B,e.m04=(c*A-o*O-h*I)*B,e.m05=(i*O-s*A+a*I)*B,e.m06=(g*w-_*x-v*b)*B,e.m07=(l*x-d*w+p*b)*B,e.m08=(o*C-u*A+h*E)*B,e.m09=(r*A-i*C-a*E)*B,e.m10=(_*S-m*w+v*y)*B,e.m11=(f*w-l*S-p*y)*B,e.m12=(u*I-o*R-c*E)*B,e.m13=(i*R-r*I+s*E)*B,e.m14=(m*b-_*T-g*y)*B,e.m15=(l*T-f*b+d*y)*B,e)},t.determinant=function(e){var t=e.m00,n=e.m01,i=e.m02,r=e.m03,s=e.m04,a=e.m05,o=e.m06,u=e.m07,c=e.m08,h=e.m09,l=e.m10,f=e.m11,d=e.m12,p=e.m13,_=e.m14,m=e.m15;return(t*a-n*s)*(l*m-f*_)-(t*o-i*s)*(h*m-f*p)+(t*u-r*s)*(h*_-l*p)+(n*o-i*a)*(c*m-f*d)-(n*u-r*a)*(c*_-l*d)+(i*u-r*o)*(c*p-h*d)},t.multiply=function(e,t,n){var i=t.m00,r=t.m01,s=t.m02,a=t.m03,o=t.m04,u=t.m05,c=t.m06,h=t.m07,l=t.m08,f=t.m09,d=t.m10,p=t.m11,_=t.m12,m=t.m13,g=t.m14,v=t.m15,y=n.m00,b=n.m01,w=n.m02,T=n.m03;return e.m00=y*i+b*o+w*l+T*_,e.m01=y*r+b*u+w*f+T*m,e.m02=y*s+b*c+w*d+T*g,e.m03=y*a+b*h+w*p+T*v,y=n.m04,b=n.m05,w=n.m06,T=n.m07,e.m04=y*i+b*o+w*l+T*_,e.m05=y*r+b*u+w*f+T*m,e.m06=y*s+b*c+w*d+T*g,e.m07=y*a+b*h+w*p+T*v,y=n.m08,b=n.m09,w=n.m10,T=n.m11,e.m08=y*i+b*o+w*l+T*_,e.m09=y*r+b*u+w*f+T*m,e.m10=y*s+b*c+w*d+T*g,e.m11=y*a+b*h+w*p+T*v,y=n.m12,b=n.m13,w=n.m14,T=n.m15,e.m12=y*i+b*o+w*l+T*_,e.m13=y*r+b*u+w*f+T*m,e.m14=y*s+b*c+w*d+T*g,e.m15=y*a+b*h+w*p+T*v,e},t.transform=function(e,t,n){var i=n.x,r=n.y,s=n.z;if(t===e)e.m12=t.m00*i+t.m04*r+t.m08*s+t.m12,e.m13=t.m01*i+t.m05*r+t.m09*s+t.m13,e.m14=t.m02*i+t.m06*r+t.m10*s+t.m14,e.m15=t.m03*i+t.m07*r+t.m11*s+t.m15;else{var a=t.m00,o=t.m01,u=t.m02,c=t.m03,h=t.m04,l=t.m05,f=t.m06,d=t.m07,p=t.m08,_=t.m09,m=t.m10,g=t.m11;e.m00=a,e.m01=o,e.m02=u,e.m03=c,e.m04=h,e.m05=l,e.m06=f,e.m07=d,e.m08=p,e.m09=_,e.m10=m,e.m11=g,e.m12=a*i+h*r+p*s+t.m12,e.m13=o*i+l*r+_*s+t.m13,e.m14=u*i+f*r+m*s+t.m14,e.m15=c*i+d*r+g*s+t.m15}return e},t.translate=function(e,t,n){return t===e?(e.m12+=n.x,e.m13+=n.y,e.m14+=n.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=t.m12+n.x,e.m13=t.m13+n.y,e.m14=t.m14+n.z,e.m15=t.m15),e},t.scale=function(e,t,n){var i=n.x,r=n.y,s=n.z;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*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,n,i){var r=i.x,s=i.y,a=i.z,o=xu(r*r+s*s+a*a);if(Tu(o)0?(i=2*xu(n+1),e.w=.25*i,e.x=(t.m06-t.m09)/i,e.y=(t.m08-t.m02)/i,e.z=(t.m01-t.m04)/i):t.m00>t.m05&&t.m00>t.m10?(i=2*xu(1+t.m00-t.m05-t.m10),e.w=(t.m06-t.m09)/i,e.x=.25*i,e.y=(t.m01+t.m04)/i,e.z=(t.m08+t.m02)/i):t.m05>t.m10?(i=2*xu(1+t.m05-t.m00-t.m10),e.w=(t.m08-t.m02)/i,e.x=(t.m01+t.m04)/i,e.y=.25*i,e.z=(t.m06+t.m09)/i):(i=2*xu(1+t.m10-t.m00-t.m05),e.w=(t.m01-t.m04)/i,e.x=(t.m08+t.m02)/i,e.y=(t.m06+t.m09)/i,e.z=.25*i),e},t.toRTS=function(e,n,i,r){t.toSRT(e,n,i,r)},t.toSRT=function(e,t,n,i){n&&Fo.set(n,e.m12,e.m13,e.m14);var r=Fo.set(Cu,e.m00,e.m01,e.m02).length(),s=Fo.set(Cu,e.m04,e.m05,e.m06).length(),a=Fo.set(Cu,e.m08,e.m09,e.m10).length();if(i&&(i.x=r,i.y=s,i.z=a),0!==r&&0!==s&&0!==a){Ou.m00=e.m00/r,Ou.m01=e.m01/r,Ou.m02=e.m02/r,Ou.m03=e.m04/s,Ou.m04=e.m05/s,Ou.m05=e.m06/s,Ou.m06=e.m08/a,Ou.m07=e.m09/a,Ou.m08=e.m10/a;var o=Zo.determinant(Ou);i&&o<0&&(i.x*=-1),t&&(o<0&&(Ou.m00*=-1,Ou.m01*=-1,Ou.m02*=-1),fu.fromMat3(t,Ou))}else t&&fu.identity(t)},t.toEuler=function(e,t){return Zo.set(Ou,e.m00,e.m01,e.m02,e.m04,e.m05,e.m06,e.m08,e.m09,e.m10),Zo.toEuler(Ou,t)},t.fromRTS=function(e,n,i,r){return t.fromSRT(e,n,i,r)},t.fromSRT=function(e,t,n,i){var r=t.x,s=t.y,a=t.z,o=t.w,u=r+r,c=s+s,h=a+a,l=r*u,f=r*c,d=r*h,p=s*c,_=s*h,m=a*h,g=o*u,v=o*c,y=o*h,b=i.x,w=i.y,T=i.z;return e.m00=(1-(p+m))*b,e.m01=(f+y)*b,e.m02=(d-v)*b,e.m03=0,e.m04=(f-y)*w,e.m05=(1-(l+m))*w,e.m06=(_+g)*w,e.m07=0,e.m08=(d+v)*T,e.m09=(_-g)*T,e.m10=(1-(l+p))*T,e.m11=0,e.m12=n.x,e.m13=n.y,e.m14=n.z,e.m15=1,e},t.fromRTSOrigin=function(e,n,i,r,s){return t.fromSRTOrigin(e,n,i,r,s)},t.fromSRTOrigin=function(e,t,n,i,r){var s=t.x,a=t.y,o=t.z,u=t.w,c=s+s,h=a+a,l=o+o,f=s*c,d=s*h,p=s*l,_=a*h,m=a*l,g=o*l,v=u*c,y=u*h,b=u*l,w=i.x,T=i.y,S=i.z,x=r.x,E=r.y,I=r.z;return e.m00=(1-(_+g))*w,e.m01=(d+b)*w,e.m02=(p-y)*w,e.m03=0,e.m04=(d-b)*T,e.m05=(1-(f+g))*T,e.m06=(m+v)*T,e.m07=0,e.m08=(p+y)*S,e.m09=(m-v)*S,e.m10=(1-(f+_))*S,e.m11=0,e.m12=n.x+x-(e.m00*x+e.m04*E+e.m08*I),e.m13=n.y+E-(e.m01*x+e.m05*E+e.m09*I),e.m14=n.z+I-(e.m02*x+e.m06*E+e.m10*I),e.m15=1,e},t.fromQuat=function(e,t){var n=t.x,i=t.y,r=t.z,s=t.w,a=n+n,o=i+i,u=r+r,c=n*a,h=i*a,l=i*o,f=r*a,d=r*o,p=r*u,_=s*a,m=s*o,g=s*u;return e.m00=1-l-p,e.m01=h+g,e.m02=f-m,e.m03=0,e.m04=h-g,e.m05=1-c-p,e.m06=d+_,e.m07=0,e.m08=f+m,e.m09=d-_,e.m10=1-c-l,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=1,e},t.frustum=function(e,t,n,i,r,s,a){var o=1/(n-t),u=1/(r-i),c=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=(n+t)*o,e.m09=(r+i)*u,e.m10=(a+s)*c,e.m11=-1,e.m12=0,e.m13=0,e.m14=a*s*2*c,e.m15=0,e},t.perspective=function(e,t,n,i,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 c=1/Au(t/2),h=1/(i-r),l=s?c/n:c,f=(s?c:c*n)*o,d=wu[u];return e.m00=l*d[0],e.m01=l*d[1],e.m02=0,e.m03=0,e.m04=f*d[2],e.m05=f*d[3],e.m06=0,e.m07=0,e.m08=0,e.m09=0,e.m10=(r-a*i)*h,e.m11=-1,e.m12=0,e.m13=0,e.m14=r*i*h*(1-a),e.m15=0,e},t.ortho=function(e,t,n,i,r,s,a,o,u,c){void 0===o&&(o=-1),void 0===u&&(u=1),void 0===c&&(c=0);var h=1/(t-n),l=1/(i-r)*u,f=1/(s-a),d=-2*h,p=-2*l,_=(t+n)*h,m=(r+i)*l,g=wu[c];return e.m00=d*g[0],e.m01=d*g[1],e.m02=0,e.m03=0,e.m04=p*g[2],e.m05=p*g[3],e.m06=0,e.m07=0,e.m08=0,e.m09=0,e.m10=f*(1-o),e.m11=0,e.m12=_*g[0]+m*g[2],e.m13=_*g[1]+m*g[3],e.m14=(s-o*a)*f,e.m15=1,e},t.lookAt=function(e,t,n,i){var r=t.x,s=t.y,a=t.z,o=i.x,u=i.y,c=i.z,h=r-n.x,l=s-n.y,f=a-n.z,d=1/xu(h*h+l*l+f*f),p=u*(f*=d)-c*(l*=d),_=c*(h*=d)-o*f,m=o*l-u*h,g=l*(m*=d=1/xu(p*p+_*_+m*m))-f*(_*=d),v=f*(p*=d)-h*m,y=h*_-l*p;return e.m00=p,e.m01=g,e.m02=h,e.m03=0,e.m04=_,e.m05=v,e.m06=l,e.m07=0,e.m08=m,e.m09=y,e.m10=f,e.m11=0,e.m12=-(p*r+_*s+m*a),e.m13=-(g*r+v*s+y*a),e.m14=-(h*r+l*s+f*a),e.m15=1,e},t.inverseTranspose=function(e,t){var n=t.m00,i=t.m01,r=t.m02,s=t.m03,a=t.m04,o=t.m05,u=t.m06,c=t.m07,h=t.m08,l=t.m09,f=t.m10,d=t.m11,p=t.m12,_=t.m13,m=t.m14,g=t.m15,v=n*o-i*a,y=n*u-r*a,b=n*c-s*a,w=i*u-r*o,T=i*c-s*o,S=r*c-s*u,x=h*_-l*p,E=h*m-f*p,I=h*g-d*p,A=l*m-f*_,R=l*g-d*_,C=f*g-d*m,O=v*C-y*R+b*A+w*I-T*E+S*x;return O?(O=1/O,e.m00=(o*C-u*R+c*A)*O,e.m01=(u*I-a*C-c*E)*O,e.m02=(a*R-o*I+c*x)*O,e.m03=0,e.m04=(r*R-i*C-s*A)*O,e.m05=(n*C-r*I+s*E)*O,e.m06=(i*I-n*R-s*x)*O,e.m07=0,e.m08=(_*S-m*T+g*w)*O,e.m09=(m*b-p*S-g*y)*O,e.m10=(p*T-_*b+g*v)*O,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=1,e):null},t.toArray=function(e,t,n){return void 0===n&&(n=0),e[n+0]=t.m00,e[n+1]=t.m01,e[n+2]=t.m02,e[n+3]=t.m03,e[n+4]=t.m04,e[n+5]=t.m05,e[n+6]=t.m06,e[n+7]=t.m07,e[n+8]=t.m08,e[n+9]=t.m09,e[n+10]=t.m10,e[n+11]=t.m11,e[n+12]=t.m12,e[n+13]=t.m13,e[n+14]=t.m14,e[n+15]=t.m15,e},t.fromArray=function(e,t,n){return void 0===n&&(n=0),e.m00=t[n+0],e.m01=t[n+1],e.m02=t[n+2],e.m03=t[n+3],e.m04=t[n+4],e.m05=t[n+5],e.m06=t[n+6],e.m07=t[n+7],e.m08=t[n+8],e.m09=t[n+9],e.m10=t[n+10],e.m11=t[n+11],e.m12=t[n+12],e.m13=t[n+13],e.m14=t[n+14],e.m15=t[n+15],e},t.add=function(e,t,n){return e.m00=t.m00+n.m00,e.m01=t.m01+n.m01,e.m02=t.m02+n.m02,e.m03=t.m03+n.m03,e.m04=t.m04+n.m04,e.m05=t.m05+n.m05,e.m06=t.m06+n.m06,e.m07=t.m07+n.m07,e.m08=t.m08+n.m08,e.m09=t.m09+n.m09,e.m10=t.m10+n.m10,e.m11=t.m11+n.m11,e.m12=t.m12+n.m12,e.m13=t.m13+n.m13,e.m14=t.m14+n.m14,e.m15=t.m15+n.m15,e},t.subtract=function(e,t,n){return e.m00=t.m00-n.m00,e.m01=t.m01-n.m01,e.m02=t.m02-n.m02,e.m03=t.m03-n.m03,e.m04=t.m04-n.m04,e.m05=t.m05-n.m05,e.m06=t.m06-n.m06,e.m07=t.m07-n.m07,e.m08=t.m08-n.m08,e.m09=t.m09-n.m09,e.m10=t.m10-n.m10,e.m11=t.m11-n.m11,e.m12=t.m12-n.m12,e.m13=t.m13-n.m13,e.m14=t.m14-n.m14,e.m15=t.m15-n.m15,e},t.multiplyScalar=function(e,t,n){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*n,e.m05=t.m05*n,e.m06=t.m06*n,e.m07=t.m07*n,e.m08=t.m08*n,e.m09=t.m09*n,e.m10=t.m10*n,e.m11=t.m11*n,e.m12=t.m12*n,e.m13=t.m13*n,e.m14=t.m14*n,e.m15=t.m15*n,e},t.multiplyScalarAndAdd=function(e,t,n,i){return e.m00=t.m00+n.m00*i,e.m01=t.m01+n.m01*i,e.m02=t.m02+n.m02*i,e.m03=t.m03+n.m03*i,e.m04=t.m04+n.m04*i,e.m05=t.m05+n.m05*i,e.m06=t.m06+n.m06*i,e.m07=t.m07+n.m07*i,e.m08=t.m08+n.m08*i,e.m09=t.m09+n.m09*i,e.m10=t.m10+n.m10*i,e.m11=t.m11+n.m11*i,e.m12=t.m12+n.m12*i,e.m13=t.m13+n.m13*i,e.m14=t.m14+n.m14*i,e.m15=t.m15+n.m15*i,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,n){return void 0===n&&(n=Ca),Tu(e.m00-t.m00)<=n*Su(1,Tu(e.m00),Tu(t.m00))&&Tu(e.m01-t.m01)<=n*Su(1,Tu(e.m01),Tu(t.m01))&&Tu(e.m02-t.m02)<=n*Su(1,Tu(e.m02),Tu(t.m02))&&Tu(e.m03-t.m03)<=n*Su(1,Tu(e.m03),Tu(t.m03))&&Tu(e.m04-t.m04)<=n*Su(1,Tu(e.m04),Tu(t.m04))&&Tu(e.m05-t.m05)<=n*Su(1,Tu(e.m05),Tu(t.m05))&&Tu(e.m06-t.m06)<=n*Su(1,Tu(e.m06),Tu(t.m06))&&Tu(e.m07-t.m07)<=n*Su(1,Tu(e.m07),Tu(t.m07))&&Tu(e.m08-t.m08)<=n*Su(1,Tu(e.m08),Tu(t.m08))&&Tu(e.m09-t.m09)<=n*Su(1,Tu(e.m09),Tu(t.m09))&&Tu(e.m10-t.m10)<=n*Su(1,Tu(e.m10),Tu(t.m10))&&Tu(e.m11-t.m11)<=n*Su(1,Tu(e.m11),Tu(t.m11))&&Tu(e.m12-t.m12)<=n*Su(1,Tu(e.m12),Tu(t.m12))&&Tu(e.m13-t.m13)<=n*Su(1,Tu(e.m13),Tu(t.m13))&&Tu(e.m14-t.m14)<=n*Su(1,Tu(e.m14),Tu(t.m14))&&Tu(e.m15-t.m15)<=n*Su(1,Tu(e.m15),Tu(t.m15))};var n=t.prototype;return n.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)},n.set=function(e,t,n,i,r,s,a,o,u,c,h,l,f,d,p,_){void 0===e&&(e=1),void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=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===c&&(c=0),void 0===h&&(h=1),void 0===l&&(l=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===_&&(_=1);var m=this;return"object"==typeof e?(m.m01=e.m01,m.m02=e.m02,m.m03=e.m03,m.m04=e.m04,m.m05=e.m05,m.m06=e.m06,m.m07=e.m07,m.m08=e.m08,m.m09=e.m09,m.m10=e.m10,m.m11=e.m11,m.m12=e.m12,m.m13=e.m13,m.m14=e.m14,m.m15=e.m15,m.m00=e.m00):(m.m01=t,m.m02=n,m.m03=i,m.m04=r,m.m05=s,m.m06=a,m.m07=o,m.m08=u,m.m09=c,m.m10=h,m.m11=l,m.m12=f,m.m13=d,m.m14=p,m.m15=_,m.m00=e),m},n.equals=function(e,t){void 0===t&&(t=Ca);var n=1/0,i=this,r=i.m00,s=i.m01,a=i.m02,o=i.m03,u=i.m04,c=i.m05,h=i.m06,l=i.m07,f=i.m08,d=i.m09,p=i.m10,_=i.m11,m=i.m12,g=i.m13,v=i.m14,y=i.m15;return!(Tu(r)===n||Tu(s)===n||Tu(a)===n||Tu(o)===n||Tu(u)===n||Tu(c)===n||Tu(h)===n||Tu(l)===n||Tu(f)===n||Tu(d)===n||Tu(p)===n||Tu(_)===n||Tu(m)===n||Tu(g)===n||Tu(v)===n||Tu(y)===n)&&Tu(r-e.m00)<=t*Su(1,Tu(r),Tu(e.m00))&&Tu(s-e.m01)<=t*Su(1,Tu(s),Tu(e.m01))&&Tu(a-e.m02)<=t*Su(1,Tu(a),Tu(e.m02))&&Tu(o-e.m03)<=t*Su(1,Tu(o),Tu(e.m03))&&Tu(u-e.m04)<=t*Su(1,Tu(u),Tu(e.m04))&&Tu(c-e.m05)<=t*Su(1,Tu(c),Tu(e.m05))&&Tu(h-e.m06)<=t*Su(1,Tu(h),Tu(e.m06))&&Tu(l-e.m07)<=t*Su(1,Tu(l),Tu(e.m07))&&Tu(f-e.m08)<=t*Su(1,Tu(f),Tu(e.m08))&&Tu(d-e.m09)<=t*Su(1,Tu(d),Tu(e.m09))&&Tu(p-e.m10)<=t*Su(1,Tu(p),Tu(e.m10))&&Tu(_-e.m11)<=t*Su(1,Tu(_),Tu(e.m11))&&Tu(m-e.m12)<=t*Su(1,Tu(m),Tu(e.m12))&&Tu(g-e.m13)<=t*Su(1,Tu(g),Tu(e.m13))&&Tu(v-e.m14)<=t*Su(1,Tu(v),Tu(e.m14))&&Tu(y-e.m15)<=t*Su(1,Tu(y),Tu(e.m15))},n.strictEquals=function(e){var t=this;return t.m00===e.m00&&t.m01===e.m01&&t.m02===e.m02&&t.m03===e.m03&&t.m04===e.m04&&t.m05===e.m05&&t.m06===e.m06&&t.m07===e.m07&&t.m08===e.m08&&t.m09===e.m09&&t.m10===e.m10&&t.m11===e.m11&&t.m12===e.m12&&t.m13===e.m13&&t.m14===e.m14&&t.m15===e.m15},n.toString=function(){var e=this;return"[\n"+e.m00+", "+e.m01+", "+e.m02+", "+e.m03+",\n"+e.m04+", "+e.m05+", "+e.m06+", "+e.m07+",\n"+e.m08+", "+e.m09+", "+e.m10+", "+e.m11+",\n"+e.m12+", "+e.m13+", "+e.m14+", "+e.m15+"\n]"},n.identity=function(){return t.identity(this)},n.zero=function(){return t.zero(this)},n.transpose=function(){var e=this,t=e.m01,n=e.m02,i=e.m03,r=e.m06,s=e.m07,a=e.m11;return e.m01=e.m04,e.m02=e.m08,e.m03=e.m12,e.m04=t,e.m06=e.m09,e.m07=e.m13,e.m08=n,e.m09=r,e.m11=e.m14,e.m12=i,e.m13=s,e.m14=a,e},n.invert=function(){var e=this,t=e.m00,n=e.m01,i=e.m02,r=e.m03,s=e.m04,a=e.m05,o=e.m06,u=e.m07,c=e.m08,h=e.m09,l=e.m10,f=e.m11,d=e.m12,p=e.m13,_=e.m14,m=e.m15,g=t*a-n*s,v=t*o-i*s,y=t*u-r*s,b=n*o-i*a,w=n*u-r*a,T=i*u-r*o,S=c*p-h*d,x=c*_-l*d,E=c*m-f*d,I=h*_-l*p,A=h*m-f*p,R=l*m-f*_,C=g*R-v*A+y*I+b*E-w*x+T*S;return 0===C?(e.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),e):(C=1/C,e.m00=(a*R-o*A+u*I)*C,e.m01=(i*A-n*R-r*I)*C,e.m02=(p*T-_*w+m*b)*C,e.m03=(l*w-h*T-f*b)*C,e.m04=(o*E-s*R-u*x)*C,e.m05=(t*R-i*E+r*x)*C,e.m06=(_*y-d*T-m*v)*C,e.m07=(c*T-l*y+f*v)*C,e.m08=(s*A-a*E+u*S)*C,e.m09=(n*E-t*A-r*S)*C,e.m10=(d*w-p*y+m*g)*C,e.m11=(h*y-c*w-f*g)*C,e.m12=(a*x-s*I-o*S)*C,e.m13=(t*I-n*x+i*S)*C,e.m14=(p*v-d*b-_*g)*C,e.m15=(c*b-h*v+l*g)*C,e)},n.determinant=function(){var e=this,t=e.m00,n=e.m01,i=e.m02,r=e.m03,s=e.m04,a=e.m05,o=e.m06,u=e.m07,c=e.m08,h=e.m09,l=e.m10,f=e.m11,d=e.m12,p=e.m13,_=e.m14,m=e.m15;return(t*a-n*s)*(l*m-f*_)-(t*o-i*s)*(h*m-f*p)+(t*u-r*s)*(h*_-l*p)+(n*o-i*a)*(c*m-f*d)-(n*u-r*a)*(c*_-l*d)+(i*u-r*o)*(c*p-h*d)},n.add=function(e){var t=this;return t.m00+=e.m00,t.m01+=e.m01,t.m02+=e.m02,t.m03+=e.m03,t.m04+=e.m04,t.m05+=e.m05,t.m06+=e.m06,t.m07+=e.m07,t.m08+=e.m08,t.m09+=e.m09,t.m10+=e.m10,t.m11+=e.m11,t.m12+=e.m12,t.m13+=e.m13,t.m14+=e.m14,t.m15+=e.m15,t},n.subtract=function(e){var t=this;return t.m00-=e.m00,t.m01-=e.m01,t.m02-=e.m02,t.m03-=e.m03,t.m04-=e.m04,t.m05-=e.m05,t.m06-=e.m06,t.m07-=e.m07,t.m08-=e.m08,t.m09-=e.m09,t.m10-=e.m10,t.m11-=e.m11,t.m12-=e.m12,t.m13-=e.m13,t.m14-=e.m14,t.m15-=e.m15,t},n.multiply=function(e){return t.multiply(this,this,e)},n.multiplyScalar=function(e){var t=this;return t.m00*=e,t.m01*=e,t.m02*=e,t.m03*=e,t.m04*=e,t.m05*=e,t.m06*=e,t.m07*=e,t.m08*=e,t.m09*=e,t.m10*=e,t.m11*=e,t.m12*=e,t.m13*=e,t.m14*=e,t.m15*=e,t},n.translate=function(e){return this.m12+=e.x,this.m13+=e.y,this.m14+=e.z,this},n.transform=function(e){var t=e.x,n=e.y,i=e.z,r=this,s=r.m00,a=r.m01,o=r.m02,u=r.m03,c=r.m04,h=r.m05,l=r.m06,f=r.m07,d=r.m08,p=r.m09,_=r.m10,m=r.m11;return r.m12=s*t+c*n+d*i+r.m12,r.m13=a*t+h*n+p*i+r.m13,r.m14=o*t+l*n+_*i+r.m14,r.m15=u*t+f*n+m*i+r.m15,r},n.scale=function(e){var t=e.x,n=e.y,i=e.z,r=this;return r.m00*=t,r.m01*=t,r.m02*=t,r.m03*=t,r.m04*=n,r.m05*=n,r.m06*=n,r.m07*=n,r.m08*=i,r.m09*=i,r.m10*=i,r.m11*=i,r},n.rotate=function(e,t){var n=t.x,i=t.y,r=t.z,s=xu(n*n+i*i+r*r);if(Tu(s)0?(r=1/zu(r),e.x=n*r,e.y=i*r):(e.x=0,e.y=0),e},t.dot=function(e,t){return e.x*t.x+e.y*t.y},t.cross=function(e,t,n){return e instanceof Fo?(e.x=e.y=0,e.z=t.x*n.y-t.y*n.x,e):e.x*t.y-e.y*t.x},t.lerp=function(e,t,n,i){var r=t.x,s=t.y;return e.x=r+i*(n.x-r),e.y=s+i*(n.y-s),e},t.random=function(e,t){t=t||1;var n=2*Na()*Fu;return e.x=ku(n)*t,e.y=Nu(n)*t,e},t.transformMat3=function(e,t,n){var i=t.x,r=t.y;return e.x=n.m00*i+n.m03*r+n.m06,e.y=n.m01*i+n.m04*r+n.m07,e},t.transformMat4=function(e,t,n){var i=t.x,r=t.y;return e.x=n.m00*i+n.m04*r+n.m12,e.y=n.m01*i+n.m05*r+n.m13,e},t.str=function(e){return"Vec2("+e.x+", "+e.y+")"},t.toArray=function(e,t,n){return void 0===n&&(n=0),e[n+0]=t.x,e[n+1]=t.y,e},t.fromArray=function(e,t,n){return void 0===n&&(n=0),e.x=t[n+0],e.y=t[n+1],e},t.strictEquals=function(e,t){return e.x===t.x&&e.y===t.y},t.equals=function(e,t,n){return void 0===n&&(n=Ca),Du(e.x-t.x)<=n*Pu(1,Du(e.x),Du(t.x))&&Du(e.y-t.y)<=n*Pu(1,Du(e.y),Du(t.y))},t.angle=function(e,t){var n=e.x*e.x+e.y*e.y,i=t.x*t.x+t.y*t.y;if(0===n||0===i)return 0;var r=(e.x*t.x+e.y*t.y)/zu(n*i);return r=Da(r,-1,1),Lu(r)};var n=t.prototype;return n.clone=function(){return new t(this.x,this.y)},n.set=function(e,t){return"object"==typeof e?(this.x=e.x,this.y=e.y):(this.x=e||0,this.y=t||0),this},n.equals=function(e,n){return void 0===n&&(n=Ca),t.equals(this,e,n)},n.equals2f=function(e,t,n){return void 0===n&&(n=Ca),Du(this.x-e)<=n*Pu(1,Du(this.x),Du(e))&&Du(this.y-t)<=n*Pu(1,Du(this.y),Du(t))},n.strictEquals=function(e){return e&&this.x===e.x&&this.y===e.y},n.strictEquals2f=function(e,t){return this.x===e&&this.y===t},n.toString=function(){return"("+this.x+", "+this.y+")"},n.lerp=function(e,t){var n=this.x,i=this.y;return this.x=n+t*(e.x-n),this.y=i+t*(e.y-i),this},n.clampf=function(e,t){return this.x=Da(this.x,e.x,t.x),this.y=Da(this.y,e.y,t.y),this},n.add=function(e){return this.x+=e.x,this.y+=e.y,this},n.add2f=function(e,t){return this.x+=e,this.y+=t,this},n.subtract=function(e){return this.x-=e.x,this.y-=e.y,this},n.subtract2f=function(e,t){return this.x-=e,this.y-=t,this},n.multiplyScalar=function(e){return"object"==typeof e&&K(16359),this.x*=e,this.y*=e,this},n.multiply=function(e){return"object"!=typeof e&&K(16360),this.x*=e.x,this.y*=e.y,this},n.multiply2f=function(e,t){return this.x*=e,this.y*=t,this},n.divide=function(e){return this.x/=e.x,this.y/=e.y,this},n.divide2f=function(e,t){return this.x/=e,this.y/=t,this},n.negative=function(){return this.x=-this.x,this.y=-this.y,this},n.dot=function(e){return this.x*e.x+this.y*e.y},n.cross=function(e){return this.x*e.y-this.y*e.x},n.length=function(){return zu(this.x*this.x+this.y*this.y)},n.lengthSqr=function(){return this.x*this.x+this.y*this.y},n.normalize=function(){var e=this,t=e.x,n=e.y,i=t*t+n*n;return i>0&&(i=1/zu(i),e.x*=i,e.y*=i),e},n.angle=function(e){var t=this.lengthSqr(),n=e.lengthSqr();if(0===t||0===n)return 0;var i=this.dot(e)/zu(t*n);return i=Da(i,-1,1),Lu(i)},n.signAngle=function(e){var t=this.cross(e),n=this.dot(e);return Uu(t,n)},n.rotate=function(e){var t=this.x,n=this.y,i=Nu(e),r=ku(e);return this.x=r*t-i*n,this.y=i*t+r*n,this},n.project=function(e){var t=this.dot(e)/e.dot(e);return this.x=e.x*t,this.y=e.y*t,this},n.transformMat4=function(e){var t=this.x,n=this.y;return this.x=e.m00*t+e.m04*n+e.m12,this.y=e.m01*t+e.m05*n+e.m13,this},n.toVec3=function(){return new Fo(this.x,this.y,0)},t}(St));function qu(e,t){return new Xu(e,t)}Xu.ZERO=Wu(0,0),Xu.ONE=Wu(1,1),Xu.NEG_ONE=Wu(-1,-1),Xu.UNIT_X=Wu(1,0),Xu.UNIT_Y=Wu(0,1),En.fastDefine("cc.Vec2",Xu,{x:0,y:0}),u.Vec2=Xu,u.v2=qu,ca(Xu,"Vec2",[{name:"sub",newName:"subtract",target:Xu,targetName:"Vec2"},{name:"mul",newName:"multiply",target:Xu,targetName:"Vec2"},{name:"div",newName:"divide",target:Xu,targetName:"Vec2"},{name:"dist",newName:"distance",target:Xu,targetName:"Vec2"},{name:"sqrDist",newName:"squaredDistance",target:Xu,targetName:"Vec2"},{name:"mag",newName:"len",target:Xu,targetName:"Vec2"},{name:"sqrMag",newName:"lengthSqr",target:Xu,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:Xu,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:Xu,targetName:"Vec2"}]),ca(Xu.prototype,"Vec2",[{name:"mag",newName:"length",target:Xu.prototype,targetName:"Vec2"},{name:"magSqr",newName:"lengthSqr",target:Xu.prototype,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:Xu.prototype,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:Xu.prototype,targetName:"Vec2"}]),ca(Fo,"Vec3",[{name:"sub",newName:"subtract",target:Fo,targetName:"Vec3"},{name:"mul",newName:"multiply",target:Fo,targetName:"Vec3"},{name:"div",newName:"divide",target:Fo,targetName:"Vec3"},{name:"dist",newName:"distance",target:Fo,targetName:"Vec3"},{name:"sqrDist",newName:"squaredDistance",target:Fo,targetName:"Vec3"},{name:"mag",newName:"len",target:Fo,targetName:"Vec3"},{name:"sqrMag",newName:"lengthSqr",target:Fo,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:Fo,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:Fo,targetName:"Vec3"}]),ca(Fo.prototype,"Vec3",[{name:"mag",newName:"length",target:Fo.prototype,targetName:"Vec3"},{name:"magSqr",newName:"lengthSqr",target:Fo.prototype,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:Fo.prototype,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:Fo.prototype,targetName:"Vec3"}]),ca(go,"Vec4",[{name:"sub",newName:"subtract",target:go,targetName:"Vec4"},{name:"mul",newName:"multiply",target:go,targetName:"Vec4"},{name:"div",newName:"divide",target:go,targetName:"Vec4"},{name:"dist",newName:"distance",target:go,targetName:"Vec4"},{name:"sqrDist",newName:"squaredDistance",target:go,targetName:"Vec4"},{name:"mag",newName:"len",target:go,targetName:"Vec4"},{name:"sqrMag",newName:"lengthSqr",target:go,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:go,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:go,targetName:"Vec4"}]),ca(go.prototype,"Vec4",[{name:"mag",newName:"length",target:go.prototype,targetName:"Vec4"},{name:"magSqr",newName:"lengthSqr",target:go.prototype,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:go.prototype,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:go.prototype,targetName:"Vec4"}]),ca(fu,"Quat",[{name:"mag",newName:"len",target:fu,targetName:"Quat"},{name:"mul",newName:"multiply",target:fu,targetName:"Quat"},{name:"sqrMag",newName:"lengthSqr",target:fu,targetName:"Quat"},{name:"scale",newName:"multiplyScalar",target:fu,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:fu,targetName:"Quat"}]),ca(fu.prototype,"Quat",[{name:"scale",newName:"multiplyScalar",target:fu.prototype,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:fu.prototype,targetName:"Quat"}]),ca(Wo,"Color",[{name:"sub",newName:"subtract",target:Wo,targetName:"Color"},{name:"mul",newName:"multiply",target:Wo,targetName:"Color"},{name:"div",newName:"divide",target:Wo,targetName:"Color"},{name:"exactEquals",newName:"strictEquals",target:Wo,targetName:"Color"},{name:"fromHex",newName:"fromHEX",customFunction:function(){for(var e=arguments.length,t=new Array(e),n=0;n=e.x&&t.y<=e.y&&t.y+t.height>=e.y},n.containsRect=function(e){var t=this;return t.x<=e.x&&t.x+t.width>=e.x+e.width&&t.y<=e.y&&t.y+t.height>=e.y+e.height},n.transformMat4=function(e){var t=this,n=t.x,i=t.y,r=n+t.width,s=i+t.height,a=e.m00*n+e.m04*i+e.m12,o=e.m01*n+e.m05*i+e.m13,u=e.m00*r+e.m04*i+e.m12,c=e.m01*r+e.m05*i+e.m13,h=e.m00*n+e.m04*s+e.m12,l=e.m01*n+e.m05*s+e.m13,f=e.m00*r+e.m04*s+e.m12,d=e.m01*r+e.m05*s+e.m13,p=Zu(a,u,h,f),_=Qu(a,u,h,f),m=Zu(o,c,l,d),g=Qu(o,c,l,d);return t.x=p,t.y=m,t.width=_-p,t.height=g-m,t},n.transformMat4ToPoints=function(e,t,n,i,r){var s=this,a=s.x,o=s.y,u=a+s.width,c=o+s.height;t.x=e.m00*a+e.m04*o+e.m12,t.y=e.m01*a+e.m05*o+e.m13,r.x=e.m00*u+e.m04*o+e.m12,r.y=e.m01*u+e.m05*o+e.m13,n.x=e.m00*a+e.m04*c+e.m12,n.y=e.m01*a+e.m05*c+e.m13,i.x=e.m00*u+e.m04*c+e.m12,i.y=e.m01*u+e.m05*c+e.m13},f(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 Xu(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 Xu(this.x,this.y)},set:function(e){this.x=e.x,this.y=e.y}},{key:"size",get:function(){return new Yu(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}(St));function $u(e,t,n,i){return void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),new Ju(e,t,n,i)}En.fastDefine("cc.Rect",Ju,{x:0,y:0,width:0,height:0}),u.Rect=Ju,u.rect=$u;var ec=e("MATH_FLOAT_ARRAY",Float64Array),tc=e("MathBase",function(e){function t(){return e.apply(this,arguments)||this}return p(t,e),t.createFloatArray=function(e){return new ec(e)},f(t,[{key:"array",get:function(){return this._array}}]),t}(St)),nc=Object.freeze({__proto__:null,Color:Wo,EPSILON:Ca,HALF_PI:Aa,MATH_FLOAT_ARRAY:ec,Mat3:Zo,Mat4:Ru,MathBase:tc,Quat:fu,Rect:Ju,Size:Yu,TWO_PI:Ra,Vec2:Xu,Vec3:Fo,Vec4:go,absMax:Ka,absMaxComponent:Ya,approx:Ba,bits:le,clamp:Da,clamp01:Pa,color:jo,enumerableProps:Qa,equals:Oa,floatToHalf:to,halfToFloat:no,inverseLerp:qa,lerp:Ma,mat4:Bu,nextPow2:Wa,pingPong:Xa,preTransforms:wu,pseudoRandom:Ga,pseudoRandomRange:Va,pseudoRandomRangeInt:Ha,quat:yu,random:Na,randomRange:za,randomRangeInt:Ua,rect:$u,repeat:ja,setRandGenerator:ka,size:Ku,toDegree:La,toRadian:Fa,v2:qu,v3:Lo,v4:vo});e("math",nc);var ic=new Fo,rc=new Fo,sc=new Fo,ac=new Fo,oc=new Fo,uc=new Fo,cc=new Array(3),hc=new Array(3);function lc(e,t){return Fo.dot(t.n,e)-t.d}function fc(e,t,n){return Fo.copy(e,t),Fo.subtract(oc,n.center,n.halfExtents),Fo.add(uc,n.center,n.halfExtents),e.x=e.xuc.x?uc.x:e.x,e.y=e.y>uc.y?uc.y:e.y,e.z=e.z>uc.z?uc.z:e.z,e}function dc(e,t,n){Fo.set(ic,n.orientation.m00,n.orientation.m01,n.orientation.m02),Fo.set(rc,n.orientation.m03,n.orientation.m04,n.orientation.m05),Fo.set(sc,n.orientation.m06,n.orientation.m07,n.orientation.m08),cc[0]=ic,cc[1]=rc,cc[2]=sc,hc[0]=n.halfExtents.x,hc[1]=n.halfExtents.y,hc[2]=n.halfExtents.z,Fo.subtract(ac,t,n.center),Fo.set(e,n.center.x,n.center.y,n.center.z);for(var i=0;i<3;i++){var r=Fo.dot(ac,cc[i]);r>hc[i]&&(r=hc[i]),r<-hc[i]&&(r=-hc[i]),e.x+=r*cc[i].x,e.y+=r*cc[i].y,e.z+=r*cc[i].z}return e}var pc=Object.freeze({__proto__:null,point_plane:lc,pt_point_aabb:fc,pt_point_line:function(e,t,n,i){Fo.subtract(ic,n,i);var r=ic.clone(),s=Fo.lengthSqr(r);if(0===s)Fo.copy(e,n);else{Fo.subtract(ic,t,n);var a=Fo.dot(ic,r)/s;a<0?Fo.copy(e,n):a>1?Fo.copy(e,i):Fo.scaleAndAdd(e,n,r,a)}},pt_point_obb:dc,pt_point_plane:function(e,t,n){var i=lc(t,n);return Fo.subtract(e,t,Fo.multiplyScalar(e,n.n,i))}}),_c=function(){function e(e,t,n,i,r,s){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=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=2,this.s=new Fo(e,t,n),this.e=new Fo(i,r,s)}return e.create=function(t,n,i,r,s,a){return new e(t,n,i,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 Fo.copy(e.s,t.s),Fo.copy(e.e,t.e),e},e.fromPoints=function(e,t,n){return Fo.copy(e.s,t),Fo.copy(e.e,n),e},e.set=function(e,t,n,i,r,s,a){return e.s.x=t,e.s.y=n,e.s.z=i,e.e.x=r,e.e.y=s,e.e.z=a,e},e.len=function(e){return Fo.distance(e.s,e.e)},e.prototype.length=function(){return Fo.distance(this.s,this.e)},f(e,[{key:"type",get:function(){return this._type}}]),e}(),mc=function(){function e(e,t,n,i,r,s){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===s&&(s=-1),this._type=1,this.o=new Fo(e,t,n),this.d=new Fo(i,r,s)}return e.create=function(t,n,i,r,s,a){return void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),new e(t,n,i,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 Fo.copy(e.o,t.o),Fo.copy(e.d,t.d),e},e.fromPoints=function(e,t,n){return Fo.copy(e.o,t),Fo.normalize(e.d,Fo.subtract(e.d,n,t)),e},e.set=function(e,t,n,i,r,s,a){return e.o.x=t,e.o.y=n,e.o.z=i,e.d.x=r,e.d.y=s,e.d.z=a,e},e.prototype.computeHit=function(e,t){Fo.normalize(e,this.d),Fo.scaleAndAdd(e,this.o,e,t)},f(e,[{key:"type",get:function(){return this._type}}]),e}(),gc=new Fo,vc=new Fo,yc=new Fo,bc=new Fo;function wc(e){return Math.max(Math.max(e.x,e.y),e.z)}var Tc,Sc,xc,Ec,Ic,Ac=function(){function e(e,t,n,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=1),this._type=4,this._center=new Fo(e,t,n),this._radius=i}e.create=function(t,n,i,r){return new e(t,n,i,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 Fo.copy(e.center,t.center),e.radius=t.radius,e},e.fromPoints=function(e,t,n){return Fo.multiplyScalar(e.center,Fo.add(gc,t,n),.5),e.radius=.5*Fo.subtract(gc,n,t).length(),e},e.set=function(e,t,n,i,r){return e.center.x=t,e.center.y=n,e.center.z=i,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){Fo.set(e,this.center.x-this.radius,this.center.y-this.radius,this.center.z-this.radius),Fo.set(t,this.center.x+this.radius,this.center.y+this.radius,this.center.z+this.radius)},t.transform=function(e,t,n,i,r){Fo.transformMat4(r.center,this.center,e),r.radius=this.radius*wc(i)},t.translateAndRotate=function(e,t,n){Fo.transformMat4(n.center,this.center,e)},t.setScale=function(e,t){t.radius=this.radius*wc(e)},t.mergePoint=function(e){this.radius<0&&(this.center.set(e),this.radius=0),Fo.subtract(vc,e,this.center);var t=vc.length();if(t>this.radius){var n=.5*(t-this.radius);this.radius+=n,Fo.multiplyScalar(vc,vc,n/t),Fo.add(this.center,this.center,vc)}},t.mergePoints=function(e){var t=e.length;if(!(t<1)){this.radius=-1;for(var n=0;n-Number.EPSILON))return 0;var r=1/i;Cc(Ec,e.o,t.a);var s=Oc(Ec,xc)*r;if(s<0||s>1)return 0;Dc(Ic,Ec,Tc);var a=Oc(e.d,Ic)*r;if(a<0||s+a>1)return 0;var o=Oc(Sc,Ic)*r;return o<0?0:o}),Vc=function(){var e=Lo();return function(t,n){var i=n.radius,r=n.center,s=t.o,a=t.d,o=i*i;Cc(e,r,s);var u=e.lengthSqr(),c=Oc(e,a),h=o-(u-c*c);if(h<0)return 0;var l=Math.sqrt(h),f=u_?0:p>0?p:_}var jc=function(){var e=Lo(),t=Lo(),n=Lo(),i=Lo(),r=Lo(),s=Lo(),a=Lo(),o=new Array(3),u=new Array(3),c=new Array(3),h=new Array(6);return function(l,f){var d=f.halfExtents,p=f.orientation;o[0]=d.x,o[1]=d.y,o[2]=d.z,e=f.center,t=l.o,n=l.d,Bc(i,p.m00,p.m01,p.m02),Bc(r,p.m03,p.m04,p.m05),Bc(s,p.m06,p.m07,p.m08),Cc(a,e,t),u[0]=Oc(i,n),u[1]=Oc(r,n),u[2]=Oc(s,n),c[0]=Oc(i,a),c[1]=Oc(r,a),c[2]=Oc(s,a);for(var _=0;_<3;++_){if(0===u[_]){if(-c[_]-o[_]>0||-c[_]+o[_]<0)return 0;u[_]=1e-7}h[2*_+0]=(c[_]+o[_])/u[_],h[2*_+1]=(c[_]-o[_])/u[_]}var m=Nc(Nc(kc(h[0],h[1]),kc(h[2],h[3])),kc(h[4],h[5])),g=kc(kc(Nc(h[0],h[1]),Nc(h[2],h[3])),Nc(h[4],h[5]));return g<0||m>g?0:m>0?m:g}}(),Xc=function(){var e=Lo(),t=Lo(),n=Lo(),i=Lo(),r=Lo(),s=Lo(),a=Lo(),o=new Ac;return function(u,c){var h=c.ellipseCenter0,l=c.ellipseCenter1,f=Cc(t,l,h);if(f.length()=0&&R<=1?x:R<0?(o.radius=c.radius,o.center.set(c.ellipseCenter0),Oh.raySphere(u,o)):R>1?(o.radius=c.radius,o.center.set(c.ellipseCenter1),Oh.raySphere(u,o)):0}}(),qc=function(){var e=Lo();return function(t,n){Cc(e,t.e,t.s);var i=-lc(t.s,n)/Oc(e,n.n);return i<0||i>1?0:i}}(),Yc=function(){var e=Lo(),t=Lo(),n=Lo(),i=Lo(),r=Lo(),s=Lo();return function(a,o,u){Cc(e,o.b,o.a),Cc(t,o.c,o.a),Cc(n,a.s,a.e),Dc(r,e,t);var c=Oc(n,r);if(c<=0)return 0;Cc(i,a.s,o.a);var h=Oc(i,r);if(h<0||h>c)return 0;Dc(s,n,i);var l=Oc(t,s);if(l<0||l>c)return 0;var f=-Oc(e,s);if(f<0||l+f>c)return 0;if(u){var d=1/c,p=1-(l*=d)-(f*=d);Bc(u,o.a.x*p+o.b.x*l+o.c.x*f,o.a.y*p+o.b.y*l+o.c.y*f,o.a.z*p+o.b.z*l+o.c.z*f)}return 1}}(),Kc=new mc;function Qc(e,t){Kc.o.set(e.s),Cc(Kc.d,e.e,e.s),Kc.d.normalize();var n=Hc(Kc,t);return n<=e.length()?n:0}function Zc(e,t){Kc.o.set(e.s),Cc(Kc.d,e.e,e.s),Kc.d.normalize();var n=jc(Kc,t);return n<=e.length()?n:0}function Jc(e,t){Kc.o.set(e.s),Cc(Kc.d,e.e,e.s),Kc.d.normalize();var n=Vc(Kc,t);return n<=e.length()?n:0}var $c,eh,th,nh,ih=($c=Lo(),eh=Lo(),th=Lo(),nh=Lo(),function(e,t){return Cc($c,e.center,e.halfExtents),Fc(eh,e.center,e.halfExtents),Cc(th,t.center,t.halfExtents),Fc(nh,t.center,t.halfExtents),$c.x<=nh.x&&eh.x>=th.x&&$c.y<=nh.y&&eh.y>=th.y&&$c.z<=nh.z&&eh.z>=th.z});function rh(e,t,n){Bc(n[0],e.x,t.y,t.z),Bc(n[1],e.x,t.y,e.z),Bc(n[2],e.x,e.y,t.z),Bc(n[3],e.x,e.y,e.z),Bc(n[4],t.x,t.y,t.z),Bc(n[5],t.x,t.y,e.z),Bc(n[6],t.x,e.y,t.z),Bc(n[7],t.x,e.y,e.z)}function sh(e,t,n,i,r,s){Bc(s[0],e.x+n.x*t.x+i.x*t.y+r.x*t.z,e.y+n.y*t.x+i.y*t.y+r.y*t.z,e.z+n.z*t.x+i.z*t.y+r.z*t.z),Bc(s[1],e.x-n.x*t.x+i.x*t.y+r.x*t.z,e.y-n.y*t.x+i.y*t.y+r.y*t.z,e.z-n.z*t.x+i.z*t.y+r.z*t.z),Bc(s[2],e.x+n.x*t.x-i.x*t.y+r.x*t.z,e.y+n.y*t.x-i.y*t.y+r.y*t.z,e.z+n.z*t.x-i.z*t.y+r.z*t.z),Bc(s[3],e.x+n.x*t.x+i.x*t.y-r.x*t.z,e.y+n.y*t.x+i.y*t.y-r.y*t.z,e.z+n.z*t.x+i.z*t.y-r.z*t.z),Bc(s[4],e.x-n.x*t.x-i.x*t.y-r.x*t.z,e.y-n.y*t.x-i.y*t.y-r.y*t.z,e.z-n.z*t.x-i.z*t.y-r.z*t.z),Bc(s[5],e.x+n.x*t.x-i.x*t.y-r.x*t.z,e.y+n.y*t.x-i.y*t.y-r.y*t.z,e.z+n.z*t.x-i.z*t.y-r.z*t.z),Bc(s[6],e.x-n.x*t.x+i.x*t.y-r.x*t.z,e.y-n.y*t.x+i.y*t.y-r.y*t.z,e.z-n.z*t.x+i.z*t.y-r.z*t.z),Bc(s[7],e.x-n.x*t.x-i.x*t.y+r.x*t.z,e.y-n.y*t.x-i.y*t.y+r.y*t.z,e.z-n.z*t.x-i.z*t.y+r.z*t.z)}function ah(e,t){for(var n=Oc(t,e[0]),i=n,r=1;r<8;++r){var s=Oc(t,e[r]);n=si?s:i}return[n,i]}var oh,uh,ch,hh,lh,fh=function(){for(var e=new Array(15),t=0;t<15;t++)e[t]=Lo();for(var n=new Array(8),i=new Array(8),r=0;r<8;r++)n[r]=Lo(),i[r]=Lo();var s=Lo(),a=Lo();return function(t,r){var o=r.orientation;Bc(e[0],1,0,0),Bc(e[1],0,1,0),Bc(e[2],0,0,1),Bc(e[3],o.m00,o.m01,o.m02),Bc(e[4],o.m03,o.m04,o.m05),Bc(e[5],o.m06,o.m07,o.m08);for(var u=0;u<3;++u)Dc(e[6+3*u],e[u],e[3]),Dc(e[7+3*u],e[u],e[4]),Dc(e[7+3*u],e[u],e[5]);Cc(s,t.center,t.halfExtents),Fc(a,t.center,t.halfExtents),rh(s,a,n),sh(r.center,r.halfExtents,e[3],e[4],e[5],i);for(var c=0;c<15;++c){var h=ah(n,e[c]),l=ah(i,e[c]);if(l[0]>h[1]||h[0]>l[1])return 0}return 1}}(),dh=function(e,t){var n=e.halfExtents,i=t.n,r=n.x*zc(i.x)+n.y*zc(i.y)+n.z*zc(i.z),s=Oc(i,e.center);return s+rt.d?0:1},ph=function(e,t){for(var n=t.planes,i=0;ia.x?t++:e[l].x<-a.x&&n++;if(t===s.length||n===s.length)return 0;t=0,n=0;for(var f=0;fa.y?t++:e[f].y<-a.y&&n++;if(t===s.length||n===s.length)return 0;t=0,n=0;for(var d=0;da.z?t++:e[d].z<-a.z&&n++;return t===s.length||n===s.length?0:1}}(),mh=(oh=Lo(),uh=new Zo,function(e,t){return Cc(oh,t,e.center),Fo.transformMat3(oh,oh,Zo.transpose(uh,e.orientation)),n=oh,i=e.halfExtents,zc(n.x)s?0:1}),vh=function(e,t){for(var n=t.planes,i=0;iu.x?n++:t<-u.x&&i++;if(n===c.length||i===c.length)return 0;n=0,i=0;for(var m=0;mu.y?n++:t<-u.y&&i++;if(n===c.length||i===c.length)return 0;n=0,i=0;for(var g=0;gu.z?n++:t<-u.z&&i++;return n===c.length||i===c.length?0:1}}(),bh=function(){for(var e=new Array(15),t=0;t<15;t++)e[t]=Lo();for(var n=new Array(8),i=new Array(8),r=0;r<8;r++)n[r]=Lo(),i[r]=Lo();return function(t,r){var s=t.orientation,a=r.orientation;Bc(e[0],s.m00,s.m01,s.m02),Bc(e[1],s.m03,s.m04,s.m05),Bc(e[2],s.m06,s.m07,s.m08),Bc(e[3],a.m00,a.m01,a.m02),Bc(e[4],a.m03,a.m04,a.m05),Bc(e[5],a.m06,a.m07,a.m08);for(var o=0;o<3;++o)Dc(e[6+3*o],e[o],e[3]),Dc(e[7+3*o],e[o],e[4]),Dc(e[8+3*o],e[o],e[5]);sh(t.center,t.halfExtents,e[0],e[1],e[2],n),sh(r.center,r.halfExtents,e[3],e[4],e[5],i);for(var u=0;u<15;++u){var c=ah(n,e[u]),h=ah(i,e[u]);if(h[0]>c[1]||c[0]>h[1])return 0}return 1}}(),wh=function(){for(var e=new Ac,t=Lo(),n=Lo(),i=Lo(),r=new Array(8),s=0;s<8;s++)r[s]=Lo();for(var a=new Array(8),o=0;o<8;o++)a[o]=Lo();return function(s,o){var u=o.ellipseCenter0,c=o.ellipseCenter1,h=o.radius;if(0===Rc(u,c))return e.radius=o.radius,e.center.set(u),Oh.sphereOBB(e,s);var l=s.orientation;t.x=l.m00,t.y=l.m01,t.z=l.m02,n.x=l.m03,n.y=l.m04,n.z=l.m05,i.x=l.m06,i.y=l.m07,i.z=l.m08,sh(s.center,s.halfExtents,t,n,i,r);var f=a,d=Mc(f[0],t),p=Mc(f[1],n),_=Mc(f[2],i);Cc(f[3],o.center,s.center).normalize();var m=Cc(f[4],u,c);m.normalize(),Dc(f[5],d,m),Dc(f[6],p,m),Dc(f[7],_,m);for(var g=0;g<8;++g){var v=ah(r,f[g]),y=Oc(f[g],u),b=Oc(f[g],c),w=Nc(y,b)+h;if(kc(y,b)-h>v[1]||v[0]>w)return 0}return 1}}(),Th=function(e,t){var n=Oc(t.n,e.center),i=e.radius*t.n.length();return n+it.d?0:1},Sh=function(e,t){for(var n=t.planes,i=0;io)){Fc(hh,s,Pc(hh,a,r));for(var c=0;c<6;c++)if(c!==n&&c!==n+lh[n]){var h=t.planes[c];if(Oc(h.n,hh)1?Rc(a,s)S&&(u=S,c=w+v,x=y)),c<0?(c=0,-b<0?u=0:-b>g?u=S:(u=-b,S=g)):c>x&&(c=x,-b+v<0?u=0:-b+v>g?u=S:(u=-b+v,S=g));var E=zc(u)0&&(e.d=t.d/n),e},e.prototype.transform=function(e){Ru.invert(Ph,e),Ru.transpose(Ph,Ph),go.set(Mh,this.n.x,this.n.y,this.n.z,-this.d),go.transformMat4(Mh,Mh,Ph),Fo.set(this.n,Mh.x,Mh.y,Mh.z),this.d=-Mh.w},f(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}(),Lh=function(){function e(e,t,n,i,r,s,a,o,u){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=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._type=64,this.a=new Fo(e,t,n),this.b=new Fo(i,r,s),this.c=new Fo(a,o,u)}return e.create=function(t,n,i,r,s,a,o,u,c){return void 0===t&&(t=1),void 0===n&&(n=0),void 0===i&&(i=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===c&&(c=1),new e(t,n,i,r,s,a,o,u,c)},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 Fo.copy(e.a,t.a),Fo.copy(e.b,t.b),Fo.copy(e.c,t.c),e},e.fromPoints=function(e,t,n,i){return Fo.copy(e.a,t),Fo.copy(e.b,n),Fo.copy(e.c,i),e},e.set=function(e,t,n,i,r,s,a,o,u,c){return e.a.x=t,e.a.y=n,e.a.z=i,e.b.x=r,e.b.y=s,e.b.z=a,e.c.x=o,e.c.y=u,e.c.z=c,e},f(e,[{key:"type",get:function(){return this._type}}]),e}();ya({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 Nh=new Fo;function kh(e,t,n,i){i||(i=new Fo),e.convertToUINode(t,n,i);var r=n.position;return i.add(r),i}function zh(e,t,n){return n||(n=new Fo),e.worldToScreen(t,n),n.x/=u.view.getScaleX(),n.y/=u.view.getScaleY(),n}var Uh=e("convertUtils",{WorldNode3DToLocalNodeUI:kh,WorldNode3DToWorldNodeUI:zh});u.pipelineUtils=Uh,ca(u.pipelineUtils,"cc.pipelineUtils",[{name:"WorldNode3DToLocalNodeUI",newName:"convertToUINode",targetName:"cc.Camera.prototype",customFunction:function(){for(var e=arguments.length,t=new Array(e),n=0;nwindow.innerHeight;this.isFrameRotated=ti.isMobile&&(t&&e===It.PORTRAIT||!t&&e===It.LANDSCAPE)},t._updateContainer=function(){if(this._gameContainer){if(this.isProportionalToFrame){if(!this._gameFrame)return void K(9201);var e,t,n=u.view.getDesignResolutionSize(),i=this._gameFrame,r=i.clientWidth,s=i.clientHeight,a=n.width,o=n.height,c=r/a,h=s/o,l=this._gameContainer.style;c0&&K(1400,"screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)","screen.requestFullScreen(): Promise"),Wh.requestFullScreen().then((function(){null==t||t.call(document)})).catch((function(e){k(e),null==n||n.call(document)}))},t.exitFullScreen=function(){return Wh.exitFullScreen()},t.autoFullScreen=function(e,t){var n;null==(n=this.requestFullScreen(e,t))||n.catch((function(e){N(e)}))},t.disableAutoFullScreen=function(){},t.on=function(e,t,n){Wh.on(e,t,n)},t.once=function(e,t,n){Wh.once(e,t,n)},t.off=function(e,t,n){Wh.off(e,t,n)},f(e,[{key:"devicePixelRatio",get:function(){return Wh.devicePixelRatio}},{key:"windowSize",get:function(){return Wh.windowSize},set:function(e){Wh.windowSize=e}},{key:"resolution",get:function(){return Wh.resolution}},{key:"supportsFullScreen",get:function(){return Wh.supportFullScreen}}]),e}(),Xh=e("screen",new jh);u.screen=Xh;var qh=e("sys",{Feature:Jn,hasFeature:function(e){return ti.hasFeature(e)},NetworkType:Kn,Language:Yn,OS:Qn,Platform:Zn,BrowserType:qn,isNative:ti.isNative,isBrowser:ti.isBrowser,isMobile:ti.isMobile,isLittleEndian:ti.isLittleEndian,platform:ti.platform,language:ti.language,languageCode:ti.nativeLanguage,os:ti.os,osVersion:ti.osVersion,osMainVersion:ti.osMainVersion,browserType:ti.browserType,browserVersion:ti.browserVersion,isXR:ti.isXR,windowPixelResolution:Xh.windowSize,capabilities:{canvas:!0,opengl:!0,webp:ti.hasFeature(Jn.WEBP),imageBitmap:ti.hasFeature(Jn.IMAGE_BITMAP),touches:ti.hasFeature(Jn.INPUT_TOUCH),mouse:ti.hasFeature(Jn.EVENT_MOUSE),keyboard:ti.hasFeature(Jn.EVENT_KEYBOARD),accelerometer:ti.hasFeature(Jn.EVENT_ACCELEROMETER)},localStorage:{},getNetworkType:function(){return ti.networkType},getBatteryLevel:function(){return ti.getBatteryLevel()},garbageCollect:function(){ti.triggerGC()},isObjectValid:function(e){return null!=e},__isWebIOS14OrIPadOS14Env:!1,dump:function(){var e="";e+="isMobile : "+this.isMobile+"\r\n",e+="language : "+this.language+"\r\n",e+="browserType : "+this.browserType+"\r\n",e+="browserVersion : "+this.browserVersion+"\r\n",e+="supports webp: "+qh.hasFeature(Jn.WEBP)+"\r\n",e+="supports bitmap: "+qh.hasFeature(Jn.IMAGE_BITMAP)+"\r\n",e+="supports touches: "+qh.hasFeature(Jn.INPUT_TOUCH)+"\r\n",e+="supports mouse: "+qh.hasFeature(Jn.EVENT_MOUSE)+"\r\n",e+="supports keyboard: "+qh.hasFeature(Jn.EVENT_KEYBOARD)+"\r\n",e+="supports accelerometer: "+qh.hasFeature(Jn.EVENT_ACCELEROMETER)+"\r\n",e+="os : "+this.os+"\r\n",e+="osVersion : "+this.osVersion+"\r\n",e+="platform : "+this.platform+"\r\n",L(e+="Using "+(u.game.renderType===u.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n")},openURL:function(e){ti.openURL(e)},init:function(){var e=this;return Promise.resolve().then((function(){return ti.init()})).then((function(){try{var t=qh.localStorage=window.localStorage;t.setItem("storage",""),t.removeItem("storage"),t=null}catch(t){var n=function(){K(5200)};e.localStorage={getItem:n,setItem:n,clear:n,removeItem:n,key:n,length:0}}e.__isWebIOS14OrIPadOS14Env=(qh.os===Qn.IOS||qh.os===Qn.OSX)&&ti.isBrowser&&/(OS 14)|(Version\/14)/.test(window.navigator.userAgent)}))},now:function(){return ti.now()},restartVM:function(){ti.restartJSVM()},getSafeAreaRect:function(e){void 0===e&&(e=!0);var t=u.view,n=Wh.safeAreaEdge;e&&(Wh.orientation===Rt.ORIENTATION_PORTRAIT?n.topQh.x&&(Qh.x=e.x),e.y>Qh.y&&(Qh.y=e.y),e.z>Qh.z&&(Qh.z=e.z),Fo.add(Zh,Kh,Qh),this.center.set(Fo.multiplyScalar(Zh,Zh,.5)),this.halfExtents.set(Qh.x-Zh.x,Qh.y-Zh.y,Qh.z-Zh.z)},t.mergePoints=function(e){if(!(e.length<1))for(var t=0;t>>1;i<=r;s=i+r>>>1){var a=e[s];if(a>t+n)r=s-1;else{if(!(a=e._times.length)return{done:!0,value:void 0};var n=[e._times[t],e._values[t]];return++t,{done:!1,value:n}}}},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 yl(this._times,e)},t.updateTime=function(e,t){var n=this._values[e];this.removeKeyframe(e),this._insertNewKeyframe(t,n)},t.assignSorted=function(e,t){if(void 0!==t)this.setKeyframes(e.slice(),t.slice());else{var n=Array.from(e);this.setKeyframes(n.map((function(e){return e[0]})),n.map((function(e){return e[1]})))}},t.clear=function(){this._times.length=0,this._values.length=0},t.searchKeyframe=function(e){return yl(this._times,e)},t.setKeyframes=function(e,t){e.length,t.length,wl(e),this._times=e,this._values=t},t._insertNewKeyframe=function(e,t){var n=this._times,i=this._values,r=n.length,s=yl(n,e);if(s>=0)return s;var a=~s;return 0===a?(n.unshift(e),i.unshift(t)):a===r?(n.push(e),i.push(t)):(n.splice(a-1,0,e),i.splice(a-1,0,t)),a},f(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 wl(e){return e.every((function(e,t,n){return 0===t||e>n[t-1]||Ba(e,n[t-1],1e-6)}))}function Tl(e,t,n,i,r){var s=n/i,a=t/i,o=s*s,u=1/3*(-1/3*o+a),c=.5*(2/27*s*o-1/3*s*a+e/i),h=u*u*u,l=c*c+h,f=0;if(xl(l)){if(xl(c))return r[0]=0,1;var d=Math.cbrt(-c);return r[0]=2*d,r[1]=-d,2}if(l<0){var p=1/3*Math.acos(-c/Math.sqrt(-h)),_=2*Math.sqrt(-u);r[0]=_*Math.cos(p),r[1]=-_*Math.cos(p+Math.PI/3),r[2]=-_*Math.cos(p-Math.PI/3),f=3}else{var m=Math.sqrt(l),g=Math.cbrt(m-c),v=-Math.cbrt(m+c);r[0]=g+v,f=1}for(var y=1/3*s,b=0;b-1e-9&&e>3},i=n.storageUnit,r=Df(n.elementType),s=new(Pf(i))(e,this._byteOffset,this._unitCount),a=new Array(this._length),o=0;o=1?1:e*e*(3-2*e)}function md(e){return e<=0?0:e>=1?1:e*e*e*(e*(6*e-15)+10)}u._decorator=Of;var gd=Ad(zf,Uf),vd=Ad(Vf,Hf),yd=Ad(jf,Xf),bd=Ad(Yf,Kf),wd=Ad(Zf,Jf),Td=Ad(ed,td),Sd=Ad(id,rd),xd=Ad(ad,od),Ed=Ad(cd,hd),Id=Ad(fd,dd);function Ad(e,t){return function(n){return n<.5?t(2*n)/2:e(2*n-1)/2+.5}}var Rd,Cd=Object.freeze({__proto__:null,backIn:cd,backInOut:ld,backOut:hd,backOutIn:Ed,bounceIn:fd,bounceInOut:pd,bounceOut:dd,bounceOutIn:Id,circIn:id,circInOut:sd,circOut:rd,circOutIn:Sd,constant:Nf,cubicIn:Vf,cubicInOut:Wf,cubicOut:Hf,cubicOutIn:vd,elasticIn:ad,elasticInOut:ud,elasticOut:od,elasticOutIn:xd,expoIn:ed,expoInOut:nd,expoOut:td,expoOutIn:Td,fade:md,linear:kf,quadIn:zf,quadInOut:Gf,quadOut:Uf,quadOutIn:gd,quartIn:jf,quartInOut:qf,quartOut:Xf,quartOutIn:yd,quintIn:Yf,quintInOut:Qf,quintOut:Kf,quintOutIn:bd,sineIn:Zf,sineInOut:$f,sineOut:Jf,sineOutIn:wd,smooth:_d});e("easing",Cd),e("EasingMethod",{LINEAR:0,CONSTANT:1,QUAD_IN:2,QUAD_OUT:3,QUAD_IN_OUT:4,QUAD_OUT_IN:5,CUBIC_IN:6,CUBIC_OUT:7,CUBIC_IN_OUT:8,CUBIC_OUT_IN:9,QUART_IN:10,QUART_OUT:11,QUART_IN_OUT:12,QUART_OUT_IN:13,QUINT_IN:14,QUINT_OUT:15,QUINT_IN_OUT:16,QUINT_OUT_IN:17,SINE_IN:18,SINE_OUT:19,SINE_IN_OUT:20,SINE_OUT_IN:21,EXPO_IN:22,EXPO_OUT:23,EXPO_IN_OUT:24,EXPO_OUT_IN:25,CIRC_IN:26,CIRC_OUT:27,CIRC_IN_OUT:28,CIRC_OUT_IN:29,ELASTIC_IN:30,ELASTIC_OUT:31,ELASTIC_IN_OUT:32,ELASTIC_OUT_IN:33,BACK_IN:34,BACK_OUT:35,BACK_IN_OUT:36,BACK_OUT_IN:37,BOUNCE_IN:38,BOUNCE_OUT:39,BOUNCE_IN_OUT:40,BOUNCE_OUT_IN:41,SMOOTH:42,FADE:43});var Od,Bd=((Rd={})[1]=Nf,Rd[0]=kf,Rd[2]=zf,Rd[3]=Uf,Rd[4]=Gf,Rd[5]=gd,Rd[6]=Vf,Rd[7]=Hf,Rd[8]=Wf,Rd[9]=vd,Rd[10]=jf,Rd[11]=Xf,Rd[12]=qf,Rd[13]=yd,Rd[14]=Yf,Rd[15]=Kf,Rd[16]=Qf,Rd[17]=bd,Rd[18]=Zf,Rd[19]=Jf,Rd[20]=$f,Rd[21]=wd,Rd[22]=ed,Rd[23]=td,Rd[24]=nd,Rd[25]=Td,Rd[26]=id,Rd[27]=rd,Rd[28]=sd,Rd[29]=Sd,Rd[30]=ad,Rd[31]=od,Rd[32]=ud,Rd[33]=xd,Rd[34]=cd,Rd[35]=hd,Rd[36]=ld,Rd[37]=Ed,Rd[38]=fd,Rd[39]=dd,Rd[40]=pd,Rd[41]=Id,Rd[42]=_d,Rd[43]=md,Rd);function Dd(e){return Bd[e]}oe(255),oe(65280);var Pd,Md,Fd,Ld=function(e){function t(){var t;return(t=e.call(this)||this).value=0,t.rightTangent=0,t.rightTangentWeight=0,t.leftTangent=0,t.leftTangentWeight=0,t._flags=0,t}return p(t,e),f(t,[{key:"interpolationMode",get:function(){return 255&this._flags},set:function(e){this._flags&=-256,this._flags|=0|e}},{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}(Cf);function Nd(e){var t=new Ld;if("number"==typeof e)t.value=e;else{var n=e.interpolationMode,i=e.tangentWeightMode,r=e.value,s=e.rightTangent,a=e.rightTangentWeight,o=e.leftTangent,u=e.leftTangentWeight,c=e.easingMethod,h=e[Cn];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!=n?n:t.interpolationMode,t.tangentWeightMode=null!=i?i:t.tangentWeightMode,t.easingMethod=null!=c?c:t.easingMethod,h&&(t[Cn]=h)}return t}En.fastDefine("cc.RealKeyframeValue",Ld,((Od={interpolationMode:0,tangentWeightMode:0,value:0,rightTangent:0,rightTangentWeight:0,leftTangent:0,leftTangentWeight:0,easingMethod:0})[Cn]=void 0,Od)),En.Attr.setClassAttr(Ld,Cn,"editorOnly",!0),(Pd=Ld,null!==(Fd=(Md=Pd)[ql])&&void 0!==Fd?Fd:Md[ql]={}).uniquelyReferenced=!0;var kd=e("RealCurve",function(e){function t(){var t;return(t=e.call(this)||this).preExtrapolation=1,t.postExtrapolation=1,t}p(t,e);var n=t.prototype;return n.evaluate=function(e){var t=this._times,n=this._values,i=t.length;if(0===i)return 0;var r=t[0],s=t[i-1];if(es){var u=this.postExtrapolation,c=n[i-1];if(1===u||i<2)return c.value;switch(u){case 0:return hp(s,c.value,t[i-2],n[i-2].value,e);case 2:e=up(e,r,s);break;case 3:e=cp(e,r,s);break;default:return c.value}}var h=yl(t,e);if(h>=0)return n[h].value;var l=~h,f=l-1,d=t[f],p=n[f],_=t[l];return lp(d,p,_,n[l],(e-d)/(_-d))},n.addKeyFrame=function(t,n){return e.prototype.addKeyFrame.call(this,t,Nd(n))},n.assignSorted=function(e,t){if(void 0!==t)this.setKeyframes(e.slice(),t.map((function(e){return Nd(e)})));else{var n=Array.from(e);this.setKeyframes(n.map((function(e){return e[0]})),n.map((function(e){return Nd(e[1])})))}},n.isConstant=function(e){if(this._values.length<=1)return!0;var t=this._values[0].value;return this._values.every((function(n){return Ba(n.value,t,e)}))},n[Ff]=function(e,t){if(t.toCCON){var n=this._times,i=this._values,r=n.length,s=new DataView(new ArrayBuffer(0+Gd+Gd+Vd+Hd*r+sp*r)),a=0;s.setUint8(a,this.preExtrapolation),a+=Gd,s.setUint8(a,this.postExtrapolation),a+=Gd,s.setUint32(a,r,!0),a+=Vd,n.forEach((function(e,t){return s.setFloat32(a+Hd*t,e,!0)})),a+=Hd*r;for(var o,u=S(i);!(o=u()).done;){var c=o.value;a=ap(s,c,a)}var h=new Uint8Array(s.buffer,0,a);e.writeProperty("bytes",h);var l=i.map((function(e){return e[Cn]}));l.some((function(e){return void 0!==e}))&&e.writeProperty("keyframeValueEditorExtras",l)}else e.writeThis()},n[Lf]=function(e,t){if(t.fromCCON){var n=e.readProperty("bytes"),i=new DataView(n.buffer,n.byteOffset,n.byteLength),r=0;this.preExtrapolation=i.getUint8(r),r+=Gd,this.postExtrapolation=i.getUint8(r),r+=Gd;var s=i.getUint32(r,!0);r+=Vd;var a=Array.from({length:s},(function(e,t){return i.getFloat32(r+Hd*t,!0)}));r+=Hd*s;for(var o=new Array(s),u=0;u>zd;return t.easingMethod=s,i}function up(e,t,n){return t+ja(e-t,n-t)}function cp(e,t,n){return t+Xa(e-t,n-t)}function hp(e,t,n,i,r){return t+(i-t)/(n-e)*(r-e)}function lp(e,t,n,i,r){var s=n-e;switch(t.interpolationMode){default:case 1:return t.value;case 0:var a=0===t.easingMethod?r:Dd(t.easingMethod)(r);return Ma(t.value,i.value,a);case 2:var o=1/3,u=t.rightTangent,c=t.rightTangentWeight,h=!!(2&t.tangentWeightMode),l=i.leftTangent,f=i.leftTangentWeight,d=!!(1&i.tangentWeightMode);if(h||d){var p=0;if(h)p=c;else{var _=s,m=s*u;p=Math.sqrt(_*_+m*m)*o}var g=Math.atan(u),v=Math.cos(g)*p+e,y=Math.sin(g)*p+t.value,b=0;if(d)b=f;else{var w=s,T=s*l;b=Math.sqrt(w*w+T*T)*o}var S=Math.atan(l),x=(v-e)/s,E=(-Math.cos(S)*b+n-e)/s,I=y,A=-Math.sin(S)*b+i.value,R=[0,0,0],C=dp(R,Tl(0-r,3*x,3*E-6*x,3*(x-E)+1,R),r);return fp(t.value,I,A,i.value,C)}var O=t.value+o*u*s,B=i.value-o*l*s;return fp(t.value,O,B,i.value,r)}}function fp(e,t,n,i,r){var s=1-r;return s*s*s*e+3*s*s*r*t+3*s*r*r*n+r*r*r*i}function dp(e,t,n){var i=n;if(1===t)i=e[0];else{i=-1/0;for(var r=0;r=0&&s<=1&&s>i&&(i=s)}i===-1/0&&(i=0)}return i}function pp(e,t,n,i,r){var s=1-r;return s*(s*(e+(3*t-e)*r)+3*n*r*r)+i*r*r*r}u.bezier=pp;var _p,mp,gp,vp,yp,bp,wp,Tp,Sp,xp=Math.cos,Ep=Math.acos,Ip=Math.max,Ap=2*Math.PI,Rp=Math.sqrt;function Cp(e){return e<0?-Math.pow(-e,1/3):Math.pow(e,1/3)}function Op(e,t){var n,i,r,s,a=t-0,o=t-e[0],u=3*a,c=3*o,h=3*(t-e[2]),l=1/(-a+c-h+(t-1)),f=1/3,d=(u-6*o+h)*l,p=d*f,_=(-u+c)*l,m=(3*_-d*d)*f,g=m*f,v=(2*d*d*d-9*d*_+a*l*27)/27,y=v/2,b=y*y+g*g*g;if(b<0){var w=-m*f,T=Rp(w*w*w),S=-v/(2*T),x=Ep(S<-1?-1:S>1?1:S),E=2*Cp(T);return i=E*xp(x*f)-p,r=E*xp((x+Ap)*f)-p,s=E*xp((x+2*Ap)*f)-p,i>=0&&i<=1?r>=0&&r<=1?s>=0&&s<=1?Ip(i,r,s):Ip(i,r):s>=0&&s<=1?Ip(i,s):i:r>=0&&r<=1?s>=0&&s<=1?Ip(r,s):r:s}if(0===b)return r=-(n=y<0?Cp(-y):-Cp(y))-p,(i=2*n-p)>=0&&i<=1?r>=0&&r<=1?Ip(i,r):i:r;var I=Rp(b);return(n=Cp(-y+I))-Cp(y+I)-p}function Bp(e,t){var n=Op(e,t),i=e[1];return((1-n)*(i+(e[3]-i)*n)*3+n*n)*n}u.bezierByTime=Bp,e("QuatInterpolationMode",{SLERP:0,CONSTANT:1});var Dp=Fl("cc.QuatKeyframeValue")(_p=Jl((mp=function(e){var t=void 0===e?{}:e,n=t.value,i=t.interpolationMode,r=t.easingMethod;this.interpolationMode=gp&&gp(),this.value=vp&&vp(),this.easingMethod=yp&&yp(),this.value=n?fu.clone(n):this.value,this.interpolationMode=null!=i?i:this.interpolationMode,this.easingMethod=null!=r?r:this.easingMethod},gp=El(mp.prototype,"interpolationMode",[Yl],(function(){return 0})),vp=El(mp.prototype,"value",[Yl],(function(){return fu.clone(fu.IDENTITY)})),yp=El(mp.prototype,"easingMethod",[Yl],(function(){return 0})),_p=mp))||_p)||_p;function Pp(e){return new Dp(e)}e("QuatCurve",Fl("cc.QuatCurve")((wp=function(e){function t(){var t;return(t=e.call(this)||this).preExtrapolation=Tp&&Tp(),t.postExtrapolation=Sp&&Sp(),t}p(t,e);var n=t.prototype;return n.evaluate=function(e,t){var n;null!==(n=t)&&void 0!==n||(t=new fu);var i=this._times,r=this._values,s=this.postExtrapolation,a=this.preExtrapolation,o=i.length;if(0===o)return t;var u=i[0],c=i[o-1];if(ec){var l=r[o-1];switch(s){case 2:e=u+ja(e-u,c-u);break;case 3:e=u+Xa(e-u,c-u);break;default:return fu.copy(t,l.value)}}var f=yl(i,e);if(f>=0)return fu.copy(t,r[f].value);var d=~f,p=d-1,_=i[p],m=r[p],g=i[d],v=r[d],y=(e-_)/(g-_);switch(m.interpolationMode){default:case 1:return fu.copy(t,m.value);case 0:var b=m.easingMethod,w=0===b?y:Array.isArray(b)?Bp(b,y):Dd(b)(y);return fu.slerp(t,m.value,v.value,w)}},n.addKeyFrame=function(t,n){var i=new Dp(n);return e.prototype.addKeyFrame.call(this,t,i)},n.assignSorted=function(e,t){if(void 0!==t)this.setKeyframes(e.slice(),t.map((function(e){return Pp(e)})));else{var n=Array.from(e);this.setKeyframes(n.map((function(e){return e[0]})),n.map((function(e){return Pp(e[1])})))}},n[Ff]=function(e,t){if(t.toCCON){var n=this._times,i=this._values,r=!0;i.forEach((function(e,t,n){var i=n[0];r&&e.interpolationMode!==i.interpolationMode&&(r=!1)}));var s=n.length,a=zp*(r?1:s),o=i.reduce((function(e,t){var n=t.easingMethod;return e+(Array.isArray(n)?Up+4*Vp:Up)}),0),u=0,c=new DataView(new ArrayBuffer(u+=Fp+Lp+Np*s+4*kp*s+o+a+0)),h=0,l=0;r&&(l|=1),c.setUint32(h,l,!0),h+=Fp,c.setUint32(h,s,!0),h+=Lp,n.forEach((function(e,t){return c.setFloat32(h+Np*t,e,!0)})),h+=Np*s,i.forEach((function(e,t){var n=e.value,i=n.x,r=n.y,s=n.z,a=n.w,o=h+4*kp*t;c.setFloat32(o+0*kp,i,!0),c.setFloat32(o+1*kp,r,!0),c.setFloat32(o+2*kp,s,!0),c.setFloat32(o+3*kp,a,!0)})),h+=4*kp*s,i.forEach((function(e){var t=e.easingMethod;Array.isArray(t)?(c.setUint8(h,Gp),++h,c.setFloat32(h+0*Vp,t[0],!0),c.setFloat32(h+1*Vp,t[1],!0),c.setFloat32(h+2*Vp,t[2],!0),c.setFloat32(h+3*Vp,t[3],!0),h+=4*Vp):(c.setUint8(h,t),++h)}));var f=h;h+=a;var d=f;i.forEach((function(e){var t=e.interpolationMode;c.setUint8(d,t),r||(d+=zp)}));var p=new Uint8Array(c.buffer);e.writeProperty("bytes",p)}else e.writeThis()},n[Lf]=function(e,t){if(t.fromCCON){var n=e.readProperty("bytes"),i=new DataView(n.buffer,n.byteOffset,n.byteLength),r=0,s=i.getUint32(r,!0);r+=Fp;var a=1&s,o=i.getUint32(r,!0);r+=Lp;var u=Array.from({length:o},(function(e,t){return i.getFloat32(r+Np*t,!0)})),c=r+=Np*o;r+=4*kp*o;var h=Array.from({length:o},(function(e,t){var n=c+4*kp*t,s=i.getFloat32(n+0*kp,!0),a=i.getFloat32(n+1*kp,!0),o=i.getFloat32(n+2*kp,!0),u=i.getFloat32(n+3*kp,!0),h=i.getUint8(r);++r;var l=Pp({value:{x:s,y:a,z:o,w:u}});return h!==Gp?l.easingMethod=h:(l.easingMethod=[i.getFloat32(r+0*Vp,!0),i.getFloat32(r+1*Vp,!0),i.getFloat32(r+2*Vp,!0),i.getFloat32(r+3*Vp,!0)],r+=4*Vp),l}));if(a){var l=i.getUint8(r);++r;for(var f=0;f=0)return this._values[t];var n=Da(~t-1,0,this._values.length-1);return this._values[n]},t}(bl))||Mp),{Blend:0,Fixed:1});yt(Hp);var Wp=e("ColorKey",(function(){this.color=Wo.WHITE.clone(),this.time=0}));En.fastDefine("cc.ColorKey",Wp,{color:Wo.WHITE.clone(),time:0}),En.Attr.setClassAttr(Wp,"color","visible",!0),En.Attr.setClassAttr(Wp,"time","visible",!0);var jp=e("AlphaKey",(function(){this.alpha=1,this.time=0}));En.fastDefine("cc.AlphaKey",jp,{alpha:1,time:0}),En.Attr.setClassAttr(jp,"alpha","visible",!0),En.Attr.setClassAttr(jp,"time","visible",!0);var Xp=e("Gradient",function(){function e(){this.colorKeys=[],this.alphaKeys=[],this.mode=0}var t=e.prototype;return t.setKeys=function(e,t){this.colorKeys=e,this.alphaKeys=t},t.sortKeys=function(){this.colorKeys.length>1&&this.colorKeys.sort((function(e,t){return e.time-t.time})),this.alphaKeys.length>1&&this.alphaKeys.sort((function(e,t){return e.time-t.time}))},t.evaluate=function(e){return this.evaluateFast(new Wo,e)},t.evaluateFast=function(e,t){return this.getRGB(e,t),e.a=this.getAlpha(t),e},t.randomColor=function(){return this.getRandomColor(new Wo)},t.getRandomColor=function(e){var t=this.colorKeys[Math.trunc(Na()*this.colorKeys.length)],n=this.alphaKeys[Math.trunc(Na()*this.alphaKeys.length)];return e.set(t.color),e.a=n.alpha,e},t.getRGB=function(e,t){var n=this.colorKeys,i=n.length;if(i>1){t=ja(t,1+Ca);for(var r=1;r=s&&tn[u].time&&Wo.lerp(e,n[u].color,Wo.BLACK,(t-n[u].time)/(1-n[u].time))}else 1===i?Wo.copy(e,n[0].color):Wo.copy(e,Wo.WHITE);return e},t.getAlpha=function(e){var t=this.alphaKeys,n=t.length;if(n>1){e=ja(e,1+Ca);for(var i=1;i=r&&et[o].time?Ma(t[o].alpha,0,(e-t[o].time)/(1-t[o].time)):255}return 1===n?t[0].alpha:255},e}());Xp.Mode=Hp,En.fastDefine("cc.Gradient",Xp,{colorKeys:[],alphaKeys:[],mode:0}),En.Attr.setClassAttr(Xp,"colorKeys","visible",!0),En.Attr.setClassAttr(Xp,"alphaKeys","visible",!0),En.Attr.setClassAttr(Xp,"mode","visible",!0);var qp=function(){this.time=0,this.value=0,this.inTangent=0,this.outTangent=0};En.fastDefine("cc.Keyframe",qp,{time:0,value:0,inTangent:0,outTangent:0});var Yp=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 Kp(e-this.time,this.coefficient)},e}();function Kp(e,t){return e*(e*(e*t[0]+t[1])+t[2])+t[3]}var Qp=function(){function e(e){if(void 0===e&&(e=null),this._curve=void 0,this.cachedKey=void 0,e instanceof kd)this._curve=e;else{var t=new kd;this._curve=t,t.preExtrapolation=2,t.postExtrapolation=1,e?t.assignSorted(e.map((function(e){return[e.time,{interpolationMode:2,value:e.value,leftTangent:e.inTangent,rightTangent:e.outTangent}]}))):t.assignSorted([[0,{interpolationMode:2,value:1}],[1,{interpolationMode:2,value:1}]])}this.cachedKey=new Yp}var t=e.prototype;return t.addKey=function(e){e?this._curve.addKeyFrame(e.time,{interpolationMode:2,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,n=this._curve,i=n.keyFramesCount-1,r=e,s=e<0?n.preExtrapolation:n.postExtrapolation,a=n.getKeyframeTime(0),o=n.getKeyframeTime(i);switch(s){case 2:r=ja(e-a,o-a)+a;break;case 3:r=Xa(e-a,o-a)+a;break;default:r=Da(e,a,o)}if(r>=t.time&&rn.getKeyframeTime(r))for(var s=0;s<3;s++){var a=r+s;if(a+1t)return a}else for(var o=0;o<3;o++){var u=r-o;if(u>=0&&n.getKeyframeTime(u-1)<=t)return u-1}for(var c,h=0,l=i;l-h>1;)c=Math.floor((h+l)/2),n.getKeyframeTime(c)>=t?l=c:h=c;return h},f(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],n=e[1],i=new qp;return i.time=t,i.value=n.value,i.inTangent=n.leftTangent,i.outTangent=n.rightTangent,i}))},set:function(e){this._curve.assignSorted(e.map((function(e){return[e.time,{interpolationMode:2,value:e.value,leftTangent:e.inTangent,rightTangent:e.outTangent}]})))}},{key:"preWrapMode",get:function(){return Jp(this._curve.preExtrapolation)},set:function(e){this._curve.preExtrapolation=Zp(e)}},{key:"postWrapMode",get:function(){return Jp(this._curve.postExtrapolation)},set:function(e){this._curve.postExtrapolation=Zp(e)}}]),e}();function Zp(e){switch(e){default:case 0:case 1:case 8:return 1;case 22:return 3;case 2:return 2}}function Jp(e){switch(e){default:case 0:case 1:return 8;case 3:return 22;case 2:return 2}}Qp.defaultKF=[{time:0,value:1,inTangent:0,outTangent:0},{time:1,value:1,inTangent:0,outTangent:0}],En.fastDefine("cc.AnimationCurve",Qp,{_curve:null});var $p=Fo.multiplyScalar,e_=Fo.add,t_=4294967295,n_=Lo(),i_=Lo(),r_=Lo(),s_=Lo(),a_=function(){function e(e,t){void 0===e&&(e=2),void 0===t&&(t=[]),this._type=void 0,this._knots=[],this._type=1024,this._mode=e;for(var n=0;n=this._knots.length?this._knots.push(n):this._knots.splice(e,0,n)},t.removeKnot=function(e){gt(this._knots,e),this._knots.splice(e,1)},t.setKnot=function(e,t){gt(this._knots,e),this._knots[e].set(t)},t.getKnot=function(e){return gt(this._knots,e),this._knots[e]},t.getPoint=function(t,n){void 0===n&&(n=t_),t=Da(t,0,1);var i=this.getSegments();if(0===i)return Lo();if(n===t_){var r=1/i;n=Math.floor(t/r),t=t%r/r}var s=this._knots;if(n>=i)return Lo(s[s.length-1]);switch(this._mode){case 0:return e.calcLinear(s[n],s[n+1],t);case 1:var a=4*n;return e.calcBezier(s[a],s[a+1],s[a+2],s[a+3],t);case 2:var o=n>0?s[n-1]:s[n],u=n+2t.priority?-1:0};var t=e.prototype;return t.init=function(){},t.update=function(){},t.postUpdate=function(){},t.destroy=function(){},f(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}());v_.Priority=yt({LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:2147483648});var y_=new Ee("Scheduler"),b_=function(){function e(e,t,n,i){this.target=void 0,this.priority=void 0,this.paused=void 0,this.markedForDeletion=void 0,this.target=e,this.priority=t,this.paused=n,this.markedForDeletion=i}return e.get=function(t,n,i,r){var s=e._listEntries.pop();return s?(s.target=t,s.priority=n,s.paused=i,s.markedForDeletion=r):s=new e(t,n,i,r),s},e.put=function(t){e._listEntries.length<20&&(t.target=null,e._listEntries.push(t))},e}();b_._listEntries=[];var w_=function(){function e(e,t,n,i){this.list=void 0,this.entry=void 0,this.target=void 0,this.callback=void 0,this.list=e,this.entry=t,this.target=n,this.callback=i}return e.get=function(t,n,i,r){var s=e._hashUpdateEntries.pop();return s?(s.list=t,s.entry=n,s.target=i,s.callback=r):s=new e(t,n,i,r),s},e.put=function(t){e._hashUpdateEntries.length<20&&(t.list=t.entry=t.target=t.callback=null,e._hashUpdateEntries.push(t))},e}();w_._hashUpdateEntries=[];var T_=function(){function e(e,t,n,i,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=n,this.currentTimer=i,this.currentTimerSalvaged=r,this.paused=s}return e.get=function(t,n,i,r,s,a){var o=e._hashTimerEntries.pop();return o?(o.timers=t,o.target=n,o.timerIndex=i,o.currentTimer=r,o.currentTimerSalvaged=s,o.paused=a):o=new e(t,n,i,r,s,a),o},e.put=function(t){e._hashTimerEntries.length<20&&(t.timers=t.target=t.currentTimer=null,e._hashTimerEntries.push(t))},e}();T_._hashTimerEntries=[];var S_=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}e.get=function(){return e._timers.pop()||new e},e.put=function(t){e._timers.length<20&&!t._lock&&(t._scheduler=t._target=t._callback=null,e._timers.push(t))};var t=e.prototype;return t.initWithCallback=function(e,t,n,i,r,s){return this._lock=!1,this._scheduler=e,this._target=n,this._callback=t,this._timesExecuted=0,this._elapsed=-1,this._interval=i,this._delay=s,this._useDelay=this._delay>0,this._repeat=r,this._runForever=this._repeat===u.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&&this._callback&&this._target&&this._scheduler.unscheduleForTimer(this,this._target)},e}();S_._timers=[];var x_=e("Scheduler",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=ke(!0),t._hashForTimers=ke(!0),t._currentTarget=null,t._currentTargetSalvaged=!1,t._updateHashLocked=!1,t._arrayForTimers=[],t}p(t,e),t.enableForTarget=function(e){var t=!1;(e.uuid||e.id)&&(t=!0),t||(e.id=y_.getNewId())};var n=t.prototype;return n.setTimeScale=function(e){this._timeScale=e},n.getTimeScale=function(){return this._timeScale},n.update=function(e){var t,n,i,r,s;for(this._updateHashLocked=!0,1!==this._timeScale&&(e*=this._timeScale),t=0,i=(n=this._updatesNegList).length;t=s&&i.timerIndex--,void(0===r.length&&(this._currentTarget===i?this._currentTargetSalvaged=!0:this._removeHashElement(i)))}}}else Z(1510)}},n.unscheduleForTimer=function(e,t){var n=t.uuid||t.id,i=this._hashForTimers[n],r=i.timers;if(r&&0!==r.length)for(var s=r.length-1;s>=0;s--){var a=r[s];if(a===e)return r.splice(s,1),S_.put(a),i.timerIndex>=s&&i.timerIndex--,void(0===r.length&&(this._currentTargetSalvaged=!0))}},n.unscheduleUpdate=function(e){if(e){var t=e.uuid||e.id;if(t){var n=this._hashForUpdates[t];null!=n&&n.entry&&(this._updateHashLocked?n.entry.markedForDeletion=!0:this._removeUpdateFromHash(n.entry))}else Z(1510)}},n.unscheduleAllForTarget=function(e){if(e){var t=e.uuid||e.id;if(t){var n=this._hashForTimers[t];if(null!=n&&n.timers){var i=n.timers;n.currentTimer&&i.indexOf(n.currentTimer)>-1&&!n.currentTimerSalvaged&&(n.currentTimerSalvaged=!0);for(var r=0,s=i.length;r=0;t--)(n=r[t]).target&&this.unscheduleAllForTarget(n.target);var s=0;if(e<0)for(t=0;t=e&&this.unscheduleUpdate(i.target),s===this._updatesNegList.length&&t++}if(e<=0)for(t=0;t=e&&this.unscheduleUpdate(i.target),s===this._updatesPosList.length&&t++}},n.isScheduled=function(e,t){$(Boolean(e),1508),$(Boolean(t),1509);var n=t.uuid||t.id;if(!n)return Z(1510),!1;var i=this._hashForTimers[n];if(!i)return!1;if(null==i.timers)return!1;for(var r=i.timers,s=0;s=e&&(r.paused=!0,s.push(r.target))}if(e<=0)for(n=0;n=e&&(r.paused=!0,s.push(r.target))}return s},n.resumeTargets=function(e){if(e)for(var t=0;t4||e<0)&&(e=0);var t=0,n=!1;if(1===e?(t=0,n=!0):0===e||4===e?(t=this._supportWebGPU()?2:1,n=!0):2===e?(t=1,n=!0):3===e&&(t=4,n=!0),!n)throw new Error(te(3820,e));return t},f(e,[{key:"gfxDevice",get:function(){return this._gfxDevice}},{key:"swapchain",get:function(){return this._swapchain}}]),e}(),D_=new B_;e("gfx",Object.freeze({__proto__:null,API:wi,AccessFlagBit:Ki,Address:Ui,Attribute:Xr,AttributeName:vs,BarrierType:cr,BindingMappingInfo:Ir,BlendFactor:Hi,BlendOp:Wi,BlendState:Zs,BlendTarget:Qs,Buffer:Fs,BufferBarrierInfo:is,BufferFlagBit:Ci,BufferInfo:Cr,BufferTextureCopy:wr,BufferUsageBit:Ri,BufferViewInfo:Or,ClearFlagBit:ur,Color:Sr,ColorAttachment:Kr,ColorMask:ji,CommandBuffer:Ls,CommandBufferInfo:hs,CommandBufferType:or,ComparisonFunc:Gi,CullMode:tr,DESCRIPTOR_BUFFER_TYPE:Ss,DESCRIPTOR_DYNAMIC_TYPE:10,DESCRIPTOR_SAMPLER_TYPE:xs,DESCRIPTOR_STORAGE_BUFFER_TYPE:12,DRAW_INFO_SIZE:28,DefaultResource:ks,DepthStencilAttachment:Qr,DepthStencilState:Ks,DescriptorSet:js,DescriptorSetInfo:os,DescriptorSetLayout:Xs,DescriptorSetLayoutBinding:ss,DescriptorSetLayoutInfo:as,DescriptorType:rr,Device:Ns,DeviceCaps:fr,DeviceInfo:Rr,DeviceManager:B_,DeviceOptions:dr,DispatchInfo:Dr,DrawInfo:Br,DynamicStateFlagBit:nr,DynamicStates:ms,DynamicStencilStates:_s,Extent:mr,Feature:Si,Filter:zi,Format:xi,FormatFeatureBit:Li,FormatInfo:ds,FormatInfos:Ts,FormatSize:As,FormatSurfaceSize:Rs,FormatType:Ei,Framebuffer:Us,FramebufferInfo:rs,GFXObject:gs,GeneralBarrier:sa,GeneralBarrierInfo:ts,GetTypeSize:Os,IndirectBuffer:Pr,InputAssembler:Ws,InputAssemblerInfo:Yr,InputState:cs,IsPowerOf2:Es,LegacyRenderMode:{AUTO:0,CANVAS:1,WEBGL:2,HEADLESS:3,WEBGPU:4},LoadOp:qi,MarkerInfo:Er,MemoryAccessBit:Oi,MemoryStatus:ps,MemoryUsageBit:Bi,ObjectType:yi,Offset:pr,PassType:hr,PipelineBindPoint:Zi,PipelineLayout:qs,PipelineLayoutInfo:us,PipelineState:$s,PipelineStateInfo:Js,PolygonMode:$i,PrimitiveMode:Ji,QueryPoolInfo:fs,QueryType:ar,Queue:ea,QueueInfo:ls,QueueType:sr,RasterizerState:Ys,Rect:_r,RenderPass:ta,RenderPassInfo:$r,RenderType:{UNKNOWN:-1,CANVAS:0,WEBGL:1,WEBGPU:2,OPENGL:3,HEADLESS:4},ResolveMode:Qi,ResourceRange:es,SampleCount:Ni,SampleType:Ii,Sampler:na,SamplerInfo:Lr,ShadeModel:er,Shader:ia,ShaderInfo:qr,ShaderStage:jr,ShaderStageFlagBit:Xi,Size:lr,Status:bi,StencilFace:ir,StencilOp:Vi,StoreOp:Yi,SubpassDependency:Jr,SubpassInfo:Zr,SurfaceTransform:Ti,Swapchain:zs,SwapchainInfo:Ar,Texture:ra,TextureBarrier:aa,TextureBarrierInfo:ns,TextureBlit:br,TextureCopy:yr,TextureFlagBit:Fi,TextureInfo:Mr,TextureSubresLayers:gr,TextureSubresRange:vr,TextureType:Di,TextureUsageBit:Mi,TextureViewInfo:Fr,Type:Ai,Uniform:Nr,UniformBlock:kr,UniformInputAttachment:Wr,UniformSampler:Ur,UniformSamplerTexture:zr,UniformStorageBuffer:Hr,UniformStorageImage:Vr,UniformTexture:Gr,ViewDimension:Pi,Viewport:Tr,VsyncMode:ki,alignTo:Ps,deviceManager:D_,formatAlignment:Ds,getTypedArrayConstructor:Bs}));var P_,M_,F_,L_,N_,k_,z_,U_,G_,V_,H_,W_,j_,X_,q_={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},Y_=e("Layers",function(){function e(){}return e.init=function(){var t=At.querySettings("engine","customLayers");if(t)for(var n=0;n19||n<0)K(16365);else{var i=1<19||t<0)K(16366);else{var n=1<31||t<0?(K(16368),""):e.Enum[1<this.pipes.length?(K(4921),this):(this.pipes.splice(t,0,e),this)},t.append=function(e){return this.pipes.push(e),this},t.remove=function(e){return this.pipes.splice(e,1),this},t.sync=function(e){var t=this.pipes;if(0===t.length)return null;e.isFinished=!1;for(var n=0,i=t.length;n>2],Xg[qg[i++]]=Wg[(3&r)<<2|s>>4],Xg[qg[i++]]=Wg[15&s]}return e.replace(t,Xg.join(""))}var Kg=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;function Qg(e){var t=Kg.exec(e);return t?t[1]:""}function Zg(e,t){(t=t||Object.create(null)).__isNative__=t.isNative,t.nativeExt&&(t.ext=t.nativeExt);var n=Ng.find((function(t){return!!t.getAssetInfo(e)}));return n&&(t.bundle=n.name),ev(e,t)}function Jg(e){return!!e&&(e instanceof o.SceneAsset||e instanceof o.Scene)}function $g(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 ev(e,t){var n=Hg.create({input:e,options:t}),i=[];try{for(var r,s=S(Ug.sync(n));!(r=s()).done;){var a=r.value,o=a.url;a.recycle(),i.push(o)}}catch(e){for(var u,c=S(n.output);!(u=c()).done;)u.value.recycle();k(e.message,e.stack)}return n.recycle(),i.length>1?i:i[0]}var tv,nv,iv,rv,sv,av,ov=Object.freeze({__proto__:null,decodeUuid:Yg,getUrlWithUuid:Zg,getUuidFromURL:Qg,isScene:Jg,normalize:$g,transform:ev}),uv=Yl,cv=zl,hv=e("Asset",Fl("cc.Asset")((nv=function(e){function t(t){var n;return(n=e.call(this,t)||this).loaded=!0,n._native=iv&&iv(),n._nativeUrl="",n._file=null,n._ref=0,Object.defineProperty(b(n),"_uuid",{value:"",writable:!0}),n}p(t,e),t.deserialize=function(e){return o.deserialize(e)};var n=t.prototype;return n.toString=function(){return this.nativeUrl},n.serialize=function(){},n._setRawAsset=function(e,t){void 0===t&&(t=!0),this._native=!1!==t?e||"":"/"+e},n.addRef=function(){return this._ref++,this},n.decRef=function(e){return void 0===e&&(e=!0),this._ref>0&&this._ref--,e&&o.assetManager.getReleaseManager().tryRelease(this),this},n.onLoaded=function(){},n.initDefault=function(e){e&&(this._uuid=e),this.isDefault=!0},n.validate=function(){return!0},n.destroy=function(){return U(te(12101,this._uuid)),e.prototype.destroy.call(this)},f(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=Zg(this._uuid,{nativeExt:e,isNative:!0}):this._nativeUrl=Zg(this._uuid,{__nativeName__:e,nativeExt:ai(e),isNative:!0})}return this._nativeUrl}},{key:"uuid",get:function(){return this._uuid}},{key:"_nativeAsset",get:function(){return this._file},set:function(e){this._file=e}},{key:"nativeAsset",get:function(){return this._file}},{key:"_nativeDep",get:function(){if(this._native)return{__isNative__:!0,uuid:this._uuid,ext:this._native}}},{key:"refCount",get:function(){return this._ref}}]),t}(jn(Pn)),iv=El(nv.prototype,"_native",[uv],(function(){return""})),I(nv.prototype,"_nativeAsset",[cv],Object.getOwnPropertyDescriptor(nv.prototype,"_nativeAsset"),nv.prototype),tv=nv))||tv);hv.prototype.createNode=null,o.Asset=hv;var lv=1346981187,fv=yt({PVR:0,PKM:1,ASTC:2});function dv(e,t){return 4===e?89:5===e?4===t?90:91:6===e?5===t?92:93:8===e?5===t?94:6===t?95:96:10===e?5===t?97:6===t?98:8===t?99:100:10===t?101:102}function pv(e,t){return e[t]<<8|e[t+1]}function _v(e){return!!(qh.hasFeature(qh.Feature.IMAGE_BITMAP)&&e instanceof ImageBitmap)}var mv,gv,vv,yv,bv,wv,Tv,Sv,xv,Ev,Iv,Av=e("ImageAsset",Fl("cc.ImageAsset")((av=function(e){p(n,e),n.mergeCompressedTextureMips=function(e){var t=new Uint8Array(0);try{for(var n,i=8+4*e.length,r=0,s=S(e);!(n=s()).done;)r+=n.value.byteLength;r+=i,t=new Uint8Array(r);var a=new DataView(t.buffer,t.byteOffset,t.byteLength);a.setUint32(0,lv,!0),a.setUint32(4,e.length,!0);for(var o=i,u=0;u0){var c=new Uint8Array(s,o,u),h=new Uint8Array(r._data.byteLength+c.byteLength);h.set(r._data),h.set(c,r._data.byteLength),r._data=h,r.mipmapLevelDataSize[t]=u}else r._data=new Uint8Array(s,o);r.width=t>0?r.width:a[7],r.height=t>0?r.height:a[6]}else{if(559044176!==a[11])throw new Error("Invalid magic number in PVR header");var l=n+a[0],f=i-a.byteLength;if(i>0){var d=new Uint8Array(s,l,f),p=new Uint8Array(r._data.byteLength+d.byteLength);p.set(r._data),p.set(d,r._data.byteLength),r._data=p,r.mipmapLevelDataSize[t]=f}else r._data=new Uint8Array(s,l);r.width=t>0?r.width:a[1],r.height=t>0?r.height:a[2]}},n.parsePKMTexture=function(e,t,n,i,r){var s=e instanceof ArrayBuffer?e:e.buffer,a=new Uint8Array(s,n,16),o=pv(a,6);if(0!==o&&1!==o&&3!==o)throw new Error("Invalid magic number in ETC header");var u=n+16,c=i-16;if(i>0){var h=new Uint8Array(s,u,c),l=new Uint8Array(r._data.byteLength+h.byteLength);l.set(r._data),l.set(h,r._data.byteLength),r._data=l,r.mipmapLevelDataSize[t]=c}else r._data=new Uint8Array(s,u);r.width=t>0?r.width:pv(a,12),r.height=t>0?r.height:pv(a,14)},n.parseASTCTexture=function(e,t,n,i,r){var s=e instanceof ArrayBuffer?e:e.buffer,a=new Uint8Array(s,n,16);if(1554098963!==a[0]+(a[1]<<8)+(a[2]<<16)+(a[3]<<24))throw new Error("Invalid magic number in ASTC header");var o=a[4],u=a[5],c=a[6];if((o<3||o>6||u<3||u>6||c<3||c>6)&&(o<4||7===o||9===o||11===o||o>12||u<4||7===u||9===u||11===u||u>12||1!==c))throw new Error("Invalid block number in ASTC header");var h=dv(o,u),l=n+16,f=i-16;if(i>0){var d=new Uint8Array(s,l,f),p=new Uint8Array(r._data.byteLength+d.byteLength);p.set(r._data),p.set(d,r._data.byteLength),r._data=p,r.mipmapLevelDataSize[t]=f}else r._data=new Uint8Array(s,l);r.width=t>0?r.width:a[7]+(a[8]<<8)+(a[9]<<16),r.height=t>0?r.height:a[10]+(a[11]<<8)+(a[12]<<16),r.format=h};var t=n.prototype;function n(t){var n;return(n=e.call(this)||this)._nativeData=void 0,n._exportedExts=void 0,n._format=35,n._width=0,n._height=0,n._nativeData={_data:null,width:0,height:0,format:0,_compressed:!1,mipmapLevelDataSize:[]},void 0!==t&&n.reset(t),n}return t.extractMipmap0=function(){if(this.mipmapLevelDataSize&&this.mipmapLevelDataSize.length>0){var e=this.mipmapLevelDataSize[0],t=this.data,i=new n({_data:new Uint8Array(t.buffer,0,e),_compressed:!0,width:this.width,height:this.height,format:this.format,mipmapLevelDataSize:[]});return i._uuid=""+this._uuid,i}return this},t.extractMipmaps=function(){var e=[];if(this.mipmapLevelDataSize&&this.mipmapLevelDataSize.length>0)for(var t,i=this.mipmapLevelDataSize,r=this.data,s=0,a=this.height,o=this.width,u=S(i);!(t=u()).done;){var c=t.value,h=new n({_data:new Uint8Array(r.buffer,s,c),_compressed:!0,width:o,height:a,format:this.format,mipmapLevelDataSize:[]});s+=c,h._uuid=""+this._uuid,o=Math.max(o>>1,1),a=Math.max(a>>1,1),e.push(h)}else e.push(this);return e},t.reset=function(e){_v(e)||e instanceof HTMLElement?this._nativeData=e:(this._nativeData=e,this._format=e.format)},t.destroy=function(){if(this.data&&this.data instanceof HTMLImageElement)this.data.src="",this._setRawAsset("");else if(_v(this.data)){var t;null==(t=this.data)||t.close()}return e.prototype.destroy.call(this)},t._serialize=function(){},t._deserialize=function(e){var t="";"string"==typeof e?t=e:(this._width=e.w,this._height=e.h,t=e.fmt);for(var i,r=D_.gfxDevice,s=t.split("_"),a=Number.MAX_VALUE,o=this._format,u="",c=Rt.SUPPORT_TEXTURE_FORMATS,h=S(s);!(i=h()).done;){var l=i.value.split("@"),f=parseInt(l[0],void 0),d=n.extnames[f]||l[0],p=c.indexOf(d);if(-1!==p&&p=72&&this._format<=102||this._format>=1024&&this._format<=1026}},{key:"mipmapLevelDataSize",get:function(){return this._nativeData.mipmapLevelDataSize}},{key:"url",get:function(){return this.nativeUrl}}]),n}(hv),av.extnames=[".png",".jpg",".jpeg",".bmp",".webp",".pvr",".pkm",".astc"],av._sharedPlaceHolderCanvas=null,I((sv=av).prototype,"_nativeAsset",[Rf],Object.getOwnPropertyDescriptor(sv.prototype,"_nativeAsset"),sv.prototype),rv=sv))||rv);o.ImageAsset=Av,Tt(xi);var Rv,Cv,Ov,Bv=new Ee("Tex"),Dv=Fl("cc.TextureBase")((Iv=function(e){function t(t){var n;return(n=e.call(this,t)||this)._format=vv&&vv(),n._minFilter=yv&&yv(),n._magFilter=bv&&bv(),n._mipFilter=wv&&wv(),n._wrapS=Tv&&Tv(),n._wrapT=Sv&&Sv(),n._wrapR=xv&&xv(),n._anisotropy=Ev&&Ev(),n._width=1,n._height=1,n._samplerInfo=new Lr,n._gfxSampler=null,n._gfxDevice=null,n._textureHash=0,n._id=Bv.getNewId(),n._gfxDevice=n._getGFXDevice(),n._textureHash=Hs(n._id,666),n}p(t,e);var n=t.prototype;return n.getId=function(){return this._id},n.getPixelFormat=function(){return this._format},n.getAnisotropy=function(){return this._anisotropy},n.setWrapMode=function(e,t,n){void 0===n&&(n=e),this._wrapS=e,this._samplerInfo.addressU=e,this._wrapT=t,this._samplerInfo.addressV=t,this._wrapR=n,this._samplerInfo.addressW=n,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},n.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))},n.setMipFilter=function(e){this._mipFilter=e,this._samplerInfo.mipFilter=e,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},n.setAnisotropy=function(e){e=Math.min(e,16),this._anisotropy=e,this._samplerInfo.maxAnisotropy=e,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},n.destroy=function(){var t,n=e.prototype.destroy.call(this);return n&&null!=(t=o.director.root)&&t.batcher2D&&o.director.root.batcher2D._releaseDescriptorSetCache(this._textureHash),n},n.getHash=function(){return this._textureHash},n.getGFXTexture=function(){return null},n.getSamplerInfo=function(){return this._samplerInfo},n.getGFXSampler=function(){return this._gfxSampler||(this._gfxDevice?this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo):Z(9302)),this._gfxSampler},n._serialize=function(){return""},n._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])))},n._getGFXDevice=function(){return D_.gfxDevice},n._getGFXFormat=function(){return this._getGFXPixelFormat(this._format)},n._setGFXFormat=function(e){this._format=void 0===e?35:e},n._getGFXPixelFormat=function(e){return 1026===e?e=72:1025===e?e=85:1024===e&&(e=83),e},f(t,[{key:"isCompressed",get:function(){return this._format>=72&&this._format<=102||this._format>=1024&&this._format<=1026}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),t}(hv),Iv.PixelFormat={RGB565:47,RGB5A1:49,RGBA4444:50,RGB888:24,RGB32F:32,RGBA8888:35,BGRA8888:36,RGBA32F:44,A8:1,I8:2,AI8:3,RGB_PVRTC_2BPPV1:83,RGBA_PVRTC_2BPPV1:84,RGB_A_PVRTC_2BPPV1:1024,RGB_PVRTC_4BPPV1:85,RGBA_PVRTC_4BPPV1:86,RGB_A_PVRTC_4BPPV1:1025,RGB_ETC1:72,RGBA_ETC1:1026,RGB_ETC2:73,RGBA_ETC2:77,RGBA_ASTC_4x4:89,RGBA_ASTC_5x4:90,RGBA_ASTC_5x5:91,RGBA_ASTC_6x5:92,RGBA_ASTC_6x6:93,RGBA_ASTC_8x5:94,RGBA_ASTC_8x6:95,RGBA_ASTC_8x8:96,RGBA_ASTC_10x5:97,RGBA_ASTC_10x6:98,RGBA_ASTC_10x8:99,RGBA_ASTC_10x10:100,RGBA_ASTC_12x10:101,RGBA_ASTC_12x12:102},Iv.WrapMode={REPEAT:0,CLAMP_TO_EDGE:2,MIRRORED_REPEAT:1,CLAMP_TO_BORDER:3},Iv.Filter={NONE:0,LINEAR:2,NEAREST:1},vv=El((gv=Iv).prototype,"_format",[Yl],(function(){return 35})),yv=El(gv.prototype,"_minFilter",[Yl],(function(){return 2})),bv=El(gv.prototype,"_magFilter",[Yl],(function(){return 2})),wv=El(gv.prototype,"_mipFilter",[Yl],(function(){return 0})),Tv=El(gv.prototype,"_wrapS",[Yl],(function(){return 0})),Sv=El(gv.prototype,"_wrapT",[Yl],(function(){return 0})),xv=El(gv.prototype,"_wrapR",[Yl],(function(){return 0})),Ev=El(gv.prototype,"_anisotropy",[Yl],(function(){return 0})),mv=gv))||mv;o.TextureBase=Dv;var Pv=e("Script",Fl("cc.Script")(Rv=function(e){function t(t){return e.call(this,t)||this}return p(t,e),t}(hv))||Rv);o._Script=Pv;var Mv=e("JavaScript",Fl("cc.JavaScript")(Cv=function(e){function t(t){return e.call(this,t)||this}return p(t,e),t}(Pv))||Cv);o._JavaScript=Mv;var Fv,Lv,Nv,kv,zv,Uv,Gv,Vv=e("TypeScript",Fl("cc.TypeScript")(Ov=function(e){function t(t){return e.call(this,t)||this}return p(t,e),t}(Pv))||Ov);o._TypeScript=Vv;var Hv,Wv,jv,Xv,qv,Yv,Kv,Qv,Zv,Jv,$v,ey=e("EventHandler",Fl("cc.ClickEvent")((Lv=function(){function e(){this.target=Nv&&Nv(),this.component=kv&&kv(),this._componentId=zv&&zv(),this.handler=Uv&&Uv(),this.customEventData=Gv&&Gv()}e.emitEvents=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r=0,1620),n=Number.isNaN(n)?u.macro.REPEAT_FOREVER:n,i=i||0;var r=u.director.getScheduler(),s=r.isTargetPaused(this);r.schedule(e,this,t,n,i,s)},n.scheduleOnce=function(e,t){void 0===t&&(t=0),this.schedule(e,0,0,t)},n.unschedule=function(e){e&&u.director.getScheduler().unschedule(e,this)},n.unscheduleAllCallbacks=function(){u.director.getScheduler().unscheduleAllForTarget(this)},f(t,[{key:"name",get:function(){if(this._name)return this._name;var e=ze(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=u.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 16384&this._objFlags}},{key:"internalUpdate",get:function(){return this.update}},{key:"internalLateUpdate",get:function(){return this.lateUpdate}},{key:"internalPreload",get:function(){return this.__preload}},{key:"internalOnLoad",get:function(){return this.onLoad}},{key:"internalStart",get:function(){return this.start}},{key:"internalOnEnable",get:function(){return this.onEnable}},{key:"internalOnDisable",get:function(){return this.onDisable}},{key:"internalOnDestroy",get:function(){return this.onDestroy}}]),t}(Pn),Qv.EventHandler=ey,Qv._executionOrder=0,Qv._requireComponent=null,Qv.system=null,I((Xv=Qv).prototype,"__scriptAsset",[Wv],Object.getOwnPropertyDescriptor(Xv.prototype,"__scriptAsset"),Xv.prototype),qv=El(Xv.prototype,"node",[Yl],(function(){return null})),Yv=El(Xv.prototype,"_enabled",[Yl],(function(){return!0})),Kv=El(Xv.prototype,"__prefab",[Yl],(function(){return null})),jv=Xv))||jv));Me(ny,"_registerEditorProps",(function(e,t){var n=t.requireComponent;n&&(Array.isArray(n)&&(n=n.filter(Boolean)),e._requireComponent=n);var i=t.executionOrder;i&&"number"==typeof i&&(e._executionOrder=i)})),u.Component=ny;var iy=e("MissingScript",Fl("cc.MissingScript")((Jv=function(e){function t(){var t;return(t=e.call(this)||this)._$erialized=$v&&$v(),t}return p(t,e),t.safeFindClass=function(e){var t=ct(e);if(t)return t;o.deserialize.reportMissingClass(e)},t.prototype.onLoad=function(){K(4600,this.node.name)},t}(ny),$v=El(Jv.prototype,"_$erialized",[Yl,Ql],(function(){return null})),Zv=Jv))||Zv);o._MissingScript=iy;try{var ry=iy.__values__;0!==ry.length&&"_$erialized"===ry[ry.length-1]||(Z(16338),Z(16339,ry.join(", ")))}catch(hc){Z(16340,""+hc)}var sy=function(){function e(e,t){this._document=e,this._chunks=t}return f(e,[{key:"document",get:function(){return this._document}},{key:"chunks",get:function(){return this._chunks}}]),e}();function ay(e){var t=e;return{chunks:t.chunks,document:t.document}}function oy(e){if(e.length<16)throw new cy(te(13102));var t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(1313817411!==t.getUint32(0,!0))throw new cy(te(13100));var n=t.getUint32(4,!0);if(1!==n)throw new cy(te(13101,n));if(t.getUint32(8,!0)!==t.byteLength)throw new cy(te(13102));var i=12,r=t.getUint32(i,!0);i+=4;var s=new Uint8Array(t.buffer,i+t.byteOffset,r);i+=r;var a,o=uy(s);try{a=JSON.parse(o)}catch(e){throw new cy(e)}for(var u=[];i0&&(e.chunks.length,this._mainBinChunk=e.chunks[0])):t=e,this._serializedData=t,this._context={fromCCON:n};var i=Array.isArray(t)?t[0]:t;return this.deserializedData=this._deserializeObject(i,0),this._serializedData=void 0,this._mainBinChunk=void 0,this._context=void 0,this.deserializedData},t._deserializeObject=function(e,t,n,i){switch(e.__type__){case"TypedArray":return this._deserializeTypedArrayView(e);case"TypedArrayRef":return this._deserializeTypedArrayViewRef(e);default:return e.__type__?this._deserializeTypeTaggedObject(e,t,n,i):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,n=e.length,i=e.ctor;return new globalThis[i](this._mainBinChunk.buffer,this._mainBinChunk.byteOffset+t,n)},t._deserializeArray=function(e){for(var t,n=new Array(e.length),i=0;i=0&&(r.deserializedList[t]=n),n}(a);return this._deserializeInto(e,o,a),o},t._deserializeInto=function(e,t,n,i){void 0===i&&(i=!1),i||!t[Lf]?t._deserialize?t._deserialize(e.content,this):o.Class._isCCClass(n)?this._deserializeFireClass(t,e,n):this._deserializeFastDefinedObject(t,e,n):this._runCustomizedDeserialize(e,t,n)},t._runCustomizedDeserialize=function(e,t,n){var i=this,r={readProperty:function(t){var n=e[t];return"object"==typeof n&&n?i._deserializeObjectField(n):n},readThis:function(){i._deserializeInto(e,t,n,!0)},readSuper:function(){var r=Ze(n);r&&i._deserializeInto(e,t,r)}};t[Lf](r,this._context)},t._deserializeFireClass=function(e,t,n){var i;if(n.hasOwnProperty("__deserialize__"))i=n.__deserialize__;else{i=ly(0,n);try{if(n===iy){var r=n.__values__;0!==r.length&&"_$erialized"===r[r.length-1]||(Z(16341),Z(16342,r.join(", ")));var s=i;i=function(e,t,n,i){s(e,t,n,i),t._$erialized||Z(16343,JSON.stringify(n))}}}catch(e){Z(16344,""+e)}Me(n,"__deserialize__",i,!0)}i(this,e,t,n)},t._deserializeAndAssignField=function(e,t,n){var i=t.__id__;if("number"==typeof i){var r=this.deserializedList[i];if(r)e[n]=r;else{var s,a=this._serializedData[i];e[n]=this._deserializeObject(a,i,void 0,n),null==(s=this._onDereferenced)||s.call(this,this.deserializedList,i,e,n)}}else{var o=t.__uuid__;if(o){var u=t.__expectedType__;this.result.push(e,n,o,u)}else e[n]=this._deserializeObject(t,-1)}return!1},t._deserializeObjectField=function(e){var t=e.__id__;if("number"==typeof t){var n=this.deserializedList[t];if(n)return n;var i=this._serializedData[t];return this._deserializeObject(i,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 n in t)if(t.hasOwnProperty(n)){var i=t[n];"object"!=typeof i?"__type__"!==n&&(e[n]=i):i?this._deserializeAndAssignField(e,i,n)&&(e[n]=null):e[n]=null}},t._deserializeFastDefinedObject=function(e,t,n){if(n===o.Vec2)return e.x=t.x||0,void(e.y=t.y||0);if(n===o.Vec3)return e.x=t.x||0,e.y=t.y||0,void(e.z=t.z||0);if(n!==o.Color){if(n===o.Size)return e.width=t.width||0,void(e.height=t.height||0);for(var i=En.Attr.getClassAttrs(n),r=n.__values__,s=0;s=0?a[n[u]]=o:a[~u]=o}for(;r=0?c[n[l]]=h:c[~l]=h}}function Py(e,t){for(var n=e[4][t[Oy]],i=n[Cy],r=new(0,i[Iy]),s=i[Ay],a=i[Ry],o=n[n.length-1],u=Cy+1;u=0?t[n]=e[5][i]:e[7][3*~i]=t}function Ly(e){return function(t,n,i,r){for(var s=0;s=0){var l=o[c];t[a]=My(e,l,h)}else(0,zy[c=~c])(e,t,a,h)}return r}function Gy(e,t,n){return e||n(t),Object}function Vy(e,t,n,i,r,s,a){var o=e(t);if(!o){if(r)return void(n[i]=function(t,n,i){return function(){var r=e(i)||Gy(s,i,a);return t[n]=r,new r}}(n,i,t));o=Gy(s,t,a)}n[i]=o}function Hy(e,t,n,i){for(var r=n||ct,s=e[3],a=0;a=0?n[c]:~c,s[o]=c);var h=a[o];"number"==typeof h&&(a[o]=i[h])}}function Xy(e){if(Array.isArray(e)){var t=e[0];return"number"==typeof t||t instanceof Ky}return!1}function qy(e,t,n){var i;t.init(e),null!==(i=n)&&void 0!==i||(n={});var r=e[0],s=!1;if("object"==typeof r&&(s=r.preprocessed,r=r.version),r>=1,i++;return i}function ub(e){return e&&!(e&e-1)}function cb(e,t,n){return!(6===e.gfxAPI)||ub(t)&&ub(n)}var hb,lb,fb,db,pb,_b=Fl("cc.SimpleTexture")(rb=function(e){function t(t){var n;return(n=e.call(this,t)||this)._gfxTexture=null,n._gfxTextureView=null,n._mipmapLevel=1,n._textureWidth=0,n._textureHeight=0,n._baseLevel=0,n._maxLevel=1e3,n}p(t,e);var n=t.prototype;return n.getGFXTexture=function(){return this._gfxTextureView},n.destroy=function(){return this._tryDestroyTextureView(),this._tryDestroyTexture(),e.prototype.destroy.call(this)},n.updateImage=function(){this.updateMipmaps(0)},n.updateMipmaps=function(){},n.uploadData=function(e,t,n){if(void 0===t&&(t=0),void 0===n&&(n=0),this._gfxTexture&&!(this._mipmapLevel<=t)){var i=this._getGFXDevice();if(i){var r=ab[0];r.texExtent.width=this._textureWidth>>t,r.texExtent.height=this._textureHeight>>t,r.texSubres.mipLevel=t,r.texSubres.baseArrayLayer=n,ArrayBuffer.isView(e)?i.copyBuffersToTexture([e],this._gfxTexture,ab):i.copyTexImagesToTexture([e],this._gfxTexture,ab)}}},n._assignImage=function(e,t,n){var i=e.data;if(i&&(this.uploadData(i,t,n),this._checkTextureLoaded(),Rt.CLEANUP_IMAGE_CACHE)){var r=sb.getDeps(this._uuid),s=r.indexOf(e._uuid);-1!==s&&(pe(r,s),e.decRef())}},n._checkTextureLoaded=function(){this._textureReady()},n._textureReady=function(){this.loaded=!0,this.emit("load")},n._setMipmapLevel=function(e){this._mipmapLevel=e<1?1:e},n._setMipRange=function(e,t){this._baseLevel=e<1?0:e,this._maxLevel=t<1?0:t},n.setMipRange=function(e,t){$(e<=t,3124),this._setMipRange(e,t);var n=this._getGFXDevice();if(n){var i=this._createTextureView(n);this._tryDestroyTextureView(),this._gfxTextureView=i}},n._getGfxTextureCreateInfo=function(){return null},n._getGfxTextureViewCreateInfo=function(){return null},n._tryReset=function(){if(this._tryDestroyTextureView(),this._tryDestroyTexture(),0!==this._mipmapLevel){var e=this._getGFXDevice();e&&(this._createTexture(e),this._gfxTextureView=this._createTextureView(e))}},n.isUsingOfflineMipmaps=function(){return!1},n._createTexture=function(e){if(0!==this._width&&0!==this._height){var t=0;0!==this._mipFilter&&cb(e,this._width,this._height)&&(this._mipmapLevel=ob(this._width,this._height),this.isUsingOfflineMipmaps()||this.isCompressed||(t=1));var n=this._getGfxTextureCreateInfo({usage:22,format:this._getGFXFormat(),levelCount:this._mipmapLevel,flags:t});if(n){var i=e.createTexture(n);this._textureWidth=n.width,this._textureHeight=n.height,this._gfxTexture=i}}},n._createTextureView=function(e){if(!this._gfxTexture)return null;var t=this._maxLevel0){var n=this._generatedMipmaps[0];this.reset({width:n.width,height:n.height,format:n.format,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel}),this._generatedMipmaps.forEach((function(e,n){t._assignImage(e,n)}))}else this.reset({width:0,height:0,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})},n.initialize=function(){this.mipmaps=this._mipmaps},n.onLoaded=function(){this.initialize()},n.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 n=void 0===e.baseLevel?0:e.baseLevel,i=void 0===e.maxLevel?1e3:e.maxLevel;this._setMipRange(n,i),this._tryReset()},n.create=function(e,t,n,i,r,s){void 0===n&&(n=35),void 0===i&&(i=1),void 0===r&&(r=0),void 0===s&&(s=1e3),this.reset({width:e,height:t,format:n,mipmapLevel:i,baseLevel:r,maxLevel:s})},n.toString=function(){return 0!==this._mipmaps.length?this._mipmaps[0].url:""},n.updateMipmaps=function(e,t){if(void 0===e&&(e=0),void 0===t&&(t=void 0),!(e>=this._generatedMipmaps.length))for(var n=Math.min(void 0===t?this._generatedMipmaps.length:t,this._generatedMipmaps.length-e),i=0;i"},n.releaseTexture=function(){this.destroy()},n._serialize=function(){return null},n._deserialize=function(t,n){var i=t;e.prototype._deserialize.call(this,i.base,n),this._mipmaps=new Array(i.mipmaps.length);for(var r=0;r1)for(var i=0;i0){var n=this._generatedMipmaps[0].front;this.reset({width:n.width,height:n.height,format:n.format,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel}),this._generatedMipmaps.forEach((function(e,n){Eb(e,(function(e,i){t._assignImage(e,n,i)}))}))}else this.reset({width:0,height:0,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})},n.isUsingOfflineMipmaps=function(){return 2===this._mipmapMode},t.fromTexture2DArray=function(e,n){for(var i=[],r=e.length/6,s=0;s=this._generatedMipmaps.length))for(var i=Math.min(void 0===t?this._generatedMipmaps.length:t,this._generatedMipmaps.length-e),r=function(){var t=e+s;Eb(n._generatedMipmaps[t],(function(e,i){n._assignImage(e,t,i)}))},s=0;s1&&e.forEach((function(e){var n={front:e.front.extractMipmap0(),back:e.back.extractMipmap0(),left:e.left.extractMipmap0(),right:e.right.extractMipmap0(),top:e.top.extractMipmap0(),bottom:e.bottom.extractMipmap0()};t.push(n)}));this._setMipmapParams(t)}},{key:"mipmapAtlas",get:function(){return this._mipmapAtlas},set:function(e){var t=this;if(this._mipmapAtlas=e,this._mipmapAtlas){var n=this._mipmapAtlas.atlas.front;if(n.data){var i=this._mipmapAtlas.atlas,r=this._mipmapAtlas.layout,s=r[0],a=Object.assign(h.document.createElement("canvas"),{width:n.width,height:n.height}).getContext("2d");this.reset({width:s.width,height:s.height,format:n.format,mipmapLevel:r.length});for(var o=function(){var e=r[u];Eb(i,(function(i,r){a.clearRect(0,0,n.width,n.height);var s=i.data;a.drawImage(s,0,0);var o=a.getImageData(e.left,e.top,e.width,e.height),u=new Av({_data:o.data,_compressed:i.isCompressed,width:o.width,height:o.height,format:i.format});t._assignImage(u,e.level,r)}))},u=0;ut.length)||47===e.charCodeAt(t.length)},Ab=function(e){var t=e.uuids,n=e.paths,i=e.types,r=e.deps,s=e.paths=Object.create(null);if(!1===e.debug){for(var a=0,o=t.length;a0&&Mb(e)>0)){Mg.remove(n);for(var i=sb.getDeps(n),r=0,s=i.length;rthis._maxInterval?this._maxInterval:t;e-this._lastDate>1e3*n&&(this._totalNumThisPeriod=0,this._lastDate=e)},e._handleQueue=function(e,t){for(this._checkNextPeriod=!1,this._updateTime();this._queue.length>0&&this._totalNum0&&(zt(this._handleQueue.bind(this),e,t),this._checkNextPeriod=!0)},f(t,[{key:"remoteServerAddress",get:function(){return this._remoteServerAddress}},{key:"handlers",get:function(){return this._downloaders}}],[{key:"instance",get:function(){return t._instance||(t._instance=new t),t._instance}}]),t}();fw._instance=void 0;var dw,pw,_w,mw,gw,vw,yw=fw.instance,bw=fw.instance,ww=e("JsonAsset",Fl("cc.JsonAsset")((pw=function(e){function t(t){var n;return(n=e.call(this,t)||this).json=_w&&_w(),n}return p(t,e),t}(hv),_w=El(pw.prototype,"json",[Yl],(function(){return null})),dw=pw))||dw);o.JsonAsset=ww;var Tw,Sw,xw=e("TextAsset",Fl("cc.TextAsset")((gw=function(e){function t(t){var n;return(n=e.call(this,t)||this).text=vw&&vw(),n}return p(t,e),t.prototype.toString=function(){return this.text},t}(hv),vw=El(gw.prototype,"text",[Yl],(function(){return""})),mw=gw))||mw);o.TextAsset=xw;var Ew=e("BufferAsset",Fl("cc.BufferAsset")((Sw=function(e){function t(t){var n;return(n=e.call(this,t)||this)._buffer=null,n}p(t,e);var n=t.prototype;return n.buffer=function(){return this._buffer,this._buffer},n.validate=function(){return!!this._buffer},f(t,[{key:"_nativeAsset",get:function(){return this._buffer},set:function(e){e instanceof ArrayBuffer?this._buffer=e:this._buffer=e.buffer}}]),t}(hv),I(Sw.prototype,"_nativeAsset",[Rf],Object.getOwnPropertyDescriptor(Sw.prototype,"_nativeAsset"),Sw.prototype),Tw=Sw))||Tw);function Iw(e,t,n,i){var r=null,s=null;try{(r=new Av)._nativeUrl=e,r._nativeAsset=t}catch(e){s=e}i(s,r)}function Aw(e,t,n,i){var r=new ww;r.json=t,i(null,r)}function Rw(e,t,n,i){var r=new xw;r.text=t,i(null,r)}function Cw(e,t,n,i){var r=new Ew;r._nativeUrl=e,r._nativeAsset=t,i(null,r)}function Ow(e,t,n,i){var r=new hv;r._nativeUrl=e,r._nativeAsset=t,i(null,r)}function Bw(e,n,i,r){var s=Ng.get(n.name);s||(s="resources"===n.name?Zb:new Qb,n.base=n.base||e+"/",s.init(n)),t.import("virtual:///prerequisite-imports/"+s.name).then((function(){r(null,s)})).catch(r)}o.BufferAsset=Ew;var Dw=function(){function e(){this._creating=new Dg,this._producers={".png":Iw,".jpg":Iw,".bmp":Iw,".jpeg":Iw,".gif":Iw,".ico":Iw,".tiff":Iw,".webp":Iw,".image":Iw,".pvr":Iw,".pkm":Iw,".astc":Iw,".txt":Rw,".xml":Rw,".vsh":Rw,".fsh":Rw,".atlas":Rw,".tmx":Rw,".tsx":Rw,".fnt":Rw,".json":Aw,".ExportJson":Aw,".binary":Cw,".bin":Cw,".dbbin":Cw,".skel":Cw,bundle:Bw,default:Ow}}var t=e.prototype;return t.register=function(e,t){"object"==typeof e?Ke(this._producers,e):this._producers[e]=t},t.create=function(e,t,n,i,r){var s=this,a=this._producers[n]||this._producers.default,o=Mg.get(e);if(i.reloadAsset||!o){var u=this._creating.get(e);u?u.push(r):(this._creating.add(e,[r]),a(e,t,i,(function(t,n){!t&&n instanceof hv&&(n._uuid=e,Vb(e,n,i.cacheAsset));for(var r=s._creating.remove(e),a=0,o=r.length;a0){var a=Hg.create({input:s,progress:r,options:i,onProgress:e.onProgress,onError:Hg.prototype.recycle,onComplete:function(i){var r;i||((r=e.output).push.apply(r,a.output),a.recycle()),n&&Nw(e),t(i)}});zg.async(a)}else n&&Nw(e),t()}))}function Nw(e){for(var t=e.output,n=0,i=t.length;n0&&(this.downloader.maxConcurrency=r),this._files.clear(),this._parsed.clear(),this._releaseManager.init(),this.assets.clear(),this.bundles.clear(),this.packManager.init(),this.downloader.init(t,n,i),this.parser.init(),this.dependUtil.init();var s=e.importBase||Zw(Jw,"importBase")||"";s&&s.endsWith("/")&&(s=s.substring(0,s.length-1));var a=e.nativeBase||Zw(Jw,"nativeBase")||"";a&&a.endsWith("/")&&(a=a.substring(0,a.length-1)),this.generalImportBase=s,this.generalNativeBase=a,this._projectBundles=Zw(Jw,"projectBundles")||[];var o=Zw(Jw,"assetsOverrides")||{};for(var u in o)this.assetsOverrideMap.set(u,o[u])},t.getBundle=function(e){return Ng.get(e)||null},t.removeBundle=function(e){e._destroy(),Ng.remove(e.name)},t.loadAny=function(e,t,n,i){var r=Xb(t,n,i),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"default",e=Array.isArray(e)?e.slice():e;var u=Hg.create({input:e,onProgress:a,onComplete:Kb(o),options:s});kg.async(u)},t.preloadAny=function(e,t,n,i){var r=Xb(t,n,i),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"preload",e=Array.isArray(e)?e.slice():e;var u=Hg.create({input:e,onProgress:a,onComplete:Kb(o),options:s});zg.async(u)},t.loadRemote=function(e,t,n){var i=Xb(t,void 0,n),r=i.options,s=i.onComplete;r.reloadAsset||!this.assets.has(e)?(r.__isNative__=!0,r.preset=r.preset||"remote",this.loadAny({url:e},r,null,(function(t,n){t?(k(t.message,t.stack),s&&s(t,n)):Pw.create(e,n,r.ext||ai(e),r,(function(e,t){s&&s(e,t)}))}))):Kb(s)(null,this.assets.get(e))},t.loadBundle=function(e,t,n){var i=Xb(t,void 0,n),r=i.options,s=i.onComplete,a=ui(e);this.bundles.has(a)?Kb(s)(null,this.getBundle(a)):(r.preset=r.preset||"bundle",r.ext="bundle",r.__isNative__=!0,this.loadAny({url:e},r,null,(function(t,n){t?(k(t.message,t.stack),s&&s(t,n)):Pw.create(e,n,"bundle",r,(function(e,t){s&&s(e,t)}))})))},t.releaseAsset=function(e){Lb.tryRelease(e,!0)},t.releaseUnusedAssets=function(){Mg.forEach((function(e){Lb.tryRelease(e)}))},t.releaseAll=function(){Mg.forEach((function(e){Lb.tryRelease(e,!0)}))},t.loadWithJson=function(){throw new Error("Only valid in Editor")},f(e,[{key:"files",get:function(){return this._files}},{key:"main",get:function(){return Ng.get("main")||null}},{key:"resources",get:function(){return Ng.get("resources")||null}}],[{key:"instance",get:function(){return this._instance||(this._instance=new e),this._instance}}]),e}());eT._instance=void 0,eT.Pipeline=Pg,eT.Task=Hg,eT.Cache=Dg,eT.RequestItem=Xw,eT.Bundle=Qb,eT.BuiltinBundleName={INTERNAL:"internal",RESOURCES:"resources",MAIN:"main",START_SCENE:"start-scene"},eT.CacheManager=function(){this.cacheDir=void 0,this.cacheEnabled=void 0,this.autoClear=void 0,this.cacheInterval=void 0,this.deleteInterval=void 0,this.cachedFiles=void 0},eT.Downloader=fw,eT.Parser=Uw,eT.DependUtil=ib;var tT=e("assetManager",o.assetManager=eT.instance);o.AssetManager=eT;var nT,iT,rT,sT=e("BuiltinResMgr",function(){function e(){this._resources={},this._materialsToBeCompiled=[]}var t=e.prototype;return t.init=function(){for(var e=this._resources,t=new Uint8Array(16),n=new Uint8Array(16),i=new Uint8Array(16),r=new Uint8Array(16),s=new Uint8Array(16),a=0,u=0;u<4;u++)t[a]=0,t[a+1]=0,t[a+2]=0,t[a+3]=255,n[a]=0,n[a+1]=0,n[a+2]=0,n[a+3]=0,i[a]=119,i[a+1]=119,i[a+2]=119,i[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 c=new Uint8Array(1024);a=0;for(var h=0;h<256;h++)c[a]=221,c[a+1]=221,c[a+2]=221,c[a+3]=255,a+=4;a=0;for(var l=0;l<8;l++){for(var f=0;f<8;f++)c[a]=85,c[a+1]=85,c[a+2]=85,c[a+3]=255,a+=4;a+=32}a+=32;for(var d=0;d<8;d++){for(var p=0;p<8;p++)c[a]=85,c[a+1]=85,c[a+2]=85,c[a+3]=255,a+=4;a+=32}var _={width:2,height:2,_data:t,_compressed:!1,format:35},m={width:2,height:2,_data:n,_compressed:!1,format:35},g={width:2,height:2,_data:i,_compressed:!1,format:35},v={width:2,height:2,_data:r,_compressed:!1,format:35},y={width:2,height:2,_data:s,_compressed:!1,format:35},b={width:16,height:16,_data:c,_compressed:!1,format:35},w=new Av(_),T=new Sb;T._uuid="black-texture",T.image=w,e[T._uuid]=T;var S=new Av(m),x=new Sb;x._uuid="empty-texture",x.image=S,e[x._uuid]=x;var E=new xb;E._uuid="black-cube-texture",E.setMipFilter(1),E.image={front:new Av(_),back:new Av(_),left:new Av(_),right:new Av(_),top:new Av(_),bottom:new Av(_)},e[E._uuid]=E;var I=new Av(g),A=new Sb;A._uuid="grey-texture",A.image=I,e[A._uuid]=A;var R=new xb;R._uuid="grey-cube-texture",R.setMipFilter(1),R.image={front:new Av(g),back:new Av(g),left:new Av(g),right:new Av(g),top:new Av(g),bottom:new Av(g)},e[R._uuid]=R;var C=new Av(v),O=new Sb;O._uuid="white-texture",O.image=C,e[O._uuid]=O;var B=new xb;B._uuid="white-cube-texture",B.setMipFilter(1),B.image={front:new Av(v),back:new Av(v),left:new Av(v),right:new Av(v),top:new Av(v),bottom:new Av(v)},e[B._uuid]=B;var D=new Av(y),P=new Sb;P._uuid="normal-texture",P.image=D,e[P._uuid]=P;var M=new Av(b),F=new Sb;F._uuid="default-texture",F.image=M,e[F._uuid]=F;var L=new xb;if(L.setMipFilter(1),L._uuid="default-cube-texture",L.image={front:new Av(b),back:new Av(b),left:new Av(b),right:new Av(b),top:new Av(b),bottom:new Av(b)},e[L._uuid]=L,o.SpriteFrame){var N=new o.SpriteFrame,k=w,z=new Sb;z.image=k,N.texture=z,N._uuid="default-spriteframe",e[N._uuid]=N}},t.addAsset=function(e,t){this._resources[e]=t},t.get=function(e){return this._resources[e]},t.loadBuiltinAssets=function(){var e=this,t=At.querySettings("engine","builtinAssets");if(!t)return Promise.resolve();var n=this._resources;return new Promise((function(i,r){tT.loadBundle("internal",(function(s){s?r(s):tT.loadAny(t,(function(t,s){t?r(t):(s.forEach((function(t){n[t.name]=t,Lb.addIgnoredAsset(t),t instanceof o.Material&&e._materialsToBeCompiled.push(t)})),i())}))}))}))},t.compileBuiltinMaterial=function(){for(var e=0;e8?Z(12004,8):(this._passes=e,this._flushPassInfo(),this._descriptorSet&&(this._descriptorSet.destroy(),oT.layout=e[0].localSetLayout,this._descriptorSet=this._device.createDescriptorSet(oT)))}},{key:"shaders",get:function(){return this._shaders}},{key:"subMesh",get:function(){return this._subMesh},set:function(e){this._inputAssembler.destroy(),this._inputAssembler=this._device.createInputAssembler(e.iaInfo),this._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:"instancedAttributeBlock",get:function(){return this._instancedAttributeBlock}},{key:"instancedWorldMatrixIndex",get:function(){return this._instancedWorldMatrixIndex},set:function(e){this._instancedWorldMatrixIndex=e}},{key:"instancedSHIndex",get:function(){return this._instancedSHIndex},set:function(e){this._instancedSHIndex=e}},{key:"useReflectionProbeType",get:function(){return this._useReflectionProbeType},set:function(e){this._useReflectionProbeType=e}}]),e}(),cT=4227858432,hT=66060288,lT=1044480,fT=function(e,t,n,i){return void 0===i&&(i=0),t<<26&cT|e<<20&hT|n<<12&lT|4095&i},dT=function(e){return(e&cT)>>>26},pT=function(e){return(e&hT)>>>20},_T=function(e){return(e&lT)>>>12},mT=function(e){return 4095&e},gT=function(e,t){return 67108863&e|t<<26&cT},vT=((nT={})[0]=function(e,t,n){return void 0===n&&(n=0),K(12010,n)},nT[5]=function(e,t,n){return void 0===n&&(n=0),e[n]},nT[6]=function(e,t,n){return void 0===n&&(n=0),Xu.fromArray(t,e,n)},nT[7]=function(e,t,n){return void 0===n&&(n=0),Fo.fromArray(t,e,n)},nT[8]=function(e,t,n){return void 0===n&&(n=0),go.fromArray(t,e,n)},nT[13]=function(e,t,n){return void 0===n&&(n=0),e[n]},nT[14]=function(e,t,n){return void 0===n&&(n=0),Xu.fromArray(t,e,n)},nT[15]=function(e,t,n){return void 0===n&&(n=0),Fo.fromArray(t,e,n)},nT[16]=function(e,t,n){return void 0===n&&(n=0),go.fromArray(t,e,n)},nT[21]=function(e,t,n){return void 0===n&&(n=0),Zo.fromArray(t,e,n)},nT[25]=function(e,t,n){return void 0===n&&(n=0),Ru.fromArray(t,e,n)},nT),yT=((iT={})[0]=function(e,t,n){return void 0===n&&(n=0),K(12010,n)},iT[5]=function(e,t,n){return void 0===n&&(n=0),e[n]=t},iT[6]=function(e,t,n){return void 0===n&&(n=0),Xu.toArray(e,t,n)},iT[7]=function(e,t,n){return void 0===n&&(n=0),Fo.toArray(e,t,n)},iT[8]=function(e,t,n){return void 0===n&&(n=0),go.toArray(e,t,n)},iT[13]=function(e,t,n){return void 0===n&&(n=0),e[n]=t},iT[14]=function(e,t,n){return void 0===n&&(n=0),Xu.toArray(e,t,n)},iT[15]=function(e,t,n){return void 0===n&&(n=0),Fo.toArray(e,t,n)},iT[16]=function(e,t,n){return void 0===n&&(n=0),go.toArray(e,t,n)},iT[21]=function(e,t,n){return void 0===n&&(n=0),Zo.toArray(e,t,n)},iT[25]=function(e,t,n){return void 0===n&&(n=0),Ru.toArray(e,t,n)},iT),bT=((rT={})[5]=function(e){return"number"==typeof e},rT[13]=function(e){return"number"==typeof e},rT[6]=function(e){return!!(e instanceof Xu)},rT[14]=function(e){return!!(e instanceof Xu)},rT[7]=function(e){return!!(e instanceof Fo)},rT[15]=function(e){return!!(e instanceof Fo)},rT[8]=function(e){return!!(e instanceof go)},rT[16]=function(e){return!!(e instanceof go||e instanceof Wo||e instanceof fu)},rT[21]=function(e){return!!(e instanceof Zo)},rT[25]=function(e){return!!(e instanceof Ru)},rT),wT=[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 TT(e){switch(e){case 1:case 5:case 9:case 13:return wT[0];case 2:case 6:case 10:case 14:return wT[1];case 4:case 8:case 12:case 16:return wT[2];case 25:return wT[3];case 28:return"default-texture";case 31:return"default-cube-texture";case 29:return"default-array-texture";case 30:return"default-3d-texture"}return wT[0]}function ST(e){switch(e){case 28:return"-texture";case 31:return"-cube-texture";case 29:return"-array-texture";case 30:return"-3d-texture";default:return"-unknown"}}function xT(e,t){for(var n=Object.entries(t),i=!1,r=0;r>2)*o.count}for(var u=0;u31&&(e.uber=!0),e.constantMacros="",e.builtins.statistics)e.constantMacros+="#define "+r+" "+e.builtins.statistics[r]+"\n"}function LT(e){var t=Object.keys(e).reduce((function(t,n){return t.reduce((function(t,i){for(var r=e[n],s=0;s0&&this.shaders.length>0},t}(hv),YT._effects={},YT._layoutValid=!0,WT=El((HT=YT).prototype,"techniques",[Yl],(function(){return[]})),jT=El(HT.prototype,"shaders",[Yl],(function(){return[]})),XT=El(HT.prototype,"combinations",[Yl],(function(){return[]})),qT=El(HT.prototype,"hideInEditor",[Yl,Ql],(function(){return!1})),VT=HT))||VT);o.EffectAsset=ZT;var JT,$T,eS=e("getPhaseID",(JT=new Map,$T=0,function(e){return"number"==typeof e?e:(JT.has(e)||(JT.set(e,1<<$T),$T++),JT.get(e))})),tS=e("InstancedBuffer",function(){function e(e){this.instances=[],this.hasPendingModels=!1,this.dynamicOffsets=[],this._device=e.device,this.pass=e}var t=e.prototype;return t.destroy=function(){this.instances.forEach((function(e){e.vb.destroy(),e.ia.destroy()})),this.instances.length=0},t.merge=function(e,t,n){void 0===n&&(n=null);var i=e.instancedAttributeBlock,r=i.buffer.length;if(r){var s=e.inputAssembler,a=e.descriptorSet,o=a.getTexture(Ym),u=a.getTexture(tg),c=a.getTexture(sg),h=e.useReflectionProbeType,l=n;l||(l=e.shaders[t]);for(var f=e.descriptorSet,d=0;d=1024)&&m.lightingMap.objectID===o.objectID&&m.useReflectionProbeType===h&&m.reflectionProbeCubemap.objectID===u.objectID&&m.reflectionProbePlanarMap.objectID===c.objectID&&m.stride===r){if(m.count>=m.capacity){m.capacity<<=1;var g=m.stride*m.capacity,v=m.data;m.data=new Uint8Array(g),m.data.set(v),m.vb.resize(g)}return m.shader=l,m.descriptorSet=f,m.data.set(i.buffer,m.stride*m.count++),void(this.hasPendingModels=!0)}}for(var y=this._device.createBuffer(new Cr(10,3,32*r,r)),b=new Uint8Array(32*r),w=s.vertexBuffers.slice(),T=s.attributes.slice(),S=s.indexBuffer,x=0;x>2,s=this._getBlockView(i,n),a=mT(e),o=0;o>2)*s,h=0;h+u.length<=c;h+=u.length)a.set(u,r+h);this._rootBufferDirty=!0}},t.resetTexture=function(e,t){var n=this.getHandle(e);if(n){var i,r=dT(n),s=pT(n),a=this._properties[e],o=a&&a.value,u=(i="string"==typeof o?aT.get(""+o+ST(r)):o||aT.get(TT(r)))&&i.getGFXTexture(),c=a&&void 0!==a.samplerHash?na.unpackFromHash(a.samplerHash):i&&i.getSamplerInfo(),h=this._device.getSampler(c);this._descriptorSet.bindSampler(s,h,t||0),this._descriptorSet.bindTexture(s,u,t||0)}},t.resetUBOs=function(){for(var e=0;e>2)*r.count,c=0;c+o.length<=u;c+=o.length)s.set(o,n+c);n+=u}this._rootBufferDirty=!0},t.resetTextures=function(){var e=this;if(o.rendering)this._shaderInfo.descriptors[1].samplerTextures.forEach((function(t){for(var n=0;n=0;--t){var n=e[t];if(n.window.swapchain)return void(wS=n)}wS=null}function SS(e,t,n,i,r){if(!gg()&&i&&i.enabled&&r===wS){var s=i.subModels[0],a=s.inputAssembler,o=s.passes,u=s.shaders,c=s.descriptorSet;cS.width=hS.width=r.window.width,cS.height=hS.height=r.window.height;var h=uS.getOrCreatePipelineState(e,o[0],u[0],t,a);n.setViewport(cS),n.setScissor(hS),n.bindPipelineState(h),n.bindDescriptorSet(1,o[0].descriptorSet),n.bindDescriptorSet(2,c),n.bindInputAssembler(a),n.draw(a)}}var xS=new go,ES=e("Material",(fS=Fl("cc.Material"),dS=yf(ZT),fS((_S=function(e){function t(t){var n;return(n=e.call(this,t)||this)._effectAsset=mS&&mS(),n._techIdx=gS&&gS(),n._defines=vS&&vS(),n._states=yS&&yS(),n._props=bS&&bS(),n._passes=[],n._hash=0,n}p(t,e),t.getHash=function(e){for(var t,n=0,i=S(e.passes);!(t=i()).done;)n^=t.value.hash;return n};var n=t.prototype;return n.initialize=function(e){this._passes.length?K(12005):(this._defines||(this._defines=[]),this._states||(this._states=[]),this._props||(this._props=[]),this._fillInfo(e),this._update())},n.reset=function(e){this.initialize(e)},n.destroy=function(){return this._doDestroy(),e.prototype.destroy.call(this)},n.recompileShaders=function(){K(16370,this.name)},n.overridePipelineStates=function(){K(16371,this.name)},n.onLoaded=function(){this._update()},n.resetUniforms=function(e){void 0===e&&(e=!0),this._props.length=this._passes.length;for(var t=0;t=this._passes.length&&K(16372,n);var u=this._passes[n];this._uploadProperty(u,e,t)&&(this._props[u.propertyIndex][e]=t,i=!0)}i||K(16373,e)},n.getProperty=function(e,t){if(void 0===t)for(var n=this._props,i=n.length,r=0;r=this._passes.length)return K(16372,t),null;var a=this._props[this._passes[t].propertyIndex];if(e in a)return a[e]}return null},n.copy=function(e,t){this._techIdx=e._techIdx,this._props.length=e._props.length;for(var n=0;n0},f(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}(hv),mS=El(_S.prototype,"_effectAsset",[dS],(function(){return null})),gS=El(_S.prototype,"_techIdx",[Yl],(function(){return 0})),vS=El(_S.prototype,"_defines",[Yl],(function(){return[]})),yS=El(_S.prototype,"_states",[Yl],(function(){return[]})),bS=El(_S.prototype,"_props",[Yl],(function(){return[]})),pS=_S))||pS));o.Material=ES;var IS=yt({Low_256x256:256,Medium_512x512:512,High_1024x1024:1024,Ultra_2048x2048:2048}),AS=yt({Planar:0,ShadowMap:1}),RS=yt({HARD:0,SOFT:1,SOFT_2X:2,SOFT_4X:3}),CS=yt({LEVEL_1:1,LEVEL_2:2,LEVEL_3:3,LEVEL_4:4}),OS=yt({NONE:1,RemoveDuplicates:2,DisableRotationFix:3}),BS=AS.ShadowMap+1,DS=function(){function e(){this.fixedSphere=new Ac(0,0,0,.01),this.maxReceived=4,this._matLight=new Ru,this._material=null,this._instancingMaterial=null,this._enabled=!1,this._type=BS,this._distance=0,this._planeBias=1,this._normal=new Fo(0,1,0),this._shadowColor=new Wo(0,0,0,76),this._size=new Xu(1024,1024),this._shadowMapDirty=!1}var t=e.prototype;return t.getPlanarShader=function(e){this._material||(this._material=new ES,this._material.initialize({effectName:"pipeline/planar-shadow"}));var t=this._material.passes;return t.length>0?t[0].getShaderVariant(e):null},t.initialize=function(e){this._enabled=e.enabled,this._type=this.enabled?e.type:BS,this.normal=e.planeDirection,this.distance=e.planeHeight,this.planeBias=e.planeBias,this.shadowColor=e.shadowColor,this.maxReceived=e.maxReceived,e.shadowMapSize!==this._size.x&&(this.size.set(e.shadowMapSize,e.shadowMapSize),this._shadowMapDirty=!0)},t.activate=function(){if(this._enabled)if(this.type===AS.Planar)this._updatePlanarInfo();else{var e=o.director.root;e.pipeline.macros.CC_SHADOW_TYPE=2,e.onGlobalPipelineStateChanged()}else{var t=o.director.root;t.pipeline.macros.CC_SHADOW_TYPE=0,t.onGlobalPipelineStateChanged()}},t._updatePlanarInfo=function(){this._material||(this._material=new ES,this._material.initialize({effectName:"pipeline/planar-shadow"}));var e=o.director.root;e.pipeline.macros.CC_SHADOW_TYPE=1,e.onGlobalPipelineStateChanged()},t.destroy=function(){this._material&&this._material.destroy(),this._instancingMaterial&&this._instancingMaterial.destroy(),this.fixedSphere.destroy()},f(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:BS,this.activate()}},{key:"normal",get:function(){return this._normal},set:function(e){Fo.copy(this._normal,e)}},{key:"distance",get:function(){return this._distance},set:function(e){this._distance=e}},{key:"planeBias",get:function(){return this._planeBias},set:function(e){this._planeBias=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}();function PS(){return o.director.root.pipeline.pipelineSceneData}DS.MAX_FAR=2e3,DS.COEFFICIENT_OF_EXPANSION=2*Math.sqrt(3),o.Shadows=DS;var MS=new Ru,FS=[{name:"CC_RECEIVE_SHADOW",value:!0}],LS=[{name:"CC_USE_LIGHTMAP",value:1}],NS=[{name:"CC_USE_LIGHTMAP",value:2}],kS=[{name:"CC_LIGHT_MAP_VERSION",value:2}],zS=[{name:"CC_USE_LIGHT_PROBE",value:!0}],US=new Lr(2,2,0,2,2,2),GS=new Lr(2,2,2,2,2,2),VS=function(){function e(){this.type=0,this.scene=null,this.isDynamicBatching=!1,this._worldBounds=null,this._modelBounds=null,this._subModels=[],this._node=null,this._transform=null,this._inited=!1,this._descriptorSetCount=1,this._updateStamp=-1,this._localDataUpdated=!0,this._localData=new Float32Array(56),this._localBuffer=null,this._localSHData=null,this._localSHBuffer=null,this._lightmap=null,this._lightmapUVParam=vo(),this._tetrahedronIndex=-1,this._lastWorldBoundCenter=Lo(1/0,1/0,1/0),this._useLightProbe=!1,this._worldBoundBuffer=null,this._receiveShadow=!1,this._castShadow=!1,this._receiveDirLight=!0,this._shadowBias=0,this._shadowNormalBias=0,this._reflectionProbeId=-1,this._reflectionProbeBlendId=-1,this._reflectionProbeBlendWeight=0,this._enabled=!0,this._visFlags=Y_.Enum.NONE,this._priority=0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=0,this._device=D_.gfxDevice}var t=e.prototype;return t.initialize=function(){this._inited||(this._receiveShadow=!0,this.castShadow=!1,this.enabled=!0,this.visFlags=Y_.Enum.NONE,this._inited=!0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=0)},t.destroy=function(){for(var e=this._subModels,t=0;t=0?u.updateInstancedWorldMatrix(s,c):a=!0}(a||r)&&this._localBuffer&&(Ru.toArray(this._localData,s,0),Ru.invert(MS,s),Ru.transpose(MS,MS),Ru.toArray(this._localData,MS,16),this._localBuffer.update(this._localData))}},t.invalidateLocalData=function(){this._localDataUpdated=!0},t.showTetrahedron=function(){return this.isLightProbeAvailable()},t.isLightProbeAvailable=function(){if(!this._useLightProbe)return!1;var e=PS().lightProbes;return!(!e||e.empty()||!this._worldBounds)},t.updateSHBuffer=function(){if(this._localSHData){for(var e=this._subModels,t=!1,n=0;n=0?i.updateInstancedSH(this._localSHData,r):t=!0}t&&this._localSHBuffer&&this._localSHBuffer.update(this._localSHData)}},t.clearSHUBOs=function(){if(this._localSHData){for(var e=0;e<28;e++)this._localSHData[e]=0;this.updateSHBuffer()}},t.updateSHUBOs=function(){if(this.isLightProbeAvailable()){var e=this._worldBounds.center;if(!e.equals(this._lastWorldBoundCenter,Ca)){var t=[],n=new go,i=o.director.root.pipeline.pipelineSceneData.lightProbes;if(this._lastWorldBoundCenter.set(e),this._tetrahedronIndex=i.data.getInterpolationWeights(e,this._tetrahedronIndex,n),i.data.getInterpolationSHCoefficients(this._tetrahedronIndex,n,t)&&this._localSHData){var r=o.internal.SH;r.reduceRinging(t,i.reduceRinging),r.updateUBOData(this._localSHData,0,t),this.updateSHBuffer()}}}},t.createBoundingShape=function(e,t){e&&t&&(this._modelBounds||(this._modelBounds=nl.create()),this._worldBounds||(this._worldBounds=nl.create()),nl.fromPoints(this._modelBounds,e,t),this._worldBounds.copy(this._modelBounds))},t._createSubModel=function(){return new uT},t.initSubModel=function(e,t,n){this.initialize(),null==this._subModels[e]?this._subModels[e]=this._createSubModel():this._subModels[e].destroy(),this._subModels[e].initialize(t,n.passes,this.getMacroPatches(e)),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;t1?GS:US),r=this._subModels,s=0;s15e3&&(t=15e3);var n=t*t,i=(.860117757+.000154118254*t+1.28641212e-7*n)/(1+.000842420235*t+7.08145163e-7*n),r=(.317398726+422806245e-13*t+4.20481691e-8*n)/(1-289741816e-13*t+1.61456053e-7*n),s=2*i-8*r+4,a=3*i/s,o=2*r/s,u=1/o*a,c=1/o*(1-a-o);e.x=3.2404542*u-1.5371385+-.4985314*c,e.y=-.969266*u+1.8760108+.041556*c,e.z=.0556434*u-.2040259+1.0572252*c}var ix,rx=function(e){return 4*Math.PI*Math.PI*e*e},sx=function(){function e(){this._baked=!1,this._color=Lo(1,1,1),this._colorTemp=6550,this._colorTempRGB=Lo(1,1,1),this._finalColor=Lo(1,1,1),this._scene=null,this._node=null,this._name=null,this._useColorTemperature=!1,this._type=5,this._visibility=fg}var t=e.prototype;return t.initialize=function(){this.color=Lo(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(){},f(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),this._useColorTemperature&&Fo.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"useColorTemperature",get:function(){return this._useColorTemperature},set:function(e){this._useColorTemperature=e,e&&Fo.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"colorTemperature",get:function(){return this._colorTemp},set:function(e){this._colorTemp=e,nx(this._colorTempRGB,this._colorTemp),this._useColorTemperature&&Fo.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"colorTemperatureRGB",get:function(){return this._colorTempRGB}},{key:"finalColor",get:function(){return this._finalColor}},{key:"visibility",get:function(){return this._visibility},set:function(e){this._visibility=e}},{key:"node",get:function(){return this._node},set:function(e){this._node=e,this._node&&(this._node.hasChangedFlags|=2)}},{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}(),ax=new Fo(0,0,-1),ox=new Fo,ux=function(e){function t(){var t;return(t=e.call(this)||this)._dir=new Fo(1,-1,-1),t._illuminanceHDR=HS.SUN_ILLUM,t._illuminanceLDR=1,t._shadowEnabled=!1,t._shadowPcf=RS.HARD,t._shadowBias=1e-5,t._shadowNormalBias=0,t._shadowSaturation=1,t._shadowDistance=50,t._shadowInvisibleOcclusionRange=200,t._csmLevel=CS.LEVEL_4,t._csmNeedUpdate=!1,t._csmLayerLambda=.75,t._csmOptimizationMode=OS.DisableRotationFix,t._csmLayersTransition=!1,t._csmTransitionRange=.05,t._shadowFixedArea=!1,t._shadowNear=.1,t._shadowFar=10,t._shadowOrthoSize=5,t._type=0,t}p(t,e);var n=t.prototype;return n.initialize=function(){e.prototype.initialize.call(this),this.illuminance=HS.SUN_ILLUM,this.direction=new Fo(1,-1,-1)},n.update=function(){this._node&&this._node.hasChangedFlags&&(this.direction=Fo.transformQuat(ox,ax,this._node.worldRotation))},n.activate=function(){var e=o.director.root,t=e.pipeline;this._shadowEnabled?(this._shadowFixedArea||!t.pipelineSceneData.csmSupported?t.macros.CC_DIR_LIGHT_SHADOW_TYPE=1:this.csmLevel>1&&t.pipelineSceneData.csmSupported?(t.macros.CC_DIR_LIGHT_SHADOW_TYPE=2,t.macros.CC_CASCADED_LAYERS_TRANSITION=this._csmLayersTransition):t.macros.CC_DIR_LIGHT_SHADOW_TYPE=1,t.macros.CC_DIR_SHADOW_PCF_TYPE=this._shadowPcf):t.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()},f(t,[{key:"direction",get:function(){return this._dir},set:function(e){Fo.normalize(this._dir,e)}},{key:"illuminance",get:function(){return PS().isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(e){PS().isHDR?this.illuminanceHDR=e:this.illuminanceLDR=e}},{key:"illuminanceHDR",get:function(){return this._illuminanceHDR},set:function(e){this._illuminanceHDR=e}},{key:"illuminanceLDR",get:function(){return this._illuminanceLDR},set:function(e){this._illuminanceLDR=e}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(e){this._shadowEnabled=e,this.activate()}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(e){this._shadowPcf=e,this.activate()}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(e){this._shadowBias=e}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(e){this._shadowNormalBias=e}},{key:"shadowSaturation",get:function(){return this._shadowSaturation},set:function(e){this._shadowSaturation=e}},{key:"shadowDistance",get:function(){return this._shadowDistance},set:function(e){this._shadowDistance=Math.min(e,DS.MAX_FAR)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(e){this._shadowInvisibleOcclusionRange=Math.min(e,DS.MAX_FAR)}},{key:"csmLevel",get:function(){return this._csmLevel},set:function(e){this._csmLevel=e,this.activate()}},{key:"csmNeedUpdate",get:function(){return this._csmNeedUpdate},set:function(e){this._csmNeedUpdate=e}},{key:"csmLayerLambda",get:function(){return this._csmLayerLambda},set:function(e){this._csmLayerLambda=e}},{key:"csmOptimizationMode",get:function(){return this._csmOptimizationMode},set:function(e){this._csmOptimizationMode=e}},{key:"shadowFixedArea",get:function(){return this._shadowFixedArea},set:function(e){this._shadowFixedArea=e,this.activate()}},{key:"shadowNear",get:function(){return this._shadowNear},set:function(e){this._shadowNear=e}},{key:"shadowFar",get:function(){return this._shadowFar},set:function(e){this._shadowFar=Math.min(e,DS.MAX_FAR)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(e){this._shadowOrthoSize=e}},{key:"csmLayersTransition",get:function(){return this._csmLayersTransition},set:function(e){this._csmLayersTransition=e,this.activate()}},{key:"csmTransitionRange",get:function(){return this._csmTransitionRange},set:function(e){this._csmTransitionRange=e}}]),t}(sx),cx=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=new Fo,t._aabb=nl.create(),t._type=1,t}p(t,e);var n=t.prototype;return n.initialize=function(){e.prototype.initialize.call(this),this.size=.15,this.range=1,this.luminanceHDR=1700/rx(.15),this.luminanceLDR=1},n.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var e=this._range;nl.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,e,e,e),this._needUpdate=!1}},f(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 PS().isHDR?this._luminanceHDR:this._luminanceLDR},set:function(e){PS().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}(sx),hx=new Fo(0,0,-1),lx=new fu,fx=new Ru,dx=new Ru,px=new Ru,_x=new Ru,mx=function(e){function t(){var t;return(t=e.call(this)||this)._dir=new Fo(1,-1,-1),t._range=5,t._spotAngle=Math.cos(Math.PI/6),t._angleAttenuationStrength=0,t._pos=new Fo,t._aabb=nl.create(),t._frustum=fl.create(),t._angle=0,t._needUpdate=!1,t._size=.15,t._luminanceHDR=0,t._luminanceLDR=0,t._shadowEnabled=!1,t._shadowPcf=RS.HARD,t._shadowBias=1e-5,t._shadowNormalBias=0,t._type=2,t}p(t,e);var n=t.prototype;return n.initialize=function(){e.prototype.initialize.call(this),this.size=.15,this.luminanceHDR=1700/rx(.15),this.luminanceLDR=1,this.range=Math.cos(Math.PI/6),this._dir.set(new Fo(1,-1,-1))},n.update=function(){this._node&&(this._node.hasChangedFlags||this._needUpdate)&&(this._node.getWorldPosition(this._pos),Fo.transformQuat(this._dir,hx,this._node.getWorldRotation(lx)),Fo.normalize(this._dir,this._dir),nl.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,this._range,this._range,this._range),this._node.getWorldRT(fx),Ru.invert(fx,fx),Ru.perspective(dx,this._angle,1,.001,this._range),Ru.multiply(px,dx,fx),this._frustum.update(px,_x),this._needUpdate=!1)},f(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 PS().isHDR?this._luminanceHDR:this._luminanceLDR},set:function(e){PS().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:"angleAttenuationStrength",get:function(){return this._angleAttenuationStrength},set:function(e){this._angleAttenuationStrength=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}(sx),gx=function(e){function t(){var t;return(t=e.call(this)||this)._needUpdate=!1,t._range=1,t._luminanceHDR=0,t._luminanceLDR=0,t._pos=Lo(),t._aabb=nl.create(),t._type=3,t}p(t,e);var n=t.prototype;return n.initialize=function(){e.prototype.initialize.call(this),this.range=1,this.luminanceHDR=1700/rx(1),this.luminanceLDR=1},n.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var e=this._range;nl.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,e,e,e),this._needUpdate=!1}},f(t,[{key:"position",get:function(){return this._pos}},{key:"range",get:function(){return this._range},set:function(e){this._range=e,this._needUpdate=!0}},{key:"luminance",get:function(){return PS().isHDR?this._luminanceHDR:this._luminanceLDR},set:function(e){PS().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}(sx),vx=new Fo(0,0,-1),yx=function(e){function t(){var t;return(t=e.call(this)||this)._dir=new Fo(0,0,-1),t._pos=new Fo(0,0,0),t._scale=new Fo(1,1,1),t._right=new Fo(1,0,0),t._illuminanceHDR=HS.SUN_ILLUM,t._illuminanceLDR=1,t._type=4,t}p(t,e);var n=t.prototype;return n.initialize=function(){e.prototype.initialize.call(this),this.illuminance=HS.SUN_ILLUM},n.update=function(){this._node&&this._node.hasChangedFlags&&(this._node.getWorldPosition(this._pos),this._node.getWorldScale(this._scale),Fo.transformQuat(this._dir,vx,this._node.worldRotation),Fo.transformQuat(this._right,Fo.RIGHT,this._node.worldRotation))},f(t,[{key:"direction",get:function(){return this._dir}},{key:"right",get:function(){return this._right}},{key:"position",get:function(){return this._pos}},{key:"scale",get:function(){return this._scale}},{key:"illuminance",get:function(){return PS().isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(e){PS().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}}]),t}(sx),bx=new Kr;bx.format=35;var wx=new Qr;wx.format=55;var Tx=new $r([bx],wx),Sx={width:1,height:1,renderPassInfo:Tx},xx=e("RenderTexture",Fl("cc.RenderTexture")(ix=function(e){function t(t){var n;return(n=e.call(this,t)||this)._window=null,n}p(t,e);var n=t.prototype;return n.initialize=function(e){this._name=e.name||"",this._width=e.width,this._height=e.height,this._initWindow(e)},n.reset=function(e){this.initialize(e)},n.destroy=function(){if(this._window){var t=o.director.root;null==t||t.destroyWindow(this._window),this._window=null}return e.prototype.destroy.call(this)},n.resize=function(e,t){this._width=Math.floor(Da(e,1,2048)),this._height=Math.floor(Da(t,1,2048)),this._window&&this._window.resize(this._width,this._height),this.emit("resize",this._window)},n._serialize=function(){return{}},n._deserialize=function(t,n){var i=t;this._width=i.w,this._height=i.h,this._name=i.n,e.prototype._deserialize.call(this,i.base,n)},n.getGFXTexture=function(){return this._window&&this._window.framebuffer.colorTextures[0]},n.onLoaded=function(){this._initWindow()},n._initWindow=function(e){var t=o.director.root;Sx.title=this._name,Sx.width=this._width,Sx.height=this._height,Sx.renderPassInfo=e&&e.passInfo?e.passInfo:Tx,Sx.externalResLow=e&&e.externalResLow?e.externalResLow:0,Sx.externalResHigh=e&&e.externalResHigh?e.externalResHigh:0,Sx.externalFlag=e&&e.externalFlag?e.externalFlag:0,Sx.renderPassInfo.colorAttachments.forEach((function(e){e.format=t.device.swapchainFormat})),bx.barrier=D_.gfxDevice.getGeneralBarrier(new ts(128,128)),this._window?(this._window.destroy(),this._window.initialize(D_.gfxDevice,Sx)):this._window=t.createWindow(Sx)},n.initDefault=function(t){e.prototype.initDefault.call(this,t),this._width=this._height=1,this._initWindow()},n.validate=function(){return this.width>=1&&this.width<=2048&&this.height>=1&&this.height<=2048},n.readPixels=function(e,t,n,i,r){e=e||0,t=t||0,n=n||this.width,i=i||this.height;var s=this.getGFXTexture();if(!s)return Z(7606),null;var a=4*n*i;if(void 0===r)r=new Uint8Array(a);else if(r.length=0&&this._models.splice(t,1)},t.clearModels=function(){this._models.length=0},f(e,[{key:"models",get:function(){return this._models}}]),e}(),Cx=function(){function e(){this.scene=void 0,this.node=null,this.enabled=!0,this._localBoundaryCenter=Lo(0,0,0),this._objectSize=1,this._lodDataArray=[],this._lockedLODLevelVec=[],this._isLockLevelChanged=!1,this._device=D_.gfxDevice}var t=e.prototype;return t.attachToScene=function(e){this.scene=e},t.detachFromScene=function(){this.scene=null},t.lockLODLevels=function(e){if(e.length!==this._lockedLODLevelVec.length)this._isLockLevelChanged=!0;else for(var t=e.length,n=0;n=this.lodDataArray[i].screenUsagePercentage){n=i;break}return n},t.getScreenUsagePercentage=function(e){return this.node?(1===e.projectionType&&(t=Fo.len(this.localBoundaryCenter.transformMat4(this.node.worldMatrix).subtract(e.node.worldPosition))),this.distanceToScreenUsagePercentage(e,t,this.getWorldSpaceSize())):0;var t},t.distanceToScreenUsagePercentage=function(e,t,n){return 1===e.projectionType?n*e.matProj.m05/(2*t):n*e.matProj.m05*.5},t.getWorldSpaceSize=function(){var e=this.node.scale;return Math.max(Math.abs(e.x),Math.abs(e.y),Math.abs(e.z))*this.objectSize},f(e,[{key:"localBoundaryCenter",get:function(){return this._localBoundaryCenter.clone()},set:function(e){this._localBoundaryCenter.set(e)}},{key:"lodCount",get:function(){return this._lodDataArray.length}},{key:"objectSize",get:function(){return this._objectSize},set:function(e){this._objectSize=e}},{key:"lodDataArray",get:function(){return this._lodDataArray}}]),e}(),Ox=yt({DEFAULT:0,LINEAR:1}),Bx=function(){function e(){this._toneMappingType=Ox.DEFAULT,this._activated=!1}var t=e.prototype;return t.initialize=function(e){this._toneMappingType=e.toneMappingType},t.activate=function(){this._updatePipeline(),this._activated=!0},t._updatePipeline=function(){var e=o.director.root;e.pipeline.macros.CC_TONE_MAPPING_TYPE=this._toneMappingType,this._activated&&e.onGlobalPipelineStateChanged()},f(e,[{key:"toneMappingType",get:function(){return this._toneMappingType},set:function(e){this._toneMappingType=e,this._updatePipeline()}}]),e}(),Dx=Object.freeze({__proto__:null,Ambient:HS,CSMLevel:CS,CSMOptimizationMode:OS,Camera:Bg,CameraAperture:bg,CameraFOVAxis:vg,CameraISO:wg,CameraProjection:yg,CameraShutter:Tg,CameraType:{DEFAULT:-1,LEFT_EYE:0,RIGHT_EYE:1,MAIN:2},CameraUsage:{EDITOR:0,GAME_VIEW:1,SCENE_VIEW:2,PREVIEW:3,GAME:100},ColorTemperatureToRGB:nx,DirectionalLight:ux,EnvironmentLightingType:YS,FOG_TYPE_NONE:JS,Fog:$S,FogType:ZS,LODData:Rx,LODGroup:Cx,Light:sx,LightType:{DIRECTIONAL:0,SPHERE:1,SPOT:2,POINT:3,RANGED_DIRECTIONAL:4,UNKNOWN:5},Model:VS,ModelType:{DEFAULT:0,SKINNING:1,BAKED_SKINNING:2,BATCH_2D:3,PARTICLE_BATCH:4,LINE:5},Octree:ex,PCFType:RS,PointLight:gx,PostSettings:Bx,ProbeClearFlag:{SKYBOX:14,SOLID_COLOR:7},ProbeType:{CUBE:0,PLANAR:1},RangedDirectionalLight:yx,ReflectionProbe:Ax,SKYBOX_FLAG:8,ShadowSize:IS,ShadowType:AS,Shadows:DS,Skin:tx,SkyBoxFlagValue:{VALUE:8},Skybox:KS,SphereLight:cx,SpotLight:mx,SubModel:uT,ToneMappingType:Ox,TrackingType:{NO_TRACKING:0,POSITION_AND_ROTATION:1,POSITION:2,ROTATION:3},nt2lm:rx});function Px(e){return--e,e|=e>>16,e|=e>>8,e|=e>>4,e|=e>>2,e|=e>>1,++e}function Mx(e,t){return Math.ceil(e/t)*t}var Fx,Lx=function(){function e(e){this._format=0,this._formatSize=0,this._chunks=[],this._chunkCount=0,this._handles=[],this._region0=new wr,this._region1=new wr,this._region2=new wr,this._roundUpFn=null,this._bufferViewCtor=Uint8Array,this._channels=4,this._alignment=1,this._device=e}var t=e.prototype;return t.initialize=function(e){var t=Ts[e.format];this._format=e.format,this._formatSize=t.size,this._channels=t.count,this._bufferViewCtor=Bs(t),this._roundUpFn=e.roundUpFn||null,this._alignment=e.alignment||1,e.inOrderFree&&(this.alloc=this._McDonaldAlloc)},t.destroy=function(){for(var e=0;e=0));++r);if(i>=0){var s=this._chunks[n];s.start+=e;var a={chunkIdx:n,start:i,end:i+e,texture:s.texture};return this._handles.push(a),a}var o=Math.sqrt(e/this._formatSize),u=this._roundUpFn&&this._roundUpFn(o,this._formatSize)||Math.max(1024,Px(o)),c=this._chunks[this.createChunk(u)];c.start+=e;var h={chunkIdx:this._chunkCount-1,start:0,end:e,texture:c.texture};return this._handles.push(h),h},t.free=function(e){for(var t=0;t0&&(this._region0.texOffset.x=a,this._region0.texOffset.y=o,this._region0.texExtent.width=u,this._region0.texExtent.height=1,n.push(new this._bufferViewCtor(t,c*this._formatSize,u*this._channels)),i.push(this._region0),a=0,o+=1,s-=u,c+=u),s>0&&(this._region1.texOffset.x=a,this._region1.texOffset.y=o,s>e.texture.width?(this._region1.texExtent.width=e.texture.width,this._region1.texExtent.height=Math.floor(s/e.texture.width),u=this._region1.texExtent.width*this._region1.texExtent.height):(u=s,this._region1.texExtent.width=u,this._region1.texExtent.height=1),n.push(new this._bufferViewCtor(t,c*this._formatSize,u*this._channels)),i.push(this._region1),a=0,o+=this._region1.texExtent.height,s-=u,c+=u),s>0&&(this._region2.texOffset.x=a,this._region2.texOffset.y=o,this._region2.texExtent.width=s,this._region2.texExtent.height=1,n.push(new this._bufferViewCtor(t,c*this._formatSize,s*this._channels)),i.push(this._region2)),this._device.copyBuffersToTexture(n,e.texture,i)},t._findAvailableSpace=function(e,t){var n=this._chunks[t],i=!1,r=n.start;if(r+e<=n.size)i=!0;else{r=0;for(var s=this._handles.filter((function(e){return e.chunkIdx===t})).sort((function(e,t){return e.start-t.start})),a=0;an.end?r+e<=n.size?i=!0:e<=n.end&&(n.start=r=0,i=!0):r===n.end&&(n.start=r=0,n.end=n.size,e<=n.end&&(i=!0)),i){n.start+=e;var s={chunkIdx:t,start:r,end:r+e,texture:n.texture};return this._handles.push(s),s}}var a=Math.sqrt(e/this._formatSize),o=this._roundUpFn&&this._roundUpFn(a,this._formatSize)||Math.max(1024,Px(a)),u=this._chunks[this.createChunk(o)];u.start+=e;var c={chunkIdx:this._chunkCount,start:0,end:e,texture:u.texture};return this._handles.push(c),c},e}(),Nx=function(){function e(e){this._name="",this._cameras=[],this._models=[],this._lodGroups=[],this._batches=[],this._directionalLights=[],this._sphereLights=[],this._spotLights=[],this._pointLights=[],this._rangedDirLights=[],this._mainLight=null,this._modelId=0,this._lodStateCache=null,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,this._lodStateCache=new zx(this),!0},t.update=function(e){var t=this._mainLight;t&&t.update();for(var n=this._sphereLights,i=0;i=0&&(this._lodGroups.splice(t,1),e.detachFromScene(),this._lodStateCache.removeLodGroup(e))},t.removeLODGroups=function(){var e=this;this._lodGroups.forEach((function(t){e._lodStateCache.removeLodGroup(t)})),this._lodGroups.length=0},t.onGlobalPipelineStateChanged=function(){this._models.forEach((function(e){e.onGlobalPipelineStateChanged()}))},t.generateModelId=function(){return this._modelId++},f(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:"pointLights",get:function(){return this._pointLights}},{key:"rangedDirLights",get:function(){return this._rangedDirLights}},{key:"models",get:function(){return this._models}},{key:"batches",get:function(){return this._batches}},{key:"lodGroups",get:function(){return this._lodGroups}}]),e}(),kx=function(){this.usedLevel=-1,this.lastUsedLevel=-1,this.transformDirty=!0},zx=function(){function e(e){this._renderScene=null,this._modelsInLODGroup=new Map,this._lodStateInCamera=new Map,this._newAddedLodGroupVec=[],this._levelModels=new Map,this._renderScene=e}var t=e.prototype;return t.addCamera=function(e){for(var t=this._renderScene.lodGroups,n=0;n0){if(n.node.hasChangedFlags>0)for(var s,a=S(e._lodStateInCamera);!(s=a()).done;){var o=s.value,u=o[1].get(n);u||(u=new kx,o[1].set(n,u)),u.transformDirty=!0}if(n.isLockLevelChanged()){n.resetLockChangeFlag();var c=e._levelModels.get(n);c&&(c.forEach((function(t){t.forEach((function(t){var n=e._modelsInLODGroup.get(t);n&&n.clear()}))})),r.forEach((function(t){var n=c.get(t);n&&n.forEach((function(t){var n=e._modelsInLODGroup.get(t);if(n&&t.node&&t.node.active)for(var i,r=S(e._lodStateInCamera);!(i=r()).done;){var s=i.value;n.set(s[0],!0)}}))})))}return 0}for(var h,l=!1,f=S(e._lodStateInCamera);!(h=f()).done;){var d=h.value,p=d[1].get(n);p||(p=new kx,d[1].set(n,p));var _=d[0].node.hasChangedFlags,m=n.node.hasChangedFlags;if(_>0||m>0||p.transformDirty){p.transformDirty&&(p.transformDirty=!1);var g=n.getVisibleLODLevel(d[0]);g!==p.usedLevel&&(p.lastUsedLevel=p.usedLevel,p.usedLevel=g,l=!0)}}var v=e._levelModels.get(n);if(!v)return 0;n.isLockLevelChanged()?(n.resetLockChangeFlag(),v.forEach((function(t){t.forEach((function(t){var n=e._modelsInLODGroup.get(t);n&&n.clear()}))})),l=!0):l&&e._lodStateInCamera.forEach((function(t){var i=t.get(n);if(i&&i.usedLevel!==i.lastUsedLevel){var r=v.get(i.lastUsedLevel);r&&r.forEach((function(t){var n=e._modelsInLODGroup.get(t);n&&n.clear()}))}})),l&&e._lodStateInCamera.forEach((function(t,i){var r=t.get(n);if(r){var s=r.usedLevel,a=v.get(s);a&&a.forEach((function(t){var n=e._modelsInLODGroup.get(t);n&&t.node&&t.node.active&&n.set(i,!0)}))}}))}},i=0;ig.x?e[b]:g.x,g.y=e[b+1]>g.y?e[b+1]:g.y,v.x=e[b]g.x?e[b]:g.x,g.y=e[b+1]>g.y?e[b+1]:g.y,g.z=e[b+2]>g.z?e[b+2]:g.z,v.x=e[b]0)for(var i=0;i=0;--i)if((t=r[i]).eventProcessor.capturingTarget&&(e.currentTarget=t,t.eventProcessor.capturingTarget.emit(e.type,e,r),e.propagationStopped))return void PE.free(r);if(e.eventPhase=2,e.currentTarget=n,this.capturingTarget&&this.capturingTarget.emit(e.type,e),!e.propagationImmediateStopped&&this.bubblingTarget&&this.bubblingTarget.emit(e.type,e),!e.propagationStopped&&e.bubbles)for(r.length=0,this.getBubblingTargets(e.type,r),e.eventPhase=3,i=0;i0?i:null}return null},t._attachMask=function(){this.maskList=this._searchComponentsInParent(e._maskComp)},t._isTouchEvent=function(e){return-1!==LE.indexOf(e)},t._isMouseEvent=function(e){return-1!==NE.indexOf(e)},t._hasTouchListeners=function(){for(var e=0;e0&&(s=n._findChildComponent(r._children,t)))return s}return null},n._findChildComponents=function(e,t,i){for(var r=0;r0&&n._findChildComponents(s._children,t,i)}},t.getWritableComponents=function(){return this._components},t._updateScene=function(){null==this._parent?Z(1640,this.name,this.uuid):this._scene=this._parent._scene},t.attr=function(e){Ke(this,e)},t.getParent=function(){return this._parent},t.modifyParent=function(e){this._parent=e},t.setParent=function(e,t){if(void 0===t&&(t=!1),t&&this.updateWorldTransform(),this._parent!==e){var n=this._parent,i=e;if(this._parent=i,this._siblingIndex=0,this._onSetParent(n,t),this.emit&&this.emit("parent-changed",n),n&&!(n._objFlags&UE)){var r=n._children.indexOf(this);n._children.splice(r,1),n._updateSiblingIndex(),n.emit&&n.emit("child-removed",this)}i&&(i._children.push(this),this._siblingIndex=i._children.length-1,i.emit&&i.emit("child-added",this)),this._onHierarchyChanged(n)}},t.getChildByUuid=function(e){if(!e)return L("Invalid uuid"),null;for(var t=this._children,n=0,i=t.length;n=0?e:t.length+e;var n=t.indexOf(this);e!==n&&(t.splice(n,1),e0?(u=s,r=s._children,a=0,o[i]=r[a],i++):(o[i]=s,i++,c=!0);o.length=0,n._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 n=e[t];n&&(n.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=WE(e);return t?n._findComponent(this,t):null},t.getComponents=function(e){var t=WE(e),i=[];return t&&n._findComponents(this,t,i),i},t.getComponentInChildren=function(e){var t=WE(e);return t?n._findChildComponent(this._children,t):null},t.getComponentsInChildren=function(e){var t=WE(e),i=[];return t&&(n._findComponents(this,t,i),n._findChildComponents(this._children,t,i)),i},t.addComponent=function(e){var t;if("string"==typeof e){if(!(t=ht(e)))throw o._RF.peek()&&Z(3808,e),TypeError(te(3807,e))}else{if(!e)throw TypeError(te(3804));t=e}if("function"!=typeof t)throw TypeError(te(3809));if(!Je(t,o.Component))throw TypeError(te(3810));var n=t._requireComponent;if(n)if(Array.isArray(n))for(var i=0;i=0;){if(a=(t=wR[i--]).hasChangedFlags,t.isValid&&(t._transformFlags&a&e)!==e)for(t._transformFlags|=e,t.hasChangedFlags=a|e,s=(n=t._children).length,r=0;r=0;)Fo.transformInverseRTS(e,e,n._lrot,n._lpos,n._lscale),n=wR[--i];return e},t.setWorldPosition=function(e,t,n){var i=this._pos;void 0===t?Fo.copy(i,e):Fo.set(i,e,t,n);var r=this._parent,s=this._lpos;r?(r.updateWorldTransform(),Fo.transformMat4(s,i,Ru.invert(yR,r._mat))):Fo.copy(s,i),this.invalidateChildren(1),1&this._eventMask&&this.emit(GE,1)},t.getWorldPosition=function(e){return this.updateWorldTransform(),e?Fo.copy(e,this._pos):Fo.copy(new Fo,this._pos)},t.setWorldRotation=function(e,t,n,i){var r=this._rot;void 0===t?fu.copy(r,e):fu.set(r,e,t,n,i),this._parent?(this._parent.updateWorldTransform(),fu.multiply(this._lrot,fu.conjugate(this._lrot,this._parent._rot),r)):fu.copy(this._lrot,r),this._eulerDirty=!0,this.invalidateChildren(2),1&this._eventMask&&this.emit(GE,2)},t.setWorldRotationFromEuler=function(e,t,n){fu.fromEuler(_R,e,t,n),this.setWorldRotation(_R)},t.getWorldRotation=function(e){return this.updateWorldTransform(),e?fu.copy(e,this._rot):fu.copy(new fu,this._rot)},t.setWorldScale=function(e,t,n){var i=this,r=i._parent;r&&i.updateWorldTransform();var s=i._scale;void 0===t?Fo.copy(s,e):Fo.set(s,e,t,n);var a=0;if(r){var o=i._mat;i._uiProps._uiSkewComp&&(Ru.fromSRT(yR,i._lrot,i._lpos,i._lscale),Ru.multiply(o,r._mat,yR));var u=Fo.set(pR,o.m00,o.m01,o.m02).length(),c=Fo.set(pR,o.m04,o.m05,o.m06).length(),h=Fo.set(pR,o.m08,o.m09,o.m10).length();0===u?(dR.x=s.x,o.m00=1,a=2):dR.x=s.x/u,0===c?(dR.y=s.y,o.m05=1,a=2):dR.y=s.y/c,0===h?(dR.z=s.z,o.m10=1,a=2):dR.z=s.z/h,Ru.scale(yR,o,dR),Ru.multiply(bR,Ru.invert(bR,r._mat),yR),Zo.fromQuat(vR,fu.conjugate(gR,i._lrot)),Zo.multiplyMat4(vR,vR,bR);var l=i._lscale;l.x=Fo.set(dR,vR.m00,vR.m01,vR.m02).length(),l.y=Fo.set(dR,vR.m03,vR.m04,vR.m05).length(),l.z=Fo.set(dR,vR.m06,vR.m07,vR.m08).length(),0!==l.x&&0!==l.y&&0!==l.z||(a=2)}else Fo.copy(i._lscale,s);i.invalidateChildren(4|a),1&i._eventMask&&i.emit(GE,4|a)},t.getWorldScale=function(e){return this.updateWorldTransform(),e?Fo.copy(e,this._scale):Fo.copy(new Fo,this._scale)},t.getWorldMatrix=function(e){this.updateWorldTransform();var t=e||new Ru;return Ru.copy(t,this._mat)},t.getWorldRS=function(e){this.updateWorldTransform();var t=e||new Ru;return Ru.copy(t,this._mat),t.m12=0,t.m13=0,t.m14=0,t},t.getWorldRT=function(e){this.updateWorldTransform();var t=e||new Ru;return Ru.fromRT(t,this._rot,this._pos)},t.setRTS=function(e,t,n){var i=0;e&&(i|=2,void 0!==e.w?(fu.copy(this._lrot,e),this._eulerDirty=!0):(Fo.copy(this._euler,e),fu.fromEuler(this._lrot,e.x,e.y,e.z),this._eulerDirty=!1)),t&&(Fo.copy(this._lpos,t),i|=1),n&&(Fo.copy(this._lscale,n),i|=4),i&&(this.invalidateChildren(i),1&this._eventMask&&this.emit(GE,i))},t.isTransformDirty=function(){return 0!==this._transformFlags},t.pauseSystemEvents=function(e){this._eventProcessor.setEnabled(!1,e)},t.resumeSystemEvents=function(e){this._eventProcessor.setEnabled(!0,e)},n.resetHasChangedFlags=function(){SR+=1},n.clearNodeArray=function(){n.ClearFrame0},set:function(e){e?this._objFlags|=64:this._objFlags&=-65}},{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&&o.director._nodeActivator.activateNode(this,e)}}},{key:"activeInHierarchy",get:function(){return this._activeInHierarchy}},{key:"parent",get:function(){return this._parent},set:function(e){this.setParent(e)}},{key:"scene",get:function(){return this._scene}},{key:"eventProcessor",get:function(){return this._eventProcessor}},{key:"prefab",get:function(){return this._prefab}},{key:"id",set:function(e){this._id=e}},{key:"siblingIndex",get:function(){return this._siblingIndex},set:function(e){this._siblingIndex=e}},{key:"position",get:function(){return this._lpos},set:function(e){this.setPosition(e)}},{key:"x",get:function(){return this._lpos.x},set:function(e){this.setPosition(e,this._lpos.y,this._lpos.z)}},{key:"y",get:function(){return this._lpos.y},set:function(e){this.setPosition(this._lpos.x,e,this._lpos.z)}},{key:"z",get:function(){return this._lpos.z},set:function(e){this.setPosition(this._lpos.x,this._lpos.y,e)}},{key:"worldPosition",get:function(){return this.updateWorldTransform(),this._pos},set:function(e){this.setWorldPosition(e)}},{key:"worldPositionX",get:function(){return this.updateWorldTransform(),this._pos.x},set:function(e){this.setWorldPosition(e,this._pos.y,this._pos.z)}},{key:"worldPositionY",get:function(){return this.updateWorldTransform(),this._pos.y},set:function(e){this.setWorldPosition(this._pos.x,e,this._pos.z)}},{key:"worldPositionZ",get:function(){return this.updateWorldTransform(),this._pos.z},set:function(e){this.setWorldPosition(this._pos.x,this._pos.y,e)}},{key:"rotation",get:function(){return this._lrot},set:function(e){this.setRotation(e)}},{key:"eulerAngles",get:function(){return this._eulerDirty&&(fu.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.eulerAngles.z},set:function(e){Fo.set(this._euler,0,0,e),fu.fromAngleZ(this._lrot,e),this._eulerDirty=!1,this.invalidateChildren(2),1&this._eventMask&&this.emit(GE,2)}},{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){Ru.toSRT(e,this._lrot,this._lpos,this._lscale),this.invalidateChildren(7),this._eulerDirty=!0,1&this._eventMask&&this.emit(GE,7)}},{key:"worldMatrix",get:function(){return this.updateWorldTransform(),this._mat}},{key:"forward",get:function(){return Fo.transformQuat(new Fo,Fo.FORWARD,this.worldRotation)},set:function(e){var t=e.length();Fo.multiplyScalar(dR,e,-1/t),fu.fromViewUp(_R,dR),this.setWorldRotation(_R)}},{key:"up",get:function(){return Fo.transformQuat(new Fo,Fo.UP,this.worldRotation)}},{key:"right",get:function(){return Fo.transformQuat(new Fo,Fo.RIGHT,this.worldRotation)}},{key:"mobility",get:function(){return this._mobility},set:function(e){this._mobility!==e&&(this._mobility=e,this.emit("mobility-changed"))}},{key:"layer",get:function(){return this._layer},set:function(e){var t=this;if(t._layer!==e){t._layer=e;var n=t._uiProps&&t._uiProps.uiComp;n&&(n.setNodeDirty(),n._markForUpdateRenderData()),t.emit("layer-changed",t._layer)}}},{key:"flagChangedVersion",get:function(){return this._flagChangeVersion}},{key:"hasChangedFlags",get:function(){return this._flagChangeVersion===SR?this._hasChangedFlags:0},set:function(e){this._flagChangeVersion=SR,this._hasChangedFlags=e}}]),n}(Pn),DE.idGenerator=HE,DE._stacks=[[]],DE._stackId=0,DE.EventType=nE,DE.NodeSpace=$x,DE.TransformDirtyBit=eE,DE.TransformBit=eE,DE.reserveContentsForAllSyncablePrefabTag=TR,DE.ClearFrame=0,DE.ClearRound=1e3,I((bE=DE).prototype,"_persistNode",[zl],Object.getOwnPropertyDescriptor(bE.prototype,"_persistNode"),bE.prototype),wE=El(bE.prototype,"_parent",[Yl],(function(){return null})),TE=El(bE.prototype,"_children",[Yl],(function(){return[]})),SE=El(bE.prototype,"_active",[Yl],(function(){return!0})),xE=El(bE.prototype,"_components",[Yl],(function(){return[]})),EE=El(bE.prototype,"_prefab",[Yl],(function(){return null})),IE=El(bE.prototype,"_lpos",[Yl],(function(){return new Fo})),AE=El(bE.prototype,"_lrot",[Yl],(function(){return new fu})),RE=El(bE.prototype,"_lscale",[Yl],(function(){return new Fo(1,1,1)})),CE=El(bE.prototype,"_mobility",[Yl],(function(){return tE.Static})),OE=El(bE.prototype,"_layer",[Yl],(function(){return Y_.Enum.DEFAULT})),BE=El(bE.prototype,"_euler",[Yl],(function(){return new Fo})),I(bE.prototype,"eulerAngles",[gE],Object.getOwnPropertyDescriptor(bE.prototype,"eulerAngles"),bE.prototype),I(bE.prototype,"mobility",[vE],Object.getOwnPropertyDescriptor(bE.prototype,"mobility"),bE.prototype),yE=bE))||yE);e({Node:xR,BaseNode:xR}),o.Node=xR;var ER=new Fo(0,1,0),IR=new Fo,AR=new go,RR=new Wo,CR=new fu,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)},BR=e("AmbientInfo",(jE=Fl("cc.AmbientInfo"),XE=yf(Jt),qE=Kl("_skyColor"),YE=Kl("_skyIllum"),KE=Kl("_groundAlbedo"),jE((ZE=function(){function e(){this._skyColorHDR=JE&&JE(),this._skyIllumHDR=$E&&$E(),this._groundAlbedoHDR=eI&&eI(),this._skyColorLDR=tI&&tI(),this._skyIllumLDR=nI&&nI(),this._groundAlbedoLDR=iI&&iI(),this._resource=null}return e.prototype.activate=function(e){this._resource=e,e.initialize(this)},f(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=PS().isHDR;return AR.set(e?this._skyColorHDR:this._skyColorLDR),OR(AR),RR.set(255*AR.x,255*AR.y,255*AR.z,255)},set:function(e){AR.set(e.x,e.y,e.z,e.w),PS().isHDR?this._skyColorHDR.set(AR):this._skyColorLDR.set(AR),this._resource&&this._resource.skyColor.set(AR)}},{key:"skyColor",set:function(e){PS().isHDR?this._skyColorHDR.set(e):this._skyColorLDR.set(e),this._resource&&this._resource.skyColor.set(e)}},{key:"skyIllum",get:function(){return PS().isHDR?this._skyIllumHDR:this._skyIllumLDR},set:function(e){PS().isHDR?this._skyIllumHDR=e:this._skyIllumLDR=e,this._resource&&(this._resource.skyIllum=e)}},{key:"groundLightingColor",get:function(){var e=PS().isHDR;return AR.set(e?this._groundAlbedoHDR:this._groundAlbedoLDR),OR(AR),RR.set(255*AR.x,255*AR.y,255*AR.z,255)},set:function(e){AR.set(e.x,e.y,e.z,e.w),PS().isHDR?this._groundAlbedoHDR.set(AR):this._groundAlbedoLDR.set(AR),this._resource&&this._resource.groundAlbedo.set(AR)}},{key:"groundAlbedo",set:function(e){PS().isHDR?this._groundAlbedoHDR.set(e):this._groundAlbedoLDR.set(e),this._resource&&this._resource.groundAlbedo.set(e)}}]),e}(),I(ZE.prototype,"skyIllum",[XE],Object.getOwnPropertyDescriptor(ZE.prototype,"skyIllum"),ZE.prototype),JE=El(ZE.prototype,"_skyColorHDR",[Yl,qE],(function(){return new go(.2,.5,.8,1)})),$E=El(ZE.prototype,"_skyIllumHDR",[Yl,YE],(function(){return HS.SKY_ILLUM})),eI=El(ZE.prototype,"_groundAlbedoHDR",[Yl,KE],(function(){return new go(.2,.2,.2,1)})),tI=El(ZE.prototype,"_skyColorLDR",[Yl],(function(){return new go(.2,.5,.8,1)})),nI=El(ZE.prototype,"_skyIllumLDR",[Yl],(function(){return HS.SKY_ILLUM})),iI=El(ZE.prototype,"_groundAlbedoLDR",[Yl],(function(){return new go(.2,.2,.2,1)})),QE=ZE))||QE));u.AmbientInfo=BR;var DR=e("SkyboxInfo",(rI=Fl("cc.SkyboxInfo"),sI=yf(YS),aI=yf(xb),oI=yf(Jt),uI=yf(xb),cI=yf(xb),hI=yf(ES),lI=yf(xb),fI=Kl("_envmap"),dI=yf(xb),pI=yf(xb),_I=yf(xb),mI=yf(ES),gI=yf(xb),vI=yf(xb),rI((bI=function(){function e(){this._envLightingType=wI&&wI(),this._envmapHDR=TI&&TI(),this._envmapLDR=SI&&SI(),this._diffuseMapHDR=xI&&xI(),this._diffuseMapLDR=EI&&EI(),this._enabled=II&&II(),this._useHDR=AI&&AI(),this._editableMaterial=RI&&RI(),this._reflectionHDR=CI&&CI(),this._reflectionLDR=OI&&OI(),this._rotationAngle=BI&&BI(),this._resource=null}var t=e.prototype;return t.activate=function(e){this.envLightingType=this._envLightingType,this._resource=e,e.initialize(this),e.setEnvMaps(this._envmapHDR,this._envmapLDR),e.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR),e.setSkyboxMaterial(this._editableMaterial),e.setReflectionMaps(this._reflectionHDR,this._reflectionLDR),e.setRotationAngle(this._rotationAngle),e.activate()},t.updateEnvMap=function(e){e||(this.applyDiffuseMap=!1,this.useIBL=!1,this.envLightingType=0,K(15001));var t=this._resource;t&&(t.setEnvMaps(this._envmapHDR,this._envmapLDR),t.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR),t.setReflectionMaps(this._reflectionHDR,this._reflectionLDR),t.useDiffuseMap=this.applyDiffuseMap,t.envmap=e)},t.setMaterialProperty=function(e,t,n){var i=this._resource;if(i){var r=i.editableMaterial;i.enabled&&r&&(r.setProperty(e,t,n),r.passes.forEach((function(e){e.update()})))}},f(e,[{key:"applyDiffuseMap",get:function(){return 2===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||0===e?(0===e?(this.useIBL=!1,this.applyDiffuseMap=!1):1===e?(this.useIBL=!0,this.applyDiffuseMap=!1):2===e&&(this.useIBL=!0,this.applyDiffuseMap=!0),this._envLightingType=e):(this.useIBL=!1,this.applyDiffuseMap=!1,this._envLightingType=0,K(15001))}},{key:"useIBL",get:function(){return 0!==this._envLightingType},set:function(e){this._resource&&(this._resource.useIBL=e)}},{key:"useHDR",get:function(){return PS().isHDR=this._useHDR,this._useHDR},set:function(e){PS().isHDR=e,this._useHDR=e;var t=this._resource;t&&2===this.envLightingType&&(null===this.diffuseMap?(this.envLightingType=1,K(15e3)):this.diffuseMap.isDefault&&K(15002)),t&&(t.useHDR=this._useHDR,t.updateMaterialRenderInfo())}},{key:"envmap",get:function(){return PS().isHDR?this._envmapHDR:this._envmapLDR},set:function(e){var t=PS().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=0,K(15001));var n=this._resource;n&&(n.setEnvMaps(this._envmapHDR,this._envmapLDR),n.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR),n.setReflectionMaps(this._reflectionHDR,this._reflectionLDR),n.useDiffuseMap=this.applyDiffuseMap,n.envmap=e)}},{key:"rotationAngle",get:function(){return this._rotationAngle},set:function(e){this._rotationAngle=e,this._resource&&this._resource.setRotationAngle(this._rotationAngle)}},{key:"diffuseMap",get:function(){return PS().isHDR?this._diffuseMapHDR:this._diffuseMapLDR},set:function(e){PS().isHDR?this._diffuseMapHDR=e:this._diffuseMapLDR=e,this._resource&&this._resource.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR)}},{key:"reflectionMap",get:function(){return PS().isHDR?this._reflectionHDR:this._reflectionLDR},set:function(e){PS().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}(),I(bI.prototype,"envLightingType",[sI],Object.getOwnPropertyDescriptor(bI.prototype,"envLightingType"),bI.prototype),I(bI.prototype,"envmap",[aI],Object.getOwnPropertyDescriptor(bI.prototype,"envmap"),bI.prototype),I(bI.prototype,"rotationAngle",[oI],Object.getOwnPropertyDescriptor(bI.prototype,"rotationAngle"),bI.prototype),I(bI.prototype,"diffuseMap",[uI],Object.getOwnPropertyDescriptor(bI.prototype,"diffuseMap"),bI.prototype),I(bI.prototype,"reflectionMap",[cI],Object.getOwnPropertyDescriptor(bI.prototype,"reflectionMap"),bI.prototype),I(bI.prototype,"skyboxMaterial",[hI],Object.getOwnPropertyDescriptor(bI.prototype,"skyboxMaterial"),bI.prototype),wI=El(bI.prototype,"_envLightingType",[Yl],(function(){return 0})),TI=El(bI.prototype,"_envmapHDR",[Yl,lI,fI],(function(){return null})),SI=El(bI.prototype,"_envmapLDR",[Yl,dI],(function(){return null})),xI=El(bI.prototype,"_diffuseMapHDR",[Yl,pI],(function(){return null})),EI=El(bI.prototype,"_diffuseMapLDR",[Yl,_I],(function(){return null})),II=El(bI.prototype,"_enabled",[Yl],(function(){return!1})),AI=El(bI.prototype,"_useHDR",[Yl],(function(){return!0})),RI=El(bI.prototype,"_editableMaterial",[Yl,mI],(function(){return null})),CI=El(bI.prototype,"_reflectionHDR",[Yl,gI],(function(){return null})),OI=El(bI.prototype,"_reflectionLDR",[Yl,vI],(function(){return null})),BI=El(bI.prototype,"_rotationAngle",[Yl],(function(){return 0})),yI=bI))||yI));u.SkyboxInfo=DR;var PR=e("FogInfo",(DI=Fl("cc.FogInfo"),PI=yf(ZS),MI=yf(Jt),FI=yf(Jt),LI=yf(Jt),NI=yf(Jt),kI=yf(Jt),zI=yf(Jt),DI((JI=function(){function e(){this._type=VI&&VI(),this._fogColor=HI&&HI(),this._enabled=WI&&WI(),this._fogDensity=jI&&jI(),this._fogStart=XI&&XI(),this._fogEnd=qI&&qI(),this._fogAtten=YI&&YI(),this._fogTop=KI&&KI(),this._fogRange=QI&&QI(),this._accurate=ZI&&ZI(),this._resource=null}return e.prototype.activate=function(e){this._resource=e,e.initialize(this),e.activate()},f(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){if(this._enabled!==e){this._enabled=e;var t=this._resource;t&&(t.enabled=e,e&&(t.type=this._type))}}},{key:"accurate",get:function(){return this._accurate},set:function(e){if(this._accurate!==e){this._accurate=e;var t=this._resource;t&&(t.accurate=e,e&&(t.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}(),JI.FogType=ZS,I((GI=JI).prototype,"type",[PI],Object.getOwnPropertyDescriptor(GI.prototype,"type"),GI.prototype),I(GI.prototype,"fogDensity",[MI],Object.getOwnPropertyDescriptor(GI.prototype,"fogDensity"),GI.prototype),I(GI.prototype,"fogStart",[FI],Object.getOwnPropertyDescriptor(GI.prototype,"fogStart"),GI.prototype),I(GI.prototype,"fogEnd",[LI],Object.getOwnPropertyDescriptor(GI.prototype,"fogEnd"),GI.prototype),I(GI.prototype,"fogAtten",[NI],Object.getOwnPropertyDescriptor(GI.prototype,"fogAtten"),GI.prototype),I(GI.prototype,"fogTop",[kI],Object.getOwnPropertyDescriptor(GI.prototype,"fogTop"),GI.prototype),I(GI.prototype,"fogRange",[zI],Object.getOwnPropertyDescriptor(GI.prototype,"fogRange"),GI.prototype),VI=El(GI.prototype,"_type",[Yl],(function(){return ZS.LINEAR})),HI=El(GI.prototype,"_fogColor",[Yl],(function(){return new Wo("#C8C8C8")})),WI=El(GI.prototype,"_enabled",[Yl],(function(){return!1})),jI=El(GI.prototype,"_fogDensity",[Yl],(function(){return.3})),XI=El(GI.prototype,"_fogStart",[Yl],(function(){return.5})),qI=El(GI.prototype,"_fogEnd",[Yl],(function(){return 300})),YI=El(GI.prototype,"_fogAtten",[Yl],(function(){return 5})),KI=El(GI.prototype,"_fogTop",[Yl],(function(){return 1.5})),QI=El(GI.prototype,"_fogRange",[Yl],(function(){return 1.2})),ZI=El(GI.prototype,"_accurate",[Yl],(function(){return!1})),UI=GI))||UI)),MR=e("ShadowsInfo",($I=Fl("cc.ShadowsInfo"),eA=yf(AS),tA=yf(Jt),nA=yf(Jt),iA=yf(Zt),rA=yf(IS),$I((aA=function(){function e(){this._enabled=oA&&oA(),this._type=uA&&uA(),this._normal=cA&&cA(),this._distance=hA&&hA(),this._planeBias=lA&&lA(),this._shadowColor=fA&&fA(),this._maxReceived=dA&&dA(),this._size=pA&&pA(),this._resource=null}var t=e.prototype;return t.setPlaneFromNode=function(e){e.getWorldRotation(CR),this.planeDirection=Fo.transformQuat(IR,ER,CR),e.getWorldPosition(IR),this.planeHeight=Fo.dot(this._normal,IR)},t.activate=function(e){this._resource=e,e.initialize(this),e.activate()},f(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){if(this._enabled!==e){this._enabled=e;var t=this._resource;t&&(t.enabled=e,e&&(t.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){Fo.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:"planeBias",get:function(){return this._planeBias},set:function(e){this._planeBias=e,this._resource&&(this._resource.planeBias=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){var t=this._resource;this._size.set(e,e),t&&(t.size.set(e,e),t.shadowMapDirty=!0)}}]),e}(),I(aA.prototype,"type",[eA],Object.getOwnPropertyDescriptor(aA.prototype,"type"),aA.prototype),I(aA.prototype,"planeHeight",[tA],Object.getOwnPropertyDescriptor(aA.prototype,"planeHeight"),aA.prototype),I(aA.prototype,"planeBias",[nA],Object.getOwnPropertyDescriptor(aA.prototype,"planeBias"),aA.prototype),I(aA.prototype,"maxReceived",[iA],Object.getOwnPropertyDescriptor(aA.prototype,"maxReceived"),aA.prototype),I(aA.prototype,"shadowMapSize",[rA],Object.getOwnPropertyDescriptor(aA.prototype,"shadowMapSize"),aA.prototype),oA=El(aA.prototype,"_enabled",[Yl],(function(){return!1})),uA=El(aA.prototype,"_type",[Yl],(function(){return AS.Planar})),cA=El(aA.prototype,"_normal",[Yl],(function(){return new Fo(0,1,0)})),hA=El(aA.prototype,"_distance",[Yl],(function(){return 0})),lA=El(aA.prototype,"_planeBias",[Yl],(function(){return 1})),fA=El(aA.prototype,"_shadowColor",[Yl],(function(){return new Wo(0,0,0,76)})),dA=El(aA.prototype,"_maxReceived",[Yl],(function(){return 4})),pA=El(aA.prototype,"_size",[Yl],(function(){return new Xu(1024,1024)})),sA=aA))||sA));u.ShadowsInfo=MR;var FR=e("DEFAULT_WORLD_MIN_POS",new Fo(-1024,-1024,-1024)),LR=e("DEFAULT_WORLD_MAX_POS",new Fo(1024,1024,1024)),NR=e("DEFAULT_OCTREE_DEPTH",8),kR=e("OctreeInfo",(_A=Fl("cc.OctreeInfo"),mA=yf(Zt),_A((vA=function(){function e(){this._enabled=yA&&yA(),this._minPos=bA&&bA(),this._maxPos=wA&&wA(),this._depth=TA&&TA(),this._resource=null}return e.prototype.activate=function(e){this._resource=e,e.initialize(this)},f(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}(),I(vA.prototype,"depth",[mA],Object.getOwnPropertyDescriptor(vA.prototype,"depth"),vA.prototype),yA=El(vA.prototype,"_enabled",[Yl],(function(){return!1})),bA=El(vA.prototype,"_minPos",[Yl],(function(){return new Fo(FR)})),wA=El(vA.prototype,"_maxPos",[Yl],(function(){return new Fo(LR)})),TA=El(vA.prototype,"_depth",[Yl],(function(){return NR})),gA=vA))||gA));u.OctreeInfo=kR;var zR=e("SkinInfo",(SA=Fl("cc.SkinInfo"),xA=yf(Jt),EA=yf(Jt),SA((AA=function(){function e(){this._enabled=RA&&RA(),this._blurRadius=CA&&CA(),this._sssIntensity=OA&&OA(),this._resource=null}return e.prototype.activate=function(e){this._resource=e,e.initialize(this)},f(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e,this._resource&&(this._resource.enabled=e))}},{key:"blurRadius",get:function(){return this._blurRadius},set:function(e){this._blurRadius=e,this._resource&&(this._resource.blurRadius=e)}},{key:"sssIntensity",get:function(){return this._sssIntensity},set:function(e){this._sssIntensity=e,this._resource&&(this._resource.sssIntensity=e)}}]),e}(),I(AA.prototype,"blurRadius",[xA],Object.getOwnPropertyDescriptor(AA.prototype,"blurRadius"),AA.prototype),I(AA.prototype,"sssIntensity",[EA],Object.getOwnPropertyDescriptor(AA.prototype,"sssIntensity"),AA.prototype),RA=El(AA.prototype,"_enabled",[Yl],(function(){return!0})),CA=El(AA.prototype,"_blurRadius",[Yl],(function(){return.01})),OA=El(AA.prototype,"_sssIntensity",[Yl],(function(){return 3})),IA=AA))||IA));u.SkinInfo=zR;var UR=e("PostSettingsInfo",(BA=Fl("cc.PostSettingsInfo"),DA=yf(Ox),BA((MA=function(){function e(){this._toneMappingType=FA&&FA(),this._resource=null}return e.prototype.activate=function(e){this._resource=e,e.initialize(this),e.activate()},f(e,[{key:"toneMappingType",get:function(){return this._toneMappingType},set:function(e){this._toneMappingType=e,this._resource&&(this._resource.toneMappingType=e)}}]),e}(),I(MA.prototype,"toneMappingType",[DA],Object.getOwnPropertyDescriptor(MA.prototype,"toneMappingType"),MA.prototype),FA=El(MA.prototype,"_toneMappingType",[Yl],(function(){return Ox.DEFAULT})),PA=MA))||PA));u.PostSettingsInfo=UR;var GR,VR,HR,WR,jR,XR,qR,YR,KR,QR,ZR,JR,$R,eC,tC,nC,iC,rC,sC,aC,oC,uC,cC,hC,lC,fC,dC,pC,_C,mC,gC,vC,yC,bC,wC,TC,SC,xC,EC,IC,AC,RC,CC,OC,BC,DC,PC,MC,FC,LC,NC,kC,zC,UC,GC,VC,HC,WC,jC,XC,qC,YC,KC,QC,ZC,JC,$C,eO,tO,nO=e("LightProbeInfo",(LA=Fl("cc.LightProbeInfo"),NA=yf(Jt),kA=yf(Zt),zA=yf(Zt),UA=yf(Jt),GA=yf(Jt),LA((HA=function(){function e(){this._giScale=WA&&WA(),this._giSamples=jA&&jA(),this._bounces=XA&&XA(),this._reduceRinging=qA&&qA(),this._showProbe=YA&&YA(),this._showWireframe=KA&&KA(),this._showConvex=QA&&QA(),this._data=ZA&&ZA(),this._lightProbeSphereVolume=JA&&JA(),this._nodes=[],this._scene=null,this._resource=null}var t=e.prototype;return t.activate=function(e,t){this._scene=e,this._resource=t,t.initialize(this)},t.onProbeBakeFinished=function(){this.onProbeBakingChanged(this._scene)},t.onProbeBakeCleared=function(){this.clearSHCoefficients(),this.onProbeBakingChanged(this._scene)},t.onProbeBakingChanged=function(e){var t=this;e&&(e.emit("light-probe-baking-changed"),e.children.forEach((function(e){t.onProbeBakingChanged(e)})))},t.clearSHCoefficients=function(){this._data&&(this._data.probes.forEach((function(e){e.coefficients.length=0})),this.clearAllSHUBOs())},t.isUniqueNode=function(){return 1===this._nodes.length},t.addNode=function(e){if(!e)return!1;for(var t=0;t0)for(var u=0;u=0&&s.node.getWritableComponents().splice(a,1)}}}function vO(e,t,n){if(!(t.length<=0))for(var i=null,r=0;r0){var u=o.pop();if(!u)continue;for(var c=0;c0){var g=_.pop();if(!g)return;for(var v=0;v<_.length&&(m=m[_[v]]);v++);if(!m)continue;m[g]=l}}}}}}function bO(e,t){var n;void 0===t&&(t=!1);var i=null==e||null==(n=e.prefab)?void 0:n.instance;if(i&&!i.expanded){fO(e),t&&e&&e.children&&e.children.forEach((function(e){bO(e,!0)}));var r={};i.targetMap=r,dO(e,r,!0),_O(0,i.mountedChildren,r),gO(0,i.removedComponents,r),mO(0,i.mountedComponents,r),vO(0,i.propertyOverrides,r),i.expanded=!0}else t&&e&&e.children&&e.children.forEach((function(e){bO(e,!0)}))}function wO(e){var t=e.prefab;t&&t.nestedPrefabInstanceRoots&&t.nestedPrefabInstanceRoots.forEach((function(e){bO(e)}))}o._PrefabInfo=lO;var TO,SO,xO,EO,IO,AO,RO,CO=Object.freeze({__proto__:null,CompPrefabInfo:aO,MountedChildrenInfo:uO,MountedComponentsInfo:cO,PrefabInfo:lO,PrefabInstance:hO,PropertyOverrideInfo:oO,TargetInfo:rO,TargetOverrideInfo:sO,applyMountedChildren:_O,applyMountedComponents:mO,applyNodeAndComponentId:function e(t,n){for(var i=t.components,r=t.children,s=0;s1&&e.csmOptimizationMode===OS.RemoveDuplicates)if(this._level>=c-1)YO=this._castLightViewBoundingBox.halfExtents.z,qO=this._castLightViewBoundingBox.center.z;else{var h=Math.abs(this._castLightViewBoundingBox.center.z-qO)+YO;this._castLightViewBoundingBox.halfExtents.z=Math.max(this._castLightViewBoundingBox.center.z,h)}var l=this._castLightViewBoundingBox.halfExtents.z;this._shadowCameraFar=2*l+r;var f=this._castLightViewBoundingBox.center;if(XO.set(f.x,f.y,f.z+l+r),Fo.transformMat4(XO,XO,PO),Ru.fromRT(PO,e.node.rotation,XO),Ru.invert(MO,PO),!n){var d=.5*s,p=.5*a;Ru.ortho(FO,-d,d,-p,p,.1,this._shadowCameraFar,i.capabilities.clipSpaceMinZ,i.capabilities.clipSpaceSignY),Ru.multiply(NO,FO,u),Fo.transformMat4(UO,XO,NO);var _=2/t;GO.set(_,_);var m=UO.x%GO.x,g=UO.y%GO.y;VO.set(UO.x-m,UO.y-g,UO.z),Ru.invert(kO,NO),Fo.transformMat4(HO,VO,kO),Ru.fromRT(PO,e.node.rotation,HO),Ru.invert(MO,PO),Ru.multiply(LO,FO,MO),Ru.copy(this._matShadowView,MO),Ru.copy(this._matShadowProj,FO),Ru.copy(this._matShadowViewProj,LO)}fl.createOrtho(this._validFrustum,s,a,.1,this._shadowCameraFar,PO)},f(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}(),QO=function(e){function t(t){var n;return(n=e.call(this,t)||this)._splitCameraNear=0,n._splitCameraFar=0,n._csmAtlas=new go,n._calculateAtlas(t),n}p(t,e);var n=t.prototype;return n.destroy=function(){e.prototype.destroy.call(this)},n._calculateAtlas=function(e){var t=o.director.root.device.capabilities.clipSpaceSignY,n=e%2-.5,i=(.5-Math.floor(e/2))*t;this._csmAtlas.set(.5,.5,n,i)},f(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}(KO),ZO=function(){function e(){this._castShadowObjects=[],this._layerObjects=new xe(64),this._layers=[],this._levelCount=0,this._specialLayer=new KO(1),this._shadowDistance=0;for(var e=0;e1?.5*n.size.x:n.size.x;if(!(r<0)){this._getCameraWorldMatrix(DO,e);for(var s=i-1;s>=0;s--){var a=this._layers[s],u=a.splitCameraNear,c=a.splitCameraFar;a.calculateSplitFrustum(e,DO,u,c),a.createMatrix(t,r,!1)}i===CS.LEVEL_1?(this._specialLayer.shadowCameraFar=this._layers[0].shadowCameraFar,Ru.copy(this._specialLayer.matShadowView,this._layers[0].matShadowView),Ru.copy(this._specialLayer.matShadowProj,this._layers[0].matShadowProj),Ru.copy(this._specialLayer.matShadowViewProj,this._layers[0].matShadowViewProj),this._specialLayer.copyToValidFrustum(this._layers[0].validFrustum)):(this._specialLayer.calculateSplitFrustum(e,DO,.1,t.shadowDistance),this._specialLayer.createMatrix(t,r,!0))}},t._getCameraWorldMatrix=function(e,t){if(t.node){var n=t.node,i=n.worldPosition,r=n.worldRotation;Ru.fromRT(e,r,i)}},f(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}(),JO=e("PipelineSceneData",function(){function e(){this.fog=new $S,this.ambient=new HS,this.skybox=new KS,this.shadows=new DS,this.csmLayers=new ZO,this.octree=new ex,this.skin=new tx,this.postSettings=new Bx,this.lightProbes=o.internal.LightProbes?new o.internal.LightProbes:null,this.validPunctualLights=[],this.renderObjects=[],this.shadowFrameBufferMap=new Map,this._geometryRendererMaterials=[],this._geometryRendererPasses=[],this._geometryRendererShaders=[],this._occlusionQueryVertexBuffer=null,this._occlusionQueryIndicesBuffer=null,this._occlusionQueryInputAssembler=null,this._occlusionQueryMaterial=null,this._occlusionQueryShader=null,this._isHDR=!0,this._shadingScale=1,this._csmSupported=!0,this._standardSkinMeshRenderer=null,this._standardSkinModel=null,this._skinMaterialModel=null,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=this._geometryRendererMaterials,n=0;n<6;n++){t[n]=new ES,t[n]._uuid="geometry-renderer-material-"+n,t[n].initialize({effectName:"internal/builtin-geometry-renderer",technique:n});for(var i=t[n].passes,r=0;r0&&(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,n;this.shadows.destroy(),this.csmLayers.destroy(),this.validPunctualLights.length=0,null==(e=this._occlusionQueryInputAssembler)||e.destroy(),this._occlusionQueryInputAssembler=null,null==(t=this._occlusionQueryVertexBuffer)||t.destroy(),this._occlusionQueryVertexBuffer=null,null==(n=this._occlusionQueryIndicesBuffer)||n.destroy(),this._occlusionQueryIndicesBuffer=null,this._standardSkinMeshRenderer=null,this._standardSkinModel=null,this._skinMaterialModel=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]);this._occlusionQueryVertexBuffer=e.createBuffer(new Cr(10,1,96,12)),this._occlusionQueryVertexBuffer.update(t);var n=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]);this._occlusionQueryIndicesBuffer=e.createBuffer(new Cr(6,1,72,2)),this._occlusionQueryIndicesBuffer.update(n);var i=[new Xr("a_position",32)],r=new Yr(i,[this._occlusionQueryVertexBuffer],this._occlusionQueryIndicesBuffer);return e.createInputAssembler(r)},f(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:"standardSkinModel",get:function(){return this._standardSkinModel},set:function(e){this._standardSkinModel=e}},{key:"standardSkinMeshRenderer",get:function(){return this._standardSkinMeshRenderer},set:function(e){this._standardSkinMeshRenderer&&this._standardSkinMeshRenderer!==e&&this._standardSkinMeshRenderer.clearGlobalStandardSkinObjectFlag(),this._standardSkinMeshRenderer=e,this.standardSkinModel=e?e.model:null}},{key:"skinMaterialModel",get:function(){return this._skinMaterialModel},set:function(e){this._skinMaterialModel=e}},{key:"geometryRendererPasses",get:function(){return this._geometryRendererPasses}},{key:"geometryRendererShaders",get:function(){return this._geometryRendererShaders}}]),e}()),$O=(e("PipelineEventType",{RENDER_FRAME_BEGIN:"render-frame-begin",RENDER_FRAME_END:"render-frame-end",RENDER_CAMERA_BEGIN:"render-camera-begin",RENDER_CAMERA_END:"render-camera-end",ATTACHMENT_SCALE_CAHNGED:"attachment-scale-changed"}),e("PipelineEventProcessor",function(e){function t(){var t;return(t=e.call(this)||this).eventTargetOn=e.prototype.on,t.eventTargetOnce=e.prototype.once,t}p(t,e);var n=t.prototype;return n.on=function(e,t,n,i){return this.eventTargetOn(e,t,n,i)},n.once=function(e,t,n){return this.eventTargetOnce(e,t,n)},t}(Xn))),eB=e("DebugView",function(){function e(){this._singleMode=0,this._compositeModeValue=0,this._lightingWithAlbedo=!0,this._csmLayerColoration=!1,this._activate()}var t=e.prototype;return t.isCompositeModeEnabled=function(e){return!!(this._compositeModeValue&1<Math.abs(t)?e:-t},t}(iB),uB=function(e){function t(t){var n;return(n=e.call(this)||this).up=t.up,n.down=t.down,n.left=t.left,n.right=t.right,n.xAxis=new oB({positive:n.right,negative:n.left}),n.yAxis=new oB({positive:n.up,negative:n.down}),n}return p(t,e),t.prototype.getValue=function(){return new Xu(this.xAxis.getValue(),this.yAxis.getValue())},t}(rB);!function(e){function t(t){var n;return(n=e.call(this)||this).up=t.up,n.down=t.down,n.left=t.left,n.right=t.right,n.forward=t.forward,n.backward=t.backward,n.xAxis=new oB({positive:n.right,negative:n.left}),n.yAxis=new oB({positive:n.up,negative:n.down}),n.zAxis=new oB({positive:n.forward,negative:n.backward}),n}p(t,e),t.prototype.getValue=function(){return new Fo(this.xAxis.getValue(),this.yAxis.getValue(),this.zAxis.getValue())}}(sB);var cB,hB=function(e){function t(){return e.apply(this,arguments)||this}return p(t,e),t.prototype.getValue=function(){return e.prototype.getValue.call(this)},t}(iB),lB=function(e){function t(){return e.apply(this,arguments)||this}return p(t,e),t}(uB),fB=function(e){function t(){return e.apply(this,arguments)||this}return p(t,e),t}(uB),dB=function(e){function t(){return e.apply(this,arguments)||this}return p(t,e),t.prototype.getValue=function(){return e.prototype.getValue.call(this)},t}(aB),pB=function(e){function t(){return e.apply(this,arguments)||this}return p(t,e),t.prototype.getValue=function(){return e.prototype.getValue.call(this)},t}(sB),_B=function(e){function t(){return e.apply(this,arguments)||this}return p(t,e),t.prototype.getValue=function(){return e.prototype.getValue.call(this)},t}(iB),mB="left",gB="right",vB=[];!function(e){e[e.HAND_LEFT=1]="HAND_LEFT",e[e.HAND_RIGHT=4]="HAND_RIGHT",e[e.AIM_LEFT=2]="AIM_LEFT",e[e.AIM_RIGHT=5]="AIM_RIGHT"}(cB||(cB={}));var yB,bB,wB,TB,SB,xB=function(){function e(e){var t;this._deviceId=-1,this._connected=!1,this._webPoseState=((t={})[cB.HAND_LEFT]={position:Fo.ZERO,orientation:fu.IDENTITY},t[cB.HAND_RIGHT]={position:Fo.ZERO,orientation:fu.IDENTITY},t[cB.AIM_LEFT]={position:Fo.ZERO,orientation:fu.IDENTITY},t[cB.AIM_RIGHT]={position:Fo.ZERO,orientation:fu.IDENTITY},t),this._deviceId=e,this._initInputSource()}e._init=function(){ti.hasFeature(Jn.EVENT_GAMEPAD)&&e._registerEvent()},e._on=function(t,n,i){e._eventTarget.on(t,n,i)},e._removeInputDevice=function(t){var n=e.all.findIndex((function(e){return e.deviceId===t}));-1!==n&&pe(e.all,n)},e._getOrCreateInputDevice=function(t,n){var i=e.all.find((function(e){return e.deviceId===t}));return i||(i=new e(t),e.all.push(i)),i._connected=n,i},e._ensureDirectorDefined=function(t){e._intervalId=setInterval((function(){u.director&&u.Director&&(clearInterval(e._intervalId),e._intervalId=-1,t())}),50)},e._updateGamepadCnt=function(){for(var t=0,n=0,i=e._cachedWebGamepads.length;n.01){a=e._getOrCreateInputDevice(r.index,!0);break}}if(a){t.push(a);continue}for(var l=s.axes,f=0;f.01){a=e._getOrCreateInputDevice(r.index,!0);break}}if(a){t.push(a);continue}}}}e._cachedWebGamepads=n}}},e._scanGamepads=function(){vB.length=0,e._scanWebGamepads(vB),e._scanWebXRGamepads(vB);for(var t=0;t0?{negative:0,positive:t}:e<0?{negative:t,positive:0}:{negative:0,positive:0}},t._updateWebPoseState=function(e){e.code!==cB.HAND_LEFT&&e.code!==cB.AIM_LEFT&&e.code!==cB.HAND_RIGHT&&e.code!==cB.AIM_RIGHT||(this._webPoseState[e.code]={position:new Fo(e.position.x,e.position.y,e.position.z),orientation:new fu(e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w)})},t._initInputSource=function(){var t=this;this._buttonNorth=new hB,this._buttonNorth.getValue=function(){if(-1===t.deviceId){var n,i=null==(n=e._getWebXRGamepadMap())?void 0:n.get(mB);return i&&i.buttons.length>5?i.buttons[5].value:0}var r=e._getWebGamepad(t.deviceId);return r?r.buttons[3].value:0},this._buttonEast=new hB,this._buttonEast.getValue=function(){if(-1===t.deviceId){var n,i=null==(n=e._getWebXRGamepadMap())?void 0:n.get(gB);return i&&i.buttons.length>5?i.buttons[5].value:0}var r=e._getWebGamepad(t.deviceId);return r?r.buttons[1].value:0},this._buttonWest=new hB,this._buttonWest.getValue=function(){if(-1===t.deviceId){var n,i=null==(n=e._getWebXRGamepadMap())?void 0:n.get(mB);return i&&i.buttons.length>4?i.buttons[4].value:0}var r=e._getWebGamepad(t.deviceId);return r?r.buttons[2].value:0},this._buttonSouth=new hB,this._buttonSouth.getValue=function(){if(-1===t.deviceId){var n,i=null==(n=e._getWebXRGamepadMap())?void 0:n.get(gB);return i&&i.buttons.length>4?i.buttons[4].value:0}var r=e._getWebGamepad(t.deviceId);return r?r.buttons[0].value:0},this._buttonL1=new hB,this._buttonL1.getValue=function(){var n=e._getWebGamepad(t.deviceId);return n?n.buttons[4].value:0},this._buttonL2=new hB,this._buttonL2.getValue=function(){if(-1===t.deviceId){var n,i=null==(n=e._getWebXRGamepadMap())?void 0:n.get(mB);return i&&i.buttons.length>0?i.buttons[0].value:0}var r=e._getWebGamepad(t.deviceId);return r?r.buttons[6].value:0},this._buttonL3=new hB,this._buttonL3.getValue=function(){if(-1===t.deviceId){var n,i=null==(n=e._getWebXRGamepadMap())?void 0:n.get(mB);if(i){if(i.buttons.length>3&&0!==i.buttons[3].value)return i.buttons[3].value;if(i.buttons.length>2&&0!==i.buttons[2].value)return i.buttons[2].value}return 0}var r=e._getWebGamepad(t.deviceId);return r?r.buttons[10].value:0},this._buttonR1=new hB,this._buttonR1.getValue=function(){var n=e._getWebGamepad(t.deviceId);return n?n.buttons[5].value:0},this._buttonR2=new hB,this._buttonR2.getValue=function(){if(-1===t.deviceId){var n,i=null==(n=e._getWebXRGamepadMap())?void 0:n.get(gB);return i&&i.buttons.length>0?i.buttons[0].value:0}var r=e._getWebGamepad(t.deviceId);return r?r.buttons[7].value:0},this._buttonR3=new hB,this._buttonR3.getValue=function(){if(-1===t.deviceId){var n,i=null==(n=e._getWebXRGamepadMap())?void 0:n.get(gB);if(i){if(i.buttons.length>3&&0!==i.buttons[3].value)return i.buttons[3].value;if(i.buttons.length>2&&0!==i.buttons[2].value)return i.buttons[2].value}return 0}var r=e._getWebGamepad(t.deviceId);return r?r.buttons[11].value:0},this._buttonShare=new hB,this._buttonShare.getValue=function(){var n=e._getWebGamepad(t.deviceId);return n?n.buttons[8].value:0},this._buttonOptions=new hB,this._buttonOptions.getValue=function(){var n=e._getWebGamepad(t.deviceId);return n?n.buttons[9].value:0};var n=new hB;n.getValue=function(){var n=e._getWebGamepad(t.deviceId);return n?n.buttons[12].value:0};var i=new hB;i.getValue=function(){var n=e._getWebGamepad(t.deviceId);return n?n.buttons[13].value:0};var r=new hB;r.getValue=function(){var n=e._getWebGamepad(t.deviceId);return n?n.buttons[14].value:0};var s=new hB;s.getValue=function(){var n=e._getWebGamepad(t.deviceId);return n?n.buttons[15].value:0},this._dpad=new lB({up:n,down:i,left:r,right:s});var a=new hB;a.getValue=function(){if(-1===t.deviceId)return 0;var n=e._getWebGamepad(t.deviceId);return n?t._axisToButtons(n.axes[1]).negative:0};var o=new hB;o.getValue=function(){if(-1===t.deviceId)return 0;var n=e._getWebGamepad(t.deviceId);return n?t._axisToButtons(n.axes[1]).positive:0};var u=new hB;u.getValue=function(){if(-1===t.deviceId)return 0;var n=e._getWebGamepad(t.deviceId);return n?t._axisToButtons(n.axes[0]).negative:0};var c=new hB;c.getValue=function(){if(-1===t.deviceId)return 0;var n=e._getWebGamepad(t.deviceId);return n?t._axisToButtons(n.axes[0]).positive:0},this._leftStick=new fB({up:a,down:o,left:u,right:c});var h=new hB;h.getValue=function(){if(-1===t.deviceId)return 0;var n=e._getWebGamepad(t.deviceId);return n?t._axisToButtons(n.axes[3]).negative:0};var l=new hB;l.getValue=function(){if(-1===t.deviceId)return 0;var n=e._getWebGamepad(t.deviceId);return n?t._axisToButtons(n.axes[3]).positive:0};var f=new hB;f.getValue=function(){if(-1===t.deviceId)return 0;var n=e._getWebGamepad(t.deviceId);return n?t._axisToButtons(n.axes[2]).negative:0};var d=new hB;d.getValue=function(){if(-1===t.deviceId)return 0;var n=e._getWebGamepad(t.deviceId);return n?t._axisToButtons(n.axes[2]).positive:0},this._rightStick=new fB({up:h,down:l,left:f,right:d}),this._buttonStart=new hB,this._buttonStart.getValue=function(){return 0},this._gripLeft=new hB,this._gripLeft.getValue=function(){return t.deviceId,0},this._gripRight=new hB,this._gripRight.getValue=function(){if(-1===t.deviceId){var n,i=null==(n=e._getWebXRGamepadMap())?void 0:n.get(gB);if(i&&i.buttons.length>1)return i.buttons[1].value}return 0},this._handLeftPosition=new pB,this._handLeftPosition.getValue=function(){return t._webPoseState[cB.HAND_LEFT].position},this._handLeftOrientation=new dB,this._handLeftOrientation.getValue=function(){return t._webPoseState[cB.HAND_LEFT].orientation},this._handRightPosition=new pB,this._handRightPosition.getValue=function(){return t._webPoseState[cB.HAND_RIGHT].position},this._handRightOrientation=new dB,this._handRightOrientation.getValue=function(){return t._webPoseState[cB.HAND_RIGHT].orientation},this._aimLeftPosition=new pB,this._aimLeftPosition.getValue=function(){return t._webPoseState[cB.AIM_LEFT].position},this._aimLeftOrientation=new dB,this._aimLeftOrientation.getValue=function(){return t._webPoseState[cB.AIM_LEFT].orientation},this._aimRightPosition=new pB,this._aimRightPosition.getValue=function(){return t._webPoseState[cB.AIM_RIGHT].position},this._aimRightOrientation=new dB,this._aimRightOrientation.getValue=function(){return t._webPoseState[cB.AIM_RIGHT].orientation}},f(e,[{key:"buttonNorth",get:function(){return this._buttonNorth}},{key:"buttonEast",get:function(){return this._buttonEast}},{key:"buttonWest",get:function(){return this._buttonWest}},{key:"buttonSouth",get:function(){return this._buttonSouth}},{key:"buttonL1",get:function(){return this._buttonL1}},{key:"buttonL2",get:function(){return this._buttonL2}},{key:"buttonL3",get:function(){return this._buttonL3}},{key:"buttonR1",get:function(){return this._buttonR1}},{key:"buttonR2",get:function(){return this._buttonR2}},{key:"buttonR3",get:function(){return this._buttonR3}},{key:"buttonShare",get:function(){return this._buttonShare}},{key:"buttonOptions",get:function(){return this._buttonOptions}},{key:"dpad",get:function(){return this._dpad}},{key:"leftStick",get:function(){return this._leftStick}},{key:"rightStick",get:function(){return this._rightStick}},{key:"buttonStart",get:function(){return this._buttonStart}},{key:"gripLeft",get:function(){return this._gripLeft}},{key:"gripRight",get:function(){return this._gripRight}},{key:"handLeftPosition",get:function(){return this._handLeftPosition}},{key:"handLeftOrientation",get:function(){return this._handLeftOrientation}},{key:"handRightPosition",get:function(){return this._handRightPosition}},{key:"handRightOrientation",get:function(){return this._handRightOrientation}},{key:"aimLeftPosition",get:function(){return this._aimLeftPosition}},{key:"aimLeftOrientation",get:function(){return this._aimLeftOrientation}},{key:"aimRightPosition",get:function(){return this._aimRightPosition}},{key:"aimRightOrientation",get:function(){return this._aimRightOrientation}},{key:"deviceId",get:function(){return this._deviceId}},{key:"connected",get:function(){return this._connected}}]),e}();xB.all=[],xB.xr=null,xB._eventTarget=new Xn,xB._cachedWebGamepads=[],xB._cachedWebXRGamepadMap=null,xB._intervalId=-1,xB._totalGamepadCnt=0,function(e){e[e.BUTTON_EAST=0]="BUTTON_EAST",e[e.BUTTON_SOUTH=1]="BUTTON_SOUTH",e[e.BUTTON_WEST=2]="BUTTON_WEST",e[e.BUTTON_NORTH=3]="BUTTON_NORTH",e[e.BUTTON_TRIGGER_LEFT=4]="BUTTON_TRIGGER_LEFT",e[e.BUTTON_TRIGGER_RIGHT=5]="BUTTON_TRIGGER_RIGHT",e[e.TRIGGER_LEFT=6]="TRIGGER_LEFT",e[e.TRIGGER_RIGHT=7]="TRIGGER_RIGHT",e[e.GRIP_LEFT=8]="GRIP_LEFT",e[e.GRIP_RIGHT=9]="GRIP_RIGHT",e[e.BUTTON_LEFT_STICK=10]="BUTTON_LEFT_STICK",e[e.LEFT_STICK_UP=11]="LEFT_STICK_UP",e[e.LEFT_STICK_DOWN=12]="LEFT_STICK_DOWN",e[e.LEFT_STICK_LEFT=13]="LEFT_STICK_LEFT",e[e.LEFT_STICK_RIGHT=14]="LEFT_STICK_RIGHT",e[e.BUTTON_RIGHT_STICK=15]="BUTTON_RIGHT_STICK",e[e.RIGHT_STICK_UP=16]="RIGHT_STICK_UP",e[e.RIGHT_STICK_DOWN=17]="RIGHT_STICK_DOWN",e[e.RIGHT_STICK_LEFT=18]="RIGHT_STICK_LEFT",e[e.RIGHT_STICK_RIGHT=19]="RIGHT_STICK_RIGHT",e[e.ROKID_MENU=20]="ROKID_MENU",e[e.ROKID_START=21]="ROKID_START"}(yB||(yB={})),function(e){e[e.KET_CLICK=0]="KET_CLICK",e[e.KET_STICK=1]="KET_STICK",e[e.KET_GRAB=2]="KET_GRAB",e[e.KET_TOUCH=3]="KET_TOUCH"}(bB||(bB={})),function(e){e[e.UNDEFINE=0]="UNDEFINE",e[e.A=1]="A",e[e.B=2]="B",e[e.X=3]="X",e[e.Y=4]="Y",e[e.L1=5]="L1",e[e.R1=6]="R1",e[e.MINUS=7]="MINUS",e[e.PLUS=8]="PLUS",e[e.L3=9]="L3",e[e.R3=10]="R3",e[e.MENU=11]="MENU",e[e.START=12]="START",e[e.TRIGGER_LEFT=13]="TRIGGER_LEFT",e[e.TRIGGER_RIGHT=14]="TRIGGER_RIGHT"}(wB||(wB={})),function(e){e[e.UNDEFINE=0]="UNDEFINE",e[e.X=1]="X",e[e.Y=2]="Y",e[e.LEFT_STICK_X=3]="LEFT_STICK_X",e[e.LEFT_STICK_Y=4]="LEFT_STICK_Y",e[e.RIGHT_STICK_X=5]="RIGHT_STICK_X",e[e.RIGHT_STICK_Y=6]="RIGHT_STICK_Y",e[e.L2=7]="L2",e[e.R2=8]="R2",e[e.LEFT_GRIP=9]="LEFT_GRIP",e[e.RIGHT_GRIP=10]="RIGHT_GRIP"}(TB||(TB={})),function(e){e[e.UNDEFINE=0]="UNDEFINE",e[e.A=1]="A",e[e.B=2]="B",e[e.X=3]="X",e[e.Y=4]="Y",e[e.LEFT_TRIGGER=5]="LEFT_TRIGGER",e[e.RIGHT_TRIGGER=6]="RIGHT_TRIGGER",e[e.LEFT_THUMBSTICK=7]="LEFT_THUMBSTICK",e[e.RIGHT_THUMBSTICK=8]="RIGHT_THUMBSTICK"}(SB||(SB={}));var EB,IB={1:yB.BUTTON_EAST,2:yB.BUTTON_SOUTH,3:yB.BUTTON_NORTH,4:yB.BUTTON_WEST,9:yB.BUTTON_LEFT_STICK,10:yB.BUTTON_RIGHT_STICK,11:yB.ROKID_MENU,12:yB.ROKID_START,13:yB.BUTTON_TRIGGER_LEFT,14:yB.BUTTON_TRIGGER_RIGHT},AB=function(){function e(){var e,t,n=this;this._eventTarget=new Xn,this._nativeButtonState=((e={})[yB.BUTTON_SOUTH]=0,e[yB.BUTTON_EAST]=0,e[yB.BUTTON_WEST]=0,e[yB.BUTTON_NORTH]=0,e[yB.BUTTON_TRIGGER_LEFT]=0,e[yB.BUTTON_TRIGGER_RIGHT]=0,e[yB.TRIGGER_LEFT]=0,e[yB.TRIGGER_RIGHT]=0,e[yB.GRIP_LEFT]=0,e[yB.GRIP_RIGHT]=0,e[yB.LEFT_STICK_UP]=0,e[yB.LEFT_STICK_DOWN]=0,e[yB.LEFT_STICK_LEFT]=0,e[yB.LEFT_STICK_RIGHT]=0,e[yB.RIGHT_STICK_UP]=0,e[yB.RIGHT_STICK_DOWN]=0,e[yB.RIGHT_STICK_LEFT]=0,e[yB.RIGHT_STICK_RIGHT]=0,e[yB.BUTTON_LEFT_STICK]=0,e[yB.BUTTON_RIGHT_STICK]=0,e[yB.ROKID_MENU]=0,e[yB.ROKID_START]=0,e),this._nativeTouchState=((t={})[SB.UNDEFINE]=0,t[SB.A]=0,t[SB.B]=0,t[SB.X]=0,t[SB.Y]=0,t[SB.LEFT_TRIGGER]=0,t[SB.RIGHT_TRIGGER]=0,t[SB.LEFT_THUMBSTICK]=0,t[SB.RIGHT_THUMBSTICK]=0,t),this._initInputSource(),window.addEventListener("xr-remote-input",(function(e){var t=e,i=t.detail.keyEventType,r=t.detail.stickAxisCode,s=t.detail.stickAxisValue,a=t.detail.stickKeyCode,o=t.detail.isButtonPressed,u=t.detail.touchCode,c=t.detail.touchValue;if(i===bB.KET_CLICK){var h=IB[a];n._nativeButtonState[h]=o?1:0}else if(i===bB.KET_STICK||i===bB.KET_GRAB){var l,f,d;switch(r){case TB.LEFT_STICK_X:l=yB.LEFT_STICK_LEFT,f=yB.LEFT_STICK_RIGHT,d=n._axisToButtons(s);break;case TB.LEFT_STICK_Y:l=yB.LEFT_STICK_DOWN,f=yB.LEFT_STICK_UP,d=n._axisToButtons(s);break;case TB.RIGHT_STICK_X:l=yB.RIGHT_STICK_LEFT,f=yB.RIGHT_STICK_RIGHT,d=n._axisToButtons(s);break;case TB.RIGHT_STICK_Y:l=yB.RIGHT_STICK_DOWN,f=yB.RIGHT_STICK_UP,d=n._axisToButtons(s);break;case TB.L2:n._nativeButtonState[yB.TRIGGER_LEFT]=s;break;case TB.R2:n._nativeButtonState[yB.TRIGGER_RIGHT]=s;break;case TB.LEFT_GRIP:n._nativeButtonState[yB.GRIP_LEFT]=s;break;case TB.RIGHT_GRIP:n._nativeButtonState[yB.GRIP_RIGHT]=s}l&&f&&d&&(n._nativeButtonState[l]=d.negative,n._nativeButtonState[f]=d.positive)}else if(i===bB.KET_TOUCH)switch(u){case SB.A:case SB.B:case SB.X:case SB.Y:case SB.LEFT_TRIGGER:case SB.RIGHT_TRIGGER:case SB.LEFT_THUMBSTICK:case SB.RIGHT_THUMBSTICK:n._nativeTouchState[u]=c}n._eventTarget.emit("handle-input",new hE("handle-input",n))}))}var t=e.prototype;return t._axisToButtons=function(e){var t=Math.abs(e);return e>0?{negative:0,positive:t}:e<0?{negative:t,positive:0}:{negative:0,positive:0}},t._on=function(e,t,n){this._eventTarget.on(e,t,n)},t._initInputSource=function(){var e=this;this._buttonNorth=new hB,this._buttonNorth.getValue=function(){return e._nativeButtonState[yB.BUTTON_NORTH]},this._buttonEast=new hB,this._buttonEast.getValue=function(){return e._nativeButtonState[yB.BUTTON_EAST]},this._buttonWest=new hB,this._buttonWest.getValue=function(){return e._nativeButtonState[yB.BUTTON_WEST]},this._buttonSouth=new hB,this._buttonSouth.getValue=function(){return e._nativeButtonState[yB.BUTTON_SOUTH]},this._buttonTriggerLeft=new hB,this._buttonTriggerLeft.getValue=function(){return e._nativeButtonState[yB.BUTTON_TRIGGER_LEFT]},this._buttonTriggerRight=new hB,this._buttonTriggerRight.getValue=function(){return e._nativeButtonState[yB.BUTTON_TRIGGER_RIGHT]},this._triggerLeft=new hB,this._triggerLeft.getValue=function(){return e._nativeButtonState[yB.TRIGGER_LEFT]},this._triggerRight=new hB,this._triggerRight.getValue=function(){return e._nativeButtonState[yB.TRIGGER_RIGHT]},this._gripLeft=new hB,this._gripLeft.getValue=function(){return e._nativeButtonState[yB.GRIP_LEFT]},this._gripRight=new hB,this._gripRight.getValue=function(){return e._nativeButtonState[yB.GRIP_RIGHT]},this._buttonLeftStick=new hB,this._buttonLeftStick.getValue=function(){return e._nativeButtonState[yB.BUTTON_LEFT_STICK]};var t=new hB;t.getValue=function(){return e._nativeButtonState[yB.LEFT_STICK_UP]};var n=new hB;n.getValue=function(){return e._nativeButtonState[yB.LEFT_STICK_DOWN]};var i=new hB;i.getValue=function(){return e._nativeButtonState[yB.LEFT_STICK_LEFT]};var r=new hB;r.getValue=function(){return e._nativeButtonState[yB.LEFT_STICK_RIGHT]},this._leftStick=new fB({up:t,down:n,left:i,right:r}),this._buttonRightStick=new hB,this._buttonRightStick.getValue=function(){return e._nativeButtonState[yB.BUTTON_RIGHT_STICK]};var s=new hB;s.getValue=function(){return e._nativeButtonState[yB.RIGHT_STICK_UP]};var a=new hB;a.getValue=function(){return e._nativeButtonState[yB.RIGHT_STICK_DOWN]};var o=new hB;o.getValue=function(){return e._nativeButtonState[yB.RIGHT_STICK_LEFT]};var u=new hB;u.getValue=function(){return e._nativeButtonState[yB.RIGHT_STICK_RIGHT]},this._rightStick=new fB({up:s,down:a,left:o,right:u}),this._buttonOptions=new hB,this._buttonOptions.getValue=function(){return e._nativeButtonState[yB.ROKID_MENU]},this._buttonStart=new hB,this._buttonStart.getValue=function(){return e._nativeButtonState[yB.ROKID_START]},this._handLeftPosition=new pB,this._handLeftPosition.getValue=function(){return Fo.ZERO},this._handLeftOrientation=new dB,this._handLeftOrientation.getValue=function(){return fu.IDENTITY},this._handRightPosition=new pB,this._handRightPosition.getValue=function(){return Fo.ZERO},this._handRightOrientation=new dB,this._handRightOrientation.getValue=function(){return fu.IDENTITY},this._aimLeftPosition=new pB,this._aimLeftPosition.getValue=function(){return Fo.ZERO},this._aimLeftOrientation=new dB,this._aimLeftOrientation.getValue=function(){return fu.IDENTITY},this._aimRightPosition=new pB,this._aimRightPosition.getValue=function(){return Fo.ZERO},this._aimRightOrientation=new dB,this._aimRightOrientation.getValue=function(){return fu.IDENTITY},this._touchButtonA=new _B,this._touchButtonA.getValue=function(){return e._nativeTouchState[SB.A]},this._touchButtonB=new _B,this._touchButtonB.getValue=function(){return e._nativeTouchState[SB.B]},this._touchButtonX=new _B,this._touchButtonX.getValue=function(){return e._nativeTouchState[SB.X]},this._touchButtonY=new _B,this._touchButtonY.getValue=function(){return e._nativeTouchState[SB.Y]},this._touchButtonTriggerLeft=new _B,this._touchButtonTriggerLeft.getValue=function(){return e._nativeTouchState[SB.LEFT_TRIGGER]},this._touchButtonTriggerRight=new _B,this._touchButtonTriggerRight.getValue=function(){return e._nativeTouchState[SB.RIGHT_TRIGGER]},this._touchButtonThumbStickLeft=new _B,this._touchButtonThumbStickLeft.getValue=function(){return e._nativeTouchState[SB.LEFT_THUMBSTICK]},this._touchButtonThumbStickRight=new _B,this._touchButtonThumbStickRight.getValue=function(){return e._nativeTouchState[SB.RIGHT_THUMBSTICK]}},f(e,[{key:"buttonNorth",get:function(){return this._buttonNorth}},{key:"buttonEast",get:function(){return this._buttonEast}},{key:"buttonWest",get:function(){return this._buttonWest}},{key:"buttonSouth",get:function(){return this._buttonSouth}},{key:"buttonTriggerLeft",get:function(){return this._buttonTriggerLeft}},{key:"buttonTriggerRight",get:function(){return this._buttonTriggerRight}},{key:"triggerLeft",get:function(){return this._triggerLeft}},{key:"triggerRight",get:function(){return this._triggerRight}},{key:"gripLeft",get:function(){return this._gripLeft}},{key:"gripRight",get:function(){return this._gripRight}},{key:"leftStick",get:function(){return this._leftStick}},{key:"rightStick",get:function(){return this._rightStick}},{key:"buttonLeftStick",get:function(){return this._buttonLeftStick}},{key:"buttonRightStick",get:function(){return this._buttonRightStick}},{key:"buttonOptions",get:function(){return this._buttonOptions}},{key:"buttonStart",get:function(){return this._buttonStart}},{key:"handLeftPosition",get:function(){return this._handLeftPosition}},{key:"handLeftOrientation",get:function(){return this._handLeftOrientation}},{key:"handRightPosition",get:function(){return this._handRightPosition}},{key:"handRightOrientation",get:function(){return this._handRightOrientation}},{key:"aimLeftPosition",get:function(){return this._aimLeftPosition}},{key:"aimLeftOrientation",get:function(){return this._aimLeftOrientation}},{key:"aimRightPosition",get:function(){return this._aimRightPosition}},{key:"aimRightOrientation",get:function(){return this._aimRightOrientation}},{key:"touchButtonA",get:function(){return this._touchButtonA}},{key:"touchButtonB",get:function(){return this._touchButtonB}},{key:"touchButtonX",get:function(){return this._touchButtonX}},{key:"touchButtonY",get:function(){return this._touchButtonY}},{key:"touchButtonTriggerLeft",get:function(){return this._touchButtonTriggerLeft}},{key:"touchButtonTriggerRight",get:function(){return this._touchButtonTriggerRight}},{key:"touchButtonThumbStickLeft",get:function(){return this._touchButtonThumbStickLeft}},{key:"touchButtonThumbStickRight",get:function(){return this._touchButtonThumbStickRight}}]),e}();!function(e){e[e.VIEW_LEFT=0]="VIEW_LEFT",e[e.VIEW_RIGHT=3]="VIEW_RIGHT",e[e.HEAD_MIDDLE=6]="HEAD_MIDDLE"}(EB||(EB={}));var RB,CB=function(){function e(){var e;this._eventTarget=new Xn,this._intervalId=-1,this._webPoseState=((e={})[EB.VIEW_LEFT]={position:Fo.ZERO,orientation:fu.IDENTITY},e[EB.VIEW_RIGHT]={position:Fo.ZERO,orientation:fu.IDENTITY},e[EB.HEAD_MIDDLE]={position:Fo.ZERO,orientation:fu.IDENTITY},e),this._initInputSource(),this._registerEvent()}var t=e.prototype;return t._ensureDirectorDefined=function(){var e=this;return new Promise((function(t){e._intervalId=setInterval((function(){u.director&&u.Director&&(clearInterval(e._intervalId),e._intervalId=-1,t())}),50)}))},t._registerEvent=function(){var e=this;this._ensureDirectorDefined().then((function(){u.director.on(u.Director.EVENT_BEGIN_FRAME,e._scanHmd,e)})).catch((function(){}))},t._scanHmd=function(){var e,t=null==(e=globalThis.__globalXR)?void 0:e.webxrHmdPoseInfos;if(t){for(var n=0;nRt.TOUCH_TIMEOUT&&(j(2302,e.getID()),t.releaseTouch(e.getID()))})),n>=this._touchMap.size},e}()),LB=function(){function e(){this._canvas=void 0,this._eventTarget=new Xn,ti.hasFeature(Jn.INPUT_TOUCH)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||N("failed to access canvas"),this._registerEvent())}var t=e.prototype;return t._registerEvent=function(){var e,t,n,i;null==(e=this._canvas)||e.addEventListener("touchstart",this._createCallback("touch-start")),null==(t=this._canvas)||t.addEventListener("touchmove",this._createCallback("touch-move")),null==(n=this._canvas)||n.addEventListener("touchend",this._createCallback("touch-end")),null==(i=this._canvas)||i.addEventListener("touchcancel",this._createCallback("touch-cancel"))},t._createCallback=function(e){var t=this;return function(n){for(var i,r=t._getCanvasRect(),s=[],a=n.changedTouches.length,o=0;o0){var f=new uE(s,!1,e,FB.getAllTouches());t._eventTarget.emit(e,f)}}},t._getCanvasRect=function(){var e=this._canvas,t=null==e?void 0:e.getBoundingClientRect();return t?new Ju(t.x,t.y,t.width,t.height):new Ju(0,0,0,0)},t._getLocation=function(e,t){var n=e.clientX-t.x,i=t.y+t.height-e.clientY;if(Wh.isFrameRotated){var r=n;n=t.height-i,i=r}var s=Wh.devicePixelRatio;return new Xu(n*=s,i*=s)},t.on=function(e,t,n){this._eventTarget.on(e,t,n)},t.dispatchEventsInCache=function(){},e}(),NB=function(){function e(e){this.priority=0,this._inputEventTarget=e}var t=e.prototype;return t.onThrowException=function(){},t.dispatchEvent=function(e){return this._inputEventTarget.emit(e.type,e),!0},e}(),kB=((RB={})["mouse-down"]="touch-start",RB["mouse-move"]="touch-move",RB["mouse-up"]="touch-end",RB),zB=e("Input",function(){function e(){this._eventTarget=new Xn,this._touchInput=new LB,this._mouseInput=new PB,this._keyboardInput=new DB,this._accelerometerInput=new tB,this._eventKeyboardList=[],this._eventAccelerationList=[],this._eventGamepadList=[],this._eventHandleList=[],this._eventHMDList=[],this._eventHandheldList=[],this._needSimulateTouchMoveEvent=!1,this._eventDispatcherList=[],this._handleInput=new AB,this._hmdInput=new CB,this._handheldInput=new OB,this._registerEvent(),this._inputEventDispatcher=new NB(this._eventTarget),this._registerEventDispatcher(this._inputEventDispatcher),xB._init()}var t=e.prototype;return t._dispatchMouseDownEvent=function(e){var t,n;null==(t=(n=this._mouseInput).dispatchMouseDownEvent)||t.call(n,e)},t._dispatchMouseMoveEvent=function(e){var t,n;null==(t=(n=this._mouseInput).dispatchMouseMoveEvent)||t.call(n,e)},t._dispatchMouseUpEvent=function(e){var t,n;null==(t=(n=this._mouseInput).dispatchMouseUpEvent)||t.call(n,e)},t._dispatchMouseScrollEvent=function(e){var t,n;null==(t=(n=this._mouseInput).dispatchScrollEvent)||t.call(n,e)},t._dispatchKeyboardDownEvent=function(e){var t,n;null==(t=(n=this._keyboardInput).dispatchKeyboardDownEvent)||t.call(n,e)},t._dispatchKeyboardUpEvent=function(e){var t,n;null==(t=(n=this._keyboardInput).dispatchKeyboardUpEvent)||t.call(n,e)},t.on=function(e,t,n){return this._eventTarget.on(e,t,n),t},t.once=function(e,t,n){return this._eventTarget.once(e,t,n),t},t.off=function(e,t,n){this._eventTarget.off(e,t,n)},t.getTouch=function(e){return FB.getTouch(e)},t.getAllTouches=function(){return FB.getAllTouches()},t.getTouchCount=function(){return FB.getTouchCount()},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=kB[e.type],n=FB.getOrCreateTouch(0,e.getLocationX(),e.getLocationY());if(n){var i=[n],r=new uE(i,!1,t,"touch-end"===t?[]:i);r.windowId=e.windowId,"touch-end"===t&&FB.releaseTouch(0),this._dispatchEventTouch(r)}},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,n=0;n>>1;r<=s;a=r+s>>>1){var o=e[a],u=o.constructor._executionOrder;if(u>n)s=a-1;else if(ui)s=a-1;else{if(!(c0&&(e.array.sort(JB),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(JB),this._invoke(t),t.array.length=0)},t}(ZB),eD=function(e){function t(t){return e.call(this,t)||this}p(t,e);var n=t.prototype;return n.add=function(e){var t=e.constructor._executionOrder;if(0===t)this._zero.array.push(e);else{var n=t<0?this._neg.array:this._pos.array,i=KB(n,e);i<0&&n.splice(~i,0,e)}},n.remove=function(e){var t=e.constructor._executionOrder;if(0===t)this._zero.fastRemove(e);else{var n=t<0?this._neg:this._pos,i=KB(n.array,e);i>=0&&n.removeAt(i)}},n.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}(ZB);function tD(e,t,n){var i="var a=it.array;for(it.i=0;it.i=0?XB(this._deferredComps,t):(!e.internalStart||e._objFlags&qB||this.startInvoker.remove(e),e.internalUpdate&&this.updateInvoker.remove(e),e.internalLateUpdate&&this.lateUpdateInvoker.remove(e))},t.enableComp=function(e,t){if(!(e._objFlags&YB)){if(e.internalOnEnable){if(t)return void t.add(e);if(e.internalOnEnable(),!e.node.activeInHierarchy)return}this._onEnabled(e)}},t.disableComp=function(e){e._objFlags&YB&&(e.internalOnDisable&&e.internalOnDisable(),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.internalStart||e._objFlags&qB||this.startInvoker.add(e),"function"==typeof e.internalUpdate&&this.updateInvoker.add(e),"function"==typeof e.internalLateUpdate&&this.lateUpdateInvoker.add(e)},t._deferredSchedule=function(){for(var e=this._deferredComps,t=0,n=e.length;t1)e.push("t="+this._targetExp+";"),t="t";else{if(1!==this._exps.length)return;t=this._targetExp}for(var n=0;n0&&(n=yD+this.globalVariables.join(",")+";");var i=A_(["return (function(R){",n||[],this.codeArray,"return o;","})"]);this.result=Function("O","F",i)(this.objs,this.funcs);for(var r=0,s=this.objsToClear_iN$t.length;r=t.OptimizationPolicyThreshold)?(e=this._doInstantiate(),this.data._instantiate(e)):e=this.data._instantiate(),++this._instantiatedTimes,e},n.initDefault=function(t){e.prototype.initDefault.call(this,t),this.data=new xR,this.data.name="(Missing Node)";var n=new u._PrefabInfo;n.asset=this,n.root=this.data,this.data._prefab=n},n.validate=function(){return!!this.data},n.onLoaded=function(){var e=this.data;wO(e),yO(e)},t}(hv),PD.OptimizationPolicy=LD,PD.OptimizationPolicyThreshold=3,OD=El((CD=PD).prototype,"data",[Yl],(function(){return null})),BD=El(CD.prototype,"optimizationPolicy",[Yl],(function(){return LD.AUTO})),DD=El(CD.prototype,"persistent",[Yl],(function(){return!1})),RD=CD))||RD);function kD(e,t,n){var i=e.o,r=e.d,s=1/r.x,a=1/r.y,o=1/r.z,u=(t.x-i.x)*s,c=(n.x-i.x)*s,h=(t.y-i.y)*a,l=(n.y-i.y)*a,f=(t.z-i.z)*o,d=(n.z-i.z)*o,p=Math.max(Math.max(Math.min(u,c),Math.min(h,l)),Math.min(f,d)),_=Math.min(Math.min(Math.max(u,c),Math.max(h,l)),Math.max(f,d));return _<0||p>_?0:p>0?p:_}Me(ND,"_utils",CO),u.Prefab=ND,Ue(u,"cc._Prefab","Prefab");var zD,UD,GD,VD,HD,WD,jD,XD,qD,YD,KD,QD=(zD=Lh.create(),UD={distance:1/0,doubleSided:!1,mode:2},GD=0,VD=function(e,t,n,i,r,s){1===e?(GD>t||0===GD)&&(GD=t,s&&(0===s.length?s.push({distance:t,vertexIndex0:n/3,vertexIndex1:i/3,vertexIndex2:r/3}):(s[0].distance=t,s[0].vertexIndex0=n/3,s[0].vertexIndex1=i/3,s[0].vertexIndex2=r/3))):(GD=t,s&&s.push({distance:t,vertexIndex0:n/3,vertexIndex1:i/3,vertexIndex2:r/3}))},HD=function(e,t,n,i,r){if(7===n)for(var s=t.length,a=0;ar.distance)&&(VD(r.mode,h,o,u,c,r.result),2===r.mode))return h}else if(8===n)for(var l=t.length-2,f=0,d=0;dr.distance)&&(VD(r.mode,g,p,_,m,r.result),2===r.mode))return g}else if(9===n){var v=t.length-1,y=3*t[0];Fo.set(zD.a,e[y],e[y+1],e[y+2]);for(var b=1;br.distance)&&(VD(r.mode,S,y,w,T,r.result),2===r.mode))return S}}return GD},function(e,t,n){if(GD=0,0===t.geometricInfo.positions.length)return GD;var i=void 0===n?UD:n;if(kD(e,t.geometricInfo.boundingBox.min,t.geometricInfo.boundingBox.max)){var r=t.primitiveMode,s=t.geometricInfo,a=s.positions,o=s.indices;HD(a,o,r,e,i)}return GD}),ZD=function(){var e=0,t={distance:1/0,doubleSided:!1,mode:2};return function(n,i,r){e=0;var s=void 0===r?t:r,a=i.renderingSubMeshes.length,o=i.struct.minPosition,u=i.struct.maxPosition;if(o&&u&&!kD(n,o,u))return e;for(var c=0;cl)&&(e=l,s.subIndices&&(s.subIndices[0]=c));else if(e=l,s.subIndices&&s.subIndices.push(c),2===s.mode)return l}return e&&1===s.mode&&(s.result&&(s.result[0].distance=e,s.result.length=1),s.subIndices&&(s.subIndices.length=1)),e}}(),JD=function(){var e=0,t={distance:1/0,doubleSided:!1,mode:2},n=new mc,i=new Ru;return function(r,s,a){e=0;var o=void 0===a?t:a,u=s.worldBounds;if(u&&!Oh.rayAABB(r,u))return e;mc.copy(n,r),s.node&&(Ru.invert(i,s.node.getWorldMatrix(i)),Fo.transformMat4(n.o,r.o,i),Fo.transformMat4Normal(n.d,r.d,i));for(var c=s.subModels,h=0;hf)&&(e=f,o.subIndices&&(o.subIndices[0]=h));else if(e=f,o.subIndices&&o.subIndices.push(h),2===o.mode)return f}return e&&1===o.mode&&(o.result&&(o.result[0].distance=e,o.result.length=1),o.subIndices&&(o.subIndices.length=1)),e}}();Oh.rayModel=JD,Oh.raySubMesh=QD,Oh.rayMesh=ZD;var $D,eP,tP,nP,iP,rP,sP,aP,oP,uP,cP,hP,lP,fP,dP,pP,_P,mP,gP,vP,yP,bP,wP,TP,SP,xP,EP,IP,AP,RP,CP,OP,BP,DP,PP,MP,FP,LP,NP,kP,zP,UP=Fl("cc.PostProcess")(WD=kl((KD=function(e){function t(){var t;return(t=e.call(this)||this).global=XD&&XD(),t._shadingScale=qD&&qD(),t.enableShadingScaleInEditor=YD&&YD(),t.settings=new Map,t}p(t,e);var n=t.prototype;return n.addSetting=function(e){this.settings.set(e.constructor,e)},n.removeSetting=function(e){this.settings.delete(e.constructor)},n.getSetting=function(e){return this.settings.get(e)},n.onEnable=function(){t.all.push(this)},n.onDisable=function(){var e=t.all.indexOf(this);-1!==e&&t.all.splice(e,1)},f(t,[{key:"shadingScale",get:function(){return this._shadingScale},set:function(e){this._shadingScale=e}}]),t}(ny),KD.all=[],XD=El((jD=KD).prototype,"global",[zl,Yl],(function(){return!0})),qD=El(jD.prototype,"_shadingScale",[Yl],(function(){return 1})),I(jD.prototype,"shadingScale",[zl],Object.getOwnPropertyDescriptor(jD.prototype,"shadingScale"),jD.prototype),YD=El(jD.prototype,"enableShadingScaleInEditor",[zl,Yl],(function(){return!1})),WD=jD))||WD)||WD,GP=new Fo,VP=yt(yg),HP=yt(vg),WP=yt(bg),jP=yt(Tg),XP=yt(wg),qP=yt({SKYBOX:14,SOLID_COLOR:7,DEPTH_ONLY:6,DONT_CLEAR:0}),YP=($D=Fl("cc.Camera"),eP=yf(Y_.BitMask),tP=yf(qP),nP=yf(VP),iP=yf(HP),rP=yf(WP),sP=yf(jP),aP=yf(XP),oP=yf(xx),uP=yf(UP),$D((PP=function(e){function t(){var t;return(t=e.call(this)||this)._projection=lP&&lP(),t._priority=fP&&fP(),t._fov=dP&&dP(),t._fovAxis=pP&&pP(),t._orthoHeight=_P&&_P(),t._near=mP&&mP(),t._far=gP&&gP(),t._color=vP&&vP(),t._depth=yP&&yP(),t._stencil=bP&&bP(),t._clearFlags=wP&&wP(),t._rect=TP&&TP(),t._aperture=SP&&SP(),t._shutter=xP&&xP(),t._iso=EP&&EP(),t._screenScale=IP&&IP(),t._visibility=AP&&AP(),t._targetTexture=RP&&RP(),t._postProcess=CP&&CP(),t._usePostProcess=OP&&OP(),t._camera=null,t._inEditorMode=!1,t._flows=void 0,t._cameraType=BP&&BP(),t._trackingType=DP&&DP(),t}p(t,e);var n=t.prototype;return n.onLoad=function(){this._createCamera()},n.onEnable=function(){this.node.hasChangedFlags|=1,this._camera&&this._attachToScene()},n.onDisable=function(){this._camera&&this._detachFromScene()},n.onDestroy=function(){this._camera&&(this._camera.destroy(),this._camera=null),this._targetTexture&&this._targetTexture.off("resize")},n.screenPointToRay=function(e,t,n){return n||(n=mc.create()),this._camera&&this._camera.screenPointToRay(n,e,t),n},n.worldToScreen=function(e,t){return t||(t=new Fo),this._camera&&this._camera.worldToScreen(t,e),t},n.screenToWorld=function(e,t){return t||(t=this.node.getWorldPosition()),this._camera&&this._camera.screenToWorld(t,e),t},n.convertToUINode=function(e,t,n){if(n||(n=new Fo),!this._camera)return n;this.worldToScreen(e,GP);var i=t.getComponent("cc.UITransform"),r=o.view,s=r.getVisibleSize(),a=GP.x-.5*this._camera.width,u=GP.y-.5*this._camera.height;return GP.x=a/r.getScaleX()+.5*s.width,GP.y=u/r.getScaleY()+.5*s.height,i&&i.convertToNodeSpaceAR(GP,n),n},n._createCamera=function(){this._camera||(this._camera=o.director.root.createCamera(),this._camera.initialize({name:this.node.name,node:this.node,projection:this._projection,window:this._inEditorMode?o.director.root&&o.director.root.mainWindow:o.director.root&&o.director.root.tempWindow,priority:this._priority,cameraType:this.cameraType,trackingType:this.trackingType}),this._camera.setViewportInOrientedSpace(this._rect),this._camera.fovAxis=this._fovAxis,this._camera.fov=Fa(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._camera.postProcess=this._postProcess,this._camera.usePostProcess=this._usePostProcess),this._updateTargetTexture()},n._attachToScene=function(){this.node.scene&&this._camera&&(this._camera&&this._camera.scene&&this._camera.scene.removeCamera(this._camera),this._getRenderScene().addCamera(this._camera))},n._detachFromScene=function(){this._camera&&this._camera.scene&&this._camera.scene.removeCamera(this._camera)},n._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)},n._updateTargetTexture=function(){if(this._camera&&this._targetTexture){var e=this._targetTexture.window;this._camera.changeTargetWindow(e),this._camera.setFixedSize(e.width,e.height)}},f(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,this.fov=0===e?this._fov*this._camera.aspect:this._fov/this._camera.aspect))}},{key:"fov",get:function(){return this._fov},set:function(e){this._fov=e,this._camera&&(this._camera.fov=Fa(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 t=this._targetTexture;this._targetTexture=e,this._checkTargetTextureEvent(t),this._updateTargetTexture(),!e&&this._camera&&(this._camera.changeTargetWindow(null),this._camera.isWindowSize=!0),this.node.emit("tex-change",this)}}},{key:"usePostProcess",get:function(){return this._usePostProcess},set:function(e){this._usePostProcess=e,this._camera&&(this._camera.usePostProcess=e)}},{key:"postProcess",get:function(){return this._postProcess},set:function(e){this._postProcess=e,this._camera&&(this._camera.postProcess=e)}},{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){if(this._inEditorMode=e,this._camera){var t=o.director.root;this._camera.changeTargetWindow(e?t&&t.mainWindow:t&&t.tempWindow)}}},{key:"cameraType",get:function(){return this._cameraType},set:function(e){this._cameraType!==e&&(this._cameraType=e,this.camera&&(this.camera.cameraType=e))}},{key:"trackingType",get:function(){return this._trackingType},set:function(e){this._trackingType!==e&&(this._trackingType=e,this.camera&&(this.camera.trackingType=e))}}]),t}(ny),PP.ProjectionType=VP,PP.FOVAxis=HP,PP.ClearFlag=qP,PP.Aperture=WP,PP.Shutter=jP,PP.ISO=XP,PP.TARGET_TEXTURE_CHANGE="tex-change",lP=El((hP=PP).prototype,"_projection",[Yl],(function(){return VP.PERSPECTIVE})),fP=El(hP.prototype,"_priority",[Yl],(function(){return 0})),dP=El(hP.prototype,"_fov",[Yl],(function(){return 45})),pP=El(hP.prototype,"_fovAxis",[Yl],(function(){return HP.VERTICAL})),_P=El(hP.prototype,"_orthoHeight",[Yl],(function(){return 10})),mP=El(hP.prototype,"_near",[Yl],(function(){return 1})),gP=El(hP.prototype,"_far",[Yl],(function(){return 1e3})),vP=El(hP.prototype,"_color",[Yl],(function(){return new Wo("#333333")})),yP=El(hP.prototype,"_depth",[Yl],(function(){return 1})),bP=El(hP.prototype,"_stencil",[Yl],(function(){return 0})),wP=El(hP.prototype,"_clearFlags",[Yl],(function(){return qP.SOLID_COLOR})),TP=El(hP.prototype,"_rect",[Yl],(function(){return new Ju(0,0,1,1)})),SP=El(hP.prototype,"_aperture",[Yl],(function(){return WP.F16_0})),xP=El(hP.prototype,"_shutter",[Yl],(function(){return jP.D125})),EP=El(hP.prototype,"_iso",[Yl],(function(){return XP.ISO100})),IP=El(hP.prototype,"_screenScale",[Yl],(function(){return 1})),AP=El(hP.prototype,"_visibility",[Yl],(function(){return fg})),RP=El(hP.prototype,"_targetTexture",[Yl],(function(){return null})),CP=El(hP.prototype,"_postProcess",[Yl],(function(){return null})),OP=El(hP.prototype,"_usePostProcess",[Yl],(function(){return!1})),BP=El(hP.prototype,"_cameraType",[Yl],(function(){return-1})),DP=El(hP.prototype,"_trackingType",[Yl],(function(){return 0})),I(hP.prototype,"visibility",[eP],Object.getOwnPropertyDescriptor(hP.prototype,"visibility"),hP.prototype),I(hP.prototype,"clearFlags",[tP],Object.getOwnPropertyDescriptor(hP.prototype,"clearFlags"),hP.prototype),I(hP.prototype,"projection",[nP],Object.getOwnPropertyDescriptor(hP.prototype,"projection"),hP.prototype),I(hP.prototype,"fovAxis",[iP],Object.getOwnPropertyDescriptor(hP.prototype,"fovAxis"),hP.prototype),I(hP.prototype,"aperture",[rP],Object.getOwnPropertyDescriptor(hP.prototype,"aperture"),hP.prototype),I(hP.prototype,"shutter",[sP],Object.getOwnPropertyDescriptor(hP.prototype,"shutter"),hP.prototype),I(hP.prototype,"iso",[aP],Object.getOwnPropertyDescriptor(hP.prototype,"iso"),hP.prototype),I(hP.prototype,"targetTexture",[oP],Object.getOwnPropertyDescriptor(hP.prototype,"targetTexture"),hP.prototype),I(hP.prototype,"usePostProcess",[zl],Object.getOwnPropertyDescriptor(hP.prototype,"usePostProcess"),hP.prototype),I(hP.prototype,"postProcess",[uP],Object.getOwnPropertyDescriptor(hP.prototype,"postProcess"),hP.prototype),cP=hP))||cP);e({Camera:YP,CameraComponent:YP}),o.Camera=YP;var KP,QP,ZP,JP={parent:null,owner:null,subModelIdx:0},$P=kl,eM=yf,tM=e("Renderer",(MP=Fl("cc.Renderer"),FP=eM(ES),LP=eM([ES]),MP(NP=$P((kP=function(e){function t(){var t;return(t=e.call(this)||this)._materials=zP&&zP(),t._materialInstances=[],t}p(t,e);var n=t.prototype;return n.getMaterial=function(e){return this.getSharedMaterial(e)},n.setMaterial=function(e,t){this.setSharedMaterial(e,t)},n.getSharedMaterial=function(e){return e<0||e>=this._materials.length?null:this._materials[e]},n.setSharedMaterial=function(e,t){if(e&&e instanceof jS&&Z(12012),this._materials[t]!==e){this._materials[t]=e;var n=this._materialInstances[t];n&&(n.destroy(),this._materialInstances[t]=null),this._onMaterialModified(t,this._materials[t])}},n.getMaterialInstance=function(e){if(!this._materials[e])return null;if(!this._materialInstances[e]){JP.parent=this._materials[e],JP.owner=this,JP.subModelIdx=e;var t=new jS(JP);JP.parent=null,JP.owner=null,JP.subModelIdx=0,this.setMaterialInstance(t,e)}return this._materialInstances[e]},n.setMaterialInstance=function(e,t){if("number"==typeof e){K(12007);var n=e;e=t,t=n}var i=this._materialInstances[t];e&&e.parent?e!==i&&(this._materialInstances[t]=e,this._onMaterialModified(t,e)):(e!==this._materials[t]||i)&&this.setSharedMaterial(e,t)},n.getRenderMaterial=function(e){return this._materialInstances[e]||this._materials[e]},n._onMaterialModified=function(){},n._onRebuildPSO=function(){},n._clearMaterials=function(){},f(t,[{key:"sharedMaterial",get:function(){return this.getSharedMaterial(0)}},{key:"sharedMaterials",get:function(){return this._materials},set:function(e){for(var t=0;t0)for(var e=0;e1&&(this._fps=this._frameCount,this._frameCount=0,this._fpsTime=0),this._frameMoveBegin(),this._frameMoveProcess(),this._frameMoveEnd()},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;t0){this._device.acquire([D_.swapchain]);var r=this._scenes,s=e.getTotalFrames();this._batcher&&(this._batcher.update(),this._batcher.uploadBuffers());for(var a=0;a0){e.emit(t.EVENT_BEFORE_COMMIT),n.sort((function(e,t){return e.priority-t.priority}));for(var i=0;i0&&(this._fixedFPS=e)}},{key:"dataPoolManager",get:function(){return this._dataPoolMgr}},{key:"useDeferredPipeline",get:function(){return this._useDeferredPipeline}},{key:"cameraList",get:function(){return this._cameraList}}]),e}());o.Root=hM;var lM=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,pe(this._allRenderers,t),e._internalId=-1,e._dirtyVersion===this._dirtyVersion&&(me(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,t=0;t1){var c=Object.create(null);t.forEach((function(e){c[e._uuid]=e})),r={isCompleted:_M,_map:c}}else r=t[0]}n&&n(e,r)}))},t.getXMLHttpRequest=function(){return new XMLHttpRequest},t.getItem=function(e){return tT.assets.has(e)?{content:tT.assets.get(e)}:null},t.loadRes=function(e,t,n,i){var r=this._parseLoadResArgs(t,n,i),s=r.type,a=r.onProgress,o=r.onComplete,u=ai(e);u&&!Zb.getInfoWithPath(e,s)&&(e=e.slice(0,-u.length)),Zb.load(e,s,a,o)},t.loadResArray=function(e,t,n,i){var r=this._parseLoadResArgs(t,n,i),s=r.type,a=r.onProgress,o=r.onComplete;e.forEach((function(t,n){var i=ai(t);i&&!Zb.getInfoWithPath(t,s)&&(e[n]=t.slice(0,-i.length))})),Zb.load(e,s,a,o)},t.loadResDir=function(e,t,n,i){var r=this._parseLoadResArgs(t,n,i),s=r.type,a=r.onProgress,o=r.onComplete;Zb.loadDir(e,s,a,(function(t,n){var i=[];t||(i=Zb.getDirWithPath(e,s).map((function(e){return e.path}))),o&&o(t,n,i)}))},t.getRes=function(e,t){return Mg.has(e)?Mg.get(e):Zb.get(e,t)},t.getResCount=function(){return Mg.count},t.getDependsRecursively=function(e){if(!e)return[];var t="string"==typeof e?e:e._uuid;return sb.getDepsRecursively(t).concat([t])},t.addDownloadHandlers=function(e){var t=Object.create(null),n=function(){var n=e[i];t["."+i]=function(e,t,i){n({url:e},i)}};for(var i in e)n();bw.register(t)},t.addLoadHandlers=function(e){var t=Object.create(null),n=function(){var n=e[i];t["."+i]=function(e,t,i){n({content:e},i)}};for(var i in e)n();Gw.register(t)},t.release=function(e){if(Array.isArray(e))for(var t=0;t0&&t>0){this._updateResolutionPolicy(n);var i=this._resolutionPolicy;i&&i.preApply(this),this._designResolutionSize.width=e,this._designResolutionSize.height=t;var r=i.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}i.postApply(this),AM.width=this._visibleRect.width,AM.height=this._visibleRect.height,Yh.init(this._visibleRect),this.emit("design-resolution-changed")}else Z(2200)},n.getDesignResolutionSize=function(){return new Yu(this._designResolutionSize.width,this._designResolutionSize.height)},n.setRealPixelResolution=function(e,t,n){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,n)},n.getViewportRect=function(){return this._viewportRect},n.getScaleX=function(){return this._scaleX},n.getScaleY=function(){return this._scaleY},n.getDevicePixelRatio=function(){return Wh.devicePixelRatio},n.convertToLocationInView=function(e,t,n,i){void 0===i&&(i=new Xu);var r=Wh.devicePixelRatio*(e-n.left),s=Wh.devicePixelRatio*(n.top+n.height-t);return Wh.isFrameRotated?(i.x=Xh.windowSize.width-s,i.y=r):(i.x=r,i.y=s),i},n._convertToUISpace=function(e){var t=this._viewportRect;e.x=(e.x-t.x)/this._scaleX,e.y=(e.y-t.y)/this._scaleY},n._updateAdaptResult=function(e,t,n){o.director.root.resize(e,t,void 0===n||0===n?1:n);var i=this._designResolutionSize,r=i.width,s=i.height;e>0&&t>0?this.setDesignResolutionSize(r,s,this._resolutionPolicy):z(!1,"_updateAdaptResult Invalid size."),this.emit("canvas-resize"),this._resizeCallback&&this._resizeCallback()},t}(jn(v_));CM.instance=void 0;var OM=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=o.game.canvas;if(e){var t=Xh.windowSize;e.width!==t.width&&(e.width=t.width),e.height!==t.height&&(e.height=t.height)}},e}();OM.EQUAL_TO_FRAME=void 0,OM.PROPORTION_TO_FRAME=void 0;var BM=function(){function e(){this.name="ContentStrategy",this._result={scale:[1,1],viewport:null},this._strategy=zM.UNKNOWN}var t=e.prototype;return t.preApply=function(){},t.apply=function(){return{scale:[1,1]}},t.postApply=function(){},t._buildResult=function(e,t,n,i,r,s){Math.abs(e-n)<2&&(n=e),Math.abs(t-i)<2&&(i=t);var a=new Ju(Math.round((e-n)/2),Math.round((t-i)/2),n,i),o=this._result;return o.scale=[r,s],o.viewport=a,o},f(e,[{key:"strategy",get:function(){return this._strategy}}]),e}(),DM=function(e){function t(){var t;return(t=e.call(this)||this).name="EqualToFrame",t}return p(t,e),t.prototype.apply=function(){Wh.isProportionalToFrame=!1,this._setupCanvas()},t}(OM),PM=function(e){function t(){var t;return(t=e.call(this)||this).name="ProportionalToFrame",t}return p(t,e),t.prototype.apply=function(){Wh.isProportionalToFrame=!0,this._setupCanvas()},t}(OM);OM.EQUAL_TO_FRAME=new DM,OM.PROPORTION_TO_FRAME=new PM;var MM=function(e){function t(){var t;return(t=e.call(this)||this).name="ExactFit",t._strategy=zM.EXACT_FIT,t}return p(t,e),t.prototype.apply=function(e,t){var n=Xh.windowSize,i=n.width,r=n.height,s=i/t.width,a=r/t.height;return this._buildResult(i,r,i,r,s,a)},t}(BM),FM=function(e){function t(){var t;return(t=e.call(this)||this).name="ShowAll",t._strategy=zM.SHOW_ALL,t}return p(t,e),t.prototype.apply=function(e,t){var n,i,r=Xh.windowSize,s=r.width,a=r.height,o=t.width,u=t.height,c=s/o,h=a/u,l=0;return ct){var r=i;i=n,n=r}this.scaleSize=e/t>16/9?t/i:e/n},e.update=function(e){var t=this.settings,n=this.device,i=this.swapchain,r=n.capabilities;Ru.ortho(this.projection,-1,1,-1,1,-1,1,r.clipSpaceMinZ,r.clipSpaceSignY,i.surfaceTransform);var s=i.width,a=i.height;this.initScale(),this._curTime+=1e3*e;var o=Hf(Pa(this._curTime/t.totalTime)),u=1,c=1,h=this.bgImage;if("custom"===t.background.type){t.policy===zM.FIXED_WIDTH?(u=s,c=s/h.width*h.height):t.policy===zM.FIXED_HEIGHT?(u=a/h.height*h.width,c=a):t.policy===zM.SHOW_ALL?h.width/this.bgHeight>s/a?(u=s,c=s/h.width*h.height):(u=a/h.height*h.width,c=a):t.policy===zM.NO_BORDER?h.width/h.height>s/a?(u=a/h.height*h.width,c=a):(u=s,c=s/h.width*h.height):(u=s,c=a);var l=this.bgMat;VM(l,"resolution",GM.set(s,a),0),VM(l,"scale",GM.set(u,c),0),VM(l,"translate",GM.set(.5*s,.5*a),0),VM(l,"percent",1),VM(l,"u_projection",this.projection),l.passes[0].update()}var f=a*this.logoYTrans;if("none"!==this.settings.logo.type){c=.185*a*t.displayRatio,u=this.logoWidth*(.185*a/this.logoHeight)*t.displayRatio;var d=this.logoMat;VM(d,"resolution",GM.set(s,a),0),VM(d,"scale",GM.set(u,c),0),VM(d,"translate",GM.set(s*this.logoXTrans,f),0),VM(d,"percent",o),VM(d,"u_projection",this.projection),d.passes[0].update()}if("default"===this.settings.logo.type&&this.watermarkMat){var p=this.watermarkTexture.width,_=this.watermarkTexture.height;u=p,c=_;var m=f-(.5*this.logoHeight*t.displayRatio+this.textYExtraTrans)*this.scaleSize-.5*_,g=this.watermarkMat;VM(g,"resolution",GM.set(s,a),0),VM(g,"scale",GM.set(u,c),0),VM(g,"translate",GM.set(s*this.textXTrans,m),0),VM(g,"percent",o),VM(g,"u_projection",this.projection),g.passes[0].update()}this.frame()},e.initBG=function(){var e=this.device;this.bgMat=new ES,this.bgMat.initialize({effectName:"util/splash-screen"});var t=new Lr;t.addressU=2,t.addressV=2,t.addressW=2,this.sampler=e.getSampler(t),this.bgTexture=e.createTexture(new Mr(1,6,35,this.bgImage.width,this.bgImage.height));var n=this.bgMat.passes[0],i=n.getBinding("mainTexture");n.bindTexture(i,this.bgTexture),this.shader=n.getShaderVariant();var r=n.descriptorSet;r.bindSampler(i,this.sampler),r.update();var s=new wr,a=s.texExtent;a.width=this.bgImage.width,a.height=this.bgImage.height,a.depth=1,e.copyTexImagesToTexture([this.bgImage],this.bgTexture,[s])},e.initLogo=function(){var e=this.device;this.logoMat=new ES,this.logoMat.initialize({effectName:"util/splash-screen"});var t=new Lr;t.addressU=2,t.addressV=2,t.addressW=2,this.sampler=e.getSampler(t),this.logoTexture=e.createTexture(new Mr(1,6,35,this.logoImage.width,this.logoImage.height));var n=this.logoMat.passes[0],i=n.getBinding("mainTexture");n.bindTexture(i,this.logoTexture),this.shader=n.getShaderVariant();var r=n.descriptorSet;r.bindSampler(i,this.sampler),r.update();var s=new wr,a=s.texExtent;a.width=this.logoImage.width,a.height=this.logoImage.height,a.depth=1,e.copyTexImagesToTexture([this.logoImage],this.logoTexture,[s]);var o=this.logoImage.width/this.logoImage.height;o<1?(this.logoWidth=this.logoWidthTemp,this.logoHeight=this.logoWidthTemp/o):(this.logoWidth=this.logoHeightTemp*o,this.logoHeight=this.logoHeightTemp)},e.initWaterMark=function(){var e=h.document.createElement("canvas");e.height=this.textHeight*this.scaleSize,e.style.width=""+e.width,e.style.height=""+e.height;var t="Created with Cocos",n=e.getContext("2d");n.font=this.textSize*this.scaleSize+"px Arial",n.textBaseline="top",n.textAlign="center",n.fillStyle="#707070";var i=n.measureText(t).width+10;e.width=i,n.font=this.textSize*this.scaleSize+"px Arial",n.textBaseline="top",n.textAlign="center",n.fillStyle="#707070",n.fillText(t,e.width/2,0);var r=new wr,s=r.texExtent;s.width=e.width,s.height=e.height,s.depth=1,this.watermarkTexture=this.device.createTexture(new Mr(1,6,35,e.width,e.height)),this.device.copyTexImagesToTexture([e],this.watermarkTexture,[r]),this.watermarkMat=new ES,this.watermarkMat.initialize({effectName:"util/splash-screen"});var a=this.watermarkMat.passes[0],o=a.getBinding("mainTexture");a.bindTexture(o,this.watermarkTexture),a.descriptorSet.update()},e.frame=function(){var e=this.device,t=this.swapchain;this.projection;var n=this.bgMat,i=this.logoMat,r=this.watermarkMat,s=this.settings,a=this.quadAssmebler;if(e.capabilities,!qh.isXR||xr.entry.isRenderAllowable())for(var c=qh.isXR?2:1,h=0;h=this.settings.totalTime}},{key:"curTime",get:function(){return this._curTime},set:function(e){this._curTime=e}}],[{key:"instance",get:function(){return t._ins}}]),t}();HM._ins=null,o.internal.SplashScreen=HM;var WM=new(function(){function e(){this._data=null}return e.prototype.init=function(e){var t=this;return void 0===e&&(e=""),u.rendering&&u.rendering.enableEffectImport&&e?new Promise((function(n,i){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="arraybuffer",r.onload=function(){t._data=r.response,n()},r.onerror=function(){i(new Error("request effect settings failed!"))},r.send(null)})):Promise.resolve()},f(e,[{key:"data",get:function(){return this._data}}]),e}());u.effectSettings=WM;var jM=At.querySettings.bind(At),XM=e("Game",function(e){function n(){var t;return(t=e.call(this)||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._pausedByEngine=!1,t._frameRate=60,t._pacer=null,t._initTime=0,t._startTime=0,t._deltaTime=0,t._useFixedDeltaTime=!1,t._shouldLoadLaunchScene=!0,t.onPreBaseInitDelegate=new $n,t.onPostBaseInitDelegate=new $n,t.onPreInfrastructureInitDelegate=new $n,t.onPostInfrastructureInitDelegate=new $n,t.onPreSubsystemInitDelegate=new $n,t.onPostSubsystemInitDelegate=new $n,t.onPreProjectInitDelegate=new $n,t.onPostProjectInitDelegate=new $n,t}p(n,e);var i=n.prototype;return i.setFrameRate=function(e){this.frameRate=e},i.getFrameRate=function(){return this.frameRate},i.step=function(){xM.tick(this._calculateDT(!0))},i.pauseByEngine=function(){this._paused||(this._pausedByEngine=!0,this.pause())},i.resumeByEngine=function(){this._pausedByEngine&&(this.resume(),this._pausedByEngine=!1)},i.pause=function(){var e;this._paused||(this._paused=!0,null==(e=this._pacer)||e.stop(),this.emit(n.EVENT_PAUSE))},i.resume=function(){var e;this._paused&&(UB._clearEvents(),this._paused=!1,null==(e=this._pacer)||e.start(),this.emit(n.EVENT_RESUME))},i.isPaused=function(){return this._paused},i.restart=function(){var e=this;return new Promise((function(e){xM.once("director_end_frame",(function(){return e()}))})).then((function(){xM.reset(),o.Object._deferredDestroy(),e.pause(),e.resume(),e._shouldLoadLaunchScene=!0})).then((function(){return HM.createInstance().init()})).then((function(){e._safeEmit(n.EVENT_RESTART)}))},i.end=function(){ti.close()},i.on=function(e,t,n,i){return this.canRegisterEvent(e)&&t.call(n),this.eventTargetOn(e,t,n,i)},i.once=function(e,t,n){return this.canRegisterEvent(e)?t.call(n):this.eventTargetOnce(e,t,n)},i.canRegisterEvent=function(e){return this._engineInited&&e===n.EVENT_ENGINE_INITED||this._inited&&e===n.EVENT_GAME_INITED||this._rendererInitialized&&e===n.EVENT_RENDERER_INITED},i.init=function(e){var i=this;return this._compatibleWithOldParams(e),Promise.resolve().then((function(){return i.emit(n.EVENT_PRE_BASE_INIT),i.onPreBaseInitDelegate.dispatch()})).then((function(){G(e.debugMode||0)})).then((function(){return qh.init()})).then((function(){i._initEvents()})).then((function(){return At.init(e.settingsPath,e.overrideSettings)})).then((function(){return i.emit(n.EVENT_POST_BASE_INIT),i.onPostBaseInitDelegate.dispatch()})).then((function(){return i.emit(n.EVENT_PRE_INFRASTRUCTURE_INIT),i.onPreInfrastructureInitDelegate.dispatch()})).then((function(){Rt.init(),i._initXR();var e={frame:document.querySelector("#GameDiv"),container:document.querySelector("#Cocos3dGameContainer"),canvas:document.querySelector("#GameCanvas")};return i.canvas=e.canvas,i.frame=e.frame,i.container=e.container,Xh.init(),mi.init(),D_.init(i.canvas,tm)})).then((function(){if(jM("rendering","customPipeline")){if(!o.rendering)return void Z(12109);Rt.CUSTOM_PIPELINE_NAME||(Rt.CUSTOM_PIPELINE_NAME="Builtin")}else o.rendering=void 0;tT.init(),aT.init(),Y_.init(),i.initPacer()})).then((function(){return i.emit(n.EVENT_POST_INFRASTRUCTURE_INIT),i.onPostInfrastructureInitDelegate.dispatch()})).then((function(){return i.emit(n.EVENT_PRE_SUBSYSTEM_INIT),i.onPreSubsystemInitDelegate.dispatch()})).then((function(){return WM.init(jM("rendering","effectSettingsPath"))})).then((function(){if(o.rendering&&o.rendering.enableEffectImport)if(3!==jM("rendering","renderMode")){var e=WM.data;null!==e?o.rendering.init(D_.gfxDevice,e):Z(1102)}else o.rendering.init(D_.gfxDevice,null)})).then((function(){var e=jM("scripting","scriptPackages");return e?Promise.all(e.map((function(e){return t.import(e)}))):Promise.resolve([])})).then((function(){return xM.init(),aT.loadBuiltinAssets()})).then((function(){return i.emit(n.EVENT_POST_SUBSYSTEM_INIT),i.onPostSubsystemInitDelegate.dispatch()})).then((function(){L("Cocos Creator v"+c),i.emit(n.EVENT_ENGINE_INITED),i._engineInited=!0})).then((function(){return i.emit(n.EVENT_PRE_PROJECT_INIT),i.onPreProjectInitDelegate.dispatch()})).then((function(){var e=jM("plugins","jsList"),t=Promise.resolve();return e&&e.forEach((function(e){t=t.then((function(){return t="src/"+e,new Promise((function(e,n){var i;function r(e){e.filename===t&&(i=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),n(Error("Error loading "+t))})),s.addEventListener("load",(function(){window.removeEventListener("error",r),document.head.removeChild(s),i?n(i):e()})),s.src=t.replace("#","%23"),document.head.appendChild(s)}));var t}))})),t})).then((function(){return i._loadProjectBundles()})).then((function(){return i._loadCCEScripts()})).then((function(){return i._setupRenderPipeline()})).then((function(){return i._loadPreloadAssets()})).then((function(){return aT.compileBuiltinMaterial(),HM.createInstance().init()})).then((function(){return i.emit(n.EVENT_POST_PROJECT_INIT),i.onPostProjectInitDelegate.dispatch()})).then((function(){i._inited=!0,i._safeEmit(n.EVENT_GAME_INITED)}))},i._initXR=function(){},i._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)},i._loadPreloadAssets=function(){var e=jM("assets","preloadAssets");return e?Promise.all(e.map((function(e){return new Promise((function(t,n){tT.loadAny(e,(function(e){e?n(e):t()}))}))}))):Promise.resolve([])},i._loadCCEScripts=function(){return new Promise((function(e){e()}))},i._loadProjectBundles=function(){var e=jM("assets","preloadBundles");return e?Promise.all(e.map((function(e){var t=e.bundle,n=e.version;return new Promise((function(e,i){var r={};n&&(r.version=n),tT.loadBundle(t,r,(function(t){t?i(t):e()}))}))}))):Promise.resolve([])},i.run=function(e){e&&(this.onStart=e),this._inited&&this.resume()},i._calculateDT=function(e){if(this._useFixedDeltaTime=e,e)return this._startTime=performance.now(),this.frameTime/1e3;var t=performance.now();return this._deltaTime=t>this._startTime?(t-this._startTime)/1e3:0,this._deltaTime>n.DEBUG_DT_THRESHOLD&&(this._deltaTime=this.frameTime/1e3),this._startTime=t,this._deltaTime},i._updateCallback=function(){var e=this;if(this._inited)if(HM.instance&&!HM.instance.isFinished)HM.instance.update(this._calculateDT(!1));else if(this._shouldLoadLaunchScene){HM.releaseInstance(),this._shouldLoadLaunchScene=!1;var t,n=jM("launch","launchScene");n?xM.loadScene(n,(function(){j(1103,n),e._initTime=performance.now(),xM.startAnimation(),null==e.onStart||e.onStart()})):(this._initTime=performance.now(),xM.startAnimation(),null==(t=this.onStart)||t.call(this))}else xM.tick(this._calculateDT(!1))},i.initPacer=function(){var e,t=null!==(e=jM("screen","frameRate"))&&void 0!==e?e:60;z("number"==typeof t),this._pacer=new IM,this._pacer.onTick=this._updateCallback.bind(this),this.frameRate=t},i._initEvents=function(){ti.on("show",this._onShow,this),ti.on("hide",this._onHide,this),ti.on("close",this._onClose,this)},i._onHide=function(){this.emit(n.EVENT_HIDE),this.pauseByEngine()},i._onShow=function(){this.emit(n.EVENT_SHOW),this.resumeByEngine()},i._onClose=function(){this.emit(n.EVENT_CLOSE),ti.exit()},i.addPersistRootNode=function(e){xM.addPersistRootNode(e)},i.removePersistRootNode=function(e){xM.removePersistRootNode(e)},i.isPersistRootNode=function(e){return xM.isPersistRootNode(e)},i._setupRenderPipeline=function(){var e=jM("rendering","customPipeline");return this._setRenderPipeline(!!e)},i._setRenderPipeline=function(e){xM.root.setRenderPipeline(e)?(this._rendererInitialized=!0,this._safeEmit(n.EVENT_RENDERER_INITED)):Z(1222)},i._safeEmit=function(e){this.emit(e)},f(n,[{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._useFixedDeltaTime?this.frameTime/1e3:this._deltaTime}},{key:"totalTime",get:function(){return performance.now()-this._initTime}},{key:"frameStartTime",get:function(){return this._startTime}}]),n}(Xn));XM.EVENT_HIDE="game_on_hide",XM.EVENT_SHOW="game_on_show",XM.EVENT_LOW_MEMORY="game_on_low_memory",XM.EVENT_GAME_INITED="game_inited",XM.EVENT_ENGINE_INITED="engine_inited",XM.EVENT_RENDERER_INITED="renderer_inited",XM.EVENT_PRE_BASE_INIT="pre_base_init",XM.EVENT_POST_BASE_INIT="post_base_init",XM.EVENT_PRE_INFRASTRUCTURE_INIT="pre_infrastructure_init",XM.EVENT_POST_INFRASTRUCTURE_INIT="post_infrastructure_init",XM.EVENT_PRE_SUBSYSTEM_INIT="pre_subsystem_init",XM.EVENT_POST_SUBSYSTEM_INIT="post_subsystem_init",XM.EVENT_PRE_PROJECT_INIT="pre_project_init",XM.EVENT_POST_PROJECT_INIT="post_project_init",XM.EVENT_RESTART="game_on_restart",XM.EVENT_PAUSE="game_on_pause",XM.EVENT_RESUME="game_on_resume",XM.EVENT_CLOSE="game_on_close",XM.RENDER_TYPE_CANVAS=0,XM.RENDER_TYPE_WEBGL=1,XM.RENDER_TYPE_OPENGL=2,XM.RENDER_TYPE_HEADLESS=3,XM.DEBUG_DT_THRESHOLD=1,o.Game=XM;var qM=e("game",o.game=new XM);la(SM.prototype,"director",[{name:"calculateDeltaTime"},{name:"getDeltaTime",suggest:"Use game.deltaTime instead"},{name:"getTotalTime",suggest:"Use game.totalTime instead"},{name:"getCurrentTime",suggest:"Use game.frameStartTime instead"}]),ha(SM.prototype,"director",[{name:"setAnimationInterval",suggest:"please use game.frameRate instead"},{name:"getAnimationInterval",suggest:"please use game.frameRate instead"},{name:"getRunningScene",suggest:"please use getScene instead"},{name:"setDepthTest",suggest:"please use camera API instead"},{name:"setClearColor",suggest:"please use camera API instead"},{name:"getWinSize",suggest:"please use view.getVisibleSize instead"},{name:"getWinSizeInPixels"},{name:"purgeCachedData",suggest:"please use assetManager.releaseAll instead"},{name:"convertToGL"},{name:"convertToUI"}]),ca(xM,"director",[{name:"_getSceneUuid",targetName:"assetManager.main",newName:"getSceneInfo",customFunction:function(e){var t;return tT.main?null==(t=tT.main.getSceneInfo(e))?void 0:t.uuid:""}}]),la(qM,"game",[{name:"collisionMatrix"},{name:"groupList"}]),ca(qM,"game",[{name:"_sceneInfos",targetName:"assetManager.main",newName:"getSceneInfo",customGetter:function(){var e=[];return tT.main&&tT.main.config.scenes.forEach((function(t){e.push(t)})),e}}]);var YM=1,KM=-4192741,QM=[];function ZM(e){return"function"==typeof e._instantiate}function JM(e){var t;if(Ln(e)){if(ZM(e))return o.game._isCloning=!0,t=e._instantiate(null,!0),o.game._isCloning=!1,t;if(e instanceof o.Asset)throw new TypeError(te(6903))}return o.game._isCloning=!0,t=$M(e),o.game._isCloning=!1,t}function $M(e,t){var n;tF(e,n=e._iN$t?e._iN$t:e.constructor?new(0,e.constructor):Object.create(null),t);for(var i=0,r=QM.length;i0&&(e.extensions.useVAO&&i.glVAO&&(e.extensions.OES_vertex_array_object.bindVertexArrayOES(null),i.glVAO=null),PF.gpuInputAssembler=null,i.glArrayBuffer!==t.glBuffer&&(n.bindBuffer(34962,t.glBuffer),i.glArrayBuffer=t.glBuffer),n.bufferData(34962,t.size,r),n.bindBuffer(34962,null),i.glArrayBuffer=null))}else if(4&t.usage){t.glTarget=34963;var a=n.createBuffer();a&&(t.glBuffer=a,t.size>0&&(e.extensions.useVAO&&i.glVAO&&(e.extensions.OES_vertex_array_object.bindVertexArrayOES(null),i.glVAO=null),PF.gpuInputAssembler=null,i.glElementArrayBuffer!==t.glBuffer&&(n.bindBuffer(34963,t.glBuffer),i.glElementArrayBuffer=t.glBuffer),n.bufferData(34963,t.size,r),n.bindBuffer(34963,null),i.glElementArrayBuffer=null))}else 16&t.usage?(t.glTarget=0,t.buffer&&(t.vf32=new Float32Array(t.buffer.buffer))):(64&t.usage||2&t.usage||1&t.usage||Z(16315),t.glTarget=0)}function SF(e,t){var n=e.gl,i=e.stateCache;if(t.glBuffer){switch(t.glTarget){case 34962:e.extensions.useVAO&&i.glVAO&&(e.extensions.OES_vertex_array_object.bindVertexArrayOES(null),i.glVAO=null),PF.gpuInputAssembler=null,n.bindBuffer(34962,null),i.glArrayBuffer=null;break;case 34963:e.extensions.useVAO&&i.glVAO&&(e.extensions.OES_vertex_array_object.bindVertexArrayOES(null),i.glVAO=null),PF.gpuInputAssembler=null,n.bindBuffer(34963,null),i.glElementArrayBuffer=null}n.deleteBuffer(t.glBuffer),t.glBuffer=null}}function xF(e,t,n,i,r){if(16&t.usage)ArrayBuffer.isView(n)?t.vf32.set(n,i/4):t.vf32.set(new Float32Array(n),i/4);else if(64&t.usage){t.indirects.clearDraws();for(var s=n.drawInfos,a=0;ae.capabilities.maxTextureSize&&Z(9100,a,e.capabilities.maxTextureSize),e.textureExclusive[t.format]||e.extensions.WEBGL_depth_texture||!Ts[t.format].hasDepth){if(t.glTexture=n.createTexture(),t.size>0){var o=i.glTexUnits[i.texUnit];if(o.glTexture!==t.glTexture&&(n.bindTexture(3553,t.glTexture),o.glTexture=t.glTexture),Ts[t.format].isCompressed)for(var u=0;u>1),s=uF(1,s>>1)}else for(var l=0;l>1),s=uF(1,s>>1);t.isPowerOf2?(t.glWrapS=10497,t.glWrapT=10497):(t.glWrapS=33071,t.glWrapT=33071),t.glMinFilter=9729,t.glMagFilter=9729,n.texParameteri(t.glTarget,10242,t.glWrapS),n.texParameteri(t.glTarget,10243,t.glWrapT),n.texParameteri(t.glTarget,10241,t.glMinFilter),n.texParameteri(t.glTarget,10240,t.glMagFilter)}}else t.glInternalFmt=lF(t.format),t.glRenderbuffer=n.createRenderbuffer(),t.size>0&&(i.glRenderbuffer!==t.glRenderbuffer&&(n.bindRenderbuffer(36161,t.glRenderbuffer),i.glRenderbuffer=t.glRenderbuffer),n.renderbufferStorage(36161,t.glInternalFmt,r,s));break;case 3:t.glTarget=34067;var f=uF(r,s);if(f>e.capabilities.maxCubeMapTextureSize&&Z(9100,f,e.capabilities.maxTextureSize),t.glTexture=n.createTexture(),t.size>0){var d=i.glTexUnits[i.texUnit];if(d.glTexture!==t.glTexture&&(n.bindTexture(34067,t.glTexture),d.glTexture=t.glTexture),Ts[t.format].isCompressed)for(var p=0;p<6;++p){r=t.width,s=t.height;for(var _=0;_>1),s=uF(1,s>>1)}}else for(var v=0;v<6;++v){r=t.width,s=t.height;for(var y=0;y>1),s=uF(1,s>>1)}t.isPowerOf2?(t.glWrapS=10497,t.glWrapT=10497):(t.glWrapS=33071,t.glWrapT=33071),t.glMinFilter=9729,t.glMagFilter=9729,n.texParameteri(t.glTarget,10242,t.glWrapS),n.texParameteri(t.glTarget,10243,t.glWrapT),n.texParameteri(t.glTarget,10241,t.glMinFilter),n.texParameteri(t.glTarget,10240,t.glMagFilter)}break;default:Z(16317),t.type=1,t.glTarget=3553}}function IF(e,t){var n=e.gl,i=e.stateCache;if(t.glTexture){var r=i.glTexUnits,s=i.texUnit;n.deleteTexture(t.glTexture);for(var a=0;ae.capabilities.maxTextureSize&&Z(9100,a,e.capabilities.maxTextureSize),t.glRenderbuffer)i.glRenderbuffer!==t.glRenderbuffer&&(n.bindRenderbuffer(36161,t.glRenderbuffer),i.glRenderbuffer=t.glRenderbuffer),n.renderbufferStorage(36161,t.glInternalFmt,r,s);else if(t.glTexture){var o=i.glTexUnits[i.texUnit];if(o.glTexture!==t.glTexture&&(n.bindTexture(3553,t.glTexture),o.glTexture=t.glTexture),Ts[t.format].isCompressed)for(var u=0;u>1),s=uF(1,s>>1)}else for(var l=0;l>1),s=uF(1,s>>1)}break;case 3:t.glTarget=34067;var f=uF(r,s);f>e.capabilities.maxCubeMapTextureSize&&Z(9100,f,e.capabilities.maxTextureSize);var d=i.glTexUnits[i.texUnit];if(d.glTexture!==t.glTexture&&(n.bindTexture(34067,t.glTexture),d.glTexture=t.glTexture),Ts[t.format].isCompressed)for(var p=0;p<6;++p){r=t.width,s=t.height;for(var _=0;_>1),s=uF(1,s>>1)}}else for(var v=0;v<6;++v){r=t.width,s=t.height;for(var y=0;y>1),s=uF(1,s>>1)}break;default:Z(16317),t.type=1,t.glTarget=3553}}}function RF(e,t){for(var n=0;n0){t.glBlocks=new Array(t.blocks.length);for(var x=0;x0){t.glSamplerTextures=new Array(t.samplerTextures.length);for(var M=0;M=0&&A.gpuDescriptors[R],O=null,B=0;if(C&&C.gpuBuffer){var D=C.gpuBuffer,P=x[I.set],M=P&&P[I.binding];M>=0&&(B=r[M]),"vf32"in D?O=D.vf32:(B+=D.offset,O=D.gpuBuffer.vf32),B>>=2}if(O)for(var F=I.glActiveUniforms.length,L=0;L=0&&Be.gpuDescriptors[De],Me=Oe.units.length,Fe=0;Fe0){var Ne=Pe.gpuTexture,ke=h.glTexUnits[Le];ke.glTexture!==Ne.glTexture&&(h.texUnit!==Le&&(c.activeTexture(33984+Le),h.texUnit=Le),Ne.glTexture?c.bindTexture(Ne.glTarget,Ne.glTexture):c.bindTexture(Ne.glTarget,e.nullTex2D.gpuTexture.glTexture),ke.glTexture=Ne.glTexture);var ze=Pe.gpuSampler;Ne.isPowerOf2?(a=ze.glWrapS,o=ze.glWrapT):(a=33071,o=33071),u=Ne.isPowerOf2?Ne.mipLevel<=1&&(9985===ze.glMinFilter||9987===ze.glMinFilter)?9729:ze.glMinFilter:9729===ze.glMinFilter||9985===ze.glMinFilter||9987===ze.glMinFilter?9729:9728,Ne.glWrapS!==a&&(h.texUnit!==Le&&(c.activeTexture(33984+Le),h.texUnit=Le),c.texParameteri(Ne.glTarget,10242,a),Ne.glWrapS=a),Ne.glWrapT!==o&&(h.texUnit!==Le&&(c.activeTexture(33984+Le),h.texUnit=Le),c.texParameteri(Ne.glTarget,10243,o),Ne.glWrapT=o),Ne.glMinFilter!==u&&(h.texUnit!==Le&&(c.activeTexture(33984+Le),h.texUnit=Le),c.texParameteri(Ne.glTarget,10241,u),Ne.glMinFilter=u),Ne.glMagFilter!==ze.glMagFilter&&(h.texUnit!==Le&&(c.activeTexture(33984+Le),h.texUnit=Le),c.texParameteri(Ne.glTarget,10240,ze.glMagFilter),Ne.glMagFilter=ze.glMagFilter)}Pe=Be.gpuDescriptors[++De]}}}if(n&&d&&(p||PF.gpuInputAssembler!==n)){PF.gpuInputAssembler=n;var Ue=e.extensions.ANGLE_instanced_arrays;if(e.extensions.useVAO){var Ge=e.extensions.OES_vertex_array_object,Ve=n.glVAOs.get(d.glProgram);if(!Ve){var He;Ve=Ge.createVertexArrayOES(),n.glVAOs.set(d.glProgram,Ve),Ge.bindVertexArrayOES(Ve),c.bindBuffer(34962,null),c.bindBuffer(34963,null),h.glArrayBuffer=null,h.glElementArrayBuffer=null;for(var We=d.glInputs.length,je=0;je=0&&(c.enableVertexAttribArray(ct),h.glEnabledAttribLocs[ct]=!0),h.glCurrentAttribLocs[ct]=!0,c.vertexAttribPointer(ct,rt.count,rt.glType,rt.isNormalized,rt.stride,ht),Ue&&Ue.vertexAttribDivisorANGLE(ct,rt.isInstanced?1:0)}}}var lt=n.gpuIndexBuffer;lt&&h.glElementArrayBuffer!==lt.glBuffer&&(c.bindBuffer(34963,lt.glBuffer),h.glElementArrayBuffer=lt.glBuffer);for(var ft=0;ft0){var d=t.firstIndex*u.stride;r.drawElementsInstancedANGLE(o,t.indexCount,a.glIndexType,d,t.instanceCount)}}else t.vertexCount>0&&r.drawArraysInstancedANGLE(o,t.firstVertex,t.vertexCount,t.instanceCount);else if(u){if(t.indexCount>0){var p=t.firstIndex*u.stride;n.drawElements(o,t.indexCount,a.glIndexType,p)}}else t.vertexCount>0&&n.drawArrays(o,t.firstVertex,t.vertexCount)}}function kF(e,t,n,i){var r=e.gl,s=e.stateCache,a=s.glTexUnits[s.texUnit];a.glTexture!==n.glTexture&&(r.bindTexture(n.glTarget,n.glTexture),a.glTexture=n.glTexture);var o=0,u=0;switch(n.glTarget){case 3553:for(var c=0;c0?E:d.width,_.height=g.buffTexHeight>0?g.buffTexHeight:d.height;var I=w+p.x===n.width>>v?w:d.width,A=T+p.y===n.height>>v?T:d.height,R=void 0,C=t[o++];if(_.width===d.width&&_.height===d.height){var O=As(n.format,I,A,1)/h.BYTES_PER_ELEMENT;$(Number.isInteger(O),9101),R=new h(C.buffer,C.byteOffset+g.buffOffset,O)}else R=UF(C,n.format,g.buffOffset,_,d);l?36196===n.glInternalFmt||e.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(3553,v,n.glInternalFmt,I,A,0,R):r.compressedTexSubImage2D(3553,v,p.x,p.y,I,A,n.glFormat,R):r.texSubImage2D(3553,v,p.x,p.y,I,A,n.glFormat,n.glType,R)}break;case 34067:for(var B=0;B0?D.buffStride:d.width,_.height=D.buffTexHeight>0?D.buffTexHeight:d.height;var G=N+p.x===n.width>>P?N:d.width,V=k+p.y===n.height>>P?k:d.height,H=L.baseArrayLayer+L.layerCount;for(u=L.baseArrayLayer;u0,this.instancedDraw=!!t.instanceCount,this.drawCount=Math.max(e+1,this.drawCount),this.drawByIndex?(this.counts[e]=t.indexCount,this.offsets[e]=t.firstIndex):(this.counts[e]=t.vertexCount,this.offsets[e]=t.firstVertex),this.instances[e]=Math.max(1,t.instanceCount)},t._ensureCapacity=function(e){if(!(this._capacity>e)){this._capacity=ce(e);var t=jF(this._capacity),n=jF(this._capacity),i=jF(this._capacity);this.byteOffsets=jF(this._capacity),t.set(this.counts),n.set(this.offsets),i.set(this.instances),this.counts=t,this.offsets=n,this.instances=i}},e}(),qF=function(){function e(){this._gpuShader=null,this._gpuDescriptorSetLayout=null,this._gpuPipelineLayout=null,this._gpuPipelineState=null,this._gpuVertexBuffer=null,this._gpuInputAssembler=null,this._gpuPointSampler=null,this._gpuLinearSampler=null,this._gpuDescriptorSet=null,this._gpuUniformBuffer=null,this._drawInfo=null,this._glFramebuffer=null,this._uniformBuffer=null;var e=WF.instance.bindingMappingInfo.maxBlockCounts[0];this._gpuShader={name:"Blit Pass",blocks:[new kr(0,0,"BlitParams",[new Nr("tilingOffsetSrc",16,1),new Nr("tilingOffsetDst",16,1)],1)],samplerTextures:[new zr(0,e,"textureSrc",28,1)],subpassInputs:[],gpuStages:[{type:1,source:"\nprecision mediump float;\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nuniform vec4 tilingOffsetSrc;\nuniform vec4 tilingOffsetDst;\nvarying vec2 v_texCoord;\nvoid main() {\n v_texCoord = a_texCoord * tilingOffsetSrc.xy + tilingOffsetSrc.zw;\n gl_Position = vec4((a_position + 1.0) * tilingOffsetDst.xy - 1.0 + tilingOffsetDst.zw * 2.0, 0, 1);\n}",glShader:null},{type:16,source:"\nprecision mediump float;\nuniform sampler2D textureSrc;\nvarying vec2 v_texCoord;\nvoid main() {\n gl_FragColor = texture2D(textureSrc, v_texCoord);\n}",glShader:null}],glProgram:null,glInputs:[],glUniforms:[],glBlocks:[],glSamplerTextures:[]},CF(WF.instance,this._gpuShader),this._gpuDescriptorSetLayout={bindings:[new ss(0,1,1,1),new ss(e,16,1,16)],dynamicBindings:[],descriptorIndices:[],descriptorCount:e+1};for(var t=0;t0&&(this._uniformBuffer=new Uint8Array(this._size)),this._gpuBuffer={usage:this._usage,memUsage:this._memUsage,size:this._size,stride:this._stride,buffer:null,vf32:null,indirects:new XF,glTarget:0,glBuffer:null},16&this._usage&&(this._gpuBuffer.buffer=this._uniformBuffer),TF(WF.instance,this._gpuBuffer),WF.instance.memoryStatus.bufferSize+=this._size},n.destroy=function(){this._gpuBuffer&&(SF(WF.instance,this._gpuBuffer),WF.instance.memoryStatus.bufferSize-=this._size,this._gpuBuffer=null),this._gpuBufferView&&(this._gpuBufferView=null)},n.resize=function(e){if(this._isBufferView)K(16379);else{var t,n,i,r,s,a=this._size;a!==e&&(this._size=e,this._count=this._size/this._stride,this._uniformBuffer&&(this._uniformBuffer=new Uint8Array(e)),this._gpuBuffer&&(this._uniformBuffer&&(this._gpuBuffer.buffer=this._uniformBuffer),this._gpuBuffer.size=e,e>0&&(t=WF.instance,n=this._gpuBuffer,i=t.gl,r=t.stateCache,s=2&n.memUsage?35048:35044,8&n.usage?(t.extensions.useVAO&&r.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),r.glVAO=null),PF.gpuInputAssembler=null,r.glArrayBuffer!==n.glBuffer&&i.bindBuffer(34962,n.glBuffer),n.buffer?i.bufferData(34962,n.buffer,s):i.bufferData(34962,n.size,s),i.bindBuffer(34962,null),r.glArrayBuffer=null):4&n.usage?(t.extensions.useVAO&&r.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),r.glVAO=null),PF.gpuInputAssembler=null,r.glElementArrayBuffer!==n.glBuffer&&i.bindBuffer(34963,n.glBuffer),n.buffer?i.bufferData(34963,n.buffer,s):i.bufferData(34963,n.size,s),i.bindBuffer(34963,null),r.glElementArrayBuffer=null):16&n.usage?n.buffer&&(n.vf32=new Float32Array(n.buffer.buffer)):(64&n.usage||2&n.usage||1&n.usage||Z(16315),n.glTarget=0),WF.instance.memoryStatus.bufferSize-=a,WF.instance.memoryStatus.bufferSize+=e)))}},n.update=function(e,t){var n;this._isBufferView?K(16380):(n=void 0!==t?t:64&this._usage?0:e.byteLength,xF(WF.instance,this._gpuBuffer,e,0,n))},f(t,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}},{key:"gpuBufferView",get:function(){return this._gpuBufferView}}]),t}(Fs),KF=function(e){function t(){var t;return(t=e.call(this)||this)._isInRenderPass=!1,t._curGPUPipelineState=null,t._curGPUInputAssembler=null,t._curGPUDescriptorSets=[],t._curDynamicOffsets=Array(8).fill(0),t._curDynamicStates=new ms,t._isStateInvalied=!1,t}p(t,e);var n=t.prototype;return n.initialize=function(e){this._type=e.type,this._queue=e.queue;for(var t=WF.instance.bindingMappings.blockOffsets.length,n=0;n0?this.gpuColorTextures[0].width:this.gpuDepthStencilTexture?this.gpuDepthStencilTexture.width:c},set width(e){c=e},get height(){return this.gpuColorTextures.length>0?this.gpuColorTextures[0].height:this.gpuDepthStencilTexture?this.gpuDepthStencilTexture.height:h},set height(e){h=e},lodLevel:r},RF(WF.instance,this._gpuFramebuffer),this._gpuFramebuffer.gpuColorTextures.forEach((function(e){return n._gpuColorTextures.push(e.glTexture)})),this._gpuDepthStencilTexture=null==(t=this._gpuFramebuffer.gpuDepthStencilTexture)?void 0:t.glTexture,this._width=this._gpuFramebuffer.width,this._height=this._gpuFramebuffer.height},t.destroy=function(){var e,t,n,i;this._gpuFramebuffer&&(e=WF.instance,t=this._gpuFramebuffer,n=e.gl,i=e.stateCache,t.glFramebuffer&&(n.deleteFramebuffer(t.glFramebuffer),i.glFramebuffer===t.glFramebuffer&&(n.bindFramebuffer(36160,null),i.glFramebuffer=null),t.glFramebuffer=null),this._gpuFramebuffer=null,this._gpuColorTextures.length=0,this._gpuDepthStencilTexture=null)},f(n,[{key:"needRebuild",get:function(){var e=this._gpuFramebuffer;if(e){for(var t,n=0;nn&&(n=s.binding)}this._bindingIndices=Array(n+1).fill(-1);for(var a=this._descriptorIndices=Array(n+1).fill(-1),o=0;o1&&(s.levelCount=Math.min(s.levelCount,t.getLevelCount(e,n)));var a=i._size;s.width=e,s.height=n,i._size=Rs(s.format,i.width,i.height,i.depth,s.levelCount)*s.layerCount;var o=i._gpuTexture;!i._isTextureView&&o&&(o.width=e,o.height=n,o.size=i._size,o.isSwapchainTexture||(AF(r,o),r.memoryStatus.textureSize-=a,r.memoryStatus.textureSize+=i._size))}},n.initAsSwapchainTexture=function(e){var t=new Mr;t.format=e.format,t.usage=Ts[e.format].hasDepth?32:16,t.width=e.width,t.height=e.height,this.initialize(t,!0)},f(t,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"lodLevel",get:function(){return this._lodLevel}}]),t}(ra),hL="webglcontextlost";function lL(e){e.activeTexture(33984),e.pixelStorei(3333,1),e.pixelStorei(3317,1),e.pixelStorei(37440,!1),e.bindFramebuffer(36160,null),e.enable(3089),e.enable(2884),e.cullFace(1029),e.frontFace(2305),e.disable(32823),e.polygonOffset(0,0),e.enable(2929),e.depthMask(!0),e.depthFunc(513),e.depthRange(0,1),e.stencilFuncSeparate(1028,519,1,65535),e.stencilOpSeparate(1028,7680,7680,7680),e.stencilMaskSeparate(1028,65535),e.stencilFuncSeparate(1029,519,1,65535),e.stencilOpSeparate(1029,7680,7680,7680),e.stencilMaskSeparate(1029,65535),e.disable(2960),e.disable(32926),e.disable(3042),e.blendEquationSeparate(32774,32774),e.blendFuncSeparate(1,0,1,0),e.colorMask(!0,!0,!0,!0),e.blendColor(0,0,0,0)}function fL(e,t){for(var n=["","WEBKIT_","MOZ_"],i=0;i=0;u--){var c=r.array[u];if(c){var h=c.model;h&&h.enabled&&h.node&&((o&h.node.layer)===h.node.layer||o&h.visFlags)&&h.worldBounds&&h.castShadow?Oh.aabbFrustum(h.worldBounds,s)&&(a.push(c),n.level>3)]+=(u.isCompositeModeEnabled(h)?1:0)*Math.pow(10,l)}r[19]+=(u.lightingWithAlbedo?1:0)*Math.pow(10,6),r[19]+=(u.csmLayerColoration?1:0)*Math.pow(10,7)}},e.updateCameraUBOView=function(e,t,n){var i,r=(n.scene?n.scene:o.director.getScene().renderScene).mainLight,s=e.pipelineSceneData,a=s.ambient,u=s.skybox,c=s.fog,h=s.shadows,l=t,f=n.exposure,d=s.isHDR;if(l[104]=s.shadingScale,l[105]=s.shadingScale,l[106]=1/l[104],l[107]=1/l[105],l[108]=f,l[109]=1/f,l[110]=d?1:0,l[111]=1/Bg.standardExposureValue,r){var p=r.shadowEnabled&&h.type===AS.ShadowMap?1:0,_=r.direction;if(GL.set(_.x,_.y,_.z,p),WL(l,GL,112),Fo.toArray(l,r.color,116),r.useColorTemperature){var m=r.colorTemperatureRGB;l[116]*=m.x,l[117]*=m.y,l[118]*=m.z}l[119]=d?r.illuminance*f:r.illuminance}else GL.set(0,0,1,0),WL(l,GL,112),WL(l,go.ZERO,116);var g=a.skyColor;g.w=d?a.skyIllum*f:a.skyIllum,l[120]=g.x,l[121]=g.y,l[122]=g.z,l[123]=g.w,l[124]=a.groundAlbedo.x,l[125]=a.groundAlbedo.y,l[126]=a.groundAlbedo.z,l[127]=u.envmap?null==(i=u.envmap)?void 0:i.mipmapLevel:1,HL(l,n.matView,0),HL(l,n.node.worldMatrix,16),Fo.toArray(l,n.position,96),HL(l,n.matProj,32),HL(l,n.matProjInv,48),HL(l,n.matViewProj,64),HL(l,n.matViewProjInv,80),l[99]=this.getCombineSignY(),l[100]=n.surfaceTransform,l[101]=n.cameraUsage,l[102]=Math.cos(Fa(s.skybox.getRotationAngle())),l[103]=Math.sin(Fa(s.skybox.getRotationAngle()));var v=c.colorArray;l[128]=v.x,l[129]=v.y,l[130]=v.z,l[131]=v.z,l[132]=c.fogStart,l[133]=c.fogEnd,l[134]=c.fogDensity,l[136]=c.fogTop,l[137]=c.fogRange,l[138]=c.fogAtten,l[140]=n.nearClip,l[141]=n.farClip,l[142]=n.getClipSpaceMinz(),l[144]=s.shadingScale*n.window.width*n.viewport.x,l[145]=s.shadingScale*n.window.height*n.viewport.y,l[146]=s.shadingScale*n.window.width*n.viewport.z,l[147]=s.shadingScale*n.window.height*n.viewport.w},e.getPCFRadius=function(e,t){var n=e.size.x;switch(t.shadowPcf){case RS.HARD:return 0;case RS.SOFT:return 1/(.5*n);case RS.SOFT_2X:return 2/(.5*n);case RS.SOFT_4X:return 3/(.5*n)}return 0},e.updatePlanarNormalAndDistance=function(e,t){Fo.normalize(VL,e.normal),t[60]=VL.x,t[61]=VL.y,t[62]=VL.z,t[63]=-e.distance},e.updateShadowUBOView=function(t,n,i,r){var s=t.device,a=r.scene.mainLight,o=t.pipelineSceneData,u=o.shadows,c=o.csmLayers,h=n,l=i,f=o.csmSupported,d=mg(s)?0:1;if(a&&u.enabled){if(u.type===AS.ShadowMap){if(a.shadowEnabled){if(a.shadowFixedArea||a.csmLevel===CS.LEVEL_1||!f){var p=c.specialLayer.matShadowView,_=c.specialLayer.matShadowProj,m=c.specialLayer.matShadowViewProj,g=.1,v=0,y=0;a.shadowFixedArea?(g=a.shadowNear,v=a.shadowFar,y=0):(v=c.specialLayer.shadowCameraFar,y=1),HL(h,p,0),h[36]=_.m10,h[37]=_.m14,h[38]=_.m11,h[39]=_.m15,h[40]=_.m00,h[41]=_.m05,h[42]=1/_.m00,h[43]=1/_.m05,HL(h,m,16),UL.set(g,v,0,1-a.shadowSaturation),WL(h,UL,44),UL.set(0,d,a.shadowNormalBias,y),WL(h,UL,52)}else{for(var b=this.getPCFRadius(u,a),w=0;w0){var o=a;a=s,s=o}var u=0;switch(e){case 0:u=0,n[u++]=-1,n[u++]=-1,n[u++]=i,n[u++]=a,n[u++]=1,n[u++]=-1,n[u++]=r,n[u++]=a,n[u++]=-1,n[u++]=1,n[u++]=i,n[u++]=s,n[u++]=1,n[u++]=1,n[u++]=r,n[u++]=s;break;case 1:u=0,n[u++]=-1,n[u++]=-1,n[u++]=r,n[u++]=a,n[u++]=1,n[u++]=-1,n[u++]=r,n[u++]=s,n[u++]=-1,n[u++]=1,n[u++]=i,n[u++]=a,n[u++]=1,n[u++]=1,n[u++]=i,n[u++]=s;break;case 2:u=0,n[u++]=-1,n[u++]=-1,n[u++]=i,n[u++]=s,n[u++]=1,n[u++]=-1,n[u++]=r,n[u++]=s,n[u++]=-1,n[u++]=1,n[u++]=i,n[u++]=a,n[u++]=1,n[u++]=1,n[u++]=r,n[u++]=a;break;case 3:u=0,n[u++]=-1,n[u++]=-1,n[u++]=i,n[u++]=s,n[u++]=1,n[u++]=-1,n[u++]=i,n[u++]=a,n[u++]=-1,n[u++]=1,n[u++]=r,n[u++]=s,n[u++]=1,n[u++]=1,n[u++]=r,n[u++]=a}return n},n._createQuadInputAssembler=function(){var e=new qx,t=this._device.createBuffer(new Cr(10,3,64,16));if(!t)return e;var n=this._device.createBuffer(new Cr(6,1,6,1));if(!n)return e;var i=new Uint8Array(6);i[0]=0,i[1]=1,i[2]=2,i[3]=1,i[4]=3,i[5]=2,n.update(i);var r=new Array(2);r[0]=new Xr("a_position",21),r[1]=new Xr("a_texCoord",21);var s=this._device.createInputAssembler(new Yr(r,[t],n));return e.quadIB=n,e.quadVB=t,e.quadIA=s,e},n.updateQuadVertexData=function(e,t){var n=this._lastUsedRenderArea;if(n.x!==e.x||n.y!==e.y||n.width!==e.width||n.height!==e.height){var i=this._genQuadVertexData(0,e);this._quadVBOffscreen.update(i);var r=this._genQuadVertexData(t.swapchain&&t.swapchain.surfaceTransform||0,e);this._quadVBOnscreen.update(r),n.copy(e)}},n.destroy=function(){for(var t,n,i=0;i>1,r>>1)),e.prefilterFramebuffer=t.createFramebuffer(new rs(e.renderPass,[e.prefiterTex])),i>>=1,r>>=1;for(var s=0;s<6;++s)e.downsampleTexs.push(t.createTexture(new Mr(1,20,35,i>>1,r>>1))),e.downsampleFramebuffers[s]=t.createFramebuffer(new rs(e.renderPass,[e.downsampleTexs[s]])),e.upsampleTexs.push(t.createTexture(new Mr(1,20,35,i,r))),e.upsampleFramebuffers[s]=t.createFramebuffer(new rs(e.renderPass,[e.upsampleTexs[s]])),i>>=1,r>>=1;e.combineTex=t.createTexture(new Mr(1,20,35,this._width,this._height)),e.combineFramebuffer=t.createFramebuffer(new rs(e.renderPass,[e.combineTex])),e.sampler=this.globalDSManager.linearSampler}},n.on=function(e,t,n,i){return this._eventProcessor.on(e,t,n,i)},n.once=function(e,t,n){return this._eventProcessor.once(e,t,n)},n.off=function(e,t,n){this._eventProcessor.off(e,t,n)},n.emit=function(e,t,n,i,r,s){this._eventProcessor.emit(e,t,n,i,r,s)},n.targetOff=function(e){this._eventProcessor.targetOff(e)},n.removeAll=function(e){this._eventProcessor.removeAll(e)},n.hasEventListener=function(e,t,n){return this._eventProcessor.hasEventListener(e,t,n)},f(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("attachment-scale-changed",e))}}]),t}(hv),aN=El(sN.prototype,"_tag",[Yl],(function(){return 0})),oN=El(sN.prototype,"_flows",[iN,Yl],(function(){return[]})),rN=sN))||rN));function pN(e,t){return e.hash-t.hash||e.depth-t.depth||e.shaderId-t.shaderId}function _N(e,t){return e.priority-t.priority||e.hash-t.hash||t.depth-e.depth||e.shaderId-t.shaderId}o.RenderPipeline=dN,la(dN.prototype,"RenderPipeline.prototype",[{name:"geometryRenderer",suggest:"please use camera.geometryRenderer instead."}]);var mN=function(){function e(e){this._passDesc=e,this._passPool=new Se((function(){return{priority:0,hash:0,depth:0,shaderId:0,subModel:null,passIdx:0}}),64),this.queue=new xe(64,this._passDesc.sortFunc)}var t=e.prototype;return t.clear=function(){this.queue.clear(),this._passPool.reset()},t.insertRenderPass=function(e,t,n){var i=e.model.subModels[t],r=i.passes[n],s=i.shaders[n];if(r.blendState.targets[0].blend!==this._passDesc.isTransparent||!(r.phase&this._passDesc.phases))return!1;var a=r.priority<<16|i.priority<<8|n,o=this._passPool.add();return o.priority=e.model.priority,o.hash=a,o.depth=e.depth||0,o.shaderId=s.typedID,o.subModel=i,o.passIdx=n,this.queue.push(o),!0},t.sort=function(){this.queue.sort()},t.recordCommandBuffer=function(e,t,n){for(var i=0;i0)))for(var a=0;athis._lightBufferCount&&(this._firstLightBufferView.destroy(),this._lightBufferCount=Wa(a.length),this._lightBuffer.resize(this._lightBufferStride*this._lightBufferCount),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount),this._firstLightBufferView=D_.gfxDevice.createBuffer(new Or(this._lightBuffer,0,80)));for(var o=0,u=0;o-1&&this.additiveInstanceQueues.splice(t,1)},n.initialize=function(t){return e.prototype.initialize.call(this,t),t.renderQueues&&(this.renderQueues=t.renderQueues),!0},n.activate=function(t,n){e.prototype.activate.call(this,t,n);for(var i=0;i0?.5*(1-Math.floor(a/2))*u.y:.5*Math.floor(a/2)*u.y,this._renderArea.width=.5*u.x,this._renderArea.height=.5*u.y}break;case 2:this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=u.x,this._renderArea.height=u.y}var l=this._shadowFrameBuffer.renderPass;s.beginRenderPass(l,this._shadowFrameBuffer,this._renderArea,Nz,e.clearDepth,e.clearStencil),s.bindDescriptorSet(0,r),this._additiveShadowQueue.recordCommandBuffer(o,l,s),s.endRenderPass(),this._isShadowMapCleared=!1}},n.activate=function(t,n){e.prototype.activate.call(this,t,n),this._additiveShadowQueue=new Lz(t),this._isShadowMapCleared=!1},t}(tN),Pz.initInfo={name:"ShadowStage",priority:10,tag:0},Dz=Pz))||Dz),zz=[],Uz=e("ShadowFlow",Fl("ShadowFlow")((Fz=function(e){function t(){var t;return(t=e.call(this)||this)._shadowRenderPass=null,t}p(t,e);var n=t.prototype;return n.initialize=function(t){if(e.prototype.initialize.call(this,t),0===this._stages.length){var n=new kz;n.initialize(kz.initInfo),this._stages.push(n)}return!0},n.activate=function(t){e.prototype.activate.call(this,t);var n=mg(t.device)?0:1;t.macros.CC_SHADOWMAP_FORMAT=n;var i=6===t.device.gfxAPI?1:0;t.macros.CC_SHADOWMAP_USE_LINEAR_DEPTH=i,t.pipelineSceneData.csmSupported=t.device.capabilities.maxFragmentUniformVectors>=99,t.macros.CC_SUPPORT_CASCADED_SHADOW_MAP=t.pipelineSceneData.csmSupported,t.macros.CC_SHADOW_TYPE=0,t.macros.CC_DIR_SHADOW_PCF_TYPE=RS.HARD,t.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,t.macros.CC_CASCADED_LAYERS_TRANSITION=0,t.onGlobalPipelineStateChanged()},n.render=function(e){var t=this._pipeline,n=t.pipelineSceneData.shadows,i=t.pipelineSceneData.csmLayers,r=t.pipelineSceneData.shadowFrameBufferMap,s=i.castShadowObjects,a=this._pipeline.pipelineSceneData.validPunctualLights;if(n.enabled&&n.type===AS.ShadowMap){for(var o=0,u=0;o0){this._renderQueues.forEach(yN);for(var T=0;T0&&(this._stageDesc||(this._stageDesc=n.createDescriptorSet(new os(c.localSetLayout)),this._localUBO=n.createBuffer(new Cr(18,1,224,224)),this._stageDesc.bindBuffer(0,this._localUBO)),this._stageDesc.update(),r.bindPipelineState(f),r.bindDescriptorSet(1,c.descriptorSet),r.bindDescriptorSet(2,this._stageDesc),r.bindInputAssembler(l),r.draw(l)),this._uiPhase.render(e,u),SS(n,u,r,t.profiler,e),r.endRenderPass()},t}(tN),AU.initInfo={name:"PostProcessStage",priority:19,tag:0},EU=El((xU=AU).prototype,"_postProcessMaterial",[wU,Yl],(function(){return null})),IU=El(xU.prototype,"renderQueues",[TU,Yl],(function(){return[]})),SU=xU))||SU)),jU=function(e){function t(){var t;return(t=e.call(this)||this)._antiAliasing=0,t}p(t,e);var n=t.prototype;return n.updatePipelineSceneData=function(){this.updatePipelinePassInfo()},n.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 n=this._bloomMaterial.passes[1+t];n.beginChangeStatesSilently(),n.tryCompile(),n.endChangeStatesSilently();var i=this._bloomMaterial.passes[7+t];i.beginChangeStatesSilently(),i.tryCompile(),i.endChangeStatesSilently()}var r=this._bloomMaterial.passes[13];r.beginChangeStatesSilently(),r.tryCompile(),r.endChangeStatesSilently()}},n.updatePostProcessPass=function(){if(this.postprocessMaterial){var e=this.postprocessMaterial.passes[0];e.beginChangeStatesSilently(),e.tryCompile(),e.endChangeStatesSilently()}},n.initPipelinePassInfo=function(){var e=new ES;e._uuid="builtin-deferred-material",e.initialize({effectName:"pipeline/deferred-lighting"});for(var t=0;t>=1,this._renderArea.height>>=1;var n=t.commandBuffers[0],i=t.pipelineSceneData.bloomMaterial.passes[0],r=t.getPipelineRenderData(),s=r.bloom,a=new Float32Array(qU.COUNT);a[qU.TEXTURE_SIZE_OFFSET+2]=this.threshold,n.updateBuffer(this._bloomUBO[0],a),n.beginRenderPass(s.renderPass,s.prefilterFramebuffer,this._renderArea,XU,0,0),n.bindDescriptorSet(0,t.descriptorSet),i.descriptorSet.bindBuffer(0,this._bloomUBO[0]),i.descriptorSet.bindTexture(1,r.outputRenderTargets[0]),i.descriptorSet.bindSampler(1,s.sampler),i.descriptorSet.update(),n.bindDescriptorSet(1,i.descriptorSet);var o=e.window.swapchain?t.quadIAOffscreen:t.quadIAOnscreen,u=null,c=i.getShaderVariant();null!=i&&null!=c&&null!=o&&(u=uS.getOrCreatePipelineState(t.device,i,c,s.renderPass,o)),null!=u&&(n.bindPipelineState(u),n.bindInputAssembler(o),n.draw(o)),n.endRenderPass()},n._downsamplePass=function(e,t){t.generateRenderArea(e,this._renderArea),this._renderArea.width>>=1,this._renderArea.height>>=1;for(var n=t.commandBuffers[0],i=t.pipelineSceneData.bloomMaterial,r=t.getPipelineRenderData().bloom,s=new Float32Array(qU.COUNT),a=0;a>=1,this._renderArea.height>>=1,n.beginRenderPass(r.renderPass,r.downsampleFramebuffers[a],this._renderArea,XU,0,0);var o=i.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(),n.bindDescriptorSet(1,o.descriptorSet);var c=e.window.swapchain?t.quadIAOffscreen:t.quadIAOnscreen,h=null;null!=o&&null!=u&&null!=c&&(h=uS.getOrCreatePipelineState(t.device,o,u,r.renderPass,c)),null!=h&&(n.bindPipelineState(h),n.bindInputAssembler(c),n.draw(c)),n.endRenderPass()}},n._upsamplePass=function(e,t){var n=t.getPipelineRenderData().bloom;t.generateRenderArea(e,this._renderArea),this._renderArea.width>>=this.iterations+1,this._renderArea.height>>=this.iterations+1;for(var i=t.commandBuffers[0],r=t.pipelineSceneData.bloomMaterial,s=new Float32Array(qU.COUNT),a=0;a0&&(e.extensions.useVAO&&i.glVAO&&(n.bindVertexArray(null),i.glVAO=null),LG.gpuInputAssembler=null,i.glArrayBuffer!==t.glBuffer&&(n.bindBuffer(34962,t.glBuffer),i.glArrayBuffer=t.glBuffer),n.bufferData(34962,t.size,r),n.bindBuffer(34962,null),i.glArrayBuffer=null))}else if(4&t.usage){t.glTarget=34963;var a=n.createBuffer();a&&(t.glBuffer=a,t.size>0&&(e.extensions.useVAO&&i.glVAO&&(n.bindVertexArray(null),i.glVAO=null),LG.gpuInputAssembler=null,i.glElementArrayBuffer!==t.glBuffer&&(n.bindBuffer(34963,t.glBuffer),i.glElementArrayBuffer=t.glBuffer),n.bufferData(34963,t.size,r),n.bindBuffer(34963,null),i.glElementArrayBuffer=null))}else if(16&t.usage){t.glTarget=35345;var o=n.createBuffer();o&&t.size>0&&(t.glBuffer=o,i.glUniformBuffer!==t.glBuffer&&(n.bindBuffer(35345,t.glBuffer),i.glUniformBuffer=t.glBuffer),n.bufferData(35345,t.size,r),n.bindBuffer(35345,null),i.glUniformBuffer=null)}else 64&t.usage||2&t.usage||1&t.usage||Z(16315),t.glTarget=0}function SG(e,t){var n=e.gl,i=e.getStateCache(),r=e.extensions.useVAO;if(t.glBuffer){switch(t.glTarget){case 34962:r&&i.glVAO&&(n.bindVertexArray(null),i.glVAO=null),LG.gpuInputAssembler=null,n.bindBuffer(34962,null),i.glArrayBuffer=null;break;case 34963:r&&i.glVAO&&(n.bindVertexArray(null),i.glVAO=null),LG.gpuInputAssembler=null,n.bindBuffer(34963,null),i.glElementArrayBuffer=null;break;case 35345:n.bindBuffer(35345,null),i.glUniformBuffer=null}n.deleteBuffer(t.glBuffer),t.glBuffer=null}}function xG(e,t){var n=e.gl,i=e.getStateCache(),r=2&t.memUsage?35048:35044;8&t.usage?(e.extensions.useVAO&&i.glVAO&&(n.bindVertexArray(null),i.glVAO=null),LG.gpuInputAssembler=null,i.glArrayBuffer!==t.glBuffer&&n.bindBuffer(34962,t.glBuffer),t.buffer?n.bufferData(34962,t.buffer,r):n.bufferData(34962,t.size,r),n.bindBuffer(34962,null),i.glArrayBuffer=null):4&t.usage?(e.extensions.useVAO&&i.glVAO&&(n.bindVertexArray(null),i.glVAO=null),LG.gpuInputAssembler=null,i.glElementArrayBuffer!==t.glBuffer&&n.bindBuffer(34963,t.glBuffer),t.buffer?n.bufferData(34963,t.buffer,r):n.bufferData(34963,t.size,r),n.bindBuffer(34963,null),i.glElementArrayBuffer=null):16&t.usage?(i.glUniformBuffer!==t.glBuffer&&n.bindBuffer(35345,t.glBuffer),n.bufferData(35345,t.size,r),n.bindBuffer(35345,null),i.glUniformBuffer=null):(64&t.usage||2&t.usage||1&t.usage||Z(16315),t.glTarget=0)}function EG(e,t,n,i,r){if(64&t.usage){t.indirects.clearDraws();for(var s=n.drawInfos,a=0;ar.maxTextureSize&&Z(9100,c,r.maxTextureSize),1===t.samples){if(t.glTexture=n.createTexture(),t.size>0){var h=i.glTexUnits[i.texUnit];if(h.glTexture!==t.glTexture&&(n.bindTexture(3553,t.glTexture),h.glTexture=t.glTexture),Ts[t.format].isCompressed)for(var l=0;l>1),a=cG(1,a>>1)}else 128&t.flags?n.texImage2D(3553,0,t.glInternalFmt,s,a,0,t.glFormat,t.glType,null):n.texStorage2D(3553,t.mipLevel,t.glInternalFmt,s,a)}}else t.glRenderbuffer=n.createRenderbuffer(),t.size>0&&(i.glRenderbuffer!==t.glRenderbuffer&&(n.bindRenderbuffer(36161,t.glRenderbuffer),i.glRenderbuffer=t.glRenderbuffer),n.renderbufferStorageMultisample(36161,t.samples,t.glInternalFmt,t.width,t.height));break;case 5:t.glTarget=35866;var p=cG(s,a);if(p>r.maxTextureSize&&Z(9100,p,r.maxTextureSize),u>r.maxArrayTextureLayers&&Z(9100,u,r.maxArrayTextureLayers),t.glTexture=n.createTexture(),t.size>0){var _=i.glTexUnits[i.texUnit];if(_.glTexture!==t.glTexture&&(n.bindTexture(35866,t.glTexture),_.glTexture=t.glTexture),Ts[t.format].isCompressed)for(var m=0;m>1),a=cG(1,a>>1)}else n.texStorage3D(35866,t.mipLevel,t.glInternalFmt,s,a,u)}break;case 2:t.glTarget=32879;var y=cG(cG(s,a),o);if(y>r.max3DTextureSize&&Z(9100,y,r.max3DTextureSize),t.glTexture=n.createTexture(),t.size>0){var b=i.glTexUnits[i.texUnit];if(b.glTexture!==t.glTexture&&(n.bindTexture(32879,t.glTexture),b.glTexture=t.glTexture),Ts[t.format].isCompressed)for(var w=0;w>1),a=cG(1,a>>1)}else n.texStorage3D(32879,t.mipLevel,t.glInternalFmt,s,a,o)}break;case 3:t.glTarget=34067;var x=cG(s,a);if(x>r.maxCubeMapTextureSize&&Z(9100,x,r.maxTextureSize),t.glTexture=n.createTexture(),t.size>0){var E=i.glTexUnits[i.texUnit];if(E.glTexture!==t.glTexture&&(n.bindTexture(34067,t.glTexture),E.glTexture=t.glTexture),Ts[t.format].isCompressed)for(var I=0;I>1),a=cG(1,a>>1)}else n.texStorage2D(34067,t.mipLevel,t.glInternalFmt,s,a)}break;default:Z(16317),t.type=1,t.glTarget=3553}}function AG(e,t){var n=e.gl,i=e.getStateCache();if(t.glTexture){var r=i.glTexUnits,s=i.texUnit;n.deleteTexture(t.glTexture);for(var a=0;ar.maxTextureSize&&Z(9100,c,r.maxTextureSize),1===t.samples){var h=i.glTexUnits[i.texUnit];if(h.glTexture!==t.glTexture&&(n.bindTexture(3553,t.glTexture),h.glTexture=t.glTexture),Ts[t.format].isCompressed)for(var l=0;l>1),a=cG(1,a>>1)}else AG(e,t),IG(e,t)}else t.glRenderbuffer&&(i.glRenderbuffer!==t.glRenderbuffer&&(n.bindRenderbuffer(36161,t.glRenderbuffer),i.glRenderbuffer=t.glRenderbuffer),n.renderbufferStorageMultisample(36161,t.samples,t.glInternalFmt,t.width,t.height));break;case 5:t.glTarget=35866;var p=cG(s,a);if(p>r.maxTextureSize&&Z(9100,p,r.maxTextureSize),u>r.maxArrayTextureLayers&&Z(9100,u,r.maxArrayTextureLayers),t.glTexture=n.createTexture(),t.size>0){var _=i.glTexUnits[i.texUnit];if(_.glTexture!==t.glTexture&&(n.bindTexture(35866,t.glTexture),_.glTexture=t.glTexture),Ts[t.format].isCompressed)for(var m=0;m>1),a=cG(1,a>>1)}else n.texStorage3D(35866,t.mipLevel,t.glInternalFmt,s,a,u)}break;case 2:t.glTarget=32879;var y=cG(cG(s,a),o);if(y>r.max3DTextureSize&&Z(9100,y,r.max3DTextureSize),t.glTexture=n.createTexture(),t.size>0){var b=i.glTexUnits[i.texUnit];if(b.glTexture!==t.glTexture&&(n.bindTexture(32879,t.glTexture),b.glTexture=t.glTexture),Ts[t.format].isCompressed)for(var w=0;w>1),a=cG(1,a>>1)}else n.texStorage3D(32879,t.mipLevel,t.glInternalFmt,s,a,o)}break;case 3:t.type=3,t.glTarget=34067;var x=cG(s,a);x>r.maxCubeMapTextureSize&&Z(9100,x,r.maxTextureSize);var E=i.glTexUnits[i.texUnit];if(E.glTexture!==t.glTexture&&(n.bindTexture(34067,t.glTexture),E.glTexture=t.glTexture),Ts[t.format].isCompressed)for(var I=0;I<6;++I){s=t.width,a=t.height;for(var A=0;A>1),a=cG(1,a>>1)}}else AG(e,t),IG(e,t);break;default:Z(16317),t.type=1,t.glTarget=3553}}}function CG(e,t){for(var n=e.gl,i=t.glSamplers.values().next();!i.done;){n.deleteSampler(i.value);for(var r=e.getStateCache().glSamplerUnits,s=0;s>u.baseLevel),t.height=hG(t.height,c.height>>u.baseLevel))}var h=t.gpuDepthStencilView;if(h){var l=h.gpuTexture,f=Ts[l.format].hasStencil?33306:36096;l.glTexture?r.framebufferTexture2D(36160,f,l.glTarget,l.glTexture,t.gpuDepthStencilView.baseLevel):r.framebufferRenderbuffer(36160,f,36161,l.glRenderbuffer),t.width=hG(t.width,l.width>>h.baseLevel),t.height=hG(t.height,l.height>>h.baseLevel)}r.drawBuffers(s);var d=r.checkFramebufferStatus(36160);if(36053!==d)switch(d){case 36054:Z(16318);break;case 36055:Z(16319);break;case 36057:Z(16320);break;case 36061:Z(16321)}n.glFramebuffer!==t.glFramebuffer&&r.bindFramebuffer(36160,n.glFramebuffer)}}function BG(e,t){var n=e.gl,i=e.getStateCache();t.glFramebuffer&&(n.deleteFramebuffer(t.glFramebuffer),i.glFramebuffer===t.glFramebuffer&&(n.bindFramebuffer(36160,null),i.glFramebuffer=null),t.glFramebuffer=null)}function DG(e,t){for(var n,i=e.gl,r=e.getStateCache(),s=e.capabilities,a=function(){var e=t.gpuStages[u],n=0,r="",s=1;switch(e.type){case 1:r="VertexShader",n=35633;break;case 16:r="FragmentShader",n=35632;break;default:return Z(16322),{v:void 0}}var a=i.createShader(n);if(a&&(e.glShader=a,i.shaderSource(e.glShader,"#version 300 es\n"+e.source),i.compileShader(e.glShader),!i.getShaderParameter(e.glShader,35713))){Z(16323,r,t.name),Z(16324,e.source.replace(/^|\n/g,(function(){return"\n"+s+++" "}))),k(i.getShaderInfoLog(e.glShader));for(var o=0;o0){t.glSamplerTextures=new Array(t.samplerTextures.length);for(var M=0;M=0&&A.gpuDescriptors[R];if(C&&C.gpuBuffer){var O=x[I.set],B=O&&O[I.binding],D=C.gpuBuffer.glOffset;B>=0&&(D+=r[B]),u.glBindUBOs[I.glBinding]===C.gpuBuffer.glBuffer&&u.glBindUBOOffsets[I.glBinding]===D||(D?a.bindBufferRange(35345,I.glBinding,C.gpuBuffer.glBuffer,D,C.gpuBuffer.size):a.bindBufferBase(35345,I.glBinding,C.gpuBuffer.glBuffer),u.glUniformBuffer=u.glBindUBOs[I.glBinding]=C.gpuBuffer.glBuffer,u.glBindUBOOffsets[I.glBinding]=D)}}for(var P=d.glSamplerTextures.length,M=0;M=0&&L.gpuDescriptors[N],z=0;z0){G.glTexture!==H.glTexture&&(u.texUnit!==U&&(a.activeTexture(33984+U),u.texUnit=U),H.glTexture?a.bindTexture(H.glTarget,H.glTexture):a.bindTexture(H.glTarget,e.nullTex2D.gpuTexture.glTexture),G.glTexture=H.glTexture);var X=k.gpuSampler.getGLSampler(e,W,j);u.glSamplerUnits[U]!==X&&(a.bindSampler(U,X),u.glSamplerUnits[U]=X)}k=L.gpuDescriptors[++N]}}}if(n&&d&&(p||LG.gpuInputAssembler!==n))if(LG.gpuInputAssembler=n,e.extensions.useVAO){var q=n.glVAOs.get(d.glProgram);if(!q){var Y;q=a.createVertexArray(),n.glVAOs.set(d.glProgram,q),a.bindVertexArray(q),a.bindBuffer(34962,null),a.bindBuffer(34963,null),u.glArrayBuffer=null,u.glElementArrayBuffer=null;for(var K=0;K=0&&(a.enableVertexAttribArray(he),u.glEnabledAttribLocs[he]=!0),u.glCurrentAttribLocs[he]=!0,a.vertexAttribPointer(he,ae.count,ae.glType,ae.isNormalized,ae.stride,le),a.vertexAttribDivisor(he,ae.isInstanced?1:0)}}}var fe=n.gpuIndexBuffer;fe&&u.glElementArrayBuffer!==fe.glBuffer&&(a.bindBuffer(34963,fe.glBuffer),u.glElementArrayBuffer=fe.glBuffer);for(var de=0;de0){var l=t.firstIndex*a.stride;n.drawElementsInstanced(r,t.indexCount,i.glIndexType,l,t.instanceCount)}}else t.vertexCount>0&&n.drawArraysInstanced(r,t.firstVertex,t.vertexCount,t.instanceCount);else if(a){if(t.indexCount>0){var f=t.firstIndex*a.stride;n.drawElements(r,t.indexCount,i.glIndexType,f)}}else t.vertexCount>0&&n.drawArrays(r,t.firstVertex,t.vertexCount)}}function UG(e,t){if(e.length>1||t.length>1)return!1;if(e[0]instanceof HTMLVideoElement){var n=e[0];return 0===t[0].texOffset.x&&0===t[0].texOffset.y&&t[0].texExtent.width===n.videoWidth&&t[0].texExtent.height===n.videoHeight}return!1}function GG(e,t,n,i){var r=e.gl,s=e.getStateCache(),a=s.glTexUnits[s.texUnit];a.glTexture!==n.glTexture&&(r.bindTexture(n.glTarget,n.glTexture),a.glTexture=n.glTexture);var o=0,u=0;switch(n.glTarget){case 3553:if(128&n.flags||UG(t,i))r.texImage2D(3553,i[0].texSubres.mipLevel,n.glInternalFmt,i[0].texExtent.width,i[0].texExtent.height,0,n.glFormat,n.glType,t[0]);else for(var c=0;c0?E:d.width,_.height=g.buffTexHeight>0?g.buffTexHeight:d.height;var I=w+p.x===n.width>>v?w:d.width,A=T+p.y===n.height>>v?T:d.height,R=void 0,C=t[o++];if(_.width===d.width&&_.height===d.height){var O=As(n.format,I,A,1)/h.BYTES_PER_ELEMENT;$(Number.isInteger(O),9101),R=new h(C.buffer,C.byteOffset+g.buffOffset,O)}else R=HG(C,n.format,g.buffOffset,_,d);l?36196!==n.glInternalFmt?r.compressedTexSubImage2D(3553,v,p.x,p.y,I,A,n.glFormat,R):r.compressedTexImage2D(3553,v,n.glInternalFmt,I,A,0,R):r.texSubImage2D(3553,v,p.x,p.y,I,A,n.glFormat,n.glType,R)}break;case 35866:for(var B=0;B0?U:d.width,_.height=D.buffTexHeight>0?D.buffTexHeight:d.height;var V=L+p.x===n.width>>P?L:d.width,H=N+p.y===n.height>>P?N:d.height,W=G.baseArrayLayer+G.layerCount;for(u=G.baseArrayLayer;u0?se:d.width,_.height=K.buffTexHeight>0?K.buffTexHeight:d.height;var ae=te+p.x===n.width>>Q?te:d.width,oe=ne+p.y===n.height>>Q?ne:d.height,ue=void 0,ce=t[o++];if(_.width===d.width&&_.height===d.height){var he=As(n.format,ae,oe,d.depth)/h.BYTES_PER_ELEMENT;$(Number.isInteger(he),9101),ue=new h(ce.buffer,ce.byteOffset+K.buffOffset,he)}else ue=HG(ce,n.format,K.buffOffset,_,d);l?36196!==n.glInternalFmt?r.compressedTexSubImage3D(35866,Q,p.x,p.y,p.z,ae,oe,d.depth,n.glFormat,ue):r.compressedTexImage3D(35866,Q,n.glInternalFmt,ae,oe,d.depth,0,ue):r.texSubImage3D(35866,Q,p.x,p.y,p.z,ae,oe,d.depth,n.glFormat,n.glType,ue)}break;case 34067:for(var le=0;le0?be:d.width,_.height=fe.buffTexHeight>0?fe.buffTexHeight:d.height;var Te=me+p.x===n.width>>de?me:d.width,Se=ge+p.y===n.height>>de?ge:d.height,xe=we.baseArrayLayer+we.layerCount;for(u=we.baseArrayLayer;u0,this.instancedDraw=!!t.instanceCount,this.drawCount=Math.max(e+1,this.drawCount),this.drawByIndex?(this.counts[e]=t.indexCount,this.offsets[e]=t.firstIndex):(this.counts[e]=t.vertexCount,this.offsets[e]=t.firstVertex),this.instances[e]=Math.max(1,t.instanceCount)},t._ensureCapacity=function(e){if(!(this._capacity>e)){this._capacity=Wa(e);var t=new Int32Array(this._capacity),n=new Int32Array(this._capacity),i=new Int32Array(this._capacity);this.byteOffsets=new Int32Array(this._capacity),t.set(this.counts),n.set(this.offsets),i.set(this.instances),this.counts=t,this.offsets=n,this.instances=i}},e}(),KG=function(){function e(){this._srcFramebuffer=void 0,this._dstFramebuffer=void 0;var e=qG.instance.gl;this._srcFramebuffer=e.createFramebuffer(),this._dstFramebuffer=e.createFramebuffer()}return e.prototype.destroy=function(){var e=qG.instance.gl;e.deleteFramebuffer(this._srcFramebuffer),e.deleteFramebuffer(this._dstFramebuffer)},f(e,[{key:"srcFramebuffer",get:function(){return this._srcFramebuffer}},{key:"dstFramebuffer",get:function(){return this._dstFramebuffer}}]),e}(),QG=function(e){function t(){var t;return(t=e.call(this)||this)._gpuBuffer=null,t}p(t,e);var n=t.prototype;return n.getGpuBuffer=function(){return this._gpuBuffer},n.initialize=function(e){if("buffer"in e){this._isBufferView=!0;var t=e.buffer;this._usage=t.usage,this._memUsage=t.memUsage,this._size=this._stride=e.range,this._count=1,this._flags=t.flags,this._gpuBuffer={usage:this._usage,memUsage:this._memUsage,size:this._size,stride:this._stride,buffer:null,indirects:t.getGpuBuffer().indirects,glTarget:t.getGpuBuffer().glTarget,glBuffer:t.getGpuBuffer().glBuffer,glOffset:e.offset}}else this._usage=e.usage,this._memUsage=e.memUsage,this._size=e.size,this._stride=Math.max(e.stride||this._size,1),this._count=this._size/this._stride,this._flags=e.flags,this._gpuBuffer={usage:this._usage,memUsage:this._memUsage,size:this._size,stride:this._stride,buffer:null,indirects:new YG,glTarget:0,glBuffer:null,glOffset:0},TG(qG.instance,this._gpuBuffer),qG.instance.memoryStatus.bufferSize+=this._size},n.destroy=function(){this._gpuBuffer&&(this._isBufferView||(SG(qG.instance,this._gpuBuffer),qG.instance.memoryStatus.bufferSize-=this._size),this._gpuBuffer=null)},n.resize=function(e){if(this._isBufferView)K(16379);else{var t=this._size;t!==e&&(this._size=e,this._count=this._size/this._stride,this._gpuBuffer&&(this._gpuBuffer.size=e,e>0&&(xG(qG.instance,this._gpuBuffer),qG.instance.memoryStatus.bufferSize-=t,qG.instance.memoryStatus.bufferSize+=e)))}},n.update=function(e,t){var n;this._isBufferView?K(16380):(n=void 0!==t?t:64&this._usage?0:e.byteLength,EG(qG.instance,this._gpuBuffer,e,0,n))},t}(Fs),ZG=function(e){function t(){var t;return(t=e.call(this)||this)._isInRenderPass=!1,t._curGPUPipelineState=null,t._curGPUDescriptorSets=[],t._curGPUInputAssembler=null,t._curDynamicOffsets=Array(8).fill(0),t._curDynamicStates=new ms,t._isStateInvalid=!1,t}p(t,e);var n=t.prototype;return n.initialize=function(e){this._type=e.type,this._queue=e.queue;for(var t=qG.instance.bindingMappings.blockOffsets.length,n=0;n0?this.gpuColorViews[0].gpuTexture.width:this.gpuDepthStencilView?this.gpuDepthStencilView.gpuTexture.width:o},set width(e){o=e},get height(){return this.gpuColorViews.length>0?this.gpuColorViews[0].gpuTexture.height:this.gpuDepthStencilView?this.gpuDepthStencilView.gpuTexture.height:u},set height(e){u=e}},OG(qG.instance,this._gpuFramebuffer),this._gpuFramebuffer.gpuColorViews.forEach((function(e){return n._gpuColorViews.push(e.gpuTexture.glTexture)})),this._gpuDepthStencilView=null==(t=this._gpuFramebuffer.gpuDepthStencilView)?void 0:t.gpuTexture.glTexture,this._width=this._gpuFramebuffer.width,this._height=this._gpuFramebuffer.height},n.destroy=function(){this._gpuFramebuffer&&(BG(qG.instance,this._gpuFramebuffer),this._gpuFramebuffer=null,this._gpuColorViews.length=0,this._gpuDepthStencilView=null)},f(t,[{key:"needRebuild",get:function(){var e=this.getGpuFramebuffer();if(e){for(var t,n=0;nn&&(n=s.binding)}this._bindingIndices=Array(n+1).fill(-1);for(var a=this._descriptorIndices=Array(n+1).fill(-1),o=0;o1&&(s.levelCount=Math.min(s.levelCount,t.getLevelCount(e,n)));var a=i._size;s.width=e,s.height=n,i._size=Rs(s.format,i.width,i.height,i.depth,s.levelCount)*s.layerCount;var o=i._gpuTexture;!i._isTextureView&&o&&(o.width=e,o.height=n,o.size=i._size,o.isSwapchainTexture||(RG(r,o),r.memoryStatus.textureSize-=a,r.memoryStatus.textureSize+=i._size))}},n.initAsSwapchainTexture=function(e){var t=new Mr;t.format=e.format,t.usage=Ts[e.format].hasDepth?32:16,t.width=e.width,t.height=e.height,this.initialize(t,!0)},f(t,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"gpuTextureView",get:function(){return this._gpuTextureView}}]),t}(ra),lV="webglcontextlost";function fV(e){e.activeTexture(33984),e.pixelStorei(3333,1),e.pixelStorei(3317,1),e.pixelStorei(37440,!1),e.bindFramebuffer(36160,null),e.enable(3089),e.enable(2884),e.cullFace(1029),e.frontFace(2305),e.polygonOffset(0,0),e.enable(2929),e.depthMask(!0),e.depthFunc(513),e.stencilFuncSeparate(1028,519,1,65535),e.stencilOpSeparate(1028,7680,7680,7680),e.stencilMaskSeparate(1028,65535),e.stencilFuncSeparate(1029,519,1,65535),e.stencilOpSeparate(1029,7680,7680,7680),e.stencilMaskSeparate(1029,65535),e.disable(2960),e.disable(32926),e.disable(3042),e.blendEquationSeparate(32774,32774),e.blendFuncSeparate(1,0,1,0),e.colorMask(!0,!0,!0,!0),e.blendColor(0,0,0,0)}function dV(e,t){for(var n=["","WEBKIT_","MOZ_"],i=0;i