System.register([],(function(t,e){"use strict";return{execute:function(){function i(t,e){for(var i=0;i=0||(r[i]=t[i]);return r}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function d(t,e){if(t){if("string"==typeof t)return _(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_(t,e):void 0}}function _(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function g(t){var e=m(t,"string");return"symbol"==typeof e?e:String(e)}function v(t,e,i,n){i&&Object.defineProperty(t,e,{enumerable:i.enumerable,configurable:i.configurable,writable:i.writable,value:i.initializer?i.initializer.call(n):void 0})}function y(t,e,i,n,r){var s={};return Object.keys(n).forEach((function(t){s[t]=n[t]})),s.enumerable=!!s.enumerable,s.configurable=!!s.configurable,("value"in s||s.initializer)&&(s.writable=!0),s=i.slice().reverse().reduce((function(i,n){return n(t,e,i)||i}),s),r&&void 0!==s.initializer&&(s.value=s.initializer?s.initializer.call(r):void 0,s.initializer=void 0),void 0===s.initializer&&(Object.defineProperty(t,e,s),s=null),s}function b(t,e){const i="undefined"==typeof window?global:window;return void 0===i[t]?i[t]=e:i[t]}t({$:function(t){return vO.test(t)},J:uO,N:yO,P:bO,W:SO,X:xO,Y:wO,Z:TO,_:p,a0:function(t){return gO.test(t)},a1:IO,a2:BO,a3:MO,aA:M2,aC:function(t,e){for(var i=t,n="";null!==i&&i!==e;)n=i.name+"/"+n,i=i.parent;return n.slice(0,-1)},aD:nY,aR:_s,aT:nr,aV:Nn,aX:zr,a_:Zr,az:B2,b0:ms,b2:bs,b4:fr,b9:Ki,bB:Be,bC:Ee,bD:Oe,bI:function(t){t>0&&(St=t)},bM:Dt,bN:function(t){for(var e,i=p(t);!(e=i()).done;)It(e.value)},bO:function(t){return Tt||(Tt="undefined"==typeof Proxy?{}:new Proxy(t,{get:function(t,e,i){return It(e),Reflect.get(t,e,i)}})),Tt},bP:Zo,bQ:$o,bT:Vi,bU:Ni,ba:Zi,bb:$i,bc:tn,bd:en,be:nn,bf:rn,bg:sn,bh:an,bi:on,bj:hn,bk:un,bl:ln,bm:cn,bn:fn,bo:dn,bp:_n,bq:pn,br:mn,bs:gn,bt:vn,bu:wn,bv:Tn,c3:function(t){return t[ou]},c6:Do,c8:K,c9:X,cH:jf,cI:Dc,cJ:Wc,cU:uu,cW:qf,cZ:Ti,c_:Ci,ca:Q,cb:Y,cc:J,cd:rt,ce:it,cf:ht,cg:at,ch:lt,ci:dt,cj:_t,ck:ft,d1:vo,d2:yo,d5:function(t,e){e.forEach((function(e){Object.getOwnPropertyNames(e.prototype).forEach((function(i){"constructor"!==i&&Object.defineProperty(t.prototype,i,Object.getOwnPropertyDescriptor(e.prototype,i))}))}))},d6:Z,d7:function(t,e){return kh(t,e,0)},d8:kh,d9:function(t,e,i){for(var n=0,r=t.length-1,s=r>>>1;n<=r;s=n+r>>>1){var a=t[s];if(i(a,e)<0)r=s-1;else{if(!(i(a,e)>0))return s;n=s+1}}return~n},dX:uv,dZ:H$,da:function(){},db:function(){},dc:Me,dd:Kf,dr:FP,fx:function(){return Promise.resolve()},g:XAt,g8:THt,gR:CXt,gS:AXt}),b("CC_WECHAT",!1),b("CC_XIAOMI",!1),b("CC_ALIPAY",!1),b("CC_BYTEDANCE",!1),b("CC_OPPO",!1),b("CC_VIVO",!1),b("CC_HUAWEI",!1),b("CC_MIGU",!1),b("CC_HONOR",!1),b("CC_COCOS_RUNTIME",!1);const S=!1;b("CC_EDITOR",!1);const x=!1;b("CC_PREVIEW",!1),b("CC_BUILD",!0),b("CC_TEST",!1),b("CC_DEBUG",!1),b("CC_DEV",!1),b("CC_MINIGAME",!1),b("CC_RUNTIME_BASED",!1),b("CC_SUPPORT_JIT",!0),b("CC_JSB",!1);const w=!1;var T="undefined"==typeof window?global:window,C=t("aO",{_global:T}),A=C;C.internal={};var D=t("aN","3.8.6");T.CocosEngine=A.ENGINE_VERSION=D,T.cc=A;var I=void 0!==globalThis.jsb&&void 0!==jsb.window?jsb.window:globalThis;T.ccwindow=I;var B=2147483647;function M(t){return(t>0)-(t<0)}function P(t,e){return t^(t^e)&-(t65535)<<4,e|=i=((t>>>=e)>255)<<3,e|=i=((t>>>=i)>15)<<2,(e|=i=((t>>>=i)>3)<<1)|(t>>>=i)>>1}function k(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24}function R(t){var e=32;return(t&=-t)&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}function O(t){return--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,1+(t|=t>>>16)}var F=new Array(256);!function(t){for(var e=0;e<256;++e){var i=e,n=e,r=7;for(i>>>=1;i;i>>>=1)n<<=1,n|=1&i,--r;t[e]=n<>31;return(t^e)-e},countTrailingZeros:R,deinterleave2:function(t,e){return(t=65535&((t=16711935&((t=252645135&((t=858993459&((t=t>>>e&1431655765)|t>>>1))|t>>>2))|t>>>4))|t>>>16))<<16>>16},deinterleave3:function(t,e){return(t=1023&((t=4278190335&((t=251719695&((t=3272356035&((t=t>>>e&1227133513)|t>>>2))|t>>>4))|t>>>8))|t>>>16))<<22>>22},interleave2:function(t,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))<<1},interleave3:function(t,e,i){return t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2),(t|=(e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2))<<1)|(i=1227133513&((i=3272356035&((i=251719695&((i=4278190335&((i&=1023)|i<<16))|i<<8))|i<<4))|i<<2))<<2},isPow2:function(t){return!(t&t-1||!t)},log10:function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},log2:E,max:P,min:function(t,e){return e^(t^e)&-(t>>R(t)+1},nextPow2:O,parity:function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1},popCount:k,prevPow2:function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},reverse:function(t){return F[255&t]<<24|F[t>>>8&255]<<16|F[t>>>16&255]<<8|F[t>>>24&255]},sign:M});t("aP",L);var V=I.document,N="https://github.com/cocos/cocos-engine/blob/"+D+"/EngineErrorMap.md",z=null,U=console.log.bind(console),G=U,H=U,W=function(t,e){if(!t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r2?i-2:0),r=2;r4){var e=function(t){if(A.game.canvas){if(!z){var e=V.createElement("Div");e.setAttribute("id","logInfoDiv"),e.setAttribute("width","200");var i=A.game.canvas.height;e.setAttribute("height",""+i);var n=e.style;n.zIndex="99999",n.position="absolute",n.top=n.left="0",(z=V.createElement("textarea")).setAttribute("rows","20"),z.setAttribute("cols","30"),z.setAttribute("disabled","true");var r=z.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",e.appendChild(z),A.game.canvas.parentNode.appendChild(e)}z.value=z.value+t+"\r\n",z.scrollTop=z.scrollHeight}};H=function(){e("ERROR : "+q.apply(void 0,arguments))},W=function(t,i){if(!t){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s2?i-2:0),r=2;r1?n-1:0),s=1;s1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;n2?i-2:0),r=2;r1?e-1:0),n=1;no.count&&(r("'%s' is deprecated, please use '%s' instead. "+a,t+"."+e,i+"."+n),o.count++)},t("bJ",pt=function(t,e,i){null!=t&&i.forEach((function(i){var n=xt++;wt.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:St});var r=null!=i.target?i.target:t,s=null!=i.newName?i.newName:i.name,a=null!=i.targetName?i.targetName:e,o=r===t,h=i.suggest?"("+i.suggest+")":"";if(null!=i.customFunction)t[i.name]=function(){var t;return vt(e,i.name,a,s,Y,n,h),(t=i.customFunction).call.apply(t,[this].concat(Array.prototype.slice.call(arguments)))};else if(null!=i.customSetter||null!=i.customGetter){var u=null!=i.customSetter,l=null!=i.customGetter;u&&l?Object.defineProperty(t,i.name,{get:function(){return vt(e,i.name,a,s,Y,n,h),i.customGetter.call(this)},set:function(t){vt(e,i.name,a,s,Y,n,h),i.customSetter.call(this,t)},enumerable:!1}):u?Object.defineProperty(t,i.name,{set:function(t){vt(e,i.name,a,s,Y,n,h),i.customSetter.call(this,t)},enumerable:!1}):l&&Object.defineProperty(t,i.name,{get:function(){return vt(e,i.name,a,s,Y,n,h),i.customGetter.call(this)},enumerable:!1})}else Object.defineProperty(t,i.name,{get:function(){return vt(e,i.name,a,s,Y,n,h),o?this[s]:r[s]},set:function(t){vt(e,i.name,a,s,Y,n,h),o?this[s]=t:r[s]=t},enumerable:!1})}))}),yt=function(t,e,i,n,r){var s=wt.get(n);s&&s.logTimes>s.count&&(i("'%s' has been removed. "+r,t+"."+e),s.count++)},t("bK",mt=function(t,e,i){null!=t&&i.forEach((function(i){var n=xt++;wt.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:St});var r=i.suggest?"("+i.suggest+")":"";Object.defineProperty(t,i.name,{get:function(){return yt(e,i.name,Q,n,r)},set:function(){yt(e,i.name,Q,n,r)},enumerable:!1})}))}),t("bL",gt=function(){});var Tt,Ct,At={};function Dt(t){for(var e in t){var i=t[e];At[e]=i}}function It(t){var e=At[t];if(e){var i=e.newName,n=e.since;e.removed?i?ht(16003,t,n,i):ht(16002,t,n):i?at(16001,t,n,i):at(16e3,t,n)}}var Bt=function(){function t(t){this.id=0|998*Math.random(),this.prefix=t?t+".":""}return t.prototype.getNewId=function(){return this.prefix+(++this.id).toString()},t}();Ct=Bt,Bt.global=new Ct("global");var Mt=new Bt("TmpCId."),Pt="undefined"==typeof Symbol?"__aliases__":Symbol("[[Aliases]]"),Et="__classname__",kt="__cid__";function Rt(t){return"number"==typeof t||t instanceof Number}function Ot(t){return"string"==typeof t||t instanceof String}function Ft(t){for(var e in t)return!1;return!0}var Lt,Vt=(Lt={value:void 0,enumerable:!1,writable:!1,configurable:!0},function(t,e,i,n,r){Lt.value=i,Lt.writable=n,Lt.enumerable=r,Object.defineProperty(t,e,Lt),Lt.value=void 0}),Nt=function(){var t={get:void 0,set:void 0,enumerable:!1};return function(e,i,n,r,s,a){void 0===s&&(s=!1),void 0===a&&(a=!1),"boolean"==typeof r&&(it(1031),s=r,r=void 0),t.get=n,t.set=r,t.enumerable=s,t.configurable=a,Object.defineProperty(e,i,t),t.get=void 0,t.set=void 0}}(),zt=function(){var t={get:void 0,enumerable:!1,configurable:!1};return function(e,i,n,r,s){t.get=n,t.enumerable=r,t.configurable=s,Object.defineProperty(e,i,t),t.get=void 0}}(),Ut=function(){var t={set:void 0,enumerable:!1,configurable:!1};return function(e,i,n,r,s){t.set=n,t.enumerable=r,t.configurable=s,Object.defineProperty(e,i,t),t.set=void 0}}();function Gt(t){var e=Object.create(null);return t&&(e["."]=1,e["/"]=1,delete e["."],delete e["/"]),e}function Ht(t){if("function"==typeof t){var e=t.prototype;if(e&&e.hasOwnProperty(Et)&&e[Et])return e[Et];var i="";if(t.name)i=t.name;else if(t.toString){var n,r=t.toString();(n="["===r.charAt(0)?/\[\w+\s*(\w+)\]/.exec(r):/^function\s*(\w+)/.exec(r))&&2===n.length&&(i=n[1])}return"Object"!==i?i:""}return t&&t.constructor?Ht(t.constructor):""}function Wt(t,e,i,n){var r=/([^.]+)$/,s=r.exec(e)[0],a=r.exec(i)[0];function o(){return this[a]}n?Nt(t,s,o,(function(t){this[a]=t})):zt(t,s,o)}function jt(t,e,i,n){for(var r in i)Wt(t,e+"."+r,i[r],n)}var qt=/(%d)|(%s)/,Xt=/%s/;function Yt(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n0){--this.count;var t=this._pool[this.count];return this._pool[this.count]=null,t}return null},t.put=function(t){var e=this._pool;if(this.count=0&&(this._pool.length=t,this.count>t&&(this.count=t))},e}(),ve=function(){function t(t){this.i=0,this.array=t}var e=t.prototype;return e.remove=function(t){var e=this.array.indexOf(t);e>=0&&this.removeAt(e)},e.removeAt=function(t){this.array.splice(t,1),t<=this.i&&--this.i},e.fastRemove=function(t){var e=this.array.indexOf(t);e>=0&&this.fastRemoveAt(e)},e.fastRemoveAt=function(t){var e=this.array;e[t]=e[e.length-1],--e.length,t<=this.i&&--this.i},e.push=function(t){this.array.push(t)},n(t,[{key:"length",get:function(){return this.array.length},set:function(t){this.array.length=t,this.i>=t&&(this.i=t-1)}}]),t}();function ye(t,e){t.splice(e,1)}function be(t,e){var i=t.length;e<0||e>=i||(t[e]=t[i-1],t.length=i-1)}function Se(t,e){var i=t.indexOf(e);return i>=0&&(ye(t,i),!0)}function xe(t,e){var i=t.indexOf(e);i>=0&&(t[i]=t[t.length-1],--t.length)}function we(t,e){var i=t.findIndex(e);if(i>=0){var n=t[i];return ye(t,i),n}}function Te(t,e){return t.indexOf(e)>=0}function Ce(t){for(var e=0,i=arguments.length<=1?0:arguments.length-1;e0)for(var i,n=p(t);!(i=n()).done;)if(!(i.value instanceof e))return it(1300),!1;return!0}}),De={IDGenerator:Bt,Pool:ge,array:Ae,isNumber:Rt,isString:Ot,isEmptyObject:Ft,getPropertyDescriptor:Jt,addon:Zt,mixin:$t,extend:te,getSuper:ee,isChildClassOf:ie,clear:ne,value:Vt,getset:Nt,get:zt,set:Ut,unregisterClass:ce,getClassName:Ht,setClassName:ue,setClassAlias:le,getClassByName:_e,getClassById:de,get _registeredClassNames(){return r({},se)},set _registeredClassNames(t){ne(se),Object.assign(se,t)},get _registeredClassIds(){return r({},re)},set _registeredClassIds(t){ne(re),Object.assign(re,t)},_getClassId:pe,getClassId:me,_setClassId:oe,_getClassById:fe,obsolete:Wt,obsoletes:jt,formatStr:Yt,shiftArguments:Qt,createMap:Gt};A.js=De;var Ie=Object.freeze({__proto__:null,IDGenerator:Bt,Pool:ge,_getClassById:fe,_getClassId:pe,_idToClass:re,_nameToClass:se,_setClassId:oe,addon:Zt,array:Ae,clear:ne,copyAllProperties:function(t,e,i){for(var n=Object.getOwnPropertyNames(t),r=0,s=n.length;r=0&&t.length,t.length}t("bF",Ie),Be.isBitMask=function(t){return t&&Object.prototype.hasOwnProperty.call(t,"__bitmask__")},Be.getList=function(t){return t.__bitmask__?t.__bitmask__:Be.update(t)},Be.update=function(t){Array.isArray(t.__bitmask__)||(t.__bitmask__=[]);var e=t.__bitmask__;for(var i in e.length=0,t){var n=t[i];Number.isInteger(n)&&e.push({name:i,value:n})}return e.sort((function(t,e){return t.value-e.value})),e},A.BitMask=Be;var Pe=Object.prototype.hasOwnProperty;function Ee(t){return"__enums__"in t?t:(Vt(t,"__enums__",null,!0),Ee.update(t))}function ke(t){Pe.call(t,"__enums__")}function Re(t){ke(t);var e=t.__enums__||[];e.length=0;var i=!0;for(var n in t){var r=t[n],s=Number.isInteger(r);s||(i=!1),(s||"string"==typeof r&&t[r]!==Number.parseInt(n))&&e.push({name:n,value:r})}return i&&e.sort((function(t,e){return t.value-e.value})),t.__enums__=e,e}function Oe(t){"__enums__"in t||Vt(t,"__enums__",null,!0)}Ee.update=function(t){for(var e=-1,i=Object.keys(t),n=0;n2?i-2:0),r=2;r1?e-1:0),n=1;ni){var n=e;e=i,i=n}return t=0;n--){var r=i[n];r.hasOwnProperty("__attrs__")&&r.__attrs__||ri(r,(e=i[n+1])&&e.__attrs__)}return ri(t,(e=i[0])&&e.__attrs__),t.__attrs__}function ai(t,e){var i=oi(t),n=e+ni,r={};for(var s in i)s.startsWith(n)&&(r[s.slice(n.length)]=i[s]);return r}function oi(t){return t.hasOwnProperty("__attrs__")&&t.__attrs__||si(t)}function hi(t,e,i,n){oi(t)[e+ni+i]=n}var ui=function(){function t(t,e){this.name=t,this.default=e}return t.prototype.toString=function(){return this.name},t}(),li=t("bX",new ui("Integer",0));A.Integer=li,A.CCInteger=li;var ci=t("bY",new ui("Float",0));A.Float=ci,A.CCFloat=ci;var fi=t("bZ",new ui("Boolean",!1));A.Boolean=fi,A.CCBoolean=fi;var di=t("b_",new ui("String",""));function _i(t,e){return function(i,n){var r='"'+Ht(i)+"."+n+'"',s=ai(i,n),a=s.type;if(a===li||a===ci?a="Number":a!==di&&a!==fi||(a=""+a),a===t){if(s.hasOwnProperty("default")){var o=s.default;if(void 0!==o&&!Array.isArray(o)&&!$e(o)){var h=typeof o,u=t.toLowerCase();if(h===u)if("object"===u){if(!o||o instanceof s.ctor)return;at(3605,r,Ht(s.ctor))}else"Number"!==t&&at(3606,e,r,t);else{if("function"===h)return;t===di.default&&null==o?at(3607,r):at(3611,e,r,h)}delete s.type}}}else at(3604,r)}}A.String=di,A.CCString=di;var pi=Object.freeze({__proto__:null,CCBoolean:fi,CCFloat:ci,CCInteger:li,CCString:di,DELIMETER:ni,PrimitiveType:ui,attr:ai,createAttrs:si,createAttrsSingle:ri,getClassAttrs:oi,getObjTypeChecker_ET:function(t){return function(e,i){_i("Object","type")(e,i);var n=oi(e)[i+ni+"default"],r=A.Class.getDefault(n);if(!Array.isArray(r)&&ie(t,A.ValueType)){var s=Ht(t),a=Yt('No need to specify the "type" of "%s.%s" because %s is a child class of ValueType.',Ht(e),i,s);n?X(a):at(3612,a,s,Ht(e),i,s)}}},getTypeChecker_ET:_i,setClassAttr:hi}),mi={default:{},serializable:{},editorOnly:{},formerlySerializedAs:{}};function gi(t,e,i,n){if(!t.get&&!t.set&&t.hasOwnProperty("default")){var r="_N$"+e;t.get=function(){return this[r]},t.set=function(t){var e=this[r];this[r]=t,i.call(this,e)};var s={};for(var a in n[r]=s,mi){var o=mi[a];t.hasOwnProperty(a)&&(s[a]=t[a],o.canUsedInGet||delete t[a])}}}function vi(t,e,i,n){if(Array.isArray(e)){if(!(e.length>0))return ht(5508,i,n);t.type=e=e[0]}"function"==typeof e&&(e===String?t.type=A.String:e===Boolean?t.type=A.Boolean:e===Number&&(t.type=A.Float))}function yi(t,e,i){var n=t||void 0===e?{_short:!0}:{_short:!0,default:e};return i&&(n.type=i),n}function bi(t,e){if(!t||t.constructor!==Object){if(Array.isArray(t)&&t.length>0)return yi(e,[],t);if("function"==typeof t){var i=t;return yi(e,ie(i,A.ValueType)?new i:null,i)}return t instanceof ui?yi(e,void 0,t):yi(e,t)}return null}function Si(t,e){for(var i in t){var n=t[i],r=bi(n,!1);if(r&&(n=t[i]=r),n){var s=n.notify;s&&gi(n,i,s,t),"type"in n&&vi(n,n.type,e,i)}}}var xi=[];function wi(){return xi[xi.length-1]}function Ti(t,e,i){Ci(oi(t),e,i)}function Ci(t,e,i){t[""+e+ni+"type"]="Enum",t[""+e+ni+"enumList"]=Ee.getList(i)}A._RF={push:function(t,e,i,n){void 0===i&&(i=e,e=""),xi.push({uuid:e,script:i,module:t,exports:t.exports,beh:null,importMeta:n})},pop:function(){var t=xi.pop(),e=t.module,i=e.exports;if(i===t.exports){for(var n in i)return;e.exports=i=t.cls}},peek:wi};var Ai=ni,Di="__ctors__",Ii=t("c$","Enum"),Bi=t("d0","BitMask");function Mi(t,e){t.indexOf(e)<0&&t.push(e)}function Pi(t,e){Mi(t.__props__,e)}function Ei(t,e,i,n){Pi(t,i),Ui(t,n,e,i)}function ki(t,e,i,n){var r=n.get;n.set,r&&(Ui(t,n,e,i),hi(t,i,"serializable",!1))}function Ri(t){return"function"==typeof t?t():t}function Oi(t,e,i){var n=i.ctor;return Vt(n,Di,!0,!0),n.prototype,e&&(n.$super=e),ue(t,n),n}function Fi(t,e,i){var n=A.Component,r=wi();if(r&&ie(e,n)){if(ie(r.cls,n))return ht(3615),null;t=t||r.script}var s=Oi(t,e,i);if(r)if(ie(e,n)){var a=r.uuid;a&&oe(a,s),r.cls=s}else ie(r.cls,n)||(r.cls=s);return s}function Li(t,e,i,n){if(t.__props__=[],n&&n.__props__&&(t.__props__=n.__props__.slice()),i)for(var r in Si(i,e),i){var s=i[r];s.get||s.set?ki(t,e,r,s):Ei(t,e,r,s)}var a=oi(t);t.__values__=t.__props__.filter((function(t){return!1!==a[""+t+Ai+"serializable"]}))}function Vi(t){var e=t.name,i=t.extends,n=Fi(e,i,t);e||(e=A.js.getClassName(n)),n._sealed=!0,i&&(i._sealed=!1),Li(n,e,t.properties,i);var r=t.editor;return r&&ie(i,A.Component)&&A.Component._registerEditorProps(n,r),n}function Ni(t){return null==t||null==t.hasOwnProperty?void 0:t.hasOwnProperty("__values__")}Vi._isCCClass=function(t){return null==t||null==t.hasOwnProperty?void 0:t.hasOwnProperty(Di)},Vi.fastDefine=function(t,e,i){ue(t,e);for(var n=e.__props__=e.__values__=Object.keys(i),r=oi(e),s=0;s=2&&((r||a())[s+"min"]=l[0],r[s+"max"]=l[1],l.length>2&&(r[s+"step"]=l[2])),u("step","number"),u("userData","object")}Vi.isArray=function(t){return t=Ri(t),Array.isArray(t)},Vi.getDefault=Ri,Vi.escapeForJS=function(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},Vi.IDENTIFIER_RE=/^[A-Za-z_$][0-9A-Za-z_$]*$/,Vi.getNewValueTypeCode=function(t){for(var e=Ht(t),i=t.constructor,n="new "+e+"(",r=0;ri){var n=e;e=i,i=n}return ti?i:t}function tn(t){return t<0?0:t>1?1:t}function en(t,e,i){return t+(e-t)*i}function nn(t){return t*ji}function rn(t){return t*qi}function sn(){return Xi()}function an(t){Xi=t}function on(t,e){return sn()*(e-t)+t}function hn(t,e){return Hi(on(t,e))}function un(t){return(t=(9301*t+49297)%233280)/233280}function ln(t,e,i){return un(t)*(i-e)+e}function cn(t,e,i){return Hi(ln(t,e,i))}function fn(t){return O(t)}function dn(t,e){return t-Hi(t/e)*e}function _n(t,e){return t=dn(t,2*e),e-Gi(t-e)}function pn(t,e,i){return(i-t)/(e-t)}function mn(t){return Gi(t.x)>Gi(t.y)?Gi(t.x)>Gi(t.z)?t.x:t.z:Gi(t.y)>Gi(t.z)?t.y:t.z}function gn(t,e){return Gi(t)>Gi(e)?t:e}function vn(t,e){e.forEach((function(e){Object.defineProperty(t,e,{enumerable:!0})}))}var yn,bn,Sn=(yn=new Float32Array(1),bn=new Int32Array(yn.buffer),function(t){yn[0]=t;var e=bn[0],i=e>>16&32768,n=2147483647&e,r=n-(112<<23)+4096>>13;return r=n<113<<23?0:r,r=n>=143<<23?31744:r,r=n>255<<23?32256:r,bn[0]=i|r,bn[0]}),xn=function(){var t=new Float32Array(1),e=new Int32Array(t.buffer);return function(i){var n,r=32767&i,s=r<<13;return 31744!==s?(s+=112<<23,0===r?s=(1048575&s)>>1:32767===r&&(s=2147483647)):s=2139095040,n=(i>>15&1)<<31|s,e[0]=n,t[0]}}();function wn(t){return Sn(t)}function Tn(t){return xn(t)}var Cn=Math.abs,An=Math.max,Dn=Math.min,In=Math.PI,Bn=Math.sin,Mn=Math.cos,Pn=Math.atan2,En=Math.sqrt,kn=Math.ceil,Rn=Math.floor,On=Math.round;function Fn(t,e,i,n){return Object.freeze(new Vn(t,e,i,n))}var Ln,Vn=t("aU",function(t){function e(e,i,n,r){var s;return s=t.call(this)||this,"object"==typeof e?(s.x=e.x,s.y=e.y,s.z=e.z,s.w=e.w):(s.x=e||0,s.y=i||0,s.z=n||0,s.w=r||0),s}s(e,t),e.clone=function(t){return new e(t.x,t.y,t.z,t.w)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t},e.set=function(t,e,i,n,r){return t.x=e,t.y=i,t.z=n,t.w=r,t},e.fromColor=function(t,e){return t.x=e.r,t.y=e.g,t.z=e.b,t.w=e.a,t},e.angle=function(t,e){var i=t.y*e.z-t.z*e.y,n=t.z*e.x-t.x*e.z,r=t.x*e.y-t.y*e.x,s=t.x*e.x+t.y*e.y+t.z*e.z;return Pn(En(i*i+n*n+r*r),s)},e.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t.z=e.z+i.z,t.w=e.w+i.w,t},e.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t.z=e.z-i.z,t.w=e.w-i.w,t},e.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t.z=e.z*i.z,t.w=e.w*i.w,t},e.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t.z=e.z/i.z,t.w=e.w/i.w,t},e.ceil=function(t,e){return t.x=kn(e.x),t.y=kn(e.y),t.z=kn(e.z),t.w=kn(e.w),t},e.floor=function(t,e){return t.x=Rn(e.x),t.y=Rn(e.y),t.z=Rn(e.z),t.w=Rn(e.w),t},e.min=function(t,e,i){return t.x=Dn(e.x,i.x),t.y=Dn(e.y,i.y),t.z=Dn(e.z,i.z),t.w=Dn(e.w,i.w),t},e.max=function(t,e,i){return t.x=An(e.x,i.x),t.y=An(e.y,i.y),t.z=An(e.z,i.z),t.w=An(e.w,i.w),t},e.round=function(t,e){return t.x=On(e.x),t.y=On(e.y),t.z=On(e.z),t.w=On(e.w),t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t.w=e.w+i.w*n,t},e.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,s=e.w-t.w;return En(i*i+n*n+r*r+s*s)},e.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,s=e.w-t.w;return i*i+n*n+r*r+s*s},e.len=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return En(e*e+i*i+n*n+r*r)},e.lengthSqr=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return e*e+i*i+n*n+r*r},e.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},e.inverse=function(t,e){return t.x=1/e.x,t.y=1/e.y,t.z=1/e.z,t.w=1/e.w,t},e.inverseSafe=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w;return Cn(i)0?(a=1/En(a),t.x=i*a,t.y=n*a,t.z=r*a,t.w=s*a):(t.x=0,t.y=0,t.z=0,t.w=0),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t.w=e.w+n*(i.w-e.w),t},e.scale=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.random=function(t,e){e=e||1;var i=2*sn()*In,n=2*sn()-1,r=En(1-n*n);return t.x=r*Mn(i)*e,t.y=r*Bn(i)*e,t.z=n*e,t.w=0,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,t.w=i.m03*n+i.m07*r+i.m11*s+i.m15*a,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,t.w=e.w,t},e.transformQuat=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.x,o=i.y,h=i.z,u=i.w,l=u*n+o*s-h*r,c=u*r+h*n-a*s,f=u*s+a*r-o*n,d=-a*n-o*r-h*s;return t.x=l*u+d*-a+c*-h-f*-o,t.y=c*u+d*-o+f*-a-l*-h,t.z=f*u+d*-h+l*-o-c*-a,t.w=e.w,t},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t[i+3]=e.w,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t.w=e[i+3],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},e.equals=function(t,e,i){void 0===i&&(i=Ji);var n=1/0;return!(Cn(t.x)===n||Cn(t.y)===n||Cn(t.z)===n||Cn(t.w)===n||Cn(e.x)===n||Cn(e.y)===n||Cn(e.z)===n||Cn(e.w)===n)&&Cn(t.x-e.x)<=i*An(1,Cn(t.x),Cn(e.x))&&Cn(t.y-e.y)<=i*An(1,Cn(t.y),Cn(e.y))&&Cn(t.z-e.z)<=i*An(1,Cn(t.z),Cn(e.z))&&Cn(t.w-e.w)<=i*An(1,Cn(t.w),Cn(e.w))};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z,this.w)},i.set=function(t,e,i,n){return"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||0),this},i.equals=function(t,e){void 0===e&&(e=Ji);var i=this;return Cn(i.x-t.x)<=e*An(1,Cn(i.x),Cn(t.x))&&Cn(i.y-t.y)<=e*An(1,Cn(i.y),Cn(t.y))&&Cn(i.z-t.z)<=e*An(1,Cn(i.z),Cn(t.z))&&Cn(i.w-t.w)<=e*An(1,Cn(i.w),Cn(t.w))},i.equals4f=function(t,e,i,n,r){void 0===r&&(r=Ji);var s=this;return Cn(s.x-t)<=r*An(1,Cn(s.x),Cn(t))&&Cn(s.y-e)<=r*An(1,Cn(s.y),Cn(e))&&Cn(s.z-i)<=r*An(1,Cn(s.z),Cn(i))&&Cn(s.w-n)<=r*An(1,Cn(s.w),Cn(n))},i.strictEquals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},i.strictEquals4f=function(t,e,i,n){return this.x===t&&this.y===e&&this.z===i&&this.w===n},i.lerp=function(t,e){var i=this,n=i.x,r=i.y,s=i.z,a=i.w;return i.x=n+e*(t.x-n),i.y=r+e*(t.y-r),i.z=s+e*(t.z-s),i.w=a+e*(t.w-a),i},i.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},i.clampf=function(t,e){var i=this;return i.x=$i(i.x,t.x,e.x),i.y=$i(i.y,t.y,e.y),i.z=$i(i.z,t.z,e.z),i.w=$i(i.w,t.w,e.w),i},i.add=function(t){var e=this;return e.x+=t.x,e.y+=t.y,e.z+=t.z,e.w+=t.w,e},i.add4f=function(t,e,i,n){var r=this;return r.x+=t,r.y+=e,r.z+=i,r.w+=n,r},i.subtract=function(t){var e=this;return e.x-=t.x,e.y-=t.y,e.z-=t.z,e.w-=t.w,e},i.subtract4f=function(t,e,i,n){var r=this;return r.x-=t,r.y-=e,r.z-=i,r.w-=n,r},i.multiplyScalar=function(t){var e=this;return e.x*=t,e.y*=t,e.z*=t,e.w*=t,e},i.multiply=function(t){var e=this;return e.x*=t.x,e.y*=t.y,e.z*=t.z,e.w*=t.w,e},i.multiply4f=function(t,e,i,n){var r=this;return r.x*=t,r.y*=e,r.z*=i,r.w*=n,r},i.divide=function(t){var e=this;return e.x/=t.x,e.y/=t.y,e.z/=t.z,e.w/=t.w,e},i.divide4f=function(t,e,i,n){var r=this;return r.x/=t,r.y/=e,r.z/=i,r.w/=n,r},i.negative=function(){var t=this;return t.x=-t.x,t.y=-t.y,t.z=-t.z,t.w=-t.w,t},i.dot=function(t){var e=this;return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},i.cross=function(t){var e=this,i=e.x,n=e.y,r=e.z,s=t.x,a=t.y,o=t.z;return e.x=n*o-r*a,e.y=r*s-i*o,e.z=i*a-n*s,e},i.length=function(){var t=this,e=t.x,i=t.y,n=t.z,r=t.w;return En(e*e+i*i+n*n+r*r)},i.lengthSqr=function(){var t=this,e=t.x,i=t.y,n=t.z,r=t.w;return e*e+i*i+n*n+r*r},i.normalize=function(){var t=this,e=t.x,i=t.y,n=t.z,r=t.w,s=e*e+i*i+n*n+r*r;return s>0&&(s=1/En(s),t.x=e*s,t.y=i*s,t.z=n*s,t.w=r*s),t},i.scale=function(t){var e=this;return e.x*=t,e.y*=t,e.z*=t,e.w*=t,e},i.transformMat4=function(t){var e=this,i=e.x,n=e.y,r=e.z,s=e.w;return e.x=t.m00*i+t.m04*n+t.m08*r+t.m12*s,e.y=t.m01*i+t.m05*n+t.m09*r+t.m13*s,e.z=t.m02*i+t.m06*n+t.m10*r+t.m14*s,e.w=t.m03*i+t.m07*n+t.m11*r+t.m15*s,e},e}(Fe));function Nn(t,e,i,n){return new Vn(t,e,i,n)}Vn.ZERO=Fn(0,0,0,0),Vn.ONE=Fn(1,1,1,1),Vn.NEG_ONE=Fn(-1,-1,-1,-1),Vn.UNIT_X=Fn(1,0,0,0),Vn.UNIT_Y=Fn(0,1,0,0),Vn.UNIT_Z=Fn(0,0,1,0),Vn.UNIT_W=Fn(0,0,0,1),Vi.fastDefine("cc.Vec4",Vn,{x:0,y:0,z:0,w:0}),A.Vec4=Vn,A.v4=Nn;var zn=Math.abs,Un=Math.max,Gn=Math.min,Hn=Math.PI,Wn=Math.acos,jn=Math.sin,qn=Math.cos,Xn=Math.sqrt,Yn=Math.ceil,Qn=Math.floor,Jn=Math.round;function Kn(t,e,i){return Object.freeze(new ir(t,e,i))}var Zn,$n,tr,er,ir=t("aS",function(t){function e(e,i,n){var r;return r=t.call(this)||this,"object"==typeof e?(r.x=e.x,r.y=e.y,r.z=e.z):(r.x=e||0,r.y=i||0,r.z=n||0),r}s(e,t),e.zero=function(t){return t.x=0,t.y=0,t.z=0,t},e.clone=function(t){return new e(t.x,t.y,t.z)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t},e.set=function(t,e,i,n){return t.x=e,t.y=i,t.z=n,t},e.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t.z=e.z+i.z,t},e.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t.z=e.z-i.z,t},e.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t.z=e.z*i.z,t},e.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t.z=e.z/i.z,t},e.ceil=function(t,e){return t.x=Yn(e.x),t.y=Yn(e.y),t.z=Yn(e.z),t},e.floor=function(t,e){return t.x=Qn(e.x),t.y=Qn(e.y),t.z=Qn(e.z),t},e.min=function(t,e,i){return t.x=Gn(e.x,i.x),t.y=Gn(e.y,i.y),t.z=Gn(e.z,i.z),t},e.max=function(t,e,i){return t.x=Un(e.x,i.x),t.y=Un(e.y,i.y),t.z=Un(e.z,i.z),t},e.round=function(t,e){return t.x=Jn(e.x),t.y=Jn(e.y),t.z=Jn(e.z),t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t},e.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z;return Xn(i*i+n*n+r*r)},e.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z;return i*i+n*n+r*r},e.len=function(t){var e=t.x,i=t.y,n=t.z;return Xn(e*e+i*i+n*n)},e.lengthSqr=function(t){var e=t.x,i=t.y,n=t.z;return e*e+i*i+n*n},e.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},e.invert=function(t,e){return t.x=1/e.x,t.y=1/e.y,t.z=1/e.z,t},e.invertSafe=function(t,e){var i=e.x,n=e.y,r=e.z;return zn(i)0?(s=1/Xn(s),t.x=i*s,t.y=n*s,t.z=r*s):(t.x=0,t.y=0,t.z=0),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},e.cross=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.x,o=i.y,h=i.z;return t.x=r*h-s*o,t.y=s*a-n*h,t.z=n*o-r*a,t},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t},e.random=function(t,e){e=e||1;var i=2*sn()*Hn,n=2*sn()-1,r=Xn(1-n*n);return t.x=r*qn(i)*e,t.y=r*jn(i)*e,t.z=n*e,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.m03*n+i.m07*r+i.m11*s+i.m15;return a=a?1/a:1,t.x=(i.m00*n+i.m04*r+i.m08*s+i.m12)*a,t.y=(i.m01*n+i.m05*r+i.m09*s+i.m13)*a,t.z=(i.m02*n+i.m06*r+i.m10*s+i.m14)*a,t},e.transformMat4Normal=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.m03*n+i.m07*r+i.m11*s;return a=a?1/a:1,t.x=(i.m00*n+i.m04*r+i.m08*s)*a,t.y=(i.m01*n+i.m05*r+i.m09*s)*a,t.z=(i.m02*n+i.m06*r+i.m10*s)*a,t},e.transformMat3=function(t,e,i){var n=e.x,r=e.y,s=e.z;return t.x=n*i.m00+r*i.m03+s*i.m06,t.y=n*i.m01+r*i.m04+s*i.m07,t.z=n*i.m02+r*i.m05+s*i.m08,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14,t},e.transformQuat=function(t,e,i){var n=i.w*e.x+i.y*e.z-i.z*e.y,r=i.w*e.y+i.z*e.x-i.x*e.z,s=i.w*e.z+i.x*e.y-i.y*e.x,a=-i.x*e.x-i.y*e.y-i.z*e.z;return t.x=n*i.w+a*-i.x+r*-i.z-s*-i.y,t.y=r*i.w+a*-i.y+s*-i.x-n*-i.z,t.z=s*i.w+a*-i.z+n*-i.y-r*-i.x,t},e.transformRTS=function(t,e,i,n,r){var s=e.x*r.x,a=e.y*r.y,o=e.z*r.z,h=i.w*s+i.y*o-i.z*a,u=i.w*a+i.z*s-i.x*o,l=i.w*o+i.x*a-i.y*s,c=-i.x*s-i.y*a-i.z*o;return t.x=h*i.w+c*-i.x+u*-i.z-l*-i.y+n.x,t.y=u*i.w+c*-i.y+l*-i.x-h*-i.z+n.y,t.z=l*i.w+c*-i.z+h*-i.y-u*-i.x+n.z,t},e.transformInverseRTS=function(t,e,i,n,r){var s=e.x-n.x,a=e.y-n.y,o=e.z-n.z,h=i.w*s-i.y*o+i.z*a,u=i.w*a-i.z*s+i.x*o,l=i.w*o-i.x*a+i.y*s,c=i.x*s+i.y*a+i.z*o;return t.x=(h*i.w+c*i.x+u*i.z-l*i.y)/r.x,t.y=(u*i.w+c*i.y+l*i.x-h*i.z)/r.y,t.z=(l*i.w+c*i.z+h*i.y-u*i.x)/r.z,t},e.rotateX=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=qn(n),h=jn(n),u=r,l=s*o-a*h,c=s*h+a*o;return t.x=u+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateY=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=qn(n),h=jn(n),u=a*h+r*o,l=s,c=a*o-r*h;return t.x=u+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateZ=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=qn(n),h=jn(n),u=r*o-s*h,l=r*h+s*o,c=a;return t.x=u+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateN=function(t,e,i,n,r){var s=e.x-i.x,a=e.y-i.y,o=e.z-i.z,h=n.x,u=n.y,l=n.z,c=qn(r),f=jn(r),d=s*(h*h*(1-c)+c)+a*(h*u*(1-c)-l*f)+o*(h*l*(1-c)+u*f),_=s*(h*u*(1-c)+l*f)+a*(u*u*(1-c)+c)+o*(u*l*(1-c)-h*f),p=s*(h*l*(1-c)-u*f)+a*(u*l*(1-c)+h*f)+o*(l*l*(1-c)+c);return t.x=d+i.x,t.y=_+i.y,t.z=p+i.z,t},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z},e.equals=function(t,e,i){void 0===i&&(i=Ji);var n=t.x,r=t.y,s=t.z,a=e.x,o=e.y,h=e.z;return zn(n-a)<=i*Un(1,zn(n),zn(a))&&zn(r-o)<=i*Un(1,zn(r),zn(o))&&zn(s-h)<=i*Un(1,zn(s),zn(h))},e.angle=function(t,e){var i=t.x*t.x+t.y*t.y+t.z*t.z,n=e.x*e.x+e.y*e.y+e.z*e.z;if(0===i||0===n)return 0;var r=(t.x*e.x+t.y*e.y+t.z*e.z)/Xn(i*n);return r=$i(r,-1,1),Wn(r)},e.projectOnPlane=function(t,i,n){return e.subtract(t,i,e.project(t,i,n))},e.project=function(t,i,n){var r=e.lengthSqr(n);return r<1e-6?e.set(t,0,0,0):e.multiplyScalar(t,n,e.dot(i,n)/r)},e.moveTowards=function(t,e,i,n){var r=i.x-e.x,s=i.y-e.y,a=i.z-e.z,o=r*r+s*s+a*a;if(0===o||n>=0&&o0&&(r=1/Xn(r),t.x=e*r,t.y=i*r,t.z=n*r),t},i.transformMat4=function(t){var e=this,i=e.x,n=e.y,r=e.z,s=t.m03*i+t.m07*n+t.m11*r+t.m15;return s=s?1/s:1,e.x=(t.m00*i+t.m04*n+t.m08*r+t.m12)*s,e.y=(t.m01*i+t.m05*n+t.m09*r+t.m13)*s,e.z=(t.m02*i+t.m06*n+t.m10*r+t.m14)*s,e},i.toVec2=function(){return new A.Vec2(this.x,this.y)},e}(Fe));function nr(t,e,i){return new ir(t,e,i)}Ln=ir,ir.UNIT_X=Kn(1,0,0),ir.UNIT_Y=Kn(0,1,0),ir.UNIT_Z=Kn(0,0,1),ir.RIGHT=Kn(1,0,0),ir.UP=Kn(0,1,0),ir.FORWARD=Kn(0,0,-1),ir.ZERO=Kn(0,0,0),ir.ONE=Kn(1,1,1),ir.NEG_ONE=Kn(-1,-1,-1),ir.slerp=(Zn=new Ln,$n=new Ln,tr=new Ln,function(t,e,i,n){var r=1e-5,s=Ln.len(e),a=Ln.len(i);if(s.99999)return Ln.lerp(t,e,i,n);if(h<-.99999){var u=Ln.multiplyScalar(Zn,e,1/s),l=Ln.generateOrthogonal($n,u);return sr(tr,u,l,Hn*n),Ln.multiplyScalar(t,tr,o),t}var c=h,f=Wn(c)*n,d=Ln.multiplyScalar(Zn,e,1/s),_=Ln.multiplyScalar($n,i,1/a);return Ln.scaleAndAdd(tr,_,d,-c),Ln.normalize(tr,tr),Ln.multiplyScalar(tr,tr,jn(f)),Ln.scaleAndAdd(tr,tr,d,qn(f)),Ln.multiplyScalar(t,tr,o),t}),ir.signedAngle=(er=new Ln,function(t,e,i){var n=Ln.angle(t,e),r=Ln.cross(er,t,e);return Ln.dot(r,i)<0?-n:n}),Vi.fastDefine("cc.Vec3",ir,{x:0,y:0,z:0}),A.Vec3=ir;var rr,sr=(rr={x:0,y:0,z:0,w:0},function(t,e,i,n){var r=.5*n,s=jn(r);return rr.x=s*i.x,rr.y=s*i.y,rr.z=s*i.z,rr.w=qn(r),ir.transformQuat(t,e,rr),t});A.v3=nr;var ar=1/255,or=Math.abs,hr=Math.max;function ur(t,e,i,n){return Object.freeze(new cr(t,e,i,n))}var lr,cr=t("b3",function(t){function e(e,i,n,r){var s;return(s=t.call(this)||this)._data=new Uint8ClampedArray(4),"string"==typeof e?s.fromHEX(e):void 0!==i?s.set(e,i,n,r):s.set(e),s}s(e,t),e.clone=function(t){var i=new e;return i.r=t.r,i.g=t.g,i.b=t.b,i.a=t.a,i},e.copy=function(t,e){return t.r=e.r,t.g=e.g,t.b=e.b,t.a=e.a,t},e.set=function(t,e,i,n,r){return t.r=e,t.g=i,t.b=n,t.a=r,t},e.toVec4=function(t,e){var i=t._data;return(e=void 0!==e?e:new Vn).x=i[0]*ar,e.y=i[1]*ar,e.z=i[2]*ar,e.w=i[3]*ar,e},e.fromVec4=function(t,i){var n=(i=void 0===i?new e:i)._data;return n[0]=t.x/ar,n[1]=t.y/ar,n[2]=t.z/ar,n[3]=t.w/ar,i},e.fromHEX=function(t,e){var i;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]),i=Number("0x"+e)):(e<16777216&&(e=255+(e<<8)),i=e),t.r=i>>>24,t.g=(16711680&i)>>>16,t.b=(65280&i)>>>8,t.a=255&i,t},e.add=function(t,e,i){return t.r=e.r+i.r,t.g=e.g+i.g,t.b=e.b+i.b,t.a=e.a+i.a,t},e.subtract=function(t,e,i){return t.r=e.r-i.r,t.g=e.g-i.g,t.b=e.b-i.b,t.a=e.a-i.a,t},e.multiply=function(t,e,i){return t.r=e.r*i.r,t.g=e.g*i.g,t.b=e.b*i.b,t.a=e.a*i.a,t},e.divide=function(t,e,i){return t.r=e.r/i.r,t.g=e.g/i.g,t.b=e.b/i.b,t.a=e.a/i.a,t},e.scale=function(t,e,i){return t.r=e.r*i,t.g=e.g*i,t.b=e.b*i,t.a=e.a*i,t},e.lerp=function(t,e,i,n){var r=e.r,s=e.g,a=e.b,o=e.a;return t.r=r+(i.r-r)*n,t.g=s+(i.g-s)*n,t.b=a+(i.b-a)*n,t.a=o+(i.a-o)*n,t},e.toArray=function(t,i,n){void 0===n&&(n=0);var r=i instanceof e||i.a>1?1/255:1;return t[n+0]=i.r*r,t[n+1]=i.g*r,t[n+2]=i.b*r,t[n+3]=i.a*r,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),e.r=255*t[i+0],e.g=255*t[i+1],e.b=255*t[i+2],e.a=255*t[i+3],e},e.fromUint32=function(t,e){return e>>>=0,t.r=255&e,t.g=e>>8&255,t.b=e>>16&255,t.a=e>>24&255,t},e.toUint32=function(t){return(t.a<<24|t.b<<16|t.g<<8|t.r)>>>0},e.strictEquals=function(t,e){return t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a},e.equals=function(t,e,i){return void 0===i&&(i=Ji),!(or(t.r)===1/0||or(t.g)===1/0||or(t.b)===1/0||or(t.a)===1/0)&&or(t.r-e.r)<=i*hr(1,or(t.r),or(e.r))&&or(t.g-e.g)<=i*hr(1,or(t.g),or(e.g))&&or(t.b-e.b)<=i*hr(1,or(t.b),or(e.b))&&or(t.a-e.a)<=i*hr(1,or(t.a),or(e.a))},e.hex=function(t){return(255*t.r<<24|255*t.g<<16|255*t.b<<8|255*t.a)>>>0};var i=e.prototype;return i.clone=function(){var t=new e;return t._data.set(this._data),t},i.equals=function(t){var e=t,i=this._data;return t&&i[0]===e.r&&i[1]===e.g&&i[2]===e.b&&i[3]===e.a},i.lerp=function(t,i){return e.lerp(this,this,t,i),this},i.toString=function(){return"rgba("+this.r.toFixed()+", "+this.g.toFixed()+", "+this.b.toFixed()+", "+this.a.toFixed()+")"},i.toCSS=function(t){return void 0===t&&(t="rgba"),"rgba"===t?"rgba("+this.r+","+this.g+","+this.b+","+(this.a*ar).toFixed(2)+")":"rgb"===t?"rgb("+this.r+","+this.g+","+this.b+")":"#"+this.toHEX(t)},i.fromHEX=function(t){var e;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]),e=Number("0x"+t)):(t<16777216&&(t=255+(t<<8)),e=t),this.r=e>>>24,this.g=(16711680&e)>>>16,this.b=(65280&e)>>>8,this.a=255&e,this},i.toHEX=function(t){void 0===t&&(t="#rrggbb");var e=this._data,i="0",n=[(e[0]<16?i:"")+e[0].toString(16),(e[1]<16?i:"")+e[1].toString(16),(e[2]<16?i:"")+e[2].toString(16)];return"#rgb"===t?(n[0]=n[0][0],n[1]=n[1][0],n[2]=n[2][0]):"#rrggbbaa"===t&&n.push((e[3]<16?i:"")+e[3].toString(16)),n.join("")},i.toRGBValue=function(){return this._data[2]<<16|this._data[1]<<8|this._data[0]},i.fromHSV=function(t,e,i){var n=0,r=0,s=0;if(0===e)n=r=s=i;else if(0===i)n=r=s=0;else{1===t&&(t=0),t*=6;var a=Math.floor(t),o=t-a,h=i*(1-e),u=i*(1-e*o),l=i*(1-e*(1-o));switch(a){default:case 0:n=i,r=l,s=h;break;case 1:n=u,r=i,s=h;break;case 2:n=h,r=i,s=l;break;case 3:n=h,r=u,s=i;break;case 4:n=l,r=h,s=i;break;case 5:n=i,r=h,s=u}}var c=this._data;return c[0]=255*n,c[1]=255*r,c[2]=255*s,this},i.toHSV=function(){var t=this._data[0]*ar,e=this._data[1]*ar,i=this._data[2]*ar,n={h:0,s:0,v:0},r=Math.max(t,e,i),s=Math.min(t,e,i),a=0;return n.v=r,n.s=r?(r-s)/r:0,n.s?(a=r-s,n.h=t===r?(e-i)/a:e===r?2+(i-t)/a:4+(t-e)/a,n.h/=6,n.h<0&&(n.h+=1)):n.h=0,n},i.set=function(t,e,i,n){var r=this._data;if("object"==typeof t){var s,a,o,h,u=t;u._data?r.set(u._data):(r[0]=null!==(s=u.r)&&void 0!==s?s:0,r[1]=null!==(a=u.g)&&void 0!==a?a:0,r[2]=null!==(o=u.b)&&void 0!==o?o:0,r[3]=null!==(h=u.a)&&void 0!==h?h:255)}else r[0]=null!=t?t:0,r[1]=null!=e?e:0,r[2]=null!=i?i:0,r[3]=null!=n?n:255;return this},i.multiply=function(t){var e=this._data;return e[0]*=t.r/255,e[1]*=t.g/255,e[2]*=t.b/255,e[3]*=t.a/255,this},i.getModifiableProperties=function(){return["r","g","b","a"]},n(e,[{key:"r",get:function(){return this._data[0]},set:function(t){this._data[0]=t}},{key:"g",get:function(){return this._data[1]},set:function(t){this._data[1]=t}},{key:"b",get:function(){return this._data[2]},set:function(t){this._data[2]=t}},{key:"a",get:function(){return this._data[3]},set:function(t){this._data[3]=t}},{key:"x",get:function(){return this._data[0]*ar},set:function(t){this._data[0]=255*t}},{key:"y",get:function(){return this._data[1]*ar},set:function(t){this._data[1]=255*t}},{key:"z",get:function(){return this._data[2]*ar},set:function(t){this._data[2]=255*t}},{key:"w",get:function(){return this._data[3]*ar},set:function(t){this._data[3]=255*t}}]),e}(Fe));function fr(t,e,i,n){return new cr(t,e,i,n)}function dr(t,e,i){if(e>i){var n=e;e=i,i=n}return ti?i:t}function _r(t){var e=t.clone();return e.x=Math.floor(t.x),e.y=Math.floor(t.y),e.z=Math.floor(t.z),e}cr.WHITE=ur(255,255,255,255),cr.GRAY=ur(127,127,127,255),cr.BLACK=ur(0,0,0,255),cr.TRANSPARENT=ur(0,0,0,0),cr.RED=ur(255,0,0,255),cr.GREEN=ur(0,255,0,255),cr.BLUE=ur(0,0,255,255),cr.CYAN=ur(0,255,255,255),cr.MAGENTA=ur(255,0,255,255),cr.YELLOW=ur(255,255,0,255),Vi.fastDefine("cc.Color",cr,{r:0,g:0,b:0,a:255}),A.Color=cr,A.color=fr;var pr=Math.abs,mr=Math.max,gr=t("aY",function(t){function e(e,i,n,r,s,a,o,h,u){var l;void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=1);var c=f(l=t.call(this)||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=i,c.m02=n,c.m03=r,c.m04=s,c.m05=a,c.m06=o,c.m07=h,c.m08=u),l}s(e,t),e.clone=function(t){return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08)},e.copy=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t},e.set=function(t,e,i,n,r,s,a,o,h,u){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=a,t.m06=o,t.m07=h,t.m08=u,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=1,t.m05=0,t.m06=0,t.m07=0,t.m08=1,t},e.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m05;t.m01=e.m03,t.m02=e.m06,t.m03=i,t.m05=e.m07,t.m06=n,t.m07=r}else t.m00=e.m00,t.m01=e.m03,t.m02=e.m06,t.m03=e.m01,t.m04=e.m04,t.m05=e.m07,t.m06=e.m02,t.m07=e.m05,t.m08=e.m08;return t},e.invert=function(t,i){var n=i.m00,r=i.m01,s=i.m02,a=i.m03,o=i.m04,h=i.m05,u=i.m06,l=i.m07,c=i.m08,f=c*o-h*l,d=-c*a+h*u,_=l*a-o*u,p=n*f+r*d+s*_;return 0===p?(e.set(t,0,0,0,0,0,0,0,0,0),t):(p=1/p,t.m00=f*p,t.m01=(-c*r+s*l)*p,t.m02=(h*r-s*o)*p,t.m03=d*p,t.m04=(c*n-s*u)*p,t.m05=(-h*n+s*a)*p,t.m06=_*p,t.m07=(-l*n+r*u)*p,t.m08=(o*n-r*a)*p,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,h=t.m07,u=t.m08;return e*(u*s-a*h)+i*(-u*r+a*o)+n*(h*r-s*o)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,f=i.m00,d=i.m01,_=i.m02,p=i.m03,m=i.m04,g=i.m05,v=i.m06,y=i.m07,b=i.m08;return t.m00=f*n+d*a+_*u,t.m01=f*r+d*o+_*l,t.m02=f*s+d*h+_*c,t.m03=p*n+m*a+g*u,t.m04=p*r+m*o+g*l,t.m05=p*s+m*h+g*c,t.m06=v*n+y*a+b*u,t.m07=v*r+y*o+b*l,t.m08=v*s+y*h+b*c,t},e.multiplyMat4=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,f=i.m00,d=i.m01,_=i.m02,p=i.m04,m=i.m05,g=i.m06,v=i.m08,y=i.m09,b=i.m10;return t.m00=f*n+d*a+_*u,t.m01=f*r+d*o+_*l,t.m02=f*s+d*h+_*c,t.m03=p*n+m*a+g*u,t.m04=p*r+m*o+g*l,t.m05=p*s+m*h+g*c,t.m06=v*n+y*a+b*u,t.m07=v*r+y*o+b*l,t.m08=v*s+y*h+b*c,t},e.transform=function(t,e,i){this.translate(t,e,i)},e.translate=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,f=i.x,d=i.y;return t.m00=n,t.m01=r,t.m02=s,t.m03=a,t.m04=o,t.m05=h,t.m06=f*n+d*a+u,t.m07=f*r+d*o+l,t.m08=f*s+d*h+c,t},e.scale=function(t,e,i){var n=i.x,r=i.y;return t.m00=n*e.m00,t.m01=n*e.m01,t.m02=n*e.m02,t.m03=r*e.m03,t.m04=r*e.m04,t.m05=r*e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t},e.rotate=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,f=Math.sin(i),d=Math.cos(i);return t.m00=d*n+f*a,t.m01=d*r+f*o,t.m02=d*s+f*h,t.m03=d*a-f*n,t.m04=d*o-f*r,t.m05=d*h-f*s,t.m06=u,t.m07=l,t.m08=c,t},e.fromMat4=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m04,t.m04=e.m05,t.m05=e.m06,t.m06=e.m08,t.m07=e.m09,t.m08=e.m10,t},e.fromViewUp=function(t,i,n){return ir.lengthSqr(i)-.999?(e.x=Math.asin(-o),e.y=Math.atan2(a,h),e.z=Math.atan2(n,s),!0):(e.x=Yi,e.y=Math.atan2(r,i),e.z=0,!1):(e.x=-Yi,e.y=Math.atan2(-r,i),e.z=0,!1)};var i=e.prototype;return i.clone=function(){return new e(this)},i.set=function(t,e,i,n,r,s,a,o,h){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=1);var u=this;return"object"==typeof t?(u.m00=t.m00,u.m01=t.m01,u.m02=t.m02,u.m03=t.m03,u.m04=t.m04,u.m05=t.m05,u.m06=t.m06,u.m07=t.m07,u.m08=t.m08):(u.m00=t,u.m01=e,u.m02=i,u.m03=n,u.m04=r,u.m05=s,u.m06=a,u.m07=o,u.m08=h),u},i.equals=function(t,i){return void 0===i&&(i=Ji),e.equals(this,t,i)},i.strictEquals=function(t){return e.strictEquals(this,t)},i.toString=function(){var t=this;return"[\n"+t.m00+", "+t.m01+", "+t.m02+",\n"+t.m03+", "+t.m04+", "+t.m05+",\n"+t.m06+", "+t.m07+", "+t.m08+"\n]"},i.identity=function(){return e.identity(this)},i.transpose=function(){var t=this,e=t.m01,i=t.m02,n=t.m05;return t.m01=t.m03,t.m02=t.m06,t.m03=e,t.m05=t.m07,t.m06=i,t.m07=n,t},i.invert=function(){return e.invert(this,this)},i.determinant=function(){return e.determinant(this)},i.add=function(t){var e=this;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},i.subtract=function(t){var e=this;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},i.multiply=function(t){return e.multiply(this,this,t)},i.multiplyScalar=function(t){var e=this;return e.m00*=t,e.m01*=t,e.m02*=t,e.m03*=t,e.m04*=t,e.m05*=t,e.m06*=t,e.m07*=t,e.m08*=t,e},i.scale=function(t){var e=t.x,i=t.y,n=this;return n.m00*=e,n.m01*=e,n.m02*=e,n.m03*=i,n.m04*=i,n.m05*=i,n},i.rotate=function(t){var e=this,i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=Math.sin(t),f=Math.cos(t);return e.m00=f*i+c*s,e.m01=f*n+c*a,e.m02=f*r+c*o,e.m03=f*s-c*i,e.m04=f*a-c*n,e.m05=f*o-c*r,e.m06=h,e.m07=u,e.m08=l,e},i.fromQuat=function(t){var e=t.x,i=t.y,n=t.z,r=t.w,s=e+e,a=i+i,o=n+n,h=e*s,u=i*s,l=i*a,c=n*s,f=n*a,d=n*o,_=r*s,p=r*a,m=r*o,g=this;return g.m00=1-l-d,g.m03=u-m,g.m06=c+p,g.m01=u+m,g.m04=1-h-d,g.m07=f-_,g.m02=c-p,g.m05=f+_,g.m08=1-h-l,g},e}(Fe));lr=gr,gr.IDENTITY=Object.freeze(new lr);var vr,yr=new ir,br=new ir;Vi.fastDefine("cc.Mat3",gr,{m00:1,m01:0,m02:0,m03:0,m04:1,m05:0,m06:0,m07:0,m08:1}),A.Mat3=gr;var Sr=Math.abs,wr=Math.max,Tr=Math.min,Cr=Math.PI,Ar=Math.acos,Dr=Math.sin,Ir=Math.cos,Br=Math.sqrt,Mr=Math.atan2,Pr=Math.asin,Er=Math.sign,kr=t("aW",function(t){function e(e,i,n,r){var s;return s=t.call(this)||this,"object"==typeof e?(s.x=e.x,s.y=e.y,s.z=e.z,s.w=e.w):(s.x=e||0,s.y=i||0,s.z=n||0,s.w=null!=r?r:1),s}s(e,t),e.clone=function(t){return new e(t.x,t.y,t.z,t.w)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t},e.set=function(t,e,i,n,r){return t.x=e,t.y=i,t.z=n,t.w=r,t},e.identity=function(t){return t.x=0,t.y=0,t.z=0,t.w=1,t},e.rotationTo=function(t,i,n){var r=ir.dot(i,n);return r<-.999999?(ir.cross(Lr,ir.UNIT_X,i),Lr.length()<1e-6&&ir.cross(Lr,ir.UNIT_Y,i),ir.normalize(Lr,Lr),e.fromAxisAngle(t,Lr,Cr),t):r>.999999?(t.x=0,t.y=0,t.z=0,t.w=1,t):(ir.cross(Lr,i,n),t.x=Lr.x,t.y=Lr.y,t.z=Lr.z,t.w=1+r,e.normalize(t,t))},e.getAxisAngle=function(t,e){var i=2*Ar(e.w),n=Dr(i/2);return 0!==n?(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n):(t.x=1,t.y=0,t.z=0),i},e.multiply=function(t,e,i){var n=e.x*i.w+e.w*i.x+e.y*i.z-e.z*i.y,r=e.y*i.w+e.w*i.y+e.z*i.x-e.x*i.z,s=e.z*i.w+e.w*i.z+e.x*i.y-e.y*i.x,a=e.w*i.w-e.x*i.x-e.y*i.y-e.z*i.z;return t.x=n,t.y=r,t.z=s,t.w=a,t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t.w=e.w+i.w*n,t},e.rotateX=function(t,e,i){var n=Dr(i*=.5),r=Ir(i),s=e.x,a=e.y,o=e.z,h=e.w;return t.x=s*r+h*n,t.y=a*r+o*n,t.z=o*r-a*n,t.w=h*r-s*n,t},e.rotateY=function(t,e,i){var n=Dr(i*=.5),r=Ir(i),s=e.x,a=e.y,o=e.z,h=e.w;return t.x=s*r-o*n,t.y=a*r+h*n,t.z=o*r+s*n,t.w=h*r-a*n,t},e.rotateZ=function(t,e,i){var n=Dr(i*=.5),r=Ir(i),s=e.x,a=e.y,o=e.z,h=e.w;return t.x=s*r+a*n,t.y=a*r-s*n,t.z=o*r+h*n,t.w=h*r-o*n,t},e.rotateAround=function(t,i,n,r){return e.invert(Or,i),ir.transformQuat(Lr,n,Or),e.fromAxisAngle(Or,Lr,r),e.multiply(t,i,Or),t},e.rotateAroundLocal=function(t,i,n,r){return e.fromAxisAngle(Or,n,r),e.multiply(t,i,Or),t},e.calculateW=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=Br(Sr(1-e.x*e.x-e.y*e.y-e.z*e.z)),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t.w=e.w+n*(i.w-e.w),t},e.slerp=function(t,e,i,n){var r=0,s=0,a=i.x,o=i.y,h=i.z,u=i.w,l=e.x*i.x+e.y*i.y+e.z*i.z+e.w*i.w;if(l<0&&(l=-l,a=-a,o=-o,h=-h,u=-u),1-l>1e-6){var c=Ar(l),f=Dr(c);r=Dr((1-n)*c)/f,s=Dr(n*c)/f}else r=1-n,s=n;return t.x=r*e.x+s*a,t.y=r*e.y+s*o,t.z=r*e.z+s*h,t.w=r*e.w+s*u,t},e.sqlerp=function(t,i,n,r,s,a){return e.slerp(Or,i,s,a),e.slerp(Fr,n,r,a),e.slerp(t,Or,Fr,2*a*(1-a)),t},e.invert=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w,n=i?1/i:0;return t.x=-e.x*n,t.y=-e.y*n,t.z=-e.z*n,t.w=e.w*n,t},e.conjugate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},e.len=function(t){return Br(t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w)},e.lengthSqr=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},e.normalize=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w;return i>0?(i=1/Br(i),t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i):(t.x=0,t.y=0,t.z=0,t.w=0),t},e.fromAxes=function(t,i,n,r){return gr.set(Vr,i.x,i.y,i.z,n.x,n.y,n.z,r.x,r.y,r.z),e.normalize(t,e.fromMat3(t,Vr))},e.fromViewUp=function(t,i,n){return gr.fromViewUp(Vr,i,n),e.normalize(t,e.fromMat3(t,Vr))},e.fromAxisAngle=function(t,e,i){var n=Dr(i*=.5);return t.x=n*e.x,t.y=n*e.y,t.z=n*e.z,t.w=Ir(i),t},e.fromMat3=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=i-a-l,f=a-i-l,d=l-i-a,_=0,p=i+a+l;c>p&&(p=c,_=1),f>p&&(p=f,_=2),d>p&&(p=d,_=3);var m=.5*Br(p+1),g=.25/m;switch(_){case 0:t.w=m,t.x=(o-u)*g,t.y=(h-r)*g,t.z=(n-s)*g;break;case 1:t.w=(o-u)*g,t.x=m,t.y=(n+s)*g,t.z=(h+r)*g;break;case 2:t.w=(h-r)*g,t.x=(n+s)*g,t.y=m,t.z=(o+u)*g;break;case 3:t.w=(n-s)*g,t.x=(h+r)*g,t.y=(o+u)*g,t.z=m;break;default:t.w=1,t.x=0,t.y=0,t.z=0}return t},e.fromEuler=function(t,e,i,n){i*=Nr,n*=Nr;var r=Dr(e*=Nr),s=Ir(e),a=Dr(i),o=Ir(i),h=Dr(n),u=Ir(n);return t.x=r*o*u+s*a*h,t.y=s*a*u+r*o*h,t.z=s*o*h-r*a*u,t.w=s*o*u-r*a*h,t},e.fromAngleZ=function(t,e){return e*=Nr,t.x=t.y=0,t.z=Dr(e),t.w=Ir(e),t},e.toAxisX=function(t,e){var i=2*e.y,n=2*e.z;return t.x=1-i*e.y-n*e.z,t.y=i*e.x+n*e.w,t.z=n*e.x-i*e.w,t},e.toAxisY=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=n*e.x-r*e.w,t.y=1-i*e.x-r*e.z,t.z=r*e.y+i*e.w,t},e.toAxisZ=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=r*e.x+n*e.w,t.y=r*e.y-i*e.w,t.z=1-i*e.x-n*e.y,t},e.toEuler=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w,o=0,h=0,u=0,l=n*r+s*a;if(l>.499999)o=0,h=rn(2*Mr(n,a)),u=90;else if(l<-.499999)o=0,h=-rn(2*Mr(n,a)),u=-90;else{var c=r*r,f=s*s;o=rn(Mr(2*n*a-2*r*s,1-n*n*2-2*f)),h=rn(Mr(2*r*a-2*n*s,1-2*c-2*f)),u=rn(Pr(2*l)),i&&(o=-180*Er(o+1e-6)+o,h=-180*Er(h+1e-6)+h,u=180*Er(u+1e-6)-u)}return t.x=o,t.y=h,t.z=u,t},e.toEulerInYXZOrder=function(t,e){gr.fromQuat(Vr,e),gr.toEuler(Vr,t),t.x=rn(t.x),t.y=rn(t.y),t.z=rn(t.z)},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t[i+3]=e.w,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t.w=e[i+3],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},e.equals=function(t,e,i){return void 0===i&&(i=Ji),Sr(t.x-e.x)<=i*wr(1,Sr(t.x),Sr(e.x))&&Sr(t.y-e.y)<=i*wr(1,Sr(t.y),Sr(e.y))&&Sr(t.z-e.z)<=i*wr(1,Sr(t.z),Sr(e.z))&&Sr(t.w-e.w)<=i*wr(1,Sr(t.w),Sr(e.w))},e.angle=function(t,i){var n=Tr(Sr(e.dot(t,i)),1);return 2*Ar(n)},e.rotateTowards=function(t,i,n,r){var s=e.angle(i,n);if(0===s)return t.x=n.x,t.y=n.y,t.z=n.z,t.w=n.w,t;var a=Tr(r/rn(s),1);return e.slerp(t,i,n,a)};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z,this.w)},i.set=function(t,e,i,n){return"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=null!=n?n:1),this},i.equals=function(t,i){return void 0===i&&(i=Ji),e.equals(this,t,i)},i.strictEquals=function(t){return t&&this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},i.getEulerAngles=function(t){return e.toEuler(t,this)},i.lerp=function(t,e){var i=this;return i.x+=e*(t.x-i.x),i.y+=e*(t.y-i.y),i.z+=e*(t.z-i.z),i.w+=e*(t.w-i.w),i},i.slerp=function(t,i){return e.slerp(this,this,t,i)},i.length=function(){var t=this,e=t.x,i=t.y,n=t.z,r=t.w;return Br(e*e+i*i+n*n+r*r)},i.lengthSqr=function(){var t=this,e=t.x,i=t.y,n=t.z,r=t.w;return e*e+i*i+n*n+r*r},i.toString=function(){return"("+this.x+", "+this.y+", "+this.z+", "+this.w+")"},e}(Fe));vr=kr,kr.IDENTITY=Object.freeze(new vr);var Rr,Or=new kr,Fr=new kr,Lr=new ir,Vr=new gr,Nr=.5*Cr/180;function zr(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),new kr(t,e,i,n)}Vi.fastDefine("cc.Quat",kr,{x:0,y:0,z:0,w:1}),A.Quat=kr,A.quat=zr;var Ur=Object.freeze,Gr=t("b5",Ur([Ur([1,0,0,1]),Ur([0,1,-1,0]),Ur([-1,0,0,-1]),Ur([0,-1,1,0])])),Hr=Math.abs,Wr=Math.max,jr=Math.sqrt,qr=Math.sin,Xr=Math.cos,Yr=Math.tan,Qr=t("aZ",function(t){function e(e,i,n,r,s,a,o,h,u,l,c,d,_,p,m,g){var v;void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=0),void 0===c&&(c=1),void 0===d&&(d=0),void 0===_&&(_=0),void 0===p&&(p=0),void 0===m&&(m=0),void 0===g&&(g=1);var y=f(v=t.call(this)||this);return"object"==typeof e?(y.m00=e.m00,v.m01=e.m01,v.m02=e.m02,v.m03=e.m03,y.m04=e.m04,v.m05=e.m05,v.m06=e.m06,v.m07=e.m07,y.m08=e.m08,v.m09=e.m09,v.m10=e.m10,v.m11=e.m11,y.m12=e.m12,v.m13=e.m13,v.m14=e.m14,v.m15=e.m15):(y.m00=e,v.m01=i,v.m02=n,v.m03=r,y.m04=s,v.m05=a,v.m06=o,v.m07=h,y.m08=u,v.m09=l,v.m10=c,v.m11=d,y.m12=_,v.m13=p,v.m14=m,v.m15=g),v}s(e,t),e.clone=function(t){return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08,t.m09,t.m10,t.m11,t.m12,t.m13,t.m14,t.m15)},e.copy=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15,t},e.set=function(t,e,i,n,r,s,a,o,h,u,l,c,f,d,_,p,m){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=a,t.m06=o,t.m07=h,t.m08=u,t.m09=l,t.m10=c,t.m11=f,t.m12=d,t.m13=_,t.m14=p,t.m15=m,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=1,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=1,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.zero=function(t){return t.m00=0,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=0,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=0,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=0,t},e.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m03,s=e.m06,a=e.m07,o=e.m11;t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=i,t.m06=e.m09,t.m07=e.m13,t.m08=n,t.m09=s,t.m11=e.m14,t.m12=r,t.m13=a,t.m14=o}else t.m00=e.m00,t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=e.m01,t.m05=e.m05,t.m06=e.m09,t.m07=e.m13,t.m08=e.m02,t.m09=e.m06,t.m10=e.m10,t.m11=e.m14,t.m12=e.m03,t.m13=e.m07,t.m14=e.m11,t.m15=e.m15;return t},e.invert=function(t,i){var n=i.m00,r=i.m01,s=i.m02,a=i.m03,o=i.m04,h=i.m05,u=i.m06,l=i.m07,c=i.m08,f=i.m09,d=i.m10,_=i.m11,p=i.m12,m=i.m13,g=i.m14,v=i.m15,y=n*h-r*o,b=n*u-s*o,S=n*l-a*o,x=r*u-s*h,w=r*l-a*h,T=s*l-a*u,C=c*m-f*p,A=c*g-d*p,D=c*v-_*p,I=f*g-d*m,B=f*v-_*m,M=d*v-_*g,P=y*M-b*B+S*I+x*D-w*A+T*C;return 0===P?e.zero(t):(P=1/P,t.m00=(h*M-u*B+l*I)*P,t.m01=(s*B-r*M-a*I)*P,t.m02=(m*T-g*w+v*x)*P,t.m03=(d*w-f*T-_*x)*P,t.m04=(u*D-o*M-l*A)*P,t.m05=(n*M-s*D+a*A)*P,t.m06=(g*S-p*T-v*b)*P,t.m07=(c*T-d*S+_*b)*P,t.m08=(o*B-h*D+l*C)*P,t.m09=(r*D-n*B-a*C)*P,t.m10=(p*w-m*S+v*y)*P,t.m11=(f*S-c*w-_*y)*P,t.m12=(h*A-o*I-u*C)*P,t.m13=(n*I-r*A+s*C)*P,t.m14=(m*b-p*x-g*y)*P,t.m15=(c*x-f*b+d*y)*P,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,h=t.m07,u=t.m08,l=t.m09,c=t.m10,f=t.m11,d=t.m12,_=t.m13,p=t.m14,m=t.m15;return(e*a-i*s)*(c*m-f*p)-(e*o-n*s)*(l*m-f*_)+(e*h-r*s)*(l*p-c*_)+(i*o-n*a)*(u*m-f*d)-(i*h-r*a)*(u*p-c*d)+(n*h-r*o)*(u*_-l*d)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,f=e.m09,d=e.m10,_=e.m11,p=e.m12,m=e.m13,g=e.m14,v=e.m15,y=i.m00,b=i.m01,S=i.m02,x=i.m03;return t.m00=y*n+b*o+S*c+x*p,t.m01=y*r+b*h+S*f+x*m,t.m02=y*s+b*u+S*d+x*g,t.m03=y*a+b*l+S*_+x*v,y=i.m04,b=i.m05,S=i.m06,x=i.m07,t.m04=y*n+b*o+S*c+x*p,t.m05=y*r+b*h+S*f+x*m,t.m06=y*s+b*u+S*d+x*g,t.m07=y*a+b*l+S*_+x*v,y=i.m08,b=i.m09,S=i.m10,x=i.m11,t.m08=y*n+b*o+S*c+x*p,t.m09=y*r+b*h+S*f+x*m,t.m10=y*s+b*u+S*d+x*g,t.m11=y*a+b*l+S*_+x*v,y=i.m12,b=i.m13,S=i.m14,x=i.m15,t.m12=y*n+b*o+S*c+x*p,t.m13=y*r+b*h+S*f+x*m,t.m14=y*s+b*u+S*d+x*g,t.m15=y*a+b*l+S*_+x*v,t},e.transform=function(t,e,i){var n=i.x,r=i.y,s=i.z;if(e===t)t.m12=e.m00*n+e.m04*r+e.m08*s+e.m12,t.m13=e.m01*n+e.m05*r+e.m09*s+e.m13,t.m14=e.m02*n+e.m06*r+e.m10*s+e.m14,t.m15=e.m03*n+e.m07*r+e.m11*s+e.m15;else{var a=e.m00,o=e.m01,h=e.m02,u=e.m03,l=e.m04,c=e.m05,f=e.m06,d=e.m07,_=e.m08,p=e.m09,m=e.m10,g=e.m11;t.m00=a,t.m01=o,t.m02=h,t.m03=u,t.m04=l,t.m05=c,t.m06=f,t.m07=d,t.m08=_,t.m09=p,t.m10=m,t.m11=g,t.m12=a*n+l*r+_*s+e.m12,t.m13=o*n+c*r+p*s+e.m13,t.m14=h*n+f*r+m*s+e.m14,t.m15=u*n+d*r+g*s+e.m15}return t},e.translate=function(t,e,i){return e===t?(t.m12+=i.x,t.m13+=i.y,t.m14+=i.z):(t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12=e.m12+i.x,t.m13=e.m13+i.y,t.m14=e.m14+i.z,t.m15=e.m15),t},e.scale=function(t,e,i){var n=i.x,r=i.y,s=i.z;return t.m00=e.m00*n,t.m01=e.m01*n,t.m02=e.m02*n,t.m03=e.m03*n,t.m04=e.m04*r,t.m05=e.m05*r,t.m06=e.m06*r,t.m07=e.m07*r,t.m08=e.m08*s,t.m09=e.m09*s,t.m10=e.m10*s,t.m11=e.m11*s,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15,t},e.rotate=function(t,e,i,n){var r=n.x,s=n.y,a=n.z,o=jr(r*r+s*s+a*a);if(Hr(o)0?(n=2*jr(i+1),t.w=.25*n,t.x=(e.m06-e.m09)/n,t.y=(e.m08-e.m02)/n,t.z=(e.m01-e.m04)/n):e.m00>e.m05&&e.m00>e.m10?(n=2*jr(1+e.m00-e.m05-e.m10),t.w=(e.m06-e.m09)/n,t.x=.25*n,t.y=(e.m01+e.m04)/n,t.z=(e.m08+e.m02)/n):e.m05>e.m10?(n=2*jr(1+e.m05-e.m00-e.m10),t.w=(e.m08-e.m02)/n,t.x=(e.m01+e.m04)/n,t.y=.25*n,t.z=(e.m06+e.m09)/n):(n=2*jr(1+e.m10-e.m00-e.m05),t.w=(e.m01-e.m04)/n,t.x=(e.m08+e.m02)/n,t.y=(e.m06+e.m09)/n,t.z=.25*n),t},e.toRTS=function(t,i,n,r){e.toSRT(t,i,n,r)},e.toSRT=function(t,e,i,n){i&&ir.set(i,t.m12,t.m13,t.m14);var r=ir.set(Jr,t.m00,t.m01,t.m02).length(),s=ir.set(Jr,t.m04,t.m05,t.m06).length(),a=ir.set(Jr,t.m08,t.m09,t.m10).length();if(n&&(n.x=r,n.y=s,n.z=a),0!==r&&0!==s&&0!==a){Kr.m00=t.m00/r,Kr.m01=t.m01/r,Kr.m02=t.m02/r,Kr.m03=t.m04/s,Kr.m04=t.m05/s,Kr.m05=t.m06/s,Kr.m06=t.m08/a,Kr.m07=t.m09/a,Kr.m08=t.m10/a;var o=gr.determinant(Kr);n&&o<0&&(n.x*=-1),e&&(o<0&&(Kr.m00*=-1,Kr.m01*=-1,Kr.m02*=-1),kr.fromMat3(e,Kr))}else e&&kr.identity(e)},e.toEuler=function(t,e){return gr.set(Kr,t.m00,t.m01,t.m02,t.m04,t.m05,t.m06,t.m08,t.m09,t.m10),gr.toEuler(Kr,e)},e.fromRTS=function(t,i,n,r){return e.fromSRT(t,i,n,r)},e.fromSRT=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=e.w,h=r+r,u=s+s,l=a+a,c=r*h,f=r*u,d=r*l,_=s*u,p=s*l,m=a*l,g=o*h,v=o*u,y=o*l,b=n.x,S=n.y,x=n.z;return t.m00=(1-(_+m))*b,t.m01=(f+y)*b,t.m02=(d-v)*b,t.m03=0,t.m04=(f-y)*S,t.m05=(1-(c+m))*S,t.m06=(p+g)*S,t.m07=0,t.m08=(d+v)*x,t.m09=(p-g)*x,t.m10=(1-(c+_))*x,t.m11=0,t.m12=i.x,t.m13=i.y,t.m14=i.z,t.m15=1,t},e.fromRTSOrigin=function(t,i,n,r,s){return e.fromSRTOrigin(t,i,n,r,s)},e.fromSRTOrigin=function(t,e,i,n,r){var s=e.x,a=e.y,o=e.z,h=e.w,u=s+s,l=a+a,c=o+o,f=s*u,d=s*l,_=s*c,p=a*l,m=a*c,g=o*c,v=h*u,y=h*l,b=h*c,S=n.x,x=n.y,w=n.z,T=r.x,C=r.y,A=r.z;return t.m00=(1-(p+g))*S,t.m01=(d+b)*S,t.m02=(_-y)*S,t.m03=0,t.m04=(d-b)*x,t.m05=(1-(f+g))*x,t.m06=(m+v)*x,t.m07=0,t.m08=(_+y)*w,t.m09=(m-v)*w,t.m10=(1-(f+p))*w,t.m11=0,t.m12=i.x+T-(t.m00*T+t.m04*C+t.m08*A),t.m13=i.y+C-(t.m01*T+t.m05*C+t.m09*A),t.m14=i.z+A-(t.m02*T+t.m06*C+t.m10*A),t.m15=1,t},e.fromQuat=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,a=i+i,o=n+n,h=r+r,u=i*a,l=n*a,c=n*o,f=r*a,d=r*o,_=r*h,p=s*a,m=s*o,g=s*h;return t.m00=1-c-_,t.m01=l+g,t.m02=f-m,t.m03=0,t.m04=l-g,t.m05=1-u-_,t.m06=d+p,t.m07=0,t.m08=f+m,t.m09=d-p,t.m10=1-u-c,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.frustum=function(t,e,i,n,r,s,a){var o=1/(i-e),h=1/(r-n),u=1/(s-a);return t.m00=2*s*o,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=2*s*h,t.m06=0,t.m07=0,t.m08=(i+e)*o,t.m09=(r+n)*h,t.m10=(a+s)*u,t.m11=-1,t.m12=0,t.m13=0,t.m14=a*s*2*u,t.m15=0,t},e.perspective=function(t,e,i,n,r,s,a,o,h){void 0===s&&(s=!0),void 0===a&&(a=-1),void 0===o&&(o=1),void 0===h&&(h=0);var u=1/Yr(e/2),l=1/(n-r),c=s?u/i:u,f=(s?u:u*i)*o,d=Gr[h];return t.m00=c*d[0],t.m01=c*d[1],t.m02=0,t.m03=0,t.m04=f*d[2],t.m05=f*d[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=(r-a*n)*l,t.m11=-1,t.m12=0,t.m13=0,t.m14=r*n*l*(1-a),t.m15=0,t},e.ortho=function(t,e,i,n,r,s,a,o,h,u){void 0===o&&(o=-1),void 0===h&&(h=1),void 0===u&&(u=0);var l=1/(e-i),c=1/(n-r)*h,f=1/(s-a),d=-2*l,_=-2*c,p=(e+i)*l,m=(r+n)*c,g=Gr[u];return t.m00=d*g[0],t.m01=d*g[1],t.m02=0,t.m03=0,t.m04=_*g[2],t.m05=_*g[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=f*(1-o),t.m11=0,t.m12=p*g[0]+m*g[2],t.m13=p*g[1]+m*g[3],t.m14=(s-o*a)*f,t.m15=1,t},e.lookAt=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=n.x,h=n.y,u=n.z,l=r-i.x,c=s-i.y,f=a-i.z,d=1/jr(l*l+c*c+f*f),_=h*(f*=d)-u*(c*=d),p=u*(l*=d)-o*f,m=o*c-h*l,g=c*(m*=d=1/jr(_*_+p*p+m*m))-f*(p*=d),v=f*(_*=d)-l*m,y=l*p-c*_;return t.m00=_,t.m01=g,t.m02=l,t.m03=0,t.m04=p,t.m05=v,t.m06=c,t.m07=0,t.m08=m,t.m09=y,t.m10=f,t.m11=0,t.m12=-(_*r+p*s+m*a),t.m13=-(g*r+v*s+y*a),t.m14=-(l*r+c*s+f*a),t.m15=1,t},e.inverseTranspose=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=e.m09,f=e.m10,d=e.m11,_=e.m12,p=e.m13,m=e.m14,g=e.m15,v=i*o-n*a,y=i*h-r*a,b=i*u-s*a,S=n*h-r*o,x=n*u-s*o,w=r*u-s*h,T=l*p-c*_,C=l*m-f*_,A=l*g-d*_,D=c*m-f*p,I=c*g-d*p,B=f*g-d*m,M=v*B-y*I+b*D+S*A-x*C+w*T;return M?(M=1/M,t.m00=(o*B-h*I+u*D)*M,t.m01=(h*A-a*B-u*C)*M,t.m02=(a*I-o*A+u*T)*M,t.m03=0,t.m04=(r*I-n*B-s*D)*M,t.m05=(i*B-r*A+s*C)*M,t.m06=(n*A-i*I-s*T)*M,t.m07=0,t.m08=(p*w-m*x+g*S)*M,t.m09=(m*b-_*w-g*y)*M,t.m10=(_*x-p*b+g*v)*M,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t):null},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.m00,t[i+1]=e.m01,t[i+2]=e.m02,t[i+3]=e.m03,t[i+4]=e.m04,t[i+5]=e.m05,t[i+6]=e.m06,t[i+7]=e.m07,t[i+8]=e.m08,t[i+9]=e.m09,t[i+10]=e.m10,t[i+11]=e.m11,t[i+12]=e.m12,t[i+13]=e.m13,t[i+14]=e.m14,t[i+15]=e.m15,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.m00=e[i+0],t.m01=e[i+1],t.m02=e[i+2],t.m03=e[i+3],t.m04=e[i+4],t.m05=e[i+5],t.m06=e[i+6],t.m07=e[i+7],t.m08=e[i+8],t.m09=e[i+9],t.m10=e[i+10],t.m11=e[i+11],t.m12=e[i+12],t.m13=e[i+13],t.m14=e[i+14],t.m15=e[i+15],t},e.add=function(t,e,i){return t.m00=e.m00+i.m00,t.m01=e.m01+i.m01,t.m02=e.m02+i.m02,t.m03=e.m03+i.m03,t.m04=e.m04+i.m04,t.m05=e.m05+i.m05,t.m06=e.m06+i.m06,t.m07=e.m07+i.m07,t.m08=e.m08+i.m08,t.m09=e.m09+i.m09,t.m10=e.m10+i.m10,t.m11=e.m11+i.m11,t.m12=e.m12+i.m12,t.m13=e.m13+i.m13,t.m14=e.m14+i.m14,t.m15=e.m15+i.m15,t},e.subtract=function(t,e,i){return t.m00=e.m00-i.m00,t.m01=e.m01-i.m01,t.m02=e.m02-i.m02,t.m03=e.m03-i.m03,t.m04=e.m04-i.m04,t.m05=e.m05-i.m05,t.m06=e.m06-i.m06,t.m07=e.m07-i.m07,t.m08=e.m08-i.m08,t.m09=e.m09-i.m09,t.m10=e.m10-i.m10,t.m11=e.m11-i.m11,t.m12=e.m12-i.m12,t.m13=e.m13-i.m13,t.m14=e.m14-i.m14,t.m15=e.m15-i.m15,t},e.multiplyScalar=function(t,e,i){return t.m00=e.m00*i,t.m01=e.m01*i,t.m02=e.m02*i,t.m03=e.m03*i,t.m04=e.m04*i,t.m05=e.m05*i,t.m06=e.m06*i,t.m07=e.m07*i,t.m08=e.m08*i,t.m09=e.m09*i,t.m10=e.m10*i,t.m11=e.m11*i,t.m12=e.m12*i,t.m13=e.m13*i,t.m14=e.m14*i,t.m15=e.m15*i,t},e.multiplyScalarAndAdd=function(t,e,i,n){return t.m00=e.m00+i.m00*n,t.m01=e.m01+i.m01*n,t.m02=e.m02+i.m02*n,t.m03=e.m03+i.m03*n,t.m04=e.m04+i.m04*n,t.m05=e.m05+i.m05*n,t.m06=e.m06+i.m06*n,t.m07=e.m07+i.m07*n,t.m08=e.m08+i.m08*n,t.m09=e.m09+i.m09*n,t.m10=e.m10+i.m10*n,t.m11=e.m11+i.m11*n,t.m12=e.m12+i.m12*n,t.m13=e.m13+i.m13*n,t.m14=e.m14+i.m14*n,t.m15=e.m15+i.m15*n,t},e.strictEquals=function(t,e){return t.m00===e.m00&&t.m01===e.m01&&t.m02===e.m02&&t.m03===e.m03&&t.m04===e.m04&&t.m05===e.m05&&t.m06===e.m06&&t.m07===e.m07&&t.m08===e.m08&&t.m09===e.m09&&t.m10===e.m10&&t.m11===e.m11&&t.m12===e.m12&&t.m13===e.m13&&t.m14===e.m14&&t.m15===e.m15},e.equals=function(t,e,i){return void 0===i&&(i=Ji),Hr(t.m00-e.m00)<=i*Wr(1,Hr(t.m00),Hr(e.m00))&&Hr(t.m01-e.m01)<=i*Wr(1,Hr(t.m01),Hr(e.m01))&&Hr(t.m02-e.m02)<=i*Wr(1,Hr(t.m02),Hr(e.m02))&&Hr(t.m03-e.m03)<=i*Wr(1,Hr(t.m03),Hr(e.m03))&&Hr(t.m04-e.m04)<=i*Wr(1,Hr(t.m04),Hr(e.m04))&&Hr(t.m05-e.m05)<=i*Wr(1,Hr(t.m05),Hr(e.m05))&&Hr(t.m06-e.m06)<=i*Wr(1,Hr(t.m06),Hr(e.m06))&&Hr(t.m07-e.m07)<=i*Wr(1,Hr(t.m07),Hr(e.m07))&&Hr(t.m08-e.m08)<=i*Wr(1,Hr(t.m08),Hr(e.m08))&&Hr(t.m09-e.m09)<=i*Wr(1,Hr(t.m09),Hr(e.m09))&&Hr(t.m10-e.m10)<=i*Wr(1,Hr(t.m10),Hr(e.m10))&&Hr(t.m11-e.m11)<=i*Wr(1,Hr(t.m11),Hr(e.m11))&&Hr(t.m12-e.m12)<=i*Wr(1,Hr(t.m12),Hr(e.m12))&&Hr(t.m13-e.m13)<=i*Wr(1,Hr(t.m13),Hr(e.m13))&&Hr(t.m14-e.m14)<=i*Wr(1,Hr(t.m14),Hr(e.m14))&&Hr(t.m15-e.m15)<=i*Wr(1,Hr(t.m15),Hr(e.m15))};var i=e.prototype;return i.clone=function(){return new e(this.m00,this.m01,this.m02,this.m03,this.m04,this.m05,this.m06,this.m07,this.m08,this.m09,this.m10,this.m11,this.m12,this.m13,this.m14,this.m15)},i.set=function(t,e,i,n,r,s,a,o,h,u,l,c,f,d,_,p){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===_&&(_=0),void 0===p&&(p=1);var m=this;return"object"==typeof t?(m.m01=t.m01,m.m02=t.m02,m.m03=t.m03,m.m04=t.m04,m.m05=t.m05,m.m06=t.m06,m.m07=t.m07,m.m08=t.m08,m.m09=t.m09,m.m10=t.m10,m.m11=t.m11,m.m12=t.m12,m.m13=t.m13,m.m14=t.m14,m.m15=t.m15,m.m00=t.m00):(m.m01=e,m.m02=i,m.m03=n,m.m04=r,m.m05=s,m.m06=a,m.m07=o,m.m08=h,m.m09=u,m.m10=l,m.m11=c,m.m12=f,m.m13=d,m.m14=_,m.m15=p,m.m00=t),m},i.equals=function(t,e){void 0===e&&(e=Ji);var i=1/0,n=this,r=n.m00,s=n.m01,a=n.m02,o=n.m03,h=n.m04,u=n.m05,l=n.m06,c=n.m07,f=n.m08,d=n.m09,_=n.m10,p=n.m11,m=n.m12,g=n.m13,v=n.m14,y=n.m15;return!(Hr(r)===i||Hr(s)===i||Hr(a)===i||Hr(o)===i||Hr(h)===i||Hr(u)===i||Hr(l)===i||Hr(c)===i||Hr(f)===i||Hr(d)===i||Hr(_)===i||Hr(p)===i||Hr(m)===i||Hr(g)===i||Hr(v)===i||Hr(y)===i)&&Hr(r-t.m00)<=e*Wr(1,Hr(r),Hr(t.m00))&&Hr(s-t.m01)<=e*Wr(1,Hr(s),Hr(t.m01))&&Hr(a-t.m02)<=e*Wr(1,Hr(a),Hr(t.m02))&&Hr(o-t.m03)<=e*Wr(1,Hr(o),Hr(t.m03))&&Hr(h-t.m04)<=e*Wr(1,Hr(h),Hr(t.m04))&&Hr(u-t.m05)<=e*Wr(1,Hr(u),Hr(t.m05))&&Hr(l-t.m06)<=e*Wr(1,Hr(l),Hr(t.m06))&&Hr(c-t.m07)<=e*Wr(1,Hr(c),Hr(t.m07))&&Hr(f-t.m08)<=e*Wr(1,Hr(f),Hr(t.m08))&&Hr(d-t.m09)<=e*Wr(1,Hr(d),Hr(t.m09))&&Hr(_-t.m10)<=e*Wr(1,Hr(_),Hr(t.m10))&&Hr(p-t.m11)<=e*Wr(1,Hr(p),Hr(t.m11))&&Hr(m-t.m12)<=e*Wr(1,Hr(m),Hr(t.m12))&&Hr(g-t.m13)<=e*Wr(1,Hr(g),Hr(t.m13))&&Hr(v-t.m14)<=e*Wr(1,Hr(v),Hr(t.m14))&&Hr(y-t.m15)<=e*Wr(1,Hr(y),Hr(t.m15))},i.strictEquals=function(t){var e=this;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},i.toString=function(){var t=this;return"[\n"+t.m00+", "+t.m01+", "+t.m02+", "+t.m03+",\n"+t.m04+", "+t.m05+", "+t.m06+", "+t.m07+",\n"+t.m08+", "+t.m09+", "+t.m10+", "+t.m11+",\n"+t.m12+", "+t.m13+", "+t.m14+", "+t.m15+"\n]"},i.identity=function(){return e.identity(this)},i.zero=function(){return e.zero(this)},i.transpose=function(){var t=this,e=t.m01,i=t.m02,n=t.m03,r=t.m06,s=t.m07,a=t.m11;return t.m01=t.m04,t.m02=t.m08,t.m03=t.m12,t.m04=e,t.m06=t.m09,t.m07=t.m13,t.m08=i,t.m09=r,t.m11=t.m14,t.m12=n,t.m13=s,t.m14=a,t},i.invert=function(){var t=this,e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,h=t.m07,u=t.m08,l=t.m09,c=t.m10,f=t.m11,d=t.m12,_=t.m13,p=t.m14,m=t.m15,g=e*a-i*s,v=e*o-n*s,y=e*h-r*s,b=i*o-n*a,S=i*h-r*a,x=n*h-r*o,w=u*_-l*d,T=u*p-c*d,C=u*m-f*d,A=l*p-c*_,D=l*m-f*_,I=c*m-f*p,B=g*I-v*D+y*A+b*C-S*T+x*w;return 0===B?(t.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),t):(B=1/B,t.m00=(a*I-o*D+h*A)*B,t.m01=(n*D-i*I-r*A)*B,t.m02=(_*x-p*S+m*b)*B,t.m03=(c*S-l*x-f*b)*B,t.m04=(o*C-s*I-h*T)*B,t.m05=(e*I-n*C+r*T)*B,t.m06=(p*y-d*x-m*v)*B,t.m07=(u*x-c*y+f*v)*B,t.m08=(s*D-a*C+h*w)*B,t.m09=(i*C-e*D-r*w)*B,t.m10=(d*S-_*y+m*g)*B,t.m11=(l*y-u*S-f*g)*B,t.m12=(a*T-s*A-o*w)*B,t.m13=(e*A-i*T+n*w)*B,t.m14=(_*v-d*b-p*g)*B,t.m15=(u*b-l*v+c*g)*B,t)},i.determinant=function(){var t=this,e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,h=t.m07,u=t.m08,l=t.m09,c=t.m10,f=t.m11,d=t.m12,_=t.m13,p=t.m14,m=t.m15;return(e*a-i*s)*(c*m-f*p)-(e*o-n*s)*(l*m-f*_)+(e*h-r*s)*(l*p-c*_)+(i*o-n*a)*(u*m-f*d)-(i*h-r*a)*(u*p-c*d)+(n*h-r*o)*(u*_-l*d)},i.add=function(t){var e=this;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},i.subtract=function(t){var e=this;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},i.multiply=function(t){return e.multiply(this,this,t)},i.multiplyScalar=function(t){var e=this;return e.m00*=t,e.m01*=t,e.m02*=t,e.m03*=t,e.m04*=t,e.m05*=t,e.m06*=t,e.m07*=t,e.m08*=t,e.m09*=t,e.m10*=t,e.m11*=t,e.m12*=t,e.m13*=t,e.m14*=t,e.m15*=t,e},i.translate=function(t){return this.m12+=t.x,this.m13+=t.y,this.m14+=t.z,this},i.transform=function(t){var e=t.x,i=t.y,n=t.z,r=this,s=r.m00,a=r.m01,o=r.m02,h=r.m03,u=r.m04,l=r.m05,c=r.m06,f=r.m07,d=r.m08,_=r.m09,p=r.m10,m=r.m11;return r.m12=s*e+u*i+d*n+r.m12,r.m13=a*e+l*i+_*n+r.m13,r.m14=o*e+c*i+p*n+r.m14,r.m15=h*e+f*i+m*n+r.m15,r},i.scale=function(t){var e=t.x,i=t.y,n=t.z,r=this;return r.m00*=e,r.m01*=e,r.m02*=e,r.m03*=e,r.m04*=i,r.m05*=i,r.m06*=i,r.m07*=i,r.m08*=n,r.m09*=n,r.m10*=n,r.m11*=n,r},i.rotate=function(t,e){var i=e.x,n=e.y,r=e.z,s=jr(i*i+n*n+r*r);if(Hr(s)0?(r=1/as(r),t.x=i*r,t.y=n*r):(t.x=0,t.y=0),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y},e.cross=function(t,e,i){return t instanceof ir?(t.x=t.y=0,t.z=e.x*i.y-e.y*i.x,t):t.x*e.y-t.y*e.x},e.lerp=function(t,e,i,n){var r=e.x,s=e.y;return t.x=r+n*(i.x-r),t.y=s+n*(i.y-s),t},e.random=function(t,e){e=e||1;var i=2*sn()*is;return t.x=ss(i)*e,t.y=rs(i)*e,t},e.transformMat3=function(t,e,i){var n=e.x,r=e.y;return t.x=i.m00*n+i.m03*r+i.m06,t.y=i.m01*n+i.m04*r+i.m07,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y;return t.x=i.m00*n+i.m04*r+i.m12,t.y=i.m01*n+i.m05*r+i.m13,t},e.str=function(t){return"Vec2("+t.x+", "+t.y+")"},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y},e.equals=function(t,e,i){return void 0===i&&(i=Ji),$r(t.x-e.x)<=i*ts(1,$r(t.x),$r(e.x))&&$r(t.y-e.y)<=i*ts(1,$r(t.y),$r(e.y))},e.angle=function(t,e){var i=t.x*t.x+t.y*t.y,n=e.x*e.x+e.y*e.y;if(0===i||0===n)return 0;var r=(t.x*e.x+t.y*e.y)/as(i*n);return r=$i(r,-1,1),ns(r)};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y)},i.set=function(t,e){return"object"==typeof t?(this.x=t.x,this.y=t.y):(this.x=t||0,this.y=e||0),this},i.equals=function(t,i){return void 0===i&&(i=Ji),e.equals(this,t,i)},i.equals2f=function(t,e,i){return void 0===i&&(i=Ji),$r(this.x-t)<=i*ts(1,$r(this.x),$r(t))&&$r(this.y-e)<=i*ts(1,$r(this.y),$r(e))},i.strictEquals=function(t){return t&&this.x===t.x&&this.y===t.y},i.strictEquals2f=function(t,e){return this.x===t&&this.y===e},i.toString=function(){return"("+this.x+", "+this.y+")"},i.lerp=function(t,e){var i=this.x,n=this.y;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this},i.clampf=function(t,e){return this.x=$i(this.x,t.x,e.x),this.y=$i(this.y,t.y,e.y),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this},i.add2f=function(t,e){return this.x+=t,this.y+=e,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this},i.subtract2f=function(t,e){return this.x-=t,this.y-=e,this},i.multiplyScalar=function(t){return"object"==typeof t&&at(16359),this.x*=t,this.y*=t,this},i.multiply=function(t){return"object"!=typeof t&&at(16360),this.x*=t.x,this.y*=t.y,this},i.multiply2f=function(t,e){return this.x*=t,this.y*=e,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this},i.divide2f=function(t,e){return this.x/=t,this.y/=e,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this},i.dot=function(t){return this.x*t.x+this.y*t.y},i.cross=function(t){return this.x*t.y-this.y*t.x},i.length=function(){return as(this.x*this.x+this.y*this.y)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y},i.normalize=function(){var t=this,e=t.x,i=t.y,n=e*e+i*i;return n>0&&(n=1/as(n),t.x*=n,t.y*=n),t},i.angle=function(t){var e=this.lengthSqr(),i=t.lengthSqr();if(0===e||0===i)return 0;var n=this.dot(t)/as(e*i);return n=$i(n,-1,1),ns(n)},i.signAngle=function(t){var e=this.cross(t),i=this.dot(t);return os(e,i)},i.rotate=function(t){var e=this.x,i=this.y,n=rs(t),r=ss(t);return this.x=r*e-n*i,this.y=n*e+r*i,this},i.project=function(t){var e=this.dot(t)/t.dot(t);return this.x=t.x*e,this.y=t.y*e,this},i.transformMat4=function(t){var e=this.x,i=this.y;return this.x=t.m00*e+t.m04*i+t.m12,this.y=t.m01*e+t.m05*i+t.m13,this},i.toVec3=function(){return new ir(this.x,this.y,0)},e}(Fe));function _s(t,e){return new ds(t,e)}ds.ZERO=cs(0,0),ds.ONE=cs(1,1),ds.NEG_ONE=cs(-1,-1),ds.UNIT_X=cs(1,0),ds.UNIT_Y=cs(0,1),Vi.fastDefine("cc.Vec2",ds,{x:0,y:0}),A.Vec2=ds,A.v2=_s,pt(ds,"Vec2",[{name:"sub",newName:"subtract",target:ds,targetName:"Vec2"},{name:"mul",newName:"multiply",target:ds,targetName:"Vec2"},{name:"div",newName:"divide",target:ds,targetName:"Vec2"},{name:"dist",newName:"distance",target:ds,targetName:"Vec2"},{name:"sqrDist",newName:"squaredDistance",target:ds,targetName:"Vec2"},{name:"mag",newName:"len",target:ds,targetName:"Vec2"},{name:"sqrMag",newName:"lengthSqr",target:ds,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:ds,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:ds,targetName:"Vec2"}]),pt(ds.prototype,"Vec2",[{name:"mag",newName:"length",target:ds.prototype,targetName:"Vec2"},{name:"magSqr",newName:"lengthSqr",target:ds.prototype,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:ds.prototype,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:ds.prototype,targetName:"Vec2"}]),pt(ir,"Vec3",[{name:"sub",newName:"subtract",target:ir,targetName:"Vec3"},{name:"mul",newName:"multiply",target:ir,targetName:"Vec3"},{name:"div",newName:"divide",target:ir,targetName:"Vec3"},{name:"dist",newName:"distance",target:ir,targetName:"Vec3"},{name:"sqrDist",newName:"squaredDistance",target:ir,targetName:"Vec3"},{name:"mag",newName:"len",target:ir,targetName:"Vec3"},{name:"sqrMag",newName:"lengthSqr",target:ir,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:ir,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:ir,targetName:"Vec3"}]),pt(ir.prototype,"Vec3",[{name:"mag",newName:"length",target:ir.prototype,targetName:"Vec3"},{name:"magSqr",newName:"lengthSqr",target:ir.prototype,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:ir.prototype,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:ir.prototype,targetName:"Vec3"}]),pt(Vn,"Vec4",[{name:"sub",newName:"subtract",target:Vn,targetName:"Vec4"},{name:"mul",newName:"multiply",target:Vn,targetName:"Vec4"},{name:"div",newName:"divide",target:Vn,targetName:"Vec4"},{name:"dist",newName:"distance",target:Vn,targetName:"Vec4"},{name:"sqrDist",newName:"squaredDistance",target:Vn,targetName:"Vec4"},{name:"mag",newName:"len",target:Vn,targetName:"Vec4"},{name:"sqrMag",newName:"lengthSqr",target:Vn,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:Vn,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:Vn,targetName:"Vec4"}]),pt(Vn.prototype,"Vec4",[{name:"mag",newName:"length",target:Vn.prototype,targetName:"Vec4"},{name:"magSqr",newName:"lengthSqr",target:Vn.prototype,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:Vn.prototype,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:Vn.prototype,targetName:"Vec4"}]),pt(kr,"Quat",[{name:"mag",newName:"len",target:kr,targetName:"Quat"},{name:"mul",newName:"multiply",target:kr,targetName:"Quat"},{name:"sqrMag",newName:"lengthSqr",target:kr,targetName:"Quat"},{name:"scale",newName:"multiplyScalar",target:kr,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:kr,targetName:"Quat"}]),pt(kr.prototype,"Quat",[{name:"scale",newName:"multiplyScalar",target:kr.prototype,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:kr.prototype,targetName:"Quat"}]),pt(cr,"Color",[{name:"sub",newName:"subtract",target:cr,targetName:"Color"},{name:"mul",newName:"multiply",target:cr,targetName:"Color"},{name:"div",newName:"divide",target:cr,targetName:"Color"},{name:"exactEquals",newName:"strictEquals",target:cr,targetName:"Color"},{name:"fromHex",newName:"fromHEX",customFunction:function(){for(var t=arguments.length,e=new Array(t),i=0;i=t.x&&e.y<=t.y&&e.y+e.height>=t.y},i.containsRect=function(t){var e=this;return e.x<=t.x&&e.x+e.width>=t.x+t.width&&e.y<=t.y&&e.y+e.height>=t.y+t.height},i.transformMat4=function(t){var e=this,i=e.x,n=e.y,r=i+e.width,s=n+e.height,a=t.m00*i+t.m04*n+t.m12,o=t.m01*i+t.m05*n+t.m13,h=t.m00*r+t.m04*n+t.m12,u=t.m01*r+t.m05*n+t.m13,l=t.m00*i+t.m04*s+t.m12,c=t.m01*i+t.m05*s+t.m13,f=t.m00*r+t.m04*s+t.m12,d=t.m01*r+t.m05*s+t.m13,_=vs(a,h,l,f),p=gs(a,h,l,f),m=vs(o,u,c,d),g=gs(o,u,c,d);return e.x=_,e.y=m,e.width=p-_,e.height=g-m,e},i.transformMat4ToPoints=function(t,e,i,n,r){var s=this,a=s.x,o=s.y,h=a+s.width,u=o+s.height;e.x=t.m00*a+t.m04*o+t.m12,e.y=t.m01*a+t.m05*o+t.m13,r.x=t.m00*h+t.m04*o+t.m12,r.y=t.m01*h+t.m05*o+t.m13,i.x=t.m00*a+t.m04*u+t.m12,i.y=t.m01*a+t.m05*u+t.m13,n.x=t.m00*h+t.m04*u+t.m12,n.y=t.m01*h+t.m05*u+t.m13},n(e,[{key:"xMin",get:function(){return this.x},set:function(t){this.width+=this.x-t,this.x=t}},{key:"yMin",get:function(){return this.y},set:function(t){this.height+=this.y-t,this.y=t}},{key:"xMax",get:function(){return this.x+this.width},set:function(t){this.width=t-this.x}},{key:"yMax",get:function(){return this.y+this.height},set:function(t){this.height=t-this.y}},{key:"center",get:function(){return new ds(this.x+.5*this.width,this.y+.5*this.height)},set:function(t){this.x=t.x-.5*this.width,this.y=t.y-.5*this.height}},{key:"origin",get:function(){return new ds(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}},{key:"size",get:function(){return new ps(this.width,this.height)},set:function(t){this.width=t.width,this.height=t.height}},{key:"z",get:function(){return this.width},set:function(t){this.width=t}},{key:"w",get:function(){return this.height},set:function(t){this.height=t}}]),e}(Fe));function bs(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),new ys(t,e,i,n)}Vi.fastDefine("cc.Rect",ys,{x:0,y:0,width:0,height:0}),A.Rect=ys,A.rect=bs;var Ss=t("bw",Float64Array),xs=t("bx",function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.createFloatArray=function(t){return new Ss(t)},n(e,[{key:"array",get:function(){return this._array}}]),e}(Fe)),ws=Object.freeze({__proto__:null,Color:cr,EPSILON:Ji,HALF_PI:Yi,MATH_FLOAT_ARRAY:Ss,Mat3:gr,Mat4:Qr,MathBase:xs,Quat:kr,Rect:ys,Size:ps,TWO_PI:Qi,Vec2:ds,Vec3:ir,Vec4:Vn,absMax:gn,absMaxComponent:mn,approx:Zi,bits:L,clamp:$i,clamp01:tn,color:fr,enumerableProps:vn,equals:Ki,floatToHalf:wn,halfToFloat:Tn,inverseLerp:pn,lerp:en,mat4:Zr,nextPow2:fn,pingPong:_n,preTransforms:Gr,pseudoRandom:un,pseudoRandomRange:ln,pseudoRandomRangeInt:cn,quat:zr,random:sn,randomRange:on,randomRangeInt:hn,rect:bs,repeat:dn,setRandGenerator:an,size:ms,toDegree:rn,toRadian:nn,v2:_s,v3:nr,v4:Nn});t("aK",ws);var Ts=new ir,Cs=new ir,As=new ir,Ds=new ir,Is=new ir,Bs=new ir,Ms=new Array(3),Ps=new Array(3);function Es(t,e){return ir.dot(e.n,t)-e.d}function ks(t,e,i){return ir.copy(t,e),ir.subtract(Is,i.center,i.halfExtents),ir.add(Bs,i.center,i.halfExtents),t.x=t.xBs.x?Bs.x:t.x,t.y=t.y>Bs.y?Bs.y:t.y,t.z=t.z>Bs.z?Bs.z:t.z,t}function Rs(t,e,i){ir.set(Ts,i.orientation.m00,i.orientation.m01,i.orientation.m02),ir.set(Cs,i.orientation.m03,i.orientation.m04,i.orientation.m05),ir.set(As,i.orientation.m06,i.orientation.m07,i.orientation.m08),Ms[0]=Ts,Ms[1]=Cs,Ms[2]=As,Ps[0]=i.halfExtents.x,Ps[1]=i.halfExtents.y,Ps[2]=i.halfExtents.z,ir.subtract(Ds,e,i.center),ir.set(t,i.center.x,i.center.y,i.center.z);for(var n=0;n<3;n++){var r=ir.dot(Ds,Ms[n]);r>Ps[n]&&(r=Ps[n]),r<-Ps[n]&&(r=-Ps[n]),t.x+=r*Ms[n].x,t.y+=r*Ms[n].y,t.z+=r*Ms[n].z}return t}var Os=Object.freeze({__proto__:null,point_plane:Es,pt_point_aabb:ks,pt_point_line:function(t,e,i,n){ir.subtract(Ts,i,n);var r=Ts.clone(),s=ir.lengthSqr(r);if(0===s)ir.copy(t,i);else{ir.subtract(Ts,e,i);var a=ir.dot(Ts,r)/s;a<0?ir.copy(t,i):a>1?ir.copy(t,n):ir.scaleAndAdd(t,i,r,a)}},pt_point_obb:Rs,pt_point_plane:function(t,e,i){var n=Es(e,i);return ir.subtract(t,e,ir.multiplyScalar(t,i.n,n))}}),Fs=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=-1),this.s=void 0,this.e=void 0,this._type=void 0,this._type=2,this.s=new ir(t,e,i),this.e=new ir(n,r,s)}return t.create=function(e,i,n,r,s,a){return new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.s.x,e.s.y,e.s.z,e.e.x,e.e.y,e.e.z)},t.copy=function(t,e){return ir.copy(t.s,e.s),ir.copy(t.e,e.e),t},t.fromPoints=function(t,e,i){return ir.copy(t.s,e),ir.copy(t.e,i),t},t.set=function(t,e,i,n,r,s,a){return t.s.x=e,t.s.y=i,t.s.z=n,t.e.x=r,t.e.y=s,t.e.z=a,t},t.len=function(t){return ir.distance(t.s,t.e)},t.prototype.length=function(){return ir.distance(this.s,this.e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),Ls=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=-1),this._type=1,this.o=new ir(t,e,i),this.d=new ir(n,r,s)}return t.create=function(e,i,n,r,s,a){return void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.o.x,e.o.y,e.o.z,e.d.x,e.d.y,e.d.z)},t.copy=function(t,e){return ir.copy(t.o,e.o),ir.copy(t.d,e.d),t},t.fromPoints=function(t,e,i){return ir.copy(t.o,e),ir.normalize(t.d,ir.subtract(t.d,i,e)),t},t.set=function(t,e,i,n,r,s,a){return t.o.x=e,t.o.y=i,t.o.z=n,t.d.x=r,t.d.y=s,t.d.z=a,t},t.prototype.computeHit=function(t,e){ir.normalize(t,this.d),ir.scaleAndAdd(t,this.o,t,e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),Vs=new ir,Ns=new ir,zs=new ir,Us=new ir;function Gs(t){return Math.max(Math.max(t.x,t.y),t.z)}var Hs,Ws,js,qs,Xs,Ys=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),this._type=4,this._center=new ir(t,e,i),this._radius=n}t.create=function(e,i,n,r){return new t(e,i,n,r)},t.clone=function(e){return new t(e.center.x,e.center.y,e.center.z,e.radius)},t.copy=function(t,e){return ir.copy(t.center,e.center),t.radius=e.radius,t},t.fromPoints=function(t,e,i){return ir.multiplyScalar(t.center,ir.add(Vs,e,i),.5),t.radius=.5*ir.subtract(Vs,i,e).length(),t},t.set=function(t,e,i,n,r){return t.center.x=e,t.center.y=i,t.center.z=n,t.radius=r,t};var e=t.prototype;return e.destroy=function(){},e.clone=function(){return t.clone(this)},e.copy=function(e){return t.copy(this,e)},e.getBoundary=function(t,e){ir.set(t,this.center.x-this.radius,this.center.y-this.radius,this.center.z-this.radius),ir.set(e,this.center.x+this.radius,this.center.y+this.radius,this.center.z+this.radius)},e.transform=function(t,e,i,n,r){ir.transformMat4(r.center,this.center,t),r.radius=this.radius*Gs(n)},e.translateAndRotate=function(t,e,i){ir.transformMat4(i.center,this.center,t)},e.setScale=function(t,e){e.radius=this.radius*Gs(t)},e.mergePoint=function(t){this.radius<0&&(this.center.set(t),this.radius=0),ir.subtract(Ns,t,this.center);var e=Ns.length();if(e>this.radius){var i=.5*(e-this.radius);this.radius+=i,ir.multiplyScalar(Ns,Ns,i/e),ir.add(this.center,this.center,Ns)}},e.mergePoints=function(t){var e=t.length;if(!(e<1)){this.radius=-1;for(var i=0;i-Number.EPSILON))return 0;var r=1/n;Js(qs,t.o,e.a);var s=Ks(qs,js)*r;if(s<0||s>1)return 0;$s(Xs,qs,Hs);var a=Ks(t.d,Xs)*r;if(a<0||s+a>1)return 0;var o=Ks(Ws,Xs)*r;return o<0?0:o}),ua=function(){var t=nr();return function(e,i){var n=i.radius,r=i.center,s=e.o,a=e.d,o=n*n;Js(t,r,s);var h=t.lengthSqr(),u=Ks(t,a),l=o-(h-u*u);if(l<0)return 0;var c=Math.sqrt(l),f=hp?0:_>0?_:p}var fa=function(){var t=nr(),e=nr(),i=nr(),n=nr(),r=nr(),s=nr(),a=nr(),o=new Array(3),h=new Array(3),u=new Array(3),l=new Array(6);return function(c,f){var d=f.halfExtents,_=f.orientation;o[0]=d.x,o[1]=d.y,o[2]=d.z,t=f.center,e=c.o,i=c.d,Zs(n,_.m00,_.m01,_.m02),Zs(r,_.m03,_.m04,_.m05),Zs(s,_.m06,_.m07,_.m08),Js(a,t,e),h[0]=Ks(n,i),h[1]=Ks(r,i),h[2]=Ks(s,i),u[0]=Ks(n,a),u[1]=Ks(r,a),u[2]=Ks(s,a);for(var p=0;p<3;++p){if(0===h[p]){if(-u[p]-o[p]>0||-u[p]+o[p]<0)return 0;h[p]=1e-7}l[2*p+0]=(u[p]+o[p])/h[p],l[2*p+1]=(u[p]-o[p])/h[p]}var m=ra(ra(sa(l[0],l[1]),sa(l[2],l[3])),sa(l[4],l[5])),g=sa(sa(ra(l[0],l[1]),ra(l[2],l[3])),ra(l[4],l[5]));return g<0||m>g?0:m>0?m:g}}(),da=function(){var t=nr(),e=nr(),i=nr(),n=nr(),r=nr(),s=nr(),a=nr(),o=new Ys;return function(h,u){var l=u.ellipseCenter0,c=u.ellipseCenter1,f=Js(e,c,l);if(f.length()=0&&I<=1?T:I<0?(o.radius=u.radius,o.center.set(u.ellipseCenter0),Ka.raySphere(h,o)):I>1?(o.radius=u.radius,o.center.set(u.ellipseCenter1),Ka.raySphere(h,o)):0}}(),_a=function(){var t=nr();return function(e,i){Js(t,e.e,e.s);var n=-Es(e.s,i)/Ks(t,i.n);return n<0||n>1?0:n}}(),pa=function(){var t=nr(),e=nr(),i=nr(),n=nr(),r=nr(),s=nr();return function(a,o,h){Js(t,o.b,o.a),Js(e,o.c,o.a),Js(i,a.s,a.e),$s(r,t,e);var u=Ks(i,r);if(u<=0)return 0;Js(n,a.s,o.a);var l=Ks(n,r);if(l<0||l>u)return 0;$s(s,i,n);var c=Ks(e,s);if(c<0||c>u)return 0;var f=-Ks(t,s);if(f<0||c+f>u)return 0;if(h){var d=1/u,_=1-(c*=d)-(f*=d);Zs(h,o.a.x*_+o.b.x*c+o.c.x*f,o.a.y*_+o.b.y*c+o.c.y*f,o.a.z*_+o.b.z*c+o.c.z*f)}return 1}}(),ma=new Ls;function ga(t,e){ma.o.set(t.s),Js(ma.d,t.e,t.s),ma.d.normalize();var i=la(ma,e);return i<=t.length()?i:0}function va(t,e){ma.o.set(t.s),Js(ma.d,t.e,t.s),ma.d.normalize();var i=fa(ma,e);return i<=t.length()?i:0}function ya(t,e){ma.o.set(t.s),Js(ma.d,t.e,t.s),ma.d.normalize();var i=ua(ma,e);return i<=t.length()?i:0}var ba,Sa,xa,wa,Ta=(ba=nr(),Sa=nr(),xa=nr(),wa=nr(),function(t,e){return Js(ba,t.center,t.halfExtents),ia(Sa,t.center,t.halfExtents),Js(xa,e.center,e.halfExtents),ia(wa,e.center,e.halfExtents),ba.x<=wa.x&&Sa.x>=xa.x&&ba.y<=wa.y&&Sa.y>=xa.y&&ba.z<=wa.z&&Sa.z>=xa.z});function Ca(t,e,i){Zs(i[0],t.x,e.y,e.z),Zs(i[1],t.x,e.y,t.z),Zs(i[2],t.x,t.y,e.z),Zs(i[3],t.x,t.y,t.z),Zs(i[4],e.x,e.y,e.z),Zs(i[5],e.x,e.y,t.z),Zs(i[6],e.x,t.y,e.z),Zs(i[7],e.x,t.y,t.z)}function Aa(t,e,i,n,r,s){Zs(s[0],t.x+i.x*e.x+n.x*e.y+r.x*e.z,t.y+i.y*e.x+n.y*e.y+r.y*e.z,t.z+i.z*e.x+n.z*e.y+r.z*e.z),Zs(s[1],t.x-i.x*e.x+n.x*e.y+r.x*e.z,t.y-i.y*e.x+n.y*e.y+r.y*e.z,t.z-i.z*e.x+n.z*e.y+r.z*e.z),Zs(s[2],t.x+i.x*e.x-n.x*e.y+r.x*e.z,t.y+i.y*e.x-n.y*e.y+r.y*e.z,t.z+i.z*e.x-n.z*e.y+r.z*e.z),Zs(s[3],t.x+i.x*e.x+n.x*e.y-r.x*e.z,t.y+i.y*e.x+n.y*e.y-r.y*e.z,t.z+i.z*e.x+n.z*e.y-r.z*e.z),Zs(s[4],t.x-i.x*e.x-n.x*e.y-r.x*e.z,t.y-i.y*e.x-n.y*e.y-r.y*e.z,t.z-i.z*e.x-n.z*e.y-r.z*e.z),Zs(s[5],t.x+i.x*e.x-n.x*e.y-r.x*e.z,t.y+i.y*e.x-n.y*e.y-r.y*e.z,t.z+i.z*e.x-n.z*e.y-r.z*e.z),Zs(s[6],t.x-i.x*e.x+n.x*e.y-r.x*e.z,t.y-i.y*e.x+n.y*e.y-r.y*e.z,t.z-i.z*e.x+n.z*e.y-r.z*e.z),Zs(s[7],t.x-i.x*e.x-n.x*e.y+r.x*e.z,t.y-i.y*e.x-n.y*e.y+r.y*e.z,t.z-i.z*e.x-n.z*e.y+r.z*e.z)}function Da(t,e){for(var i=Ks(e,t[0]),n=i,r=1;r<8;++r){var s=Ks(e,t[r]);i=sn?s:n}return[i,n]}var Ia,Ba,Ma,Pa,Ea,ka=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=nr();for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=nr(),n[r]=nr();var s=nr(),a=nr();return function(e,r){var o=r.orientation;Zs(t[0],1,0,0),Zs(t[1],0,1,0),Zs(t[2],0,0,1),Zs(t[3],o.m00,o.m01,o.m02),Zs(t[4],o.m03,o.m04,o.m05),Zs(t[5],o.m06,o.m07,o.m08);for(var h=0;h<3;++h)$s(t[6+3*h],t[h],t[3]),$s(t[7+3*h],t[h],t[4]),$s(t[7+3*h],t[h],t[5]);Js(s,e.center,e.halfExtents),ia(a,e.center,e.halfExtents),Ca(s,a,i),Aa(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var u=0;u<15;++u){var l=Da(i,t[u]),c=Da(n,t[u]);if(c[0]>l[1]||l[0]>c[1])return 0}return 1}}(),Ra=function(t,e){var i=t.halfExtents,n=e.n,r=i.x*aa(n.x)+i.y*aa(n.y)+i.z*aa(n.z),s=Ks(n,t.center);return s+re.d?0:1},Oa=function(t,e){for(var i=e.planes,n=0;na.x?e++:t[c].x<-a.x&&i++;if(e===s.length||i===s.length)return 0;e=0,i=0;for(var f=0;fa.y?e++:t[f].y<-a.y&&i++;if(e===s.length||i===s.length)return 0;e=0,i=0;for(var d=0;da.z?e++:t[d].z<-a.z&&i++;return e===s.length||i===s.length?0:1}}(),La=(Ia=nr(),Ba=new gr,function(t,e){return Js(Ia,e,t.center),ir.transformMat3(Ia,Ia,gr.transpose(Ba,t.orientation)),i=Ia,n=t.halfExtents,aa(i.x)s?0:1}),Na=function(t,e){for(var i=e.planes,n=0;nh.x?i++:e<-h.x&&n++;if(i===u.length||n===u.length)return 0;i=0,n=0;for(var m=0;mh.y?i++:e<-h.y&&n++;if(i===u.length||n===u.length)return 0;i=0,n=0;for(var g=0;gh.z?i++:e<-h.z&&n++;return i===u.length||n===u.length?0:1}}(),Ua=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=nr();for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=nr(),n[r]=nr();return function(e,r){var s=e.orientation,a=r.orientation;Zs(t[0],s.m00,s.m01,s.m02),Zs(t[1],s.m03,s.m04,s.m05),Zs(t[2],s.m06,s.m07,s.m08),Zs(t[3],a.m00,a.m01,a.m02),Zs(t[4],a.m03,a.m04,a.m05),Zs(t[5],a.m06,a.m07,a.m08);for(var o=0;o<3;++o)$s(t[6+3*o],t[o],t[3]),$s(t[7+3*o],t[o],t[4]),$s(t[8+3*o],t[o],t[5]);Aa(e.center,e.halfExtents,t[0],t[1],t[2],i),Aa(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var h=0;h<15;++h){var u=Da(i,t[h]),l=Da(n,t[h]);if(l[0]>u[1]||u[0]>l[1])return 0}return 1}}(),Ga=function(){for(var t=new Ys,e=nr(),i=nr(),n=nr(),r=new Array(8),s=0;s<8;s++)r[s]=nr();for(var a=new Array(8),o=0;o<8;o++)a[o]=nr();return function(s,o){var h=o.ellipseCenter0,u=o.ellipseCenter1,l=o.radius;if(0===Qs(h,u))return t.radius=o.radius,t.center.set(h),Ka.sphereOBB(t,s);var c=s.orientation;e.x=c.m00,e.y=c.m01,e.z=c.m02,i.x=c.m03,i.y=c.m04,i.z=c.m05,n.x=c.m06,n.y=c.m07,n.z=c.m08,Aa(s.center,s.halfExtents,e,i,n,r);var f=a,d=ea(f[0],e),_=ea(f[1],i),p=ea(f[2],n);Js(f[3],o.center,s.center).normalize();var m=Js(f[4],h,u);m.normalize(),$s(f[5],d,m),$s(f[6],_,m),$s(f[7],p,m);for(var g=0;g<8;++g){var v=Da(r,f[g]),y=Ks(f[g],h),b=Ks(f[g],u),S=ra(y,b)+l;if(sa(y,b)-l>v[1]||v[0]>S)return 0}return 1}}(),Ha=function(t,e){var i=Ks(e.n,t.center),n=t.radius*e.n.length();return i+ne.d?0:1},Wa=function(t,e){for(var i=e.planes,n=0;no)){ia(Pa,s,ta(Pa,a,r));for(var u=0;u<6;u++)if(u!==i&&u!==i+Ea[i]){var l=e.planes[u];if(Ks(l.n,Pa)1?Qs(a,s)w&&(h=w,u=S+v,T=y)),u<0?(u=0,-b<0?h=0:-b>g?h=w:(h=-b,w=g)):u>T&&(u=T,-b+v<0?h=0:-b+v>g?h=w:(h=-b+v,w=g));var C=aa(h)0&&(t.d=e.d/i),t},t.prototype.transform=function(t){Qr.invert(to,t),Qr.transpose(to,to),Vn.set(eo,this.n.x,this.n.y,this.n.z,-this.d),Vn.transformMat4(eo,eo,to),ir.set(this.n,eo.x,eo.y,eo.z),this.d=-eo.w},n(t,[{key:"type",get:function(){return this._type}},{key:"x",get:function(){return this.n.x},set:function(t){this.n.x=t}},{key:"y",get:function(){return this.n.y},set:function(t){this.n.y=t}},{key:"z",get:function(){return this.n.z},set:function(t){this.n.z=t}},{key:"w",get:function(){return this.d},set:function(t){this.d=t}}]),t}(),no=function(){function t(t,e,i,n,r,s,a,o,h){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=1),void 0===h&&(h=0),this._type=64,this.a=new ir(t,e,i),this.b=new ir(n,r,s),this.c=new ir(a,o,h)}return t.create=function(e,i,n,r,s,a,o,h,u){return void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=1),new t(e,i,n,r,s,a,o,h,u)},t.clone=function(e){return new t(e.a.x,e.a.y,e.a.z,e.b.x,e.b.y,e.b.z,e.c.x,e.c.y,e.c.z)},t.copy=function(t,e){return ir.copy(t.a,e.a),ir.copy(t.b,e.b),ir.copy(t.c,e.c),t},t.fromPoints=function(t,e,i,n){return ir.copy(t.a,e),ir.copy(t.b,i),ir.copy(t.c,n),t},t.set=function(t,e,i,n,r,s,a,o,h,u){return t.a.x=e,t.a.y=i,t.a.z=n,t.b.x=r,t.b.y=s,t.b.z=a,t.c.x=o,t.c.y=h,t.c.z=u,t},n(t,[{key:"type",get:function(){return this._type}}]),t}();Dt({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 ro=function(){function t(){this._poolHandle=-1,ao.addContainer(this)}return t.prototype.destroy=function(){ao.removeContainer(this)},t}(),so=function(){function t(){this._pools=[],this._lastShrinkPassed=0,this.shrinkTimeSpan=5}var e=t.prototype;return e.addContainer=function(t){-1===t._poolHandle&&(t._poolHandle=this._pools.length,this._pools.push(t))},e.removeContainer=function(t){-1!==t._poolHandle&&(this._pools[this._pools.length-1]._poolHandle=t._poolHandle,be(this._pools,t._poolHandle),t._poolHandle=-1)},e.tryShrink=function(){for(var t=0;tthis.shrinkTimeSpan&&(this.tryShrink(),this._lastShrinkPassed-=this.shrinkTimeSpan)},t}(),ao=new so,oo=t("by",function(t){function e(e,i,n,r){var s;(s=t.call(this)||this)._freePool=[],s._ctor=e,s._dtor=n||null,s._elementsPerBatch=Math.max(i,1),s._shrinkThreshold=r?P(r,1):s._elementsPerBatch,s._nextAvail=s._elementsPerBatch-1;for(var a=0;a>1>=this._shrinkThreshold?t>>1:Math.floor((t-this._shrinkThreshold+1)/2),this._dtor)for(var i=this._nextAvail-e+1;i<=this._nextAvail;++i)this._dtor(this._freePool[i]);this._nextAvail-=e,this._freePool.length=this._nextAvail+1}},i.destroy=function(){var e=arguments.length>0?arguments[0]:null;e&&at(14100);var i=e||this._dtor;if(i)for(var n=0;n<=this._nextAvail;n++)i(this._freePool[n]);this._freePool.length=0,this._nextAvail=-1,t.prototype.destroy.call(this)},e}(ro)),ho=t("bz",function(t){function e(e,i,n){var r;(r=t.call(this)||this)._count=0,r._fn=e,r._dtor=n||null,r._data=new Array(i),r._initSize=i;for(var s=0;sthis._data.length)for(var e=this._data.length;e=this._data.length&&this.resize(this._data.length<<1),this._data[this._count++]},i.destroy=function(){if(this._dtor)for(var e=0;e>2>this._count){var t=Math.max(this._initSize,this._data.length>>1);if(this._dtor)for(var e=t;e=this._count)){var e=this._count-1,i=this._data[t];this._data[t]=this._data[e],this._data[e]=i,this._count-=1}},n(e,[{key:"length",get:function(){return this._count}},{key:"data",get:function(){return this._data}}]),e}(ro)),uo=t("bA",function(t){function e(e,i){var n;return(n=t.call(this)||this).length=0,n._initSize=0,n.array=new Array(e),n._initSize=e,n._compareFn=i,n}s(e,t);var i=e.prototype;return i.push=function(t){this.array[this.length++]=t},i.pop=function(){return this.array[--this.length]},i.get=function(t){return this.array[t]},i.clear=function(){this.length=0},i.destroy=function(){this.length=0,this.array.length=0,t.prototype.destroy.call(this)},i.tryShrink=function(){this.array.length>>2>this.length&&(this.array.length=Math.max(this._initSize,this.array.length>>1))},i.sort=function(){this.array.length=this.length,this.array.sort(this._compareFn)},i.concat=function(t){for(var e=0;e=this.length||t<0)){var e=--this.length;this.array[t]=this.array[e]}},i.indexOf=function(t){for(var e=0,i=this.length;e=0;--t)this.callbackInfos[t]||bo(this.callbackInfos,t);this.containCanceled=!1},e.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1},t}(),Co=new oo((function(){return new To}),16),Ao=t("d4",function(){function t(){this._callbackTable=Gt(!0),this._offCallback=void 0}var e=t.prototype;return e.on=function(t,e,i,n){if(!this.hasEventListener(t,e,i)){var r=this._callbackTable[t];r||(r=this._callbackTable[t]=Co.alloc());var s=wo.alloc();s.set(e,i,n),r.callbackInfos.push(s)}return e},e.hasEventListener=function(t,e,i){var n=this._callbackTable&&this._callbackTable[t];if(!n)return!1;var r=n.callbackInfos;if(!e){if(n.isInvoking){for(var s=0;s0}for(var a=0;a1)&&(h=!0,u="",l=0);var f=Eo.UNKNOWN;-1!==r.appVersion.indexOf("Win")?f=Eo.WINDOWS:h?f=Eo.IOS:-1!==r.appVersion.indexOf("Mac")?f=Eo.OSX:-1!==r.appVersion.indexOf("X11")&&-1===r.appVersion.indexOf("Linux")?f=Eo.LINUX:o?f=Eo.ANDROID:-1===r.appVersion.indexOf("Linux")&&-1===s.indexOf("ubuntu")||(f=Eo.LINUX),i.os=f,i.osVersion=u,i.osMainVersion=l,i.browserType=Bo.UNKNOWN;var d=/wechat|weixin|micromessenger/i.exec(s)||/mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|ucbs|360 aphone|360browser|baiduboxapp|baidubrowser|maxthon|mxbrowser|miuibrowser/i.exec(s)||/qq|qqbrowser|ucbrowser|ubrowser|edge|HuaweiBrowser/i.exec(s)||/chrome|safari|firefox|trident|opera|opr\/|oupeng/i.exec(s),_=d?d[0].toLowerCase():Eo.UNKNOWN;("safari"===_&&o||"qq"===_&&/android.*applewebkit/i.test(s))&&(_=Bo.ANDROID);var p={micromessenger:Bo.WECHAT,wechat:Bo.WECHAT,weixin:Bo.WECHAT,trident:Bo.IE,edge:Bo.EDGE,"360 aphone":Bo.BROWSER_360,mxbrowser:Bo.MAXTHON,"opr/":Bo.OPERA,ubrowser:Bo.UC,huaweibrowser:Bo.HUAWEI};i.browserType=p[_]||_,i.browserVersion="";var m=/(mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|uc|ucbs|360 aphone|360|baiduboxapp|baidu|maxthon|mxbrowser|miui(?:.hybrid)?)(mobile)?(browser)?\/?([\d.]+)/i.exec(s);m||(m=/(qq|chrome|safari|firefox|trident|opera|opr\/|oupeng)(mobile)?(browser)?\/?([\d.]+)/i.exec(s)),i.browserVersion=m?m[4]:"",i.isXR=!1;var g,v=document.createElement("canvas");v.getContext("2d");try{g=v.toDataURL("image/webp").startsWith("data:image/webp")}catch(t){g=!1}if(i.os===Eo.IOS){var y,b=null==(y=/ applewebkit\/(\d+)/.exec(s))?void 0:y[1];"string"==typeof b&&Number.parseInt(b)>=604&&(g=!0)}else if(i.browserType===Bo.SAFARI){var w,T=null==(w=/ version\/(\d+)/.exec(s))?void 0:w[1];"string"==typeof T&&Number.parseInt(T)>=14&&(g=!0)}var C=void 0!==document.documentElement.ontouchstart||void 0!==document.ontouchstart||S,A=void 0!==document.documentElement.onmouseup||S,D=void 0!==navigator.xr,I=function(){if((i.os===Eo.IOS||i.os===Eo.OSX)&&/(OS 15_4)|(Version\/15.4)/.test(window.navigator.userAgent))return!1;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){var t=new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0]));if(t instanceof WebAssembly.Module)return new WebAssembly.Instance(t)instanceof WebAssembly.Instance}}catch(t){return!1}return!1}();return i._featureMap=((e={})[Ro.WEBP]=g,e[Ro.IMAGE_BITMAP]=!1,e[Ro.WEB_VIEW]=!0,e[Ro.VIDEO_PLAYER]=!0,e[Ro.SAFE_AREA]=!1,e[Ro.HPE]=!1,e[Ro.INPUT_TOUCH]=C,e[Ro.EVENT_KEYBOARD]=void 0!==document.documentElement.onkeyup||S,e[Ro.EVENT_MOUSE]=A,e[Ro.EVENT_TOUCH]=C||A,e[Ro.EVENT_ACCELEROMETER]=void 0!==window.DeviceMotionEvent||void 0!==window.DeviceOrientationEvent,e[Ro.EVENT_GAMEPAD]=void 0!==navigator.getGamepads||void 0!==navigator.webkitGetGamepads||D,e[Ro.EVENT_HANDLE]=x,e[Ro.EVENT_HMD]=D,e[Ro.EVENT_HANDHELD]=D,e[Ro.WASM]=I,e),i._initPromise.push(i._supportsImageBitmapPromise()),i._registerEvent(),i}s(e,t);var i=e.prototype;return i._supportsImageBitmapPromise=function(){var t=this;if("undefined"!=typeof createImageBitmap&&"undefined"!=typeof Blob){var e=document.createElement("canvas");e.width=e.height=2;var i=createImageBitmap(e);if(i instanceof Promise)return i.then((function(e){e&&e.close&&(t._setFeature(Ro.IMAGE_BITMAP,!0),e.close())}))}return Promise.resolve()},i._registerEvent=function(){var t,e=this;t=void 0!==document.hidden?"hidden":void 0!==document.mozHidden?"mozHidden":void 0!==document.msHidden?"msHidden":void 0!==document.webkitHidden?"webkitHidden":"hidden";var i=!1,n=function(){i||(i=!0,e.emit("hide"))},r=function(t,n,r,s,a){i&&(i=!1,e.emit("show",t,n,r,s,a))};if(t)for(var s=["visibilitychange","mozvisibilitychange","msvisibilitychange","webkitvisibilitychange","qbrowserVisibilityChange"],a=0;a-1&&(window.onfocus=r),"onpageshow"in window&&"onpagehide"in window&&(window.addEventListener("pagehide",n),window.addEventListener("pageshow",r),document.addEventListener("pagehide",n),document.addEventListener("pageshow",r))},i._setFeature=function(t,e){return this._featureMap[t]=e},i.init=function(){return Promise.all(this._initPromise)},i.hasFeature=function(t){return this._featureMap[t]},i.getBatteryLevel=function(){return this._battery?this._battery.level:1},i.triggerGC=function(){},i.openURL=function(t){window.open(t)},i.now=function(){return Date.now?Date.now():+new Date},i.restartJSVM=function(){},i.exit=function(){window.close()},i.close=function(){this.emit("close")},e}(Io),Lo=new Fo,Vo=/(\.[^./?\\]*)(\?.*)?$/,No=/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,zo=/[^./]+\/\.\.\//;function Uo(){for(var t="",e=arguments.length,i=new Array(e),n=0;n0&&(t=t.substring(0,i));var n=/(\/|\\)([^/\\]+)$/g.exec(t.replace(/(\/|\\)$/,""));if(!n)return t;var r=n[2];return e&&t.substring(t.length-e.length).toLowerCase()===e.toLowerCase()?r.substring(0,r.length-e.length):r}function jo(t){var e=No.exec(t);return e?e[2]:""}function qo(t,e){e=e||"";var i=t.indexOf("?"),n="";return i>0&&(n=t.substring(i),t=t.substring(0,i)),(i=t.lastIndexOf("."))<0?t+e+n:t.substring(0,i)+e+n}function Xo(t,e,i){if(0===e.indexOf("."))return qo(t,e);var n=t.indexOf("?"),r="",s=i?Go(t):"";return n>0&&(r=t.substring(n),t=t.substring(0,n)),n=(n=t.lastIndexOf("/"))<=0?0:n+1,t.substring(0,n)+e+s+r}function Yo(t){var e=t=String(t);do{e=t,t=t.replace(zo,"")}while(e.length!==t.length);return t}function Qo(t){return t.replace(/[/\\]$/,"")}function Jo(){return Lo.os===Eo.WINDOWS?"\\":"/"}t("bH",Object.freeze({__proto__:null,_normalize:Yo,basename:Wo,changeBasename:Xo,changeExtname:qo,dirname:jo,extname:Go,getSeperator:Jo,join:Uo,mainFileName:Ho,stripSep:Qo}));var Ko=new ir;function Zo(t,e,i,n){n||(n=new ir),t.convertToUINode(e,i,n);var r=i.position;return n.add(r),n}function $o(t,e,i){return i||(i=new ir),t.worldToScreen(e,i),i.x/=A.view.getScaleX(),i.y/=A.view.getScaleY(),i}var th=t("bR",{WorldNode3DToLocalNodeUI:Zo,WorldNode3DToWorldNodeUI:$o});A.pipelineUtils=th,pt(A.pipelineUtils,"cc.pipelineUtils",[{name:"WorldNode3DToLocalNodeUI",newName:"convertToUINode",targetName:"cc.Camera.prototype",customFunction:function(){for(var t=arguments.length,e=new Array(t),i=0;iwindow.innerHeight;this.isFrameRotated=Lo.isMobile&&(e&&t===Ne.PORTRAIT||!e&&t===Ne.LANDSCAPE)},e._updateContainer=function(){if(this._gameContainer){if(this.isProportionalToFrame){if(!this._gameFrame)return void at(9201);var t,e,i=A.view.getDesignResolutionSize(),n=this._gameFrame,r=n.clientWidth,s=n.clientHeight,a=i.width,o=i.height,h=r/a,u=s/o,l=this._gameContainer.style;h0&&at(1400,"screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)","screen.requestFullScreen(): Promise"),rh.requestFullScreen().then((function(){null==e||e.call(document)})).catch((function(t){Q(t),null==i||i.call(document)}))},e.exitFullScreen=function(){return rh.exitFullScreen()},e.autoFullScreen=function(t,e){var i;null==(i=this.requestFullScreen(t,e))||i.catch((function(t){Y(t)}))},e.disableAutoFullScreen=function(){},e.on=function(t,e,i){rh.on(t,e,i)},e.once=function(t,e,i){rh.once(t,e,i)},e.off=function(t,e,i){rh.off(t,e,i)},n(t,[{key:"devicePixelRatio",get:function(){return rh.devicePixelRatio}},{key:"windowSize",get:function(){return rh.windowSize},set:function(t){rh.windowSize=t}},{key:"resolution",get:function(){return rh.resolution}},{key:"supportsFullScreen",get:function(){return rh.supportFullScreen}}]),t}(),ah=t("cm",new sh);A.screen=ah;var oh=t("cn",{Feature:Ro,hasFeature:function(t){return Lo.hasFeature(t)},NetworkType:Po,Language:Mo,OS:Eo,Platform:ko,BrowserType:Bo,isNative:Lo.isNative,isBrowser:Lo.isBrowser,isMobile:Lo.isMobile,isLittleEndian:Lo.isLittleEndian,platform:Lo.platform,language:Lo.language,languageCode:Lo.nativeLanguage,os:Lo.os,osVersion:Lo.osVersion,osMainVersion:Lo.osMainVersion,browserType:Lo.browserType,browserVersion:Lo.browserVersion,isXR:Lo.isXR,windowPixelResolution:ah.windowSize,capabilities:{canvas:!0,opengl:!0,webp:Lo.hasFeature(Ro.WEBP),imageBitmap:Lo.hasFeature(Ro.IMAGE_BITMAP),touches:Lo.hasFeature(Ro.INPUT_TOUCH),mouse:Lo.hasFeature(Ro.EVENT_MOUSE),keyboard:Lo.hasFeature(Ro.EVENT_KEYBOARD),accelerometer:Lo.hasFeature(Ro.EVENT_ACCELEROMETER)},localStorage:{},getNetworkType:function(){return Lo.networkType},getBatteryLevel:function(){return Lo.getBatteryLevel()},garbageCollect:function(){Lo.triggerGC()},isObjectValid:function(t){return null!=t},__isWebIOS14OrIPadOS14Env:!1,dump:function(){var t="";t+="isMobile : "+this.isMobile+"\r\n",t+="language : "+this.language+"\r\n",t+="browserType : "+this.browserType+"\r\n",t+="browserVersion : "+this.browserVersion+"\r\n",t+="supports webp: "+oh.hasFeature(Ro.WEBP)+"\r\n",t+="supports bitmap: "+oh.hasFeature(Ro.IMAGE_BITMAP)+"\r\n",t+="supports touches: "+oh.hasFeature(Ro.INPUT_TOUCH)+"\r\n",t+="supports mouse: "+oh.hasFeature(Ro.EVENT_MOUSE)+"\r\n",t+="supports keyboard: "+oh.hasFeature(Ro.EVENT_KEYBOARD)+"\r\n",t+="supports accelerometer: "+oh.hasFeature(Ro.EVENT_ACCELEROMETER)+"\r\n",t+="os : "+this.os+"\r\n",t+="osVersion : "+this.osVersion+"\r\n",t+="platform : "+this.platform+"\r\n",X(t+="Using "+(A.game.renderType===A.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n")},openURL:function(t){Lo.openURL(t)},init:function(){var t=this;return Promise.resolve().then((function(){return Lo.init()})).then((function(){try{var e=oh.localStorage=window.localStorage;e.setItem("storage",""),e.removeItem("storage"),e=null}catch(e){var i=function(){at(5200)};t.localStorage={getItem:i,setItem:i,clear:i,removeItem:i,key:i,length:0}}t.__isWebIOS14OrIPadOS14Env=(oh.os===Eo.IOS||oh.os===Eo.OSX)&&Lo.isBrowser&&/(OS 14)|(Version\/14)/.test(window.navigator.userAgent)}))},now:function(){return Lo.now()},restartVM:function(){Lo.restartJSVM()},getSafeAreaRect:function(t){void 0===t&&(t=!0);var e=A.view,i=rh.safeAreaEdge;t&&(rh.orientation===Ue.ORIENTATION_PORTRAIT?i.toplh.x&&(lh.x=t.x),t.y>lh.y&&(lh.y=t.y),t.z>lh.z&&(lh.z=t.z),ir.add(ch,uh,lh),this.center.set(ir.multiplyScalar(ch,ch,.5)),this.halfExtents.set(lh.x-ch.x,lh.y-ch.y,lh.z-ch.z)},e.mergePoints=function(t){if(!(t.length<1))for(var e=0;e>>1;n<=r;s=n+r>>>1){var a=t[s];if(a>e+i)r=s-1;else{if(!(a=t._times.length)return{done:!0,value:void 0};var i=[t._times[e],t._values[e]];return++e,{done:!1,value:i}}}},e.keyframes=function(){return this},e.times=function(){return this._times},e.values=function(){return this._values},e.getKeyframeTime=function(t){return this._times[t]},e.getKeyframeValue=function(t){return this._values[t]},e.addKeyFrame=function(t,e){return this._insertNewKeyframe(t,e)},e.removeKeyframe=function(t){this._times.splice(t,1),this._values.splice(t,1)},e.indexOfKeyframe=function(t){return kh(this._times,t)},e.updateTime=function(t,e){var i=this._values[t];this.removeKeyframe(t),this._insertNewKeyframe(e,i)},e.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.slice());else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return t[1]})))}},e.clear=function(){this._times.length=0,this._values.length=0},e.searchKeyframe=function(t){return kh(this._times,t)},e.setKeyframes=function(t,e){t.length,e.length,Oh(t),this._times=t,this._values=e},e._insertNewKeyframe=function(t,e){var i=this._times,n=this._values,r=i.length,s=kh(i,t);if(s>=0)return s;var a=~s;return 0===a?(i.unshift(t),n.unshift(e)):a===r?(i.push(t),n.push(e)):(i.splice(a-1,0,t),n.splice(a-1,0,e)),a},n(t,[{key:"keyFramesCount",get:function(){return this._times.length}},{key:"rangeMin",get:function(){return this._times[0]}},{key:"rangeMax",get:function(){return this._times[this._values.length-1]}}]),t}();function Oh(t){return t.every((function(t,e,i){return 0===e||t>i[e-1]||Zi(t,i[e-1],1e-6)}))}function Fh(t,e,i,n,r){var s=i/n,a=e/n,o=s*s,h=1/3*(-1/3*o+a),u=.5*(2/27*s*o-1/3*s*a+t/n),l=h*h*h,c=u*u+l,f=0;if(Vh(c)){if(Vh(u))return r[0]=0,1;var d=Math.cbrt(-u);return r[0]=2*d,r[1]=-d,2}if(c<0){var _=1/3*Math.acos(-u/Math.sqrt(-l)),p=2*Math.sqrt(-h);r[0]=p*Math.cos(_),r[1]=-p*Math.cos(_+Math.PI/3),r[2]=-p*Math.cos(_-Math.PI/3),f=3}else{var m=Math.sqrt(c),g=Math.cbrt(m-u),v=-Math.cbrt(m+u);r[0]=g+v,f=1}for(var y=1/3*s,b=0;b-1e-9&&t>3},n=i.storageUnit,r=ju(i.elementType),s=new(qu(n))(t,this._byteOffset,this._unitCount),a=new Array(this._length),o=0;o=1?1:t*t*(3-2*t)}function Bl(t){return t<=0?0:t>=1?1:t*t*t*(t*(6*t-15)+10)}A._decorator=Hu;var Ml=zl(Zu,$u),Pl=zl(el,il),El=zl(rl,sl),kl=zl(ol,hl),Rl=zl(ll,cl),Ol=zl(dl,_l),Fl=zl(ml,gl),Ll=zl(yl,bl),Vl=zl(xl,wl),Nl=zl(Cl,Al);function zl(t,e){return function(i){return i<.5?e(2*i)/2:t(2*i-1)/2+.5}}var Ul,Gl=Object.freeze({__proto__:null,backIn:xl,backInOut:Tl,backOut:wl,backOutIn:Vl,bounceIn:Cl,bounceInOut:Dl,bounceOut:Al,bounceOutIn:Nl,circIn:ml,circInOut:vl,circOut:gl,circOutIn:Fl,constant:Ju,cubicIn:el,cubicInOut:nl,cubicOut:il,cubicOutIn:Pl,elasticIn:yl,elasticInOut:Sl,elasticOut:bl,elasticOutIn:Ll,expoIn:dl,expoInOut:pl,expoOut:_l,expoOutIn:Ol,fade:Bl,linear:Ku,quadIn:Zu,quadInOut:tl,quadOut:$u,quadOutIn:Ml,quartIn:rl,quartInOut:al,quartOut:sl,quartOutIn:El,quintIn:ol,quintInOut:ul,quintOut:hl,quintOutIn:kl,sineIn:ll,sineInOut:fl,sineOut:cl,sineOutIn:Rl,smooth:Il});t("cG",Gl),t("d3",{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 Hl,Wl=((Ul={})[1]=Ju,Ul[0]=Ku,Ul[2]=Zu,Ul[3]=$u,Ul[4]=tl,Ul[5]=Ml,Ul[6]=el,Ul[7]=il,Ul[8]=nl,Ul[9]=Pl,Ul[10]=rl,Ul[11]=sl,Ul[12]=al,Ul[13]=El,Ul[14]=ol,Ul[15]=hl,Ul[16]=ul,Ul[17]=kl,Ul[18]=ll,Ul[19]=cl,Ul[20]=fl,Ul[21]=Rl,Ul[22]=dl,Ul[23]=_l,Ul[24]=pl,Ul[25]=Ol,Ul[26]=ml,Ul[27]=gl,Ul[28]=vl,Ul[29]=Fl,Ul[30]=yl,Ul[31]=bl,Ul[32]=Sl,Ul[33]=Ll,Ul[34]=xl,Ul[35]=wl,Ul[36]=Tl,Ul[37]=Vl,Ul[38]=Cl,Ul[39]=Al,Ul[40]=Dl,Ul[41]=Nl,Ul[42]=Il,Ul[43]=Bl,Ul);function jl(t){return Wl[t]}k(255),k(65280);var ql,Xl,Yl,Ql=function(t){function e(){var e;return(e=t.call(this)||this).value=0,e.rightTangent=0,e.rightTangentWeight=0,e.leftTangent=0,e.leftTangentWeight=0,e._flags=0,e}return s(e,t),n(e,[{key:"interpolationMode",get:function(){return 255&this._flags},set:function(t){this._flags&=-256,this._flags|=0|t}},{key:"tangentWeightMode",get:function(){return(65280&this._flags)>>8},set:function(t){this._flags&=-65281,this._flags|=t<<8}},{key:"easingMethod",get:function(){return(16711680&this._flags)>>16},set:function(t){this._flags&=-16711681,this._flags|=t<<16}}]),e}(Gu);function Jl(t){var e=new Ql;if("number"==typeof t)e.value=t;else{var i=t.interpolationMode,n=t.tangentWeightMode,r=t.value,s=t.rightTangent,a=t.rightTangentWeight,o=t.leftTangent,h=t.leftTangentWeight,u=t.easingMethod,l=t[lo];e.value=null!=r?r:e.value,e.rightTangent=null!=s?s:e.rightTangent,e.rightTangentWeight=null!=a?a:e.rightTangentWeight,e.leftTangent=null!=o?o:e.leftTangent,e.leftTangentWeight=null!=h?h:e.leftTangentWeight,e.interpolationMode=null!=i?i:e.interpolationMode,e.tangentWeightMode=null!=n?n:e.tangentWeightMode,e.easingMethod=null!=u?u:e.easingMethod,l&&(e[lo]=l)}return e}Vi.fastDefine("cc.RealKeyframeValue",Ql,((Hl={interpolationMode:0,tangentWeightMode:0,value:0,rightTangent:0,rightTangentWeight:0,leftTangent:0,leftTangentWeight:0,easingMethod:0})[lo]=void 0,Hl)),Vi.Attr.setClassAttr(Ql,lo,"editorOnly",!0),(ql=Ql,null!==(Yl=(Xl=ql)[ou])&&void 0!==Yl?Yl:Xl[ou]={}).uniquelyReferenced=!0;var Kl=t("cr",function(t){function e(){var e;return(e=t.call(this)||this).preExtrapolation=1,e.postExtrapolation=1,e}s(e,t);var i=e.prototype;return i.evaluate=function(t){var e=this._times,i=this._values,n=e.length;if(0===n)return 0;var r=e[0],s=e[n-1];if(ts){var h=this.postExtrapolation,u=i[n-1];if(1===h||n<2)return u.value;switch(h){case 0:return wc(s,u.value,e[n-2],i[n-2].value,t);case 2:t=Sc(t,r,s);break;case 3:t=xc(t,r,s);break;default:return u.value}}var l=kh(e,t);if(l>=0)return i[l].value;var c=~l,f=c-1,d=e[f],_=i[f],p=e[c];return Tc(d,_,p,i[c],(t-d)/(p-d))},i.addKeyFrame=function(e,i){return t.prototype.addKeyFrame.call(this,e,Jl(i))},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return Jl(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return Jl(t[1])})))}},i.isConstant=function(t){if(this._values.length<=1)return!0;var e=this._values[0].value;return this._values.every((function(i){return Zi(i.value,e,t)}))},i[Yu]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=i.length,s=new DataView(new ArrayBuffer(0+tc+tc+ec+ic*r+vc*r)),a=0;s.setUint8(a,this.preExtrapolation),a+=tc,s.setUint8(a,this.postExtrapolation),a+=tc,s.setUint32(a,r,!0),a+=ec,i.forEach((function(t,e){return s.setFloat32(a+ic*e,t,!0)})),a+=ic*r;for(var o,h=p(n);!(o=h()).done;){var u=o.value;a=yc(s,u,a)}var l=new Uint8Array(s.buffer,0,a);t.writeProperty("bytes",l);var c=n.map((function(t){return t[lo]}));c.some((function(t){return void 0!==t}))&&t.writeProperty("keyframeValueEditorExtras",c)}else t.writeThis()},i[Qu]=function(t,e){if(e.fromCCON){var i=t.readProperty("bytes"),n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=0;this.preExtrapolation=n.getUint8(r),r+=tc,this.postExtrapolation=n.getUint8(r),r+=tc;var s=n.getUint32(r,!0);r+=ec;var a=Array.from({length:s},(function(t,e){return n.getFloat32(r+ic*e,!0)}));r+=ic*s;for(var o=new Array(s),h=0;h>Zl;return e.easingMethod=s,n}function Sc(t,e,i){return e+dn(t-e,i-e)}function xc(t,e,i){return e+_n(t-e,i-e)}function wc(t,e,i,n,r){return e+(n-e)/(i-t)*(r-t)}function Tc(t,e,i,n,r){var s=i-t;switch(e.interpolationMode){default:case 1:return e.value;case 0:var a=0===e.easingMethod?r:jl(e.easingMethod)(r);return en(e.value,n.value,a);case 2:var o=1/3,h=e.rightTangent,u=e.rightTangentWeight,l=!!(2&e.tangentWeightMode),c=n.leftTangent,f=n.leftTangentWeight,d=!!(1&n.tangentWeightMode);if(l||d){var _=0;if(l)_=u;else{var p=s,m=s*h;_=Math.sqrt(p*p+m*m)*o}var g=Math.atan(h),v=Math.cos(g)*_+t,y=Math.sin(g)*_+e.value,b=0;if(d)b=f;else{var S=s,x=s*c;b=Math.sqrt(S*S+x*x)*o}var w=Math.atan(c),T=(v-t)/s,C=(-Math.cos(w)*b+i-t)/s,A=y,D=-Math.sin(w)*b+n.value,I=[0,0,0],B=Ac(I,Fh(0-r,3*T,3*C-6*T,3*(T-C)+1,I),r);return Cc(e.value,A,D,n.value,B)}var M=e.value+o*h*s,P=n.value-o*c*s;return Cc(e.value,M,P,n.value,r)}}function Cc(t,e,i,n,r){var s=1-r;return s*s*s*t+3*s*s*r*e+3*s*r*r*i+r*r*r*n}function Ac(t,e,i){var n=i;if(1===e)n=t[0];else{n=-1/0;for(var r=0;r=0&&s<=1&&s>n&&(n=s)}n===-1/0&&(n=0)}return n}function Dc(t,e,i,n,r){var s=1-r;return s*(s*(t+(3*e-t)*r)+3*i*r*r)+n*r*r*r}A.bezier=Dc;var Ic,Bc,Mc,Pc,Ec,kc,Rc,Oc,Fc,Lc=Math.cos,Vc=Math.acos,Nc=Math.max,zc=2*Math.PI,Uc=Math.sqrt;function Gc(t){return t<0?-Math.pow(-t,1/3):Math.pow(t,1/3)}function Hc(t,e){var i,n,r,s,a=e-0,o=e-t[0],h=3*a,u=3*o,l=3*(e-t[2]),c=1/(-a+u-l+(e-1)),f=1/3,d=(h-6*o+l)*c,_=d*f,p=(-h+u)*c,m=(3*p-d*d)*f,g=m*f,v=(2*d*d*d-9*d*p+a*c*27)/27,y=v/2,b=y*y+g*g*g;if(b<0){var S=-m*f,x=Uc(S*S*S),w=-v/(2*x),T=Vc(w<-1?-1:w>1?1:w),C=2*Gc(x);return n=C*Lc(T*f)-_,r=C*Lc((T+zc)*f)-_,s=C*Lc((T+2*zc)*f)-_,n>=0&&n<=1?r>=0&&r<=1?s>=0&&s<=1?Nc(n,r,s):Nc(n,r):s>=0&&s<=1?Nc(n,s):n:r>=0&&r<=1?s>=0&&s<=1?Nc(r,s):r:s}if(0===b)return r=-(i=y<0?Gc(-y):-Gc(y))-_,(n=2*i-_)>=0&&n<=1?r>=0&&r<=1?Nc(n,r):n:r;var A=Uc(b);return(i=Gc(-y+A))-Gc(y+A)-_}function Wc(t,e){var i=Hc(t,e),n=t[1];return((1-i)*(n+(t[3]-n)*i)*3+i*i)*i}A.bezierByTime=Wc,t("cw",{SLERP:0,CONSTANT:1});var jc=Qh("cc.QuatKeyframeValue")(Ic=fu((Bc=function(t){var e=void 0===t?{}:t,i=e.value,n=e.interpolationMode,r=e.easingMethod;this.interpolationMode=Mc&&Mc(),this.value=Pc&&Pc(),this.easingMethod=Ec&&Ec(),this.value=i?kr.clone(i):this.value,this.interpolationMode=null!=n?n:this.interpolationMode,this.easingMethod=null!=r?r:this.easingMethod},Mc=Nh(Bc.prototype,"interpolationMode",[hu],(function(){return 0})),Pc=Nh(Bc.prototype,"value",[hu],(function(){return kr.clone(kr.IDENTITY)})),Ec=Nh(Bc.prototype,"easingMethod",[hu],(function(){return 0})),Ic=Bc))||Ic)||Ic;function qc(t){return new jc(t)}var Xc,Yc=t("cv",Qh("cc.QuatCurve")((Rc=function(t){function e(){var e;return(e=t.call(this)||this).preExtrapolation=Oc&&Oc(),e.postExtrapolation=Fc&&Fc(),e}s(e,t);var i=e.prototype;return i.evaluate=function(t,e){var i;null!==(i=e)&&void 0!==i||(e=new kr);var n=this._times,r=this._values,s=this.postExtrapolation,a=this.preExtrapolation,o=n.length;if(0===o)return e;var h=n[0],u=n[o-1];if(tu){var c=r[o-1];switch(s){case 2:t=h+dn(t-h,u-h);break;case 3:t=h+_n(t-h,u-h);break;default:return kr.copy(e,c.value)}}var f=kh(n,t);if(f>=0)return kr.copy(e,r[f].value);var d=~f,_=d-1,p=n[_],m=r[_],g=n[d],v=r[d],y=(t-p)/(g-p);switch(m.interpolationMode){default:case 1:return kr.copy(e,m.value);case 0:var b=m.easingMethod,S=0===b?y:Array.isArray(b)?Wc(b,y):jl(b)(y);return kr.slerp(e,m.value,v.value,S)}},i.addKeyFrame=function(e,i){var n=new jc(i);return t.prototype.addKeyFrame.call(this,e,n)},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return qc(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return qc(t[1])})))}},i[Yu]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=!0;n.forEach((function(t,e,i){var n=i[0];r&&t.interpolationMode!==n.interpolationMode&&(r=!1)}));var s=i.length,a=$c*(r?1:s),o=n.reduce((function(t,e){var i=e.easingMethod;return t+(Array.isArray(i)?tf+4*nf:tf)}),0),h=0,u=new DataView(new ArrayBuffer(h+=Qc+Jc+Kc*s+4*Zc*s+o+a+0)),l=0,c=0;r&&(c|=1),u.setUint32(l,c,!0),l+=Qc,u.setUint32(l,s,!0),l+=Jc,i.forEach((function(t,e){return u.setFloat32(l+Kc*e,t,!0)})),l+=Kc*s,n.forEach((function(t,e){var i=t.value,n=i.x,r=i.y,s=i.z,a=i.w,o=l+4*Zc*e;u.setFloat32(o+0*Zc,n,!0),u.setFloat32(o+1*Zc,r,!0),u.setFloat32(o+2*Zc,s,!0),u.setFloat32(o+3*Zc,a,!0)})),l+=4*Zc*s,n.forEach((function(t){var e=t.easingMethod;Array.isArray(e)?(u.setUint8(l,ef),++l,u.setFloat32(l+0*nf,e[0],!0),u.setFloat32(l+1*nf,e[1],!0),u.setFloat32(l+2*nf,e[2],!0),u.setFloat32(l+3*nf,e[3],!0),l+=4*nf):(u.setUint8(l,e),++l)}));var f=l;l+=a;var d=f;n.forEach((function(t){var e=t.interpolationMode;u.setUint8(d,e),r||(d+=$c)}));var _=new Uint8Array(u.buffer);t.writeProperty("bytes",_)}else t.writeThis()},i[Qu]=function(t,e){if(e.fromCCON){var i=t.readProperty("bytes"),n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=0,s=n.getUint32(r,!0);r+=Qc;var a=1&s,o=n.getUint32(r,!0);r+=Jc;var h=Array.from({length:o},(function(t,e){return n.getFloat32(r+Kc*e,!0)})),u=r+=Kc*o;r+=4*Zc*o;var l=Array.from({length:o},(function(t,e){var i=u+4*Zc*e,s=n.getFloat32(i+0*Zc,!0),a=n.getFloat32(i+1*Zc,!0),o=n.getFloat32(i+2*Zc,!0),h=n.getFloat32(i+3*Zc,!0),l=n.getUint8(r);++r;var c=qc({value:{x:s,y:a,z:o,w:h}});return l!==ef?c.easingMethod=l:(c.easingMethod=[n.getFloat32(r+0*nf,!0),n.getFloat32(r+1*nf,!0),n.getFloat32(r+2*nf,!0),n.getFloat32(r+3*nf,!0)],r+=4*nf),c}));if(a){var c=n.getUint8(r);++r;for(var f=0;f=0)return this._values[e];var i=$i(~e-1,0,this._values.length-1);return this._values[i]},e}(Rh))||Xc),sf={Blend:0,Fixed:1};Ee(sf);var af=t("cy",(function(){this.color=cr.WHITE.clone(),this.time=0}));Vi.fastDefine("cc.ColorKey",af,{color:cr.WHITE.clone(),time:0}),Vi.Attr.setClassAttr(af,"color","visible",!0),Vi.Attr.setClassAttr(af,"time","visible",!0);var of=t("cz",(function(){this.alpha=1,this.time=0}));Vi.fastDefine("cc.AlphaKey",of,{alpha:1,time:0}),Vi.Attr.setClassAttr(of,"alpha","visible",!0),Vi.Attr.setClassAttr(of,"time","visible",!0);var hf=t("cA",function(){function t(){this.colorKeys=[],this.alphaKeys=[],this.mode=0}var e=t.prototype;return e.setKeys=function(t,e){this.colorKeys=t,this.alphaKeys=e},e.sortKeys=function(){this.colorKeys.length>1&&this.colorKeys.sort((function(t,e){return t.time-e.time})),this.alphaKeys.length>1&&this.alphaKeys.sort((function(t,e){return t.time-e.time}))},e.evaluate=function(t){return this.evaluateFast(new cr,t)},e.evaluateFast=function(t,e){return this.getRGB(t,e),t.a=this.getAlpha(e),t},e.randomColor=function(){return this.getRandomColor(new cr)},e.getRandomColor=function(t){var e=this.colorKeys[Math.trunc(sn()*this.colorKeys.length)],i=this.alphaKeys[Math.trunc(sn()*this.alphaKeys.length)];return t.set(e.color),t.a=i.alpha,t},e.getRGB=function(t,e){var i=this.colorKeys,n=i.length;if(n>1){e=dn(e,1+Ji);for(var r=1;r=s&&ei[h].time&&cr.lerp(t,i[h].color,cr.BLACK,(e-i[h].time)/(1-i[h].time))}else 1===n?cr.copy(t,i[0].color):cr.copy(t,cr.WHITE);return t},e.getAlpha=function(t){var e=this.alphaKeys,i=e.length;if(i>1){t=dn(t,1+Ji);for(var n=1;n=r&&te[o].time?en(e[o].alpha,0,(t-e[o].time)/(1-e[o].time)):255}return 1===i?e[0].alpha:255},t}());hf.Mode=sf,Vi.fastDefine("cc.Gradient",hf,{colorKeys:[],alphaKeys:[],mode:0}),Vi.Attr.setClassAttr(hf,"colorKeys","visible",!0),Vi.Attr.setClassAttr(hf,"alphaKeys","visible",!0),Vi.Attr.setClassAttr(hf,"mode","visible",!0);var uf=function(){this.time=0,this.value=0,this.inTangent=0,this.outTangent=0};Vi.fastDefine("cc.Keyframe",uf,{time:0,value:0,inTangent:0,outTangent:0});var lf=function(){function t(){this.index=void 0,this.time=void 0,this.endTime=void 0,this.coefficient=void 0,this.index=-1,this.time=0,this.endTime=0,this.coefficient=new Float32Array(4)}return t.prototype.evaluate=function(t){return cf(t-this.time,this.coefficient)},t}();function cf(t,e){return t*(t*(t*e[0]+e[1])+e[2])+e[3]}var ff=function(){function t(t){if(void 0===t&&(t=null),this._curve=void 0,this.cachedKey=void 0,t instanceof Kl)this._curve=t;else{var e=new Kl;this._curve=e,e.preExtrapolation=2,e.postExtrapolation=1,t?e.assignSorted(t.map((function(t){return[t.time,{interpolationMode:2,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]}))):e.assignSorted([[0,{interpolationMode:2,value:1}],[1,{interpolationMode:2,value:1}]])}this.cachedKey=new lf}var e=t.prototype;return e.addKey=function(t){t?this._curve.addKeyFrame(t.time,{interpolationMode:2,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}):this._curve.clear()},e.evaluate_slow=function(t){return this._curve.evaluate(t)},e.evaluate=function(t){var e=this.cachedKey,i=this._curve,n=i.keyFramesCount-1,r=t,s=t<0?i.preExtrapolation:i.postExtrapolation,a=i.getKeyframeTime(0),o=i.getKeyframeTime(n);switch(s){case 2:r=dn(t-a,o-a)+a;break;case 3:r=_n(t-a,o-a)+a;break;default:r=$i(t,a,o)}if(r>=e.time&&ri.getKeyframeTime(r))for(var s=0;s<3;s++){var a=r+s;if(a+1e)return a}else for(var o=0;o<3;o++){var h=r-o;if(h>=0&&i.getKeyframeTime(h-1)<=e)return h-1}for(var u,l=0,c=n;c-l>1;)u=Math.floor((l+c)/2),i.getKeyframeTime(u)>=e?c=u:l=u;return l},n(t,[{key:"_internalCurve",get:function(){return this._curve}},{key:"keyFrames",get:function(){return Array.from(this._curve.keyframes()).map((function(t){var e=t[0],i=t[1],n=new uf;return n.time=e,n.value=i.value,n.inTangent=i.leftTangent,n.outTangent=i.rightTangent,n}))},set:function(t){this._curve.assignSorted(t.map((function(t){return[t.time,{interpolationMode:2,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]})))}},{key:"preWrapMode",get:function(){return _f(this._curve.preExtrapolation)},set:function(t){this._curve.preExtrapolation=df(t)}},{key:"postWrapMode",get:function(){return _f(this._curve.postExtrapolation)},set:function(t){this._curve.postExtrapolation=df(t)}}]),t}();function df(t){switch(t){default:case 0:case 1:case 8:return 1;case 22:return 3;case 2:return 2}}function _f(t){switch(t){default:case 0:case 1:return 8;case 3:return 22;case 2:return 2}}function pf(){var t=new Kl;return t.assignSorted([[0,{interpolationMode:2,value:1}],[1,{interpolationMode:2,value:1}]]),t}ff.defaultKF=[{time:0,value:1,inTangent:0,outTangent:0},{time:1,value:1,inTangent:0,outTangent:0}],Vi.fastDefine("cc.AnimationCurve",ff,{_curve:null});var mf=ir.multiplyScalar,gf=ir.add,vf=4294967295,yf=nr(),bf=nr(),Sf=nr(),xf=nr(),wf=function(){function t(t,e){void 0===t&&(t=2),void 0===e&&(e=[]),this._type=void 0,this._knots=[],this._type=1024,this._mode=t;for(var i=0;i=this._knots.length?this._knots.push(i):this._knots.splice(t,0,i)},e.removeKnot=function(t){Me(this._knots,t),this._knots.splice(t,1)},e.setKnot=function(t,e){Me(this._knots,t),this._knots[t].set(e)},e.getKnot=function(t){return Me(this._knots,t),this._knots[t]},e.getPoint=function(e,i){void 0===i&&(i=vf),e=$i(e,0,1);var n=this.getSegments();if(0===n)return nr();if(i===vf){var r=1/n;i=Math.floor(e/r),e=e%r/r}var s=this._knots;if(i>=n)return nr(s[s.length-1]);switch(this._mode){case 0:return t.calcLinear(s[i],s[i+1],e);case 1:var a=4*i;return t.calcBezier(s[a],s[a+1],s[a+2],s[a+3],e);case 2:var o=i>0?s[i-1]:s[i],h=i+2e.priority?-1:0};var e=t.prototype;return e.init=function(){},e.update=function(){},e.postUpdate=function(){},e.destroy=function(){},n(t,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"id",get:function(){return this._id},set:function(t){this._id=t}}]),t}());Of.Priority=Ee({LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:2147483648});var Ff=new Bt("Scheduler"),Lf=function(){function t(t,e,i,n){this.target=void 0,this.priority=void 0,this.paused=void 0,this.markedForDeletion=void 0,this.target=t,this.priority=e,this.paused=i,this.markedForDeletion=n}return t.get=function(e,i,n,r){var s=t._listEntries.pop();return s?(s.target=e,s.priority=i,s.paused=n,s.markedForDeletion=r):s=new t(e,i,n,r),s},t.put=function(e){t._listEntries.length<20&&(e.target=null,t._listEntries.push(e))},t}();Lf._listEntries=[];var Vf=function(){function t(t,e,i,n){this.list=void 0,this.entry=void 0,this.target=void 0,this.callback=void 0,this.list=t,this.entry=e,this.target=i,this.callback=n}return t.get=function(e,i,n,r){var s=t._hashUpdateEntries.pop();return s?(s.list=e,s.entry=i,s.target=n,s.callback=r):s=new t(e,i,n,r),s},t.put=function(e){t._hashUpdateEntries.length<20&&(e.list=e.entry=e.target=e.callback=null,t._hashUpdateEntries.push(e))},t}();Vf._hashUpdateEntries=[];var Nf=function(){function t(t,e,i,n,r,s){this.timers=void 0,this.target=void 0,this.timerIndex=void 0,this.currentTimer=void 0,this.currentTimerSalvaged=void 0,this.paused=void 0,this.timers=t,this.target=e,this.timerIndex=i,this.currentTimer=n,this.currentTimerSalvaged=r,this.paused=s}return t.get=function(e,i,n,r,s,a){var o=t._hashTimerEntries.pop();return o?(o.timers=e,o.target=i,o.timerIndex=n,o.currentTimer=r,o.currentTimerSalvaged=s,o.paused=a):o=new t(e,i,n,r,s,a),o},t.put=function(e){t._hashTimerEntries.length<20&&(e.timers=e.target=e.currentTimer=null,t._hashTimerEntries.push(e))},t}();Nf._hashTimerEntries=[];var zf=function(){function t(){this._lock=void 0,this._scheduler=void 0,this._elapsed=void 0,this._runForever=void 0,this._useDelay=void 0,this._timesExecuted=void 0,this._repeat=void 0,this._delay=void 0,this._interval=void 0,this._target=void 0,this._callback=void 0,this._lock=!1,this._scheduler=null,this._elapsed=-1,this._runForever=!1,this._useDelay=!1,this._timesExecuted=0,this._repeat=0,this._delay=0,this._interval=0,this._target=null}t.get=function(){return t._timers.pop()||new t},t.put=function(e){t._timers.length<20&&!e._lock&&(e._scheduler=e._target=e._callback=null,t._timers.push(e))};var e=t.prototype;return e.initWithCallback=function(t,e,i,n,r,s){return this._lock=!1,this._scheduler=t,this._target=i,this._callback=e,this._timesExecuted=0,this._elapsed=-1,this._interval=n,this._delay=s,this._useDelay=this._delay>0,this._repeat=r,this._runForever=this._repeat===A.macro.REPEAT_FOREVER,!0},e.getInterval=function(){return this._interval},e.setInterval=function(t){this._interval=t},e.update=function(t){-1===this._elapsed?(this._elapsed=0,this._timesExecuted=0):(this._elapsed+=t,this._runForever&&!this._useDelay?this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0):(this._useDelay?this._elapsed>=this._delay&&(this.trigger(),this._elapsed-=this._delay,this._timesExecuted+=1,this._useDelay=!1):this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0,this._timesExecuted+=1),this._callback&&!this._runForever&&this._timesExecuted>this._repeat&&this.cancel()))},e.getCallback=function(){return this._callback},e.trigger=function(){this._target&&this._callback&&(this._lock=!0,this._callback.call(this._target,this._elapsed),this._lock=!1)},e.cancel=function(){this._scheduler&&this._callback&&this._target&&this._scheduler.unscheduleForTimer(this,this._target)},t}();zf._timers=[];var Uf=t("cq",function(t){function e(){var e;return(e=t.call(this)||this)._timeScale=void 0,e._updatesNegList=void 0,e._updates0List=void 0,e._updatesPosList=void 0,e._hashForUpdates=void 0,e._hashForTimers=void 0,e._currentTarget=void 0,e._currentTargetSalvaged=void 0,e._updateHashLocked=void 0,e._arrayForTimers=void 0,e._timeScale=1,e._updatesNegList=[],e._updates0List=[],e._updatesPosList=[],e._hashForUpdates=Gt(!0),e._hashForTimers=Gt(!0),e._currentTarget=null,e._currentTargetSalvaged=!1,e._updateHashLocked=!1,e._arrayForTimers=[],e}s(e,t),e.enableForTarget=function(t){var e=!1;(t.uuid||t.id)&&(e=!0),e||(t.id=Ff.getNewId())};var i=e.prototype;return i.setTimeScale=function(t){this._timeScale=t},i.getTimeScale=function(){return this._timeScale},i.update=function(t){var e,i,n,r,s;for(this._updateHashLocked=!0,1!==this._timeScale&&(t*=this._timeScale),e=0,n=(i=this._updatesNegList).length;e=s&&n.timerIndex--,void(0===r.length&&(this._currentTarget===n?this._currentTargetSalvaged=!0:this._removeHashElement(n)))}}}else ht(1510)}},i.unscheduleForTimer=function(t,e){var i=e.uuid||e.id,n=this._hashForTimers[i],r=n.timers;if(r&&0!==r.length)for(var s=r.length-1;s>=0;s--){var a=r[s];if(a===t)return r.splice(s,1),zf.put(a),n.timerIndex>=s&&n.timerIndex--,void(0===r.length&&(this._currentTargetSalvaged=!0))}},i.unscheduleUpdate=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForUpdates[e];null!=i&&i.entry&&(this._updateHashLocked?i.entry.markedForDeletion=!0:this._removeUpdateFromHash(i.entry))}else ht(1510)}},i.unscheduleAllForTarget=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForTimers[e];if(null!=i&&i.timers){var n=i.timers;i.currentTimer&&n.indexOf(i.currentTimer)>-1&&!i.currentTimerSalvaged&&(i.currentTimerSalvaged=!0);for(var r=0,s=n.length;r=0;e--)(i=r[e]).target&&this.unscheduleAllForTarget(i.target);var s=0;if(t<0)for(e=0;e=t&&this.unscheduleUpdate(n.target),s===this._updatesNegList.length&&e++}if(t<=0)for(e=0;e=t&&this.unscheduleUpdate(n.target),s===this._updatesPosList.length&&e++}},i.isScheduled=function(t,e){lt(Boolean(t),1508),lt(Boolean(e),1509);var i=e.uuid||e.id;if(!i)return ht(1510),!1;var n=this._hashForTimers[i];if(!n)return!1;if(null==n.timers)return!1;for(var r=n.timers,s=0;s=t&&(r.paused=!0,s.push(r.target))}if(t<=0)for(i=0;i=t&&(r.paused=!0,s.push(r.target))}return s},i.resumeTargets=function(t){if(t)for(var e=0;e=4;){var a=255&s.call(t,r)|(255&s.call(t,++r))<<8|(255&s.call(t,++r))<<16|(255&s.call(t,++r))<<24;a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),i-=4,++r}switch(i){case 3:n^=(255&s.call(t,r+2))<<16;case 2:n^=(255&s.call(t,r+1))<<8;case 1:n=1540483477*(65535&(n^=255&s.call(t,r)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}function qf(t,e,i){if(Me(t,e),Me(t,i),e===i)return t;var n=t[e];if(e0&&!(t&t-1)}var sp=Math.ceil;function ap(t,e,i,n){if(!ep[t].isCompressed)return e*i*n*ep[t].size;switch(t){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 sp(e/4)*sp(i/4)*8*n;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 sp(e/4)*sp(i/4)*16*n;case 66:case 67:return sp(e/4)*sp(i/4)*32*n;case 83:case 84:case 87:return sp(e/8)*sp(i/4)*8*n;case 90:case 104:return sp(e/5)*sp(i/4)*16*n;case 91:case 105:return sp(e/5)*sp(i/5)*16*n;case 92:case 106:return sp(e/6)*sp(i/5)*16*n;case 93:case 107:return sp(e/6)*sp(i/6)*16*n;case 94:case 108:return sp(e/8)*sp(i/5)*16*n;case 95:case 109:return sp(e/8)*sp(i/6)*16*n;case 96:case 110:return sp(e/8)*sp(i/8)*16*n;case 97:case 111:return sp(e/10)*sp(i/5)*16*n;case 98:case 112:return sp(e/10)*sp(i/6)*16*n;case 99:case 113:return sp(e/10)*sp(i/8)*16*n;case 100:case 114:return sp(e/10)*sp(i/10)*16*n;case 101:case 115:return sp(e/12)*sp(i/10)*16*n;case 102:case 116:return sp(e/12)*sp(i/12)*16*n;default:return 0}}function op(t,e,i,n,r){for(var s=0,a=0;a>1,1),i=Math.max(i>>1,1);return s}var hp=[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 up(t){return hp[t]||0}function lp(t){if(t.isCompressed)return Uint8Array;var e=t.size/t.count;switch(t.type){case 1:case 3:switch(e){case 1:default:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array}case 2:case 4:switch(e){case 1:default:return Int8Array;case 2:return Int16Array;case 4:return Int32Array}case 6:return 2===e?Uint16Array:Float32Array}return Float32Array}function cp(t){switch(t){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 fp(t,e){return sp(t/e)*e}var dp=Object.freeze({__proto__:null,API:ed,AccessFlagBit:Bd,Address:bd,Attribute:C_,AttributeName:K_,BarrierType:Hd,BindingMappingInfo:s_,BlendFactor:wd,BlendOp:Td,BufferBarrierInfo:F_,BufferFlagBit:ud,BufferInfo:h_,BufferTextureCopy:e_,BufferUsageBit:hd,BufferViewInfo:u_,ClearFlagBit:Gd,Color:n_,ColorAttachment:I_,ColorMask:Cd,CommandBufferInfo:H_,CommandBufferType:Ud,ComparisonFunc:Sd,CullMode:Od,DESCRIPTOR_BUFFER_TYPE:ip,DESCRIPTOR_DYNAMIC_TYPE:10,DESCRIPTOR_SAMPLER_TYPE:np,DESCRIPTOR_STORAGE_BUFFER_TYPE:12,DRAW_INFO_SIZE:28,DepthStencilAttachment:B_,DescriptorSetInfo:z_,DescriptorSetLayoutBinding:V_,DescriptorSetLayoutInfo:N_,DescriptorType:Vd,DeviceCaps:qd,DeviceInfo:o_,DeviceOptions:Xd,DispatchInfo:c_,DrawInfo:l_,DynamicStateFlagBit:Fd,DynamicStates:Q_,DynamicStencilStates:Y_,Extent:Jd,Feature:nd,Filter:yd,Format:rd,FormatFeatureBit:md,FormatInfo:q_,FormatInfos:ep,FormatSize:ap,FormatSurfaceSize:op,FormatType:sd,FramebufferInfo:L_,GFXObject:J_,GeneralBarrierInfo:R_,GetTypeSize:up,IndirectBuffer:f_,InputAssemblerInfo:D_,InputState:G_,IsPowerOf2:rp,LoadOp:Dd,MarkerInfo:r_,MemoryAccessBit:ld,MemoryStatus:X_,MemoryUsageBit:cd,ObjectType:$f,Offset:Yd,PassType:Wd,PipelineBindPoint:Pd,PipelineLayoutInfo:U_,PolygonMode:kd,PrimitiveMode:Ed,QueryPoolInfo:j_,QueryType:zd,QueueInfo:W_,QueueType:Nd,Rect:Qd,RenderPassInfo:E_,ResolveMode:Md,ResourceRange:k_,SampleCount:gd,SampleType:ad,SamplerInfo:p_,ShadeModel:Rd,ShaderInfo:A_,ShaderStage:T_,ShaderStageFlagBit:Ad,Size:jd,Status:td,StencilFace:Ld,StencilOp:xd,StoreOp:Id,SubpassDependency:P_,SubpassInfo:M_,SurfaceTransform:id,SwapchainInfo:a_,TextureBarrierInfo:O_,TextureBlit:t_,TextureCopy:$d,TextureFlagBit:pd,TextureInfo:d_,TextureSubresLayers:Kd,TextureSubresRange:Zd,TextureType:fd,TextureUsageBit:_d,TextureViewInfo:__,Type:od,Uniform:m_,UniformBlock:g_,UniformInputAttachment:w_,UniformSampler:y_,UniformSamplerTexture:v_,UniformStorageBuffer:x_,UniformStorageImage:S_,UniformTexture:b_,ViewDimension:dd,Viewport:i_,VsyncMode:vd,alignTo:fp,formatAlignment:cp,getTypedArrayConstructor:lp}),_p=function(t){function e(){var e;return(e=t.call(this,2)||this)._usage=0,e._memUsage=0,e._size=0,e._stride=1,e._count=0,e._flags=0,e._isBufferView=!1,e}return s(e,t),n(e,[{key:"usage",get:function(){return this._usage}},{key:"memUsage",get:function(){return this._memUsage}},{key:"size",get:function(){return this._size}},{key:"stride",get:function(){return this._stride}},{key:"count",get:function(){return this._count}},{key:"flags",get:function(){return this._flags}}]),e}(J_),pp=function(t){function e(){var e;return(e=t.call(this,13)||this)._queue=null,e._type=0,e._numDrawCalls=0,e._numInstances=0,e._numTris=0,e}return s(e,t),n(e,[{key:"type",get:function(){return this._type}},{key:"queue",get:function(){return this._queue}},{key:"numDrawCalls",get:function(){return this._numDrawCalls}},{key:"numInstances",get:function(){return this._numInstances}},{key:"numTris",get:function(){return this._numTris}}]),e}(J_),mp=function(){function t(){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 X_,this._caps=new qd,this._bindingMappingInfo=new s_,this._samplers=new Map,this._generalBarrierss=new Map,this._textureBarriers=new Map,this._bufferBarriers=new Map,this._swapchainFormat=35}var e=t.prototype;return e.hasFeature=function(t){return this._features[t]},e.getFormatFeatures=function(t){return this._formatFeatures[t]},e.enableAutoBarrier=function(){},e.getMaxSampleCount=function(){return 1},n(t,[{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}}]),t}();mp.canvas=void 0;var gp=function(){function t(t){this._texture2D=null,this._texture3D=null,this._textureCube=null,this._texture2DArray=null;var e=t.capabilities,i=new Uint8Array(64);if(i.fill(255),e.maxTextureSize>=2){this._texture2D=t.createTexture(new d_(1,12,35,2,2,0));var n=new e_(0,0,0,new Yd(0,0,0),new Jd(2,2,1));t.copyBuffersToTexture([i],this._texture2D,[n])}if(e.maxTextureSize>=2){this._textureCube=t.createTexture(new d_(3,12,35,2,2,0,6));var r=new e_(0,0,0,new Yd(0,0,0),new Jd(2,2,1));t.copyBuffersToTexture([i],this._textureCube,[r]),r.texSubres.baseArrayLayer=1,t.copyBuffersToTexture([i],this._textureCube,[r]),r.texSubres.baseArrayLayer=2,t.copyBuffersToTexture([i],this._textureCube,[r]),r.texSubres.baseArrayLayer=3,t.copyBuffersToTexture([i],this._textureCube,[r]),r.texSubres.baseArrayLayer=4,t.copyBuffersToTexture([i],this._textureCube,[r]),r.texSubres.baseArrayLayer=5,t.copyBuffersToTexture([i],this._textureCube,[r])}if(e.max3DTextureSize>=2){this._texture3D=t.createTexture(new d_(2,12,35,2,2,0,1,1,1,2));var s=new e_(0,0,0,new Yd(0,0,0),new Jd(2,2,2),new Kd(0,0,1));t.copyBuffersToTexture([i],this._texture3D,[s])}if(e.maxArrayTextureLayers>=2){this._texture2DArray=t.createTexture(new d_(5,12,35,2,2,0,2));var a=new e_(0,0,0,new Yd(0,0,0),new Jd(2,2,1),new Kd(0,0,1));t.copyBuffersToTexture([i],this._texture2DArray,[a]),a.texSubres.baseArrayLayer=1,t.copyBuffersToTexture([i],this._texture2DArray,[a])}}return t.prototype.getTexture=function(t){switch(t){case 1:return this._texture2D;case 2:return this._texture3D;case 3:return this._textureCube;case 5:return this._texture2DArray;default:return null}},t}(),vp=function(t){function e(){var e;return(e=t.call(this,1)||this)._transform=0,e._colorTexture=null,e._depthStencilTexture=null,e}return s(e,t),n(e,[{key:"colorTexture",get:function(){return this._colorTexture}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}},{key:"surfaceTransform",get:function(){return this._transform}},{key:"width",get:function(){return this._colorTexture.width}},{key:"height",get:function(){return this._colorTexture.height}}]),e}(J_),yp=function(t){function e(){var e;return(e=t.call(this,5)||this)._renderPass=null,e._colorTextures=[],e._depthStencilTexture=null,e._width=0,e._height=0,e}return s(e,t),n(e,[{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 t,e;return this.colorTextures.length>0?null!==(t=null==(e=this.colorTextures[0])?void 0:e.width)&&void 0!==t?t:this._width:this.depthStencilTexture?this.depthStencilTexture.width:this._width}},{key:"height",get:function(){var t,e;return this.colorTextures.length>0?null!==(t=null==(e=this.colorTextures[0])?void 0:e.height)&&void 0!==t?t:this._height:this.depthStencilTexture?this.depthStencilTexture.height:this._height}},{key:"needRebuild",get:function(){return!1}}]),e}(J_),bp=function(t){function e(){var e;return(e=t.call(this,12)||this)._attributes=[],e._attributesHash=0,e._vertexBuffers=[],e._indexBuffer=null,e._indirectBuffer=null,e._drawInfo=new l_,e}s(e,t);var i=e.prototype;return i.getVertexBuffer=function(t){return void 0===t&&(t=0),t=0){var o=this._colorInfos[i.depthStencil];t+="ds,"+o.format+","+o.sampleCount}}else{t+="ca";for(var h=0;h>2&3,e.mipFilter=t>>4&3,e.addressU=t>>6&3,e.addressV=t>>8&3,e.addressW=t>>10&3,e.maxAnisotropy=t>>12&31,e.cmpFunc=t>>17&7,e},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(J_),kp=function(t){function e(){var e;return(e=t.call(this,7)||this)._name="",e._stages=[],e._attributes=[],e._blocks=[],e._samplers=[],e}return s(e,t),n(e,[{key:"name",get:function(){return this._name}},{key:"attributes",get:function(){return this._attributes}},{key:"blocks",get:function(){return this._blocks}},{key:"samplers",get:function(){return this._samplers}},{key:"stages",get:function(){return this._stages}}]),e}(J_),Rp=function(t){function e(){var e;return(e=t.call(this,3)||this)._info=new d_,e._viewInfo=new __,e._isPowerOf2=!1,e._isTextureView=!1,e._size=0,e}return s(e,t),e.getLevelCount=function(t,e){return Math.floor(Math.log2(Math.max(t,e)))},n(e,[{key:"type",get:function(){return this._info.type}},{key:"usage",get:function(){return this._info.usage}},{key:"format",get:function(){return this._info.format}},{key:"width",get:function(){return this._info.width}},{key:"height",get:function(){return this._info.height}},{key:"depth",get:function(){return this._info.depth}},{key:"layerCount",get:function(){return this._info.layerCount}},{key:"levelCount",get:function(){return this._info.levelCount}},{key:"samples",get:function(){return this._info.samples}},{key:"flags",get:function(){return this._info.flags}},{key:"size",get:function(){return this._size}},{key:"info",get:function(){return this._info}},{key:"viewInfo",get:function(){return this._viewInfo}},{key:"isTextureView",get:function(){return this._isTextureView}}]),e}(J_),Op=function(t){function e(e,i){var n;return(n=t.call(this,16)||this)._info=new R_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){return jf(t.prevAccesses+" "+t.nextAccesses+" "+t.type,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(J_),Fp=function(t){function e(e,i){var n;return(n=t.call(this,17)||this)._info=new O_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){var e=t.prevAccesses+" "+t.nextAccesses;return e+=t.type,e+=t.range.mipLevel,e+=t.range.levelCount,e+=t.range.firstSlice,e+=t.range.numSlices,e+=t.range.basePlane,e+=t.range.planeCount,e+=t.discardContents,e+=t.srcQueue?t.srcQueue.type:0,jf(e+=t.dstQueue?t.dstQueue.type:0,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(J_),Lp=function(t){function e(e,i){var n;return(n=t.call(this,18)||this)._info=new F_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){var e=t.prevAccesses+" "+t.nextAccesses;return e+=t.type,e+=t.offset,e+=t.size,e+=t.discardContents,e+=t.srcQueue?t.srcQueue.type:0,jf(e+=t.dstQueue?t.dstQueue.type:0,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(J_),Vp={Device:mp,Swapchain:vp,Buffer:_p,Texture:Rp,Sampler:Ep,Shader:kp,InputAssembler:bp,RenderPass:Pp,Framebuffer:yp,DescriptorSet:Sp,DescriptorSetLayout:xp,PipelineLayout:wp,PipelineState:Bp,CommandBuffer:pp,Queue:Mp,GeneralBarrier:Op,TextureBarrier:Fp,BufferBarrier:Lp,RasterizerState:Tp,BlendState:Dp,BlendTarget:Ap,DepthStencilState:Cp,PipelineStateInfo:Ip};Object.assign(Vp,dp),C.gfx=Vp;var Np={GFXDevice:!0,GFXBuffer:!0,GFXTexture:!0,GFXSampler:!0,GFXShader:!0,GFXInputAssembler:!0,GFXRenderPass:!0,GFXFramebuffer:!0,GFXPipelineState:!0,GFXCommandBuffer:!0,GFXQueue:!0,GFXObjectType:!0,GFXObject:!1,GFXAttributeName:!0,GFXType:!0,GFXFormat:!0,GFXBufferUsageBit:!0,GFXMemoryUsageBit:!0,GFXBufferFlagBit:!0,GFXBufferAccessBit:"MemoryAccessBit",GFXPrimitiveMode:!0,GFXPolygonMode:!0,GFXShadeModel:!0,GFXCullMode:!0,GFXComparisonFunc:!0,GFXStencilOp:!0,GFXBlendOp:!0,GFXBlendFactor:!0,GFXColorMask:!0,GFXFilter:!0,GFXAddress:!0,GFXTextureType:!0,GFXTextureUsageBit:!0,GFXSampleCount:!0,GFXTextureFlagBit:!0,GFXShaderStageFlagBit:!0,GFXDescriptorType:!0,GFXCommandBufferType:!0,GFXLoadOp:!0,GFXStoreOp:!0,GFXPipelineBindPoint:!0,GFXDynamicStateFlagBit:!0,GFXStencilFace:!0,GFXQueueType:!0,GFXRect:!0,GFXViewport:!0,GFXColor:!0,GFXClearFlag:!0,GFXOffset:!0,GFXExtent:!0,GFXTextureSubres:"TextureSubresLayers",GFXTextureCopy:!0,GFXBufferTextureCopy:!0,GFXFormatType:!0,GFXFormatInfo:!0,GFXMemoryStatus:!0,GFXFormatInfos:!0,GFXFormatSize:!0,GFXFormatSurfaceSize:!0,GFXGetTypeSize:!0,getTypedArrayConstructor:!1};for(var zp in Np){var Up=Np[zp];!0===Up?Up=zp.slice(3):!1===Up&&(Up=zp),pt(C,"cc",[{name:zp,newName:Up,target:C.gfx,targetName:"cc.gfx"}])}mt(C,"cc",[{name:"GFX_MAX_VERTEX_ATTRIBUTES"},{name:"GFX_MAX_TEXTURE_UNITS"},{name:"GFX_MAX_ATTACHMENTS"},{name:"GFX_MAX_BUFFER_BINDINGS"},{name:"GFXTextureLayout"}]),mt(nd,"Feature",[{name:"COLOR_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R32F) & FormatFeatureBit.RENDER_TARGET;"},{name:"COLOR_HALF_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R16F) & FormatFeatureBit.RENDER_TARGET;"},{name:"TEXTURE_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = (device.getFormatFeatures(Format.R32F) & (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE)) === (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE);"},{name:"TEXTURE_HALF_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = (device.getFormatFeatures(Format.R16F) & (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE)) === (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE);"},{name:"TEXTURE_FLOAT_LINEAR",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R32F) & FormatFeatureBit.LINEAR_FILTER;"},{name:"TEXTURE_HALF_FLOAT_LINEAR",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R16F) & FormatFeatureBit.LINEAR_FILTER;"},{name:"FORMAT_R11G11B10F",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R11G11B10F) !== FormatFeatureBit.NONE;"},{name:"FORMAT_SRGB",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.SRGB8) !== FormatFeatureBit.NONE;"},{name:"FORMAT_ETC1",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.ETC_RGB8) !== FormatFeatureBit.NONE;"},{name:"FORMAT_ETC2",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.ETC2_RGB8) !== FormatFeatureBit.NONE;"},{name:"FORMAT_DXT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.BC1) !== FormatFeatureBit.NONE;"},{name:"FORMAT_PVRTC",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.PVRTC_RGB2) !== FormatFeatureBit.NONE;"},{name:"FORMAT_ASTC",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.ASTC_RGBA_4x4) !== FormatFeatureBit.NONE;"},{name:"FORMAT_RGB8",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.RGB8) !== FormatFeatureBit.NONE;"}]),mt(I_.prototype,"ColorAttachment",[{name:"beginAccesses",suggest:"Please assign to ColorAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to ColorAttachment.barrier instead"}]),mt(B_.prototype,"DepthStencilAttachment",[{name:"beginAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"}]),pt(mp.prototype,"Device",[{name:"getGlobalBarrier",newName:"getGeneralBarrier"}]);var Gp=function(){function t(){this.initialized=!1,this._gfxDevice=void 0,this._canvas=null,this._swapchain=void 0,this._renderType=-1,this._deviceInitialized=!1}var e=t.prototype;return e._tryInitializeWebGPUDevice=function(t,e){var i=this;return this._deviceInitialized?Promise.resolve(!0):t?(this._gfxDevice=new t,new Promise((function(t,n){i._gfxDevice.initialize(e).then((function(e){i._deviceInitialized=e,t(e)})).catch((function(t){n(t)}))}))):Promise.resolve(!1)},e._tryInitializeDeviceSync=function(t,e){return!!this._deviceInitialized||(t&&(this._gfxDevice=new t,this._deviceInitialized=this._gfxDevice.initialize(e)),this._deviceInitialized)},e.init=function(t,e){var i=this;if(this.initialized)return!0;var n=ze.querySettings(Ve.Category.RENDERING,"renderMode");this._canvas=t,this._canvas&&(this._canvas.oncontextmenu=function(){return!1}),this._renderType=this._determineRenderType(n),this._deviceInitialized=!1;var r=new o_(e);if(1===this._renderType||2===this._renderType){var s=!!globalThis.WebGL2RenderingContext;if(globalThis.navigator.userAgent.toLowerCase(),oh.browserType===Bo.UC&&(s=!1),mp.canvas=t,2===this._renderType&&C.WebGPUDevice)return new Promise((function(t,e){i._tryInitializeWebGPUDevice(C.WebGPUDevice,r).then((function(e){i._initSwapchain(),t(e)})).catch((function(t){e(t)}))}));s&&C.WebGL2Device&&this._tryInitializeDeviceSync(C.WebGL2Device,r),C.WebGLDevice&&this._tryInitializeDeviceSync(C.WebGLDevice,r),C.EmptyDevice&&this._tryInitializeDeviceSync(C.EmptyDevice,r),this._initSwapchain()}else 4===this._renderType&&C.EmptyDevice&&(this._tryInitializeDeviceSync(C.EmptyDevice,r),this._initSwapchain());return!!this._gfxDevice||(ht(16337),this._renderType=-1,!1)},e._initSwapchain=function(){var t=new a_(1,this._canvas),e=ah.windowSize;t.width=e.width,t.height=e.height,this._swapchain=this._gfxDevice.createSwapchain(t)},e._supportWebGPU=function(){return"gpu"in globalThis.navigator},e._determineRenderType=function(t){("number"!=typeof t||t>4||t<0)&&(t=0);var e=0,i=!1;if(1===t?(e=0,i=!0):0===t||4===t?(e=this._supportWebGPU()?2:1,i=!0):2===t?(e=1,i=!0):3===t&&(e=4,i=!0),!i)throw new Error(ft(3820,t));return e},n(t,[{key:"gfxDevice",get:function(){return this._gfxDevice}},{key:"swapchain",get:function(){return this._swapchain}}]),t}(),Hp=new Gp;t("aH",Object.freeze({__proto__:null,API:ed,AccessFlagBit:Bd,Address:bd,Attribute:C_,AttributeName:K_,BarrierType:Hd,BindingMappingInfo:s_,BlendFactor:wd,BlendOp:Td,BlendState:Dp,BlendTarget:Ap,Buffer:_p,BufferBarrierInfo:F_,BufferFlagBit:ud,BufferInfo:h_,BufferTextureCopy:e_,BufferUsageBit:hd,BufferViewInfo:u_,ClearFlagBit:Gd,Color:n_,ColorAttachment:I_,ColorMask:Cd,CommandBuffer:pp,CommandBufferInfo:H_,CommandBufferType:Ud,ComparisonFunc:Sd,CullMode:Od,DESCRIPTOR_BUFFER_TYPE:ip,DESCRIPTOR_DYNAMIC_TYPE:10,DESCRIPTOR_SAMPLER_TYPE:np,DESCRIPTOR_STORAGE_BUFFER_TYPE:12,DRAW_INFO_SIZE:28,DefaultResource:gp,DepthStencilAttachment:B_,DepthStencilState:Cp,DescriptorSet:Sp,DescriptorSetInfo:z_,DescriptorSetLayout:xp,DescriptorSetLayoutBinding:V_,DescriptorSetLayoutInfo:N_,DescriptorType:Vd,Device:mp,DeviceCaps:qd,DeviceInfo:o_,DeviceManager:Gp,DeviceOptions:Xd,DispatchInfo:c_,DrawInfo:l_,DynamicStateFlagBit:Fd,DynamicStates:Q_,DynamicStencilStates:Y_,Extent:Jd,Feature:nd,Filter:yd,Format:rd,FormatFeatureBit:md,FormatInfo:q_,FormatInfos:ep,FormatSize:ap,FormatSurfaceSize:op,FormatType:sd,Framebuffer:yp,FramebufferInfo:L_,GFXObject:J_,GeneralBarrier:Op,GeneralBarrierInfo:R_,GetTypeSize:up,IndirectBuffer:f_,InputAssembler:bp,InputAssemblerInfo:D_,InputState:G_,IsPowerOf2:rp,LegacyRenderMode:{AUTO:0,CANVAS:1,WEBGL:2,HEADLESS:3,WEBGPU:4},LoadOp:Dd,MarkerInfo:r_,MemoryAccessBit:ld,MemoryStatus:X_,MemoryUsageBit:cd,ObjectType:$f,Offset:Yd,PassType:Wd,PipelineBindPoint:Pd,PipelineLayout:wp,PipelineLayoutInfo:U_,PipelineState:Bp,PipelineStateInfo:Ip,PolygonMode:kd,PrimitiveMode:Ed,QueryPoolInfo:j_,QueryType:zd,Queue:Mp,QueueInfo:W_,QueueType:Nd,RasterizerState:Tp,Rect:Qd,RenderPass:Pp,RenderPassInfo:E_,RenderType:{UNKNOWN:-1,CANVAS:0,WEBGL:1,WEBGPU:2,OPENGL:3,HEADLESS:4},ResolveMode:Md,ResourceRange:k_,SampleCount:gd,SampleType:ad,Sampler:Ep,SamplerInfo:p_,ShadeModel:Rd,Shader:kp,ShaderInfo:A_,ShaderStage:T_,ShaderStageFlagBit:Ad,Size:jd,Status:td,StencilFace:Ld,StencilOp:xd,StoreOp:Id,SubpassDependency:P_,SubpassInfo:M_,SurfaceTransform:id,Swapchain:vp,SwapchainInfo:a_,Texture:Rp,TextureBarrier:Fp,TextureBarrierInfo:O_,TextureBlit:t_,TextureCopy:$d,TextureFlagBit:pd,TextureInfo:d_,TextureSubresLayers:Kd,TextureSubresRange:Zd,TextureType:fd,TextureUsageBit:_d,TextureViewInfo:__,Type:od,Uniform:m_,UniformBlock:g_,UniformInputAttachment:w_,UniformSampler:y_,UniformSamplerTexture:v_,UniformStorageBuffer:x_,UniformStorageImage:S_,UniformTexture:b_,ViewDimension:dd,Viewport:i_,VsyncMode:vd,alignTo:fp,deviceManager:Hp,formatAlignment:cp,getTypedArrayConstructor:lp}));var Wp=new Vn;function jp(t,e,i,n){var r=i.chunk,s=i.data,a=r.vb,o=i.vertexCount,h=t.worldMatrix,u=h.m00,l=h.m01,c=h.m02,f=h.m03,d=h.m04,_=h.m05,p=h.m06,m=h.m07,g=h.m12,v=h.m13,y=h.m14,b=h.m15;Wp.set(n.r/255,n.g/255,n.b/255,n.a/255);for(var S=0,x=0;x>>0;else if(n.size/n.count==4)for(var c=o+3;c>2}}var Xp=function(){function t(t){this._map=null,this._count=0,t?(this._map=t,this._count=Object.keys(t).length):(this._map=Gt(!0),this._count=0)}var e=t.prototype;return e.add=function(t,e){return t in this._map||this._count++,this._map[t]=e},e.get=function(t){return this._map[t]},e.has=function(t){return t in this._map},e.remove=function(t){var e=this._map[t];return t in this._map&&(delete this._map[t],this._count--),e},e.clear=function(){0!==this._count&&(this._map=Gt(!0),this._count=0)},e.forEach=function(t){for(var e in this._map)t(this._map[e],e)},e.find=function(t){for(var e in this._map)if(t(this._map[e],e))return this._map[e];return null},e.destroy=function(){this._map=null},n(t,[{key:"map",get:function(){return this._map}},{key:"count",get:function(){return this._count}}]),t}(),Yp=function(){function t(e,i){this.id=t._pipelineId++,this.name="",this.pipes=[],this.name=e;for(var n=0,r=i.length;nthis.pipes.length?(at(4921),this):(this.pipes.splice(e,0,t),this)},e.append=function(t){return this.pipes.push(t),this},e.remove=function(t){return this.pipes.splice(t,1),this},e.sync=function(t){var e=this.pipes;if(0===e.length)return null;t.isFinished=!1;for(var i=0,n=e.length;i>2],om[hm[n++]]=sm[(3&r)<<2|s>>4],om[hm[n++]]=sm[15&s]}return t.replace(e,om.join(""))}var lm=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;function cm(t){var e=lm.exec(t);return e?e[1]:""}function fm(t,e){(e=e||Object.create(null)).__isNative__=e.isNative,e.nativeExt&&(e.ext=e.nativeExt);var i=Zp.find((function(e){return!!e.getAssetInfo(t)}));return i&&(e.bundle=i.name),pm(t,e)}function dm(t){return!!t&&(t instanceof C.SceneAsset||t instanceof C.Scene)}function _m(t){return t&&(46===t.charCodeAt(0)&&47===t.charCodeAt(1)?t=t.slice(2):47===t.charCodeAt(0)&&(t=t.slice(1))),t}function pm(t,e){var i=rm.create({input:t,options:e}),n=[];try{for(var r,s=p(em.sync(i));!(r=s()).done;){var a=r.value,o=a.url;a.recycle(),n.push(o)}}catch(t){for(var h,u=p(i.output);!(h=u()).done;)h.value.recycle();Q(t.message,t.stack)}return i.recycle(),n.length>1?n:n[0]}var mm,gm,vm,ym,bm,Sm,xm=Object.freeze({__proto__:null,decodeUuid:um,getUrlWithUuid:fm,getUuidFromURL:cm,isScene:dm,normalize:_m,transform:pm}),wm=hu,Tm=$h,Cm=t("d_",Qh("cc.Asset")((gm=function(t){function e(e){var i;return(i=t.call(this,e)||this).loaded=!0,i._native=vm&&vm(),i._nativeUrl="",i._file=null,i._ref=0,Object.defineProperty(f(i),"_uuid",{value:"",writable:!0}),i}s(e,t),e.deserialize=function(t){return C.deserialize(t)};var i=e.prototype;return i.toString=function(){return this.nativeUrl},i.serialize=function(){},i._setRawAsset=function(t,e){void 0===e&&(e=!0),this._native=!1!==e?t||"":"/"+t},i.addRef=function(){return this._ref++,this},i.decRef=function(t){return void 0===t&&(t=!0),this._ref>0&&this._ref--,t&&C.assetManager.getReleaseManager().tryRelease(this),this},i.onLoaded=function(){},i.initDefault=function(t){t&&(this._uuid=t),this.isDefault=!0},i.validate=function(){return!0},i.destroy=function(){return K(ft(12101,this._uuid)),t.prototype.destroy.call(this)},n(e,[{key:"nativeUrl",get:function(){if(!this._nativeUrl){if(!this._native)return"";var t=this._native;if(47===t.charCodeAt(0))return t.slice(1);46===t.charCodeAt(0)?this._nativeUrl=fm(this._uuid,{nativeExt:t,isNative:!0}):this._nativeUrl=fm(this._uuid,{__nativeName__:t,nativeExt:Go(t),isNative:!0})}return this._nativeUrl}},{key:"uuid",get:function(){return this._uuid}},{key:"_nativeAsset",get:function(){return this._file},set:function(t){this._file=t}},{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}}]),e}(Do(po)),vm=Nh(gm.prototype,"_native",[wm],(function(){return""})),y(gm.prototype,"_nativeAsset",[Tm],Object.getOwnPropertyDescriptor(gm.prototype,"_nativeAsset"),gm.prototype),mm=gm))||mm);Cm.prototype.createNode=null,C.Asset=Cm;var Am=1346981187,Dm=Ee({PVR:0,PKM:1,ASTC:2});function Im(t,e){return 4===t?89:5===t?4===e?90:91:6===t?5===e?92:93:8===t?5===e?94:6===e?95:96:10===t?5===e?97:6===e?98:8===e?99:100:10===e?101:102}function Bm(t,e){return t[e]<<8|t[e+1]}function Mm(t){return!!(oh.hasFeature(oh.Feature.IMAGE_BITMAP)&&t instanceof ImageBitmap)}var Pm,Em,km,Rm,Om,Fm,Lm,Vm,Nm,zm,Um,Gm=t("e4",Qh("cc.ImageAsset")((Sm=function(t){s(i,t),i.mergeCompressedTextureMips=function(t){var e=new Uint8Array(0);try{for(var i,n=8+4*t.length,r=0,s=p(t);!(i=s()).done;)r+=i.value.byteLength;r+=n,e=new Uint8Array(r);var a=new DataView(e.buffer,e.byteOffset,e.byteLength);a.setUint32(0,Am,!0),a.setUint32(4,t.length,!0);for(var o=n,h=0;h0){var u=new Uint8Array(s,o,h),l=new Uint8Array(r._data.byteLength+u.byteLength);l.set(r._data),l.set(u,r._data.byteLength),r._data=l,r.mipmapLevelDataSize[e]=h}else r._data=new Uint8Array(s,o);r.width=e>0?r.width:a[7],r.height=e>0?r.height:a[6]}else{if(559044176!==a[11])throw new Error("Invalid magic number in PVR header");var c=i+a[0],f=n-a.byteLength;if(n>0){var d=new Uint8Array(s,c,f),_=new Uint8Array(r._data.byteLength+d.byteLength);_.set(r._data),_.set(d,r._data.byteLength),r._data=_,r.mipmapLevelDataSize[e]=f}else r._data=new Uint8Array(s,c);r.width=e>0?r.width:a[1],r.height=e>0?r.height:a[2]}},i.parsePKMTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,a=new Uint8Array(s,i,16),o=Bm(a,6);if(0!==o&&1!==o&&3!==o)throw new Error("Invalid magic number in ETC header");var h=i+16,u=n-16;if(n>0){var l=new Uint8Array(s,h,u),c=new Uint8Array(r._data.byteLength+l.byteLength);c.set(r._data),c.set(l,r._data.byteLength),r._data=c,r.mipmapLevelDataSize[e]=u}else r._data=new Uint8Array(s,h);r.width=e>0?r.width:Bm(a,12),r.height=e>0?r.height:Bm(a,14)},i.parseASTCTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,a=new Uint8Array(s,i,16);if(1554098963!==a[0]+(a[1]<<8)+(a[2]<<16)+(a[3]<<24))throw new Error("Invalid magic number in ASTC header");var o=a[4],h=a[5],u=a[6];if((o<3||o>6||h<3||h>6||u<3||u>6)&&(o<4||7===o||9===o||11===o||o>12||h<4||7===h||9===h||11===h||h>12||1!==u))throw new Error("Invalid block number in ASTC header");var l=Im(o,h),c=i+16,f=n-16;if(n>0){var d=new Uint8Array(s,c,f),_=new Uint8Array(r._data.byteLength+d.byteLength);_.set(r._data),_.set(d,r._data.byteLength),r._data=_,r.mipmapLevelDataSize[e]=f}else r._data=new Uint8Array(s,c);r.width=e>0?r.width:a[7]+(a[8]<<8)+(a[9]<<16),r.height=e>0?r.height:a[10]+(a[11]<<8)+(a[12]<<16),r.format=l};var e=i.prototype;function i(e){var i;return(i=t.call(this)||this)._nativeData=void 0,i._exportedExts=void 0,i._format=35,i._width=0,i._height=0,i._nativeData={_data:null,width:0,height:0,format:0,_compressed:!1,mipmapLevelDataSize:[]},void 0!==e&&i.reset(e),i}return e.extractMipmap0=function(){if(this.mipmapLevelDataSize&&this.mipmapLevelDataSize.length>0){var t=this.mipmapLevelDataSize[0],e=this.data,n=new i({_data:new Uint8Array(e.buffer,0,t),_compressed:!0,width:this.width,height:this.height,format:this.format,mipmapLevelDataSize:[]});return n._uuid=""+this._uuid,n}return this},e.extractMipmaps=function(){var t=[];if(this.mipmapLevelDataSize&&this.mipmapLevelDataSize.length>0)for(var e,n=this.mipmapLevelDataSize,r=this.data,s=0,a=this.height,o=this.width,h=p(n);!(e=h()).done;){var u=e.value,l=new i({_data:new Uint8Array(r.buffer,s,u),_compressed:!0,width:o,height:a,format:this.format,mipmapLevelDataSize:[]});s+=u,l._uuid=""+this._uuid,o=Math.max(o>>1,1),a=Math.max(a>>1,1),t.push(l)}else t.push(this);return t},e.reset=function(t){Mm(t)||t instanceof HTMLElement?this._nativeData=t:(this._nativeData=t,this._format=t.format)},e.destroy=function(){if(this.data&&this.data instanceof HTMLImageElement)this.data.src="",this._setRawAsset("");else if(Mm(this.data)){var e;null==(e=this.data)||e.close()}return t.prototype.destroy.call(this)},e._serialize=function(){},e._deserialize=function(t){var e="";"string"==typeof t?e=t:(this._width=t.w,this._height=t.h,e=t.fmt);for(var n,r=Hp.gfxDevice,s=e.split("_"),a=Number.MAX_VALUE,o=this._format,h="",u=Ue.SUPPORT_TEXTURE_FORMATS,l=p(s);!(n=l()).done;){var c=n.value.split("@"),f=parseInt(c[0],void 0),d=i.extnames[f]||c[0],_=u.indexOf(d);if(-1!==_&&_=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}}]),i}(Cm),Sm.extnames=[".png",".jpg",".jpeg",".bmp",".webp",".pvr",".pkm",".astc"],Sm._sharedPlaceHolderCanvas=null,y((bm=Sm).prototype,"_nativeAsset",[Uu],Object.getOwnPropertyDescriptor(bm.prototype,"_nativeAsset"),bm.prototype),ym=bm))||ym);C.ImageAsset=Gm,Oe(rd);var Hm,Wm,jm,qm=new Bt("Tex"),Xm=Qh("cc.TextureBase")((Um=function(t){function e(e){var i;return(i=t.call(this,e)||this)._format=km&&km(),i._minFilter=Rm&&Rm(),i._magFilter=Om&&Om(),i._mipFilter=Fm&&Fm(),i._wrapS=Lm&&Lm(),i._wrapT=Vm&&Vm(),i._wrapR=Nm&&Nm(),i._anisotropy=zm&&zm(),i._width=1,i._height=1,i._samplerInfo=new p_,i._gfxSampler=null,i._gfxDevice=null,i._textureHash=0,i._id=qm.getNewId(),i._gfxDevice=i._getGFXDevice(),i._textureHash=jf(i._id,666),i}s(e,t);var i=e.prototype;return i.getId=function(){return this._id},i.getPixelFormat=function(){return this._format},i.getAnisotropy=function(){return this._anisotropy},i.setWrapMode=function(t,e,i){void 0===i&&(i=t),this._wrapS=t,this._samplerInfo.addressU=t,this._wrapT=e,this._samplerInfo.addressV=e,this._wrapR=i,this._samplerInfo.addressW=i,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setFilters=function(t,e){this._minFilter=t,this._samplerInfo.minFilter=t,this._magFilter=e,this._samplerInfo.magFilter=e,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setMipFilter=function(t){this._mipFilter=t,this._samplerInfo.mipFilter=t,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setAnisotropy=function(t){t=Math.min(t,16),this._anisotropy=t,this._samplerInfo.maxAnisotropy=t,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.destroy=function(){var e,i=t.prototype.destroy.call(this);return i&&null!=(e=C.director.root)&&e.batcher2D&&C.director.root.batcher2D._releaseDescriptorSetCache(this._textureHash),i},i.getHash=function(){return this._textureHash},i.getGFXTexture=function(){return null},i.getSamplerInfo=function(){return this._samplerInfo},i.getGFXSampler=function(){return this._gfxSampler||(this._gfxDevice?this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo):ht(9302)),this._gfxSampler},i._serialize=function(){return""},i._deserialize=function(t){var e=t.split(",");e.unshift(""),e.length>=5&&(this.setFilters(parseInt(e[1]),parseInt(e[2])),this.setWrapMode(parseInt(e[3]),parseInt(e[4]))),e.length>=7&&(this.setMipFilter(parseInt(e[5])),this.setAnisotropy(parseInt(e[6])))},i._getGFXDevice=function(){return Hp.gfxDevice},i._getGFXFormat=function(){return this._getGFXPixelFormat(this._format)},i._setGFXFormat=function(t){this._format=void 0===t?35:t},i._getGFXPixelFormat=function(t){return 1026===t?t=72:1025===t?t=85:1024===t&&(t=83),t},n(e,[{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}}]),e}(Cm),Um.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},Um.WrapMode={REPEAT:0,CLAMP_TO_EDGE:2,MIRRORED_REPEAT:1,CLAMP_TO_BORDER:3},Um.Filter={NONE:0,LINEAR:2,NEAREST:1},km=Nh((Em=Um).prototype,"_format",[hu],(function(){return 35})),Rm=Nh(Em.prototype,"_minFilter",[hu],(function(){return 2})),Om=Nh(Em.prototype,"_magFilter",[hu],(function(){return 2})),Fm=Nh(Em.prototype,"_mipFilter",[hu],(function(){return 0})),Lm=Nh(Em.prototype,"_wrapS",[hu],(function(){return 0})),Vm=Nh(Em.prototype,"_wrapT",[hu],(function(){return 0})),Nm=Nh(Em.prototype,"_wrapR",[hu],(function(){return 0})),zm=Nh(Em.prototype,"_anisotropy",[hu],(function(){return 0})),Pm=Em))||Pm;C.TextureBase=Xm;var Ym=t("ea",Qh("cc.Script")(Hm=function(t){function e(e){return t.call(this,e)||this}return s(e,t),e}(Cm))||Hm);C._Script=Ym;var Qm=t("eb",Qh("cc.JavaScript")(Wm=function(t){function e(e){return t.call(this,e)||this}return s(e,t),e}(Ym))||Wm);C._JavaScript=Qm;var Jm,Km,Zm,$m,tg,eg,ig,ng=t("ec",Qh("cc.TypeScript")(jm=function(t){function e(e){return t.call(this,e)||this}return s(e,t),e}(Ym))||jm);C._TypeScript=ng;var rg,sg,ag,og,hg,ug,lg,cg,fg,dg,_g,pg=t("ds",Qh("cc.ClickEvent")((Km=function(){function t(){this.target=Zm&&Zm(),this.component=$m&&$m(),this._componentId=tg&&tg(),this.handler=eg&&eg(),this.customEventData=ig&&ig()}t.emitEvents=function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r=0,1620),i=Number.isNaN(i)?A.macro.REPEAT_FOREVER:i,n=n||0;var r=A.director.getScheduler(),s=r.isTargetPaused(this);r.schedule(t,this,e,i,n,s)},i.scheduleOnce=function(t,e){void 0===e&&(e=0),this.schedule(t,0,0,e)},i.unschedule=function(t){t&&A.director.getScheduler().unschedule(t,this)},i.unscheduleAllCallbacks=function(){A.director.getScheduler().unscheduleAllForTarget(this)},n(e,[{key:"name",get:function(){if(this._name)return this._name;var t=Ht(this),e=t.lastIndexOf(".");return e>=0&&(t=t.slice(e+1)),this.node?this.node.name+"<"+t+">":t},set:function(t){this._name=t}},{key:"uuid",get:function(){return this._id}},{key:"__scriptAsset",get:function(){return null}},{key:"enabled",get:function(){return this._enabled},set:function(t){if(this._enabled!==t&&(this._enabled=t,this.node.activeInHierarchy)){var e=A.director._compScheduler;t?e.enableComp(this):e.disableComp(this)}}},{key:"enabledInHierarchy",get:function(){return this._enabled&&this.node&&this.node.activeInHierarchy}},{key:"_isOnLoadCalled",get:function(){return 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}}]),e}(po),cg.EventHandler=pg,cg._executionOrder=0,cg._requireComponent=null,cg.system=null,y((og=cg).prototype,"__scriptAsset",[sg],Object.getOwnPropertyDescriptor(og.prototype,"__scriptAsset"),og.prototype),hg=Nh(og.prototype,"node",[hu],(function(){return null})),ug=Nh(og.prototype,"_enabled",[hu],(function(){return!0})),lg=Nh(og.prototype,"__prefab",[hu],(function(){return null})),ag=og))||ag));Vt(gg,"_registerEditorProps",(function(t,e){var i=e.requireComponent;i&&(Array.isArray(i)&&(i=i.filter(Boolean)),t._requireComponent=i);var n=e.executionOrder;n&&"number"==typeof n&&(t._executionOrder=n)})),A.Component=gg;var vg=t("dQ",Qh("cc.MissingScript")((dg=function(t){function e(){var e;return(e=t.call(this)||this)._$erialized=_g&&_g(),e}return s(e,t),e.safeFindClass=function(t){var e=de(t);if(e)return e;C.deserialize.reportMissingClass(t)},e.prototype.onLoad=function(){at(4600,this.node.name)},e}(gg),_g=Nh(dg.prototype,"_$erialized",[hu,lu],(function(){return null})),fg=dg))||fg);C._MissingScript=vg;try{var yg=vg.__values__;0!==yg.length&&"_$erialized"===yg[yg.length-1]||(ht(16338),ht(16339,yg.join(", ")))}catch(Ps){ht(16340,""+Ps)}var bg=function(){function t(t,e){this._document=t,this._chunks=e}return n(t,[{key:"document",get:function(){return this._document}},{key:"chunks",get:function(){return this._chunks}}]),t}();function Sg(t){var e=t;return{chunks:e.chunks,document:e.document}}function xg(t){if(t.length<16)throw new Tg(ft(13102));var e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(1313817411!==e.getUint32(0,!0))throw new Tg(ft(13100));var i=e.getUint32(4,!0);if(1!==i)throw new Tg(ft(13101,i));if(e.getUint32(8,!0)!==e.byteLength)throw new Tg(ft(13102));var n=12,r=e.getUint32(n,!0);n+=4;var s=new Uint8Array(e.buffer,n+e.byteOffset,r);n+=r;var a,o=wg(s);try{a=JSON.parse(o)}catch(t){throw new Tg(t)}for(var h=[];n0&&(t.chunks.length,this._mainBinChunk=t.chunks[0])):e=t,this._serializedData=e,this._context={fromCCON:i};var n=Array.isArray(e)?e[0]:e;return this.deserializedData=this._deserializeObject(n,0),this._serializedData=void 0,this._mainBinChunk=void 0,this._context=void 0,this.deserializedData},e._deserializeObject=function(t,e,i,n){switch(t.__type__){case"TypedArray":return this._deserializeTypedArrayView(t);case"TypedArrayRef":return this._deserializeTypedArrayViewRef(t);default:return t.__type__?this._deserializeTypeTaggedObject(t,e,i,n):Array.isArray(t)?this._deserializeArray(t):this._deserializePlainObject(t)}},e._deserializeTypedArrayView=function(t){return globalThis[t.ctor].from(t.array)},e._deserializeTypedArrayViewRef=function(t){var e=t.offset,i=t.length,n=t.ctor;return new globalThis[n](this._mainBinChunk.buffer,this._mainBinChunk.byteOffset+e,i)},e._deserializeArray=function(t){for(var e,i=new Array(t.length),n=0;n=0&&(r.deserializedList[e]=i),i}(a);return this._deserializeInto(t,o,a),o},e._deserializeInto=function(t,e,i,n){void 0===n&&(n=!1),n||!e[Qu]?e._deserialize?e._deserialize(t.content,this):C.Class._isCCClass(i)?this._deserializeFireClass(e,t,i):this._deserializeFastDefinedObject(e,t,i):this._runCustomizedDeserialize(t,e,i)},e._runCustomizedDeserialize=function(t,e,i){var n=this,r={readProperty:function(e){var i=t[e];return"object"==typeof i&&i?n._deserializeObjectField(i):i},readThis:function(){n._deserializeInto(t,e,i,!0)},readSuper:function(){var r=ee(i);r&&n._deserializeInto(t,e,r)}};e[Qu](r,this._context)},e._deserializeFireClass=function(t,e,i){var n;if(i.hasOwnProperty("__deserialize__"))n=i.__deserialize__;else{n=Ag(0,i);try{if(i===vg){var r=i.__values__;0!==r.length&&"_$erialized"===r[r.length-1]||(ht(16341),ht(16342,r.join(", ")));var s=n;n=function(t,e,i,n){s(t,e,i,n),e._$erialized||ht(16343,JSON.stringify(i))}}}catch(t){ht(16344,""+t)}Vt(i,"__deserialize__",n,!0)}n(this,t,e,i)},e._deserializeAndAssignField=function(t,e,i){var n=e.__id__;if("number"==typeof n){var r=this.deserializedList[n];if(r)t[i]=r;else{var s,a=this._serializedData[n];t[i]=this._deserializeObject(a,n,void 0,i),null==(s=this._onDereferenced)||s.call(this,this.deserializedList,n,t,i)}}else{var o=e.__uuid__;if(o){var h=e.__expectedType__;this.result.push(t,i,o,h)}else t[i]=this._deserializeObject(e,-1)}return!1},e._deserializeObjectField=function(t){var e=t.__id__;if("number"==typeof e){var i=this.deserializedList[e];if(i)return i;var n=this._serializedData[e];return this._deserializeObject(n,e,void 0,void 0)}if(t.__uuid__)throw t.__expectedType__,new Error("Asset reference field serialization is currently not supported in custom serialization.");return this._deserializeObject(t,-1)},e._fillPlainObject=function(t,e){for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];"object"!=typeof n?"__type__"!==i&&(t[i]=n):n?this._deserializeAndAssignField(t,n,i)&&(t[i]=null):t[i]=null}},e._deserializeFastDefinedObject=function(t,e,i){if(i===C.Vec2)return t.x=e.x||0,void(t.y=e.y||0);if(i===C.Vec3)return t.x=e.x||0,t.y=e.y||0,void(t.z=e.z||0);if(i!==C.Color){if(i===C.Size)return t.width=e.width||0,void(t.height=e.height||0);for(var n=Vi.Attr.getClassAttrs(i),r=i.__values__,s=0;s=0?a[i[h]]=o:a[~h]=o}for(;r=0?u[i[c]]=l:u[~c]=l}}function Yg(t,e){for(var i=t[4][e[jg]],n=i[Wg],r=new(0,n[Ug]),s=n[Gg],a=n[Hg],o=i[i.length-1],h=Wg+1;h=0?e[i]=t[5][n]:t[7][3*~n]=e}function Kg(t){return function(e,i,n,r){for(var s=0;s=0){var c=o[u];e[a]=Qg(t,c,l)}else(0,tv[u=~u])(t,e,a,l)}return r}function iv(t,e,i){return t||i(e),Object}function nv(t,e,i,n,r,s,a){var o=t(e);if(!o){if(r)return void(i[n]=function(e,i,n){return function(){var r=t(n)||iv(s,n,a);return e[i]=r,new r}}(i,n,e));o=iv(s,e,a)}i[n]=o}function rv(t,e,i,n){for(var r=i||de,s=t[3],a=0;a=0?i[u]:~u,s[o]=u);var l=a[o];"number"==typeof l&&(a[o]=n[l])}}function ov(t){if(Array.isArray(t)){var e=t[0];return"number"==typeof e||e instanceof lv}return!1}function hv(t,e,i){var n;e.init(t),null!==(n=i)&&void 0!==n||(i={});var r=t[0],s=!1;if("object"==typeof r&&(s=r.preprocessed,r=r.version),r>=1,n++;return n}function wv(t){return t&&!(t&t-1)}function Tv(t,e,i){return!(6===t.gfxAPI)||wv(e)&&wv(i)}var Cv,Av,Dv,Iv,Bv,Mv=Qh("cc.SimpleTexture")(yv=function(t){function e(e){var i;return(i=t.call(this,e)||this)._gfxTexture=null,i._gfxTextureView=null,i._mipmapLevel=1,i._textureWidth=0,i._textureHeight=0,i._baseLevel=0,i._maxLevel=1e3,i}s(e,t);var i=e.prototype;return i.getGFXTexture=function(){return this._gfxTextureView},i.destroy=function(){return this._tryDestroyTextureView(),this._tryDestroyTexture(),t.prototype.destroy.call(this)},i.updateImage=function(){this.updateMipmaps(0)},i.updateMipmaps=function(){},i.uploadData=function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this._gfxTexture&&!(this._mipmapLevel<=e)){var n=this._getGFXDevice();if(n){var r=Sv[0];r.texExtent.width=this._textureWidth>>e,r.texExtent.height=this._textureHeight>>e,r.texSubres.mipLevel=e,r.texSubres.baseArrayLayer=i,ArrayBuffer.isView(t)?n.copyBuffersToTexture([t],this._gfxTexture,Sv):n.copyTexImagesToTexture([t],this._gfxTexture,Sv)}}},i._assignImage=function(t,e,i){var n=t.data;if(n&&(this.uploadData(n,e,i),this._checkTextureLoaded(),Ue.CLEANUP_IMAGE_CACHE)){var r=bv.getDeps(this._uuid),s=r.indexOf(t._uuid);-1!==s&&(be(r,s),t.decRef())}},i._checkTextureLoaded=function(){this._textureReady()},i._textureReady=function(){this.loaded=!0,this.emit("load")},i._setMipmapLevel=function(t){this._mipmapLevel=t<1?1:t},i._setMipRange=function(t,e){this._baseLevel=t<1?0:t,this._maxLevel=e<1?0:e},i.setMipRange=function(t,e){lt(t<=e,3124),this._setMipRange(t,e);var i=this._getGFXDevice();if(i){var n=this._createTextureView(i);this._tryDestroyTextureView(),this._gfxTextureView=n}},i._getGfxTextureCreateInfo=function(){return null},i._getGfxTextureViewCreateInfo=function(){return null},i._tryReset=function(){if(this._tryDestroyTextureView(),this._tryDestroyTexture(),0!==this._mipmapLevel){var t=this._getGFXDevice();t&&(this._createTexture(t),this._gfxTextureView=this._createTextureView(t))}},i.isUsingOfflineMipmaps=function(){return!1},i._createTexture=function(t){if(0!==this._width&&0!==this._height){var e=0;0!==this._mipFilter&&Tv(t,this._width,this._height)&&(this._mipmapLevel=xv(this._width,this._height),this.isUsingOfflineMipmaps()||this.isCompressed||(e=1));var i=this._getGfxTextureCreateInfo({usage:22,format:this._getGFXFormat(),levelCount:this._mipmapLevel,flags:e});if(i){var n=t.createTexture(i);this._textureWidth=i.width,this._textureHeight=i.height,this._gfxTexture=n}}},i._createTextureView=function(t){if(!this._gfxTexture)return null;var e=this._maxLevel0){var i=this._generatedMipmaps[0];this.reset({width:i.width,height:i.height,format:i.format,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel}),this._generatedMipmaps.forEach((function(t,i){e._assignImage(t,i)}))}else this.reset({width:0,height:0,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})},i.initialize=function(){this.mipmaps=this._mipmaps},i.onLoaded=function(){this.initialize()},i.reset=function(t){this._width=t.width,this._height=t.height,this._setGFXFormat(t.format);var e=void 0===t.mipmapLevel?1:t.mipmapLevel;this._setMipmapLevel(e);var i=void 0===t.baseLevel?0:t.baseLevel,n=void 0===t.maxLevel?1e3:t.maxLevel;this._setMipRange(i,n),this._tryReset()},i.create=function(t,e,i,n,r,s){void 0===i&&(i=35),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=1e3),this.reset({width:t,height:e,format:i,mipmapLevel:n,baseLevel:r,maxLevel:s})},i.toString=function(){return 0!==this._mipmaps.length?this._mipmaps[0].url:""},i.updateMipmaps=function(t,e){if(void 0===t&&(t=0),void 0===e&&(e=void 0),!(t>=this._generatedMipmaps.length))for(var i=Math.min(void 0===e?this._generatedMipmaps.length:e,this._generatedMipmaps.length-t),n=0;n"},i.releaseTexture=function(){this.destroy()},i._serialize=function(){return null},i._deserialize=function(e,i){var n=e;t.prototype._deserialize.call(this,n.base,i),this._mipmaps=new Array(n.mipmaps.length);for(var r=0;r1)for(var n=0;nthis._width&&(this._x=2,this._y=this._nextY),this._y+o+2>this._nextY&&(this._nextY=this._y+o+2),this._nextY>this._height)return null;var h=this._texture,u=i.image;C.internal.dynamicAtlasManager.textureBleeding&&((a<=8||o<=8)&&(Ev(h,u,this._x-1,this._y-1),Ev(h,u,this._x-1,this._y+1),Ev(h,u,this._x+1,this._y-1),Ev(h,u,this._x+1,this._y+1)),Ev(h,u,this._x-1,this._y),Ev(h,u,this._x+1,this._y),Ev(h,u,this._x,this._y-1),Ev(h,u,this._x,this._y+1)),Ev(h,u,this._x,this._y),this._innerTextureInfos[i.getId()]={x:this._x,y:this._y,texture:i},this._count++,r+=this._x,s+=this._y,this._x+=a+2}var l={x:r,y:s,texture:this._texture};return this._innerSpriteFrames.push(t),l},e.removeSpriteFrame=function(t){xe(this._innerSpriteFrames,t)},e.deleteInnerTexture=function(t){t&&this._innerTextureInfos[t.getId()]&&(delete this._innerTextureInfos[t.getId()],this._count--)},e.isEmpty=function(){return this._count<=0},e.reset=function(){this._x=2,this._y=2,this._nextY=2;for(var t=this._innerSpriteFrames,e=0,i=t.length;e19||i<0)at(16365);else{var n=1<19||e<0)at(16366);else{var i=1<31||e<0?(at(16368),""):t.Enum[1<0)for(var n=0;n=0;--n)if((e=r[n]).eventProcessor.capturingTarget&&(t.currentTarget=e,e.eventProcessor.capturingTarget.emit(t.type,t,r),t.propagationStopped))return void ey.free(r);if(t.eventPhase=2,t.currentTarget=i,this.capturingTarget&&this.capturingTarget.emit(t.type,t),!t.propagationImmediateStopped&&this.bubblingTarget&&this.bubblingTarget.emit(t.type,t),!t.propagationStopped&&t.bubbles)for(r.length=0,this.getBubblingTargets(t.type,r),t.eventPhase=3,n=0;n0?n:null}return null},e._attachMask=function(){this.maskList=this._searchComponentsInParent(t._maskComp)},e._isTouchEvent=function(t){return-1!==ry.indexOf(t)},e._isMouseEvent=function(t){return-1!==sy.indexOf(t)},e._hasTouchListeners=function(){for(var t=0;t=0;--a){var o=i[a];Qr.fromSRT(Cy,o.rotation,o.position,o.scale),Qr.multiply(e,e,Cy)}s=!0}else e.set(t._mat);return Ay.length=0,s}function By(t,e){if(t.isSkewEnabled()&&(0!==t.x||0!==t.y))if(t.rotational){var i=-t.x*Dy,n=t.y*Dy,r=Math.cos(i),s=Math.sin(i),a=Math.cos(n),o=Math.sin(n),h=e.m00,u=e.m01,l=e.m04,c=e.m05;e.m00=a*h-s*u,e.m01=o*h+r*u,e.m04=a*l-s*c,e.m05=o*l+r*c}else{var f=Math.tan(t.x*Dy),d=Math.tan(t.y*Dy),_=e.m00,p=e.m01,m=e.m04,g=e.m05;e.m00=_+m*d,e.m01=p+g*d,e.m04=m+_*f,e.m05=g+p*f}}var My=128,Py="transform-changed",Ey="active-changed",ky=new Bt("Node");function Ry(t){return t?"string"==typeof t?_e(t):t:(ht(3804),null)}var Oy,Fy,Ly,Vy,Ny,zy,Uy,Gy=nr(),Hy=nr(),Wy=zr(),jy=zr(),qy=zr(),Xy=new gr,Yy=Zr(),Qy=Zr(),Jy=[],Ky=Symbol("ReserveContentsForAllSyncablePrefab"),Zy=0,$y=0,tb=t("dn",(hy=Qh("cc.Node"),uy=Eu(ir),ly=Eu(zv),hy((Ty=function(t){s(i,t);var e=i.prototype;function i(e){var i;return void 0===e&&(e="New Node"),(i=t.call(this,e)||this)._parent=dy&&dy(),i._children=_y&&_y(),i._active=py&&py(),i._components=my&&my(),i._prefab=gy&&gy(),i._scene=null,i._activeInHierarchy=!1,i._id=ky.getNewId(),i._eventProcessor=new oy(f(i)),i._eventMask=0,i._siblingIndex=0,i._originalSceneId="",i._uiProps=new Lv(f(i)),i._static=!1,i._lpos=vy&&vy(),i._lrot=yy&&yy(),i._lscale=by&&by(),i._mobility=Sy&&Sy(),i._layer=xy&&xy(),i._euler=wy&&wy(),i._transformFlags=15,i._eulerDirty=!1,i._flagChangeVersion=0,i._hasChangedFlags=0,i._pos=new ir,i._rot=new kr,i._scale=new ir(1,1,1),i._mat=new Qr,i}return e._setActiveInHierarchy=function(t){this._activeInHierarchy=t},i._setScene=function(t){t._updateScene()},i._incSkewCompCount=function(){++$y},i._decSkewCompCount=function(){--$y},i._findComponent=function(t,e){var i=e,n=t._components;if(i._sealed)for(var r=0;r0&&(s=i._findChildComponent(r._children,e)))return s}return null},i._findChildComponents=function(t,e,n){for(var r=0;r0&&i._findChildComponents(s._children,e,n)}},e.getWritableComponents=function(){return this._components},e._updateScene=function(){null==this._parent?ht(1640,this.name,this.uuid):this._scene=this._parent._scene},e.attr=function(t){$t(this,t)},e.getParent=function(){return this._parent},e.modifyParent=function(t){this._parent=t},e.setParent=function(t,e){if(void 0===e&&(e=!1),e&&this.updateWorldTransform(),this._parent!==t){var i=this._parent,n=t;if(this._parent=n,this._siblingIndex=0,this._onSetParent(i,e),this.emit&&this.emit("parent-changed",i),i&&!(i._objFlags&My)){var r=i._children.indexOf(this);i._children.splice(r,1),i._updateSiblingIndex(),i.emit&&i.emit("child-removed",this)}n&&(n._children.push(this),this._siblingIndex=n._children.length-1,n.emit&&n.emit("child-added",this)),this._onHierarchyChanged(i)}},e.getChildByUuid=function(t){if(!t)return X("Invalid uuid"),null;for(var e=this._children,i=0,n=e.length;i=0?t:e.length+t;var i=e.indexOf(this);t!==i&&(e.splice(i,1),t0?(h=s,r=s._children,a=0,o[n]=r[a],n++):(o[n]=s,n++,u=!0);o.length=0,i._stackId--},e.removeFromParent=function(){this._parent&&this._parent.removeChild(this)},e.removeChild=function(t){this._children.indexOf(t)>-1&&(t.parent=null)},e.removeAllChildren=function(){for(var t=this._children,e=t.length-1;e>=0;e--){var i=t[e];i&&(i.parent=null)}this._children.length=0},e.isChildOf=function(t){var e=this;do{if(e===t)return!0;e=e._parent}while(e);return!1},e.getComponent=function(t){var e=Ry(t);return e?i._findComponent(this,e):null},e.getComponents=function(t){var e=Ry(t),n=[];return e&&i._findComponents(this,e,n),n},e.getComponentInChildren=function(t){var e=Ry(t);return e?i._findChildComponent(this._children,e):null},e.getComponentsInChildren=function(t){var e=Ry(t),n=[];return e&&(i._findComponents(this,e,n),i._findChildComponents(this._children,e,n)),n},e.addComponent=function(t){var e;if("string"==typeof t){if(!(e=_e(t)))throw C._RF.peek()&&ht(3808,t),TypeError(ft(3807,t))}else{if(!t)throw TypeError(ft(3804));e=t}if("function"!=typeof e)throw TypeError(ft(3809));if(!ie(e,C.Component))throw TypeError(ft(3810));var i=e._requireComponent;if(i)if(Array.isArray(i))for(var n=0;n0){if(t){var a=Iy(t,Qy);Qr.fromSRT(Yy,n._lrot,n._lpos,n._lscale);var o=a?Qy:t._mat;Qr.multiply(n._mat,o,Yy)}Iy(r,Qy)&&(s=Qy)}Qr.multiply(Yy,Qr.invert(Yy,s),n._mat),Qr.toSRT(Yy,n._lrot,n._lpos,n._lscale)}else ir.copy(n._lpos,n._pos),kr.copy(n._lrot,n._rot),ir.copy(n._lscale,n._scale);n._eulerDirty=!0}n.invalidateChildren(7)},e._onHierarchyChanged=function(t){this.eventProcessor.reattach(),this._onHierarchyChangedBase(t)},e._onBatchCreated=function(t){2&this._eventMask&&(this._activeInHierarchy||this.emit(Ey,this,!1)),this.hasChangedFlags=7,this._children.forEach((function(e,i){e._siblingIndex=i,e._onBatchCreated(t)}))},e._onBeforeSerialize=function(){this.eulerAngles},e._onPostActivated=function(t){var e=this;2&e._eventMask&&e.emit(Ey,e,t);var i=this._eventProcessor;if(i.isEnabled===t&&oy.callbacksInvoker.emit(2),i.setEnabled(t),t){e.invalidateChildren(7);var n=e._uiProps&&e._uiProps.uiComp;n&&(n.setNodeDirty(),n.setTextureDirty(),n._markForUpdateRenderData())}},e.translate=function(t,e){var i=e||0;if(0===i)ir.transformQuat(Gy,t,this._lrot),this._lpos.x+=Gy.x,this._lpos.y+=Gy.y,this._lpos.z+=Gy.z;else if(1===i)if(this._parent){kr.invert(Wy,this._parent.worldRotation),ir.transformQuat(Gy,t,Wy);var n=this.worldScale;this._lpos.x+=Gy.x/n.x,this._lpos.y+=Gy.y/n.y,this._lpos.z+=Gy.z/n.z}else this._lpos.x+=t.x,this._lpos.y+=t.y,this._lpos.z+=t.z;this.invalidateChildren(1),1&this._eventMask&&this.emit(Py,1)},e.rotate=function(t,e){var i=e||0;if(kr.normalize(Wy,t),0===i)kr.multiply(this._lrot,this._lrot,Wy);else if(1===i){var n=this.worldRotation;kr.multiply(jy,Wy,n),kr.invert(Wy,n),kr.multiply(jy,Wy,jy),kr.multiply(this._lrot,this._lrot,jy)}this._eulerDirty=!0,this.invalidateChildren(2),1&this._eventMask&&this.emit(Py,2)},e.lookAt=function(t,e){this.getWorldPosition(Gy),ir.subtract(Gy,Gy,t),ir.normalize(Gy,Gy),kr.fromViewUp(Wy,Gy,e),this.setWorldRotation(Wy)},e.invalidateChildren=function(t){var e,i,n=0,r=0,s=0,a=0,o=1|t;for(Jy[0]=this;n>=0;){if(a=(e=Jy[n--]).hasChangedFlags,e.isValid&&(e._transformFlags&a&t)!==t)for(e._transformFlags|=t,e.hasChangedFlags=a|t,s=(i=e._children).length,r=0;r0&&(u=Iy(n,Qy),((h=t._uiProps._uiSkewComp)||u)&&(Qr.multiply(Qy,Qy,Yy),h&&By(h,Yy),l=Qy)),Qr.multiply(e,n._mat,Yy);var c=2&s?t._rot:null;Qr.toSRT(l,c,i,t._scale),u&&ir.transformMat4(i,t._lpos,n._mat)}}else a&&(ir.copy(i,t._lpos),e.m12=i.x,e.m13=i.y,e.m14=i.z),o&&(2&s&&kr.copy(t._rot,t._lrot),4&s&&ir.copy(t._scale,t._lscale),Qr.fromSRT(e,t._rot,t._pos,t._scale),$y>0&&(h=t._uiProps._uiSkewComp)&&By(h,e));t._transformFlags=0,n=t}}},e.setPosition=function(t,e,i){var n=this._lpos;void 0===e?ir.copy(n,t):(void 0===i&&(i=n.z),ir.set(n,t,e,i)),this.invalidateChildren(1),1&this._eventMask&&this.emit(Py,1)},e.getPosition=function(t){return t?ir.set(t,this._lpos.x,this._lpos.y,this._lpos.z):ir.copy(new ir,this._lpos)},e.setRotation=function(t,e,i,n){void 0===e?kr.copy(this._lrot,t):kr.set(this._lrot,t,e,i,n),this._eulerDirty=!0,this.invalidateChildren(2),1&this._eventMask&&this.emit(Py,2)},e.setRotationFromEuler=function(t,e,i){if(void 0===e)ir.copy(this._euler,t),kr.fromEuler(this._lrot,t.x,t.y,t.z);else{var n=void 0===i?this._euler.z:i;ir.set(this._euler,t,e,n),kr.fromEuler(this._lrot,t,e,n)}this._eulerDirty=!1,this.invalidateChildren(2),1&this._eventMask&&this.emit(Py,2)},e.getRotation=function(t){return t?kr.set(t,this._lrot.x,this._lrot.y,this._lrot.z,this._lrot.w):kr.copy(new kr,this._lrot)},e.setScale=function(t,e,i){var n=this._lscale;void 0===e?ir.copy(n,t):(void 0===i&&(i=n.z),ir.set(n,t,e,i)),this.invalidateChildren(4),1&this._eventMask&&this.emit(Py,4)},e.getScale=function(t){return t?ir.set(t,this._lscale.x,this._lscale.y,this._lscale.z):ir.copy(new ir,this._lscale)},e.inverseTransformPoint=function(t,e){ir.copy(t,e);for(var i=this,n=0;i._parent;)Jy[n++]=i,i=i._parent;for(;n>=0;)ir.transformInverseRTS(t,t,i._lrot,i._lpos,i._lscale),i=Jy[--n];return t},e.setWorldPosition=function(t,e,i){var n=this._pos;void 0===e?ir.copy(n,t):ir.set(n,t,e,i);var r=this._parent,s=this._lpos;r?(r.updateWorldTransform(),ir.transformMat4(s,n,Qr.invert(Yy,r._mat))):ir.copy(s,n),this.invalidateChildren(1),1&this._eventMask&&this.emit(Py,1)},e.getWorldPosition=function(t){return this.updateWorldTransform(),t?ir.copy(t,this._pos):ir.copy(new ir,this._pos)},e.setWorldRotation=function(t,e,i,n){var r=this._rot;void 0===e?kr.copy(r,t):kr.set(r,t,e,i,n),this._parent?(this._parent.updateWorldTransform(),kr.multiply(this._lrot,kr.conjugate(this._lrot,this._parent._rot),r)):kr.copy(this._lrot,r),this._eulerDirty=!0,this.invalidateChildren(2),1&this._eventMask&&this.emit(Py,2)},e.setWorldRotationFromEuler=function(t,e,i){kr.fromEuler(Wy,t,e,i),this.setWorldRotation(Wy)},e.getWorldRotation=function(t){return this.updateWorldTransform(),t?kr.copy(t,this._rot):kr.copy(new kr,this._rot)},e.setWorldScale=function(t,e,i){var n=this,r=n._parent;r&&n.updateWorldTransform();var s=n._scale;void 0===e?ir.copy(s,t):ir.set(s,t,e,i);var a=0;if(r){var o=n._mat;n._uiProps._uiSkewComp&&(Qr.fromSRT(Yy,n._lrot,n._lpos,n._lscale),Qr.multiply(o,r._mat,Yy));var h=ir.set(Hy,o.m00,o.m01,o.m02).length(),u=ir.set(Hy,o.m04,o.m05,o.m06).length(),l=ir.set(Hy,o.m08,o.m09,o.m10).length();0===h?(Gy.x=s.x,o.m00=1,a=2):Gy.x=s.x/h,0===u?(Gy.y=s.y,o.m05=1,a=2):Gy.y=s.y/u,0===l?(Gy.z=s.z,o.m10=1,a=2):Gy.z=s.z/l,Qr.scale(Yy,o,Gy),Qr.multiply(Qy,Qr.invert(Qy,r._mat),Yy),gr.fromQuat(Xy,kr.conjugate(qy,n._lrot)),gr.multiplyMat4(Xy,Xy,Qy);var c=n._lscale;c.x=ir.set(Gy,Xy.m00,Xy.m01,Xy.m02).length(),c.y=ir.set(Gy,Xy.m03,Xy.m04,Xy.m05).length(),c.z=ir.set(Gy,Xy.m06,Xy.m07,Xy.m08).length(),0!==c.x&&0!==c.y&&0!==c.z||(a=2)}else ir.copy(n._lscale,s);n.invalidateChildren(4|a),1&n._eventMask&&n.emit(Py,4|a)},e.getWorldScale=function(t){return this.updateWorldTransform(),t?ir.copy(t,this._scale):ir.copy(new ir,this._scale)},e.getWorldMatrix=function(t){this.updateWorldTransform();var e=t||new Qr;return Qr.copy(e,this._mat)},e.getWorldRS=function(t){this.updateWorldTransform();var e=t||new Qr;return Qr.copy(e,this._mat),e.m12=0,e.m13=0,e.m14=0,e},e.getWorldRT=function(t){this.updateWorldTransform();var e=t||new Qr;return Qr.fromRT(e,this._rot,this._pos)},e.setRTS=function(t,e,i){var n=0;t&&(n|=2,void 0!==t.w?(kr.copy(this._lrot,t),this._eulerDirty=!0):(ir.copy(this._euler,t),kr.fromEuler(this._lrot,t.x,t.y,t.z),this._eulerDirty=!1)),e&&(ir.copy(this._lpos,e),n|=1),i&&(ir.copy(this._lscale,i),n|=4),n&&(this.invalidateChildren(n),1&this._eventMask&&this.emit(Py,n))},e.isTransformDirty=function(){return 0!==this._transformFlags},e.pauseSystemEvents=function(t){this._eventProcessor.setEnabled(!1,t)},e.resumeSystemEvents=function(t){this._eventProcessor.setEnabled(!0,t)},i.resetHasChangedFlags=function(){Zy+=1},i.clearNodeArray=function(){i.ClearFrame0},set:function(t){t?this._objFlags|=64:this._objFlags&=-65}},{key:"name",get:function(){return this._name},set:function(t){this._name=t}},{key:"uuid",get:function(){return this._id}},{key:"children",get:function(){return this._children}},{key:"active",get:function(){return this._active},set:function(t){if(t=!!t,this._active!==t){this._active=t;var e=this._parent;e&&e._activeInHierarchy&&C.director._nodeActivator.activateNode(this,t)}}},{key:"activeInHierarchy",get:function(){return this._activeInHierarchy}},{key:"parent",get:function(){return this._parent},set:function(t){this.setParent(t)}},{key:"scene",get:function(){return this._scene}},{key:"eventProcessor",get:function(){return this._eventProcessor}},{key:"prefab",get:function(){return this._prefab}},{key:"id",set:function(t){this._id=t}},{key:"siblingIndex",get:function(){return this._siblingIndex},set:function(t){this._siblingIndex=t}},{key:"position",get:function(){return this._lpos},set:function(t){this.setPosition(t)}},{key:"x",get:function(){return this._lpos.x},set:function(t){this.setPosition(t,this._lpos.y,this._lpos.z)}},{key:"y",get:function(){return this._lpos.y},set:function(t){this.setPosition(this._lpos.x,t,this._lpos.z)}},{key:"z",get:function(){return this._lpos.z},set:function(t){this.setPosition(this._lpos.x,this._lpos.y,t)}},{key:"worldPosition",get:function(){return this.updateWorldTransform(),this._pos},set:function(t){this.setWorldPosition(t)}},{key:"worldPositionX",get:function(){return this.updateWorldTransform(),this._pos.x},set:function(t){this.setWorldPosition(t,this._pos.y,this._pos.z)}},{key:"worldPositionY",get:function(){return this.updateWorldTransform(),this._pos.y},set:function(t){this.setWorldPosition(this._pos.x,t,this._pos.z)}},{key:"worldPositionZ",get:function(){return this.updateWorldTransform(),this._pos.z},set:function(t){this.setWorldPosition(this._pos.x,this._pos.y,t)}},{key:"rotation",get:function(){return this._lrot},set:function(t){this.setRotation(t)}},{key:"eulerAngles",get:function(){return this._eulerDirty&&(kr.toEuler(this._euler,this._lrot),this._eulerDirty=!1),this._euler},set:function(t){this.setRotationFromEuler(t.x,t.y,t.z)}},{key:"angle",get:function(){return this.eulerAngles.z},set:function(t){ir.set(this._euler,0,0,t),kr.fromAngleZ(this._lrot,t),this._eulerDirty=!1,this.invalidateChildren(2),1&this._eventMask&&this.emit(Py,2)}},{key:"worldRotation",get:function(){return this.updateWorldTransform(),this._rot},set:function(t){this.setWorldRotation(t)}},{key:"scale",get:function(){return this._lscale},set:function(t){this.setScale(t)}},{key:"worldScale",get:function(){return this.updateWorldTransform(),this._scale},set:function(t){this.setWorldScale(t)}},{key:"matrix",set:function(t){Qr.toSRT(t,this._lrot,this._lpos,this._lscale),this.invalidateChildren(7),this._eulerDirty=!0,1&this._eventMask&&this.emit(Py,7)}},{key:"worldMatrix",get:function(){return this.updateWorldTransform(),this._mat}},{key:"forward",get:function(){return ir.transformQuat(new ir,ir.FORWARD,this.worldRotation)},set:function(t){var e=t.length();ir.multiplyScalar(Gy,t,-1/e),kr.fromViewUp(Wy,Gy),this.setWorldRotation(Wy)}},{key:"up",get:function(){return ir.transformQuat(new ir,ir.UP,this.worldRotation)}},{key:"right",get:function(){return ir.transformQuat(new ir,ir.RIGHT,this.worldRotation)}},{key:"mobility",get:function(){return this._mobility},set:function(t){this._mobility!==t&&(this._mobility=t,this.emit("mobility-changed"))}},{key:"layer",get:function(){return this._layer},set:function(t){var e=this;if(e._layer!==t){e._layer=t;var i=e._uiProps&&e._uiProps.uiComp;i&&(i.setNodeDirty(),i._markForUpdateRenderData()),e.emit("layer-changed",e._layer)}}},{key:"flagChangedVersion",get:function(){return this._flagChangeVersion}},{key:"hasChangedFlags",get:function(){return this._flagChangeVersion===Zy?this._hasChangedFlags:0},set:function(t){this._flagChangeVersion=Zy,this._hasChangedFlags=t}}]),i}(po),Ty.idGenerator=ky,Ty._stacks=[[]],Ty._stackId=0,Ty.EventType=Uv,Ty.NodeSpace=Vv,Ty.TransformDirtyBit=Nv,Ty.TransformBit=Nv,Ty.reserveContentsForAllSyncablePrefabTag=Ky,Ty.ClearFrame=0,Ty.ClearRound=1e3,y((fy=Ty).prototype,"_persistNode",[$h],Object.getOwnPropertyDescriptor(fy.prototype,"_persistNode"),fy.prototype),dy=Nh(fy.prototype,"_parent",[hu],(function(){return null})),_y=Nh(fy.prototype,"_children",[hu],(function(){return[]})),py=Nh(fy.prototype,"_active",[hu],(function(){return!0})),my=Nh(fy.prototype,"_components",[hu],(function(){return[]})),gy=Nh(fy.prototype,"_prefab",[hu],(function(){return null})),vy=Nh(fy.prototype,"_lpos",[hu],(function(){return new ir})),yy=Nh(fy.prototype,"_lrot",[hu],(function(){return new kr})),by=Nh(fy.prototype,"_lscale",[hu],(function(){return new ir(1,1,1)})),Sy=Nh(fy.prototype,"_mobility",[hu],(function(){return zv.Static})),xy=Nh(fy.prototype,"_layer",[hu],(function(){return Fv.Enum.DEFAULT})),wy=Nh(fy.prototype,"_euler",[hu],(function(){return new ir})),y(fy.prototype,"eulerAngles",[uy],Object.getOwnPropertyDescriptor(fy.prototype,"eulerAngles"),fy.prototype),y(fy.prototype,"mobility",[ly],Object.getOwnPropertyDescriptor(fy.prototype,"mobility"),fy.prototype),cy=fy))||cy));C.Node=tb;var eb=t("e6",Qh("cc.TextureCube")((Uy=function(t){function e(e){var i;return(i=t.call(this,e)||this).isRGBE=Ly&&Ly(),i._mipmapAtlas=Vy&&Vy(),i._mipmapMode=Ny&&Ny(),i._mipmaps=zy&&zy(),i._generatedMipmaps=[],i}s(e,t);var i=e.prototype;return i._setMipmapParams=function(t){var e=this;if(this._generatedMipmaps=t,this._setMipmapLevel(this._generatedMipmaps.length),this._generatedMipmaps.length>0){var i=this._generatedMipmaps[0].front;this.reset({width:i.width,height:i.height,format:i.format,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel}),this._generatedMipmaps.forEach((function(t,i){ib(t,(function(t,n){e._assignImage(t,i,n)}))}))}else this.reset({width:0,height:0,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})},i.isUsingOfflineMipmaps=function(){return 2===this._mipmapMode},e.fromTexture2DArray=function(t,i){for(var n=[],r=t.length/6,s=0;s=this._generatedMipmaps.length))for(var n=Math.min(void 0===e?this._generatedMipmaps.length:e,this._generatedMipmaps.length-t),r=function(){var e=t+s;ib(i._generatedMipmaps[e],(function(t,n){i._assignImage(t,e,n)}))},s=0;s1&&t.forEach((function(t){var i={front:t.front.extractMipmap0(),back:t.back.extractMipmap0(),left:t.left.extractMipmap0(),right:t.right.extractMipmap0(),top:t.top.extractMipmap0(),bottom:t.bottom.extractMipmap0()};e.push(i)}));this._setMipmapParams(e)}},{key:"mipmapAtlas",get:function(){return this._mipmapAtlas},set:function(t){var e=this;if(this._mipmapAtlas=t,this._mipmapAtlas){var i=this._mipmapAtlas.atlas.front;if(i.data){var n=this._mipmapAtlas.atlas,r=this._mipmapAtlas.layout,s=r[0],a=Object.assign(I.document.createElement("canvas"),{width:i.width,height:i.height}).getContext("2d");this.reset({width:s.width,height:s.height,format:i.format,mipmapLevel:r.length});for(var o=function(){var t=r[h];ib(n,(function(n,r){a.clearRect(0,0,i.width,i.height);var s=n.data;a.drawImage(s,0,0);var o=a.getImageData(t.left,t.top,t.width,t.height),h=new Gm({_data:o.data,_compressed:n.isCompressed,width:o.width,height:o.height,format:n.format});e._assignImage(h,t.level,r)}))},h=0;h>>26},QS=function(t){return(t&jS)>>>20},JS=function(t){return(t&qS)>>>12},KS=function(t){return 4095&t},ZS=function(t,e){return 67108863&t|e<<26&WS},$S=((RS={})[0]=function(t,e,i){return void 0===i&&(i=0),at(12010,i)},RS[5]=function(t,e,i){return void 0===i&&(i=0),t[i]},RS[6]=function(t,e,i){return void 0===i&&(i=0),ds.fromArray(e,t,i)},RS[7]=function(t,e,i){return void 0===i&&(i=0),ir.fromArray(e,t,i)},RS[8]=function(t,e,i){return void 0===i&&(i=0),Vn.fromArray(e,t,i)},RS[13]=function(t,e,i){return void 0===i&&(i=0),t[i]},RS[14]=function(t,e,i){return void 0===i&&(i=0),ds.fromArray(e,t,i)},RS[15]=function(t,e,i){return void 0===i&&(i=0),ir.fromArray(e,t,i)},RS[16]=function(t,e,i){return void 0===i&&(i=0),Vn.fromArray(e,t,i)},RS[21]=function(t,e,i){return void 0===i&&(i=0),gr.fromArray(e,t,i)},RS[25]=function(t,e,i){return void 0===i&&(i=0),Qr.fromArray(e,t,i)},RS),tx=((OS={})[0]=function(t,e,i){return void 0===i&&(i=0),at(12010,i)},OS[5]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},OS[6]=function(t,e,i){return void 0===i&&(i=0),ds.toArray(t,e,i)},OS[7]=function(t,e,i){return void 0===i&&(i=0),ir.toArray(t,e,i)},OS[8]=function(t,e,i){return void 0===i&&(i=0),Vn.toArray(t,e,i)},OS[13]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},OS[14]=function(t,e,i){return void 0===i&&(i=0),ds.toArray(t,e,i)},OS[15]=function(t,e,i){return void 0===i&&(i=0),ir.toArray(t,e,i)},OS[16]=function(t,e,i){return void 0===i&&(i=0),Vn.toArray(t,e,i)},OS[21]=function(t,e,i){return void 0===i&&(i=0),gr.toArray(t,e,i)},OS[25]=function(t,e,i){return void 0===i&&(i=0),Qr.toArray(t,e,i)},OS),ex=((FS={})[5]=function(t){return"number"==typeof t},FS[13]=function(t){return"number"==typeof t},FS[6]=function(t){return!!(t instanceof ds)},FS[14]=function(t){return!!(t instanceof ds)},FS[7]=function(t){return!!(t instanceof ir)},FS[15]=function(t){return!!(t instanceof ir)},FS[8]=function(t){return!!(t instanceof Vn)},FS[16]=function(t){return!!(t instanceof Vn||t instanceof cr||t instanceof kr)},FS[21]=function(t){return!!(t instanceof gr)},FS[25]=function(t){return!!(t instanceof Qr)},FS),ix=[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 nx(t){switch(t){case 1:case 5:case 9:case 13:return ix[0];case 2:case 6:case 10:case 14:return ix[1];case 4:case 8:case 12:case 16:return ix[2];case 25:return ix[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 ix[0]}function rx(t){switch(t){case 28:return"-texture";case 31:return"-cube-texture";case 29:return"-array-texture";case 30:return"-3d-texture";default:return"-unknown"}}function sx(t,e){for(var i=Object.entries(e),n=!1,r=0;r>2)*o.count}for(var h=0;h31&&(t.uber=!0),t.constantMacros="",t.builtins.statistics)t.constantMacros+="#define "+r+" "+t.builtins.statistics[r]+"\n"}function vx(t){var e=Object.keys(t).reduce((function(e,i){return e.reduce((function(e,n){for(var s=t[i],a=0;a0&&this.shaders.length>0},e}(Cm),Mx._effects={},Mx._layoutValid=!0,Ax=Nh((Cx=Mx).prototype,"techniques",[hu],(function(){return[]})),Dx=Nh(Cx.prototype,"shaders",[hu],(function(){return[]})),Ix=Nh(Cx.prototype,"combinations",[hu],(function(){return[]})),Bx=Nh(Cx.prototype,"hideInEditor",[hu,lu],(function(){return!1})),Tx=Cx))||Tx);C.EffectAsset=kx;var Rx=function(t,e){return!(t.length>e.length)||47===t.charCodeAt(e.length)},Ox=function(t){var e=t.uuids,i=t.paths,n=t.types,r=t.deps,s=t.paths=Object.create(null);if(!1===t.debug){for(var a=0,o=e.length;a0&&Gx(t)>0)){Qp.remove(i);for(var n=bv.getDeps(i),r=0,s=n.length;rthis._maxInterval?this._maxInterval:e;t-this._lastDate>1e3*i&&(this._totalNumThisPeriod=0,this._lastDate=t)},t._handleQueue=function(t,e){for(this._checkNextPeriod=!1,this._updateTime();this._queue.length>0&&this._totalNum0&&(Ze(this._handleQueue.bind(this),t,e),this._checkNextPeriod=!0)},n(e,[{key:"remoteServerAddress",get:function(){return this._remoteServerAddress}},{key:"handlers",get:function(){return this._downloaders}}],[{key:"instance",get:function(){return e._instance||(e._instance=new e),e._instance}}]),e}();bw._instance=void 0;var Sw,xw,ww,Tw,Cw,Aw,Dw=bw.instance,Iw=bw.instance,Bw=t("e3",Qh("cc.JsonAsset")((xw=function(t){function e(e){var i;return(i=t.call(this,e)||this).json=ww&&ww(),i}return s(e,t),e}(Cm),ww=Nh(xw.prototype,"json",[hu],(function(){return null})),Sw=xw))||Sw);C.JsonAsset=Bw;var Mw,Pw,Ew=t("e2",Qh("cc.TextAsset")((Cw=function(t){function e(e){var i;return(i=t.call(this,e)||this).text=Aw&&Aw(),i}return s(e,t),e.prototype.toString=function(){return this.text},e}(Cm),Aw=Nh(Cw.prototype,"text",[hu],(function(){return""})),Tw=Cw))||Tw);C.TextAsset=Ew;var kw=t("d$",Qh("cc.BufferAsset")((Pw=function(t){function e(e){var i;return(i=t.call(this,e)||this)._buffer=null,i}s(e,t);var i=e.prototype;return i.buffer=function(){return this._buffer,this._buffer},i.validate=function(){return!!this._buffer},n(e,[{key:"_nativeAsset",get:function(){return this._buffer},set:function(t){t instanceof ArrayBuffer?this._buffer=t:this._buffer=t.buffer}}]),e}(Cm),y(Pw.prototype,"_nativeAsset",[Uu],Object.getOwnPropertyDescriptor(Pw.prototype,"_nativeAsset"),Pw.prototype),Mw=Pw))||Mw);function Rw(t,e,i,n){var r=null,s=null;try{(r=new Gm)._nativeUrl=t,r._nativeAsset=e}catch(t){s=t}n(s,r)}function Ow(t,e,i,n){var r=new Bw;r.json=e,n(null,r)}function Fw(t,e,i,n){var r=new Ew;r.text=e,n(null,r)}function Lw(t,e,i,n){var r=new kw;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function Vw(t,e,i,n){var r=new Cm;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function Nw(t,i,n,r){var s=Zp.get(i.name);s||(s="resources"===i.name?sw:new rw,i.base=i.base||t+"/",s.init(i)),e.import("virtual:///prerequisite-imports/"+s.name).then((function(){r(null,s)})).catch(r)}C.BufferAsset=kw;var zw=function(){function t(){this._creating=new Xp,this._producers={".png":Rw,".jpg":Rw,".bmp":Rw,".jpeg":Rw,".gif":Rw,".ico":Rw,".tiff":Rw,".webp":Rw,".image":Rw,".pvr":Rw,".pkm":Rw,".astc":Rw,".txt":Fw,".xml":Fw,".vsh":Fw,".fsh":Fw,".atlas":Fw,".tmx":Fw,".tsx":Fw,".fnt":Fw,".json":Ow,".ExportJson":Ow,".binary":Lw,".bin":Lw,".dbbin":Lw,".skel":Lw,bundle:Nw,default:Vw}}var e=t.prototype;return e.register=function(t,e){"object"==typeof t?$t(this._producers,t):this._producers[t]=e},e.create=function(t,e,i,n,r){var s=this,a=this._producers[i]||this._producers.default,o=Qp.get(t);if(n.reloadAsset||!o){var h=this._creating.get(t);h?h.push(r):(this._creating.add(t,[r]),a(t,e,n,(function(e,i){!e&&i instanceof Cm&&(i._uuid=t,Jx(t,i,n.cacheAsset));for(var r=s._creating.remove(t),a=0,o=r.length;a0){var a=rm.create({input:s,progress:r,options:n,onProgress:t.onProgress,onError:rm.prototype.recycle,onComplete:function(n){var r;n||((r=t.output).push.apply(r,a.output),a.recycle()),i&&jw(t),e(n)}});tm.async(a)}else i&&jw(t),e()}))}function jw(t){for(var e=t.output,i=0,n=e.length;i0&&(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(e,i,n),this.parser.init(),this.dependUtil.init();var s=t.importBase||aT(oT,"importBase")||"";s&&s.endsWith("/")&&(s=s.substring(0,s.length-1));var a=t.nativeBase||aT(oT,"nativeBase")||"";a&&a.endsWith("/")&&(a=a.substring(0,a.length-1)),this.generalImportBase=s,this.generalNativeBase=a,this._projectBundles=aT(oT,"projectBundles")||[];var o=aT(oT,"assetsOverrides")||{};for(var h in o)this.assetsOverrideMap.set(h,o[h])},e.getBundle=function(t){return Zp.get(t)||null},e.removeBundle=function(t){t._destroy(),Zp.remove(t.name)},e.loadAny=function(t,e,i,n){var r=tw(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"default",t=Array.isArray(t)?t.slice():t;var h=rm.create({input:t,onProgress:a,onComplete:nw(o),options:s});$p.async(h)},e.preloadAny=function(t,e,i,n){var r=tw(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"preload",t=Array.isArray(t)?t.slice():t;var h=rm.create({input:t,onProgress:a,onComplete:nw(o),options:s});tm.async(h)},e.loadRemote=function(t,e,i){var n=tw(e,void 0,i),r=n.options,s=n.onComplete;r.reloadAsset||!this.assets.has(t)?(r.__isNative__=!0,r.preset=r.preset||"remote",this.loadAny({url:t},r,null,(function(e,i){e?(Q(e.message,e.stack),s&&s(e,i)):Uw.create(t,i,r.ext||Go(t),r,(function(t,e){s&&s(t,e)}))}))):nw(s)(null,this.assets.get(t))},e.loadBundle=function(t,e,i){var n=tw(e,void 0,i),r=n.options,s=n.onComplete,a=Wo(t);this.bundles.has(a)?nw(s)(null,this.getBundle(a)):(r.preset=r.preset||"bundle",r.ext="bundle",r.__isNative__=!0,this.loadAny({url:t},r,null,(function(e,i){e?(Q(e.message,e.stack),s&&s(e,i)):Uw.create(t,i,"bundle",r,(function(t,e){s&&s(t,e)}))})))},e.releaseAsset=function(t){Wx.tryRelease(t,!0)},e.releaseUnusedAssets=function(){Qp.forEach((function(t){Wx.tryRelease(t)}))},e.releaseAll=function(){Qp.forEach((function(t){Wx.tryRelease(t,!0)}))},e.loadWithJson=function(){throw new Error("Only valid in Editor")},n(t,[{key:"files",get:function(){return this._files}},{key:"main",get:function(){return Zp.get("main")||null}},{key:"resources",get:function(){return Zp.get("resources")||null}}],[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}());uT._instance=void 0,uT.Pipeline=Yp,uT.Task=rm,uT.Cache=Xp,uT.RequestItem=eT,uT.Bundle=rw,uT.BuiltinBundleName={INTERNAL:"internal",RESOURCES:"resources",MAIN:"main",START_SCENE:"start-scene"},uT.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},uT.Downloader=bw,uT.Parser=Qw,uT.DependUtil=vv;var lT=t("ed",C.assetManager=uT.instance);C.AssetManager=uT;var cT,fT,dT=t("ek",function(){function t(){this._resources={},this._materialsToBeCompiled=[]}var e=t.prototype;return e.init=function(){for(var t=this._resources,e=new Uint8Array(16),i=new Uint8Array(16),n=new Uint8Array(16),r=new Uint8Array(16),s=new Uint8Array(16),a=0,o=0;o<4;o++)e[a]=0,e[a+1]=0,e[a+2]=0,e[a+3]=255,i[a]=0,i[a+1]=0,i[a+2]=0,i[a+3]=0,n[a]=119,n[a+1]=119,n[a+2]=119,n[a+3]=255,r[a]=255,r[a+1]=255,r[a+2]=255,r[a+3]=255,s[a]=127,s[a+1]=127,s[a+2]=255,s[a+3]=255,a+=4;var h=new Uint8Array(1024);a=0;for(var u=0;u<256;u++)h[a]=221,h[a+1]=221,h[a+2]=221,h[a+3]=255,a+=4;a=0;for(var l=0;l<8;l++){for(var c=0;c<8;c++)h[a]=85,h[a+1]=85,h[a+2]=85,h[a+3]=255,a+=4;a+=32}a+=32;for(var f=0;f<8;f++){for(var d=0;d<8;d++)h[a]=85,h[a+1]=85,h[a+2]=85,h[a+3]=255,a+=4;a+=32}var _={width:2,height:2,_data:e,_compressed:!1,format:35},p={width:2,height:2,_data:i,_compressed:!1,format:35},m={width:2,height:2,_data:n,_compressed:!1,format:35},g={width:2,height:2,_data:r,_compressed:!1,format:35},v={width:2,height:2,_data:s,_compressed:!1,format:35},y={width:16,height:16,_data:h,_compressed:!1,format:35},b=new Gm(_),S=new Pv;S._uuid="black-texture",S.image=b,t[S._uuid]=S;var x=new Gm(p),w=new Pv;w._uuid="empty-texture",w.image=x,t[w._uuid]=w;var T=new eb;T._uuid="black-cube-texture",T.setMipFilter(1),T.image={front:new Gm(_),back:new Gm(_),left:new Gm(_),right:new Gm(_),top:new Gm(_),bottom:new Gm(_)},t[T._uuid]=T;var A=new Gm(m),D=new Pv;D._uuid="grey-texture",D.image=A,t[D._uuid]=D;var I=new eb;I._uuid="grey-cube-texture",I.setMipFilter(1),I.image={front:new Gm(m),back:new Gm(m),left:new Gm(m),right:new Gm(m),top:new Gm(m),bottom:new Gm(m)},t[I._uuid]=I;var B=new Gm(g),M=new Pv;M._uuid="white-texture",M.image=B,t[M._uuid]=M;var P=new eb;P._uuid="white-cube-texture",P.setMipFilter(1),P.image={front:new Gm(g),back:new Gm(g),left:new Gm(g),right:new Gm(g),top:new Gm(g),bottom:new Gm(g)},t[P._uuid]=P;var E=new Gm(v),k=new Pv;k._uuid="normal-texture",k.image=E,t[k._uuid]=k;var R=new Gm(y),O=new Pv;O._uuid="default-texture",O.image=R,t[O._uuid]=O;var F=new eb;if(F.setMipFilter(1),F._uuid="default-cube-texture",F.image={front:new Gm(y),back:new Gm(y),left:new Gm(y),right:new Gm(y),top:new Gm(y),bottom:new Gm(y)},t[F._uuid]=F,C.SpriteFrame){var L=new C.SpriteFrame,V=b,N=new Pv;N.image=V,L.texture=N,L._uuid="default-spriteframe",t[L._uuid]=L}},e.addAsset=function(t,e){this._resources[t]=e},e.get=function(t){return this._resources[t]},e.loadBuiltinAssets=function(){var t=this,e=ze.querySettings("engine","builtinAssets");if(!e)return Promise.resolve();var i=this._resources;return new Promise((function(n,r){lT.loadBundle("internal",(function(s){s?r(s):lT.loadAny(e,(function(e,s){e?r(e):(s.forEach((function(e){i[e.name]=e,Wx.addIgnoredAsset(e),e instanceof C.Material&&t._materialsToBeCompiled.push(e)})),n())}))}))}))},e.compileBuiltinMaterial=function(){for(var t=0;t=1024)&&m.lightingMap.objectID===o.objectID&&m.useReflectionProbeType===l&&m.reflectionProbeCubemap.objectID===h.objectID&&m.reflectionProbePlanarMap.objectID===u.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=c,m.descriptorSet=f,m.data.set(n.buffer,m.stride*m.count++),void(this.hasPendingModels=!0)}}for(var y=this._device.createBuffer(new h_(10,3,32*r,r)),b=new Uint8Array(32*r),S=s.vertexBuffers.slice(),x=s.attributes.slice(),w=s.indexBuffer,T=0;T>2,s=this._getBlockView(n,i),a=KS(t),o=0;o>2)*s,l=0;l+h.length<=u;l+=h.length)a.set(h,r+l);this._rootBufferDirty=!0}},e.resetTexture=function(t,e){var i=this.getHandle(t);if(i){var n,r=YS(i),s=QS(i),a=this._properties[t],o=a&&a.value,h=(n="string"==typeof o?_T.get(""+o+rx(r)):o||_T.get(nx(r)))&&n.getGFXTexture(),u=a&&void 0!==a.samplerHash?Ep.unpackFromHash(a.samplerHash):n&&n.getSamplerInfo(),l=this._device.getSampler(u);this._descriptorSet.bindSampler(s,l,e||0),this._descriptorSet.bindTexture(s,h,e||0)}},e.resetUBOs=function(){for(var t=0;t>2)*r.count,u=0;u+o.length<=h;u+=o.length)s.set(o,i+u);i+=h}this._rootBufferDirty=!0},e.resetTextures=function(){var t=this;if(C.rendering)this._shaderInfo.descriptors[1].samplerTextures.forEach((function(e){for(var i=0;i=0;--e)if(t[e].window.swapchain)return}ET._PSOHashMap=new Map,new i_,new Qd;var OT=new Vn,FT=t("e8",(wT=Qh("cc.Material"),TT=Eu(kx),wT((AT=function(t){function e(e){var i;return(i=t.call(this,e)||this)._effectAsset=DT&&DT(),i._techIdx=IT&&IT(),i._defines=BT&&BT(),i._states=MT&&MT(),i._props=PT&&PT(),i._passes=[],i._hash=0,i}s(e,t),e.getHash=function(t){for(var e,i=0,n=p(t.passes);!(e=n()).done;)i^=e.value.hash;return i};var i=e.prototype;return i.initialize=function(t){this._passes.length?at(12005):(this._defines||(this._defines=[]),this._states||(this._states=[]),this._props||(this._props=[]),this._fillInfo(t),this._update())},i.reset=function(t){this.initialize(t)},i.destroy=function(){return this._doDestroy(),t.prototype.destroy.call(this)},i.recompileShaders=function(){at(16370,this.name)},i.overridePipelineStates=function(){at(16371,this.name)},i.onLoaded=function(){this._update()},i.resetUniforms=function(t){void 0===t&&(t=!0),this._props.length=this._passes.length;for(var e=0;e=this._passes.length&&at(16372,i);var h=this._passes[i];this._uploadProperty(h,t,e)&&(this._props[h.propertyIndex][t]=e,n=!0)}n||at(16373,t)},i.getProperty=function(t,e){if(void 0===e)for(var i=this._props,n=i.length,r=0;r=this._passes.length)return at(16372,e),null;var a=this._props[this._passes[e].propertyIndex];if(t in a)return a[t]}return null},i.copy=function(t,e){this._techIdx=t._techIdx,this._props.length=t._props.length;for(var i=0;i0},n(e,[{key:"effectAsset",get:function(){return this._effectAsset}},{key:"effectName",get:function(){return this._effectAsset?this._effectAsset.name:""}},{key:"technique",get:function(){return this._techIdx}},{key:"passes",get:function(){return this._passes}},{key:"hash",get:function(){return this._hash}},{key:"parent",get:function(){return null}},{key:"owner",get:function(){return null}}]),e}(Cm),DT=Nh(AT.prototype,"_effectAsset",[TT],(function(){return null})),IT=Nh(AT.prototype,"_techIdx",[hu],(function(){return 0})),BT=Nh(AT.prototype,"_defines",[hu],(function(){return[]})),MT=Nh(AT.prototype,"_states",[hu],(function(){return[]})),PT=Nh(AT.prototype,"_props",[hu],(function(){return[]})),CT=AT))||CT));C.Material=FT;var LT=Ee({Low_256x256:256,Medium_512x512:512,High_1024x1024:1024,Ultra_2048x2048:2048}),VT=Ee({Planar:0,ShadowMap:1}),NT=Ee({HARD:0,SOFT:1,SOFT_2X:2,SOFT_4X:3}),zT=Ee({LEVEL_1:1,LEVEL_2:2,LEVEL_3:3,LEVEL_4:4}),UT=Ee({NONE:1,RemoveDuplicates:2,DisableRotationFix:3}),GT=VT.ShadowMap+1,HT=function(){function t(){this.fixedSphere=new Ys(0,0,0,.01),this.maxReceived=4,this._matLight=new Qr,this._material=null,this._instancingMaterial=null,this._enabled=!1,this._type=GT,this._distance=0,this._planeBias=1,this._normal=new ir(0,1,0),this._shadowColor=new cr(0,0,0,76),this._size=new ds(1024,1024),this._shadowMapDirty=!1}var e=t.prototype;return e.getPlanarShader=function(t){this._material||(this._material=new FT,this._material.initialize({effectName:"pipeline/planar-shadow"}));var e=this._material.passes;return e.length>0?e[0].getShaderVariant(t):null},e.initialize=function(t){this._enabled=t.enabled,this._type=this.enabled?t.type:GT,this.normal=t.planeDirection,this.distance=t.planeHeight,this.planeBias=t.planeBias,this.shadowColor=t.shadowColor,this.maxReceived=t.maxReceived,t.shadowMapSize!==this._size.x&&(this.size.set(t.shadowMapSize,t.shadowMapSize),this._shadowMapDirty=!0)},e.activate=function(){if(this._enabled)if(this.type===VT.Planar)this._updatePlanarInfo();else{var t=C.director.root;t.pipeline.macros.CC_SHADOW_TYPE=2,t.onGlobalPipelineStateChanged()}else{var e=C.director.root;e.pipeline.macros.CC_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()}},e._updatePlanarInfo=function(){this._material||(this._material=new FT,this._material.initialize({effectName:"pipeline/planar-shadow"}));var t=C.director.root;t.pipeline.macros.CC_SHADOW_TYPE=1,t.onGlobalPipelineStateChanged()},e.destroy=function(){this._material&&this._material.destroy(),this._instancingMaterial&&this._instancingMaterial.destroy(),this.fixedSphere.destroy()},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,this.activate()}},{key:"type",get:function(){return this._type},set:function(t){this._type=this.enabled?t:GT,this.activate()}},{key:"normal",get:function(){return this._normal},set:function(t){ir.copy(this._normal,t)}},{key:"distance",get:function(){return this._distance},set:function(t){this._distance=t}},{key:"planeBias",get:function(){return this._planeBias},set:function(t){this._planeBias=t}},{key:"shadowColor",get:function(){return this._shadowColor},set:function(t){this._shadowColor=t}},{key:"size",get:function(){return this._size},set:function(t){this._size.set(t)}},{key:"shadowMapDirty",get:function(){return this._shadowMapDirty},set:function(t){this._shadowMapDirty=t}},{key:"matLight",get:function(){return this._matLight}},{key:"material",get:function(){return this._material}},{key:"instancingMaterial",get:function(){return this._instancingMaterial}}]),t}();HT.MAX_FAR=2e3,HT.COEFFICIENT_OF_EXPANSION=2*Math.sqrt(3),C.Shadows=HT;var WT=function(t){function e(e,i){var n;(n=t.call(this,e.root)||this)._dontNotify=!1,n._parent=e,n._owner=i,n._doInit(n._parent,!0),n._shaderInfo.blocks.forEach((function(t){var e=n._blocks[t.binding],i=n._parent.blocks[t.binding];e.set(i)})),n._rootBufferDirty=!0;var r=n._parent,s=n._descriptorSet;return n._shaderInfo.samplerTextures.forEach((function(t){for(var e=0;e0)for(var h=0;h=0&&s.node.getWritableComponents().splice(a,1)}}}function gB(t,e,i){if(!(e.length<=0))for(var n=null,r=0;r0){var h=o.pop();if(!h)continue;for(var u=0;u0){var g=p.pop();if(!g)return;for(var v=0;vMath.abs(e)?t:-e},e}(kB),VB=function(t){function e(e){var i;return(i=t.call(this)||this).up=e.up,i.down=e.down,i.left=e.left,i.right=e.right,i.xAxis=new LB({positive:i.right,negative:i.left}),i.yAxis=new LB({positive:i.up,negative:i.down}),i}return s(e,t),e.prototype.getValue=function(){return new ds(this.xAxis.getValue(),this.yAxis.getValue())},e}(RB);!function(t){function e(e){var i;return(i=t.call(this)||this).up=e.up,i.down=e.down,i.left=e.left,i.right=e.right,i.forward=e.forward,i.backward=e.backward,i.xAxis=new LB({positive:i.right,negative:i.left}),i.yAxis=new LB({positive:i.up,negative:i.down}),i.zAxis=new LB({positive:i.forward,negative:i.backward}),i}s(e,t),e.prototype.getValue=function(){return new ir(this.xAxis.getValue(),this.yAxis.getValue(),this.zAxis.getValue())}}(OB);var NB,zB=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(kB),UB=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(VB),GB=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(VB),HB=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(FB),WB=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(OB),jB=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(kB),qB="left",XB="right",YB=[];!function(t){t[t.HAND_LEFT=1]="HAND_LEFT",t[t.HAND_RIGHT=4]="HAND_RIGHT",t[t.AIM_LEFT=2]="AIM_LEFT",t[t.AIM_RIGHT=5]="AIM_RIGHT"}(NB||(NB={}));var QB,JB,KB,ZB,$B,tM=function(){function t(t){var e;this._deviceId=-1,this._connected=!1,this._webPoseState=((e={})[NB.HAND_LEFT]={position:ir.ZERO,orientation:kr.IDENTITY},e[NB.HAND_RIGHT]={position:ir.ZERO,orientation:kr.IDENTITY},e[NB.AIM_LEFT]={position:ir.ZERO,orientation:kr.IDENTITY},e[NB.AIM_RIGHT]={position:ir.ZERO,orientation:kr.IDENTITY},e),this._deviceId=t,this._initInputSource()}t._init=function(){Lo.hasFeature(Ro.EVENT_GAMEPAD)&&t._registerEvent()},t._on=function(e,i,n){t._eventTarget.on(e,i,n)},t._removeInputDevice=function(e){var i=t.all.findIndex((function(t){return t.deviceId===e}));-1!==i&&be(t.all,i)},t._getOrCreateInputDevice=function(e,i){var n=t.all.find((function(t){return t.deviceId===e}));return n||(n=new t(e),t.all.push(n)),n._connected=i,n},t._ensureDirectorDefined=function(e){t._intervalId=setInterval((function(){A.director&&A.Director&&(clearInterval(t._intervalId),t._intervalId=-1,e())}),50)},t._updateGamepadCnt=function(){for(var e=0,i=0,n=t._cachedWebGamepads.length;i.01){a=t._getOrCreateInputDevice(r.index,!0);break}}if(a){e.push(a);continue}for(var c=s.axes,f=0;f.01){a=t._getOrCreateInputDevice(r.index,!0);break}}if(a){e.push(a);continue}}}}t._cachedWebGamepads=i}}},t._scanGamepads=function(){YB.length=0,t._scanWebGamepads(YB),t._scanWebXRGamepads(YB);for(var e=0;e0?{negative:0,positive:e}:t<0?{negative:e,positive:0}:{negative:0,positive:0}},e._updateWebPoseState=function(t){t.code!==NB.HAND_LEFT&&t.code!==NB.AIM_LEFT&&t.code!==NB.HAND_RIGHT&&t.code!==NB.AIM_RIGHT||(this._webPoseState[t.code]={position:new ir(t.position.x,t.position.y,t.position.z),orientation:new kr(t.orientation.x,t.orientation.y,t.orientation.z,t.orientation.w)})},e._initInputSource=function(){var e=this;this._buttonNorth=new zB,this._buttonNorth.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get(qB);return n&&n.buttons.length>5?n.buttons[5].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[3].value:0},this._buttonEast=new zB,this._buttonEast.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get(XB);return n&&n.buttons.length>5?n.buttons[5].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[1].value:0},this._buttonWest=new zB,this._buttonWest.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get(qB);return n&&n.buttons.length>4?n.buttons[4].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[2].value:0},this._buttonSouth=new zB,this._buttonSouth.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get(XB);return n&&n.buttons.length>4?n.buttons[4].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[0].value:0},this._buttonL1=new zB,this._buttonL1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[4].value:0},this._buttonL2=new zB,this._buttonL2.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get(qB);return n&&n.buttons.length>0?n.buttons[0].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[6].value:0},this._buttonL3=new zB,this._buttonL3.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get(qB);if(n){if(n.buttons.length>3&&0!==n.buttons[3].value)return n.buttons[3].value;if(n.buttons.length>2&&0!==n.buttons[2].value)return n.buttons[2].value}return 0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[10].value:0},this._buttonR1=new zB,this._buttonR1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[5].value:0},this._buttonR2=new zB,this._buttonR2.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get(XB);return n&&n.buttons.length>0?n.buttons[0].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[7].value:0},this._buttonR3=new zB,this._buttonR3.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get(XB);if(n){if(n.buttons.length>3&&0!==n.buttons[3].value)return n.buttons[3].value;if(n.buttons.length>2&&0!==n.buttons[2].value)return n.buttons[2].value}return 0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[11].value:0},this._buttonShare=new zB,this._buttonShare.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[8].value:0},this._buttonOptions=new zB,this._buttonOptions.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[9].value:0};var i=new zB;i.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[12].value:0};var n=new zB;n.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[13].value:0};var r=new zB;r.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[14].value:0};var s=new zB;s.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[15].value:0},this._dpad=new UB({up:i,down:n,left:r,right:s});var a=new zB;a.getValue=function(){if(-1===e.deviceId)return 0;var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[1]).negative:0};var o=new zB;o.getValue=function(){if(-1===e.deviceId)return 0;var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[1]).positive:0};var h=new zB;h.getValue=function(){if(-1===e.deviceId)return 0;var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[0]).negative:0};var u=new zB;u.getValue=function(){if(-1===e.deviceId)return 0;var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[0]).positive:0},this._leftStick=new GB({up:a,down:o,left:h,right:u});var l=new zB;l.getValue=function(){if(-1===e.deviceId)return 0;var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[3]).negative:0};var c=new zB;c.getValue=function(){if(-1===e.deviceId)return 0;var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[3]).positive:0};var f=new zB;f.getValue=function(){if(-1===e.deviceId)return 0;var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[2]).negative:0};var d=new zB;d.getValue=function(){if(-1===e.deviceId)return 0;var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[2]).positive:0},this._rightStick=new GB({up:l,down:c,left:f,right:d}),this._buttonStart=new zB,this._buttonStart.getValue=function(){return 0},this._gripLeft=new zB,this._gripLeft.getValue=function(){return e.deviceId,0},this._gripRight=new zB,this._gripRight.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get(XB);if(n&&n.buttons.length>1)return n.buttons[1].value}return 0},this._handLeftPosition=new WB,this._handLeftPosition.getValue=function(){return e._webPoseState[NB.HAND_LEFT].position},this._handLeftOrientation=new HB,this._handLeftOrientation.getValue=function(){return e._webPoseState[NB.HAND_LEFT].orientation},this._handRightPosition=new WB,this._handRightPosition.getValue=function(){return e._webPoseState[NB.HAND_RIGHT].position},this._handRightOrientation=new HB,this._handRightOrientation.getValue=function(){return e._webPoseState[NB.HAND_RIGHT].orientation},this._aimLeftPosition=new WB,this._aimLeftPosition.getValue=function(){return e._webPoseState[NB.AIM_LEFT].position},this._aimLeftOrientation=new HB,this._aimLeftOrientation.getValue=function(){return e._webPoseState[NB.AIM_LEFT].orientation},this._aimRightPosition=new WB,this._aimRightPosition.getValue=function(){return e._webPoseState[NB.AIM_RIGHT].position},this._aimRightOrientation=new HB,this._aimRightOrientation.getValue=function(){return e._webPoseState[NB.AIM_RIGHT].orientation}},n(t,[{key:"buttonNorth",get:function(){return this._buttonNorth}},{key:"buttonEast",get:function(){return this._buttonEast}},{key:"buttonWest",get:function(){return this._buttonWest}},{key:"buttonSouth",get:function(){return this._buttonSouth}},{key:"buttonL1",get:function(){return this._buttonL1}},{key:"buttonL2",get:function(){return this._buttonL2}},{key:"buttonL3",get:function(){return this._buttonL3}},{key:"buttonR1",get:function(){return this._buttonR1}},{key:"buttonR2",get:function(){return this._buttonR2}},{key:"buttonR3",get:function(){return this._buttonR3}},{key:"buttonShare",get:function(){return this._buttonShare}},{key:"buttonOptions",get:function(){return this._buttonOptions}},{key:"dpad",get:function(){return this._dpad}},{key:"leftStick",get:function(){return this._leftStick}},{key:"rightStick",get:function(){return this._rightStick}},{key:"buttonStart",get:function(){return this._buttonStart}},{key:"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}}]),t}();tM.all=[],tM.xr=null,tM._eventTarget=new Io,tM._cachedWebGamepads=[],tM._cachedWebXRGamepadMap=null,tM._intervalId=-1,tM._totalGamepadCnt=0,function(t){t[t.BUTTON_EAST=0]="BUTTON_EAST",t[t.BUTTON_SOUTH=1]="BUTTON_SOUTH",t[t.BUTTON_WEST=2]="BUTTON_WEST",t[t.BUTTON_NORTH=3]="BUTTON_NORTH",t[t.BUTTON_TRIGGER_LEFT=4]="BUTTON_TRIGGER_LEFT",t[t.BUTTON_TRIGGER_RIGHT=5]="BUTTON_TRIGGER_RIGHT",t[t.TRIGGER_LEFT=6]="TRIGGER_LEFT",t[t.TRIGGER_RIGHT=7]="TRIGGER_RIGHT",t[t.GRIP_LEFT=8]="GRIP_LEFT",t[t.GRIP_RIGHT=9]="GRIP_RIGHT",t[t.BUTTON_LEFT_STICK=10]="BUTTON_LEFT_STICK",t[t.LEFT_STICK_UP=11]="LEFT_STICK_UP",t[t.LEFT_STICK_DOWN=12]="LEFT_STICK_DOWN",t[t.LEFT_STICK_LEFT=13]="LEFT_STICK_LEFT",t[t.LEFT_STICK_RIGHT=14]="LEFT_STICK_RIGHT",t[t.BUTTON_RIGHT_STICK=15]="BUTTON_RIGHT_STICK",t[t.RIGHT_STICK_UP=16]="RIGHT_STICK_UP",t[t.RIGHT_STICK_DOWN=17]="RIGHT_STICK_DOWN",t[t.RIGHT_STICK_LEFT=18]="RIGHT_STICK_LEFT",t[t.RIGHT_STICK_RIGHT=19]="RIGHT_STICK_RIGHT",t[t.ROKID_MENU=20]="ROKID_MENU",t[t.ROKID_START=21]="ROKID_START"}(QB||(QB={})),function(t){t[t.KET_CLICK=0]="KET_CLICK",t[t.KET_STICK=1]="KET_STICK",t[t.KET_GRAB=2]="KET_GRAB",t[t.KET_TOUCH=3]="KET_TOUCH"}(JB||(JB={})),function(t){t[t.UNDEFINE=0]="UNDEFINE",t[t.A=1]="A",t[t.B=2]="B",t[t.X=3]="X",t[t.Y=4]="Y",t[t.L1=5]="L1",t[t.R1=6]="R1",t[t.MINUS=7]="MINUS",t[t.PLUS=8]="PLUS",t[t.L3=9]="L3",t[t.R3=10]="R3",t[t.MENU=11]="MENU",t[t.START=12]="START",t[t.TRIGGER_LEFT=13]="TRIGGER_LEFT",t[t.TRIGGER_RIGHT=14]="TRIGGER_RIGHT"}(KB||(KB={})),function(t){t[t.UNDEFINE=0]="UNDEFINE",t[t.X=1]="X",t[t.Y=2]="Y",t[t.LEFT_STICK_X=3]="LEFT_STICK_X",t[t.LEFT_STICK_Y=4]="LEFT_STICK_Y",t[t.RIGHT_STICK_X=5]="RIGHT_STICK_X",t[t.RIGHT_STICK_Y=6]="RIGHT_STICK_Y",t[t.L2=7]="L2",t[t.R2=8]="R2",t[t.LEFT_GRIP=9]="LEFT_GRIP",t[t.RIGHT_GRIP=10]="RIGHT_GRIP"}(ZB||(ZB={})),function(t){t[t.UNDEFINE=0]="UNDEFINE",t[t.A=1]="A",t[t.B=2]="B",t[t.X=3]="X",t[t.Y=4]="Y",t[t.LEFT_TRIGGER=5]="LEFT_TRIGGER",t[t.RIGHT_TRIGGER=6]="RIGHT_TRIGGER",t[t.LEFT_THUMBSTICK=7]="LEFT_THUMBSTICK",t[t.RIGHT_THUMBSTICK=8]="RIGHT_THUMBSTICK"}($B||($B={}));var eM,iM={1:QB.BUTTON_EAST,2:QB.BUTTON_SOUTH,3:QB.BUTTON_NORTH,4:QB.BUTTON_WEST,9:QB.BUTTON_LEFT_STICK,10:QB.BUTTON_RIGHT_STICK,11:QB.ROKID_MENU,12:QB.ROKID_START,13:QB.BUTTON_TRIGGER_LEFT,14:QB.BUTTON_TRIGGER_RIGHT},nM=function(){function t(){var t,e,i=this;this._eventTarget=new Io,this._nativeButtonState=((t={})[QB.BUTTON_SOUTH]=0,t[QB.BUTTON_EAST]=0,t[QB.BUTTON_WEST]=0,t[QB.BUTTON_NORTH]=0,t[QB.BUTTON_TRIGGER_LEFT]=0,t[QB.BUTTON_TRIGGER_RIGHT]=0,t[QB.TRIGGER_LEFT]=0,t[QB.TRIGGER_RIGHT]=0,t[QB.GRIP_LEFT]=0,t[QB.GRIP_RIGHT]=0,t[QB.LEFT_STICK_UP]=0,t[QB.LEFT_STICK_DOWN]=0,t[QB.LEFT_STICK_LEFT]=0,t[QB.LEFT_STICK_RIGHT]=0,t[QB.RIGHT_STICK_UP]=0,t[QB.RIGHT_STICK_DOWN]=0,t[QB.RIGHT_STICK_LEFT]=0,t[QB.RIGHT_STICK_RIGHT]=0,t[QB.BUTTON_LEFT_STICK]=0,t[QB.BUTTON_RIGHT_STICK]=0,t[QB.ROKID_MENU]=0,t[QB.ROKID_START]=0,t),this._nativeTouchState=((e={})[$B.UNDEFINE]=0,e[$B.A]=0,e[$B.B]=0,e[$B.X]=0,e[$B.Y]=0,e[$B.LEFT_TRIGGER]=0,e[$B.RIGHT_TRIGGER]=0,e[$B.LEFT_THUMBSTICK]=0,e[$B.RIGHT_THUMBSTICK]=0,e),this._initInputSource(),window.addEventListener("xr-remote-input",(function(t){var e=t,n=e.detail.keyEventType,r=e.detail.stickAxisCode,s=e.detail.stickAxisValue,a=e.detail.stickKeyCode,o=e.detail.isButtonPressed,h=e.detail.touchCode,u=e.detail.touchValue;if(n===JB.KET_CLICK){var l=iM[a];i._nativeButtonState[l]=o?1:0}else if(n===JB.KET_STICK||n===JB.KET_GRAB){var c,f,d;switch(r){case ZB.LEFT_STICK_X:c=QB.LEFT_STICK_LEFT,f=QB.LEFT_STICK_RIGHT,d=i._axisToButtons(s);break;case ZB.LEFT_STICK_Y:c=QB.LEFT_STICK_DOWN,f=QB.LEFT_STICK_UP,d=i._axisToButtons(s);break;case ZB.RIGHT_STICK_X:c=QB.RIGHT_STICK_LEFT,f=QB.RIGHT_STICK_RIGHT,d=i._axisToButtons(s);break;case ZB.RIGHT_STICK_Y:c=QB.RIGHT_STICK_DOWN,f=QB.RIGHT_STICK_UP,d=i._axisToButtons(s);break;case ZB.L2:i._nativeButtonState[QB.TRIGGER_LEFT]=s;break;case ZB.R2:i._nativeButtonState[QB.TRIGGER_RIGHT]=s;break;case ZB.LEFT_GRIP:i._nativeButtonState[QB.GRIP_LEFT]=s;break;case ZB.RIGHT_GRIP:i._nativeButtonState[QB.GRIP_RIGHT]=s}c&&f&&d&&(i._nativeButtonState[c]=d.negative,i._nativeButtonState[f]=d.positive)}else if(n===JB.KET_TOUCH)switch(h){case $B.A:case $B.B:case $B.X:case $B.Y:case $B.LEFT_TRIGGER:case $B.RIGHT_TRIGGER:case $B.LEFT_THUMBSTICK:case $B.RIGHT_THUMBSTICK:i._nativeTouchState[h]=u}i._eventTarget.emit("handle-input",new Qv("handle-input",i))}))}var e=t.prototype;return e._axisToButtons=function(t){var e=Math.abs(t);return t>0?{negative:0,positive:e}:t<0?{negative:e,positive:0}:{negative:0,positive:0}},e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._initInputSource=function(){var t=this;this._buttonNorth=new zB,this._buttonNorth.getValue=function(){return t._nativeButtonState[QB.BUTTON_NORTH]},this._buttonEast=new zB,this._buttonEast.getValue=function(){return t._nativeButtonState[QB.BUTTON_EAST]},this._buttonWest=new zB,this._buttonWest.getValue=function(){return t._nativeButtonState[QB.BUTTON_WEST]},this._buttonSouth=new zB,this._buttonSouth.getValue=function(){return t._nativeButtonState[QB.BUTTON_SOUTH]},this._buttonTriggerLeft=new zB,this._buttonTriggerLeft.getValue=function(){return t._nativeButtonState[QB.BUTTON_TRIGGER_LEFT]},this._buttonTriggerRight=new zB,this._buttonTriggerRight.getValue=function(){return t._nativeButtonState[QB.BUTTON_TRIGGER_RIGHT]},this._triggerLeft=new zB,this._triggerLeft.getValue=function(){return t._nativeButtonState[QB.TRIGGER_LEFT]},this._triggerRight=new zB,this._triggerRight.getValue=function(){return t._nativeButtonState[QB.TRIGGER_RIGHT]},this._gripLeft=new zB,this._gripLeft.getValue=function(){return t._nativeButtonState[QB.GRIP_LEFT]},this._gripRight=new zB,this._gripRight.getValue=function(){return t._nativeButtonState[QB.GRIP_RIGHT]},this._buttonLeftStick=new zB,this._buttonLeftStick.getValue=function(){return t._nativeButtonState[QB.BUTTON_LEFT_STICK]};var e=new zB;e.getValue=function(){return t._nativeButtonState[QB.LEFT_STICK_UP]};var i=new zB;i.getValue=function(){return t._nativeButtonState[QB.LEFT_STICK_DOWN]};var n=new zB;n.getValue=function(){return t._nativeButtonState[QB.LEFT_STICK_LEFT]};var r=new zB;r.getValue=function(){return t._nativeButtonState[QB.LEFT_STICK_RIGHT]},this._leftStick=new GB({up:e,down:i,left:n,right:r}),this._buttonRightStick=new zB,this._buttonRightStick.getValue=function(){return t._nativeButtonState[QB.BUTTON_RIGHT_STICK]};var s=new zB;s.getValue=function(){return t._nativeButtonState[QB.RIGHT_STICK_UP]};var a=new zB;a.getValue=function(){return t._nativeButtonState[QB.RIGHT_STICK_DOWN]};var o=new zB;o.getValue=function(){return t._nativeButtonState[QB.RIGHT_STICK_LEFT]};var h=new zB;h.getValue=function(){return t._nativeButtonState[QB.RIGHT_STICK_RIGHT]},this._rightStick=new GB({up:s,down:a,left:o,right:h}),this._buttonOptions=new zB,this._buttonOptions.getValue=function(){return t._nativeButtonState[QB.ROKID_MENU]},this._buttonStart=new zB,this._buttonStart.getValue=function(){return t._nativeButtonState[QB.ROKID_START]},this._handLeftPosition=new WB,this._handLeftPosition.getValue=function(){return ir.ZERO},this._handLeftOrientation=new HB,this._handLeftOrientation.getValue=function(){return kr.IDENTITY},this._handRightPosition=new WB,this._handRightPosition.getValue=function(){return ir.ZERO},this._handRightOrientation=new HB,this._handRightOrientation.getValue=function(){return kr.IDENTITY},this._aimLeftPosition=new WB,this._aimLeftPosition.getValue=function(){return ir.ZERO},this._aimLeftOrientation=new HB,this._aimLeftOrientation.getValue=function(){return kr.IDENTITY},this._aimRightPosition=new WB,this._aimRightPosition.getValue=function(){return ir.ZERO},this._aimRightOrientation=new HB,this._aimRightOrientation.getValue=function(){return kr.IDENTITY},this._touchButtonA=new jB,this._touchButtonA.getValue=function(){return t._nativeTouchState[$B.A]},this._touchButtonB=new jB,this._touchButtonB.getValue=function(){return t._nativeTouchState[$B.B]},this._touchButtonX=new jB,this._touchButtonX.getValue=function(){return t._nativeTouchState[$B.X]},this._touchButtonY=new jB,this._touchButtonY.getValue=function(){return t._nativeTouchState[$B.Y]},this._touchButtonTriggerLeft=new jB,this._touchButtonTriggerLeft.getValue=function(){return t._nativeTouchState[$B.LEFT_TRIGGER]},this._touchButtonTriggerRight=new jB,this._touchButtonTriggerRight.getValue=function(){return t._nativeTouchState[$B.RIGHT_TRIGGER]},this._touchButtonThumbStickLeft=new jB,this._touchButtonThumbStickLeft.getValue=function(){return t._nativeTouchState[$B.LEFT_THUMBSTICK]},this._touchButtonThumbStickRight=new jB,this._touchButtonThumbStickRight.getValue=function(){return t._nativeTouchState[$B.RIGHT_THUMBSTICK]}},n(t,[{key:"buttonNorth",get:function(){return this._buttonNorth}},{key:"buttonEast",get:function(){return this._buttonEast}},{key:"buttonWest",get:function(){return this._buttonWest}},{key:"buttonSouth",get:function(){return this._buttonSouth}},{key:"buttonTriggerLeft",get:function(){return this._buttonTriggerLeft}},{key:"buttonTriggerRight",get:function(){return this._buttonTriggerRight}},{key:"triggerLeft",get:function(){return this._triggerLeft}},{key:"triggerRight",get:function(){return this._triggerRight}},{key:"gripLeft",get:function(){return this._gripLeft}},{key:"gripRight",get:function(){return this._gripRight}},{key:"leftStick",get:function(){return this._leftStick}},{key:"rightStick",get:function(){return this._rightStick}},{key:"buttonLeftStick",get:function(){return this._buttonLeftStick}},{key:"buttonRightStick",get:function(){return this._buttonRightStick}},{key:"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}}]),t}();!function(t){t[t.VIEW_LEFT=0]="VIEW_LEFT",t[t.VIEW_RIGHT=3]="VIEW_RIGHT",t[t.HEAD_MIDDLE=6]="HEAD_MIDDLE"}(eM||(eM={}));var rM,sM=function(){function t(){var t;this._eventTarget=new Io,this._intervalId=-1,this._webPoseState=((t={})[eM.VIEW_LEFT]={position:ir.ZERO,orientation:kr.IDENTITY},t[eM.VIEW_RIGHT]={position:ir.ZERO,orientation:kr.IDENTITY},t[eM.HEAD_MIDDLE]={position:ir.ZERO,orientation:kr.IDENTITY},t),this._initInputSource(),this._registerEvent()}var e=t.prototype;return e._ensureDirectorDefined=function(){var t=this;return new Promise((function(e){t._intervalId=setInterval((function(){A.director&&A.Director&&(clearInterval(t._intervalId),t._intervalId=-1,e())}),50)}))},e._registerEvent=function(){var t=this;this._ensureDirectorDefined().then((function(){A.director.on(A.Director.EVENT_BEGIN_FRAME,t._scanHmd,t)})).catch((function(){}))},e._scanHmd=function(){var t,e=null==(t=globalThis.__globalXR)?void 0:t.webxrHmdPoseInfos;if(e){for(var i=0;iUe.TOUCH_TIMEOUT&&(it(2302,t.getID()),e.releaseTouch(t.getID()))})),i>=this._touchMap.size},t}()),fM=function(){function t(){this._canvas=void 0,this._eventTarget=new Io,Lo.hasFeature(Ro.INPUT_TOUCH)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||Y("failed to access canvas"),this._registerEvent())}var e=t.prototype;return e._registerEvent=function(){var t,e,i,n;null==(t=this._canvas)||t.addEventListener("touchstart",this._createCallback("touch-start")),null==(e=this._canvas)||e.addEventListener("touchmove",this._createCallback("touch-move")),null==(i=this._canvas)||i.addEventListener("touchend",this._createCallback("touch-end")),null==(n=this._canvas)||n.addEventListener("touchcancel",this._createCallback("touch-cancel"))},e._createCallback=function(t){var e=this;return function(i){for(var n,r=e._getCanvasRect(),s=[],a=i.changedTouches.length,o=0;o0){var f=new Xv(s,!1,t,cM.getAllTouches());e._eventTarget.emit(t,f)}}},e._getCanvasRect=function(){var t=this._canvas,e=null==t?void 0:t.getBoundingClientRect();return e?new ys(e.x,e.y,e.width,e.height):new ys(0,0,0,0)},e._getLocation=function(t,e){var i=t.clientX-e.x,n=e.y+e.height-t.clientY;if(rh.isFrameRotated){var r=i;i=e.height-n,n=r}var s=rh.devicePixelRatio;return new ds(i*=s,n*=s)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},e.dispatchEventsInCache=function(){},t}(),dM=function(){function t(t){this.priority=0,this._inputEventTarget=t}var e=t.prototype;return e.onThrowException=function(){},e.dispatchEvent=function(t){return this._inputEventTarget.emit(t.type,t),!0},t}(),_M=((rM={})["mouse-down"]="touch-start",rM["mouse-move"]="touch-move",rM["mouse-up"]="touch-end",rM),pM=t("eB",function(){function t(){this._eventTarget=new Io,this._touchInput=new fM,this._mouseInput=new uM,this._keyboardInput=new hM,this._accelerometerInput=new PB,this._eventKeyboardList=[],this._eventAccelerationList=[],this._eventGamepadList=[],this._eventHandleList=[],this._eventHMDList=[],this._eventHandheldList=[],this._needSimulateTouchMoveEvent=!1,this._eventDispatcherList=[],this._handleInput=new nM,this._hmdInput=new sM,this._handheldInput=new aM,this._registerEvent(),this._inputEventDispatcher=new dM(this._eventTarget),this._registerEventDispatcher(this._inputEventDispatcher),tM._init()}var e=t.prototype;return e._dispatchMouseDownEvent=function(t){var e,i;null==(e=(i=this._mouseInput).dispatchMouseDownEvent)||e.call(i,t)},e._dispatchMouseMoveEvent=function(t){var e,i;null==(e=(i=this._mouseInput).dispatchMouseMoveEvent)||e.call(i,t)},e._dispatchMouseUpEvent=function(t){var e,i;null==(e=(i=this._mouseInput).dispatchMouseUpEvent)||e.call(i,t)},e._dispatchMouseScrollEvent=function(t){var e,i;null==(e=(i=this._mouseInput).dispatchScrollEvent)||e.call(i,t)},e._dispatchKeyboardDownEvent=function(t){var e,i;null==(e=(i=this._keyboardInput).dispatchKeyboardDownEvent)||e.call(i,t)},e._dispatchKeyboardUpEvent=function(t){var e,i;null==(e=(i=this._keyboardInput).dispatchKeyboardUpEvent)||e.call(i,t)},e.on=function(t,e,i){return this._eventTarget.on(t,e,i),e},e.once=function(t,e,i){return this._eventTarget.once(t,e,i),e},e.off=function(t,e,i){this._eventTarget.off(t,e,i)},e.getTouch=function(t){return cM.getTouch(t)},e.getAllTouches=function(){return cM.getAllTouches()},e.getTouchCount=function(){return cM.getTouchCount()},e.setAccelerometerEnabled=function(t){t?this._accelerometerInput.start():this._accelerometerInput.stop()},e.setAccelerometerInterval=function(t){this._accelerometerInput.setInterval(t)},e._simulateEventTouch=function(t){var e=_M[t.type],i=cM.getOrCreateTouch(0,t.getLocationX(),t.getLocationY());if(i){var n=[i],r=new Xv(n,!1,e,"touch-end"===e?[]:n);r.windowId=t.windowId,"touch-end"===e&&cM.releaseTouch(0),this._dispatchEventTouch(r)}},e._registerEventDispatcher=function(t){this._eventDispatcherList.push(t),this._eventDispatcherList.sort((function(t,e){return e.priority-t.priority}))},e._emitEvent=function(t){for(var e=this._eventDispatcherList.length,i=0;i8?ht(12004,8):(this._passes=t,this._flushPassInfo(),this._descriptorSet&&(this._descriptorSet.destroy(),RM.layout=t[0].localSetLayout,this._descriptorSet=this._device.createDescriptorSet(RM)))}},{key:"shaders",get:function(){return this._shaders}},{key:"subMesh",get:function(){return this._subMesh},set:function(t){this._inputAssembler.destroy(),this._inputAssembler=this._device.createInputAssembler(t.iaInfo),this._subMesh=t}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"inputAssembler",get:function(){return this._inputAssembler}},{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"worldBoundDescriptorSet",get:function(){return this._worldBoundDescriptorSet}},{key:"patches",get:function(){return this._patches}},{key:"instancedAttributeBlock",get:function(){return this._instancedAttributeBlock}},{key:"instancedWorldMatrixIndex",get:function(){return this._instancedWorldMatrixIndex},set:function(t){this._instancedWorldMatrixIndex=t}},{key:"instancedSHIndex",get:function(){return this._instancedSHIndex},set:function(t){this._instancedSHIndex=t}},{key:"useReflectionProbeType",get:function(){return this._useReflectionProbeType},set:function(t){this._useReflectionProbeType=t}}]),t}(),FM=new Qr,LM=[{name:"CC_RECEIVE_SHADOW",value:!0}],VM=[{name:"CC_USE_LIGHTMAP",value:1}],NM=[{name:"CC_USE_LIGHTMAP",value:2}],zM=[{name:"CC_LIGHT_MAP_VERSION",value:2}],UM=[{name:"CC_USE_LIGHT_PROBE",value:!0}],GM=new p_(2,2,0,2,2,2),HM=new p_(2,2,2,2,2,2),WM=function(){function t(){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=Nn(),this._tetrahedronIndex=-1,this._lastWorldBoundCenter=nr(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=Fv.Enum.NONE,this._priority=0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=0,this._device=Hp.gfxDevice}var e=t.prototype;return e.initialize=function(){this._inited||(this._receiveShadow=!0,this.castShadow=!1,this.enabled=!0,this.visFlags=Fv.Enum.NONE,this._inited=!0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=0)},e.destroy=function(){for(var t=this._subModels,e=0;e=0?h.updateInstancedWorldMatrix(s,u):a=!0}(a||r)&&this._localBuffer&&(Qr.toArray(this._localData,s,0),Qr.invert(FM,s),Qr.transpose(FM,FM),Qr.toArray(this._localData,FM,16),this._localBuffer.update(this._localData))}},e.invalidateLocalData=function(){this._localDataUpdated=!0},e.showTetrahedron=function(){return this.isLightProbeAvailable()},e.isLightProbeAvailable=function(){if(!this._useLightProbe)return!1;var t=nb().lightProbes;return!(!t||t.empty()||!this._worldBounds)},e.updateSHBuffer=function(){if(this._localSHData){for(var t=this._subModels,e=!1,i=0;i=0?n.updateInstancedSH(this._localSHData,r):e=!0}e&&this._localSHBuffer&&this._localSHBuffer.update(this._localSHData)}},e.clearSHUBOs=function(){if(this._localSHData){for(var t=0;t<28;t++)this._localSHData[t]=0;this.updateSHBuffer()}},e.updateSHUBOs=function(){if(this.isLightProbeAvailable()){var t=this._worldBounds.center;if(!t.equals(this._lastWorldBoundCenter,Ji)){var e=[],i=new Vn,n=C.director.root.pipeline.pipelineSceneData.lightProbes;if(this._lastWorldBoundCenter.set(t),this._tetrahedronIndex=n.data.getInterpolationWeights(t,this._tetrahedronIndex,i),n.data.getInterpolationSHCoefficients(this._tetrahedronIndex,i,e)&&this._localSHData){var r=C.internal.SH;r.reduceRinging(e,n.reduceRinging),r.updateUBOData(this._localSHData,0,e),this.updateSHBuffer()}}}},e.createBoundingShape=function(t,e){t&&e&&(this._modelBounds||(this._modelBounds=mh.create()),this._worldBounds||(this._worldBounds=mh.create()),mh.fromPoints(this._modelBounds,t,e),this._worldBounds.copy(this._modelBounds))},e._createSubModel=function(){return new OM},e.initSubModel=function(t,e,i){this.initialize(),null==this._subModels[t]?this._subModels[t]=this._createSubModel():this._subModels[t].destroy(),this._subModels[t].initialize(e,i.passes,this.getMacroPatches(t)),this._updateAttributesAndBinding(t)},e.setSubModelMesh=function(t,e){this._subModels[t]&&(this._subModels[t].subMesh=e)},e.setSubModelMaterial=function(t,e){this._subModels[t]&&(this._subModels[t].passes=e.passes,this._updateAttributesAndBinding(t))},e.onGlobalPipelineStateChanged=function(){for(var t=this._subModels,e=0;e1?HM:GM),r=this._subModels,s=0;s15e3&&(e=15e3);var i=e*e,n=(.860117757+.000154118254*e+1.28641212e-7*i)/(1+.000842420235*e+7.08145163e-7*i),r=(.317398726+422806245e-13*e+4.20481691e-8*i)/(1-289741816e-13*e+1.61456053e-7*i),s=2*n-8*r+4,a=3*n/s,o=2*r/s,h=1/o*a,u=1/o*(1-a-o);t.x=3.2404542*h-1.5371385+-.4985314*u,t.y=-.969266*h+1.8760108+.041556*u,t.z=.0556434*h-.2040259+1.0572252*u}var YM,QM={DIRECTIONAL:0,SPHERE:1,SPOT:2,POINT:3,RANGED_DIRECTIONAL:4,UNKNOWN:5},JM=function(t){return 4*Math.PI*Math.PI*t*t},KM=function(){function t(){this._baked=!1,this._color=nr(1,1,1),this._colorTemp=6550,this._colorTempRGB=nr(1,1,1),this._finalColor=nr(1,1,1),this._scene=null,this._node=null,this._name=null,this._useColorTemperature=!1,this._type=5,this._visibility=LS}var e=t.prototype;return e.initialize=function(){this.color=nr(1,1,1),this.colorTemperature=6550},e.attachToScene=function(t){this._scene=t},e.detachFromScene=function(){this._scene=null},e.destroy=function(){this._name=null,this._node=null},e.update=function(){},n(t,[{key:"baked",get:function(){return this._baked},set:function(t){this._baked=t}},{key:"color",get:function(){return this._color},set:function(t){this._color.set(t),this._useColorTemperature&&ir.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"useColorTemperature",get:function(){return this._useColorTemperature},set:function(t){this._useColorTemperature=t,t&&ir.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"colorTemperature",get:function(){return this._colorTemp},set:function(t){this._colorTemp=t,XM(this._colorTempRGB,this._colorTemp),this._useColorTemperature&&ir.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(t){this._visibility=t}},{key:"node",get:function(){return this._node},set:function(t){this._node=t,this._node&&(this._node.hasChangedFlags|=2)}},{key:"type",get:function(){return this._type}},{key:"name",get:function(){return this._name},set:function(t){this._name=t}},{key:"scene",get:function(){return this._scene}}]),t}(),ZM=new ir(0,0,-1),$M=new ir,tP=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new ir(1,-1,-1),e._illuminanceHDR=vb.SUN_ILLUM,e._illuminanceLDR=1,e._shadowEnabled=!1,e._shadowPcf=NT.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._shadowSaturation=1,e._shadowDistance=50,e._shadowInvisibleOcclusionRange=200,e._csmLevel=zT.LEVEL_4,e._csmNeedUpdate=!1,e._csmLayerLambda=.75,e._csmOptimizationMode=UT.DisableRotationFix,e._csmLayersTransition=!1,e._csmTransitionRange=.05,e._shadowFixedArea=!1,e._shadowNear=.1,e._shadowFar=10,e._shadowOrthoSize=5,e._type=0,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.illuminance=vb.SUN_ILLUM,this.direction=new ir(1,-1,-1)},i.update=function(){this._node&&this._node.hasChangedFlags&&(this.direction=ir.transformQuat($M,ZM,this._node.worldRotation))},i.activate=function(){var t=C.director.root,e=t.pipeline;this._shadowEnabled?(this._shadowFixedArea||!e.pipelineSceneData.csmSupported?e.macros.CC_DIR_LIGHT_SHADOW_TYPE=1:this.csmLevel>1&&e.pipelineSceneData.csmSupported?(e.macros.CC_DIR_LIGHT_SHADOW_TYPE=2,e.macros.CC_CASCADED_LAYERS_TRANSITION=this._csmLayersTransition):e.macros.CC_DIR_LIGHT_SHADOW_TYPE=1,e.macros.CC_DIR_SHADOW_PCF_TYPE=this._shadowPcf):e.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,t.onGlobalPipelineStateChanged()},n(e,[{key:"direction",get:function(){return this._dir},set:function(t){ir.normalize(this._dir,t)}},{key:"illuminance",get:function(){return nb().isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){nb().isHDR?this.illuminanceHDR=t:this.illuminanceLDR=t}},{key:"illuminanceHDR",get:function(){return this._illuminanceHDR},set:function(t){this._illuminanceHDR=t}},{key:"illuminanceLDR",get:function(){return this._illuminanceLDR},set:function(t){this._illuminanceLDR=t}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t,this.activate()}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t,this.activate()}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t}},{key:"shadowSaturation",get:function(){return this._shadowSaturation},set:function(t){this._shadowSaturation=t}},{key:"shadowDistance",get:function(){return this._shadowDistance},set:function(t){this._shadowDistance=Math.min(t,HT.MAX_FAR)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(t){this._shadowInvisibleOcclusionRange=Math.min(t,HT.MAX_FAR)}},{key:"csmLevel",get:function(){return this._csmLevel},set:function(t){this._csmLevel=t,this.activate()}},{key:"csmNeedUpdate",get:function(){return this._csmNeedUpdate},set:function(t){this._csmNeedUpdate=t}},{key:"csmLayerLambda",get:function(){return this._csmLayerLambda},set:function(t){this._csmLayerLambda=t}},{key:"csmOptimizationMode",get:function(){return this._csmOptimizationMode},set:function(t){this._csmOptimizationMode=t}},{key:"shadowFixedArea",get:function(){return this._shadowFixedArea},set:function(t){this._shadowFixedArea=t,this.activate()}},{key:"shadowNear",get:function(){return this._shadowNear},set:function(t){this._shadowNear=t}},{key:"shadowFar",get:function(){return this._shadowFar},set:function(t){this._shadowFar=Math.min(t,HT.MAX_FAR)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(t){this._shadowOrthoSize=t}},{key:"csmLayersTransition",get:function(){return this._csmLayersTransition},set:function(t){this._csmLayersTransition=t,this.activate()}},{key:"csmTransitionRange",get:function(){return this._csmTransitionRange},set:function(t){this._csmTransitionRange=t}}]),e}(KM),eP=function(t){function e(){var e;return(e=t.call(this)||this)._needUpdate=!1,e._size=.15,e._range=1,e._luminanceHDR=0,e._luminanceLDR=0,e._pos=new ir,e._aabb=mh.create(),e._type=1,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.range=1,this.luminanceHDR=1700/JM(.15),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;mh.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,t,t,t),this._needUpdate=!1}},n(e,[{key:"position",get:function(){return this._pos}},{key:"size",get:function(){return this._size},set:function(t){this._size=t}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._needUpdate=!0}},{key:"luminance",get:function(){return nb().isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){nb().isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",set:function(t){this._luminanceLDR=t}},{key:"aabb",get:function(){return this._aabb}}]),e}(KM),iP=new ir(0,0,-1),nP=new kr,rP=new Qr,sP=new Qr,aP=new Qr,oP=new Qr,hP=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new ir(1,-1,-1),e._range=5,e._spotAngle=Math.cos(Math.PI/6),e._angleAttenuationStrength=0,e._pos=new ir,e._aabb=mh.create(),e._frustum=Ah.create(),e._angle=0,e._needUpdate=!1,e._size=.15,e._luminanceHDR=0,e._luminanceLDR=0,e._shadowEnabled=!1,e._shadowPcf=NT.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._type=2,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.luminanceHDR=1700/JM(.15),this.luminanceLDR=1,this.range=Math.cos(Math.PI/6),this._dir.set(new ir(1,-1,-1))},i.update=function(){this._node&&(this._node.hasChangedFlags||this._needUpdate)&&(this._node.getWorldPosition(this._pos),ir.transformQuat(this._dir,iP,this._node.getWorldRotation(nP)),ir.normalize(this._dir,this._dir),mh.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,this._range,this._range,this._range),this._node.getWorldRT(rP),Qr.invert(rP,rP),Qr.perspective(sP,this._angle,1,.001,this._range),Qr.multiply(aP,sP,rP),this._frustum.update(aP,oP),this._needUpdate=!1)},n(e,[{key:"position",get:function(){return this._pos}},{key:"size",get:function(){return this._size},set:function(t){this._size=t}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._needUpdate=!0}},{key:"luminance",get:function(){return nb().isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){nb().isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",get:function(){return this._luminanceLDR},set:function(t){this._luminanceLDR=t}},{key:"direction",get:function(){return this._dir}},{key:"spotAngle",get:function(){return this._spotAngle},set:function(t){this._angle=t,this._spotAngle=Math.cos(.5*t),this._needUpdate=!0}},{key:"angleAttenuationStrength",get:function(){return this._angleAttenuationStrength},set:function(t){this._angleAttenuationStrength=t,this._needUpdate=!0}},{key:"angle",get:function(){return this._angle}},{key:"aabb",get:function(){return this._aabb}},{key:"frustum",get:function(){return this._frustum}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t}}]),e}(KM),uP=function(t){function e(){var e;return(e=t.call(this)||this)._needUpdate=!1,e._range=1,e._luminanceHDR=0,e._luminanceLDR=0,e._pos=nr(),e._aabb=mh.create(),e._type=3,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.range=1,this.luminanceHDR=1700/JM(1),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;mh.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,t,t,t),this._needUpdate=!1}},n(e,[{key:"position",get:function(){return this._pos}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._needUpdate=!0}},{key:"luminance",get:function(){return nb().isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){nb().isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",set:function(t){this._luminanceLDR=t}},{key:"aabb",get:function(){return this._aabb}}]),e}(KM),lP=new ir(0,0,-1),cP=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new ir(0,0,-1),e._pos=new ir(0,0,0),e._scale=new ir(1,1,1),e._right=new ir(1,0,0),e._illuminanceHDR=vb.SUN_ILLUM,e._illuminanceLDR=1,e._type=4,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.illuminance=vb.SUN_ILLUM},i.update=function(){this._node&&this._node.hasChangedFlags&&(this._node.getWorldPosition(this._pos),this._node.getWorldScale(this._scale),ir.transformQuat(this._dir,lP,this._node.worldRotation),ir.transformQuat(this._right,ir.RIGHT,this._node.worldRotation))},n(e,[{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 nb().isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){nb().isHDR?this.illuminanceHDR=t:this.illuminanceLDR=t}},{key:"illuminanceHDR",get:function(){return this._illuminanceHDR},set:function(t){this._illuminanceHDR=t}},{key:"illuminanceLDR",get:function(){return this._illuminanceLDR},set:function(t){this._illuminanceLDR=t}}]),e}(KM),fP=new I_;fP.format=35;var dP=new B_;dP.format=55;var _P=new E_([fP],dP),pP={width:1,height:1,renderPassInfo:_P},mP=t("e9",Qh("cc.RenderTexture")(YM=function(t){function e(e){var i;return(i=t.call(this,e)||this)._window=null,i}s(e,t);var i=e.prototype;return i.initialize=function(t){this._name=t.name||"",this._width=t.width,this._height=t.height,this._initWindow(t)},i.reset=function(t){this.initialize(t)},i.destroy=function(){if(this._window){var e=C.director.root;null==e||e.destroyWindow(this._window),this._window=null}return t.prototype.destroy.call(this)},i.resize=function(t,e){this._width=Math.floor($i(t,1,2048)),this._height=Math.floor($i(e,1,2048)),this._window&&this._window.resize(this._width,this._height),this.emit("resize",this._window)},i._serialize=function(){return{}},i._deserialize=function(e,i){var n=e;this._width=n.w,this._height=n.h,this._name=n.n,t.prototype._deserialize.call(this,n.base,i)},i.getGFXTexture=function(){return this._window&&this._window.framebuffer.colorTextures[0]},i.onLoaded=function(){this._initWindow()},i._initWindow=function(t){var e=C.director.root;pP.title=this._name,pP.width=this._width,pP.height=this._height,pP.renderPassInfo=t&&t.passInfo?t.passInfo:_P,pP.externalResLow=t&&t.externalResLow?t.externalResLow:0,pP.externalResHigh=t&&t.externalResHigh?t.externalResHigh:0,pP.externalFlag=t&&t.externalFlag?t.externalFlag:0,pP.renderPassInfo.colorAttachments.forEach((function(t){t.format=e.device.swapchainFormat})),fP.barrier=Hp.gfxDevice.getGeneralBarrier(new R_(128,128)),this._window?(this._window.destroy(),this._window.initialize(Hp.gfxDevice,pP)):this._window=e.createWindow(pP)},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this._width=this._height=1,this._initWindow()},i.validate=function(){return this.width>=1&&this.width<=2048&&this.height>=1&&this.height<=2048},i.readPixels=function(t,e,i,n,r){t=t||0,e=e||0,i=i||this.width,n=n||this.height;var s=this.getGFXTexture();if(!s)return ht(7606),null;var a=4*i*n;if(void 0===r)r=new Uint8Array(a);else if(r.length=0&&this._models.splice(e,1)},e.clearModels=function(){this._models.length=0},n(t,[{key:"models",get:function(){return this._models}}]),t}(),CP=function(){function t(){this.scene=void 0,this.node=null,this.enabled=!0,this._localBoundaryCenter=nr(0,0,0),this._objectSize=1,this._lodDataArray=[],this._lockedLODLevelVec=[],this._isLockLevelChanged=!1,this._device=Hp.gfxDevice}var e=t.prototype;return e.attachToScene=function(t){this.scene=t},e.detachFromScene=function(){this.scene=null},e.lockLODLevels=function(t){if(t.length!==this._lockedLODLevelVec.length)this._isLockLevelChanged=!0;else for(var e=t.length,i=0;i=this.lodDataArray[n].screenUsagePercentage){i=n;break}return i},e.getScreenUsagePercentage=function(t){return this.node?(1===t.projectionType&&(e=ir.len(this.localBoundaryCenter.transformMat4(this.node.worldMatrix).subtract(t.node.worldPosition))),this.distanceToScreenUsagePercentage(t,e,this.getWorldSpaceSize())):0;var e},e.distanceToScreenUsagePercentage=function(t,e,i){return 1===t.projectionType?i*t.matProj.m05/(2*e):i*t.matProj.m05*.5},e.getWorldSpaceSize=function(){var t=this.node.scale;return Math.max(Math.abs(t.x),Math.abs(t.y),Math.abs(t.z))*this.objectSize},n(t,[{key:"localBoundaryCenter",get:function(){return this._localBoundaryCenter.clone()},set:function(t){this._localBoundaryCenter.set(t)}},{key:"lodCount",get:function(){return this._lodDataArray.length}},{key:"objectSize",get:function(){return this._objectSize},set:function(t){this._objectSize=t}},{key:"lodDataArray",get:function(){return this._lodDataArray}}]),t}(),AP=Object.freeze({__proto__:null,Ambient:vb,CSMLevel:zT,CSMOptimizationMode:UT,Camera:kM,CameraAperture:xM,CameraFOVAxis:bM,CameraISO:wM,CameraProjection:SM,CameraShutter:TM,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:XM,DirectionalLight:tP,EnvironmentLightingType:YT,FOG_TYPE_NONE:ZT,Fog:$T,FogType:KT,LODData:TP,LODGroup:CP,Light:KM,LightType:QM,Model:WM,ModelType:{DEFAULT:0,SKINNING:1,BAKED_SKINNING:2,BATCH_2D:3,PARTICLE_BATCH:4,LINE:5},Octree:jM,PCFType:NT,PointLight:uP,PostSettings:wD,ProbeClearFlag:yP,ProbeType:bP,RangedDirectionalLight:cP,ReflectionProbe:wP,SKYBOX_FLAG:8,ShadowSize:LT,ShadowType:VT,Shadows:HT,Skin:qM,SkyBoxFlagValue:{VALUE:8},Skybox:QT,SphereLight:eP,SpotLight:hP,SubModel:OM,ToneMappingType:xD,TrackingType:{NO_TRACKING:0,POSITION_AND_ROTATION:1,POSITION:2,ROTATION:3},nt2lm:JM}),DP=function(){function t(t){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=t}t.registerCreateFunc=function(e){e._createSceneFun=function(e){return new t(e)}};var e=t.prototype;return e.initialize=function(t){return this._name=t.name,this._lodStateCache=new BP(this),!0},e.update=function(t){var e=this._mainLight;e&&e.update();for(var i=this._sphereLights,n=0;n=0&&(this._lodGroups.splice(e,1),t.detachFromScene(),this._lodStateCache.removeLodGroup(t))},e.removeLODGroups=function(){var t=this;this._lodGroups.forEach((function(e){t._lodStateCache.removeLodGroup(e)})),this._lodGroups.length=0},e.onGlobalPipelineStateChanged=function(){this._models.forEach((function(t){t.onGlobalPipelineStateChanged()}))},e.generateModelId=function(){return this._modelId++},n(t,[{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}}]),t}(),IP=function(){this.usedLevel=-1,this.lastUsedLevel=-1,this.transformDirty=!0},BP=function(){function t(t){this._renderScene=null,this._modelsInLODGroup=new Map,this._lodStateInCamera=new Map,this._newAddedLodGroupVec=[],this._levelModels=new Map,this._renderScene=t}var e=t.prototype;return e.addCamera=function(t){for(var e=this._renderScene.lodGroups,i=0;i0){if(i.node.hasChangedFlags>0)for(var s,a=p(t._lodStateInCamera);!(s=a()).done;){var o=s.value,h=o[1].get(i);h||(h=new IP,o[1].set(i,h)),h.transformDirty=!0}if(i.isLockLevelChanged()){i.resetLockChangeFlag();var u=t._levelModels.get(i);u&&(u.forEach((function(e){e.forEach((function(e){var i=t._modelsInLODGroup.get(e);i&&i.clear()}))})),r.forEach((function(e){var i=u.get(e);i&&i.forEach((function(e){var i=t._modelsInLODGroup.get(e);if(i&&e.node&&e.node.active)for(var n,r=p(t._lodStateInCamera);!(n=r()).done;){var s=n.value;i.set(s[0],!0)}}))})))}return 0}for(var l,c=!1,f=p(t._lodStateInCamera);!(l=f()).done;){var d=l.value,_=d[1].get(i);_||(_=new IP,d[1].set(i,_));var m=d[0].node.hasChangedFlags,g=i.node.hasChangedFlags;if(m>0||g>0||_.transformDirty){_.transformDirty&&(_.transformDirty=!1);var v=i.getVisibleLODLevel(d[0]);v!==_.usedLevel&&(_.lastUsedLevel=_.usedLevel,_.usedLevel=v,c=!0)}}var y=t._levelModels.get(i);if(!y)return 0;i.isLockLevelChanged()?(i.resetLockChangeFlag(),y.forEach((function(e){e.forEach((function(e){var i=t._modelsInLODGroup.get(e);i&&i.clear()}))})),c=!0):c&&t._lodStateInCamera.forEach((function(e){var n=e.get(i);if(n&&n.usedLevel!==n.lastUsedLevel){var r=y.get(n.lastUsedLevel);r&&r.forEach((function(e){var i=t._modelsInLODGroup.get(e);i&&i.clear()}))}})),c&&t._lodStateInCamera.forEach((function(e,n){var r=e.get(i);if(r){var s=r.usedLevel,a=y.get(s);a&&a.forEach((function(e){var i=t._modelsInLODGroup.get(e);i&&e.node&&e.node.active&&i.set(n,!0)}))}}))}},n=0;n1&&(this._fps=this._frameCount,this._frameCount=0,this._fpsTime=0),this._frameMoveBegin(),this._frameMoveProcess(),this._frameMoveEnd()},e.createWindow=function(t){var e=this._createWindowFun(this);return e.initialize(this.device,t),this._windows.push(e),e},e.destroyWindow=function(t){for(var e=0;e0){this._device.acquire([Hp.swapchain]);var r=this._scenes,s=t.getTotalFrames();this._batcher&&(this._batcher.update(),this._batcher.uploadBuffers());for(var a=0;a0){t.emit(e.EVENT_BEFORE_COMMIT),i.sort((function(t,e){return t.priority-e.priority}));for(var n=0;n0&&(this._fixedFPS=t)}},{key:"dataPoolManager",get:function(){return this._dataPoolMgr}},{key:"useDeferredPipeline",get:function(){return this._useDeferredPipeline}},{key:"cameraList",get:function(){return this._cameraList}}]),t}());C.Root=RP,Vi.Attr.setClassAttr(pg,"target","type","Object"),Vi.Attr.setClassAttr(pg,"target","ctor",tb),pt(tb.prototype,"Node",[{name:"childrenCount",newName:"children.length",customGetter:function(){return this.children.length}}]),pt(tb.prototype,"Node",[{name:"width",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._getUITransformComp().width},customSetter:function(t){this._getUITransformComp().width=t}},{name:"height",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._getUITransformComp().height},customSetter:function(t){this._getUITransformComp().height=t}},{name:"anchorX",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._getUITransformComp().anchorX},customSetter:function(t){this._getUITransformComp().anchorX=t}},{name:"anchorY",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._getUITransformComp().anchorY},customSetter:function(t){this._getUITransformComp().anchorY=t}},{name:"getAnchorPoint",targetName:"node.getComponent(UITransform)",customFunction:function(t){return t||(t=new ds),t.set(this._getUITransformComp().anchorPoint),t}},{name:"setAnchorPoint",targetName:"node.getComponent(UITransform)",customFunction:function(t,e){this._getUITransformComp().setAnchorPoint(t,e)}},{name:"getContentSize",targetName:"node.getComponent(UITransform)",customFunction:function(t){return t||(t=new ps),t.set(this._getUITransformComp().contentSize),t}},{name:"setContentSize",targetName:"node.getComponent(UITransform)",customFunction:function(t,e){"number"==typeof t?this._getUITransformComp().setContentSize(t,e):this._getUITransformComp().setContentSize(t)}}]),mt(iB.prototype,"SceneGlobals.prototype",[{name:"aspect"},{name:"selfShadow"},{name:"linear"},{name:"packing"},{name:"autoAdapt"},{name:"fixedArea"},{name:"pcf"},{name:"bias"},{name:"normalBias"},{name:"near"},{name:"far"},{name:"shadowDistance"},{name:"invisibleOcclusionRange"},{name:"orthoSize"},{name:"saturation"}]),pt(iB.prototype,"SceneGlobals.prototype",[{name:"distance",newName:"planeHeight"},{name:"normal",newName:"planeDirection"},{name:"size",newName:"shadowMapSize"}]),mt(tb.prototype,"Node.prototype",[{name:"addLayer"},{name:"removeLayer"}]),pt(Lv.prototype,"NodeUIProperties",[{name:"opacityDirty",newName:"colorDirty"}]),mt(Fv,"Layers",[{name:"All"},{name:"RaycastMask"},{name:"check"}]),pt(Fv,"Layers",[{name:"Default",newName:"DEFAULT",target:Fv.Enum,targetName:"Layers.Enum"},{name:"Always",newName:"ALWAYS",target:Fv.Enum,targetName:"Layers.Enum"},{name:"IgnoreRaycast",newName:"IGNORE_RAYCAST",target:Fv.Enum,targetName:"Layers.Enum"},{name:"Gizmos",newName:"GIZMOS",target:Fv.Enum,targetName:"Layers.Enum"},{name:"Editor",newName:"EDITOR",target:Fv.Enum,targetName:"Layers.Enum"},{name:"UI",newName:"UI_3D",target:Fv.Enum,targetName:"Layers.Enum"},{name:"UI2D",newName:"UI_2D",target:Fv.Enum,targetName:"Layers.Enum"},{name:"SceneGizmo",newName:"SCENE_GIZMO",target:Fv.Enum,targetName:"Layers.Enum"},{name:"makeInclusiveMask",newName:"makeMaskInclude",target:Fv,targetName:"Layers"},{name:"makeExclusiveMask",newName:"makeMaskExclude",target:Fv,targetName:"Layers"}]),mt(Fv.Enum,"Layers.Enum",[{name:"ALWAYS"}]),mt(Fv.BitMask,"Layers.BitMask",[{name:"ALWAYS"}]);var OP=t("dM",Qh("cc.PrivateNode")(vP=function(t){function e(e){var i;return at(12003,(i=t.call(this,e)||this).name),i.hideFlags|=1032,i}return s(e,t),e}(tb))||vP);function FP(t,e){if(!e){var i=A.director.getScene();if(!i)return null;e=i}return e.getChildByPath(t)}pt(Zv,"SystemEventType",["MOUSE_ENTER","MOUSE_LEAVE","TRANSFORM_CHANGED","SCENE_CHANGED_FOR_PERSISTS","SIZE_CHANGED","ANCHOR_CHANGED","COLOR_CHANGED","CHILD_ADDED","CHILD_REMOVED","PARENT_CHANGED","NODE_DESTROYED","LAYER_CHANGED","SIBLING_ORDER_CHANGED"].map((function(t){return{name:t,target:tb.EventType,targetName:"Node.EventType"}}))),pt(tb.EventType,"Node.EventType",[{name:"DEVICEMOTION",target:gM.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_DOWN",target:gM.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_UP",target:gM.EventType,targetName:"SystemEvent.EventType"}]),A.PrivateNode=OP,Dt({BaseNode:{newName:"Node",since:"3.7.0",removed:!1}}),A.find=FP;var LP=be,VP=65536,NP=2048;function zP(t,e){for(var i=e.constructor._executionOrder,n=e._id,r=0,s=t.length-1,a=s>>>1;r<=s;a=r+s>>>1){var o=t[a],h=o.constructor._executionOrder;if(h>i)s=a-1;else if(hn)s=a-1;else{if(!(u0&&(t.array.sort(HP),this._invoke(t),t.array.length=0),this._invoke(this._zero),this._zero.array.length=0;var e=this._pos;e.array.length>0&&(e.array.sort(HP),this._invoke(e),e.array.length=0)},e}(GP),jP=function(t){function e(e){return t.call(this,e)||this}s(e,t);var i=e.prototype;return i.add=function(t){var e=t.constructor._executionOrder;if(0===e)this._zero.array.push(t);else{var i=e<0?this._neg.array:this._pos.array,n=zP(i,t);n<0&&i.splice(~n,0,t)}},i.remove=function(t){var e=t.constructor._executionOrder;if(0===e)this._zero.fastRemove(t);else{var i=e<0?this._neg:this._pos,n=zP(i.array,t);n>=0&&i.removeAt(n)}},i.invoke=function(t){this._neg.array.length>0&&this._invoke(this._neg,t),this._invoke(this._zero,t),this._pos.array.length>0&&this._invoke(this._pos,t)},e}(GP);function qP(t,e,i){var n="var a=it.array;for(it.i=0;it.i=0?LP(this._deferredComps,e):(!t.internalStart||t._objFlags&VP||this.startInvoker.remove(t),t.internalUpdate&&this.updateInvoker.remove(t),t.internalLateUpdate&&this.lateUpdateInvoker.remove(t))},e.enableComp=function(t,e){if(!(t._objFlags&NP)){if(t.internalOnEnable){if(e)return void e.add(t);if(t.internalOnEnable(),!t.node.activeInHierarchy)return}this._onEnabled(t)}},e.disableComp=function(t){t._objFlags&NP&&(t.internalOnDisable&&t.internalOnDisable(),this._onDisabled(t))},e.startPhase=function(){this._updating=!0,this.startInvoker.invoke(),this._startForNewComps()},e.updatePhase=function(t){this.updateInvoker.invoke(t)},e.lateUpdatePhase=function(t){this.lateUpdateInvoker.invoke(t),this._updating=!1,this._startForNewComps()},e._startForNewComps=function(){this._deferredComps.length>0&&(this._deferredSchedule(),this.startInvoker.invoke())},e._scheduleImmediate=function(t){"function"!=typeof t.internalStart||t._objFlags&VP||this.startInvoker.add(t),"function"==typeof t.internalUpdate&&this.updateInvoker.add(t),"function"==typeof t.internalLateUpdate&&this.lateUpdateInvoker.add(t)},e._deferredSchedule=function(){for(var t=this._deferredComps,e=0,i=t.length;e1)t.push("t="+this._targetExp+";"),e="t";else{if(1!==this._exps.length)return;e=this._targetExp}for(var i=0;i0&&(i=lE+this.globalVariables.join(",")+";");var n=Kf(["return (function(R){",i||[],this.codeArray,"return o;","})"]);this.result=Function("O","F",n)(this.objs,this.funcs);for(var r=0,s=this.objsToClear_iN$t.length;r=e.OptimizationPolicyThreshold)?(t=this._doInstantiate(),this.data._instantiate(t)):t=this.data._instantiate(),++this._instantiatedTimes,t},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.data=new tb,this.data.name="(Missing Node)";var i=new A._PrefabInfo;i.asset=this,i.root=this.data,this.data._prefab=i},i.validate=function(){return!!this.data},i.onLoaded=function(){var t=this.data;bB(t),vB(t)},e}(Cm),TE.OptimizationPolicy=DE,TE.OptimizationPolicyThreshold=3,SE=Nh((bE=TE).prototype,"data",[hu],(function(){return null})),xE=Nh(bE.prototype,"optimizationPolicy",[hu],(function(){return DE.AUTO})),wE=Nh(bE.prototype,"persistent",[hu],(function(){return!1})),yE=bE))||yE);Vt(IE,"_utils",IB),A.Prefab=IE,Wt(A,"cc._Prefab","Prefab");var BE=function(){function t(){this._allRenderers=[],this._dirtyRenderers=[],this._dirtyVersion=0}var e=t.prototype;return e.addRenderer=function(t){-1===t._internalId&&(t._internalId=this._allRenderers.length,this._allRenderers.push(t))},e.removeRenderer=function(t){if(-1!==t._internalId){var e=t._internalId;this._allRenderers[this._allRenderers.length-1]._internalId=e,be(this._allRenderers,e),t._internalId=-1,t._dirtyVersion===this._dirtyVersion&&(xe(this._dirtyRenderers,t),t._dirtyVersion=-1)}},e.markDirtyRenderer=function(t){t._dirtyVersion!==this._dirtyVersion&&-1!==t._internalId&&(this._dirtyRenderers.push(t),t._dirtyVersion=this._dirtyVersion)},e.updateAllDirtyRenderers=function(){for(var t=this._dirtyRenderers,e=0;e1){var u=Object.create(null);e.forEach((function(t){u[t._uuid]=t})),r={isCompleted:kE,_map:u}}else r=e[0]}i&&i(t,r)}))},e.getXMLHttpRequest=function(){return new XMLHttpRequest},e.getItem=function(t){return lT.assets.has(t)?{content:lT.assets.get(t)}:null},e.loadRes=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete,h=Go(t);h&&!sw.getInfoWithPath(t,s)&&(t=t.slice(0,-h.length)),sw.load(t,s,a,o)},e.loadResArray=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;t.forEach((function(e,i){var n=Go(e);n&&!sw.getInfoWithPath(e,s)&&(t[i]=e.slice(0,-n.length))})),sw.load(t,s,a,o)},e.loadResDir=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;sw.loadDir(t,s,a,(function(e,i){var n=[];e||(n=sw.getDirWithPath(t,s).map((function(t){return t.path}))),o&&o(e,i,n)}))},e.getRes=function(t,e){return Qp.has(t)?Qp.get(t):sw.get(t,e)},e.getResCount=function(){return Qp.count},e.getDependsRecursively=function(t){if(!t)return[];var e="string"==typeof t?t:t._uuid;return bv.getDepsRecursively(e).concat([e])},e.addDownloadHandlers=function(t){var e=Object.create(null),i=function(){var i=t[n];e["."+n]=function(t,e,n){i({url:t},n)}};for(var n in t)i();Iw.register(e)},e.addLoadHandlers=function(t){var e=Object.create(null),i=function(){var i=t[n];e["."+n]=function(t,e,n){i({content:t},n)}};for(var n in t)i();Jw.register(e)},e.release=function(t){if(Array.isArray(t))for(var e=0;eg.x?t[b]:g.x,g.y=t[b+1]>g.y?t[b+1]:g.y,v.x=t[b]g.x?t[b]:g.x,g.y=t[b+1]>g.y?t[b+1]:g.y,g.z=t[b+2]>g.z?t[b+2]:g.z,v.x=t[b]1&&t.csmOptimizationMode===UT.RemoveDuplicates)if(this._level>=h-1)mk=this._castLightViewBoundingBox.halfExtents.z,pk=this._castLightViewBoundingBox.center.z;else{var u=Math.abs(this._castLightViewBoundingBox.center.z-pk)+mk;this._castLightViewBoundingBox.halfExtents.z=Math.max(this._castLightViewBoundingBox.center.z,u)}var l=this._castLightViewBoundingBox.halfExtents.z;this._shadowCameraFar=2*l+r;var c=this._castLightViewBoundingBox.center;if(_k.set(c.x,c.y,c.z+l+r),ir.transformMat4(_k,_k,ek),Qr.fromRT(ek,t.node.rotation,_k),Qr.invert(ik,ek),!i){var f=.5*s,d=.5*a;Qr.ortho(nk,-f,f,-d,d,.1,this._shadowCameraFar,n.capabilities.clipSpaceMinZ,n.capabilities.clipSpaceSignY),Qr.multiply(sk,nk,o),ir.transformMat4(hk,_k,sk);var _=2/e;uk.set(_,_);var p=hk.x%uk.x,m=hk.y%uk.y;lk.set(hk.x-p,hk.y-m,hk.z),Qr.invert(ak,sk),ir.transformMat4(ck,lk,ak),Qr.fromRT(ek,t.node.rotation,ck),Qr.invert(ik,ek),Qr.multiply(rk,nk,ik),Qr.copy(this._matShadowView,ik),Qr.copy(this._matShadowProj,nk),Qr.copy(this._matShadowViewProj,rk)}Ah.createOrtho(this._validFrustum,s,a,.1,this._shadowCameraFar,ek)},n(t,[{key:"level",get:function(){return this._level}},{key:"shadowObjects",get:function(){return this._shadowObjects}},{key:"shadowCameraFar",get:function(){return this._shadowCameraFar},set:function(t){this._shadowCameraFar=t}},{key:"matShadowView",get:function(){return this._matShadowView},set:function(t){this._matShadowView=t}},{key:"matShadowProj",get:function(){return this._matShadowProj},set:function(t){this._matShadowProj=t}},{key:"matShadowViewProj",get:function(){return this._matShadowViewProj},set:function(t){this._matShadowViewProj=t}},{key:"validFrustum",get:function(){return this._validFrustum}},{key:"splitFrustum",get:function(){return this._splitFrustum}},{key:"lightViewFrustum",get:function(){return this._lightViewFrustum}},{key:"castLightViewBoundingBox",get:function(){return this._castLightViewBoundingBox}}]),t}(),vk=function(t){function e(e){var i;return(i=t.call(this,e)||this)._splitCameraNear=0,i._splitCameraFar=0,i._csmAtlas=new Vn,i._calculateAtlas(e),i}s(e,t);var i=e.prototype;return i.destroy=function(){t.prototype.destroy.call(this)},i._calculateAtlas=function(t){var e=C.director.root.device.capabilities.clipSpaceSignY,i=t%2-.5,n=(.5-Math.floor(t/2))*e;this._csmAtlas.set(.5,.5,i,n)},n(e,[{key:"splitCameraNear",get:function(){return this._splitCameraNear},set:function(t){this._splitCameraNear=t}},{key:"splitCameraFar",get:function(){return this._splitCameraFar},set:function(t){this._splitCameraFar=t}},{key:"csmAtlas",get:function(){return this._csmAtlas},set:function(t){this._csmAtlas=t}}]),e}(gk),yk=function(){function t(){this._castShadowObjects=[],this._layerObjects=new uo(64),this._layers=[],this._levelCount=0,this._specialLayer=new gk(1),this._shadowDistance=0;for(var t=0;t1?.5*i.size.x:i.size.x;if(!(r<0)){this._getCameraWorldMatrix(tk,t);for(var s=n-1;s>=0;s--){var a=this._layers[s],o=a.splitCameraNear,h=a.splitCameraFar;a.calculateSplitFrustum(t,tk,o,h),a.createMatrix(e,r,!1)}n===zT.LEVEL_1?(this._specialLayer.shadowCameraFar=this._layers[0].shadowCameraFar,Qr.copy(this._specialLayer.matShadowView,this._layers[0].matShadowView),Qr.copy(this._specialLayer.matShadowProj,this._layers[0].matShadowProj),Qr.copy(this._specialLayer.matShadowViewProj,this._layers[0].matShadowViewProj),this._specialLayer.copyToValidFrustum(this._layers[0].validFrustum)):(this._specialLayer.calculateSplitFrustum(t,tk,.1,e.shadowDistance),this._specialLayer.createMatrix(e,r,!0))}},e._getCameraWorldMatrix=function(t,e){if(e.node){var i=e.node,n=i.worldPosition,r=i.worldRotation;Qr.fromRT(t,r,n)}},n(t,[{key:"castShadowObjects",get:function(){return this._castShadowObjects}},{key:"layerObjects",get:function(){return this._layerObjects}},{key:"layers",get:function(){return this._layers}},{key:"specialLayer",get:function(){return this._specialLayer}}]),t}(),bk=t("df",function(){function t(){this.fog=new $T,this.ambient=new vb,this.skybox=new QT,this.shadows=new HT,this.csmLayers=new yk,this.octree=new jM,this.skin=new qM,this.postSettings=new wD,this.lightProbes=C.internal.LightProbes?new C.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 e=t.prototype;return e.activate=function(t){return this._device=t,this.initGeometryRendererMaterials(),this.initOcclusionQuery(),!0},e.initGeometryRendererMaterials=function(){for(var t=0,e=this._geometryRendererMaterials,i=0;i<6;i++){e[i]=new FT,e[i]._uuid="geometry-renderer-material-"+i,e[i].initialize({effectName:"internal/builtin-geometry-renderer",technique:i});for(var n=e[i].passes,r=0;r0&&(this._occlusionQueryShader=t.passes[0].getShaderVariant())}},e.getOcclusionQueryPass=function(){return this._occlusionQueryMaterial&&this._occlusionQueryMaterial.passes.length>0?this._occlusionQueryMaterial.passes[0]:null},e.updatePipelineSceneData=function(){},e.destroy=function(){var t,e,i;this.shadows.destroy(),this.csmLayers.destroy(),this.validPunctualLights.length=0,null==(t=this._occlusionQueryInputAssembler)||t.destroy(),this._occlusionQueryInputAssembler=null,null==(e=this._occlusionQueryVertexBuffer)||e.destroy(),this._occlusionQueryVertexBuffer=null,null==(i=this._occlusionQueryIndicesBuffer)||i.destroy(),this._occlusionQueryIndicesBuffer=null,this._standardSkinMeshRenderer=null,this._standardSkinModel=null,this._skinMaterialModel=null},e._createOcclusionQueryIA=function(){var t=this._device,e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,1,1,1,1]);this._occlusionQueryVertexBuffer=t.createBuffer(new h_(10,1,96,12)),this._occlusionQueryVertexBuffer.update(e);var i=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=t.createBuffer(new h_(6,1,72,2)),this._occlusionQueryIndicesBuffer.update(i);var n=[new C_("a_position",32)],r=new D_(n,[this._occlusionQueryVertexBuffer],this._occlusionQueryIndicesBuffer);return t.createInputAssembler(r)},n(t,[{key:"isHDR",get:function(){return this._isHDR},set:function(t){this._isHDR=t}},{key:"shadingScale",get:function(){return this._shadingScale},set:function(t){this._shadingScale=t}},{key:"csmSupported",get:function(){return this._csmSupported},set:function(t){this._csmSupported=t}},{key:"standardSkinModel",get:function(){return this._standardSkinModel},set:function(t){this._standardSkinModel=t}},{key:"standardSkinMeshRenderer",get:function(){return this._standardSkinMeshRenderer},set:function(t){this._standardSkinMeshRenderer&&this._standardSkinMeshRenderer!==t&&this._standardSkinMeshRenderer.clearGlobalStandardSkinObjectFlag(),this._standardSkinMeshRenderer=t,this.standardSkinModel=t?t.model:null}},{key:"skinMaterialModel",get:function(){return this._skinMaterialModel},set:function(t){this._skinMaterialModel=t}},{key:"geometryRendererPasses",get:function(){return this._geometryRendererPasses}},{key:"geometryRendererShaders",get:function(){return this._geometryRendererShaders}}]),t}()),Sk=ms(),xk=((KE={})[Ue.ORIENTATION_AUTO]=Ne.AUTO,KE[Ue.ORIENTATION_LANDSCAPE]=Ne.LANDSCAPE,KE[Ue.ORIENTATION_PORTRAIT]=Ne.PORTRAIT,KE),wk=t("h9",function(t){function e(){var e;(e=t.call(this)||this)._designResolutionSize=ms(0,0),e._scaleX=1,e._scaleY=1,e._viewportRect=bs(),e._visibleRect=bs(),e._autoFullScreen=!1,e._retinaEnabled=!1,e._resizeCallback=null;var i=Tk,n=Ck;return e._rpExactFit=new kk(i.EQUAL_TO_FRAME,n.EXACT_FIT),e._rpShowAll=new kk(i.EQUAL_TO_FRAME,n.SHOW_ALL),e._rpNoBorder=new kk(i.EQUAL_TO_FRAME,n.NO_BORDER),e._rpFixedHeight=new kk(i.EQUAL_TO_FRAME,n.FIXED_HEIGHT),e._rpFixedWidth=new kk(i.EQUAL_TO_FRAME,n.FIXED_WIDTH),e._resolutionPolicy=e._rpShowAll,e}s(e,t);var i=e.prototype;return i.init=function(){var t=ah.windowSize,e=t.width,i=t.height;this._designResolutionSize.width=e,this._designResolutionSize.height=i,this._viewportRect.width=e,this._viewportRect.height=i,this._visibleRect.width=e,this._visibleRect.height=i,Sk.width=this._visibleRect.width,Sk.height=this._visibleRect.height,hh.init(this._visibleRect),this.resizeWithBrowserSize(!0);var n=ze.querySettings("screen","designResolution");n&&this.setDesignResolutionSize(Number(n.width),Number(n.height),n.policy||kk.FIXED_HEIGHT),ah.on("window-resize",this._updateAdaptResult,this),ah.on("fullscreen-change",this._updateAdaptResult,this)},i.resizeWithBrowserSize=function(t){rh.handleResizeEvent=t},i.setResizeCallback=function(t){"function"!=typeof t&&null!=t||(this._resizeCallback=t)},i.setOrientation=function(t){rh.orientation=xk[t]},i.adjustViewportMeta=function(){},i.enableRetina=function(t){this._retinaEnabled=!!t},i.isRetinaEnabled=function(){return this._retinaEnabled},i.enableAutoFullScreen=function(t){t!==this._autoFullScreen&&(this._autoFullScreen=t,t&&ah.requestFullScreen().catch((function(){})))},i.isAutoFullScreenEnabled=function(){return this._autoFullScreen},i.setCanvasSize=function(t,e){rh.resolutionScale=1;var i=rh.devicePixelRatio,n=new ps(t*i,e*i);ah.windowSize=n},i.getCanvasSize=function(){return ah.windowSize},i.getFrameSize=function(){var t=rh.devicePixelRatio,e=ah.windowSize;return e.width/=t,e.height/=t,e},i.setFrameSize=function(t,e){var i=rh.devicePixelRatio;ah.windowSize=new ps(t*i,e*i)},i.getVisibleSize=function(){return new ps(this._visibleRect.width,this._visibleRect.height)},i.getVisibleSizeInPixel=function(){return new ps(this._visibleRect.width*this._scaleX,this._visibleRect.height*this._scaleY)},i.getVisibleOrigin=function(){return new ds(this._visibleRect.x,this._visibleRect.y)},i.getVisibleOriginInPixel=function(){return new ds(this._visibleRect.x*this._scaleX,this._visibleRect.y*this._scaleY)},i.getResolutionPolicy=function(){return this._resolutionPolicy},i._updateResolutionPolicy=function(t){if(t instanceof kk)this._resolutionPolicy=t;else{var e=kk;t===e.EXACT_FIT&&(this._resolutionPolicy=this._rpExactFit),t===e.SHOW_ALL&&(this._resolutionPolicy=this._rpShowAll),t===e.NO_BORDER&&(this._resolutionPolicy=this._rpNoBorder),t===e.FIXED_HEIGHT&&(this._resolutionPolicy=this._rpFixedHeight),t===e.FIXED_WIDTH&&(this._resolutionPolicy=this._rpFixedWidth)}},i.setResolutionPolicy=function(t){this._updateResolutionPolicy(t);var e=Rk.getDesignResolutionSize();Rk.setDesignResolutionSize(e.width,e.height,t)},i.setDesignResolutionSize=function(t,e,i){if(t>0&&e>0){this._updateResolutionPolicy(i);var n=this._resolutionPolicy;n&&n.preApply(this),this._designResolutionSize.width=t,this._designResolutionSize.height=e;var r=n.apply(this,this._designResolutionSize);if(r.scale&&2===r.scale.length&&(this._scaleX=r.scale[0],this._scaleY=r.scale[1]),r.viewport){var s=this._viewportRect,a=this._visibleRect,o=r.viewport;s.x=o.x,s.y=o.y,s.width=o.width,s.height=o.height,a.x=0,a.y=0,a.width=o.width/this._scaleX,a.height=o.height/this._scaleY}n.postApply(this),Sk.width=this._visibleRect.width,Sk.height=this._visibleRect.height,hh.init(this._visibleRect),this.emit("design-resolution-changed")}else ht(2200)},i.getDesignResolutionSize=function(){return new ps(this._designResolutionSize.width,this._designResolutionSize.height)},i.setRealPixelResolution=function(t,e,i){document.documentElement.style.width=t+"px",document.body.style.width=t+"px",document.body.style.left="0px",document.body.style.top="0px",this.setDesignResolutionSize(t,e,i)},i.getViewportRect=function(){return this._viewportRect},i.getScaleX=function(){return this._scaleX},i.getScaleY=function(){return this._scaleY},i.getDevicePixelRatio=function(){return rh.devicePixelRatio},i.convertToLocationInView=function(t,e,i,n){void 0===n&&(n=new ds);var r=rh.devicePixelRatio*(t-i.left),s=rh.devicePixelRatio*(i.top+i.height-e);return rh.isFrameRotated?(n.x=ah.windowSize.width-s,n.y=r):(n.x=r,n.y=s),n},i._convertToUISpace=function(t){var e=this._viewportRect;t.x=(t.x-e.x)/this._scaleX,t.y=(t.y-e.y)/this._scaleY},i._updateAdaptResult=function(t,e,i){C.director.root.resize(t,e,void 0===i||0===i?1:i);var n=this._designResolutionSize,r=n.width,s=n.height;t>0&&e>0?this.setDesignResolutionSize(r,s,this._resolutionPolicy):J(!1,"_updateAdaptResult Invalid size."),this.emit("canvas-resize"),this._resizeCallback&&this._resizeCallback()},e}(Do(Of)));wk.instance=void 0;var Tk=function(){function t(){this.name="ContainerStrategy"}var e=t.prototype;return e.preApply=function(){},e.apply=function(){},e.postApply=function(){},e._setupCanvas=function(){var t=C.game.canvas;if(t){var e=ah.windowSize;t.width!==e.width&&(t.width=e.width),t.height!==e.height&&(t.height=e.height)}},t}();Tk.EQUAL_TO_FRAME=void 0,Tk.PROPORTION_TO_FRAME=void 0;var Ck=function(){function t(){this.name="ContentStrategy",this._result={scale:[1,1],viewport:null},this._strategy=kk.UNKNOWN}var e=t.prototype;return e.preApply=function(){},e.apply=function(){return{scale:[1,1]}},e.postApply=function(){},e._buildResult=function(t,e,i,n,r,s){Math.abs(t-i)<2&&(i=t),Math.abs(e-n)<2&&(n=e);var a=new ys(Math.round((t-i)/2),Math.round((e-n)/2),i,n),o=this._result;return o.scale=[r,s],o.viewport=a,o},n(t,[{key:"strategy",get:function(){return this._strategy}}]),t}(),Ak=function(t){function e(){var e;return(e=t.call(this)||this).name="EqualToFrame",e}return s(e,t),e.prototype.apply=function(){rh.isProportionalToFrame=!1,this._setupCanvas()},e}(Tk),Dk=function(t){function e(){var e;return(e=t.call(this)||this).name="ProportionalToFrame",e}return s(e,t),e.prototype.apply=function(){rh.isProportionalToFrame=!0,this._setupCanvas()},e}(Tk);Tk.EQUAL_TO_FRAME=new Ak,Tk.PROPORTION_TO_FRAME=new Dk;var Ik=function(t){function e(){var e;return(e=t.call(this)||this).name="ExactFit",e._strategy=kk.EXACT_FIT,e}return s(e,t),e.prototype.apply=function(t,e){var i=ah.windowSize,n=i.width,r=i.height,s=n/e.width,a=r/e.height;return this._buildResult(n,r,n,r,s,a)},e}(Ck),Bk=function(t){function e(){var e;return(e=t.call(this)||this).name="ShowAll",e._strategy=kk.SHOW_ALL,e}return s(e,t),e.prototype.apply=function(t,e){var i,n,r=ah.windowSize,s=r.width,a=r.height,o=e.width,h=e.height,u=s/o,l=a/h,c=0;return ue){var r=n;n=i,i=r}this.scaleSize=t/e>16/9?e/n:t/i},t.update=function(t){var e=this.settings,i=this.device,n=this.swapchain,r=i.capabilities;Qr.ortho(this.projection,-1,1,-1,1,-1,1,r.clipSpaceMinZ,r.clipSpaceSignY,n.surfaceTransform);var s=n.width,a=n.height;this.initScale(),this._curTime+=1e3*t;var o=il(tn(this._curTime/e.totalTime)),h=1,u=1,l=this.bgImage;if("custom"===e.background.type){e.policy===kk.FIXED_WIDTH?(h=s,u=s/l.width*l.height):e.policy===kk.FIXED_HEIGHT?(h=a/l.height*l.width,u=a):e.policy===kk.SHOW_ALL?l.width/this.bgHeight>s/a?(h=s,u=s/l.width*l.height):(h=a/l.height*l.width,u=a):e.policy===kk.NO_BORDER?l.width/l.height>s/a?(h=a/l.height*l.width,u=a):(h=s,u=s/l.width*l.height):(h=s,u=a);var c=this.bgMat;Fk(c,"resolution",Ok.set(s,a),0),Fk(c,"scale",Ok.set(h,u),0),Fk(c,"translate",Ok.set(.5*s,.5*a),0),Fk(c,"percent",1),Fk(c,"u_projection",this.projection),c.passes[0].update()}var f=a*this.logoYTrans;if("none"!==this.settings.logo.type){u=.185*a*e.displayRatio,h=this.logoWidth*(.185*a/this.logoHeight)*e.displayRatio;var d=this.logoMat;Fk(d,"resolution",Ok.set(s,a),0),Fk(d,"scale",Ok.set(h,u),0),Fk(d,"translate",Ok.set(s*this.logoXTrans,f),0),Fk(d,"percent",o),Fk(d,"u_projection",this.projection),d.passes[0].update()}if("default"===this.settings.logo.type&&this.watermarkMat){var _=this.watermarkTexture.width,p=this.watermarkTexture.height;h=_,u=p;var m=f-(.5*this.logoHeight*e.displayRatio+this.textYExtraTrans)*this.scaleSize-.5*p,g=this.watermarkMat;Fk(g,"resolution",Ok.set(s,a),0),Fk(g,"scale",Ok.set(h,u),0),Fk(g,"translate",Ok.set(s*this.textXTrans,m),0),Fk(g,"percent",o),Fk(g,"u_projection",this.projection),g.passes[0].update()}this.frame()},t.initBG=function(){var t=this.device;this.bgMat=new FT,this.bgMat.initialize({effectName:"util/splash-screen"});var e=new p_;e.addressU=2,e.addressV=2,e.addressW=2,this.sampler=t.getSampler(e),this.bgTexture=t.createTexture(new d_(1,6,35,this.bgImage.width,this.bgImage.height));var i=this.bgMat.passes[0],n=i.getBinding("mainTexture");i.bindTexture(n,this.bgTexture),this.shader=i.getShaderVariant();var r=i.descriptorSet;r.bindSampler(n,this.sampler),r.update();var s=new e_,a=s.texExtent;a.width=this.bgImage.width,a.height=this.bgImage.height,a.depth=1,t.copyTexImagesToTexture([this.bgImage],this.bgTexture,[s])},t.initLogo=function(){var t=this.device;this.logoMat=new FT,this.logoMat.initialize({effectName:"util/splash-screen"});var e=new p_;e.addressU=2,e.addressV=2,e.addressW=2,this.sampler=t.getSampler(e),this.logoTexture=t.createTexture(new d_(1,6,35,this.logoImage.width,this.logoImage.height));var i=this.logoMat.passes[0],n=i.getBinding("mainTexture");i.bindTexture(n,this.logoTexture),this.shader=i.getShaderVariant();var r=i.descriptorSet;r.bindSampler(n,this.sampler),r.update();var s=new e_,a=s.texExtent;a.width=this.logoImage.width,a.height=this.logoImage.height,a.depth=1,t.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)},t.initWaterMark=function(){var t=I.document.createElement("canvas");t.height=this.textHeight*this.scaleSize,t.style.width=""+t.width,t.style.height=""+t.height;var e="Created with Cocos",i=t.getContext("2d");i.font=this.textSize*this.scaleSize+"px Arial",i.textBaseline="top",i.textAlign="center",i.fillStyle="#707070";var n=i.measureText(e).width+10;t.width=n,i.font=this.textSize*this.scaleSize+"px Arial",i.textBaseline="top",i.textAlign="center",i.fillStyle="#707070",i.fillText(e,t.width/2,0);var r=new e_,s=r.texExtent;s.width=t.width,s.height=t.height,s.depth=1,this.watermarkTexture=this.device.createTexture(new d_(1,6,35,t.width,t.height)),this.device.copyTexImagesToTexture([t],this.watermarkTexture,[r]),this.watermarkMat=new FT,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()},t.frame=function(){var t=this.device,e=this.swapchain;this.projection;var i=this.bgMat,n=this.logoMat,r=this.watermarkMat,s=this.settings,a=this.quadAssmebler;if(t.capabilities,!oh.isXR||xr.entry.isRenderAllowable())for(var o=oh.isXR?2:1,h=0;h=this.settings.totalTime}},{key:"curTime",get:function(){return this._curTime},set:function(t){this._curTime=t}}],[{key:"instance",get:function(){return e._ins}}]),e}();Lk._ins=null,C.internal.SplashScreen=Lk;var Vk=new(function(){function t(){this._data=null}return t.prototype.init=function(t){var e=this;return void 0===t&&(t=""),A.rendering&&A.rendering.enableEffectImport&&t?new Promise((function(i,n){var r=new XMLHttpRequest;r.open("GET",t),r.responseType="arraybuffer",r.onload=function(){e._data=r.response,i()},r.onerror=function(){n(new Error("request effect settings failed!"))},r.send(null)})):Promise.resolve()},n(t,[{key:"data",get:function(){return this._data}}]),t}());A.effectSettings=Vk;var Nk=ze.querySettings.bind(ze),zk=t("dV",function(t){function i(){var e;return(e=t.call(this)||this).frame=null,e.container=null,e.canvas=null,e.renderType=-1,e.eventTargetOn=t.prototype.on,e.eventTargetOnce=t.prototype.once,e.config={},e.onStart=null,e.frameTime=1e3/60,e._isCloning=!1,e._inited=!1,e._engineInited=!1,e._rendererInitialized=!1,e._paused=!0,e._pausedByEngine=!1,e._frameRate=60,e._pacer=null,e._initTime=0,e._startTime=0,e._deltaTime=0,e._useFixedDeltaTime=!1,e._shouldLoadLaunchScene=!0,e.onPreBaseInitDelegate=new Oo,e.onPostBaseInitDelegate=new Oo,e.onPreInfrastructureInitDelegate=new Oo,e.onPostInfrastructureInitDelegate=new Oo,e.onPreSubsystemInitDelegate=new Oo,e.onPostSubsystemInitDelegate=new Oo,e.onPreProjectInitDelegate=new Oo,e.onPostProjectInitDelegate=new Oo,e}s(i,t);var r=i.prototype;return r.setFrameRate=function(t){this.frameRate=t},r.getFrameRate=function(){return this.frameRate},r.step=function(){GE.tick(this._calculateDT(!0))},r.pauseByEngine=function(){this._paused||(this._pausedByEngine=!0,this.pause())},r.resumeByEngine=function(){this._pausedByEngine&&(this.resume(),this._pausedByEngine=!1)},r.pause=function(){var t;this._paused||(this._paused=!0,null==(t=this._pacer)||t.stop(),this.emit(i.EVENT_PAUSE))},r.resume=function(){var t;this._paused&&(mM._clearEvents(),this._paused=!1,null==(t=this._pacer)||t.start(),this.emit(i.EVENT_RESUME))},r.isPaused=function(){return this._paused},r.restart=function(){var t=this;return new Promise((function(t){GE.once("director_end_frame",(function(){return t()}))})).then((function(){GE.reset(),C.Object._deferredDestroy(),t.pause(),t.resume(),t._shouldLoadLaunchScene=!0})).then((function(){return Lk.createInstance().init()})).then((function(){t._safeEmit(i.EVENT_RESTART)}))},r.end=function(){Lo.close()},r.on=function(t,e,i,n){return this.canRegisterEvent(t)&&e.call(i),this.eventTargetOn(t,e,i,n)},r.once=function(t,e,i){return this.canRegisterEvent(t)?e.call(i):this.eventTargetOnce(t,e,i)},r.canRegisterEvent=function(t){return this._engineInited&&t===i.EVENT_ENGINE_INITED||this._inited&&t===i.EVENT_GAME_INITED||this._rendererInitialized&&t===i.EVENT_RENDERER_INITED},r.init=function(t){var n=this;return this._compatibleWithOldParams(t),Promise.resolve().then((function(){return n.emit(i.EVENT_PRE_BASE_INIT),n.onPreBaseInitDelegate.dispatch()})).then((function(){Z(t.debugMode||0)})).then((function(){return oh.init()})).then((function(){n._initEvents()})).then((function(){return ze.init(t.settingsPath,t.overrideSettings)})).then((function(){return n.emit(i.EVENT_POST_BASE_INIT),n.onPostBaseInitDelegate.dispatch()})).then((function(){return n.emit(i.EVENT_PRE_INFRASTRUCTURE_INIT),n.onPreInfrastructureInitDelegate.dispatch()})).then((function(){Ue.init(),n._initXR();var t={frame:document.querySelector("#GameDiv"),container:document.querySelector("#Cocos3dGameContainer"),canvas:document.querySelector("#GameCanvas")};return n.canvas=t.canvas,n.frame=t.frame,n.container=t.container,ah.init(),Yf.init(),Hp.init(n.canvas,xb)})).then((function(){if(Nk("rendering","customPipeline")){if(!C.rendering)return void ht(12109);Ue.CUSTOM_PIPELINE_NAME||(Ue.CUSTOM_PIPELINE_NAME="Builtin")}else C.rendering=void 0;lT.init(),_T.init(),Fv.init(),n.initPacer()})).then((function(){return n.emit(i.EVENT_POST_INFRASTRUCTURE_INIT),n.onPostInfrastructureInitDelegate.dispatch()})).then((function(){return n.emit(i.EVENT_PRE_SUBSYSTEM_INIT),n.onPreSubsystemInitDelegate.dispatch()})).then((function(){return Vk.init(Nk("rendering","effectSettingsPath"))})).then((function(){if(C.rendering&&C.rendering.enableEffectImport)if(3!==Nk("rendering","renderMode")){var t=Vk.data;null!==t?C.rendering.init(Hp.gfxDevice,t):ht(1102)}else C.rendering.init(Hp.gfxDevice,null)})).then((function(){var t=Nk("scripting","scriptPackages");return t?Promise.all(t.map((function(t){return e.import(t)}))):Promise.resolve([])})).then((function(){return GE.init(),_T.loadBuiltinAssets()})).then((function(){return n.emit(i.EVENT_POST_SUBSYSTEM_INIT),n.onPostSubsystemInitDelegate.dispatch()})).then((function(){X("Cocos Creator v"+D),n.emit(i.EVENT_ENGINE_INITED),n._engineInited=!0})).then((function(){return n.emit(i.EVENT_PRE_PROJECT_INIT),n.onPreProjectInitDelegate.dispatch()})).then((function(){var t=Nk("plugins","jsList"),e=Promise.resolve();return t&&t.forEach((function(t){e=e.then((function(){return e="src/"+t,new Promise((function(t,i){var n;function r(t){t.filename===e&&(n=t.error)}window.addEventListener("error",r);var s=document.createElement("script");s.charset="utf-8",s.async=!0,s.crossOrigin="anonymous",s.addEventListener("error",(function(){window.removeEventListener("error",r),i(Error("Error loading "+e))})),s.addEventListener("load",(function(){window.removeEventListener("error",r),document.head.removeChild(s),n?i(n):t()})),s.src=e.replace("#","%23"),document.head.appendChild(s)}));var e}))})),e})).then((function(){return n._loadProjectBundles()})).then((function(){return n._loadCCEScripts()})).then((function(){return n._setupRenderPipeline()})).then((function(){return n._loadPreloadAssets()})).then((function(){return _T.compileBuiltinMaterial(),Lk.createInstance().init()})).then((function(){return n.emit(i.EVENT_POST_PROJECT_INIT),n.onPostProjectInitDelegate.dispatch()})).then((function(){n._inited=!0,n._safeEmit(i.EVENT_GAME_INITED)}))},r._initXR=function(){},r._compatibleWithOldParams=function(t){var e=t.overrideSettings=t.overrideSettings||{};"showFPS"in t&&(e.profiling=e.profiling||{},e.profiling.showFPS=t.showFPS),"frameRate"in t&&(e.screen=e.screen||{},e.screen.frameRate=t.frameRate),"renderMode"in t&&(e.rendering=e.rendering||{},e.rendering.renderMode=t.renderMode),"renderPipeline"in t&&(e.rendering=e.rendering||{},e.rendering.renderPipeline=t.renderPipeline),"assetOptions"in t&&(e.assets=e.assets||{},Object.assign(e.assets,t.assetOptions)),"customJointTextureLayouts"in t&&(e.animation=e.animation||{},e.animation.customJointTextureLayouts=t.customJointTextureLayouts),"physics"in t&&(e.physics=e.physics||{},Object.assign(e.physics,t.physics)),"orientation"in t&&(e.screen=e.screen||{},e.screen.orientation=t.orientation),"exactFitScreen"in t&&(e.screen=e.screen||{},e.screen.exactFitScreen=t.exactFitScreen)},r._loadPreloadAssets=function(){var t=Nk("assets","preloadAssets");return t?Promise.all(t.map((function(t){return new Promise((function(e,i){lT.loadAny(t,(function(t){t?i(t):e()}))}))}))):Promise.resolve([])},r._loadCCEScripts=function(){return new Promise((function(t){t()}))},r._loadProjectBundles=function(){var t=Nk("assets","preloadBundles");return t?Promise.all(t.map((function(t){var e=t.bundle,i=t.version;return new Promise((function(t,n){var r={};i&&(r.version=i),lT.loadBundle(e,r,(function(e){e?n(e):t()}))}))}))):Promise.resolve([])},r.run=function(t){t&&(this.onStart=t),this._inited&&this.resume()},r._calculateDT=function(t){if(this._useFixedDeltaTime=t,t)return this._startTime=performance.now(),this.frameTime/1e3;var e=performance.now();return this._deltaTime=e>this._startTime?(e-this._startTime)/1e3:0,this._deltaTime>i.DEBUG_DT_THRESHOLD&&(this._deltaTime=this.frameTime/1e3),this._startTime=e,this._deltaTime},r._updateCallback=function(){var t=this;if(this._inited)if(Lk.instance&&!Lk.instance.isFinished)Lk.instance.update(this._calculateDT(!1));else if(this._shouldLoadLaunchScene){Lk.releaseInstance(),this._shouldLoadLaunchScene=!1;var e,i=Nk("launch","launchScene");i?GE.loadScene(i,(function(){it(1103,i),t._initTime=performance.now(),GE.startAnimation(),null==t.onStart||t.onStart()})):(this._initTime=performance.now(),GE.startAnimation(),null==(e=this.onStart)||e.call(this))}else GE.tick(this._calculateDT(!1))},r.initPacer=function(){var t,e=null!==(t=Nk("screen","frameRate"))&&void 0!==t?t:60;J("number"==typeof e),this._pacer=new WE,this._pacer.onTick=this._updateCallback.bind(this),this.frameRate=e},r._initEvents=function(){Lo.on("show",this._onShow,this),Lo.on("hide",this._onHide,this),Lo.on("close",this._onClose,this)},r._onHide=function(){this.emit(i.EVENT_HIDE),this.pauseByEngine()},r._onShow=function(){this.emit(i.EVENT_SHOW),this.resumeByEngine()},r._onClose=function(){this.emit(i.EVENT_CLOSE),Lo.exit()},r.addPersistRootNode=function(t){GE.addPersistRootNode(t)},r.removePersistRootNode=function(t){GE.removePersistRootNode(t)},r.isPersistRootNode=function(t){return GE.isPersistRootNode(t)},r._setupRenderPipeline=function(){var t=Nk("rendering","customPipeline");return this._setRenderPipeline(!!t)},r._setRenderPipeline=function(t){GE.root.setRenderPipeline(t)?(this._rendererInitialized=!0,this._safeEmit(i.EVENT_RENDERER_INITED)):ht(1222)},r._safeEmit=function(t){this.emit(t)},n(i,[{key:"inited",get:function(){return this._inited}},{key:"frameRate",get:function(){return this._frameRate},set:function(t){"number"!=typeof t&&(t=parseInt(t,10),Number.isNaN(t)&&(t=60)),this._frameRate=t,this.frameTime=1e3/t,this._pacer&&(this._pacer.targetFrameRate=this._frameRate)}},{key:"deltaTime",get:function(){return this._useFixedDeltaTime?this.frameTime/1e3:this._deltaTime}},{key:"totalTime",get:function(){return performance.now()-this._initTime}},{key:"frameStartTime",get:function(){return this._startTime}}]),i}(Io));zk.EVENT_HIDE="game_on_hide",zk.EVENT_SHOW="game_on_show",zk.EVENT_LOW_MEMORY="game_on_low_memory",zk.EVENT_GAME_INITED="game_inited",zk.EVENT_ENGINE_INITED="engine_inited",zk.EVENT_RENDERER_INITED="renderer_inited",zk.EVENT_PRE_BASE_INIT="pre_base_init",zk.EVENT_POST_BASE_INIT="post_base_init",zk.EVENT_PRE_INFRASTRUCTURE_INIT="pre_infrastructure_init",zk.EVENT_POST_INFRASTRUCTURE_INIT="post_infrastructure_init",zk.EVENT_PRE_SUBSYSTEM_INIT="pre_subsystem_init",zk.EVENT_POST_SUBSYSTEM_INIT="post_subsystem_init",zk.EVENT_PRE_PROJECT_INIT="pre_project_init",zk.EVENT_POST_PROJECT_INIT="post_project_init",zk.EVENT_RESTART="game_on_restart",zk.EVENT_PAUSE="game_on_pause",zk.EVENT_RESUME="game_on_resume",zk.EVENT_CLOSE="game_on_close",zk.RENDER_TYPE_CANVAS=0,zk.RENDER_TYPE_WEBGL=1,zk.RENDER_TYPE_OPENGL=2,zk.RENDER_TYPE_HEADLESS=3,zk.DEBUG_DT_THRESHOLD=1,C.Game=zk;var Uk=t("dW",C.game=new zk);gt(UE.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"}]),mt(UE.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"}]),pt(GE,"director",[{name:"_getSceneUuid",targetName:"assetManager.main",newName:"getSceneInfo",customFunction:function(t){var e;return lT.main?null==(e=lT.main.getSceneInfo(t))?void 0:e.uuid:""}}]),gt(Uk,"game",[{name:"collisionMatrix"},{name:"groupList"}]),pt(Uk,"game",[{name:"_sceneInfos",targetName:"assetManager.main",newName:"getSceneInfo",customGetter:function(){var t=[];return lT.main&&lT.main.config.scenes.forEach((function(e){t.push(e)})),t}}]);var Gk=t("a4",function(t){function e(){var e;return(e=t.call(this)||this)._atlases=[],e._atlasIndex=-1,e._maxAtlasCount=5,e._textureSize=2048,e._maxFrameSize=512,e._textureBleeding=!0,e._enabled=!1,e}s(e,t);var i=e.prototype;return i.newAtlas=function(){var t=this._atlases[++this._atlasIndex];return!t&&this._atlasIndex=this._maxAtlasCount||!t||t.original)return null;if(!t.packable)return null;var e=t.texture.getSamplerInfo();if(2!==e.minFilter||2!==e.magFilter||0!==e.mipFilter)return null;var i=this._atlases[this._atlasIndex];i||(i=this.newAtlas());var n=i?i.insertSpriteFrame(t):null;return!n&&this._atlasIndex=0;e--)this._atlases[e].removeSpriteFrame(t);var i=t.original._texture;this.deleteAtlasTexture(i)}},i.deleteAtlasTexture=function(t){if(t)for(var e=this._atlases.length-1;e>=0;e--)this._atlases[e].deleteInnerTexture(t),this._atlases[e].isEmpty()&&(this._atlases[e].destroy(),this._atlases.splice(e,1),this._atlasIndex--)},i.packToDynamicAtlas=function(t,e){if(this._enabled&&e&&!e.original&&e.packable&&e.texture&&e.texture.width>0&&e.texture.height>0){var i=this.insertSpriteFrame(e);i&&e._setDynamicAtlasFrame(i)}},n(e,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(t?(this.reset(),GE.on("director_before_scene_launch",this.beforeSceneLoad,this)):(this.reset(),GE.off("director_before_scene_launch",this.beforeSceneLoad,this)),this._enabled=t)}},{key:"maxAtlasCount",get:function(){return this._maxAtlasCount},set:function(t){this._maxAtlasCount=t}},{key:"atlasCount",get:function(){return this._atlases.length}},{key:"textureBleeding",get:function(){return this._textureBleeding},set:function(t){this._textureBleeding=t}},{key:"textureSize",get:function(){return this._textureSize},set:function(t){this._textureSize=t}},{key:"maxFrameSize",get:function(){return this._maxFrameSize},set:function(t){this._maxFrameSize=t}}]),e}(Of));Gk.instance=void 0;var Hk=t("a5",Gk.instance=new Gk);GE.registerSystem("dynamicAtlasManager",Hk,0),C.internal.dynamicAtlasManager=Hk;var Wk={positions:"a_position",normals:"a_normal",uvs:"a_texCoord",colors:"a_color"},jk=function(){function t(){this._arrayBufferOrPaddings=[],this._length=0}var e=t.prototype;return e.setNextAlignment=function(t){if(0!==t){var e=this._length%t;if(0!==e){var i=t-e;this._arrayBufferOrPaddings.push(i),this._length+=i}}},e.addBuffer=function(t){var e=this._length;return this._arrayBufferOrPaddings.push(t),this._length+=t.byteLength,e},e.getLength=function(){return this._length},e.getCombined=function(){var t=new Uint8Array(this._length),e=0;return this._arrayBufferOrPaddings.forEach((function(i){"number"==typeof i?e+=i:(t.set(new Uint8Array(i),e),e+=i.byteLength)})),t.buffer},t}();function qk(t,e){return new Xk(t,e)}var Xk=function(){function t(t,e){if(this._subMeshRenderings=[],this._mesh=t,this._mesh.struct.morph){var i=this._mesh.struct.primitives.length;this._subMeshRenderings=new Array(i).fill(null);for(var n=0;n60?this._subMeshRenderings[n]=new Qk(this._mesh,n,this._mesh.struct.morph,e):this._subMeshRenderings[n]=new Yk(this._mesh,n,this._mesh.struct.morph,e))}}}return t.prototype.createInstance=function(){for(var t=this,e=this._mesh.struct.primitives.length,i=new Array(e),n=0;n>1;return{width:1<<(1&e?i+1:i),height:1<d&&(d=t[u]),t[u]<_&&(_=t[u]);for(e=1<>=1;for(c=n<<16|u,l=o;l>>=1){case 0:var n=this.input,a=this.a,u=this.c,l=this.b,c=n.length,f=e,_=u.length,p=e;switch(this.d=this.f=0,a+1>=c&&t(Error("invalid uncompressed block header: LEN")),f=n[a++]|n[a++]<<8,a+1>=c&&t(Error("invalid uncompressed block header: NLEN")),f===~(n[a++]|n[a++]<<8)&&t(Error("invalid uncompressed block header: length verify")),a+f>n.length&&t(Error("input buffer is broken")),this.e){case o:for(;l+f>u.length;){if(f-=p=_-l,r)u.set(n.subarray(a,a+p),l),l+=p,a+=p;else for(;p--;)u[l++]=n[a++];this.b=l,u=E(this),l=this.b}break;case h:for(;l+f>u.length;)u=k(this,{m:2});break;default:t(Error("invalid inflate mode"))}if(r)u.set(n.subarray(a,a+f),l),l+=f,a+=f;else for(;f--;)u[l++]=n[a++];this.a=a,this.b=l,this.c=u;break;case 1:switch(this.e){case h:P(this,C,D);break;case o:M(this,C,D);break;default:t(Error("invalid inflate mode"))}break;case 2:var m,g,v,y,b=I(this,5)+257,S=I(this,5)+1,x=I(this,4)+4,w=new(r?Uint8Array:Array)(d.length),T=e,A=e,R=e,O=e,F=e;for(F=0;FY&&(this.c.length=Y),X=this.c),this.buffer=X;default:t(Error("invalid inflate mode"))}};var l,c,f=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],d=r?new Uint16Array(f):f,_=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],p=r?new Uint16Array(_):_,m=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],g=r?new Uint8Array(m):m,v=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],y=r?new Uint16Array(v):v,b=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],S=r?new Uint8Array(b):b,x=new(r?Uint8Array:Array)(288);for(l=0,c=x.length;l=l?8:255>=l?9:279>=l?7:8;var w,T,C=s(x),A=new(r?Uint8Array:Array)(30);for(w=0,T=A.length;w>3)>=a.length&&t(Error("input buffer is broken"));s>>i,e.d=s-i,e.a=o,n}function B(e,i){for(var n,r,s=e.f,a=e.d,o=e.input,h=e.a,u=o.length,l=i[0],c=i[1];a=u);)s|=o[h++]<>>16)>a&&t(Error("invalid code length: "+r)),e.f=s>>r,e.d=a-r,e.a=h,65535&n}function M(t,e,i){var n=t.c,r=t.b;t.l=e;for(var s,a,o,h,u=n.length-258;256!==(s=B(t,e));)if(256>s)r>=u&&(t.b=r,n=E(t),r=t.b),n[r++]=s;else for(h=p[a=s-257],0=u&&(t.b=r,n=E(t),r=t.b);h--;)n[r]=n[r++-o];for(;8<=t.d;)t.d-=8,t.a--;t.b=r}function P(t,e,i){var n=t.c,r=t.b;t.l=e;for(var s,a,o,h,u=n.length;256!==(s=B(t,e));)if(256>s)r>=u&&(u=(n=k(t)).length),n[r++]=s;else for(h=p[a=s-257],0u&&(u=(n=k(t)).length);h--;)n[r]=n[r++-o];for(;8<=t.d;)t.d-=8,t.a--;t.b=r}function E(t){var e,i,n=new(r?Uint8Array:Array)(t.b-32768),s=t.b-32768,a=t.c;if(r)n.set(a.subarray(32768,n.length));else for(e=0,i=n.length;ee;++e)a[e]=a[s+e];return t.b=32768,a}function k(t,e){var i,n,s,a=t.input.length/t.a+1|0,o=t.input,h=t.c;return e&&("number"==typeof e.m&&(a=e.m),"number"==typeof e.r&&(a+=e.r)),n=2>a?(s=(o.length-t.a)/t.l[2]/2*258|0)>>0;var r=e;if("string"==typeof r){var s,a,o=r.split("");for(s=0,a=o.length;s>>0;r=o}for(var h,u=1,l=0,c=r.length,f=0;0>>0&&t(Error("invalid adler-32 checksum"))}return e};var O=8;n("Zlib.Inflate",R),n("Zlib.Inflate.prototype.decompress",R.prototype.i);var F,L,V,N,z={ADAPTIVE:u.p,BLOCK:u.q};if(Object.keys)F=Object.keys(z);else for(L in F=[],V=0,z)F[V++]=L;for(V=0,N=F.length;V=65536){at(10001,R,65536);continue}E>>=1,k>>=1}B=w.createBuffer(new h_(4,1,k,E)),C.push(B),M=new(SR(P.stride))(x,P.offset,P.count),P.stride!==E&&(M=SR(E).from(M)),B.update(M)}var O=I.vertexBundelIndices.map((function(t){return T[t]})),F=[];if(I.vertexBundelIndices.length>0)for(var L=I.vertexBundelIndices[0],V=this._struct.vertexBundles[L].attributes,N=0;N=this._struct.primitives.length)at(14201);else{var i=[];if(e.positions.length>0&&i.push(e.positions),e.normals&&e.normals.length>0&&i.push(e.normals),e.uvs&&e.uvs.length>0&&i.push(e.uvs),e.tangents&&e.tangents.length>0&&i.push(e.tangents),e.colors&&e.colors.length>0&&i.push(e.colors),e.customAttributes)for(var n=0;n0&&(p.set(m),g.update(m,_)),c.view.count=d,h.vertexCount=d}if(a.indexView){var v=a.indexView,y=v.stride,b=2===y?e.indices16.length:e.indices32.length,S=b*y,x=new Uint8Array(this._data.buffer,v.offset,S),w=2===y?new Uint8Array(e.indices16.buffer,e.indices16.byteOffset,S):new Uint8Array(e.indices32.buffer,e.indices32.byteOffset,S),T=o.indexBuffer;s.maxSubMeshIndices,S>0&&(x.set(w),T.update(w,S)),v.count=b,h.indexCount=b}if(e.minPos&&e.maxPos){var C=nr(e.minPos.x,e.minPos.y,e.minPos.z),A=nr(e.maxPos.x,e.maxPos.y,e.maxPos.z);r.bounds[t]||(r.bounds[t]=new mh),mR(r.bounds[t],C,A);var D=nr(),I=nr();r.bounds.forEach((function(t){t&&(t.getBoundary(D,I),vR(C,D,C),gR(A,I,A))})),this._struct.minPosition=nr(C.x,C.y,C.z),this._struct.maxPosition=nr(A.x,A.y,A.z)}o.invalidateGeometricInfo()}else at(14200)},i.destroy=function(){return this.destroyRenderingMesh(),t.prototype.destroy.call(this)},i.destroyRenderingMesh=function(){if(this._renderingSubMeshes){for(var t=0;t=n.length)){bR(wR,xR,n[_]),i[_]=!0;var p=e[_];vR(p.center,p.center,wR),gR(p.halfExtents,p.halfExtents,wR)}}}}for(var m=0;m=this._struct.primitives.length)return null;var e=this._struct.primitives[t];if(!e.indexView)return null;var i=e.indexView.stride;return new(1===i?Uint8Array:2===i?Uint16Array:Uint32Array)(this._data.buffer,e.indexView.offset,e.indexView.count)},i.copyIndices=function(t,e){if(t>=this._struct.primitives.length)return!1;var i=this._struct.primitives[t];if(!i.indexView)return!1;for(var n=i.indexView.count,r=1===i.indexView.stride?6:2===i.indexView.stride?9:12,s=BR(new DataView(this._data.buffer),r),a=0;a=this._struct.primitives.length))for(var n=this._struct.primitives[t].vertexBundelIndices,r=0;r0){n=null,t.attributes&&(n=t.attributes.find((function(t){return"a_position"===t.name}))||null),n||(n=RR[0]),r.push(n);var u=ep[n.format];o=Math.max(o,Math.floor(h.length/u.count)),a.push({offset:s,data:h,attribute:n}),s+=u.size}if(t.normals&&t.normals.length>0){n=null,t.attributes&&(n=t.attributes.find((function(t){return"a_normal"===t.name}))||null),n||(n=RR[1]);var l=ep[n.format];r.push(n),o=Math.max(o,Math.floor(t.normals.length/l.count)),a.push({offset:s,data:t.normals,attribute:n}),s+=l.size}if(t.uvs&&t.uvs.length>0){n=null,t.attributes&&(n=t.attributes.find((function(t){return"a_texCoord"===t.name}))||null),n||(n=RR[2]);var c=ep[n.format];r.push(n),o=Math.max(o,Math.floor(t.uvs.length/c.count)),a.push({offset:s,data:t.uvs,attribute:n}),s+=c.size}if(t.tangents&&t.tangents.length>0){n=null,t.attributes&&(n=t.attributes.find((function(t){return"a_tangent"===t.name}))||null),n||(n=RR[3]);var f=ep[n.format];r.push(n),o=Math.max(o,Math.floor(t.tangents.length/f.count)),a.push({offset:s,data:t.tangents,attribute:n}),s+=f.size}if(t.colors&&t.colors.length>0){n=null,t.attributes&&(n=t.attributes.find((function(t){return"a_color"===t.name}))||null),n||(n=RR[4]);var d=ep[n.format];r.push(n),o=Math.max(o,Math.floor(t.colors.length/d.count)),a.push({offset:s,data:t.colors,attribute:n}),s+=d.size}if(t.customAttributes)for(var _=0;_0){var i=t%e;if(0!==i)return e-i}return 0}function VR(t,e,i,n){n=n||{maxSubMeshes:1,maxSubMeshVertices:1024,maxSubMeshIndices:1024};var r=[],s=0;if(e.positions.length>0&&r.push(new C_("a_position",32,!1,s++,!1,0)),e.normals&&e.normals.length>0&&r.push(new C_("a_normal",32,!1,s++,!1,0)),e.uvs&&e.uvs.length>0&&r.push(new C_("a_texCoord",21,!1,s++,!1,0)),e.tangents&&e.tangents.length>0&&r.push(new C_("a_tangent",44,!1,s++,!1,0)),e.colors&&e.colors.length>0&&r.push(new C_("a_color",44,!1,s++,!1,0)),e.customAttributes)for(var a=0;a0?x=2:e.indices32&&e.indices32.length>0&&(x=4),x>0){c+=LR(c,x);var w=n.maxSubMeshIndices*x,T={offset:c,length:w,count:0,stride:x};_.indexView=T,c+=w}l.push(_)}var C={info:{maxSubMeshes:n.maxSubMeshes,maxSubMeshVertices:n.maxSubMeshVertices,maxSubMeshIndices:n.maxSubMeshIndices},bounds:[]};C.bounds.length=n.maxSubMeshes;var A={struct:{vertexBundles:u,primitives:l,dynamic:C},data:new Uint8Array(c)};return i||(i=new CR),i.reset(A),i.initialize(),i.updateSubMesh(t,e),i}var NR,zR,UR=function(){function t(){}return t.createMesh=function(t,e,i){return FR(t,e,i)},t.createDynamicMesh=function(t,e,i,n){return VR(t,e,i,n)},t.decodeMesh=function(t){return PR(t)},t.inflateMesh=function(t){return ER(t)},t}(),GR=Object.freeze({__proto__:null,MeshUtils:UR,createMesh:FR,find:FP,mapBuffer:JE,readBuffer:QE,readMesh:function(t,e){void 0===e&&(e=0);var i={positions:[]},n=new DataView(t.data.buffer,t.data.byteOffset,t.data.byteLength),r=t.struct,s=r.primitives[e];s.vertexBundelIndices.forEach((function(t){var e=r.vertexBundles[t],s=e.view.offset,a=e.view,o=a.length,h=a.stride;e.attributes.forEach((function(t){var e=Wk[t.name];e&&(i[e]=(i[e]||[]).concat(QE(n,t.format,s,o,h))),s+=ep[t.format].size}))}));var a=s.indexView;return i.indices=QE(n,rd["R"+8*a.stride+"UI"],a.offset,a.length),i},toPPM:function(t,e,i){return"P3 "+e+" "+i+" 255\n"+t.filter((function(t,e){return e%4<3})).toString()+"\n"},writeBuffer:YE});t("a8",GR);var HR,WR,jR,qR=nr(),XR=Zr(),YR=ir.transformMat4,QR=ir.toArray,JR=[{u:0,v:0},{u:0,v:0},{u:0,v:0},{u:0,v:0}],KR=(t("b",{UV_UPDATED:"uv_updated"}),t("c",Qh("cc.SpriteFrame")((zR=function(t){function e(e){var i;return(i=t.call(this,e)||this).vertices=null,i.uv=[],i.unbiasUV=[],i.uvSliced=[],i._rect=bs(),i._trimmedBorder=Nn(),i._offset=_s(),i._originalSize=ms(),i._rotated=!1,i._capInsets=[0,0,0,0],i._atlasUuid="",i._texture=void 0,i._isFlipUVY=!1,i._isFlipUVX=!1,i._original=null,i._packable=!0,i._pixelsToUnit=100,i._pivot=_s(.5,.5),i._meshType=0,i._extrude=0,i._customOutLine=[],i._mesh=null,i._minPos=nr(),i._maxPos=nr(),i}s(e,t),e.createWithImage=function(t){var i=t instanceof Gm?t:new Gm(t),n=new Pv;n.image=i;var r=new e;return r.texture=n,r};var i=e.prototype;return i.textureLoaded=function(){return!!this.texture},i.isRotated=function(){return this._rotated},i.setRotated=function(t){this.rotated=t},i.getRect=function(t){return t?(t.set(this._rect),t):this._rect.clone()},i.setRect=function(t){this.rect=t},i.getOriginalSize=function(t){return t?(t.set(this._originalSize),t):this._originalSize.clone()},i.setOriginalSize=function(t){this.originalSize=t},i.getOffset=function(t){return t?(t.set(this._offset),t):this._offset.clone()},i.setOffset=function(t){this.offset=t},i.getGFXTexture=function(){return this._texture.getGFXTexture()},i.getGFXSampler=function(){return this._texture.getGFXSampler()},i.getHash=function(){return this._texture.getHash()},i.getSamplerInfo=function(){return this._texture.getSamplerInfo()},i.reset=function(t,e){void 0===e&&(e=!1);var i=this,n=!1;if(e&&(i._originalSize.set(0,0),i._rect.set(0,0,0,0),i._offset.set(0,0),i._capInsets=[0,0,0,0],i._rotated=!1,n=!0),t){t.texture&&(i._rect.set(0,0,t.texture.width,t.texture.height),i._refreshTexture(t.texture),i.checkRect(i._texture)),t.originalSize&&i._originalSize.set(t.originalSize),t.rect&&i._rect.set(t.rect),t.offset&&i._offset.set(t.offset);var r=i._capInsets;void 0!==t.borderTop&&(r[1]=t.borderTop),void 0!==t.borderBottom&&(r[3]=t.borderBottom),void 0!==t.borderLeft&&(r[0]=t.borderLeft),void 0!==t.borderRight&&(r[2]=t.borderRight),void 0!==t.isRotate&&(i._rotated=!!t.isRotate),void 0!==t.isFlipUv&&(i._isFlipUVY=!!t.isFlipUv),n=!0}n&&i.texture&&i._calculateUV(),i._calcTrimmedBorder()},i.checkRect=function(t){var e=this._rect,i=e.x,n=e.y;return this._rotated?(i+=e.height,n+=e.width):(i+=e.width,n+=e.height),i>t.width?(ht(3300,this.name+"/"+t.name,i,t.width),!1):!(n>t.height&&(ht(3301,this.name+"/"+t.name,n,t.height),1))},i._calcTrimmedBorder=function(){var t=this,e=t._originalSize.width,i=t._originalSize.height,n=.5*(e-t._rect.width),r=.5*(i-t._rect.height),s=t._offset,a=t._trimmedBorder;a.x=s.x+n,a.y=s.x-n,a.z=s.y+r,a.w=s.y-r},i.ensureMeshData=function(){this._mesh||(this._initVertices(),this._createMesh())},i.destroy=function(){return this._packable&&Hk&&Hk.deleteAtlasSpriteFrame(this),t.prototype.destroy.call(this)},i._calculateSlicedUV=function(){var t=this,e=t._rect,i=t.texture,n=t._capInsets,r=i.width,s=i.height,a=n[0],o=n[2],h=e.width-a-o,u=n[1],l=n[3],c=e.height-u-l,f=t.uvSliced;if(f.length=0,t._rotated){JR[0].u=e.x/r,JR[1].u=(e.x+l)/r,JR[2].u=(e.x+l+c)/r,JR[3].u=(e.x+e.height)/r,JR[3].v=e.y/s,JR[2].v=(e.y+a)/s,JR[1].v=(e.y+a+h)/s,JR[0].v=(e.y+e.width)/s;for(var d=0;d<4;++d)for(var _=JR[d],p=0;p<4;++p){var m=JR[3-p];f.push({u:_.u,v:m.v})}}else{JR[0].u=e.x/r,JR[1].u=(e.x+a)/r,JR[2].u=(e.x+a+h)/r,JR[3].u=(e.x+e.width)/r,JR[3].v=e.y/s,JR[2].v=(e.y+u)/s,JR[1].v=(e.y+u+c)/s,JR[0].v=(e.y+e.height)/s;for(var g=0;g<4;++g)for(var v=JR[g],y=0;y<4;++y){var b=JR[y];f.push({u:b.u,v:v.v})}}this.emit("uv_updated",this)},i._calculateUV=function(){var t=Ce,e=this,i=e._rect,n=e.uv,r=e.unbiasUV,s=e.texture,a=s.width,o=s.height;if(e._rotated){var h=0===a?0:i.x/a,u=0===a?1:(i.x+i.height)/a,l=0===o?0:i.y/o,c=0===o?1:(i.y+i.width)/o;e._isFlipUVX&&e._isFlipUVY?t(n,u,c,u,l,h,c,h,l):e._isFlipUVX?t(n,u,l,u,c,h,l,h,c):e._isFlipUVY?t(n,h,c,h,l,u,c,u,l):t(n,h,l,h,c,u,l,u,c);var f=0===a?0:i.x/a,d=0===a?1:(i.x+i.height)/a,_=0===o?0:i.y/o,p=0===o?1:(i.y+i.width)/o;e._isFlipUVX&&e._isFlipUVY?t(r,d,p,d,_,f,p,f,_):e._isFlipUVX?t(r,d,_,d,p,f,_,f,p):e._isFlipUVY?t(r,f,p,f,_,d,p,d,_):t(r,f,_,f,p,d,_,d,p)}else{var m=0===a?0:i.x/a,g=0===a?1:(i.x+i.width)/a,v=0===o?1:(i.y+i.height)/o,y=0===o?0:i.y/o;e._isFlipUVX&&e._isFlipUVY?t(n,g,y,m,y,g,v,m,v):e._isFlipUVX?t(n,g,v,m,v,g,y,m,y):e._isFlipUVY?t(n,m,y,g,y,m,v,g,v):t(n,m,v,g,v,m,y,g,y);var b=0===a?0:i.x/a,S=0===a?1:(i.x+i.width)/a,x=0===o?1:(i.y+i.height)/o,w=0===o?0:i.y/o;e._isFlipUVX&&e._isFlipUVY?t(r,S,w,b,w,S,x,b,x):e._isFlipUVX?t(r,S,x,b,x,S,w,b,w):e._isFlipUVY?t(r,b,w,S,w,b,x,S,x):t(r,b,x,S,x,b,w,S,w)}e._calculateSlicedUV()},i._setDynamicAtlasFrame=function(t){t&&(this._original={_texture:this._texture,_x:this._rect.x,_y:this._rect.y},this._texture=t.texture,this._rect.x=t.x,this._rect.y=t.y,this._calculateUV())},i._resetDynamicAtlasFrame=function(){this._original&&(this._rect.x=this._original._x,this._rect.y=this._original._y,this._texture=this._original._texture,this._original=null,this._calculateUV())},i._checkPackable=function(){var t=Hk;if(t){var e=this._texture;if(e instanceof Pv&&!e.isCompressed){var i=this.width,n=this.height;if(!e.image||i>t.maxFrameSize||n>t.maxFrameSize)this._packable=!1;else{var r=I.HTMLCanvasElement;e.image&&e.image instanceof r&&(this._packable=!0)}}else this._packable=!1}},i._serialize=function(){return null},i._deserialize=function(t){var e=this,i=t,n=i.rect;n&&(e._rect=new ys(n.x,n.y,n.width,n.height));var r=i.offset;i.offset&&(e._offset=_s(r.x,r.y));var s=i.originalSize;i.originalSize&&(e._originalSize=ms(s.width,s.height)),e._rotated=!!i.rotated,e._name=i.name,e._packable=!!i.packable,e._pixelsToUnit=i.pixelsToUnit;var a=i.pivot;a&&(e._pivot=_s(a.x,a.y)),e._meshType=i.meshType;var o=i.capInsets;if(o){var h=e._capInsets;h[0]=o[0],h[1]=o[1],h[2]=o[2],h[3]=o[3]}var u=i.vertices;if(u){e.vertices||(e.vertices={rawPosition:[],positions:[],indexes:u.indexes,uv:u.uv,nuv:u.nuv,minPos:nr(u.minPos.x,u.minPos.y,u.minPos.z),maxPos:nr(u.maxPos.x,u.maxPos.y,u.maxPos.z)}),e.vertices.rawPosition.length=0;for(var l=u.rawPosition,c=0;c0){var e=this.spriteFrames[t[0]];return e&&e.texture}return null},i.getSpriteFrame=function(t){var e=this.spriteFrames[t];return e?(e.name||(e.name=t),e):null},i.getSpriteFrames=function(){var t=[],e=this.spriteFrames;for(var i in e)t.push(e[i]);return t},i._serialize=function(){return null},i._deserialize=function(t,e){var i=t;this._name=i.name;var n=i.spriteFrames;this.spriteFrames=Gt();for(var r=0;r=this.limit){var n=this.tail;delete this.datas[n.key],this.count--,this.tail=n.prev,this.tail.next=null,n.prev=null,n.next=null,lO.put(n)}this.moveToHead(i)},e.remove=function(t){t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,delete this.datas[t.key],this.count--},e.get=function(t){var e=this.datas[t];return e?(this.remove(e),this.moveToHead(e),e.value):null},e.clear=function(){this.count=0,this.datas={},this.head=null,this.tail=null},e.has=function(t){return!!this.datas[t]},e.delete=function(t){var e=this.datas[t];this.remove(e)},t}()),fO=new cO(100),dO=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûа-яА-ЯЁё]+|\S)/,_O=/^[!,.:;'}\]%\?>、‘“》?。,!]/,pO="[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]",mO=new RegExp("("+pO+"+|\\S)$"),gO=new RegExp(pO+"+$"),vO=new RegExp("^"+pO);function yO(t){return/^[\u4E00-\u9FFF\u3400-\u4DFF]+$/.test(t)||/[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g.test(t)||/^[\u1100-\u11FF]|[\u3130-\u318F]|[\uA960-\uA97F]|[\uAC00-\uD7AF]|[\uD7B0-\uD7FF]+$/.test(t)}function bO(t){var e=t.charCodeAt(0);return e>=9&&e<=13||32===e||133===e||160===e||5760===e||e>=8192&&e<=8202||8232===e||8233===e||8239===e||8287===e||12288===e}function SO(t,e,i){var n=(i||t.font)+"🎮"+e,r=fO.get(n);if(null!==r)return r;var s=t.measureText(e),a=s&&s.width||0;return fO.put(n,a),a}function xO(t){for(var e=t.length,i=0,n=0,r=0;r=55296&&n<=56319&&(n=t.charCodeAt(r+1))>=56320&&n<=57343?((r+2>=e||8205!==t.charCodeAt(r+2))&&i++,r++):i++);return i}function wO(t,e){for(var i=t.length,n=0,r=0,s=0,a=0,o=0;o=55296&&a<=56319&&(n++,(a=t.charCodeAt(o+1))>=56320&&a<=57343)){if(n++,o+2>=i||8205!==t.charCodeAt(o+2)){if(e===r)return t.slice(s,s+n);s+=n,r++,n=0}o++}else{if(e===r)return t.charAt(o);s=o+1,r++,n=0}else n++;return""}function TO(t,e){var i=wO(t,e);if(1===i.length)return""+i.charCodeAt(0);for(var n="",r=0;r=t.length)return t.length;for(var i=e,n=t[i];i>=0&&("‍"===n&&(n=t[--i]),n>="\udc00"&&n<="\udfff"&&i-1>=0&&(n=t[--i]),n>="\ud800"&&n<="\udbff")&&i-1>=0&&"‍"===t[i-1];)n=t[--i];return i}function AO(t,e){for(var i=e,n=e,r=t[n];n="\ud800"&&r<="\udbff"&&(i++,r=t[++n])),r>="\ud800"&&r<="\udbff")i++,r=t[++n];else{if(!(r>="\udc00"&&r<="\udfff"))break;if(r=t[++n],!(nn?r=n:r+=1}return t.substring(n,r)}function IO(t){return vO.exec(t)}function BO(t){return gO.exec(t)}function MO(t,e,i,n){var r=[];if(0===t.length||i<0)return r.push(""),r;for(var s=t;e>i&&s.length>1;){for(var a=s.length*(i/e)|0,o=DO(s,a),h=e-n(o),u=o,l=0,c=0;h>i&&c++<100;)a*=i/h,h=e-n(o=DO(s,a|=0));for(c=0;o&&h<=i&&c++<100;){var f=dO.exec(o);u=o,h=e-n(o=DO(s,a+=l=f?f[0].length:1))}0==(a-=l)?(a=1,u=DO(s,1)):1===a&&s[0]>="\ud800"&&s[0]<="\udbff"&&(a=2,u=DO(s,2));var d=DO(s,0,a),_=void 0;_O.test(u||o)&&(0==(a-=(_=mO.exec(d))?_[0].length:0)&&(a=1),u=DO(s,a),d=DO(s,0,a)),vO.test(u)&&(_=gO.exec(d))&&d!==_[0]&&(u=DO(s,a-=_[0].length),d=DO(s,0,a)),(0===r.length||(d=d.trim()).length>0)&&r.push(d),e=n(s=u||o)}return(0===r.length||(s=s.trim()).length>0)&&r.push(s),r}var PO,EO=I.document,kO=null,RO=-1,OO="BES bswy:->@123丁ぁᄁ",FO=Object.create(null),LO=[],VO=3e3,NO=function(){if(void 0===PO)if("FontFace"in I){var t=/Gecko.*Firefox\/(\d+)/.exec(I.navigator.userAgent),e=/OS X.*Version\/10\..*Safari/.exec(I.navigator.userAgent)&&/Apple/.exec(I.navigator.vendor);PO=t?parseInt(t[1],10)>42:!e}else PO=!1;return PO};function zO(){for(var t=!0,e=Date.now(),i=LO.length-1;i>=0;i--){var n=LO[i],r=n.fontFamilyName;if(e-n.startTime>VO)at(4933,r),n.onComplete(null,r),LO.splice(i,1);else{var s=n.refWidth,a="40px "+r;kO.font=a,s!==SO(kO,OO,a)?(LO.splice(i,1),n.onComplete(null,r)):t=!1}}t&&(clearInterval(RO),RO=-1)}function UO(t,e,i){var n=new Promise((function(i,n){!function r(){Date.now()-t>=VO?n():EO.fonts.load("40px "+e).then((function(t){t.length>=1?i():setTimeout(r,100)}),(function(){n()}))}()})),r=null,s=new Promise((function(t,e){r=setTimeout(e,VO)}));Promise.race([s,n]).then((function(){r&&(clearTimeout(r),r=null),i(null,e)}),(function(){at(4933,e),i(null,e)}))}function GO(t,e,i){var n=HO(t);if(FO[n])i(null,n);else{if(!kO){var r=EO.createElement("canvas");r.width=100,r.height=100,kO=r.getContext("2d")}var s="40px "+n,a=EO.createElement("style");a.type="text/css";var o="";Number.isNaN(n)?o+="@font-face { font-family:"+n+"; src:":o+='@font-face { font-family:"'+n+'"; src:',o+='url("'+t+'");',a.textContent=o+"}",EO.body.appendChild(a);var h=EO.createElement("div"),u=h.style;if(u.fontFamily=n,h.innerHTML=".",u.position="absolute",u.left="-100px",u.top="-100px",EO.body.appendChild(h),NO())UO(Date.now(),n,i);else{var l={fontFamilyName:n,refWidth:SO(kO,OO,s),onComplete:i,startTime:Date.now()};LO.push(l),-1===RO&&(RO=setInterval(zO,100))}FO[n]=a}}function HO(t){var e=t.lastIndexOf(".ttf");if(-1===e)return t;var i,n=t.lastIndexOf("/");return-1!==(i=-1===n?t.substring(0,e)+"_LABEL":t.substring(n+1,e)+"_LABEL").indexOf(" ")&&(i='"'+i+'"'),i}function WO(t,e,i,n){var r=new rO;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}Iw.register({".font":GO,".eot":GO,".ttf":GO,".woff":GO,".svg":GO,".ttc":GO}),Uw.register({".font":WO,".eot":WO,".ttf":WO,".woff":WO,".svg":WO,".ttc":WO});var jO,qO,XO,YO,QO,JO,KO,ZO,$O,tF=/^(click)(\s)*=|(param)(\s)*=/,eF=/(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*align(\s)*=|(\s)*offset(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/,iF=t("z",function(){function t(){this._specialSymbolArray=[],this._stack=[],this._resultObjectArray=[],this._specialSymbolArray.push([/</g,"<"]),this._specialSymbolArray.push([/>/g,">"]),this._specialSymbolArray.push([/&/g,"&"]),this._specialSymbolArray.push([/"/g,'"']),this._specialSymbolArray.push([/'/g,"'"])}var e=t.prototype;return e.parse=function(t){this._resultObjectArray.length=0,this._stack.length=0;for(var e=0,i=t.length;e",e),r=-1;if(n>=0&&(r=t.lastIndexOf("<",n))",r+1)),r<0)this._stack.pop(),this._processResult(t.substring(e)),e=i;else{var s=t.substring(e,r),a=t.substring(r+1,n);""===a&&(s=t.substring(e,n+1)),this._processResult(s),-1===n?n=r:"/"===t.charAt(r+1)?this._stack.pop():this._addToStack(a),e=n+1}}return this._resultObjectArray},e._attributeToObject=function(t){t=t.trim();var e={},i=/^(color|size)(\s)*=/.exec(t),n="",r=0,s="";if(i){if(n=i[0],""===(t=t.substring(n.length).trim()))return e;switch(r=t.indexOf(" "),n[0]){case"c":e.color=r>-1?t.substring(0,r).trim():t;break;case"s":e.size=parseInt(t)}return r>-1&&(s=t.substring(r+1).trim(),e.event=this._processEventHandler(s)),e}if((i=/^(br(\s)*\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("br")&&"/"===n[n.length-1])return e.isNewLine=!0,this._resultObjectArray.push({text:"",style:{isNewLine:!0}}),e;var a="",o=-1;if((i=/^(img(\s)*src(\s)*=[^>]+\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("img")&&"/"===n[n.length-1]){var h;i=eF.exec(t);for(var u=!1;i;){var l=(n=(t=t.substring(t.indexOf(i[0]))).substring(0,i[0].length)).length;if(n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),a=t.substring(l).trim(),o="src"===n?this.getRightQuotationIndex(a):-1,h=(r=a.indexOf(" ",o+1>=a.length?-1:o+1))>-1?a.substring(0,r):a,t=a.substring(r).trim(),h.endsWith("/")&&(h=h.slice(0,-1)),"src"===n){switch(h.charCodeAt(0)){case 34:case 39:u=!0,h=h.slice(1,-1)}e.isImage=!0,e.src=h}else if("height"===n)e.imageHeight=parseInt(h);else if("width"===n)e.imageWidth=parseInt(h);else if("align"===n){switch(h.charCodeAt(0)){case 34:case 39:h=h.slice(1,-1)}e.imageAlign=h.toLowerCase()}else"offset"===n?e.imageOffset=h:"click"===n&&(e.event=this._processEventHandler(n+"="+h));e.event&&"param"===n&&(e.event[n]=h.replace(/^"|"$/g,"")),i=eF.exec(t)}return u&&e.isImage&&this._resultObjectArray.push({text:"",style:e}),{}}if(i=/^(outline(\s)*[^>]*)/.exec(t)){var c={color:"#ffffff",width:1};if(t=i[0].substring(7).trim()){var f,d=/(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;for(i=d.exec(t);i;)n=(t=t.substring(t.indexOf(i[0]))).substring(0,i[0].length),f=(r=(a=t.substring(n.length).trim()).indexOf(" "))>-1?a.substring(0,r):a,n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),t=a.substring(r).trim(),"click"===n?e.event=this._processEventHandler(n+"="+f):"color"===n?c.color=f:"width"===n&&(c.width=parseInt(f)),e.event&&"param"===n&&(e.event[n]=f.replace(/^"|"$/g,"")),i=d.exec(t)}e.outline=c}if((i=/^(on|u|b|i)(\s)*/.exec(t))&&i[0].length>0){switch(n=i[0],t=t.substring(n.length).trim(),n[0]){case"u":e.underline=!0;break;case"i":e.italic=!0;break;case"b":e.bold=!0}if(""===t)return e;e.event=this._processEventHandler(t)}return e},e.getRightQuotationIndex=function(t){var e=-1,i=-1,n=t.indexOf("'"),r=t.indexOf('"'),s=r>-1&&(r-1&&(n=t.length?-1:e+1)):s&&(e=r,i=t.indexOf('"',e+1>=t.length?-1:e+1)),i},e._processEventHandler=function(t){for(var e={},i=0,n=!1,r=tF.exec(t);r;){var s=r[0],a="";if(n=!1,'"'===(t=t.substring(s.length).trim()).charAt(0))(i=t.indexOf('"',1))>-1&&(a=t.substring(1,i).trim(),n=!0),i++;else if("'"===t.charAt(0))(i=t.indexOf("'",1))>-1&&(a=t.substring(1,i).trim(),n=!0),i++;else{var o=/(\S)+/.exec(t);i=(a=o?o[0]:"").length}n&&(e[s=s.substring(0,s.length-1).trim()]=a),t=t.substring(i).trim(),r=tF.exec(t)}return e},e._addToStack=function(t){var e=this._attributeToObject(t);if(0===this._stack.length)this._stack.push(e);else{if(e.isNewLine||e.isImage)return;var i=this._stack[this._stack.length-1];for(var n in i)e[n]||(e[n]=i[n]);this._stack.push(e)}},e._processResult=function(t){0!==t.length&&(t=this._escapeSpecialSymbol(t),this._stack.length>0?this._resultObjectArray.push({text:t,style:this._stack[this._stack.length-1]}):this._resultObjectArray.push({text:t}))},e._escapeSpecialSymbol=function(t){for(var e,i=p(this._specialSymbolArray);!(e=i()).done;){var n=e.value,r=n[0],s=n[1];t=t.replace(r,s)}return t},t}()),nF=function(){this.u=0,this.v=0,this.w=0,this.h=0,this.offsetX=0,this.offsetY=0,this.valid=!1,this.xAdvance=0},rF=function(){function t(t){this.letterDefinitions={},this._texture=null,this.texture=t}var e=t.prototype;return e.addLetterDefinitions=function(t,e){this.letterDefinitions[t]=e},e.cloneLetterDefinition=function(){var t={};for(var e in this.letterDefinitions){var i=new nF;$t(i,this.letterDefinitions[e]),t[e]=i}return t},e.getTexture=function(){return this._texture},e.getLetter=function(t){return this.letterDefinitions[t]},e.getLetterDefinitionForChar=function(t){var e=TO(t,0),i=null;return Object.prototype.hasOwnProperty.call(this.letterDefinitions,e)&&(i=this.letterDefinitions[e]),i},e.clear=function(){this.letterDefinitions={}},n(t,[{key:"texture",get:function(){return this._texture},set:function(t){var e=this._texture;e!==t&&(e&&(e.decRef(!1),e.refCount<=0&&e.destroy()),t&&t.addRef(),this._texture=t)}}]),t}(),sF=t("B",(jO=Qh("cc.BitmapFont"),qO=Eu(KR),jO((YO=function(t){function e(){var e;return(e=t.call(this)||this).fntDataStr=QO&&QO(),e.spriteFrame=JO&&JO(),e.fontSize=KO&&KO(),e.fntConfig=ZO&&ZO(),e}return s(e,t),e.prototype.onLoaded=function(){var t=this.spriteFrame;!this.fontDefDictionary&&t&&(this.fontDefDictionary=new rF(t.texture));var e=this.fntConfig;if(e){var i=e.fontDefDictionary;for(var n in i){var r=i[n],s=new nF,a=r.rect;s.offsetX=r.xOffset,s.offsetY=r.yOffset,s.w=a.width,s.h=a.height,s.u=a.x,s.v=a.y,s.valid=!0,s.xAdvance=r.xAdvance,this.fontDefDictionary.addLetterDefinitions(n,s)}}else at(16376)},e}(nO),QO=Nh(YO.prototype,"fntDataStr",[hu],(function(){return""})),JO=Nh(YO.prototype,"spriteFrame",[qO],(function(){return null})),KO=Nh(YO.prototype,"fontSize",[hu],(function(){return-1})),ZO=Nh(YO.prototype,"fntConfig",[hu],(function(){return null})),XO=YO))||XO));C.BitmapFont=sF;var aF,oF=t("L",Qh("cc.LabelAtlas")($O=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(sF))||$O);C.LabelAtlas=oF;var hF=function(){function t(){this.pool=[]}t.getInstance=function(){return aF||(aF=new t),aF};var e=t.prototype;return e.get=function(){var t=this.pool.pop();if(!t){var e=I.document.createElement("canvas"),i=e.getContext("2d");t={canvas:e,context:i}}return t},e.put=function(t){this.pool.length>=Ue.MAX_LABEL_CANVAS_POOL_SIZE||this.pool.push(t)},t}(),uF=cr.WHITE.clone(),lF="rgba(255, 255, 255, "+(1/255).toFixed(3)+")",cF=uO(),fF=function(){function t(t,e){this.image=null,this.data=null,this.canvas=null,this.context=null,this.width=0,this.height=0,this.offsetY=0,this.char=t,this.labelInfo=e,this.hash=""+TO(t,0)+e.hash}var e=t.prototype;return e.updateRenderData=function(){this._updateProperties(),this._updateTexture()},e.destroy=function(){this.image=null,hF.getInstance().put(this.data),this.data=null},e._updateProperties=function(){if(this.data=hF.getInstance().get(),this.canvas=this.data.canvas,this.context=this.data.context,this.context){var t=this.labelInfo.fontScale;this.context.font=this.labelInfo.fontDesc;var e=SO(this.context,this.char,this.labelInfo.fontDesc),i=2*this.labelInfo.margin+2;this.width=parseFloat(e.toFixed(2))*t+i,this.height=(1+aO)*this.labelInfo.fontSize*t+i,this.offsetY=-this.labelInfo.fontSize*aO*t/2}this.canvas.width!==this.width&&(this.canvas.width=this.width),this.canvas.height!==this.height&&(this.canvas.height=this.height),this.image||(this.image=new Gm),this.image.reset(this.canvas)},e._updateTexture=function(){if(this.context&&this.canvas){var t=this.context,e=this.labelInfo,i=this.canvas.width,n=this.canvas.height,r=e.fontScale;t.textAlign="center",t.textBaseline="alphabetic",t.clearRect(0,0,i,n),t.fillStyle=lF,t.fillRect(0,0,i,n),t.font=e.fontDesc.replace(/(\d+)(\.\d+)?(px|em|rem|pt)/g,(function(t,e,i,n){return(+e*r+(+i||0)*r).toString()+n}));var s=e.fontSize*r,a=i/2,o=n/2+s*hO+s*cF,h=e.color;if(t.lineJoin="round",t.fillStyle="rgba("+h.r+", "+h.g+", "+h.b+", 1)",e.isOutlined){var u=e.out||uF;t.strokeStyle="rgba("+u.r+", "+u.g+", "+u.b+", "+u.a/255+")",t.lineWidth=2*e.margin*r,t.strokeText(this.char,a,o)}t.fillText(this.char,a,o)}},t}(),dF=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.initWithSize=function(t,e,i){void 0===i&&(i=35),this.reset({width:t,height:e,format:i})},i.drawTextureAt=function(t,e,i){var n=this.getGFXTexture();if(t&&n){var r=this._getGFXDevice();if(r){var s=new e_;s.texOffset.x=e,s.texOffset.y=i,s.texExtent.width=t.width,s.texExtent.height=t.height,r.copyTexImagesToTexture([t.data],n,[s])}else at(16363)}},e}(Pv),_F=function(){function t(t,e){this._x=0,this._y=0,this._nextY=0,this._width=0,this._height=0,this._halfBleed=0,this._dirty=!1;var i=new dF;i.initWithSize(t,e),this.fontDefDictionary=new rF(i),this._halfBleed=1,this._width=t,this._height=e,GE.on("director_before_scene_launch",this.beforeSceneLoad,this)}var e=t.prototype;return e.insertLetterTexture=function(t){var e=t.image,i=GE.root.device;if(!e||!this.fontDefDictionary||!i)return null;var n=e.width,r=e.height;if(this._x+n+0>this._width&&(this._x=0,this._y=this._nextY),this._y+r>this._nextY&&(this._nextY=this._y+r+0),this._nextY>this._height)return at(12100),null;if(!this.fontDefDictionary.texture)return null;this.fontDefDictionary.texture.drawTextureAt(e,this._x,this._y),this._dirty=!0;var s=new nF;return s.u=this._x+this._halfBleed,s.v=this._y+this._halfBleed,s.valid=!0,s.w=t.width-2,s.h=t.height-2,s.xAdvance=s.w,s.offsetY=t.offsetY,this._x+=n+0,this.fontDefDictionary.addLetterDefinitions(t.hash,s),s},e.update=function(){this._dirty&&(this._dirty=!1)},e.reset=function(){this._x=0,this._y=0,this._nextY=0,this.fontDefDictionary.clear()},e.destroy=function(){this.reset();var t=this.fontDefDictionary;t&&t.texture&&(t.texture=null)},e.getTexture=function(){return this.fontDefDictionary.getTexture()},e.beforeSceneLoad=function(){this.clearAllCache()},e.clearAllCache=function(){this.destroy();var t=new dF;t.initWithSize(this._width,this._height),this.fontDefDictionary.texture=t},e.getLetter=function(t){return this.fontDefDictionary.letterDefinitions[t]},e.getLetterDefinitionForChar=function(t,e){var i=TO(t,0)+e.hash,n=this.fontDefDictionary.letterDefinitions[i];if(!n){var r=new fF(t,e);r.updateRenderData(),n=this.insertLetterTexture(r),r.destroy()}return n},n(t,[{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),t}(),pF={fontAtlas:null,fontSize:0,lineHeight:0,hAlign:0,vAlign:0,hash:"",fontFamily:"",fontDesc:"Arial",color:cr.WHITE.clone(),isOutlined:!1,out:cr.WHITE.clone(),margin:0,fontScale:1};function mF(t){var e=t.color.toHEX(),i="";return t.isOutlined&&t.margin>0&&(i=i+t.margin+t.out.toHEX()),""+t.fontSize+t.fontFamily+e+i}var gF="a_position",vF="a_color",yF="a_texCoord",bF="a_color2",SF=[new C_(gF,32)],xF=[new C_(gF,32),new C_(vF,44)],wF=[new C_(gF,32),new C_(yF,21),new C_(vF,44)],TF=[new C_(gF,32),new C_(yF,21),new C_(vF,35,!0)],CF=[new C_(gF,32),new C_(yF,21),new C_(vF,44),new C_(bF,44)],AF=[new C_(gF,32),new C_(yF,21),new C_(vF,35,!0),new C_(bF,35,!0)];function DF(t){for(var e=0,i=0;i>2,this._initVDataCount,this._floatsPerVertex,ft(9005),this.vData&&this.iData||(this.vData=new Float32Array(this._initVDataCount),this.iData=new Uint16Array(this._initIDataCount)),this._iaPool.push(this.createNewIA(t))},t.reset=function(){this._nextFreeIAHandle=0,this.dirty=!1},t.destroy=function(){this.reset(),this._attributes=null,this._iaInfo=null,this.vData=null,this.iData=null;for(var t=0;tthis._initVDataCount||n>this._initIDataCount)},t.uploadBuffers=function(){if(0!==this.byteOffset&&this._dirty){var t=oh.__isWebIOS14OrIPadOS14Env,e=t?this._nextFreeIAHandle:1;if(t&&e/this._iaPool.length<.5){for(var i=e/.5,n=this._iaPool.length-1;n>=i;n--){var r=this._iaPool[n];r.vertexBuffers[0]&&r.vertexBuffers[0].destroy(),r.indexBuffer&&r.indexBuffer.destroy(),r.ia.destroy()}this._iaPool.length=i}for(var s=this.byteOffset,a=this.indexOffset,o=0;o>2),l=new Uint16Array(this.iData.buffer,0,a),c=h.vertexBuffers[0];s>c.size&&c.resize(s),c.update(u),2*a>h.indexBuffer.size&&h.indexBuffer.resize(2*a),h.indexBuffer.update(l)}this.dirty=!1}},t.createNewIA=function(t){var e,i,n;if(oh.__isWebIOS14OrIPadOS14Env||!this._iaPool[0]){var r=this._vertexFormatBytes=4*this._floatsPerVertex,s=t.createBuffer(new h_(10,3,r,r));n=t.createBuffer(new h_(6,3,2,2)),i=[s],this._iaInfo=new D_(this._attributes,i,n),e=t.createInputAssembler(this._iaInfo)}else e=t.createInputAssembler(this._iaInfo),i=this._iaInfo.vertexBuffers,n=this._iaInfo.indexBuffer;return{ia:e,vertexBuffers:i,indexBuffer:n}},n(e,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexFormatBytes",get:function(){return this._vertexFormatBytes}},{key:"byteOffset",get:function(){return this._byteOffset},set:function(t){this._byteOffset=t}},{key:"vertexOffset",get:function(){return this._vertexOffset},set:function(t){this._vertexOffset=t}},{key:"indexOffset",get:function(){return this._indexOffset},set:function(t){this._indexOffset=t}},{key:"dirty",get:function(){return this._dirty},set:function(t){this._dirty=t}},{key:"floatsPerVertex",get:function(){return this._floatsPerVertex},set:function(t){this._floatsPerVertex=t}},{key:"vData",get:function(){return this._vData},set:function(t){this._vData=t}},{key:"iData",get:function(){return this._iData},set:function(t){this._iData=t}},{key:"nativeObj",get:function(){return this._nativeObj}},{key:"sharedBuffer",get:function(){return this._sharedBuffer}}]),e}()),MF=function(){function t(t,e){this._buffers=[],this._device=t,this._attributes=e,this._floatsPerVertex=IF(e)>>2,this._vertexFormatBytes=4*this._floatsPerVertex}var e=t.prototype;return e.initialize=function(){},e.reset=function(){},e.request=function(){},e.appendBuffers=function(){},e.uploadBuffers=function(){},e.destroy=function(){this._attributes.length=0},n(t,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexFormatBytes",get:function(){return this._vertexFormatBytes}},{key:"floatsPerVertex",get:function(){return this._floatsPerVertex}}]),t}(),PF=new oo((function(){return{offset:0,length:0}}),32),EF=function(){function t(t,e,i,n,r,s){this.vertexAccessor=t,this.bufferId=e,this.meshBuffer=i,this.vertexOffset=n,this.vb=r,this.indexCount=s,this._ib=new Uint16Array(s),t.getMeshBuffer(e)}return t.prototype.setIndexBuffer=function(){},n(t,[{key:"ib",get:function(){return this._ib}}]),t}(),kF=function(t){function e(i,n,r,s){var a;return(a=t.call(this,i,n)||this)._freeLists=[],a._vCount=0,a._iCount=0,a._id=0,a._vCount=r||Math.floor(1024*Ue.BATCHER2D_MEM_INCREMENT/a._vertexFormatBytes),a._iCount=s||a._vCount*e.IB_SCALE,a._id=e.generateID(),a._allocateBuffer(),a}s(e,t);var i=e.prototype;return i.destroy=function(){for(var e=0;ethis._vCount||e>this._iCount)return ht(9004,i),null;for(var n,r=null,s=0,a=-1,o=null,h=0;h=i){o=n[u],s=h,a=u;break}if(o)break}if(o||(s=this._allocateBuffer(),(r=this._buffers[s])&&(a=0,o=this._freeLists[s][a])),o){var l=o.offset/this.vertexFormatBytes,c=new Float32Array(r.vData.buffer,o.offset,i>>2).fill(0);return this._allocateChunkFromEntry(s,a,o,i),new EF(this,s,r,l,c,e)}return null},i.recycleChunk=function(t){var e=this._freeLists[t.bufferId],i=this._buffers[t.bufferId],n=t.vertexOffset*this.vertexFormatBytes,r=t.vb.byteLength;if(0!==r){for(var s=!1,a=0,o=null,h=e[a];h&&h.offset=0,9004,t,i.offset,i.length),0===r?(this._freeLists[t].splice(e,1),PF.free(i)):(i.offset+=n,i.length=r)},i._allocateBuffer=function(){lt(this._buffers.length===this._freeLists.length,9003);var t=new BF,e=this._vCount*this._floatsPerVertex;t.initialize(this._device,this._attributes,e,this._iCount),this._buffers.push(t);var i=PF.alloc();i.offset=0,i.length=t.vData.byteLength;var n=[i];return this._freeLists.push(n),GE.root.batcher2D.syncMeshBuffersToNative(this.id,this._buffers),this._buffers.length-1},e.generateID=function(){return e.ID_COUNT++},n(e,[{key:"id",get:function(){return this._id}}]),e}(MF);kF.IB_SCALE=4,kF.ID_COUNT=0;var RF,OF,FF,LF,VF,NF,zF,UF,GF,HF,WF,jF=function(){function t(t){this._accId=-1,this._bufferId=-1,this._vertexOffset=0,this._indexOffset=0,this._vb=null,this._ib=null,this._vData=null,this._iData=null,this._vertDirty=!1,this._vbCount=0,this._ibCount=0,this._dataHash=0,this._isMeshBuffer=!1,this._material=null,this._texture=null,this._sampler=null,this._stride=0,this._useLocal=!1,this._model=null,this._drawInfoType=0,this._subNode=null,this._render2dBuffer=null,this.init(t);var e=this._nativeObj.getAttrSharedBufferForJS(),i=0;this._uint8SharedBuffer=new Uint8Array(e,i,4),i+=4,this._uint16SharedBuffer=new Uint16Array(e,i,2),i+=4,this._uint32SharedBuffer=new Uint32Array(e,i,5)}var e=t.prototype;return e.init=function(){},e.clear=function(){this._bufferId=0,this._vertexOffset=0,this._indexOffset=0,this._vertDirty=!1},e.setAccId=function(t){this._accId=t},e.setBufferId=function(t){this._bufferId=t},e.setAccAndBuffer=function(t,e){this._bufferId=e,this._accId=t},e.setVertexOffset=function(t){this._vertexOffset=t},e.setIndexOffset=function(t){this._indexOffset=t},e.setVB=function(){},e.setIB=function(){},e.setVData=function(){},e.setIData=function(){},e.setVBCount=function(t){this._vbCount=t},e.setIBCount=function(){},e.setVertDirty=function(t){this._vertDirty=t},e.setDataHash=function(t){this._dataHash=t},e.setIsMeshBuffer=function(t){this._isMeshBuffer=t},e.setVertexPositionInWorld=function(){},e.setMaterial=function(t){this._material=t},e.setTexture=function(t){this._texture=t},e.setSampler=function(t){this._sampler=t},e.setModel=function(){},e.setDrawInfoType=function(t){this._drawInfoType=t},e.setSubNode=function(t){this._subNode=t},e.setStride=function(t){this._stride=t},e.initRender2dBuffer=function(){},e.fillRender2dBuffer=function(){},n(t,[{key:"nativeObj",get:function(){return this._nativeObj}},{key:"render2dBuffer",get:function(){return this._render2dBuffer}}]),t}(),qF=IF(wF)>>2,XF=t("t",function(){function t(t){void 0===t&&(t=wF),this.chunk=null,this._renderDrawInfo=null,this._material=null,this._dataHash=0,this._isMeshBuffer=!1,this._vc=0,this._ic=0,this._floatStride=0,this._vertexFormat=wF,this._drawInfoType=0,this._multiOwner=!1,this._batcher=null,this._floatStride=t===wF?qF:IF(t)>>2,this._vertexFormat=t}var e=t.prototype;return e.isValid=function(){return this._ic>0&&this.chunk.vertexAccessor},e.initRenderDrawInfo=function(){},e.removeRenderDrawInfo=function(){},e.setRenderDrawInfoAttributes=function(){},n(t,[{key:"vertexCount",get:function(){return this._vc}},{key:"indexCount",get:function(){return this._ic}},{key:"stride",get:function(){return this._floatStride<<2}},{key:"floatStride",get:function(){return this._floatStride}},{key:"vertexFormat",get:function(){return this._vertexFormat}},{key:"drawInfoType",get:function(){return this._drawInfoType},set:function(t){this._drawInfoType=t}},{key:"renderDrawInfo",get:function(){return this._renderDrawInfo}},{key:"material",get:function(){return this._material},set:function(t){this._material=t}},{key:"dataHash",get:function(){return this._dataHash},set:function(t){this._dataHash=t}},{key:"multiOwner",get:function(){return this._multiOwner},set:function(t){this._multiOwner=t}},{key:"batcher",get:function(){return this._batcher||(this._batcher=GE.root.batcher2D),this._batcher}}]),t}()),YF=t("u",function(t){function e(e,i){var n;return void 0===e&&(e=wF),void 0===i&&(i=null),(n=t.call(this,e)||this)._vertDirty=!0,n._textureHash=0,n.indices=null,n.layer=0,n.nodeDirty=!0,n.passDirty=!0,n.textureDirty=!0,n.hashDirty=!0,n._data=[],n._frame=null,n._accessor=null,n.vertexRow=1,n.vertexCol=1,i||(i=n.batcher.switchBufferAccessor(n._vertexFormat)),n._accessor=i,n}s(e,t),e.add=function(t,i){void 0===t&&(t=wF),void 0===i&&(i=null);var n=new e(t,i);return i||(i=GE.root.batcher2D.switchBufferAccessor(n._vertexFormat)),n._accessor=i,n},e.remove=function(t){t.clear(),t._accessor=null};var i=e.prototype;return i.resize=function(t,e){t===this._vc&&e===this._ic&&this.chunk||(this._vc=t,this._ic=e,this.chunk&&(this._accessor.recycleChunk(this.chunk),this.chunk=null),this.chunk=this._accessor.allocateChunk(t,e),this.updateHash())},i.setRenderDrawInfoAttributes=function(){},i.fillDrawInfoAttributes=function(){},i.syncRender2dBuffer=function(){},i.resizeAndCopy=function(t,e){if(t!==this._vc||e!==this._ic||!this.chunk){this._vc=t,this._ic=e;var i=this.chunk;this.chunk=this._accessor.allocateChunk(t,e),i&&(this.chunk.vb.set(i.vb),this._accessor.recycleChunk(i)),this.updateHash()}},i.getMeshBuffer=function(){return this.chunk&&this._accessor?this._accessor.getMeshBuffer(this.chunk.bufferId):null},i.updateNode=function(t){this.layer=t.node.layer,this.nodeDirty=!1,this.hashDirty=!0},i.updatePass=function(t){this.material=t.getRenderMaterial(0),this.passDirty=!1,this.hashDirty=!0},i.updateTexture=function(t){this.frame=t,this.textureHash=t.getHash(),this.textureDirty=!1,this.hashDirty=!0},i.updateHash=function(){var t=""+(this.chunk?this.chunk.bufferId:-1)+this.layer+" "+this.textureHash;this.dataHash=jf(t,666),this.hashDirty=!1},i.updateRenderData=function(t,e){if(this.passDirty&&(this.material=t.getRenderMaterial(0),this.passDirty=!1,this.hashDirty=!0),this.nodeDirty){var i=t.node.scene?t._getRenderScene():null;this.layer=t.node.layer,null!==i&&(this.nodeDirty=!1),this.hashDirty=!0}this.textureDirty&&(this.frame=e,this.textureHash=e.getHash(),this.textureDirty=!1,this.hashDirty=!0),this.hashDirty&&this.updateHash()},i.clear=function(){this.resize(0,0),this._data.length=0,this.indices=null,this.vertDirty=!0,this.material=null,this.nodeDirty=!0,this.passDirty=!0,this.textureDirty=!0,this.hashDirty=!0,this.layer=0,this.frame=null,this.textureHash=0,this.dataHash=0},e.createStaticVBAccessor=function(t,e,i){var n=GE.root.device;return new kF(n,t,e,i)},n(e,[{key:"dataLength",get:function(){return this._data.length},set:function(t){var e=this._data;if(e.length!==t){for(var i=e.length;i>2,i._vertexFormat=t,i},e.remove=function(t){t.clear()};var i=e.prototype;return i.request=function(t,e){var i=this._byteLength+t*this.stride;return!!this.reserve(t,e)&&(this._vc+=t,this._ic+=e,this._byteLength=i,this.vertexRange=this._vc,this.indexRange=this._ic,!0)},i.reserve=function(t,e){var i=this._byteLength+t*this.stride,n=this.indexCount+e;if(t+this.vertexCount>65535)return!1;var r=this.vData.byteLength,s=this.iData.length,a=this.vData.length,o=this.iData.length;if(i>r||n>s){for(;r=0&&e>=0&&i<=this.vData.byteLength&&this.iData.length,this._vc=t,this._ic=e,this._byteLength=i,this.updateRange(0,t,0,e)},i.updateRange=function(t,e,i,n){e>=0&&n>=0&&e<=this._vc&&this._ic,this.vertexStart=t,this.indexStart=i,this.vertexRange=e,this.indexRange=n},i.requestIA=function(t){this._initIAInfo(t);var e=this._iaPool.add();return e.firstIndex=this.indexStart,e.indexCount=this.indexRange,e},i.uploadBuffers=function(){if(0!==this._byteLength&&this._vertexBuffers[0]&&this._indexBuffer){var t=this._ic,e=new Float32Array(this.vData.buffer,0,this._byteLength>>2),i=new Uint16Array(this.iData.buffer,0,t),n=this._vertexBuffers[0];this._byteLength>n.size&&n.resize(this._byteLength),n.update(e);var r=t<<1;r>this._indexBuffer.size&&this._indexBuffer.resize(r),this._indexBuffer.update(i)}},i.freeIAPool=function(){this._iaPool&&this._iaPool.reset()},i.reset=function(){this._vc=0,this._ic=0,this._byteLength=0,this.vertexStart=0,this.vertexRange=0,this.indexStart=0,this.indexRange=0,this.lastFilledIndex=0,this.lastFilledVertex=0,this.material=null,this.freeIAPool()},i.clear=function(){this.reset(),this._iaPool&&this._iaPool.destroy(),this._vertexBuffers[0]&&(this._vertexBuffers[0].destroy(),this._vertexBuffers=[]),this._iaInfo=null,this.vData=new Float32Array(256*this.stride),this.iData=new Uint16Array(1536)},i._initIAInfo=function(t){var e=this;if(!this._iaInfo){var i=this.stride,n=this._vertexBuffers;n.length||n.push(t.createBuffer(new h_(10,1,i,i))),this._indexBuffer||(this._indexBuffer=t.createBuffer(new h_(6,1,2,2))),this._iaInfo=new D_(this._vertexFormat,n,this._indexBuffer),this._iaPool=new ho((function(){return t.createInputAssembler(e._iaInfo)}),1,(function(t){t.destroy()}))}},i._reallocBuffer=function(t,e){var i=this.vData;this.vData=new Float32Array(t),i&&this.vData.set(i,0);var n=this.iData;this.iData=new Uint16Array(e),n&&this.iData.set(n,0)},i.setRenderDrawInfoAttributes=function(){},i.particleInitRenderDrawInfo=function(){},n(e,[{key:"formatByte",get:function(){return this.stride},set:function(){}},{key:"floatStride",get:function(){return this._floatStride}},{key:"vDataOffset",get:function(){return this._byteLength>>>2}}]),e}(XF)),JF=new ds,KF=new ds,ZF=new ir,$F=new Qr,tL=new Qr,eL=new Qr,iL=new Qr(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),nL=new ys,rL=t("e",Qh("cc.UITransform")(RF=Kh(110)(RF=Zh((VF=function(t){function e(){var e;return(e=t.call(this)||this)._priority=0,e._contentSize=FF&&FF(),e._anchorPoint=LF&&LF(),e}s(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiTransformComp=this},i.onLoad=function(){this.node.parent&&e.insertChangeMap(this.node.parent)},i.onEnable=function(){this.node.on("parent-changed",this._parentChanged,this),this._markRenderDataDirty()},i.onDisable=function(){this.node.off("parent-changed",this._parentChanged,this)},i.onDestroy=function(){this.node._uiProps.uiTransformComp=null},i.setContentSize=function(t,e){var i,n,r=this._contentSize;if(void 0===e){if(Zi(t.width,r.width,Ji)&&Zi(t.height,r.height,Ji))return;i=t.width,n=t.height}else{if(Zi(t,r.width,Ji)&&Zi(e,r.height,Ji))return;i=t,n=e}r.width=i,r.height=n,this.node.emit("size-changed"),this._markRenderDataDirty()},i.setAnchorPoint=function(t,e){var i=this._anchorPoint;if(void 0===e){if(t.x===i.x&&t.y===i.y)return;i.x=t.x,i.y=t.y}else{if(t===i.x&&e===i.y)return;i.x=t,i.y=e}this.node.emit("anchor-changed",this._anchorPoint),this._markRenderDataDirty()},i.isHit=function(t){for(var e=this._contentSize.width,i=this._contentSize.height,n=JF,r=KF,s=this._getRenderScene().cameras,a=0;a=0&&r.y>=0&&r.x<=e&&r.y<=i&&(c=this._maskTest(n)),c)return!0}}}return!1},i.hitTest=function(t,e){void 0===e&&(e=0);for(var i=this._contentSize.width,n=this._contentSize.height,r=ZF,s=JF,a=KF,o=this._getRenderScene().cameras,h=0;h=0&&a.y>=0&&a.x<=i&&a.y<=n&&(l=this._maskTest(s)),l)return!0}}return!1},i._maskTest=function(t){var e,i,n=null==(e=this.node)||null==(i=e.eventProcessor)?void 0:i.maskList;if(n)for(var r=this.node,s=n.length,a=0,o=0;r&&oh.index){n.length=o;break}}return!0},i.convertToNodeSpaceAR=function(t,e){return this.node.getWorldMatrix(eL),Qr.invert($F,eL),e||(e=new ir),ir.transformMat4(e,t,$F)},i.convertToWorldSpaceAR=function(t,e){return this.node.getWorldMatrix(eL),e||(e=new ir),ir.transformMat4(e,t,eL)},i.getBoundingBox=function(){var t=new ys;return this._selfBoundingBox(t),Qr.fromSRT(tL,this.node.rotation,this.node.position,this.node.scale),t.transformMat4(tL),t},i.getBoundingBoxToWorld=function(){for(var t=new ys,i=this.node.children,n=0;n=this._materials.length?null:this._materials[t]},i.setSharedMaterial=function(t,e){if(t&&t instanceof jT&&ht(12012),this._materials[e]!==t){this._materials[e]=t;var i=this._materialInstances[e];i&&(i.destroy(),this._materialInstances[e]=null),this._onMaterialModified(e,this._materials[e])}},i.getMaterialInstance=function(t){if(!this._materials[t])return null;if(!this._materialInstances[t]){gL.parent=this._materials[t],gL.owner=this,gL.subModelIdx=t;var e=new jT(gL);gL.parent=null,gL.owner=null,gL.subModelIdx=0,this.setMaterialInstance(e,t)}return this._materialInstances[t]},i.setMaterialInstance=function(t,e){if("number"==typeof t){at(12007);var i=t;t=e,e=i}var n=this._materialInstances[e];t&&t.parent?t!==n&&(this._materialInstances[e]=t,this._onMaterialModified(e,t)):(t!==this._materials[e]||n)&&this.setSharedMaterial(t,e)},i.getRenderMaterial=function(t){return this._materialInstances[t]||this._materials[t]},i._onMaterialModified=function(){},i._onRebuildPSO=function(){},i._clearMaterials=function(){},n(e,[{key:"sharedMaterial",get:function(){return this.getSharedMaterial(0)}},{key:"sharedMaterials",get:function(){return this._materials},set:function(t){for(var e=0;e0},i._postCanRender=function(){},i.updateMaterial=function(){if(this._customMaterial)this.getSharedMaterial(0)!==this._customMaterial&&this.setSharedMaterial(this._customMaterial,0);else{var t=this._updateBuiltinMaterial();this.setSharedMaterial(t,0),2!==this.stencilStage&&6!==this.stencilStage||this.getMaterialInstance(0).recompileShaders({USE_ALPHA_TEST:!0}),this._updateBlendFunc()}},i._updateColor=function(){this.node._uiProps.colorDirty=!0,this.setEntityColorDirty(!0),this.setEntityColor(this._color),this.setEntityOpacity(this.node._uiProps.localOpacity);var t=this._assembler;if(t){t.updateColor&&t.updateColor(this);var e=this._renderFlag;if(this._renderFlag=this._canRender(),this.setEntityEnabled(this._renderFlag),e!==this._renderFlag){var i=this.renderData;i&&(i.vertDirty=!0)}}},e.setEntityColorDirtyRecursively=function(t,i){var n=t._uiProps.uiComp;n&&n.color&&(n._renderEntity.colorDirty=i);for(var r=0;r>16,t|=t>>8,t|=t>>4,t|=t>>2,t|=t>>1,++t}function ZV(t,e){return Math.ceil(t/e)*e}var $V=function(){function t(t){this._format=0,this._formatSize=0,this._chunks=[],this._chunkCount=0,this._handles=[],this._region0=new e_,this._region1=new e_,this._region2=new e_,this._roundUpFn=null,this._bufferViewCtor=Uint8Array,this._channels=4,this._alignment=1,this._device=t}var e=t.prototype;return e.initialize=function(t){var e=ep[t.format];this._format=t.format,this._formatSize=e.size,this._channels=e.count,this._bufferViewCtor=lp(e),this._roundUpFn=t.roundUpFn||null,this._alignment=t.alignment||1,t.inOrderFree&&(this.alloc=this._McDonaldAlloc)},e.destroy=function(){for(var t=0;t=0));++r);if(n>=0){var s=this._chunks[i];s.start+=t;var a={chunkIdx:i,start:n,end:n+t,texture:s.texture};return this._handles.push(a),a}var o=Math.sqrt(t/this._formatSize),h=this._roundUpFn&&this._roundUpFn(o,this._formatSize)||Math.max(1024,KV(o)),u=this._chunks[this.createChunk(h)];u.start+=t;var l={chunkIdx:this._chunkCount-1,start:0,end:t,texture:u.texture};return this._handles.push(l),l},e.free=function(t){for(var e=0;e0&&(this._region0.texOffset.x=a,this._region0.texOffset.y=o,this._region0.texExtent.width=h,this._region0.texExtent.height=1,i.push(new this._bufferViewCtor(e,u*this._formatSize,h*this._channels)),n.push(this._region0),a=0,o+=1,s-=h,u+=h),s>0&&(this._region1.texOffset.x=a,this._region1.texOffset.y=o,s>t.texture.width?(this._region1.texExtent.width=t.texture.width,this._region1.texExtent.height=Math.floor(s/t.texture.width),h=this._region1.texExtent.width*this._region1.texExtent.height):(h=s,this._region1.texExtent.width=h,this._region1.texExtent.height=1),i.push(new this._bufferViewCtor(e,u*this._formatSize,h*this._channels)),n.push(this._region1),a=0,o+=this._region1.texExtent.height,s-=h,u+=h),s>0&&(this._region2.texOffset.x=a,this._region2.texOffset.y=o,this._region2.texExtent.width=s,this._region2.texExtent.height=1,i.push(new this._bufferViewCtor(e,u*this._formatSize,s*this._channels)),n.push(this._region2)),this._device.copyBuffersToTexture(i,t.texture,n)},e._findAvailableSpace=function(t,e){var i=this._chunks[e],n=!1,r=i.start;if(r+t<=i.size)n=!0;else{r=0;for(var s=this._handles.filter((function(t){return t.chunkIdx===e})).sort((function(t,e){return t.start-e.start})),a=0;ai.end?r+t<=i.size?n=!0:t<=i.end&&(i.start=r=0,n=!0):r===i.end&&(i.start=r=0,i.end=i.size,t<=i.end&&(n=!0)),n){i.start+=t;var s={chunkIdx:e,start:r,end:r+t,texture:i.texture};return this._handles.push(s),s}}var a=Math.sqrt(t/this._formatSize),o=this._roundUpFn&&this._roundUpFn(a,this._formatSize)||Math.max(1024,KV(a)),h=this._chunks[this.createChunk(o)];h.start+=t;var u={chunkIdx:this._chunkCount,start:0,end:t,texture:h.texture};return this._handles.push(u),u},t}();mt(DP.prototype,"RenderScene.prototype",[{name:"raycastUI2DNode"},{name:"raycastUINode"}]),mt(DP.prototype,"RenderScene.prototype",[{name:"raycastAll",suggest:"using intersect.rayModel in geometry"},{name:"raycastAllModels",suggest:"using intersect.rayModel in geometry"},{name:"raycastSingleModel",suggest:"using intersect.rayModel in geometry"},{name:"raycastAllCanvas",suggest:"using intersect.rayAABB in geometry"},{name:"rayResultCanvas"},{name:"rayResultModels"},{name:"rayResultAll"},{name:"rayResultSingleModel"}]),mt(WM.prototype,"Model.prototype",[{name:"isInstancingEnabled"},{name:"instancedAttributes"}]);var tN={};mt(tN,"CameraVisFlags",[{name:"GENERAL"}]),pt(tN,"CameraVisFlags",[{name:"PROFILER",newName:"PROFILER",target:Fv.BitMask,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Fv.BitMask,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Fv.BitMask,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Fv.BitMask,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Fv.BitMask,targetName:"UI_2D"}]),A.CameraVisFlags=tN;var eN={};mt(eN,"VisibilityFlags",[{name:"GENERAL"}]),pt(eN,"VisibilityFlags",[{name:"ALWALS",newName:"ALWALS",target:Fv.Enum,targetName:"ALWALS"},{name:"PROFILER",newName:"PROFILER",target:Fv.Enum,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Fv.Enum,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Fv.Enum,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Fv.Enum,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Fv.Enum,targetName:"UI_2D"}]),A.VisibilityFlags=eN,pt(bT.prototype,"Pass.prototype",[{name:"getBindingTypeFromHandle",newName:"getDescriptorTypeFromHandle"}]),mt(kM.prototype,"Camera.prototype",[{name:"getSplitFrustum"},{name:"setMatView"},{name:"setMatViewInv"},{name:"setMatProjInv"},{name:"setMatViewProjInv"},{name:"setMatProj"},{name:"setMatViewProj"},{name:"getMatViewInv"}]),mt(HT.prototype,"Shadows.prototype",[{name:"aspect"},{name:"selfShadow"},{name:"linear"},{name:"packing"},{name:"autoAdapt"},{name:"fixedArea"},{name:"pcf"},{name:"bias"},{name:"normalBias"},{name:"near"},{name:"far"},{name:"shadowDistance"},{name:"invisibleOcclusionRange"},{name:"orthoSize"},{name:"saturation"}]),mt(hP.prototype,"SpotLight.prototype",[{name:"aspect"}]),pt(OM.prototype,"SubModel.prototype",[{name:"subMeshData",newName:"subMesh"}]),mt(OM.prototype,"SubModel.prototype",[{name:"getSubModel",suggest:"Use `subModels[i]` instead"},{name:"subModelNum",suggest:"Use `subModels.length` instead"}]);var iN=Object.freeze({__proto__:null,BatchingSchemes:{NONE:0,INSTANCING:1},CameraVisFlags:tN,MaterialInstance:jT,Pass:bT,PassInstance:WT,PassStage:{DEFAULT:1,FORWARD:2,SHADOWCAST:4},RenderQueue:{OPAQUE:0,TRANSPARENT:1,OVERLAY:2},RenderScene:DP,RenderWindow:EP,TextureBufferPool:$V,VisibilityFlags:eN,createIA:function(t,e){if(!e.positions)return ht(16306),null;for(var i=[],n=e.positions.length/3,r=0;r=2*sN)l=2*sN;else for(;l<0;)l+=2*sN;else if(lN(l)>=2*sN)l=2*-sN;else for(;l>0;)l-=2*sN;for(h=0|oN(1,aN(lN(l)/(.5*sN)+.5,5)),c=lN(4/3*(1-hN(o=l/h/2))/uN(o)),a||(c=-c),x=0;x<=h;x++)_=e+(f=hN(u=r+l*(x/h)))*n,p=i+(d=uN(u))*n,m=-d*n*c,g=f*n*c,0===x?t.moveTo(_,p):t.bezierCurveTo(v+b,y+S,_-m,p-g,_,p),v=_,y=p,b=m,S=g}function _N(t,e,i,n,r){t.moveTo(e-n,i),t.bezierCurveTo(e-n,i+r*fN,e-n*fN,i+r,e,i+r),t.bezierCurveTo(e+n*fN,i+r,e+n,i+r*fN,e+n,i),t.bezierCurveTo(e+n,i-r*fN,e+n*fN,i-r,e,i-r),t.bezierCurveTo(e-n*fN,i-r,e-n,i-r*fN,e-n,i),t.close()}function pN(t,e,i,n,r,s){if(s<.1)t.rect(e,i,n,r);else{var a=aN(s,.5*lN(n))*cN(n),o=aN(s,.5*lN(r))*cN(r);t.moveTo(e,i+o),t.lineTo(e,i+r-o),t.bezierCurveTo(e,i+r-o*(1-fN),e+a*(1-fN),i+r,e+a,i+r),t.lineTo(e+n-a,i+r),t.bezierCurveTo(e+n-a*(1-fN),i+r,e+n,i+r-o*(1-fN),e+n,i+r-o),t.lineTo(e+n,i+o),t.bezierCurveTo(e+n,i+o*(1-fN),e+n-a*(1-fN),i,e+n-a,i),t.lineTo(e+a,i),t.bezierCurveTo(e+a*(1-fN),i,e,i+o*(1-fN),e,i+o),t.close()}}function mN(t,e,i,n,r,s,a,o,h,u,l){var c,f,d,_,p,m,g,v,y,b,S,x,w,T,C,A;u>10||(p=.5*(s+o),m=.5*(a+h),g=.5*((c=.5*(e+n))+(d=.5*(n+s))),v=.5*((f=.5*(i+r))+(_=.5*(r+a))),((C=lN((n-o)*(T=h-i)-(r-h)*(w=o-e)))+(A=lN((s-o)*T-(a-h)*w)))*(C+A)0){for(var i=0;ii)for(var n=i;n=0&&s.y>=0&&s.x<=n&&s.y<=r;else if(1===this.type){var h=n/2,u=r/2,l=s.x-.5*n,c=s.y-.5*r;o=l*l/(h*h)+c*c/(u*u)<1}return this._inverted&&(o=!o),o},i._nodeStateChange=function(){this._updateGraphics()},i._changeRenderType=function(){3!==this._type?this._createGraphics():this._createSprite()},i._createSprite=function(){if(!this._sprite){var t=this._sprite=this.node.getComponent(FV);if(!t){var e=this.node;t=this._sprite=e.addComponent(FV)}}this._sprite.stencilStage=this.inverted?6:2,this._sprite.updateMaterial()},i._createGraphics=function(){if(!this._graphics){var t=this._graphics=this.node.getComponent(qN);if(!t){var e=this.node;t=this._graphics=e.addComponent(qN)}t.lineWidth=1;var i=cr.WHITE.clone();i.a=0,t.fillColor=i}this._graphics.stencilStage=this.inverted?6:2},i._updateGraphics=function(){if(this._graphics&&(0===this._type||1===this._type)){var t=this.node._getUITransformComp(),e=this._graphics;e.clear();var i=t.contentSize,n=i.width,r=i.height,s=t.anchorPoint,a=-n*s.x,o=-r*s.y;if(0===this._type)e.rect(a,o,n,r);else if(1===this._type){for(var h=KN(new ir(a+n/2,o+r/2,0),new ir(n/2,r/2,0),this._segments),u=0;up?0:_>0?_:p}C.Canvas=hU,mt(t("U",Qh("cc.UIComponent")(sU=Jh(rL)(sU=Kh(110)(sU=Zh(sU=function(t){function e(){var e;return(e=t.call(this)||this)._lastParent=null,e.stencilStage=0,e}s(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiComp=this},i.onEnable=function(){},i.onDisable=function(){},i.onDestroy=function(){var t=this.node._uiProps;t.uiComp===this&&(t.uiComp=null)},i.postUpdateAssembler=function(){},i.markForUpdateRenderData=function(){},i.setNodeDirty=function(){},i.setTextureDirty=function(){},e}(gg))||sU)||sU)||sU)||sU).prototype,"UIComponent",[{name:"_visibility"},{name:"setVisibility"}]),pt(hU.prototype,"Canvas.prototype",[{name:"camera",newName:"cameraComponent.camera",customGetter:function(){var t;return null==(t=this._cameraComponent)?void 0:t.camera}},{name:"clearFlag",newName:"cameraComponent.clearFlags",customGetter:function(){return this._cameraComponent?this._cameraComponent.clearFlags:0},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.clearFlags=t)}},{name:"color",newName:"cameraComponent.clearColor",customGetter:function(){return this._cameraComponent?this._cameraComponent.clearColor:cr.BLACK},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.clearColor=t)}},{name:"priority",newName:"cameraComponent.priority",customGetter:function(){return this._cameraComponent?this._cameraComponent.priority:0},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.priority=t)}},{name:"targetTexture",newName:"cameraComponent.targetTexture",customGetter:function(){return this._cameraComponent?this._cameraComponent.targetTexture:null},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.targetTexture=t)}},{name:"visibility",newName:"cameraComponent.visibility",customGetter:function(){return this._cameraComponent?this._cameraComponent.visibility:0}}]),gt(rL.prototype,"UITransform.prototype",[{name:"priority",suggest:"Please use setSiblingIndex to change index of the current node in its parent's children array."}]),C.UITransformComponent=rL,le(rL,"cc.UITransformComponent"),le(xL,"cc.RenderComponent"),C.CanvasComponent=hU,le(hU,"cc.CanvasComponent"),C.internal.Renderable2D=xL,le(xL,"cc.Renderable2D");var lU,cU,fU,dU,_U,pU,mU,gU,vU=(lU=no.create(),cU={distance:1/0,doubleSided:!1,mode:2},fU=0,dU=function(t,e,i,n,r,s){1===t?(fU>e||0===fU)&&(fU=e,s&&(0===s.length?s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}):(s[0].distance=e,s[0].vertexIndex0=i/3,s[0].vertexIndex1=n/3,s[0].vertexIndex2=r/3))):(fU=e,s&&s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}))},_U=function(t,e,i,n,r){if(7===i)for(var s=e.length,a=0;ar.distance)&&(dU(r.mode,l,o,h,u,r.result),2===r.mode))return l}else if(8===i)for(var c=e.length-2,f=0,d=0;dr.distance)&&(dU(r.mode,g,_,p,m,r.result),2===r.mode))return g}else if(9===i){var v=e.length-1,y=3*e[0];ir.set(lU.a,t[y],t[y+1],t[y+2]);for(var b=1;br.distance)&&(dU(r.mode,w,y,S,x,r.result),2===r.mode))return w}}return fU},function(t,e,i){if(fU=0,0===e.geometricInfo.positions.length)return fU;var n=void 0===i?cU:i;if(uU(t,e.geometricInfo.boundingBox.min,e.geometricInfo.boundingBox.max)){var r=e.primitiveMode,s=e.geometricInfo,a=s.positions,o=s.indices;_U(a,o,r,t,n)}return fU}),yU=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:2};return function(i,n,r){t=0;var s=void 0===r?e:r,a=n.renderingSubMeshes.length,o=n.struct.minPosition,h=n.struct.maxPosition;if(o&&h&&!uU(i,o,h))return t;for(var u=0;uc)&&(t=c,s.subIndices&&(s.subIndices[0]=u));else if(t=c,s.subIndices&&s.subIndices.push(u),2===s.mode)return c}return t&&1===s.mode&&(s.result&&(s.result[0].distance=t,s.result.length=1),s.subIndices&&(s.subIndices.length=1)),t}}(),bU=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:2},i=new Ls,n=new Qr;return function(r,s,a){t=0;var o=void 0===a?e:a,h=s.worldBounds;if(h&&!Ka.rayAABB(r,h))return t;Ls.copy(i,r),s.node&&(Qr.invert(n,s.node.getWorldMatrix(n)),ir.transformMat4(i.o,r.o,n),ir.transformMat4Normal(i.d,r.d,n));for(var u=s.subModels,l=0;lf)&&(t=f,o.subIndices&&(o.subIndices[0]=l));else if(t=f,o.subIndices&&o.subIndices.push(l),2===o.mode)return f}return t&&1===o.mode&&(o.result&&(o.result[0].distance=t,o.result.length=1),o.subIndices&&(o.subIndices.length=1)),t}}();Ka.rayModel=bU,Ka.raySubMesh=vU,Ka.rayMesh=yU,pT("specular-pass");var SU,xU,wU,TU,CU,AU,DU,IU,BU,MU,PU,EU,kU,RU,OU,FU,LU=t("dO",Qh("cc.ModelRenderer")((mU=function(t){function e(){var e;return(e=t.call(this)||this)._visFlags=gU&&gU(),e._models=[],e._priority=0,e}s(e,t);var i=e.prototype;return i._collectModels=function(){return this._models},i.onEnable=function(){this._updatePriority()},i._attachToScene=function(){},i._detachFromScene=function(){},i._onVisibilityChange=function(){},i._updatePriority=function(){if(this._models.length>0)for(var t=0;tc;){if((s/=2)<1){s*=2;break}a=a.substring(r,s),o=n.substring(s),this._calculateSize(h,e,a)}for(var f=1e3,d=1;f&&r0&&(d=_[0].length),s+=d,a=n.substring(r,s),o=n.substring(s),this._calculateSize(h,e,a),f--}for(;f&&a.length>=2&&h.x>c;)s-=d,a=n.substring(r,s),this._calculateSize(h,e,a),d=1,f--;if(a.length>=2){var p=BO(a);p&&p.length>0&&a!==p[0]&&(s-=p[0].length,a=n.substring(r,s))}if(i.push(a),r=s,s+=a.length,a=n.substring(r,s),o=n.substring(s),this._calculateSize(u,e,o),this._calculateSize(h,e,a),f--,u.x<2048&&h.x=0;e--){var i=t[e];if(i.name===fG||i.name===dG){i.parent=null;var n=vG(i.name);n.node=i,i.name===fG?(n.comp=i.getComponent(PV),mG.put(n)):(n.comp=i.getComponent(FV),gG.put(n)),this._labelChildrenNum--}}this._segments.length=0,this._labelSegmentsCache.length=0,this._linesWidth.length=0,this._lineOffsetX=0,this._lineCount=1,this._labelWidth=0,this._labelHeight=0,this._layoutDirty=!0},i._activateChildren=function(t){for(var e=this.node.children.length-1;e>=0;e--){var i=this.node.children[e];i.name!==fG&&i.name!==dG||(i.active=t)}},i._addLabelSegment=function(t,e){var i;if(0===this._labelSegmentsCache.length)i=this._createFontLabel(t);else{var n=(i=this._labelSegmentsCache.pop()).node.getComponent(PV);n&&(n.string=t)}var r=i.comp;return r.verticalAlign!==this._verticalAlign&&(r.verticalAlign=this._verticalAlign),i.styleIndex=e,i.lineCount=this._lineCount,i.node._getUITransformComp().setAnchorPoint(0,0),i.node.layer=this.node.layer,this.node.insertChild(i.node,this._labelChildrenNum++),this._applyTextAttribute(i),this._segments.push(i),i},i._updateRichTextWithMaxWidth=function(t,e,i){var n=e;if(this._lineOffsetX>0&&n+this._lineOffsetX>this._maxWidth)for(var r=0;this._lineOffsetX<=this._maxWidth;){var s=this._getFirstWordLen(t,r,t.length),a=t.substr(r,s),o=this._measureText(i,a);if(!(this._lineOffsetX+o<=this._maxWidth)){if(r>0){var h=t.substr(0,r);this._addLabelSegment(h,i),t=t.substr(r,t.length),n=this._measureText(i,t)}this._updateLineInfo();break}this._lineOffsetX+=o,r+=s}if(n>this._maxWidth)for(var u=MO(t,n,this._maxWidth,this._measureText(i)),l=0;l1&&l0?(o*=a=l/h,h*=a):(o*=a=this._lineHeight/h,h*=a),u>0&&(o=u),this._maxWidth>0?(this._lineOffsetX+o>this._maxWidth&&this._updateLineInfo(),this._lineOffsetX+=o):(this._lineOffsetX+=o,this._lineOffsetX>this._labelWidth&&(this._labelWidth=this._lineOffsetX)),r.node._getUITransformComp().setContentSize(o,h),r.lineCount=this._lineCount,r.clickHandler="",r.clickParam="";var c=e.event;c&&(r.clickHandler=c.click,r.clickParam=c.param)}else at(4400)}},i._updateTextDefaultColor=function(){for(var t=0;t0){var u=this._measureText(n,h);this._updateRichTextWithMaxWidth(h,u,n),a.length>1&&othis._labelWidth&&(this._labelWidth=this._lineOffsetX),a.length>1&&o0&&(this._labelWidth=this._maxWidth),this._labelHeight=(this._lineCount+aO)*this._lineHeight,this.node._getUITransformComp().setContentSize(this._labelWidth,this._labelHeight),this._updateRichTextPosition(),this._layoutDirty=!1}},i._getFirstWordLen=function(t,e,i){var n=wO(t,e);if(yO(n)||bO(n))return 1;for(var r=1,s=e+1;se&&(t=0,e=h);var u=this._labelWidth*(.5*this._horizontalAlign-r);switch(this._horizontalAlign){case 0:break;case 1:u-=this._linesWidth[h-1]/2;break;case 2:u-=this._linesWidth[h-1]}var l=o.node.position;if(o.node.setPosition(t+u,this._lineHeight*(i-h)-this._labelHeight*s,l.z),h===e&&(t+=o.node._getUITransformComp().width),o.node.getComponent(FV)){var c=o.node.position.clone(),f=this._lineHeight,d=this._lineHeight*(1+aO);switch(o.node._getUITransformComp().anchorY){case 1:c.y+=f+(d-f)/2;break;case.5:c.y+=d/2;break;default:c.y+=(d-f)/2}if(o.imageOffset){var _=o.imageOffset.split(",");if(1===_.length&&_[0]){var p=parseFloat(_[0]);Number.isInteger(p)&&(c.y+=p)}else if(2===_.length){var m=parseFloat(_[0]),g=parseFloat(_[1]);Number.isInteger(m)&&(c.x+=m),Number.isInteger(g)&&(c.y+=g)}}o.node.position=c}var v=o.node.getComponent(PV);if(v&&v.enableOutline){var y=o.node.position.clone();y.y-=v.outlineWidth,o.node.position=y}}},i._convertLiteralColorValue=function(t){var e=t.toUpperCase();return cr[e]?cr[e]:(new cr).fromHEX(t)},i._applyTextAttribute=function(t){var e=t.node.getComponent(PV);if(e){this._resetLabelState(e);var i,n=t.styleIndex;if(this._textArray[n]&&(i=this._textArray[n].style),i){if(i.color?e.color=this._convertLiteralColorValue(i.color):e.color=this._fontColor,e.isBold=!!i.bold,e.isItalic=!!i.italic,e.isUnderline=!!i.underline,i.outline){var r=t.node.getComponent(PV);r||(r=t.node.addComponent(PV)),r.enableOutline=!0,r.outlineColor=this._convertLiteralColorValue(i.outline.color),r.outlineWidth=i.outline.width}e.fontSize=i.size||this._fontSize,t.clickHandler="",t.clickParam="";var s=i.event;s&&(t.clickHandler=s.click||"",t.clickParam=s.param||"")}e.cacheMode=this._cacheMode,this._font instanceof nO&&!this._isSystemFontUsed?e.font=this._font:e.fontFamily=this._fontFamily,e.useSystemFont=this._isSystemFontUsed,e.lineHeight=this._lineHeight,e.updateRenderData(!0)}},i._applyLayer=function(){var t=this;this._segments.forEach((function(e){e.node.layer=t.node.layer}))},i._resetLabelState=function(t){t.fontSize=this._fontSize,t.color=this._fontColor,t.isBold=!1,t.isItalic=!1,t.isUnderline=!1},n(e,[{key:"string",get:function(){return this._string},set:function(t){this._string!==t&&(this._string=t,this._updateRichTextStatus())}},{key:"horizontalAlign",get:function(){return this._horizontalAlign},set:function(t){this.horizontalAlign!==t&&(this._horizontalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"verticalAlign",get:function(){return this._verticalAlign},set:function(t){this._verticalAlign!==t&&(this._verticalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontSize",get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontColor",get:function(){return this._fontColor},set:function(t){this._fontColor!==t&&(this._fontColor=t,this._updateTextDefaultColor())}},{key:"fontFamily",get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"font",get:function(){return this._font},set:function(t){this._font!==t&&(this._font=t,this._layoutDirty=!0,this._font?(this.useSystemFont=!1,this._onTTFLoaded()):this.useSystemFont=!0,this._updateRichTextStatus())}},{key:"useSystemFont",get:function(){return this._isSystemFontUsed},set:function(t){this._isSystemFontUsed!==t&&(this._isSystemFontUsed=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"cacheMode",get:function(){return this._cacheMode},set:function(t){this._cacheMode!==t&&(this._cacheMode=t,this._updateRichTextStatus())}},{key:"maxWidth",get:function(){return this._maxWidth},set:function(t){this._maxWidth!==t&&(this._maxWidth=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"lineHeight",get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"imageAtlas",get:function(){return this._imageAtlas},set:function(t){this._imageAtlas!==t&&(this._imageAtlas=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"handleTouchEvent",get:function(){return this._handleTouchEvent},set:function(t){this._handleTouchEvent!==t&&(this._handleTouchEvent=t,this.enabledInHierarchy&&(this.handleTouchEvent?this._addEventListeners():this._removeEventListeners()))}}]),e}(gg),lG.HorizontalAlign=oV,lG.VerticalAlign=hV,y((QU=lG).prototype,"horizontalAlign",[GU],Object.getOwnPropertyDescriptor(QU.prototype,"horizontalAlign"),QU.prototype),y(QU.prototype,"verticalAlign",[HU],Object.getOwnPropertyDescriptor(QU.prototype,"verticalAlign"),QU.prototype),y(QU.prototype,"fontColor",[WU],Object.getOwnPropertyDescriptor(QU.prototype,"fontColor"),QU.prototype),y(QU.prototype,"font",[jU],Object.getOwnPropertyDescriptor(QU.prototype,"font"),QU.prototype),y(QU.prototype,"cacheMode",[qU],Object.getOwnPropertyDescriptor(QU.prototype,"cacheMode"),QU.prototype),y(QU.prototype,"imageAtlas",[XU],Object.getOwnPropertyDescriptor(QU.prototype,"imageAtlas"),QU.prototype),JU=Nh(QU.prototype,"_lineHeight",[hu],(function(){return 40})),KU=Nh(QU.prototype,"_string",[hu],(function(){return"RichText"})),ZU=Nh(QU.prototype,"_horizontalAlign",[hu],(function(){return 0})),$U=Nh(QU.prototype,"_verticalAlign",[hu],(function(){return 0})),tG=Nh(QU.prototype,"_fontSize",[hu],(function(){return 40})),eG=Nh(QU.prototype,"_fontColor",[hu],(function(){return cr.WHITE.clone()})),iG=Nh(QU.prototype,"_maxWidth",[hu],(function(){return 0})),nG=Nh(QU.prototype,"_fontFamily",[hu],(function(){return"Arial"})),rG=Nh(QU.prototype,"_font",[hu],(function(){return null})),sG=Nh(QU.prototype,"_isSystemFontUsed",[hu],(function(){return!0})),aG=Nh(QU.prototype,"_userDefinedFont",[hu],(function(){return null})),oG=Nh(QU.prototype,"_cacheMode",[hu],(function(){return 0})),hG=Nh(QU.prototype,"_imageAtlas",[hu],(function(){return null})),uG=Nh(QU.prototype,"_handleTouchEvent",[hu],(function(){return!0})),YU=QU))||YU)||YU));C.RichText=bG,C.MaskComponent=sz,le(sz,"cc.MaskComponent"),C.LabelComponent=PV,le(PV,"cc.LabelComponent"),C.LabelOutlineComponent=NV,le(NV,"cc.LabelOutlineComponent"),C.RichTextComponent=bG,le(bG,"cc.RichTextComponent"),C.SpriteComponent=FV,le(FV,"cc.SpriteComponent"),C.UIModelComponent=VV,le(VV,"cc.UIModelComponent"),C.GraphicsComponent=qN,le(qN,"cc.GraphicsComponent"),le(YV,"cc.UIStaticBatchComponent"),le(JV,"cc.UIOpacityComponent"),pt(sz.prototype,"Mask",[{name:"graphics",newName:"subComp",target:sz.prototype,targetName:"Mask"}]),pt(ZN,"MaskType",[{name:"RECT",newName:"GRAPHICS_RECT",target:ZN,targetName:"MaskType"},{name:"ELLIPSE",newName:"GRAPHICS_ELLIPSE",target:ZN,targetName:"MaskType"},{name:"IMAGE_STENCIL",newName:"SPRITE_STENCIL",target:ZN,targetName:"MaskType"}]),gt(NV.prototype,"LabelOutline",[{name:"width",suggest:"Please use Label.outlineWidth instead."},{name:"color",suggest:"Please use Label.outlineColor instead."}]),gt(QV.prototype,"LabelShadow",[{name:"color",suggest:"Please use Label.shadowColor instead."},{name:"offset",suggest:"Please use Label.shadowOffset instead."},{name:"blur",suggest:"Please use Label.shadowBlur instead."}]);var SG=["left","center","right"],xG=2048,wG=uO(),TG=(1/255).toFixed(3),CG=function(){this.char="",this.valid=!0,this.x=0,this.y=0,this.line=0,this.hash=""},AG=function(){function t(){this._context=null,this._canvas=null,this._canvasData=null,this._lettersInfo=[],this._tmpRect=new ys,this._maxFontSize=100,this._fontScale=1;var t=this._canvasData=hF.getInstance().get();this._canvas=t.canvas,this._context=t.context}var e=t.prototype;return e.destroy=function(){hF.getInstance().put(this._canvasData),this._canvasData=null,this._canvas=null,this._context=null,this._lettersInfo.length=0},e.processingString=function(t,e,i,n,r,s){if(t)e.fntConfig?this._fontScale=1:this._fontScale=this._getStyleFontScale(e.originFontSize,e.fontScale),pF.fontScale=this._fontScale,this._setupBMFontOverflowMetrics(i,n),this._updateFontScale(e),this._computeHorizontalKerningForText(e,i,r),this._alignText(e,i,n,r);else{var a=0;for(this._fontScale=this._getStyleFontScale(e.fontSize,e.fontScale),this._updatePaddingRect(e,n),this._calculateLabelFont(e,i,n,r);(n.canvasSize.width>xG||n.canvasSize.height>xG)&&a<=3;){if(++a>3)this._fontScale=1;else{var o=Math.max(n.canvasSize.width,n.canvasSize.height),h=xG/o;this._fontScale*=h,this._fontScale=Math.max(1,this._fontScale)}this._updatePaddingRect(e,n),this._calculateLabelFont(e,i,n,r)}}s&&(s=n.parsedString)},e.generateRenderInfo=function(t,e,i,n,r,s,a){t?(this._computeAlignmentOffset(e,i,n),this.generateVertexData(t,e,i,n,r,s,a)):(this._updateLabelDimensions(e,i,n),this._updateTexture(e,i,n,r),this.generateVertexData(t,e,i,n,r,s,a))},e.setCanvasUsed=function(t,e){this._canvas=t,this._context=e},e._getStyleFontScale=function(t,e){var i=e,n=this._maxFontSize;return i*t>n&&t_?f:_}var p=f,m=(s.length+aO)*this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);o.width=p+u.width*c,o.height=m+u.height*c,h.width=(p+l.width*c)/c,h.height=(m+l.height*c)/c;break;case 2:this._calculateShrinkFont(r,t,e,i),this._calculateWrapText(r,t,e,i),o.width=h.width*c,o.height=h.height*c;break;case 1:this._calculateWrapText(r,t,e,i),o.width=h.width*c,o.height=h.height*c;break;case 3:this._calculateWrapText(r,t,e,i);var g=(i.parsedString.length+aO)*this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);o.width=h.width*c,o.height=g+u.height*c,h.height=(g+l.height*c)/c}}},e._getFontDesc=function(t,e,i,n){var r=t.toString()+"px ";return r+=e,i&&(r="bold "+r),n&&(r="italic "+r),r},e._getLineHeight=function(t,e,i){return 0===t?e:t*e/i},e._calculateShrinkFont=function(t,e,i,n){if(this._context){var r=this._getFontDesc(e.actualFontSize,e.fontFamily,e.isBold,e.isItalic);this._context.font=r;var s=this._calculateParagraphLength(t,this._context,r),a=0,o=0,h=0,u=e.actualFontSize,l=n.canvasSize,c=n.nodeContentSize,f=n.canvasPadding,d=this._fontScale;if(i.wrapping){var _=c.width*d,p=c.height*d;if(_<0||p<0)return;o=p+1;for(var m=0,g=0|e.actualFontSize+1,v=0;m>1)<=0){it(4003);break}u=v,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r;var y=this._getLineHeight(i.lineHeight,u,e.fontSize);for(o=0,a=0;ap?g=v-1:m=v}0===m?it(4003):(u=m,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r)}else{for(o=t.length*this._getLineHeight(i.lineHeight,u,e.fontSize),a=0;a1&&i.hasShadow,h=this._measureText(this._context,i.fontDesc),u=0,l=0,c=0;c0&&this._isVerticalClamp(t,e,i,n,this)&&this._shrinkLabelToContentSize(t,e,i,n,this._isVerticalClamp),t.fontSize>0&&this._isHorizontalNeedShrink(e,i)&&this._shrinkLabelToContentSize(t,e,i,n,this._isHorizontalClamp)),this._parsedString(i,n)},e._parsedString=function(t,e){for(var i=[],n="",r=0,s=0,a=xO(e);r0&&h>0&&A+_.w*t.bmfontScale>e.maxLineWidth&&!bO(m)){e.linesWidth.push(c),c=0,o++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,x=!0;break}w.x=A,w.y=u-_.offsetY*t.bmfontScale,this._recordLetterInfo(w,m,C,o),C+1w.y-_.h*t.bmfontScale&&(y=w.y-_.h*t.bmfontScale)}else this._recordPlaceholderInfo(C,m),null!=t.fntConfig?it(16354,t.fntConfig.atlasName,m):it(16355,t.fontFamily,m);else this._recordPlaceholderInfo(C,m)}x||(h=S,fy&&(d=y),l<(c=b)&&(l=c),p+=g)}else e.linesWidth.push(c),c=0,o++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,this._recordPlaceholderInfo(p,m),p++}e.linesWidth.push(c),e.numberOfLines=o+1,e.textDesiredHeight=e.numberOfLines*e.lineHeight*this._getFontScale(t,e),e.numberOfLines>1&&(e.textDesiredHeight+=0*(e.numberOfLines-1));var D=i.nodeContentSize;return D.width=e.textWidthTemp,D.height=e.textHeightTemp,e.textWidthTemp<=0&&(D.width=parseFloat(l.toFixed(2))+2*pF.margin),e.textHeightTemp<=0&&(D.height=parseFloat(e.textDesiredHeight.toFixed(2))+2*pF.margin),e.tailoredTopY=D.height,e.tailoredBottomY=0,f>0&&(e.tailoredTopY=D.height+f),d<-e.textDesiredHeight&&(e.tailoredBottomY=e.textDesiredHeight+d),!0},e._recordPlaceholderInfo=function(t,e){var i=this._lettersInfo;if(t>=i.length){var n=new CG;i.push(n)}i[t].char=e,i[t].hash=""+TO(e,0)+pF.hash,i[t].valid=!1},e._recordLetterInfo=function(t,e,i,n){var r=this._lettersInfo;if(i>=r.length){var s=new CG;r.push(s)}var a=""+TO(e,0)+pF.hash;r[i].line=n,r[i].char=e,r[i].hash=a,r[i].valid=pF.fontAtlas.getLetter(a).valid,r[i].x=t.x,r[i].y=t.y},e._getFirstWordLen=function(t,e,i,n,r){var s=wO(i,n);if(yO(s)||"\n"===s||bO(s))return 1;var a=pF.fontAtlas,o=1,h=a.getLetterDefinitionForChar(s,pF);if(!h)return o;for(var u=h.xAdvance*t.bmfontScale+e.spacingX,l=n+1;le.maxLineWidth&&!bO(s)&&e.maxLineWidth>0)return o;if(u+=h.xAdvance*t.bmfontScale+e.spacingX,"\n"===s||bO(s)||yO(s))break;o++}return o},e._computeAlignmentOffset=function(t,e,i){var n=i.nodeContentSize;switch(e.linesOffsetX.length=0,e.letterOffsetY=0,e.horizontalAlign){case 0:for(var r=0;ri.nodeContentSize.height},e._isHorizontalClamp=function(t,e,i,n,r){for(var s=!1,a=0,o=xO(n);a0){var f=i.nodeContentSize;if(e.wrapping){if(e.linesWidth[c]>f.width&&(l>f.width||l<0)){s=!0;break}}else if(l>f.width){s=!0;break}}}}return s},e._isHorizontalNeedShrink=function(t,e){for(var i=0,n=t.linesWidth.length;ie.nodeContentSize.width)return!0;return!1},e._shrinkLabelToContentSize=function(t,e,i,n,r){for(var s=0,a=0|t.actualFontSize,o=0;s>1;if(h<=0)break;t.bmfontScale=h/(t.originFontSize*this._fontScale),this._multilineTextWrap(t,e,i,n,this._getFirstWordLen),this._computeAlignmentOffset(t,e,i),r(t,e,i,n,this)?a=o-1:s=o}s>=0&&this._scaleFontSizeDown(t,e,i,n,s)},e._scaleFontSizeDown=function(t,e,i,n,r){var s=!0;r||(r=.1,s=!1),t.actualFontSize=r,s&&(this._updateFontScale(t),this._multilineTextWrap(t,e,i,n,this._getFirstWordLen))},e._updateQuads=function(t,e,i,n,r,s){for(var a=pF.fontAtlas,o=t.spriteFrame?t.spriteFrame.texture:a.getTexture(),h=i.nodeContentSize,u=n.uiTransAnchorX*h.width,l=n.uiTransAnchorY*h.height,c=0,f=xO(r);c0){if(m>e.tailoredTopY){var g=m-e.tailoredTopY;p.y+=g,p.height-=g,m-=g}m-p.height*t.bmfontScale0&&this._isHorizontalClamped(e,i,y,v)&&1===e.overFlow&&(p.width=0),p.height>0&&p.width>0){var b=this._determineRect(t),S=d.x+e.linesOffsetX[d.line],x=n.quadCount;n.quadCount+=4,this.updateQuatCount(n),s(t,i,n,x,o,p,b,S-u,m-l)}}else at(16353)}}return!0},e._isHorizontalClamped=function(t,e,i,n){var r=e.nodeContentSize,s=t.linesWidth[n],a=i>r.width||i<0;return t.wrapping?s>r.width&&a:a},e._determineRect=function(t){var e=t.spriteFrame;if(!e)return!1;var i=e.isRotated(),n=e.getOriginalSize(),r=e.getRect(),s=e.getOffset(),a=s.x+(n.width-r.width)/2,o=s.y-(n.height-r.height)/2,h=this._tmpRect;if(i){var u=h.x;h.x=r.x+r.height-h.y-h.height-o,h.y=u+r.y-a,h.y<0&&(h.height+=o)}else h.x+=r.x-a,h.y+=r.y+o;return i},t}();AG.instance=void 0,AG.instance=new AG;var DG=new _F(64,64),IG=new rF(null),BG=null,MG=null,PG=null,EG=null,kG=null,RG=function(){function t(){}var e=t.prototype;return e.updateProcessingData=function(t,e,i,n,r,s){t.fontSize=r.fontSize,t.actualFontSize=r.fontSize,t.originFontSize=PG?PG.fontSize:r.fontSize,e.horizontalAlign=r.horizontalAlign,e.verticalAlign=r.verticalAlign,e.spacingX=r.spacingX;var a=r.overflow;e.overFlow=a,e.lineHeight=r.lineHeight,i.nodeContentSize.width=s.width,i.nodeContentSize.height=s.height,0===a?(e.wrapping=!1,i.nodeContentSize.width+=2*pF.margin,i.nodeContentSize.height+=2*pF.margin):3===a?(e.wrapping=!0,i.nodeContentSize.height+=2*pF.margin):e.wrapping=r.enableWrapText,n.uiTransAnchorX=s.anchorX,n.uiTransAnchorY=s.anchorY,pF.lineHeight=r.lineHeight,pF.fontSize=r.fontSize,t.spriteFrame=EG,t.fntConfig=PG,t.fontFamily=pF.fontFamily,t.color.set(r.color)},e.updateRenderData=function(t){if(t.renderData&&BG!==t){if(t.renderData.vertDirty){MG=(BG=t).node._getUITransformComp();var e=t.renderData,i=AG.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,a=t.textRenderData;n.fontScale=Rk.getScaleX(),this._updateFontFamily(t),this.updateProcessingData(n,r,s,a,t,MG),this._updateLabelInfo(t),n.fontDesc=pF.fontDesc,i.processingString(!0,n,r,s,t.string),a.quadCount=0,i.generateRenderInfo(!0,n,r,s,a,t.string,this.generateVertexData),e.dataLength!==a.quadCount&&(this.resetRenderData(t),e.dataLength=a.quadCount,e.resize(e.dataLength,e.dataLength/2*3));for(var o=e.data,h=0,u=a.quadCount;h0?(pF.isOutlined=!0,pF.margin=t.outlineWidth,pF.out=t.outlineColor.clone(),pF.out.a=t.outlineColor.a*t.color.a/255):(pF.isOutlined=!1,pF.margin=0)},i._getFontFamily=function(t){var e="Arial";return t.useSystemFont?e=t.fontFamily||"Arial":t.font&&(e=t.font._nativeAsset||"Arial"),e},i._updateLabelInfo=function(t){pF.fontDesc=this._getFontDesc(),pF.color.set(t.color),pF.hash=mF(pF)},i._getFontDesc=function(){return pF.fontSize.toString()+"px "+pF.fontFamily},e}(RG),zG=new cr(255,255,255,255),UG=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.createData=function(t){var e=t.requestRenderData();return e.resize(0,0),e},i.fillBuffers=function(t){if(t.renderData){var e=t.node;zG.a=255*e._uiProps.opacity,jp(e,0,t.renderData,zG)}},i.updateColor=function(){},e}(NG),GG=new UG;PV.Overflow;var HG=function(){function t(){}var e=t.prototype;return e.updateProcessingData=function(t,e,i,n,r,s){t.isSystemFontUsed=r.useSystemFont,t.fontSize=r.fontSize,i.nodeContentSize.width=i.canvasSize.width=s.width,i.nodeContentSize.height=i.canvasSize.height=s.height,e.lineHeight=r.lineHeight,e.overFlow=r.overflow,0===r.overflow?e.wrapping=!1:3===r.overflow?e.wrapping=!0:e.wrapping=r.enableWrapText,t.isBold=r.isBold,t.isItalic=r.isItalic,t.isUnderline=r.isUnderline,t.underlineHeight=r.underlineHeight,r.enableOutline&&r.outlineWidth>0?(t.isOutlined=!0,t.outlineColor.set(r.outlineColor),t.outlineWidth=r.outlineWidth):t.isOutlined=!1,r.enableShadow&&(r.shadowBlur>0||!Zi(r.shadowOffset.x,0)||!Zi(r.shadowOffset.y,0))?(t.hasShadow=!0,t.shadowColor.set(r.shadowColor),t.shadowBlur=r.shadowBlur,t.shadowOffsetX=r.shadowOffset.x,t.shadowOffsetY=r.shadowOffset.y):t.hasShadow=!1,t.color.set(r.color),n.texture=r.spriteFrame,n.uiTransAnchorX=s.anchorX,n.uiTransAnchorY=s.anchorY,e.horizontalAlign=r.horizontalAlign,e.verticalAlign=r.verticalAlign},e.getAssemblerData=function(){var t=PV._canvasPool.get();return t.canvas.width=t.canvas.height=1,t},e.resetAssemblerData=function(t){t&&PV._canvasPool.put(t)},e.updateRenderData=function(t){if(t.renderData){if(t.renderData.vertDirty){var e=t.node._getUITransformComp(),i=AG.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,a=t.textRenderData;n.fontScale=Rk.getScaleX(),this.updateProcessingData(n,r,s,a,t,e),i.setCanvasUsed(t.assemblerData.canvas,t.assemblerData.context),n.fontFamily=this._updateFontFamily(t),this._resetDynamicAtlas(t),i.processingString(!1,n,r,s,t.string),i.generateRenderInfo(!1,n,r,s,a,t.string,this.generateVertexData);var o=t.renderData;o.textureDirty=!0,this._calDynamicAtlas(t,s),t.actualFontSize=n.actualFontSize,e.setContentSize(s.nodeContentSize);var h=o.data;h[0]=a.vertexBuffer[0],h[1]=a.vertexBuffer[1],h[2]=a.vertexBuffer[2],h[3]=a.vertexBuffer[3],this.updateUVs(t),t.renderData.vertDirty=!1,t.contentWidth=s.nodeContentSize.width}t.spriteFrame&&t.renderData.updateRenderData(t,t.spriteFrame)}},e.generateVertexData=function(t,e,i){var n=i.vertexBuffer,r=e.nodeContentSize.width,s=e.nodeContentSize.height,a=i.uiTransAnchorX*r,o=i.uiTransAnchorY*s;n[0].x=-a,n[0].y=-o,n[1].x=r-a,n[1].y=-o,n[2].x=-a,n[2].y=s-o,n[3].x=r-a,n[3].y=s-o},e.updateVertexData=function(){},e.updateUVs=function(){},e._updateFontFamily=function(t){return t.useSystemFont?t.fontFamily||"Arial":t.font&&t.font._nativeAsset||"Arial"},e._calDynamicAtlas=function(t,e){if(!(1!==t.cacheMode||e.canvasSize.width<=0||e.canvasSize.height<=0)){var i=t.ttfSpriteFrame;Hk.packToDynamicAtlas(t,i)}},e._resetDynamicAtlas=function(t){if(1===t.cacheMode){var e=t.ttfSpriteFrame;Hk.deleteAtlasSpriteFrame(e),e._resetDynamicAtlasFrame()}},t}(),WG=cr.WHITE.clone(),jG=Uint16Array.from([0,1,2,1,3,2]),qG=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.createData=function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6),t.textRenderData.quadCount=4;for(var i=e.chunk.vb,n=e.floatStride,r=[{u:0,v:1},{u:1,v:1},{u:0,v:0},{u:1,v:0}],s=3,a=0,o=e.dataLength;a1?1:r)<0?0:r;var s=(n=(n=n>1?1:n)<0?0:n)+(r=(r-=n)<0?0:r);s=s>1?1:s,this.updateUVs(t,n,s),this.updateVertexData(t,n,s),i.updateRenderData(t,e)}},e.updateUVs=function(t,e,i){var n=t.spriteFrame,r=t.renderData,s=r.chunk.vb,a=n.width,o=n.height,h=n.rect,u=0,l=0,c=0,f=0,d=0,_=0,p=0,m=0,g=0,v=0;n.isRotated()?(u=h.x/a,l=(h.y+h.width)/o,c=d=u,p=g=(h.x+h.height)/a,_=v=l,f=m=h.y/o):(u=h.x/a,l=(h.y+h.height)/o,c=p=u,d=g=(h.x+h.width)/a,f=_=l,m=v=h.y/o);var y=r.floatStride,b=3;switch(t.fillType){case 0:s[b]=c+(d-c)*e,s[b+1]=f+(_-f)*e,s[b+=y]=c+(d-c)*i,s[b+1]=f+(_-f)*i,s[b+=y]=p+(g-p)*e,s[b+1]=m+(v-m)*e,s[b+=y]=p+(g-p)*i,s[b+1]=m+(v-m)*i;break;case 1:s[b]=c+(p-c)*e,s[b+1]=f+(m-f)*e,s[b+=y]=d+(g-d)*e,s[b+1]=_+(v-_)*e,s[b+=y]=c+(p-c)*i,s[b+1]=f+(m-f)*i,s[b+=y]=d+(g-d)*i,s[b+1]=_+(v-_)*i;break;default:ht(2626)}},e.updateVertexData=function(t,e,i){var n=t.renderData.data,r=t.node._getUITransformComp(),s=r.width,a=r.height,o=r.anchorX*s,h=r.anchorY*a,u=-o,l=-h,c=s-o,f=a-h,d=0;switch(t.fillType){case 0:d=u+(c-u)*i,u+=(c-u)*e,c=d;break;case 1:d=l+(f-l)*i,l+=(f-l)*e,f=d;break;default:ht(2626)}n[0].x=u,n[0].y=l,n[1].x=c,n[1].y=l,n[2].x=u,n[2].y=f,n[3].x=c,n[3].y=f},e.createData=function(t){var e=t.requestRenderData();return e.dataLength=4,e.resize(4,6),e.chunk.setIndexBuffer(JG),e.data.forEach((function(t){t.z=0})),e},e.updateWorldVertexData=function(t,e){t.node.getWorldMatrix(QG);for(var i=t.renderData.floatStride,n=t.renderData.data,r=e.vb,s=0,a=0;a<4;a++){var o=n[a],h=o.x,u=o.y,l=QG.m03*h+QG.m07*u+QG.m15;l=l?1/l:1,r[s=a*i]=(QG.m00*h+QG.m04*u+QG.m12)*l,r[s+1]=(QG.m01*h+QG.m05*u+QG.m13)*l,r[s+2]=(QG.m02*h+QG.m06*u+QG.m14)*l}},e.fillBuffers=function(t){var e=t.renderData,i=e.chunk;(t._flagChangedVersion!==t.node.flagChangedVersion||e.vertDirty)&&(this.updateWorldVertexData(t,i),e.vertDirty=!1,t._flagChangedVersion=t.node.flagChangedVersion),i.bufferId;var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,a=r.indexOffset;s[a++]=n,s[a++]=n+1,s[a++]=n+2,s[a++]=n+2,s[a++]=n+1,s[a++]=n+3,r.indexOffset+=6},e.updateColor=function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=5,s=t.color,a=s.r/255,o=s.g/255,h=s.b/255,u=t.node._uiProps.opacity,l=0;l<4;l++)i[r]=a,i[r+1]=o,i[r+2]=h,i[r+3]=u,r+=n},t}(),ZG=new KG,$G=2*Math.PI,tH=1e-6,eH=new Qr,iH=[new ds,new ds,new ds,new ds],nH=new Array(4),rH=new Array(8),sH=[new ds,new ds,new ds,new ds],aH=[new ds,new ds,new ds,new ds],oH=new ds,hH=[new ds,new ds,new ds,new ds],uH=null;function lH(t,e,i,n,r,s,a){var o=Math.sin(s);o=Math.abs(o)>tH?o:0;var h=Math.cos(s),u=0,l=0;if(0!==(h=Math.abs(h)>tH?h:0)){if(u=o/h,(t-r.x)*h>0){var c=r.y+u*(t-r.x);a[0].x=t,a[0].y=c}if((e-r.x)*h>0){var f=r.y+u*(e-r.x);a[2].x=e,a[2].y=f}}if(0!==o){if(l=h/o,(n-r.y)*o>0){var d=r.x+l*(n-r.y);a[3].x=d,a[3].y=n}if((i-r.y)*o>0){var _=r.x+l*(i-r.y);a[1].x=_,a[1].y=i}}}function cH(t){var e=t.node._getUITransformComp(),i=e.width,n=e.height,r=e.anchorX*i,s=e.anchorY*n,a=-r,o=-s,h=i-r,u=n-s,l=nH;l[0]=a,l[1]=o,l[2]=h,l[3]=u;var c=t.fillCenter,f=oH.x=Math.min(Math.max(0,c.x),1)*(h-a)+a,d=oH.y=Math.min(Math.max(0,c.y),1)*(u-o)+o;iH[0].x=iH[3].x=a,iH[1].x=iH[2].x=h,iH[0].y=iH[1].y=o,iH[2].y=iH[3].y=u,hH.forEach((function(t){ds.set(t,0,0)})),f!==l[0]&&ds.set(hH[0],3,0),f!==l[2]&&ds.set(hH[2],1,2),d!==l[1]&&ds.set(hH[1],0,1),d!==l[3]&&ds.set(hH[3],2,3)}function fH(t){var e=t.width,i=t.height,n=t.getRect(),r=0,s=0,a=0,o=0,h=rH;t.isRotated()?(r=n.x/e,s=(n.x+n.height)/e,a=n.y/i,o=(n.y+n.width)/i,h[0]=h[2]=r,h[4]=h[6]=s,h[3]=h[7]=o,h[1]=h[5]=a):(r=n.x/e,s=(n.x+n.width)/e,a=n.y/i,o=(n.y+n.height)/i,h[0]=h[4]=r,h[2]=h[6]=s,h[1]=h[3]=o,h[5]=h[7]=a)}function dH(t,e){var i=e.x-t.x,n=e.y-t.y;if(0===i&&0===n)return 0;if(0===i)return n>0?.5*Math.PI:1.5*Math.PI;var r=Math.atan(n/i);return i<0&&(r+=Math.PI),r}function _H(t,e,i,n,r){var s=nH,a=s[0],o=s[1],h=s[2],u=s[3];t[e].x=i.x,t[e].y=i.y,t[e+1].x=n.x,t[e+1].y=n.y,t[e+2].x=r.x,t[e+2].y=r.y,pH((i.x-a)/(h-a),(i.y-o)/(u-o),t,e),pH((n.x-a)/(h-a),(n.y-o)/(u-o),t,e+1),pH((r.x-a)/(h-a),(r.y-o)/(u-o),t,e+2)}function pH(t,e,i,n){var r=rH,s=r[0]+(r[2]-r[0])*t,a=r[4]+(r[6]-r[4])*t,o=r[1]+(r[3]-r[1])*t,h=r[5]+(r[7]-r[5])*t,u=i[n];u.u=s+(a-s)*e,u.v=o+(h-o)*e}for(var mH=function(){function t(){}var e=t.prototype;return e.createData=function(t){return t.requestRenderData()},e.updateRenderData=function(t){var e=t.spriteFrame;Hk.packToDynamicAtlas(t,e),this.updateUVs(t);var i=t.renderData;if(i&&e){if(!i.vertDirty)return;var n=i.data,r=t.fillStart,s=t.fillRange;for(s<0&&(r+=s,s=-s);r>=1;)r-=1;for(;r<0;)r+=1;var a=(r*=$G)+(s*=$G);cH(t),fH(e),lH(nH[0],nH[2],nH[1],nH[3],oH,r,sH),lH(nH[0],nH[2],nH[1],nH[3],oH,r+s,aH);for(var o=0,h=0;h<4;++h){var u=hH[h];if(u)if(s>=$G)i.dataLength=o+3,_H(n,o,oH,iH[u.x],iH[u.y]),o+=3;else{var l=dH(oH,iH[u.x]),c=dH(oH,iH[u.y]);c=a||(l>=r?(i.dataLength=o+3,_H(n,o,oH,iH[u.x],c>=a?aH[h]:iH[u.y]),o+=3):c>r&&(c<=a?(i.dataLength=o+3,_H(n,o,oH,sH[h],iH[u.y]),o+=3):(i.dataLength=o+3,_H(n,o,oH,sH[h],aH[h]),o+=3))),l+=$G,c+=$G}}0===o&&(i.dataLength=0),i.resize(o,o),i.updateRenderData(t,e)}},e.createQuadIndices=function(t){uH=null,uH=new Uint16Array(t);for(var e=0,i=0;i1?1:p,m=Number.isNaN(m)||m>1?1:m,d=d<0?0:d,_=_<0?0:_,SH[0].x=-a,SH[0].y=-o,SH[1].x=u*p-a,SH[1].y=f*m-o,SH[2].x=SH[1].x+d,SH[2].y=SH[1].y+_,SH[3].x=r-a,SH[3].y=s-o;for(var g=0;g<4;g++)for(var v=0;v<4;v++){var y=4*g+v;y0||t.insetBottom>0||t.insetLeft>0||t.insetRight>0)?2:0}var LH=function(){function t(){}var e=t.prototype;return e.createData=function(t){return t.requestRenderData()},e.updateRenderData=function(t){var e=t.renderData;if(e){var i=t.spriteFrame;if(i&&e&&e.vertDirty){var n=t.node._getUITransformComp(),r=Math.abs(n.width),s=Math.abs(n.height),a=i.getRect(),o=i.insetLeft,h=i.insetRight,u=a.width-o-h,l=i.insetTop,c=i.insetBottom,f=a.height-l-c,d=r-o-h,_=s-l-c;d=d>0?d:0,_=_>0?_:0;var p=0===u?d:d/u,m=0===f?_:_/f,g=FH(i),v=Math.ceil(m+g),y=Math.ceil(p+g);e.dataLength=4*v*y,this.updateVerts(t,d,_,v,y),e.vertexCount!==v*y*4&&(t.renderEntity.colorDirty=!0),e.resize(v*y*4,v*y*6),e.updateRenderData(t,i)}}},e.createQuadIndices=function(t){if(t%6==0){var e=t/6;OH=new Uint16Array(t);for(var i=0,n=0;n1?1:s.width/(m+g),w=s.height/(y+b)>1?1:s.height/(y+b);o=v>0?Math.floor(1e3*e)/1e3%v==0?v:e%v:e,h=S>0?Math.floor(1e3*i)/1e3%S==0?S:i%S:i,RH.length=0,kH=Math.max(n+1,r+1);for(var T=0;T=r?f-_:A*v-_,RH[A].y=A>=n?d-p:A*S-p;else for(var D=0;D1&&D0?m*x-_+v*(D-1):m+e-_:D===r-1?RH[D].x=m*x-_+o+v*(D-2):D>=r&&(RH[D].x=Math.min(m+e+g,f)-_),0===D?RH[D].y=-p:1===D?RH[D].y=b*w-p:D>1&&D0?b*w-p+S*(D-1):b+i-p:D===n-1?RH[D].y=b*w-p+h+S*(D-2):D>=n&&(RH[D].y=Math.min(b+i+y,d)-p);for(var I=0,B=0,M=0,P=0,E=0;ES?i>=(C>0?H:H+1)*S?1:z%1:z;for(var W=0;Wv?e>=(C>0?W:W+1)*v?1:N%1:N,O?(0===C?(U[0]=DH.u,U[1]=DH.u,U[2]=DH.u+(IH.u-DH.u)*V,G[0]=TH.v,G[1]=TH.v+(CH.v-TH.v)*L,G[2]=TH.v):(0===H?(U[0]=wH.u,U[1]=wH.u,U[2]=DH.u):H0){var h=a.claimedTouchIdList.indexOf(n.getID());if(-1!==h){if(a._handleEventTouch(t),"touch-end"!==t.type&&"touch-cancel"!==t.type||(ye(a.claimedTouchIdList,h),t.preventSwallow||this._removeClaimedTouch(s+1,n.getID())),r=!1,!t.preventSwallow)break;t.preventSwallow=!1}}}return--this._inDispatchCount<=0&&this._updatePointerEventProcessorList(),r},e._removeClaimedTouch=function(t,e){for(var i=this._pointerEventProcessorList,n=i.length,r=t;re)for(;e0){for(var t=this._meshDataArray.length,e=0;e0){qp(r.renderData,a);var h=r.renderData.getMeshBuffer();h&&h.setDirty()}if(i.length>0&&!t._static)for(var u=0;u0&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates(),zH.sharedManager.exitMask())),e+=1}},e._screenSort=function(t,e){return t.node.siblingIndex-e.node.siblingIndex},e._releaseDescriptorSetCache=function(t){this._descriptorSetCache.releaseDescriptorSetCache(t)},e._createClearModel=function(){if(!this._maskClearModel){this._maskClearMtl=_T.get("default-clear-stencil"),this._maskClearModel=C.director.root.createModel(WM);var t=IF(SF),e=Hp.gfxDevice,i=e.createBuffer(new h_(10,1,4*t,t)),n=new Float32Array([-1,-1,0,1,-1,0,-1,1,0,1,1,0]);i.update(n);var r=e.createBuffer(new h_(6,1,12,2)),s=new Uint16Array([0,1,2,2,1,3]);r.update(s),this._maskModelMesh=new $E([i],SF,7,r),this._maskModelMesh.subMeshIdx=0,this._maskClearModel.initSubModel(0,this._maskModelMesh,this._maskClearMtl)}},e._insertMaskBatch=function(t){this.autoMergeBatches(this._currComponent),this.resetRenderStates(),this._createClearModel(),this._maskClearModel.node=this._maskClearModel.transform=t.node;var e=zH.sharedManager;e.pushMask(1);var i=e.clear(t),n=null,r=0,s=this._maskClearMtl;s&&(n=e.getStencilStage(i,s),r=e.getStencilHash(i));var a=this._maskClearModel,o=C.director.getTotalFrames();a&&(a.updateTransform(o),a.updateUBOs(o));for(var h=0;h=0;a--){var o=i[a],h=t[o];t.splice(o,1),this._localCachePool.free(h)}}},e.reset=function(){for(var t=this._localDescriptorSetCache,e=t.length,i=0;i>>0},t.getLayerIndex=function(t){void 0===t&&(t=0);var e=0;return this.indexMap.has(t)?e=this.indexMap.get(t):ht(2105),e},t.getLayerIndexByName=function(t){var e=this.getLayerByName(t);return this.getLayerIndex(e)},t.getLayerName=function(t){void 0===t&&(t=0);var e="";return this.nameMap.has(t)?e=this.nameMap.get(t):ht(2105),e},t.getLayerByName=function(t){for(var e=this.nameMap.size,i=this.nameMap.keys(),n=0,r=0;r=i.length||i[e].length===t.length&&(i[e]=t.slice(0),this._uploadSubMeshShapesWeights(e))},e.setWeight=function(t,e,i){var n=this._subMeshShapesWeights;if(!(e>=n.length)){var r=n[e];i>=r.length||(r[i]=t,this._uploadSubMeshShapesWeights(e))}},e.setInstancedAttribute=function(t,e){if(this.model)for(var i=this.model.subModels,n=0;n0&&this.bindposes.length>0},n(e,[{key:"joints",get:function(){return this._joints},set:function(t){this._joints=t}},{key:"bindposes",get:function(){return this._bindposes},set:function(t){this._bindposes=t}},{key:"inverseBindposes",get:function(){if(!this._invBindposes){this._invBindposes=[];for(var t=0;tzT.LEVEL_1},set:function(t){this._csmLevel=t?zT.LEVEL_4:zT.LEVEL_1,this._light&&(this._light.csmLevel=this._csmLevel,this._light.csmNeedUpdate=!0)}},{key:"csmLayerLambda",get:function(){return this._csmLayerLambda},set:function(t){this._csmLayerLambda=t,this._light&&(this._light.csmLayerLambda=this._csmLayerLambda,this._light.csmNeedUpdate=!0)}},{key:"csmOptimizationMode",get:function(){return this._csmOptimizationMode},set:function(t){this._csmOptimizationMode=t,this._light&&(this._light.csmOptimizationMode=this._csmOptimizationMode)}},{key:"shadowFixedArea",get:function(){return this._shadowFixedArea},set:function(t){this._shadowFixedArea=t,this._light&&(this._light.shadowFixedArea=this._shadowFixedArea)}},{key:"shadowNear",get:function(){return this._shadowNear},set:function(t){this._shadowNear=t,this._light&&(this._light.shadowNear=this._shadowNear)}},{key:"shadowFar",get:function(){return this._shadowFar},set:function(t){this._shadowFar=Math.min(t,HT.MAX_FAR),this._light&&(this._light.shadowFar=this._shadowFar)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(t){this._shadowOrthoSize=t,this._light&&(this._light.shadowOrthoSize=this._shadowOrthoSize)}},{key:"csmAdvancedOptions",get:function(){return this._csmAdvancedOptions},set:function(t){this._csmAdvancedOptions=t}},{key:"csmLayersTransition",get:function(){return this._csmLayersTransition},set:function(t){this._csmLayersTransition=t,this._light&&(this._light.csmLayersTransition=t)}},{key:"csmTransitionRange",get:function(){return this._csmTransitionRange},set:function(t){this._csmTransitionRange=t,this._light&&(this._light.csmTransitionRange=t)}}]),e}(GX),mq=Nh(pq.prototype,"_illuminanceHDR",[HX,Mj],(function(){return 65e3})),gq=Nh(pq.prototype,"_illuminanceLDR",[WX],(function(){return 65e3*kM.standardExposureValue})),vq=Nh(pq.prototype,"_shadowEnabled",[WX],(function(){return!1})),yq=Nh(pq.prototype,"_shadowPcf",[WX],(function(){return NT.HARD})),bq=Nh(pq.prototype,"_shadowBias",[WX],(function(){return 1e-5})),Sq=Nh(pq.prototype,"_shadowNormalBias",[WX],(function(){return 0})),xq=Nh(pq.prototype,"_shadowSaturation",[WX],(function(){return 1})),wq=Nh(pq.prototype,"_shadowDistance",[WX],(function(){return 50})),Tq=Nh(pq.prototype,"_shadowInvisibleOcclusionRange",[WX],(function(){return 200})),Cq=Nh(pq.prototype,"_csmLevel",[WX],(function(){return zT.LEVEL_4})),Aq=Nh(pq.prototype,"_csmLayerLambda",[WX],(function(){return.75})),Dq=Nh(pq.prototype,"_csmOptimizationMode",[WX],(function(){return UT.RemoveDuplicates})),Iq=Nh(pq.prototype,"_csmAdvancedOptions",[WX],(function(){return!1})),Bq=Nh(pq.prototype,"_csmLayersTransition",[WX],(function(){return!1})),Mq=Nh(pq.prototype,"_csmTransitionRange",[WX],(function(){return.05})),Pq=Nh(pq.prototype,"_shadowFixedArea",[WX],(function(){return!1})),Eq=Nh(pq.prototype,"_shadowNear",[WX],(function(){return.1})),kq=Nh(pq.prototype,"_shadowFar",[WX],(function(){return 10})),Rq=Nh(pq.prototype,"_shadowOrthoSize",[WX],(function(){return 5})),y(pq.prototype,"illuminance",[Pj],Object.getOwnPropertyDescriptor(pq.prototype,"illuminance"),pq.prototype),y(pq.prototype,"shadowEnabled",[Ej,kj],Object.getOwnPropertyDescriptor(pq.prototype,"shadowEnabled"),pq.prototype),y(pq.prototype,"shadowPcf",[Rj,Oj],Object.getOwnPropertyDescriptor(pq.prototype,"shadowPcf"),pq.prototype),y(pq.prototype,"shadowBias",[Fj,Lj],Object.getOwnPropertyDescriptor(pq.prototype,"shadowBias"),pq.prototype),y(pq.prototype,"shadowNormalBias",[Vj,Nj],Object.getOwnPropertyDescriptor(pq.prototype,"shadowNormalBias"),pq.prototype),y(pq.prototype,"shadowSaturation",[zj,Uj],Object.getOwnPropertyDescriptor(pq.prototype,"shadowSaturation"),pq.prototype),y(pq.prototype,"shadowDistance",[Gj,Hj],Object.getOwnPropertyDescriptor(pq.prototype,"shadowDistance"),pq.prototype),y(pq.prototype,"shadowInvisibleOcclusionRange",[Wj,jj],Object.getOwnPropertyDescriptor(pq.prototype,"shadowInvisibleOcclusionRange"),pq.prototype),y(pq.prototype,"csmLevel",[qj,Xj],Object.getOwnPropertyDescriptor(pq.prototype,"csmLevel"),pq.prototype),y(pq.prototype,"enableCSM",[Yj,Qj],Object.getOwnPropertyDescriptor(pq.prototype,"enableCSM"),pq.prototype),y(pq.prototype,"csmLayerLambda",[Jj,Kj],Object.getOwnPropertyDescriptor(pq.prototype,"csmLayerLambda"),pq.prototype),y(pq.prototype,"csmOptimizationMode",[Zj,$j],Object.getOwnPropertyDescriptor(pq.prototype,"csmOptimizationMode"),pq.prototype),y(pq.prototype,"shadowFixedArea",[tq,eq],Object.getOwnPropertyDescriptor(pq.prototype,"shadowFixedArea"),pq.prototype),y(pq.prototype,"shadowNear",[iq,nq],Object.getOwnPropertyDescriptor(pq.prototype,"shadowNear"),pq.prototype),y(pq.prototype,"shadowFar",[rq,sq],Object.getOwnPropertyDescriptor(pq.prototype,"shadowFar"),pq.prototype),y(pq.prototype,"shadowOrthoSize",[aq,oq],Object.getOwnPropertyDescriptor(pq.prototype,"shadowOrthoSize"),pq.prototype),y(pq.prototype,"csmAdvancedOptions",[hq,uq],Object.getOwnPropertyDescriptor(pq.prototype,"csmAdvancedOptions"),pq.prototype),y(pq.prototype,"csmLayersTransition",[lq,cq],Object.getOwnPropertyDescriptor(pq.prototype,"csmLayersTransition"),pq.prototype),y(pq.prototype,"csmTransitionRange",[fq,dq],Object.getOwnPropertyDescriptor(pq.prototype,"csmTransitionRange"),pq.prototype),_q=pq))||_q)),YX=t("af",(Oq=Qh("cc.SphereLight"),Fq=uu("_luminance"),Lq=Eu(li),Vq=Eu(li),Nq=Eu(zX),zq=Eu(ci),Uq=Eu(ci),Oq((Hq=function(t){function e(){var e;return(e=t.call(this)||this)._size=Wq&&Wq(),e._luminanceHDR=jq&&jq(),e._luminanceLDR=qq&&qq(),e._term=Xq&&Xq(),e._range=Yq&&Yq(),e._lightType=eP,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=1,this.size=this._size,this.range=this._range,this._light&&(this._light.luminanceHDR=this._luminanceHDR,this._light.luminanceLDR=this._luminanceLDR)},n(e,[{key:"luminousFlux",get:function(){return nb().isHDR?this._luminanceHDR*JM(this._size):this._luminanceLDR},set:function(t){var e=0;nb().isHDR?(this._luminanceHDR=t/JM(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return nb().isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){nb().isHDR?(this._luminanceHDR=t,this._light&&(this._light.luminanceHDR=this._luminanceHDR)):(this._luminanceLDR=t,this._light&&(this._light.luminanceLDR=this._luminanceLDR))}},{key:"term",get:function(){return this._term},set:function(t){this._term=t}},{key:"size",get:function(){return this._size},set:function(t){this._size=t,this._light&&(this._light.size=t)}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._light&&(this._light.range=t)}}]),e}(GX),Wq=Nh(Hq.prototype,"_size",[hu],(function(){return.15})),jq=Nh(Hq.prototype,"_luminanceHDR",[hu,Fq],(function(){return 1700/JM(.15)})),qq=Nh(Hq.prototype,"_luminanceLDR",[hu],(function(){return 1700/JM(.15)*kM.standardExposureValue*kM.standardLightMeterScale})),Xq=Nh(Hq.prototype,"_term",[hu],(function(){return zX.LUMINOUS_FLUX})),Yq=Nh(Hq.prototype,"_range",[hu],(function(){return 1})),y(Hq.prototype,"luminousFlux",[Lq],Object.getOwnPropertyDescriptor(Hq.prototype,"luminousFlux"),Hq.prototype),y(Hq.prototype,"luminance",[Vq],Object.getOwnPropertyDescriptor(Hq.prototype,"luminance"),Hq.prototype),y(Hq.prototype,"term",[Nq],Object.getOwnPropertyDescriptor(Hq.prototype,"term"),Hq.prototype),y(Hq.prototype,"size",[zq],Object.getOwnPropertyDescriptor(Hq.prototype,"size"),Hq.prototype),y(Hq.prototype,"range",[Uq],Object.getOwnPropertyDescriptor(Hq.prototype,"range"),Hq.prototype),Gq=Hq))||Gq)),QX=Eu,JX=hu,KX=uu,ZX=$h,$X=t("ag",(Qq=Qh("cc.SpotLight"),Jq=KX("_luminance"),Kq=QX(zX),Zq=QX(ci),$q=ZX({group:{name:"DynamicShadowSettings",displayOrder:1}}),tX=QX(fi),eX=ZX({group:{name:"DynamicShadowSettings",displayOrder:2}}),iX=QX(NT),nX=ZX({group:{name:"DynamicShadowSettings",displayOrder:3}}),rX=QX(ci),sX=ZX({group:{name:"DynamicShadowSettings",displayOrder:4}}),aX=QX(ci),Qq((hX=function(t){function e(){var e;return(e=t.call(this)||this)._size=uX&&uX(),e._luminanceHDR=lX&&lX(),e._luminanceLDR=cX&&cX(),e._term=fX&&fX(),e._range=dX&&dX(),e._spotAngle=_X&&_X(),e._angleAttenuationStrength=pX&&pX(),e._shadowEnabled=mX&&mX(),e._shadowPcf=gX&&gX(),e._shadowBias=vX&&vX(),e._shadowNormalBias=yX&&yX(),e._lightType=hP,e}return s(e,t),e.prototype._createLight=function(){if(t.prototype._createLight.call(this),this._type=2,this.size=this._size,this.range=this._range,this.spotAngle=this._spotAngle,this.angleAttenuationStrength=this._angleAttenuationStrength,this._light){var e=this._light;e.luminanceHDR=this._luminanceHDR,e.luminanceLDR=this._luminanceLDR,e.shadowEnabled=this._shadowEnabled,e.shadowPcf=this._shadowPcf,e.shadowBias=this._shadowBias,e.shadowNormalBias=this._shadowNormalBias}},n(e,[{key:"luminousFlux",get:function(){return nb().isHDR?this._luminanceHDR*JM(this._size):this._luminanceLDR},set:function(t){var e=0;nb().isHDR?(this._luminanceHDR=t/JM(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return nb().isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){nb().isHDR?(this._luminanceHDR=t,this._light&&(this._light.luminanceHDR=this._luminanceHDR)):(this._luminanceLDR=t,this._light&&(this._light.luminanceLDR=this._luminanceLDR))}},{key:"term",get:function(){return this._term},set:function(t){this._term=t}},{key:"size",get:function(){return this._size},set:function(t){this._size=t,this._light&&(this._light.size=t)}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._light&&(this._light.range=t)}},{key:"spotAngle",get:function(){return this._spotAngle},set:function(t){this._spotAngle=t,this._light&&(this._light.spotAngle=nn(t))}},{key:"angleAttenuationStrength",get:function(){return this._angleAttenuationStrength},set:function(t){this._angleAttenuationStrength=t,this._light&&(this._light.angleAttenuationStrength=t)}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t,this._light&&(this._light.shadowEnabled=t)}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t,this._light&&(this._light.shadowPcf=t)}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t,this._light&&(this._light.shadowBias=t)}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t,this._light&&(this._light.shadowNormalBias=t)}}]),e}(GX),uX=Nh(hX.prototype,"_size",[JX],(function(){return.15})),lX=Nh(hX.prototype,"_luminanceHDR",[JX,Jq],(function(){return 1700/JM(.15)})),cX=Nh(hX.prototype,"_luminanceLDR",[JX],(function(){return 1700/JM(.15)*kM.standardExposureValue*kM.standardLightMeterScale})),fX=Nh(hX.prototype,"_term",[JX],(function(){return zX.LUMINOUS_FLUX})),dX=Nh(hX.prototype,"_range",[JX],(function(){return 1})),_X=Nh(hX.prototype,"_spotAngle",[JX],(function(){return 60})),pX=Nh(hX.prototype,"_angleAttenuationStrength",[JX],(function(){return 0})),mX=Nh(hX.prototype,"_shadowEnabled",[JX],(function(){return!1})),gX=Nh(hX.prototype,"_shadowPcf",[JX],(function(){return NT.HARD})),vX=Nh(hX.prototype,"_shadowBias",[JX],(function(){return 1e-5})),yX=Nh(hX.prototype,"_shadowNormalBias",[JX],(function(){return 0})),y(hX.prototype,"term",[Kq],Object.getOwnPropertyDescriptor(hX.prototype,"term"),hX.prototype),y(hX.prototype,"size",[Zq],Object.getOwnPropertyDescriptor(hX.prototype,"size"),hX.prototype),y(hX.prototype,"shadowEnabled",[$q,tX],Object.getOwnPropertyDescriptor(hX.prototype,"shadowEnabled"),hX.prototype),y(hX.prototype,"shadowPcf",[eX,iX],Object.getOwnPropertyDescriptor(hX.prototype,"shadowPcf"),hX.prototype),y(hX.prototype,"shadowBias",[nX,rX],Object.getOwnPropertyDescriptor(hX.prototype,"shadowBias"),hX.prototype),y(hX.prototype,"shadowNormalBias",[sX,aX],Object.getOwnPropertyDescriptor(hX.prototype,"shadowNormalBias"),hX.prototype),oX=hX))||oX));t("ah",(bX=Qh("cc.PointLight"),SX=uu("_luminance"),xX=Eu(li),wX=Eu(li),TX=Eu(zX),CX=Eu(ci),bX((DX=function(t){function e(){var e;return(e=t.call(this)||this)._luminanceHDR=IX&&IX(),e._luminanceLDR=BX&&BX(),e._term=MX&&MX(),e._range=PX&&PX(),e._lightType=uP,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=3,this.range=this._range,this._light&&(this._light.luminanceHDR=this._luminanceHDR,this._light.luminanceLDR=this._luminanceLDR)},n(e,[{key:"luminousFlux",get:function(){return nb().isHDR?this._luminanceHDR*JM(1):this._luminanceLDR},set:function(t){var e=0;nb().isHDR?(this._luminanceHDR=t/JM(1),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return nb().isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){nb().isHDR?(this._luminanceHDR=t,this._light&&(this._light.luminanceHDR=this._luminanceHDR)):(this._luminanceLDR=t,this._light&&(this._light.luminanceLDR=this._luminanceLDR))}},{key:"term",get:function(){return this._term},set:function(t){this._term=t}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._light&&(this._light.range=t)}}]),e}(GX),IX=Nh(DX.prototype,"_luminanceHDR",[hu,SX],(function(){return 1700/JM(.15)})),BX=Nh(DX.prototype,"_luminanceLDR",[hu],(function(){return 1700/JM(.15)*kM.standardExposureValue*kM.standardLightMeterScale})),MX=Nh(DX.prototype,"_term",[hu],(function(){return zX.LUMINOUS_FLUX})),PX=Nh(DX.prototype,"_range",[hu],(function(){return 1})),y(DX.prototype,"luminousFlux",[xX],Object.getOwnPropertyDescriptor(DX.prototype,"luminousFlux"),DX.prototype),y(DX.prototype,"luminance",[wX],Object.getOwnPropertyDescriptor(DX.prototype,"luminance"),DX.prototype),y(DX.prototype,"term",[TX],Object.getOwnPropertyDescriptor(DX.prototype,"term"),DX.prototype),y(DX.prototype,"range",[CX],Object.getOwnPropertyDescriptor(DX.prototype,"range"),DX.prototype),AX=DX))||AX)),t("ai",(EX=Qh("cc.RangedDirectionalLight"),kX=uu("_illuminance"),RX=Eu(li),EX((FX=function(t){function e(){var e;return(e=t.call(this)||this)._illuminanceHDR=LX&&LX(),e._illuminanceLDR=VX&&VX(),e._lightType=cP,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=4,this._light&&(this._light.illuminanceHDR=this._illuminanceHDR,this._light.illuminanceLDR=this._illuminanceLDR)},n(e,[{key:"illuminance",get:function(){return nb().isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){nb().isHDR?(this._illuminanceHDR=t,this._light&&(this._light.illuminanceHDR=this._illuminanceHDR)):(this._illuminanceLDR=t,this._light&&(this._light.illuminanceLDR=this._illuminanceLDR))}}]),e}(GX),LX=Nh(FX.prototype,"_illuminanceHDR",[$h,kX],(function(){return 65e3})),VX=Nh(FX.prototype,"_illuminanceLDR",[hu],(function(){return 65e3*kM.standardExposureValue})),y(FX.prototype,"illuminance",[RX],Object.getOwnPropertyDescriptor(FX.prototype,"illuminance"),FX.prototype),OX=FX))||OX)),C.LightComponent=GX,le(GX,"cc.LightComponent"),C.DirectionalLightComponent=XX,le(XX,"cc.DirectionalLightComponent"),C.SphereLightComponent=YX,le(YX,"cc.SphereLightComponent"),C.SpotLightComponent=$X,le($X,"cc.SpotLightComponent"),pt($X.prototype,"SpotLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),pt(YX.prototype,"SphereLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),pt(GX.PhotometricTerm,"Light.PhotometricTerm",[{name:"LUMINOUS_POWER",newName:"LUMINOUS_FLUX"}]);var tY=Symbol("BakeNodeCurves"),eY=t("g3",function(){function t(){}return t.getOrExtract=function(e){var i=t.pool.get(e);if(!i||i.samples!==e.sample){i&&C.director.root.dataPoolManager.releaseAnimationClip(e);var n=Math.ceil(e.sample*e.duration)+1,r=e.sample;i=e[tY](0,r,n),t.pool.set(e,i)}return i},t.destroy=function(e){t.pool.delete(e)},t}());eY.pool=new Map;var iY=new Qr;function nY(t,e,i){for(Qr.identity(i);t!==e;)Qr.fromRTS(iY,t.rotation,t.position,t.scale),Qr.multiply(i,iY,i),t=t.parent;return i}var rY=new p_(1,1,0,2,2,2),sY=function(t,e,i){t[e+0]=i.m00,t[e+1]=i.m01,t[e+2]=i.m02,t[e+3]=i.m12,t[e+4]=i.m04,t[e+5]=i.m05,t[e+6]=i.m06,t[e+7]=i.m13,t[e+8]=i.m08,t[e+9]=i.m09,t[e+10]=i.m10,t[e+11]=i.m14};function aY(t){return 2&t.getFormatFeatures(44)?44:35}function oY(t,e){var i=4/Math.sqrt(e);return 12*Math.ceil(Math.max(480*i,t)/12)}new kr,new kr,new ir,new kr,new ir;var hY=new ir,uY=new ir,lY=new ir,cY=new ir,fY=new Qr,dY=new Qr,_Y=new mh,pY=Number.MAX_SAFE_INTEGER,mY=function(){function t(t){this._device=void 0,this._pool=void 0,this._textureBuffers=new Map,this._formatSize=void 0,this._pixelsPerJoint=void 0,this._customPool=void 0,this._chunkIdxMap=new Map,this._device=t;var e=aY(this._device);this._formatSize=ep[e].size,this._pixelsPerJoint=48/this._formatSize,this._pool=new $V(t),this._pool.initialize({format:e,roundUpFn:oY}),this._customPool=new $V(t),this._customPool.initialize({format:e,roundUpFn:oY})}var e=t.prototype;return e.clear=function(){this._pool.destroy(),this._textureBuffers.clear()},e.registerCustomTextureLayouts=function(t){for(var e=0;e0&&t.refCount--,!t.refCount&&t.readyToBeDeleted){var e=t.skeletonHash^t.clipHash;(void 0!==this._chunkIdxMap.get(e)?this._customPool:this._pool).free(t.handle),this._textureBuffers.get(e)===t&&this._textureBuffers.delete(e)}},e.releaseSkeleton=function(t){for(var e=this._textureBuffers.values(),i=e.next();!i.done;){var n=i.value;n.skeletonHash===t.hash&&(n.readyToBeDeleted=!0,n.refCount?this._textureBuffers.delete(n.skeletonHash^n.clipHash):this.releaseHandle(n)),i=e.next()}},e.releaseAnimationClip=function(t){for(var e=this._textureBuffers.values(),i=e.next();!i.done;){var n=i.value;n.clipHash===t.hash&&(n.readyToBeDeleted=!0,n.refCount?this._textureBuffers.delete(n.skeletonHash^n.clipHash):this.releaseHandle(n)),i=e.next()}},e._createAnimInfos=function(t,e,i){for(var n=[],r=t.joints,s=t.bindposes,a=r.length,o=eY.getOrExtract(e),h=0;h0;){t=vY[--i],vY[i]=null;var r=t.node;Qr.fromRTS(t.local,r.rotation,r.position,r.scale),n=Qr.multiply(t.world,n,t.local)}return n}function SY(t,e){for(var i,n=null,r=0;t!==e;){var s=t.uuid;if(yY.has(s)){n=yY.get(s);break}n={node:t,local:new Qr,world:new Qr,stamp:-1,parent:null},yY.set(s,n),vY[r++]=n,t=t.parent,n=null}for(;r>0;)i=vY[--r],vY[r]=null,i.parent=n,n=i;return n}function xY(t){for(var e=yY.get(t.uuid)||null;e;)yY.delete(e.node.uuid),e=e.parent}var wY=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!1}],TY=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!0}];function CY(t,e,i,n){for(var r=0;r=0&&(e.push(r),t.push(a))}}var AY=new ir,DY=new ir,IY=new ir,BY=new ir,MY=new Qr,PY=new mh,EY=function(){this._format=44,this._textures=[],this._buffers=[]};EY.WIDTH=256,EY.HEIGHT=3;var kY,RY,OY,FY,LY,VY,NY,zY,UY,GY,HY,WY,jY,qY,XY,YY,QY,JY,KY,ZY,$Y,tQ,eQ,iQ,nQ,rQ,sQ,aQ,oQ,hQ,uQ,lQ,cQ=function(t){function e(){var e;return(e=t.call(this)||this)._buffers=[],e._dataArray=[],e._joints=[],e._bufferIndices=null,e._realTimeJointTexture=new EY,e._realTimeTextureMode=!1,e.type=1,e}s(e,t);var i=e.prototype;return i.destroy=function(){if(this.bindSkeleton(),this._buffers.length){for(var e=0;e=0?a.instancedAttributeBlock.views[r][0]=i.data[0]:n=!0}return n&&i.dirty&&(i.buffer.update(i.data),i.dirty=!1),!0},i.getMacroPatches=function(e){var i=t.prototype.getMacroPatches.call(this,e);return i?i.concat(fQ):fQ},i.uploadAnimation=function(t){if(this._skeleton&&this._mesh&&this.uploadedAnim!==t){this.uploadedAnim=t;var e=this._dataPoolManager,i=null;t?(i=e.jointTexturePool.getSequencePoseTexture(this._skeleton,t,this._mesh,this.transform),this._jointsMedium.boundsInfo=i&&i.bounds.get(this._mesh.hash),this._modelBounds=null):(i=e.jointTexturePool.getDefaultPoseTexture(this._skeleton,this._mesh,this.transform),this._jointsMedium.boundsInfo=null,this._modelBounds=i&&i.bounds.get(this._mesh.hash)[0]),this._applyJointTexture(i)}},i._applyJointTexture=function(t){void 0===t&&(t=null);var e=this._jointsMedium.texture;if(e&&e!==t&&this._dataPoolManager.jointTexturePool.releaseHandle(e),this._jointsMedium.texture=t,t){var i=this._jointsMedium,n=i.buffer,r=i.jointTextureInfo;r[0]=t.handle.texture.width,r[1]=this._skeleton.joints.length,r[2]=t.pixelOffset+.1,r[3]=1/r[0],this.updateInstancedJointTextureInfo(),n&&n.update(r);for(var s=t.handle.texture,a=0;a=0&&s.length>0){var a=s[n];a[0]=i.data[0],a[1]=e[1],a[2]=e[2]}}},e}(WW),_Q=t("aj",(kY=Qh("cc.SkinnedMeshRenderer"),RY=Kh(100),OY=Eu(Ij),FY=Eu(tb),LY=Eu(Ij),VY=Eu(tb),kY(NY=RY((zY=function(t){function e(){var e;return(e=t.call(this)||this)._skeleton=UY&&UY(),e._skinningRoot=GY&&GY(),e._clip=null,e.associatedAnimation=null,e._modelType=dQ,e}s(e,t);var i=e.prototype;return i.onLoad=function(){t.prototype.onLoad.call(this),this._tryBindAnimation()},i.onDestroy=function(){this.associatedAnimation&&(this.associatedAnimation.notifySkinnedMeshRemoved(this),this.associatedAnimation),t.prototype.onDestroy.call(this)},i.uploadAnimation=function(t){this._clip=t,this.model&&this.model.uploadAnimation&&this.model.uploadAnimation(t)},i.setUseBakedAnimation=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!1);var i=t?dQ:cQ;(e||this._modelType!==i)&&(this._modelType=i,this._model&&(C.director.root.destroyModel(this._model),this._model=null,this._models.length=0,this._updateModels(),this._updateCastShadow(),this._updateReceiveShadow(),this._updateUseLightProbe(),this.enabledInHierarchy&&this._attachToScene()))},i.setSharedMaterial=function(e,i){t.prototype.setSharedMaterial.call(this,e,i),this._modelType===cQ&&this.getMaterialInstance(i)},i._updateModelParams=function(){this._update(),t.prototype._updateModelParams.call(this)},i._tryBindAnimation=function(){var t=this._skinningRoot;if(t){for(var e=!1,i=this.node;i;i=i.parent)if(i===t){e=!0;break}if(e){var n=t.getComponent("cc.SkeletalAnimation");n&&n.enabledInHierarchy?n.notifySkinnedMeshAdded(this):this.setUseBakedAnimation(!1)}}},i._update=function(){this.model&&(this.model.bindSkeleton(this._skeleton,this._skinningRoot,this._mesh),this.model.uploadAnimation&&this.model.uploadAnimation(this._clip))},n(e,[{key:"skeleton",get:function(){return this._skeleton},set:function(t){t!==this._skeleton&&(this._skeleton=t,this._update())}},{key:"skinningRoot",get:function(){return this._skinningRoot},set:function(t){t!==this._skinningRoot&&(this._skinningRoot=t,this._tryBindAnimation(),this._update())}},{key:"model",get:function(){return this._model}}]),e}(lj),UY=Nh(zY.prototype,"_skeleton",[OY],(function(){return null})),GY=Nh(zY.prototype,"_skinningRoot",[FY],(function(){return null})),y(zY.prototype,"skeleton",[LY],Object.getOwnPropertyDescriptor(zY.prototype,"skeleton"),zY.prototype),y(zY.prototype,"skinningRoot",[VY],Object.getOwnPropertyDescriptor(zY.prototype,"skinningRoot"),zY.prototype),NY=zY))||NY)||NY)),pQ=new C_("a_batch_id",11),mQ=new C_("a_batch_uv",21),gQ=ep[pQ.format].size+ep[mQ.format].size,vQ=t("al",(HY=Qh("cc.SkinnedMeshUnit"),WY=Eu(CR),jY=Eu(Ij),qY=Eu(FT),XY=Eu(_Q),HY((QY=function(){function t(){this.mesh=JY&&JY(),this.skeleton=KY&&KY(),this.material=ZY&&ZY(),this._localTransform=$Y&&$Y(),this._offset=tQ&&tQ(),this._size=eQ&&eQ()}return n(t,[{key:"offset",get:function(){return this._offset},set:function(t){ds.copy(this._offset,t)}},{key:"size",get:function(){return this._size},set:function(t){ds.copy(this._size,t)}},{key:"copyFrom",get:function(){return null},set:function(t){t&&(this.mesh=t.mesh,this.skeleton=t.skeleton,this.material=t.getSharedMaterial(0),t.skinningRoot&&nY(t.node,t.skinningRoot,this._localTransform))}}]),t}(),JY=Nh(QY.prototype,"mesh",[WY],(function(){return null})),KY=Nh(QY.prototype,"skeleton",[jY],(function(){return null})),ZY=Nh(QY.prototype,"material",[qY],(function(){return null})),$Y=Nh(QY.prototype,"_localTransform",[hu],(function(){return new Qr})),tQ=Nh(QY.prototype,"_offset",[hu],(function(){return new ds(0,0)})),eQ=Nh(QY.prototype,"_size",[hu],(function(){return new ds(1,1)})),y(QY.prototype,"copyFrom",[XY],Object.getOwnPropertyDescriptor(QY.prototype,"copyFrom"),QY.prototype),YY=QY))||YY)),yQ=new Qr;new Qr;var bQ,SQ,xQ,wQ,TQ,CQ,AQ,DQ,IQ,BQ,MQ,PQ,EQ,kQ,RQ,OQ,FQ,LQ=new ir,VQ=t("ak",(iQ=Qh("cc.SkinnedMeshBatchRenderer"),nQ=Kh(100),rQ=Eu([di]),sQ=Eu([vQ]),iQ(aQ=nQ((oQ=function(t){function e(){var e;return(e=t.call(this)||this).atlasSize=hQ&&hQ(),e.batchableTextureNames=uQ&&uQ(),e.units=lQ&&lQ(),e._textures={},e._batchMaterial=null,e}s(e,t);var i=e.prototype;return i.onLoad=function(){t.prototype.onLoad.call(this),this.cook()},i.onDestroy=function(){for(var e in this._textures)this._textures[e].destroy();this._textures={},this._mesh&&(this._mesh.destroy(),this._mesh=null),t.prototype.onDestroy.call(this)},i._onMaterialModified=function(e){this.cookMaterials(),t.prototype._onMaterialModified.call(this,e,this.getMaterialInstance(e))},i.cook=function(){this.cookMaterials(),this.cookSkeletons(),this.cookMeshes()},i.cookMaterials=function(){var t=this;this._batchMaterial||(this._batchMaterial=this.getSharedMaterial(0));var e=this.getMaterialInstance(0);if(e&&this._batchMaterial&&this._batchMaterial.effectAsset){e.copy(this._batchMaterial),this.resizeAtlases();for(var i=e.effectAsset.techniques[e.technique],n=function(n){var r=i.passes[n];if(!r.properties)return 1;var s=function(i){if(r.properties[i].type>=26){var s=null;t.batchableTextureNames.find((function(t){return t===i}))?((s=t._textures[i])||(s=t.createTexture(i)),t.cookTextures(s,i,n)):t.units.some((function(t){return s=t.material&&t.material.getProperty(i,n)})),s&&e.setProperty(i,s,n)}else{for(var a=[],o=0;o=0)return 1;t.push(i),e.push(Qr.multiply(new Qr,r.bindposes[a]||Qr.IDENTITY,yQ))},a=0;at[i]?1:t[e]0&&d.copyBuffersToTexture(s,f,a),n.length>0&&d.copyTexImagesToTexture(n,f,r)},i.createTexture=function(t){var e=new Pv;return e.setFilters(2,2),e.setMipFilter(1),e.reset({width:this.atlasSize,height:this.atlasSize,format:35}),this._textures[t]=e,e},i.resizeAtlases=function(){for(var t in this._textures)this._textures[t].reset({width:this.atlasSize,height:this.atlasSize,format:35})},i._createUnitMesh=function(t,e){for(var i=JSON.parse(JSON.stringify(e.struct)),n={},r=0;rthis._renderers.length)&&(t=this._renderers.length),this._renderers.splice(t,0,e);var i=!1;return e.model&&(i=!0,this._LODData.addModel(e.model)),this._modelAddedCallback&&i&&this._modelAddedCallback(),e},e.deleteRenderer=function(t){var e,i=this._renderers.splice(t,1),n=i.length>0?null==(e=i[0])?void 0:e.model:null;return n&&this._LODData.eraseModel(n),i[0]},e.getRenderer=function(t){return this._renderers[t]||null},e.setRenderer=function(t,e){t<0||t>=this.rendererCount?Q("setRenderer to LOD error, index out of range"):(this.deleteRenderer(t),this.insertRenderer(t,e))},n(t,[{key:"screenUsagePercentage",get:function(){return this._screenUsagePercentage},set:function(t){this._screenUsagePercentage=t,this._LODData.screenUsagePercentage=t}},{key:"renderers",get:function(){return this._renderers},set:function(t){if(t!==this._renderers){var e=!1;this._renderers.length=0,this._LODData.clearModels();for(var i=0;ithis.lodCount)&&(t=this.lodCount),i||(i=new zQ),i.modelAddedCallback=this.onLodModelAddedCallback.bind(this),!e){var n=this.getLOD(t-1),r=this.getLOD(t);if(n&&r)e=(n.screenUsagePercentage+r.screenUsagePercentage)/2;else if(n&&!r)(e=n.screenUsagePercentage/2)>.01&&(e=.01);else if(r&&!n){e=r.screenUsagePercentage;var s=this.getLOD(t+1);r.screenUsagePercentage=(e+(s?s.screenUsagePercentage:0))/2}else e=NQ[0]}return i.screenUsagePercentage=e,this._LODs.splice(t,0,i),this._lodGroup.insertLOD(t,i.lodData),this._updateDataToScene(),this.node&&this._emitChangeNode(this.node),i},i.eraseLOD=function(t){if(t<0||t>=this.lodCount)return Y("eraseLOD error, index out of range"),null;var e=this._LODs[t];return e?(this._LODs.splice(t,1),this._lodGroup.eraseLOD(t),this._updateDataToScene(),this._emitChangeNode(this.node),e):(Y("eraseLOD error, LOD not exist at specified index."),null)},i.getLOD=function(t){return t<0||t>=this.lodCount?(Y("getLOD error, index out of range"),null):this._LODs[t]},i.setLOD=function(t,e){t<0||t>=this.lodCount?Y("setLOD error, index out of range"):(this._LODs[t]=e,e.modelAddedCallback=this.onLodModelAddedCallback.bind(this),this.lodGroup.updateLOD(t,e.lodData),this._updateDataToScene())},i.recalculateBounds=function(){for(var t=new ir,e=new ir,i=null,n=new ir,r=0;r0&&this._lodGroup.lodCount<1&&this._LODs.forEach((function(e,i){e.lodData.screenUsagePercentage=e.screenUsagePercentage;var n=e.renderers;if(null!==n&&n.length>0)for(var r=0;r1?e[1]:null},e._getModelsByProbe=function(t){var e=[],i=this._useCubeModels;1===t.probeType&&(i=this._usePlanarModels);for(var n,r=p(i.entries());!(n=r()).done;){var s=n.value;s[1]===t&&e.push(s[0])}return e},e._removeDependentModels=function(t){for(var e,i=p(this._useCubeModels.keys());!(e=i()).done;){var n=e.value,r=this._useCubeModels.get(n);void 0!==r&&r===t&&(this._useCubeModels.delete(n),this.selectReflectionProbe(n))}for(var s,a=p(this._usePlanarModels.keys());!(s=a()).done;){var o=s.value,h=this._usePlanarModels.get(o);void 0!==h&&h===t&&(this._usePlanarModels.delete(o),this.selectPlanarReflectionProbe(o))}},e._updateCubemapOfModel=function(t,e){var i=t.node;if(i){var n=i.getComponent(lj);if(n&&(n.updateProbeCubemap(e?e.cubemap:null),n.updateReflectionProbeId(e&&e.cubemap?e.getProbeId():-1),e&&(n.updateReflectionProbeDataMap(this._dataTexture),this._isUsedBlending(t)))){var r=this._getBlendProbe(t);this._updateBlendProbeInfo(t,e,r)}}},e._updatePlanarMapOfModel=function(t,e,i){var n=t.node.getComponent(lj);n&&(n.updateProbePlanarMap(e),i?(n.updateReflectionProbeId(i.getProbeId()),n.updateReflectionProbeDataMap(this._dataTexture)):n.updateReflectionProbeId(-1))},e._isUsedBlending=function(t){return 3===t.reflectionProbeType||4===t.reflectionProbeType},e._updateBlendProbeInfo=function(t,e,i){var n=t.node;if(n){var r=n.getComponent(lj);r&&(r.updateReflectionProbeBlendId(-1),4===t.reflectionProbeType&&r.updateReflectionProbeBlendWeight(this._calculateBlendWeight(t,e,i)))}},e._updateBlendCubemap=function(t,e){var i=t.node;if(i&&this._isUsedBlending(t)){var n=i.getComponent(lj);n&&n.updateProbeBlendCubemap(e.cubemap)}},e._calculateBlendWeight=function(t,e,i){if(i){var n=ir.distance(t.node.worldPosition,e.node.worldPosition),r=ir.distance(t.node.worldPosition,i.node.worldPosition);return 1-r/(n+r)}return 3===t.reflectionProbeType?0:4===t.reflectionProbeType?this._calculateBlendOfSkybox(t.worldBounds,e.boundingBox):0},e._calculateBlendOfSkybox=function(t,e){if(!t)return 1;var i=new ir,n=new ir,r=new ir,s=new ir;if(ir.subtract(i,t.center,t.halfExtents),ir.add(n,t.center,t.halfExtents),ir.subtract(r,e.center,e.halfExtents),ir.add(s,e.center,e.halfExtents),i.x<=s.x&&n.x>=r.x&&i.y<=s.y&&n.y>=r.y&&i.z<=s.z&&n.z>=r.z){var a=new ir;ir.multiplyScalar(a,t.halfExtents,2);var o=i.x+a.x<=s.x&&n.x+a.x>=r.x,h=i.x-a.x<=s.x&&n.x-a.x>=r.x,u=i.y+a.y<=s.y&&n.y+a.y>=r.y,l=i.y-a.y<=s.y&&n.y-a.y>=r.y,c=i.z+a.z<=s.z&&n.z+a.z>=r.z,f=i.z-a.z<=s.z&&n.z-a.z>=r.z,d=[];if(!o){var _=n.x-s.x;d.push(_/a.x)}if(!h){var p=Math.abs(i.x-r.x);d.push(p/a.x)}if(!u){var m=n.y-s.y;d.push(m/a.y)}if(!l){var g=Math.abs(i.y-r.y);d.push(g/a.y)}if(!c){var v=n.z-s.z;d.push(v/a.z)}if(!f){var y=Math.abs(i.z-r.z);d.push(y/a.z)}return d.length>0?(d.sort((function(t,e){return e-t})),d[0]):0}return 1},n(t,[{key:"updateForRuntime",get:function(){return this._updateForRuntime},set:function(t){this._updateForRuntime=t}}]),t}());function HQ(t){return void 0===(t=t||{}).includeNormal&&(t.includeNormal=!0),void 0===t.includeUV&&(t.includeUV=!0),t}GQ.probeManager=void 0,GQ.probeManager=new GQ,C.internal.reflectionProbeManager=GQ.probeManager;var WQ=new ir,jQ=new ir,qQ=new ir,XQ=new ir,YQ=new ir,QQ=new ir,JQ=new ir,KQ=new ir,ZQ=new ir,$Q=new ir,tJ=new ir,eJ=new ir,iJ=new ir(0,0,0),nJ=new ir(0,0,0);function rJ(t,e,i,n){void 0===t&&(t=.5),void 0===e&&(e=.5),void 0===i&&(i=2),void 0===n&&(n={});var r=.5*i,s=n.radialSegments||32,a=n.heightSegments||1,o=void 0===n.capped||n.capped,h=n.arc||2*Math.PI,u=0;o&&(t>0&&u++,e>0&&u++);var l=(s+1)*(a+1);o&&(l+=(s+1)*u+s*u);var c=s*a*6;o&&(c+=s*u*3);var f=new Array(c),d=new Array(3*l),_=new Array(3*l),p=new Array(2*l),m=Math.max(t,e),g=new ir(-m,-r,-m),v=new ir(m,r,m),y=Math.sqrt(m*m+r*r),b=0,S=0;return function(){for(var n=[],o=t-e,u=o*o/i*Math.sign(o),l=0;l<=a;l++){for(var c=[],m=l/a,g=m*o+e,v=0;v<=s;++v){var y=v/s,x=y*h,w=Math.sin(x),T=Math.cos(x);d[3*b]=g*w,d[3*b+1]=m*i-r,d[3*b+2]=g*T,ir.normalize(iJ,ir.set(nJ,w,-u,T)),_[3*b]=iJ.x,_[3*b+1]=iJ.y,_[3*b+2]=iJ.z,p[2*b]=2*(1-y)%1,p[2*b+1]=m,c.push(b),++b}n.push(c)}for(var C=0;C0&&x(!1),t>0&&x(!0)),{positions:d,normals:_,uvs:p,indices:f,minPos:g,maxPos:v,boundingRadius:y};function x(i){for(var n=i?t:e,a=i?1:-1,o=b,u=1;u<=s;++u)d[3*b]=0,d[3*b+1]=r*a,d[3*b+2]=0,_[3*b]=0,_[3*b+1]=a,_[3*b+2]=0,p[2*b]=.5,p[2*b+1]=.5,++b;for(var l=b,c=0;c<=s;++c){var m=c/s*h,g=Math.cos(m),v=Math.sin(m);d[3*b]=n*v,d[3*b+1]=r*a,d[3*b+2]=n*g,_[3*b]=0,_[3*b+1]=a,_[3*b+2]=0,p[2*b]=.5-.5*v*a,p[2*b+1]=.5+.5*g,++b}for(var y=0;y0&&(n[n.length-1]=1),{positions:i,indices:n,minPos:{x:1,y:1,z:0},maxPos:{x:-1,y:-1,z:0},boundingRadius:1,primitiveMode:9}},cone:function(t,e,i){return void 0===t&&(t=.5),void 0===e&&(e=1),void 0===i&&(i={}),rJ(0,t,e,i)},cylinder:rJ,invWinding:function(t){for(var e=[],i=0;io?o<<16|a:a<<16|o;void 0===n[h]&&(n[h]=0,i.push(a,o))}return i},wireframed:function(t){var e=t.indices;if(!e)return t;if(t.primitiveMode&&7!==t.primitiveMode)return t;for(var i=[[0,1],[1,2],[2,0]],n=[],r={},s=0;sh?h<<16|o:o<<16|h;void 0===r[u]&&(r[u]=0,n.push(o,h))}return t.indices=n,t.primitiveMode=1,t}});t("f$",mJ);var gJ=new ir;function vJ(t){return t.x=Math.abs(t.x),t.y=Math.abs(t.y),t.z=Math.abs(t.z),t}var yJ,bJ,SJ,xJ,wJ,TJ,CJ,AJ,DJ,IJ,BJ,MJ,PJ,EJ,kJ,RJ,OJ,FJ,LJ,VJ,NJ,zJ,UJ,GJ=Object.freeze({__proto__:null,CharacterTriggerEventObject:{type:"onControllerTriggerEnter",collider:null,characterController:null,impl:null},CollisionEventObject:{type:"onCollisionEnter",selfCollider:null,otherCollider:null,contacts:[],impl:null},TriggerEventObject:{type:"onTriggerEnter",selfCollider:null,otherCollider:null,impl:null},VEC3_0:gJ,absolute:vJ,cylinder:rJ,getWrap:function(t){return t.__cc_wrapper__},maxComponent:function(t){return Math.max(t.x,Math.max(t.y,t.z))},setWrap:function(t,e){t.__cc_wrapper__=e},shrinkPositions:function(t){var e=[],i={};if(t.length>=3){e[0]=t[0],e[1]=t[1],e[2]=t[2];for(var n=t.length,r=3;r0&&(this._delayTime-=t,this._delayTime>0)||(this._currentFramePlayed?this.time+=t*this._speed:this._currentFramePlayed=!0,this._process())},i.sample=function(){var t=this.getWrappedInfo(this.time,this._wrappedInfo);return this._sampleCurves(t.time),this._sampleEvents(t),this._sampleEmbeddedPlayers(t),t},i.onPlay=function(){var t;this.setTime(this._getPlaybackStart()),this._delayTime=this._delay,this._onReplayOrResume(),this.emit("play",this),null==(t=this._clipEmbeddedPlayerEval)||t.notifyHostPlay(this.current)},i.onStop=function(){var t;this.isPaused||this._onPauseOrStop(),this.emit("stop",this),null==(t=this._clipEmbeddedPlayerEval)||t.notifyHostStop()},i.onResume=function(){var t;this._onReplayOrResume(),this.emit("resume",this),null==(t=this._clipEmbeddedPlayerEval)||t.notifyHostPlay(this.current)},i.onPause=function(){var t;this._onPauseOrStop(),this.emit("pause",this),null==(t=this._clipEmbeddedPlayerEval)||t.notifyHostPause(this.current)},i._sampleCurves=function(t){var e=this._poseOutput,i=this._clipEval;e&&(e.weight=this.weight),i&&i.evaluate(t)},i._process=function(){this._useSimpleProcess?this.simpleProcess():this.process()},i.process=function(){var t,e=this.sample();this._allowLastFrame&&(t=this._lastWrapInfo?this._lastWrapInfo:this._lastWrapInfo=new iK(e),this.repeatCount>1&&(0|e.iterations)>(0|t.iterations)&&this.emit("lastframe",this),t.set(e)),e.stopped&&(this.stop(),this.emit("finished",this))},i.simpleProcess=function(){var t=this._playbackRange.min,e=this._playbackDuration,i=0,n=0;if(0!==e&&((i=this.time%e)<0&&(i+=e),n=(t+i)*this._invDuration),this._sampleCurves(t+i),this._clipEventEval||this._clipEmbeddedPlayerEval){var r=this.getWrappedInfo(this.time,this._wrappedInfo);this._sampleEvents(r),this._sampleEmbeddedPlayers(r)}this._allowLastFrame&&(Number.isNaN(this._lastIterations)&&(this._lastIterations=n),(this.time>0&&this._lastIterations>n||this.time<0&&this._lastIterations0&&(t-=1),1&t&&(i=!i)),36&~e||(i=!i),i},i.getWrappedInfo=function(t,e){e=e||new iK;var i=this._playbackRange.min,n=this._playbackDuration,r=this.repeatCount;if(0===n)return e.time=0,e.ratio=0,e.direction=1,e.stopped=!!Number.isFinite(r),e.iterations=0,e;var s=!1,a=(t-=i)>0?t/n:-t/n;if(a>=r){a=r,s=!0;var o=r-(0|r);0===o&&(o=1),t=o*n*(t>0?1:-1)}if(t>n){var h=t%n;t=0===h?n:h}else t<0&&0!=(t%=n)&&(t+=n);var u=!1,l=4&this._wrapMode;l&&(u=this._needReverse(a));var c=u?-1:1;return this.speed<0&&(c*=-1),l&&u&&(t=n-t),e.time=i+t,e.ratio=e.time/this.duration,e.direction=c,e.stopped=s,e.iterations=a,e},i._getPlaybackStart=function(){return this._playbackRange.min},i._sampleEvents=function(t){var e;null==(e=this._clipEventEval)||e.sample(t.ratio,t.direction,t.iterations)},i._sampleEmbeddedPlayers=function(t){var e;null==(e=this._clipEmbeddedPlayerEval)||e.evaluate(t.time,Math.trunc(t.iterations))},i._emit=function(t,e){this._target&&this._target.isValid&&this._target.emit(t,t,e)},i._onReplayOrResume=function(){rK().addAnimation(this)},i._onPauseOrStop=function(){rK().removeAnimation(this)},n(e,[{key:"clip",get:function(){return this._clip}},{key:"name",get:function(){return this._name}},{key:"length",get:function(){return this.duration}},{key:"wrapMode",get:function(){return this._wrapMode},set:function(t){var e;this._wrapMode=t,this.time=0,this.repeatCount=2&t?1/0:1,null==(e=this._clipEventEval)||e.setWrapMode(t)}},{key:"repeatCount",get:function(){return this._repeatCount},set:function(t){this._repeatCount=t;var e=4&this._wrapMode,i=!(36&~this.wrapMode);this._useSimpleProcess=t===1/0&&!e&&!i}},{key:"delay",get:function(){return this._delay},set:function(t){this._delayTime=this._delay=t}},{key:"playbackRange",get:function(){return this._playbackRange},set:function(t){t.max,t.min,this._playbackRange.min=Math.max(t.min,0),this._playbackRange.max=Math.min(t.max,this.duration),this._playbackDuration=this._playbackRange.max-this._playbackRange.min,this.setTime(0)}},{key:"speed",get:function(){return this._speed},set:function(t){var e;this._speed=t,null==(e=this._clipEmbeddedPlayerEval)||e.notifyHostSpeedChanged(t)}},{key:"current",get:function(){return this.getWrappedInfo(this.time).time}},{key:"ratio",get:function(){return 0===this.duration?0:this.current/this.duration}},{key:"weight",get:function(){return this._weight},set:function(t){this._weight=t,this._poseOutput&&(this._poseOutput.weight=t)}},{key:"curveLoaded",get:function(){return this._curveLoaded}}]),e}(tK));C.AnimationState=uK,Qh(JJ+"EmbeddedAnimationClipPlayable")((aK=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;re){var i;(i=this._channels).push.apply(i,Array.from({length:t-e},(function(){return new QK(new Kl)})))}}}]),e}(YK),XK=Nh(qK.prototype,"_channels",[ZK],(function(){return[]})),qK));var $K,tZ,eZ,iZ,nZ,rZ,sZ,aZ,oZ,hZ,uZ,lZ,cZ,fZ=function(){function t(t){this._curves=t,this._result=new Array(t.length).fill(0)}return t.prototype.evaluate=function(t){for(var e=this._result,i=e.length,n=0;n=t.passes.length)at(3941,t.name,e);else{var r=t.passes[e],s=r.getHandle(i);if(s){if(YS(s)<26){var a=void 0===n?s:r.getHandle(i,n,13);return a?_Z(r,i)?{set:function(t){r.setUniformArray(a,t)}}:{set:function(t){r.setUniform(a,t)}}:void at(3943,t.name,e,i,n)}var o=QS(s),h=r.properties[i],u=h&&h.value?""+h.value+rx(h.type):nx(h.type),l=_T.get(u);return l||(Y("Illegal texture default value: "+u+"."),l=_T.get("default-texture")),{set:function(t){t||(t=l);var e=t.getGFXTexture();e&&e.width&&e.height&&(r.bindTexture(o,e),t instanceof Xm&&r.bindSampler(o,Hp.gfxDevice.getSampler(t.getSamplerInfo())))}}}at(3942,t.name,e,i)}}else at(3940,t)},t}(),eZ=Nh(tZ.prototype,"passIndex",[hu],(function(){return 0})),iZ=Nh(tZ.prototype,"uniformName",[hu],(function(){return""})),nZ=y(tZ.prototype,"channelIndex",[Bu],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){}}),$K=tZ))||$K;function _Z(t,e){for(var i,n=p(t.shaderInfo.blocks);!(i=n()).done;)for(var r,s=p(i.value.members);!(r=s()).done;){var a=r.value;if(a.name===e)return a.count>1}return!1}var pZ,mZ,gZ,vZ,yZ,bZ=Qh("cc.animation.MorphWeightValueProxy")((sZ=function(){function t(){this.subMeshIndex=aZ&&aZ(),this.shapeIndex=oZ&&oZ()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeight(i,e.subMeshIndex,e.shapeIndex)}}},t}(),aZ=Nh(sZ.prototype,"subMeshIndex",[hu],(function(){return 0})),oZ=Nh(sZ.prototype,"shapeIndex",[hu],(function(){return 0})),rZ=sZ))||rZ,SZ=Qh("cc.animation.MorphWeightsValueProxy")((uZ=function(){function t(){this.subMeshIndex=lZ&&lZ()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeights(i,e.subMeshIndex)}}},t}(),lZ=Nh(uZ.prototype,"subMeshIndex",[hu],(function(){return 0})),hZ=uZ))||hZ,xZ=Qh("cc.animation.MorphWeightsAllValueProxy")(cZ=function(){function t(){}return t.prototype.forTarget=function(t){return{set:function(e){for(var i,n,r=null!==(i=null==(n=t.mesh)?void 0:n.struct.primitives.length)&&void 0!==i?i:0,s=0;s2?i-2:0),r=2;r>1},set:function(t){this._flags&=-7,this._flags|=t<<1}}]),t}(),f$=Nh(c$.prototype,"_flags",[hu],(function(){return 0})),l$=c$))||l$,T$=function(t){function e(e,i){var n;return(n=t.call(this,2)||this).resetMode=0,n._value=void 0,n.resetMode=i,n._value=e,n}s(e,t);var i=e.prototype;return i.getValue=function(){return this._value},i.setValue=function(t){this._value=t},e}(b$),C$=Qh("cc.animation.Vec3Variable")((_$=function(){function t(){this._value=p$&&p$()}return t.prototype[y$]=function(){return new A$(this.value)},n(t,[{key:"type",get:function(){return 4}},{key:"value",get:function(){return this._value},set:function(t){ir.copy(this._value,t)}}]),t}(),p$=Nh(_$.prototype,"_value",[hu],(function(){return new ir})),d$=_$))||d$,A$=function(t){function e(e){var i;return(i=t.call(this,4)||this)._value=new ir,ir.copy(i._value,e),i}s(e,t);var i=e.prototype;return i.getValue=function(){return this._value},i.setValue=function(t){ir.copy(this._value,t)},e}(b$),D$=Qh("cc.animation.QuatVariable")((g$=function(){function t(){this._value=v$&&v$()}return t.prototype[y$]=function(){return new I$(this._value)},n(t,[{key:"type",get:function(){return 5}},{key:"value",get:function(){return this._value},set:function(t){kr.copy(this._value,t)}}]),t}(),v$=Nh(g$.prototype,"_value",[hu],(function(){return new kr})),m$=g$))||m$,I$=function(t){function e(e){var i;return(i=t.call(this,5)||this)._value=new kr,kr.copy(i._value,e),i}s(e,t);var i=e.prototype;return i.getValue=function(){return this._value},i.setValue=function(t){kr.copy(this._value,t)},e}(b$);function B$(t,e){var i;switch(t){case 0:case 3:case 1:i=new S$(t);break;case 2:i=new w$;break;case 4:i=new C$;break;case 5:i=new D$;break;default:throw new Error("Unknown variable type "+t)}return void 0!==e&&(i.value=e),i}var M$,P$,E$,k$,R$,O$,F$=function(t){function e(e){var i;return(i=t.call(this,e+" transition is invalid")||this).name="TransitionRejectError",i}return s(e,t),e}(l(Error)),L$=function(t){function e(e){return t.call(this,"Graph variable "+e+" is not defined")||this}return s(e,t),e}(l(Error)),V$=function(t){function e(e,i,n){return t.call(this,"Expect graph variable "+e+" to have type '"+i+"' instead of received '"+(null!=n?n:typeof n)+"'")||this}return s(e,t),e}(l(Error)),N$=1,z$=-4192741,U$=[];function G$(t){return"function"==typeof t._instantiate}function H$(t){var e;if(vo(t)){if(G$(t))return C.game._isCloning=!0,e=t._instantiate(null,!0),C.game._isCloning=!1,e;if(t instanceof C.Asset)throw new TypeError(ft(6903))}return C.game._isCloning=!0,e=W$(t),C.game._isCloning=!1,e}function W$(t,e){var i;q$(t,i=t._iN$t?t._iN$t:t.constructor?new(0,t.constructor):Object.create(null),e);for(var n=0,r=U$.length;n=0&&this._bindings.splice(e,1)},i.moveArrayElementBindingForward=function(t,e,i){for(var n=this._bindings,r=[],s=0;s=e&&(r.push(a),n.splice(s,1))}for(var l=0,c=r;l=0?this._bindings[e]:void 0},i._findBindingIndex=function(t){return this._bindings.findIndex((function(e){return B0(e.inputPath,t)}))},i._emplaceBinding=function(t){var e=this._bindings.findIndex((function(e){return B0(e.inputPath,t.inputPath)}));e>=0?this._bindings[e]=t:this._bindings.push(t)},e}(Gu),S0=Nh(b0.prototype,"_bindings",[hu],(function(){return[]})),y0=b0))||y0;function B0(t,e){var i=t[0],n=t[1],r=e[0],s=e[1];return i===r&&n===s}var M0=Qh(JJ+"PoseGraphNodeInputBinding")((w0=function(){function t(t,e,i){this._inputPath=T0&&T0(),this._producer=C0&&C0(),this._outputIndex=A0&&A0(),this._inputPath=t,this._producer=e,void 0!==i&&(this._outputIndex=i)}return n(t,[{key:"inputPath",get:function(){return this._inputPath}},{key:"producer",get:function(){return this._producer}},{key:"outputIndex",get:function(){return this._outputIndex}}]),t}(),T0=Nh(w0.prototype,"_inputPath",[hu],null),C0=Nh(w0.prototype,"_producer",[hu],null),A0=Nh(w0.prototype,"_outputIndex",[hu],(function(){return 0})),x0=w0))||x0,P0=function(t){function e(e){return t.call(this,"Can not add the specified "+e.toString()+" since it has already been added into another graph.")||this}return s(e,t),e}(l(Error)),E0=function(t){function e(e){return t.call(this,"Can not perform specified operation on "+e.toString()+" since it has not been added in to graph.")||this}return s(e,t),e}(l(Error)),k0=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Gu),R0=new WeakMap;function O0(t){var e=R0.get(t);if(e)return e;var i={};return R0.set(t,i),i}function F0(t){return function(e){if(ie(e,k0)||(Q("This kind of decorator should only be applied to pose graph node classes."),0)){var i=O0(e);t(i)}}}var L0=function(t){return F0((function(e){var i;Object.assign(null!==(i=e.appearance)&&void 0!==i?i:e.appearance={},t)}))};var V0=["arraySyncGroup"],N0=function(){function t(){this._classInputMap=new WeakMap}var e=t.prototype;return e.setPropertyNodeInputRecord=function(t,e,i){var n=this._classInputMap.get(t);n||(n={properties:{}},this._classInputMap.set(t,n)),i.arraySyncGroup;var r=c(i,V0),s=i.arraySyncGroup;if(s){var a,o;n.arraySyncGroups||(n.arraySyncGroups={});var h=null!==(o=(a=n.arraySyncGroups)[s])&&void 0!==o?o:a[s]={members:[]};h.members.includes(e)||h.members.push(e),r.arraySyncGroup=h}n.properties[e]=Object.freeze(r)},e.getInputKeys=function(t){var e=this,i=[];return function n(r){if(r){n(ee(r));var s=e._classInputMap.get(r);if(s)for(var a=function(){var e=h[o][0];if(i.findIndex((function(t){var i=t[0];return e===i}))>=0)return 1;var n=t[e];if(Array.isArray(n))for(var r=0;r=a.length)return;var o,h,u=null!==(o=null==(h=s.getArrayElementDisplayName)?void 0:h.call(t,r))&&void 0!==o?o:s.displayName;return{type:s.type,displayName:u,deletable:!(s.arraySyncGroup&&s.arraySyncGroupFollower),insertPoint:!0}}return{type:s.type,displayName:s.displayName}}},e.hasInput=function(t,e){var i=e[0],n=e[1],r=void 0===n?-1:n;if(!this._getPropertyNodeInputRecord(t.constructor,i))return!1;var s=t[i];return!Array.isArray(s)||!(r<0||r>=s.length)},e.getInputInsertInfos=function(t){for(var e={},i=t.constructor;i;i=ee(i)){var n=this._classInputMap.get(i);if(n)for(var r in n.properties){var s=n.properties[r],a=t[r];if(Array.isArray(a)){if(s.arraySyncGroup&&s.arraySyncGroupFollower)continue;e[r]={displayName:r}}}}return e},e.deleteInput=function(t,e,i){var n=i[0],r=i[1],s=void 0===r?-1:r,a=this._getPropertyNodeInputRecord(e.constructor,n);if(a){var o=e[n];if(Array.isArray(o)&&!(s<0||s>=o.length)){var h=a.arraySyncGroup;h?this._deleteInputInArraySyncGroup(t,e,h,o.length,s):U0(t,e,i)}}},e.insertInput=function(t,e,i){var n=i,r=this._getPropertyNodeInputRecord(e.constructor,n);if(r){var s=e[n];if(Array.isArray(s)){var a=s.length,o=r.arraySyncGroup;o?this._insertInputInArraySyncGroup(t,e,o,s.length,a):z0(t,e,[n,a],G0(r.type))}}},e._getPropertyNodeInputRecord=function(t,e){if(t){var i=this._classInputMap.get(t);if(i){var n=i.properties[e];if(n)return n}return this._getPropertyNodeInputRecord(ee(t),e)}},e._insertInputInArraySyncGroup=function(t,e,i,n,r){for(var s=0;s=o.length||(n.deleteBinding(i),o.splice(a,1),n.moveArrayElementBindingForward(r,a+1,!0)))}function G0(t){switch(t){default:case 0:case 1:return 0;case 2:return!1;case 5:return null;case 3:return new ir;case 4:return new kr}}var H0,W0=new N0;Oe({NO:0,LOCAL:1,COMPONENT:2});var j0,q0,X0,Y0,Q0,J0,K0=Qh(JJ+"PoseNode")(H0=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rr)for(var h=r+1;h<=s;++h){var u=n[h],l=a.indexOf(u);a[o]=u,o=l}else if(r>s)for(var c=r-1;c>=s;--c){var f=n[c],d=a.indexOf(f);a[o]=f,o=d}a[o]=t,qf(n,r,s)}},e.copyTo=function(t){for(var e,i=t._states.filter((function(e){switch(e){case t._entryState:case t._exitState:case t._anyState:return!0;default:return!1}})),n=p(i);!(e=n()).done;){var r=e.value;t.remove(r)}for(var s,a=new Map,o=p(this._states);!(s=o()).done;){var h=s.value;switch(h){case this._entryState:a.set(h,t._entryState);break;case this._exitState:a.set(h,t._exitState);break;case this._anyState:a.set(h,t._anyState);break;default:if(h instanceof p0||h instanceof S2||h instanceof _2||h instanceof m2){if(h instanceof _2&&!t._allowEmptyStates)continue;var u=H$(h);t._addState(u),a.set(h,u)}}}for(var l,c=p(this._transitions);!(l=c()).done;){var f=l.value;if(t._allowEmptyStates||!(f.from instanceof _2||f.to instanceof _2)){var d=a.get(f.from),_=a.get(f.to),m=t.connect(d,_);m.conditions=f.conditions.map((function(t){return t.clone()})),f.copyTo(m)}}},e.clone=function(){var t=new i(this._allowEmptyStates);return this.copyTo(t),t},e._addState=function(t){return this._states.push(t),t},n(i,[{key:"allowEmptyStates",get:function(){return this._allowEmptyStates}},{key:"entryState",get:function(){return this._entryState}},{key:"exitState",get:function(){return this._exitState}},{key:"anyState",get:function(){return this._anyState}}]),i}(Gu),V1=Nh(L1.prototype,"_states",[hu],(function(){return[]})),N1=Nh(L1.prototype,"_transitions",[hu],(function(){return[]})),z1=Nh(L1.prototype,"_entryState",[hu],null),U1=Nh(L1.prototype,"_exitState",[hu],null),G1=Nh(L1.prototype,"_anyState",[hu],null),F1=L1))||F1,S2=Qh("cc.animation.SubStateMachine")((W1=function(t){function e(e){var i;return(i=t.call(this)||this)._stateMachine=j1&&j1(),i._stateMachine=new b2(e),i}return s(e,t),e.prototype.copyTo=function(e){t.prototype.copyTo.call(this,e),this._stateMachine.copyTo(e._stateMachine)},n(e,[{key:"stateMachine",get:function(){return this._stateMachine}}]),e}(n0),j1=Nh(W1.prototype,"_stateMachine",[hu],null),H1=W1))||H1,x2=Qh(JJ+"PoseGraphStash")((X1=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r1e-6){n=!1;break}this._findRatio=n?P2:kh}return t.prototype.sample=function(t){return this._findRatio(this.ratios,t)},t}());C.RatioSampler=D2;var I2=t("ax",function(){function t(e,i){this.types=void 0,this.type=null,this._values=[],this._lerp=void 0,this._duration=void 0,this._array=void 0,this._duration=i,this._values=e.values;var n=function(e){return"string"==typeof e?e:Array.isArray(e)?e[0]===e[1]&&e[2]===e[3]?t.Linear:t.Bezier(e):t.Linear};if(void 0!==e.easingMethod)this.type=n(e.easingMethod);else if(Array.isArray(e.easingMethods))this.types=e.easingMethods.map(n);else if(void 0!==e.easingMethods){this.types=new Array(this._values.length).fill(null);for(var r=0,s=Object.keys(e.easingMethods);r=e.ratios.length))return t.valueBetween(i,n-1,e.ratios[n-1],n,e.ratios[n]);n=e.ratios.length-1}return t.valueAt(n)}function M2(t,e){if("string"==typeof e){var i=Gl[e];i?t=i(t):ht(3906,e)}else Array.isArray(e)&&(t=Wc(e,t));return t}function P2(t,e){var i=t.length-1;if(0===i)return 0;var n=t[0];if(er)return i;var s=(e=(e-n)/(r-n))/(1/i),a=0|s,o=1e-6;return s-a=0)i=r;else{var s=~r,a=s-1;i=a;var o=t[s],h=t[a];n=(e-h)/(o-h)}return{index:i,ratio:n}}!function(){function t(){this._reset()}var e=t.prototype;e.calculate=function(t,e,i){if(this._reset(),!(e>i)){var n=t.length;if(n){var r=t[0],s=t[n-1],a=0,o=0;if(e=s)a=n-1,o=0;else{var h=I3(t,e);a=h.index,o=h.ratio}var u=0,l=0;if(i=s)u=n-1,l=0;else{var c=I3(t,i);u=c.index,l=c.ratio}var f=!o,d=!l;a!==u||o!==l?(f||(this.preLerpIndex=a,this.preLerpRatio=o),this.directKeyframesBegin=f?a:a+1,this.directKeyframesEnd=u+1,d||(this.postLerpIndex=u,this.postLerpRatio=l)):f?(this.directKeyframesBegin=a,this.directKeyframesEnd=a+1):(this.preLerpIndex=a,this.preLerpRatio=o)}}},e._reset=function(){this.preLerpIndex=-1,this.preLerpRatio=0,this.directKeyframesBegin=0,this.directKeyframesEnd=0,this.postLerpIndex=-1,this.postLerpRatio=0},n(t,[{key:"keyframesCount",get:function(){var t=this.preLerpIndex,e=this.directKeyframesBegin;return 0+(t<0?0:1)+(this.directKeyframesEnd-e)+(this.postLerpIndex<0?0:1)}}])}();var B3=function(){function t(t,e){this._nodeEvaluations=void 0,this._nodeEvaluations=t.map((function(t){return t.createEvaluator(e)}))}return t.prototype.evaluate=function(t){this._nodeEvaluations.forEach((function(e){e.evaluate(t)}))},t}(),M3=function(){function t(t,e,i,n,r){this._position=null,this._rotation=null,this._scale=null,e&&(this._position=W3(e.times,e.values,ir,t,"position",r)),i&&(this._rotation=W3(i.times,i.values,kr,t,"rotation",r)),n&&(this._scale=W3(n.times,n.values,ir,t,"scale",r))}return t.prototype.evaluate=function(t){if(this._position){var e=this._position.evaluator.evaluate(t);this._position.runtimeBinding.setValue(e)}if(this._rotation){var i=this._rotation.evaluator.evaluate(t);this._rotation.runtimeBinding.setValue(i)}if(this._scale){var n=this._scale.evaluator.evaluate(t);this._scale.runtimeBinding.setValue(n)}},t}(),P3=function(){function t(t,e,i){this._times=void 0,this._inputSampleResultCache={just:!1,index:-1,nextIndex:-1,ratio:0},this._values=void 0,this._prevValue=void 0,this._nextValue=void 0,this._resultValue=void 0,this._times=t,this._values=e,this._prevValue=new i,this._nextValue=new i,this._resultValue=new i}return t.prototype.evaluate=function(t){var e=this._times,i=this._values,n=this._resultValue;if(0===e.length)return n;var r=R3(e,t,this._inputSampleResultCache);return r.just?i.get(r.index,n):i.lerp(r.index,r.nextIndex,r.ratio,this._prevValue,this._nextValue,n),n},t}(),E3=function(){function t(t,e){this._nodeEvaluations=void 0,this._nodeEvaluations=t.map((function(t){return t.createEvaluatorForAnimationGraph(e)})).filter((function(t){return!!t}))}var e=t.prototype;return e.destroy=function(){for(var t=this._nodeEvaluations,e=t.length,i=0;is)i.just=!0,i.index=n-1;else{var a=kh(t,e);if(a>=0)i.just=!0,i.index=a;else{var o=~a,h=o-1,u=t[h],l=t[o],c=(e-t[h])/(l-u);i.just=!1,i.index=h,i.nextIndex=o,i.ratio=c}}return i}var O3={uint8:Uint8Array,uint16:Uint16Array};function F3(t){switch(t.BYTES_PER_ELEMENT){default:case 4:return 0;case 8:return 1}}var L3,V3,N3,z3,U3=v3(JJ+"QuantizedFloatArray")((c3=function(){function t(t,e,i,n){void 0===n&&(n=0),this.originalPrecision=f3&&f3(),this.min=d3&&d3(),this.extent=_3&&_3(),this.values=p3&&p3(),this.originalPrecision=t,this.values=e,this.extent=i,this.min=n}return t.prototype.toHashString=function(){var t=this.originalPrecision,e=this.min,i=this.extent,n=this.values;return t+" "+x3(e)+" "+x3(i)+" "+n.join(" ")},n(t,[{key:"quantizationType",get:function(){switch(this.values.BYTES_PER_ELEMENT){default:case 1:return"uint8";case 2:return"uint16"}}}]),t}(),f3=Nh(c3.prototype,"originalPrecision",[y3],null),d3=Nh(c3.prototype,"min",[y3],null),_3=Nh(c3.prototype,"extent",[y3],null),p3=Nh(c3.prototype,"values",[y3],null),l3=c3))||l3;function G3(t,e){var i=O3[e],n=1<=0){var f=u.substring(0,c),d=h[f];d&&(l.parent=d)}}for(var _=this._createEvalWithBinder(void 0,(function(t){var e=t.parseTrsPath();if(e){var i=h[e.node];if(i)return P5(i,e.property)}}),void 0),p=0;p=0&&this._embeddedPlayers.splice(e,1)},i[y5]=function(){this._embeddedPlayers.length=0},i.getAuxiliaryCurveNames_experimental=function(){return this._auxiliaryCurveEntries.map((function(t){return t.name}))},i.hasAuxiliaryCurve_experimental=function(t){return!!this._findAuxiliaryCurveEntry(t)},i.addAuxiliaryCurve_experimental=function(t){var e=this._findAuxiliaryCurveEntry(t);return e||((e=new f5).name=t,this._auxiliaryCurveEntries.push(e)),e.curve},i.getAuxiliaryCurve_experimental=function(t){return this._findAuxiliaryCurveEntry(t).curve},i.renameAuxiliaryCurve_experimental=function(t,e){var i=this._findAuxiliaryCurveEntry(t);i&&(i.name=e)},i.removeAuxiliaryCurve_experimental=function(t){we(this._auxiliaryCurveEntries,(function(e){return e.name===t}))},i._trySyncLegacyData=function(){this._legacyDataDirty&&(this._legacyDataDirty=!1,this.syncLegacyData())},i._createEvalWithBinder=function(t,e,i){this._legacyDataDirty&&(this._legacyDataDirty=!1,this.syncLegacyData());var n,r=[];i&&(n=this._createRootMotionEvaluation(t,i,r));for(var s,a=[],o=this._tracks,h=o.length,u=0;u=c&&t<=f?o?e!==u&&(h.stop(),h.play(),a.entered=!0):(h.play(),a.entered=!0):o&&(h.stop(),a.entered=!1),a.lastIterations=e,a.entered){var d=t-c;a.instantiatedPlayer.setTime(d)}}}},e.notifyHostSpeedChanged=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r0?(22&~s?h=n:e*=-1,o++):1===e&&h===n-1&&ra)break}h+=e,this._doFire(h,!0)}while(h!==r&&h>-1&&h=e.length||this._ignoreIndex===t))for(var i=e[t],n=i.events.length,r=0;r0?t/e:-t/e;if(o>=n){o=n,a=!0;var h=n-(0|n);0===h&&(h=1),t=h*e*(t>0?1:-1)}if(t>e){var u=t%e;t=0===u?e:u}else t<0&&0!=(t%=e)&&(t+=e);var l=!1,c=4&i;c&&(l=L5(i,o));var f=l?-1:1;return c&&l&&(t=e-t),s.time=t,s.ratio=s.time/e,s.direction=f,s.stopped=a,s.iterations=o,s}function L5(t,e){var i=!1;return 22&~t||(e-(0|e)==0&&e>0&&(e-=1),1&e&&(i=!i)),36&~t||(i=!i),i}var V5=new ir,N5=new ir,z5=new kr;new kr;var U5,G5,H5=function(){function t(){this._position=new ir,this._rotation=new kr,this._scale=ir.clone(ir.ONE)}return t.clone=function(e){var i=new t;return t.copy(i,e),i},t.setIdentity=function(t){return ir.copy(t._position,ir.ZERO),kr.copy(t._rotation,kr.IDENTITY),ir.copy(t._scale,ir.ONE),t},t.copy=function(t,e){return ir.copy(t._position,e._position),kr.copy(t._rotation,e._rotation),ir.copy(t._scale,e._scale),t},t.equals=function(t,e,i){return ir.equals(t._position,e._position,i)&&kr.equals(t._rotation,e._rotation,i)&&ir.equals(t._scale,e._scale,i)},t.strictEquals=function(t,e){return ir.strictEquals(t._position,e._position)&&kr.strictEquals(t._rotation,e._rotation)&&ir.strictEquals(t._scale,e._scale)},t.lerp=function(e,i,n,r){return 0===r?t.copy(e,i):1===r?t.copy(e,n):(ir.lerp(e._position,i._position,n._position,r),kr.slerp(e._rotation,i._rotation,n._rotation,r),ir.lerp(e._scale,i._scale,n._scale,r),e)},t.multiply=function(t,e,i){var n=kr.multiply(z5,e._rotation,i._rotation),r=ir.multiply(V5,i._scale,e._scale),s=ir.multiply(N5,i._position,e._scale);return ir.transformQuat(s,s,e._rotation),ir.add(s,s,e._position),ir.copy(t._position,s),kr.copy(t._rotation,n),ir.copy(t._scale,r),t},t.invert=function(t,e){var i=t._rotation,n=t._scale,r=t._position;return kr.invert(i,e._rotation),W5(n,e._scale,Ji),ir.negate(r,e._position),ir.multiply(r,r,n),ir.transformQuat(r,r,i),t},t.fromMatrix=function(t,e){return Qr.toSRT(e,t._rotation,t._position,t._scale),t},t.toMatrix=function(t,e){return Qr.fromSRT(t,e._rotation,e._position,e._scale)},n(t,[{key:"position",get:function(){return this._position},set:function(t){ir.copy(this._position,t)}},{key:"rotation",get:function(){return this._rotation},set:function(t){kr.copy(this._rotation,t)}},{key:"scale",get:function(){return this._scale},set:function(t){ir.copy(this._scale,t)}}]),t}();function W5(t,e,i){var n=e.x,r=e.y,s=e.z;return ir.set(t,Math.abs(n)<=i?0:1/n,Math.abs(r)<=i?0:1/r,Math.abs(s)<=i?0:1/s)}function j5(t,e,i){return ir.subtract(t.position,e.position,i.position),Q5(t.rotation,i.rotation,e.rotation),ir.subtract(t.scale,e.scale,i.scale),t}E5=H5,H5.IDENTITY=Object.freeze(new E5),H5.ZERO=Object.freeze(function(){var t=new E5;return ir.copy(t._position,ir.ZERO),kr.set(t._rotation,0,0,0,0),ir.copy(t._scale,ir.ZERO),t}()),H5.calculateRelative=(U5=new kr,G5=new ir,function(t,e,i){var n=kr.invert(U5,i._rotation),r=W5(G5,i._scale,Ji),s=ir.subtract(N5,e._position,i._position);return ir.transformQuat(s,s,n),ir.multiply(s,s,r),ir.copy(t._position,s),kr.multiply(t._rotation,n,e._rotation),ir.multiply(t._scale,e._scale,r),t});var q5,X5,Y5=(q5=new kr,function(t,e,i,n){ir.scaleAndAdd(t.position,e.position,i.position,n);var r=kr.slerp(q5,kr.IDENTITY,i.rotation,n);return kr.multiply(t.rotation,r,e.rotation),ir.scaleAndAdd(t.scale,e.scale,i.scale,n),t}),Q5=(X5=new kr,function(t,e,i){var n=kr.invert(X5,e);return kr.multiply(t,i,n)}),J5=Object.freeze(function(){var t=new H5;return t.position=ir.ZERO,t.rotation=kr.IDENTITY,t.scale=ir.ZERO,t}()),K5=function(){function t(t,e){this.transforms=void 0,this.auxiliaryCurves=void 0,this._poseTransformSpace=0,this.transforms=t,this.auxiliaryCurves=e}return t._create=function(e,i){return new t(e,i)},t}(),Z5=function(){function t(t){this._involvedTransforms=new Uint16Array(t)}return n(t,[{key:"involvedTransforms",get:function(){return this._involvedTransforms}}]),t}();function $5(t,e,i,n){void 0===n&&(n=void 0),t4(t.transforms,e.transforms,i,n),s4(t.auxiliaryCurves,e.auxiliaryCurves,i)}function t4(t,e,i,n){void 0===n&&(n=void 0);var r=t.length;if(t.length,0!==i)if(1!==i)if(n)for(var s=0;s=r)return{done:!0,value:void 0};var o=i[s];e=null==o?void 0:o.getClipStatuses(t*n[s]),++s}}}},e.__evaluatePort=function(t,e,i){for(var n=this._childEvaluators.length,r=0,s=null,a=0;a5?h-5:0),l=5;l=e[e.length-1])t[t.length-1]=1;else{for(var n=0,r=1;ri){n=r;break}var s=e[n-1],a=e[n],o=a-s;t[n-1]=(a-i)/o,t[n]=(i-s)/o}}var w6,T6,C6=Qh,A6=hu,D6=C6(JJ+"AnimationBlend1DItem")((Y4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0?t[n]=1:t.fill(1/e.length)}else{for(var r=-1,s=-1,a=-1,o=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY,u=i.x,l=i.y,c=0;c0?_>=h&&(h=_,r=c):_>=o&&(o=_,s=c)}}var p=0;if(r<0||s<0)p=1;else{var m=(T=e[r],C=e[s],A=i,D=T6,(I=ds.cross(T,C))?(D.wA=ds.cross(A,C)/I,D.wB=ds.cross(A,T)/-I):(D.wA=0,D.wB=0),D),g=m.wA,v=m.wB,y=0,b=0,S=g+v;S>1?(y=g/S,b=v/S):S<0?(y=0,b=0,p=1):(y=g,b=v,p=1-S),t[r]=y,t[s]=b}if(p>0)if(a>=0)t[a]=p;else for(var x=p/t.length,w=0;w0&&t.forEach((function(e,i){return t[i]=e/a}))}var k6,R6,O6,F6,L6,V6,N6,z6,U6,G6,H6=function(t,e,i,n,r){ds.subtract(n,i,t),ds.subtract(r,e,t)},W6=function(){function t(e){for(var i=t._ANGLE_MULTIPLIER,n=e.length,r=this._exampleMagnitudes=new Array(n).fill(0),s=this._exampleDirections=e.map((function(t,e){var i=ds.copy(new ds,t),n=ds.len(i);return r[e]=n,Zi(n,0,1e-5)||ds.multiplyScalar(i,i,1/n),i})),a=this._precomputedVIJs=new Float32Array(3*n*n),o=0;o0)for(var O=0;O=s)){this.setTransform(e,t);for(var a=e+1;a=0&&this._pages.length,this._pages[t].buffer},e.pushPage=function(t){var e=t[U8];this._pages.length,e===this._pages.length&&this._pushNewPage(),this._pages.length;var i=this._pages[e];return++i.useCount,++t[U8],i},e.popPage=function(t){var e=t[U8]-1,i=this._pages[e];i.useCount,--i.useCount,--t[U8],0===i.useCount&&(this._pages.length,this._pages.pop())},e.createAllocator=function(t){var e=new q8(this,t);return++this._allocatorCount,e},e.destroyAllocator=function(t){for(var e=t[U8],i=0;ii[e-1]}))}var e=t.prototype;return e.createAllocator=function(t){var e=t,i=this._selectStackPageSize(e),n=this._stacks.get(i);return n||(n=new W8(this,i),this._stacks.set(i,n)),n.createAllocator(e)},e[G8]=function(t){for(var e,i=p(this._stacks);!(e=i()).done;){var n=e.value,r=n[0];if(n[1]===t){this._stacks.delete(r);break}}},e._selectStackPageSize=function(t){var e=kh(this._thresholds,t),i=t;return e>=0?i=this._thresholds[e]:(e=~e)===this._thresholds.length||(e>=0&&this._thresholds.length,i=this._thresholds[e]),i},n(t,[{key:"isEmpty",get:function(){return 0===this._stacks.size}}]),t}(),Y8=function(){function t(t,e){this._poses=[],this._allocatedCount=0,this._memoryAllocator=void 0,this._transformCount=t,this._auxiliaryCurveCount=e;var i=Q8(t,e,1);this._memoryAllocator=J8.createAllocator(i)}var e=t.prototype;return e.destroy=function(){this._allocatedCount;for(var t=0;t>l7},set:function(t){this._id&=u7,this._id|=t<=n)return null;r>=0&&e.length;var s=null!==(t=e[r])&&void 0!==t?t:e[r]=this._createPose(r);return s[a7].poseIndex=r,this._idleFlags&=~(1<=0&&e.length,e[i],this._idleFlags|=1<=0){var n=e[i];return++n.refCount,n.handle}for(var r=0,s=function(t){var i=e.findIndex((function(e){return e.node===t}));if(i>=0)return r=i+1,1},a=t.parent;a&&!s(a);a=a.parent);for(var o=r;o=0){var n=e[i];return++n.refCount,n.handle}var r=e.length,s=new y7(new P7(this,r),t);return e.push(s),s.handle},e.createEvaluationContext=function(){return this._bindStarted,new B7(this.transformCount,this.auxiliaryCurveCount,this._parentTable.slice(),this._origin)},e.resetPoseStashAllocator=function(t){this._bindStarted,t._reset(this.transformCount,this.auxiliaryCurveCount)},e.createTransformFilter=function(t){for(var e,i=this._origin,n=[],r=p(this._transformRecords);!(e=r()).done;){var s=e.value,a=s.node,o=s.handle,h=u(i,a);if(void 0===h)Q(a.getPathInHierarchy()+" is not a child of "+i.getPathInHierarchy());else if(t.isExcluded(h))continue;n.push(o.index)}return n.sort(),new Z5(n);function u(t,e){for(var i=[],n=e;n;n=n.parent){if(n===t)return i.join("/");i.unshift(n.name)}}},e.fetchDefaultTransforms=function(t){var e=this._transformRecords.length;t.length;for(var i=0;i=0&&this._transformRecords.length;var e=this._transformRecords[t];e.refCount,--e.refCount},e._destroyAuxiliaryCurveHandle=function(t){t>=0&&this._auxiliaryCurveRecords.length;var e=this._auxiliaryCurveRecords[t];e.refCount,--e.refCount},e.startBind=function(){this._bindStarted=!0,this._transformCountBeforeBind=this._transformRecords.length,this._auxiliaryCurveCountBeforeBind=this._auxiliaryCurveRecords.length},e.endBind=function(){var t=this._transformRecords,e=this._auxiliaryCurveRecords,i=0;if(b7(t),t.length!==this._transformCountBeforeBind){i|=1;for(var n=t.length,r=0;r=0?n:-1}else{var r=t.findIndex((function(t){return t.node===i}));u[f]=r}},f=0;f0}));if(t.length,e!==t.length){for(var i=0;i=0;--i){var n=this._parentTable[i];if(!(n<0)){var r=e.getTransform(i,D7),s=e.getTransform(n,I7);H5.calculateRelative(r,r,s),e.setTransform(i,r)}}t._poseTransformSpace=0},e._convertPoseSpaceTransformToTargetSpace=function(t,e,i,n){var r=i._poseTransformSpace;switch(e){default:break;case 0:1===r?H5.multiply(t,this._getComponentToWorldTransform(),t):H5.multiply(t,this._getLocalToWorldTransform(I7,i,n),t);break;case 1:1===r||H5.multiply(t,this._getLocalToComponentTransform(I7,i,n),t);break;case 2:if(1===r){var s=this._parentTable[n];if(s>=0){var a=i.transforms.getTransform(s,I7),o=H5.invert(a,a);H5.multiply(t,o,t)}}break;case 3:var h=i.transforms.getTransform(n,I7),u=H5.invert(h,h);H5.multiply(t,u,t)}return t},e._convertTransformToPoseTransformSpace=function(t,e,i,n){var r=i._poseTransformSpace;switch(e){default:break;case 0:if(1===r){var s=H5.invert(I7,this._getComponentToWorldTransform());H5.multiply(t,s,t)}else{var a=this._getLocalToWorldTransform(I7,i,n),o=H5.invert(a,a);H5.multiply(t,o,t)}break;case 1:if(1===r);else{var h=this._getLocalToComponentTransform(I7,i,n),u=H5.invert(h,h);H5.multiply(t,u,t)}break;case 2:if(1===r){var l=this._parentTable[n];if(l>=0){var c=i.transforms.getTransform(l,I7);H5.multiply(t,c,t)}}break;case 3:var f=i.transforms.getTransform(n,I7);H5.multiply(t,f,t)}return t},e._getComponentToWorldTransform=function(){var t=this._cacheComponentToWorldTransform,e=this._componentNode;return t.position=e.worldPosition,t.rotation=e.worldRotation,t.scale=e.worldScale,t},e._getLocalToComponentTransform=function(t,e,i){var n=this._parentTable;H5.setIdentity(t);for(var r=n[i];r>=0;r=n[r]){var s=e.transforms.getTransform(r,D7);H5.multiply(t,s,t)}return t},e._getLocalToWorldTransform=function(t,e,i){return this._getLocalToComponentTransform(t,e,i),H5.multiply(t,this._getComponentToWorldTransform(),t),t},n(t,[{key:"allocatedPoseCount",get:function(){return this._poseAllocator.allocatedCount}},{key:"parentTable",get:function(){return this._parentTable}},{key:"_stackSize_debugging",get:function(){return this._poseAllocator.allocatedCount}}]),t}(),M7=function(){function t(t,e){this.index=-1,this._host=void 0,this._host=t,this.index=e}return t.prototype.destroy=function(){this._host._destroyTransformHandle(this.index)},t}(),P7=function(){function t(t,e){this.index=-1,this._host=void 0,this._host=t,this.index=e}return t.prototype.destroy=function(){this._host._destroyAuxiliaryCurveHandle(this.index)},t}(),E7=function(){function t(){this._context={deltaTime:0,indicativeWeight:0}}var e=t.prototype;return e.generate=function(t,e){return this._context.deltaTime=t,this._context.indicativeWeight=e,this._context},e.forkSubWeight=function(t,e){this._context.deltaTime=t.deltaTime,this._context.indicativeWeight=t.indicativeWeight*e},t}(),k7=function(){function t(){this._allocator=null}var e=t.prototype;return e._reset=function(t,e){this._allocator=new o7(t,e)},e.allocatePose=function(){return this._allocator,this._allocator.allocatePose()},e.destroyPose=function(t){return this._allocator,this._allocator.destroyPose(t)},n(t,[{key:"allocatedPoseCount",get:function(){return this._allocator,this._allocator.allocatedCount}}]),t}(),R7=hu;Qh(JJ+"UnaryCondition")((T7=function(){function t(){this.operator=x7&&x7(),this.operand=w7&&w7()}var e=t.prototype;return e.clone=function(){var e=new t;return e.operator=this.operator,e.operand=this.operand.clone(),e},e[C2]=function(t){var e=this.operator,i=this.operand,n=new G7(e,!1),r=v6(t,i,1,n.setOperand,n);return n.reset(r),n},t}(),T7.Operator={TRUTHY:0,FALSY:1},x7=Nh((S7=T7).prototype,"operator",[R7],(function(){return 0})),w7=Nh(S7.prototype,"operand",[R7],(function(){return new g6})),S7));var O7,F7,L7,V7,N7,z7,U7,G7=function(){function t(t,e){this._operator=t,this._operand=e,this._eval()}var e=t.prototype;return e.reset=function(t){this.setOperand(t)},e.setOperand=function(t){this._operand=t,this._eval()},e.eval=function(){return this._result},e._eval=function(){var t=this._operand;switch(this._operator){default:case 0:this._result=!!t;break;case 1:this._result=!t}},t}(),H7=function(){},W7=function(){for(var t=arguments.length,e=new Array(t),i=0;ir;case 5:return n>=r}},t}(),I9=hu,B9=Qh(JJ+"TriggerCondition")((h9=function(){function t(){this.trigger=u9&&u9()}var e=t.prototype;return e.clone=function(){var e=new t;return e.trigger=this.trigger,e},e[C2]=function(t){var e=new M9(!1),i=t.getVar(this.trigger);return y6(i,this.trigger)&&(S6(i.type,this.trigger),e.setTrigger(i.bind(e.setTrigger,e))),e},t}(),u9=Nh(h9.prototype,"trigger",[I9],(function(){return""})),o9=h9))||o9,M9=function(){function t(t){this._triggered=!1,this._triggered=t}var e=t.prototype;return e.setTrigger=function(t){this._triggered=t},e.eval=function(){return this._triggered},t}(),P9=Qh(JJ+"StateMachineComponent")(l9=function(){function t(){}var e=t.prototype;return e.onMotionStateEnter=function(){},e.onMotionStateExit=function(){},e.onMotionStateUpdate=function(){},e.onStateMachineEnter=function(){},e.onStateMachineExit=function(){},t}())||l9,E9=Qh(JJ+"MotionSyncInfo")((f9=function(){this.group=d9&&d9()},d9=Nh(f9.prototype,"group",[hu],(function(){return""})),c9=f9))||c9,k9=1e-5,R9=(_9=Qh(JJ+"PoseNodePlayMotion"),p9=F0((function(t){t.category="i18n:ENGINE.animation_graph.pose_graph_node_sub_categories.pose_nodes/"})),m9=function(t){return F0((function(e){e.factory=t}))}((A9=function(t){var e=new R9;return e.motion=t,e},{listEntries:function(){return[{arg:{type:"clip-motion"},menu:"i18n:ENGINE.animation_graph.pose_graph_node_sub_menus.play_or_sample_clip_motion"},{arg:{type:"animation-blend-1d"},menu:"i18n:ENGINE.animation_graph.pose_graph_node_sub_menus.play_or_sample_animation_blend_1d"},{arg:{type:"animation-blend-2d"},menu:"i18n:ENGINE.animation_graph.pose_graph_node_sub_menus.play_or_sample_animation_blend_2d"}]},create:function(t){var e=null;switch(t.type){case"clip-motion":e=new r6;break;case"animation-blend-1d":e=new I6;break;case"animation-blend-2d":e=new i8}return A9(e)}})),g9=L0({themeColor:"#227F9B"}),v9=$0({type:0}),y9=$0({type:0}),_9(b9=p9(b9=m9(b9=g9((S9=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rk9&&(r=e*this.speedMultiplier/n),i?i.notifyUpdate(r,t.indicativeWeight):this._workspace.normalizedTime+=r,this._workspace.lastIndicativeWeight=t.indicativeWeight}},i.doEvaluate=function(t){if(this._workspace){var e=this._runtimeSyncRecord?this._runtimeSyncRecord.getSyncedEnterTime():this._workspace.normalizedTime;return this._workspace.motionEvalPort.evaluate(e,t)}return t.pushDefaultedPose()},n(e,[{key:"lastIndicativeWeight",get:function(){var t,e;return null!==(t=null==(e=this._workspace)?void 0:e.lastIndicativeWeight)&&void 0!==t?t:0}},{key:"elapsedMotionTime",get:function(){var t,e;return null!==(t=null==(e=this._workspace)?void 0:e.normalizedTime)&&void 0!==t?t:0}}]),e}(K0),x9=Nh(S9.prototype,"motion",[hu],(function(){return new r6})),w9=Nh(S9.prototype,"syncInfo",[hu],(function(){return new E9})),T9=y(S9.prototype,"startTime",[hu,v9],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),C9=y(S9.prototype,"speedMultiplier",[hu,y9],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),b9=S9))||b9)||b9)||b9)||b9),O9=function(t,e){this.normalizedTime=0,this.lastIndicativeWeight=0,this.motionEval=t,this.motionEvalPort=e};function F9(t){return t instanceof K0||t instanceof Z0}var L9=function(){function t(t,e){this._rootPoseNode=t,this._countingPlayMotionNodes=e}var e=t.prototype;return e.bind=function(t){var e;null==(e=this._rootPoseNode)||e.bind(t)},e.settle=function(t){var e;null==(e=this._rootPoseNode)||e.settle(t)},e.reenter=function(){var t;null==(t=this._rootPoseNode)||t.reenter()},e.update=function(t){var e;null==(e=this._rootPoseNode)||e.update(t)},e.evaluate=function(t){var e,i;return null!==(e=null==(i=this._rootPoseNode)?void 0:i.evaluate(t,1))&&void 0!==e?e:null},e.countMotionTime=function(){var t=this._countingPlayMotionNodes;if(!t)return 0;for(var e=0,i=Number.NEGATIVE_INFINITY,n=0;ni&&(i=a,e=s)}return e},t}();function V9(t,e,i){void 0===i&&(i=!1);var n=t.outputNode,r=t.getShell(n).getBindings();if(r.length,0===r.length)return new L9(void 0,i?[]:void 0);var s=r[0];s.outputIndex,s.producer;var a=new Map,o=N9(t,s.producer,a,e);return new L9(o,i?Array.from(a.values()).filter((function(t){return t instanceof R9})):void 0)}function N9(t,e,i,n){var r=t.getShell(e),s=i.get(e);if(s)return s;var a=H$(e);"__callOnAfterDeserializeRecursive"in a&&a.__callOnAfterDeserializeRecursive(),a instanceof Z0&&a.link(n);for(var o,h=a,u=[],l=p(r.getBindings());!(o=l()).done;){var c=o.value,f=c.producer,d=c.outputIndex,_=c.inputPath;if(F9(f)){var m=N9(t,f,i,n);if(m instanceof K0)G9(h,_,m,d);else{var g=q9(h,_,m,d);g&&u.push(g)}}else Y("There's a input bound to a node with unrecognized type.")}var v,y=new z9(u);return h instanceof K0?(h._setDependencyEvaluation(y),v=h):v=new U9(h,y),i.set(e,v),v}var z9=function(){function t(t){this._bindingEvaluations=void 0,this._bindingEvaluations=t}return t.prototype.evaluate=function(){for(var t,e=p(this._bindingEvaluations);!(t=e()).done;)t.value.evaluate()},t}(),U9=function(){function t(t,e){this._outputs=void 0,this._node=t,this._dependency=e,this._outputs=new Array(t.outputCount)}var e=t.prototype;return e.getDefaultOutput=function(){return this.getOutput(0)},e.getOutput=function(t){return this._outputs[t]},e.evaluate=function(){var t=this._node;this._dependency.evaluate(),t.selfEvaluate(this._outputs)},n(t,[{key:"node",get:function(){return this._node}},{key:"outputCount",get:function(){return this._outputs.length}}]),t}();function G9(t,e,i,n){var r=e[0],s=e[1],a=void 0===s?-1:s;if(r in t)if(0===n){var o=t[r];if(a<0)return null!==o?void Y("Invalid binding: consumer node's input "+r+" should be leaved as evaluation before evaluation."):void(t[r]=i);Array.isArray(o)?a>=o.length?Y("Invalid binding: consumer node's input "+r+" have length "+o.length+" but the binding specified "+a):null===o[a]?o[a]=i:Y("Invalid binding: consumer node's input "+r+"["+a+"] should be leaved as null before evaluation"):Y("Invalid binding: consumer node's input "+r+" should be an array.")}else Y("Node "+i.toString()+" does not have specified output "+n+".");else Y("Invalid binding: consumer node has no property "+r)}var H9,W9=function(){function t(t,e,i,n){this._consumerNode=t,this._consumerPropertyKey=e,this._producerRecord=i,this._producerOutputIndex=n}return t.prototype.evaluate=function(){this._producerRecord.evaluate(),this._consumerNode[this._consumerPropertyKey]=this._producerRecord.getOutput(this._producerOutputIndex)},t}(),j9=function(){function t(t,e,i,n,r){this._consumerNode=t,this._consumerPropertyKey=e,this._consumerElementIndex=i,this._producerRecord=n,this._producerOutputIndex=r}return t.prototype.evaluate=function(){this._producerRecord.evaluate(),this._consumerNode[this._consumerPropertyKey][this._consumerElementIndex]=this._producerRecord.getOutput(this._producerOutputIndex)},t}();function q9(t,e,i,n){var r=e[0],s=e[1],a=void 0===s?-1:s;if(r in t){var o=t[r];if(a<0)return new W9(t,r,i,n);if(Array.isArray(o)){if(!(a>=o.length))return new j9(t,r,a,i,n);Y("Invalid binding: consumer node's input "+r+" have length "+o.length+" but the binding specified "+a)}else Y("Invalid binding: consumer node's input "+r+" should be an array.")}else Y("Invalid binding: consumer node has no property "+r)}var X9=function(){function t(t,e,i){this.passthroughWeight=1,this._motionStates=[],this._proceduralPoseStates=[],this._topLevelEntry=void 0,this._topLevelExit=void 0,this._currentNode=void 0,this._pendingTransitionPath=[],this._activatedTransitions=[],this._activatedTransitionPool=ptt.createPool(4),this._updateContextGenerator=new E7,this._conditionEvaluationContext=new _tt,this._additive=!1,this._additive=i.additive,this.name=e,this._controller=i.controller;var n=this._addStateMachine(t,null,i,e),r=n.entry,s=n.exit;this._topLevelEntry=r,this._topLevelExit=s,this._currentNode=r,r.increaseActiveReference(),this._resetTrigger=i.triggerResetter}var e=t.prototype;return e.settle=function(t){for(var e=this._proceduralPoseStates,i=e.length,n=0;n=16){at(14e3,16,"");break}var r=this._matchNextTransition(i);if(!r)break;var s=r.to,a=i;if(i=s,Y9(s)){if(s===a)break;this._activateTransition(t,r),t.length=0}else t.push(r)}t.length=0},e._resetStateTickFlagsAndWeights=function(){var t=this._currentNode,e=this._activatedTransitions;t.resetTickFlagsAndWeight();for(var i=0;i=0;--i){var s=e[i],a=0===i?this._currentNode:e[i-1].destination;if(s.update(t,a),s.done){this._dropActivatedTransitions(r);break}var o=s.normalizedElapsedTime*n;s.destination.increaseAbsoluteWeight(o),n*=1-s.normalizedElapsedTime,r=i-1}this._currentNode.increaseAbsoluteWeight(n)},e._dropActivatedTransitions=function(t){var e=this._activatedTransitions,i=this._activatedTransitionPool;t>=0&&e.length;var n=t+1,r=e[t],s=r.destination;r.path.length;var a=r.path[r.path.length-1];a.endEventBinding&&this._emit(a.endEventBinding),this._callExitMethods(this._currentNode);for(var o=0;o<=t;++o){var h=e[o];o!==t&&h.destination.decreaseActiveReference();for(var u=o===t?h.path.length-1:h.path.length,l=0;l=0?e:1+e}var stt,att,ott,htt,utt,ltt,ctt=function(t){function e(e,i){var n;return(n=t.call(this,e)||this).kind=void 0,n.kind=i,n}return s(e,t),e}(K9),ftt=function(t){function e(e){var i;return(i=t.call(this,e)||this).kind=4,i}return s(e,t),e}(K9),dtt=function(t){function e(e,i){var n;(n=t.call(this,e)||this).kind=5,n.elapsedTime=0,n.statusCache={progress:0},n._instantiatedPoseGraph=void 0,n._statusCache={progress:0},n._elapsedTime=0;var r=V9(e.graph,i,!0);return r.bind(i),n._instantiatedPoseGraph=r,n._statusCache.progress=0,n}s(e,t);var i=e.prototype;return i.settle=function(t){this._instantiatedPoseGraph.settle(t)},i.reenter=function(){this._statusCache.progress=0,this._instantiatedPoseGraph.reenter()},i.update=function(t){this._elapsedTime+=t.deltaTime,this._instantiatedPoseGraph.update(t)},i.evaluate=function(t){var e;return null!==(e=this._instantiatedPoseGraph.evaluate(t))&&void 0!==e?e:null},i.getStatus=function(){return this._statusCache.progress=rtt(this._elapsedTime),this._statusCache},i.countMotionTime=function(){return this._instantiatedPoseGraph.countMotionTime()},e}(Z9),_tt=function(){function t(){this.sourceStateWeight=0,this._sourceState=void 0}var e=t.prototype;return e.set=function(t){this._sourceState=t,Y9(t)?(t.activeReferenceCount,this.sourceStateWeight=t.absoluteWeight):this.sourceStateWeight=0},e.unset=function(){this._sourceState=void 0,this.sourceStateWeight=0},n(t,[{key:"sourceStateMotionTimeNormalized",get:function(){var t=this._sourceState;switch(t&&(3===t.kind||5===t.kind)&&t.activeReferenceCount,t.kind){case 3:return t.normalizedTime;case 5:return t.countMotionTime();default:return 0}}}]),t}(),ptt=function(){function t(){this.normalizedElapsedTime=0,this.path=[],this._durationMultiplier=1}var e=t.prototype;return e.getAbsoluteDuration=function(t){return this._getAbsoluteDurationUnscaled(t)*this._durationMultiplier},e.update=function(t,e){if(Y9(e)){var i=this.getAbsoluteDuration(e);if(i<=0)this.normalizedElapsedTime=1;else{var n=this.normalizedElapsedTime*i,r=i-n,s=tn((n+Math.min(r,t))/i);this.normalizedElapsedTime=s}}else this.normalizedElapsedTime=1},t.createPool=function(e){return new oo((function(){return new t}),e,void 0)},e.reset=function(t,e){var i=e.to;Y9(i),this.normalizedElapsedTime=0,this.destination=i,this.path=[].concat(t,[e]);var n=i.activeReferenceCount;if(i.increaseActiveReference(),0===n)if(3===i.kind){var r=this.path[0],s=r.destinationStart,a=r.relativeDestinationStart?s:0===i.duration?0:s/i.duration;i.reenter(a)}else 5===i.kind&&i.reenter();i.activeReferenceCount,this._durationMultiplier=1-i.absoluteWeight},e._getAbsoluteDurationUnscaled=function(t){this.path.length;var e=this.path[0],i=e.duration;return e.normalizedDuration?(3===t.kind?t.duration:1)*i:i},n(t,[{key:"done",get:function(){return Zi(this.normalizedElapsedTime,1,1e-6)}}]),t}(),mtt=function(){function t(){this._groups=[]}var e=t.prototype;return e.register=function(t){var e=t.group,i=this._groups.find((function(t){return t.name===e}));return i||(i=new gtt(e),this._groups.push(i)),i.addMember()},e.sync=function(){for(var t,e=p(this._groups);!(t=e()).done;)t.value.sync()},t}(),gtt=function(){function t(t){this._lastLeader=void 0,this._records=[],this.name=t}var e=t.prototype;return e.addMember=function(){var t=new vtt;return this._records.push(t),t},e.sync=function(){var t=this._records,e=t.length,i=this._lastLeader;if(this._lastLeader=void 0,!t.every((function(t){return!t.active}))){t.sort((function(t,e){var i=t.active?t.weight:-1;return(e.active?e.weight:-1)-i}));var n=0,r=t[0].weight;if(t[n]!==i)for(var s=0;s=0&&this._layerRecords.length,this._layerRecords[t].weight},i.setLayerWeight=function(t,e){t>=0&&this._layerRecords.length,this._layerRecords[t].weight=e},i.getLayerTopLevelStateMachineEvaluation=function(t){return this._layerRecords[t].stateMachineEvaluation},i.overrideClips=function(t){for(var e=this._layerRecords,i=e.length,n=0;n0||delete e[t])},e.apply=function(t){var e,i,n,r=this._transformApplyFlags,s=this._properties,a=s.position,o=s.scale,h=s.rotation,u=s.eulerAngles;r&&(a&&1&r&&(e=a.result),o&&4&r&&(i=o.result),u&&8&r&&(n=u.result),h&&2&r&&(n=h.result),(n||e||i)&&t.setRTS(n,e,i),this._transformApplyFlags=0)},n(t,[{key:"empty",get:function(){var t=this._properties;return!(t.position||t.rotation||t.eulerAngles||t.scale)}}]),t}(),Ftt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.apply=function(e){var i=this._properties,n=i.position,r=i.scale,s=i.rotation,a=i.eulerAngles;n&&n.accumulatedWeight&&(this._transformApplyFlags|=1,n.accumulatedWeight<1&&n.blend(e.position,1-n.accumulatedWeight)),r&&r.accumulatedWeight&&(this._transformApplyFlags|=4,r.accumulatedWeight<1&&r.blend(e.scale,1-r.accumulatedWeight)),a&&a.accumulatedWeight&&(this._transformApplyFlags|=8,a.accumulatedWeight<1&&a.blend(e.eulerAngles,1-a.accumulatedWeight)),s&&s.accumulatedWeight&&(this._transformApplyFlags|=2,s.accumulatedWeight<1&&s.blend(e.rotation,1-s.accumulatedWeight)),t.prototype.apply.call(this,e),null==n||n.reset(),null==r||r.reset(),null==s||s.reset(),null==a||a.reset()},i._createVec3BlendState=function(){return new ktt},i._createQuatBlendState=function(){return new Rtt},e}(Ott),Ltt=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createNodeBlendState=function(){return new Ftt},e}(Ptt);function Vtt(t,e,i,n,r){var s=i+r;if(1!==r||i){if(s){var a=r/s;ir.lerp(t,t,n,a)}}else ir.copy(t,n);return s}function Ntt(t,e,i,n,r){var s=i+r;if(1!==r||i){if(s){var a=r/s;kr.slerp(t,e,n,a)}}else kr.copy(t,n);return s}var ztt=t("aB",Qh((Mtt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0?this._crossFades.fastRemoveAt(e):ht(3907)},i.update=function(t){var e=this._delayEvents,i=this._crossFades,n=this._sockets,r=i.array;for(i.i=0;i.i=0?this._anims.fastRemoveAt(e):ht(3907)},i.pushDelayEvent=function(t,e,i){this._delayEvents.push({fn:t,thisArg:e,args:i})},i.addSockets=function(t,e){for(var i=this,n=function(){var n=e[r];if(i._sockets.find((function(t){return t.target===n.target})))return 1;var s=t.getChildByPath(n.path),a=n.target&&s&&SY(s,t);a&&i._sockets.push({target:n.target,transform:a})},r=0;r=h.easeDuration){a=o+1,h.easeTime=h.easeDuration;break}}if(a!==i.length){for(var c=a;c=0||(this._clips.push(t),this.createState(t)))}}]),e}(Do(gg)),Ktt.EventType=sK,y((Xtt=Ktt).prototype,"clips",[Htt],Object.getOwnPropertyDescriptor(Xtt.prototype,"clips"),Xtt.prototype),y(Xtt.prototype,"defaultClip",[Wtt],Object.getOwnPropertyDescriptor(Xtt.prototype,"defaultClip"),Xtt.prototype),Ytt=Nh(Xtt.prototype,"playOnLoad",[hu],(function(){return!1})),Qtt=Nh(Xtt.prototype,"_clips",[jtt],(function(){return[]})),Jtt=Nh(Xtt.prototype,"_defaultClip",[hu],(function(){return null})),qtt=Xtt))||qtt)||qtt));function net(t,e){return t===e||!!t&&!!e&&t._uuid===e._uuid&&t._uuid}C.Animation=iet,C.AnimationComponent=iet,le(iet,"cc.AnimationComponent"),function(t){t.PLAYED="play",t.PAUSED="pause",t.STOPPED="stop",t.SEEKED="seeked",t.ENDED="ended",t.INTERRUPTION_BEGIN="interruptionBegin",t.INTERRUPTION_END="interruptionEnd",t.USER_GESTURE="on_gesture"}(Ztt||(Ztt={})),function(t){t[t.DOM_AUDIO=0]="DOM_AUDIO",t[t.WEB_AUDIO=1]="WEB_AUDIO",t[t.MINIGAME_AUDIO=2]="MINIGAME_AUDIO",t[t.NATIVE_AUDIO=3]="NATIVE_AUDIO",t[t.UNKNOWN_AUDIO=4]="UNKNOWN_AUDIO"}($tt||($tt={})),function(t){t[t.INIT=0]="INIT",t[t.PLAYING=1]="PLAYING",t[t.PAUSED=2]="PAUSED",t[t.STOPPED=3]="STOPPED",t[t.INTERRUPTED=4]="INTERRUPTED"}(tet||(tet={}));var ret=t("aG",function(){function t(){this._bufferView=void 0,this._normalizeFactor=1;for(var t=arguments.length,e=new Array(t),i=0;i=0;s--){var a=i[s];if("stop"===a.op){n.push(a);break}if("seek"===a.op)r||(n.push(a),r=!0);else{if(r){n.push(a);break}0===n.length&&n.push(a)}}t._operationQueue=n.reverse()}var aet,oet=0;function het(t,e){var i;e.invoking||(e.invoking=!0,(i=e.func).call.apply(i,[t].concat(e.args)).then((function(){e.invoking=!1,t._operationQueue.shift(),t._eventTarget.emit(e.id.toString()),t._eventTarget.off(e.id.toString()),set(t);var i=t._operationQueue[0];i&&het(t,i)})).catch((function(){})))}function uet(t,e,i){var n=i.value;i.value=function(){for(var t=this,i=arguments.length,r=new Array(i),s=0;s=this.duration&&(this._startTime=this._now(),this._startOffset=0),e%this.duration},e.start=function(){this._isPaused=!1,this._startTime=this._now()},e.pause=function(){this._isPaused||(this._isPaused=!0,this._startOffset=this._calculateCurrentTime())},e.stop=function(){this._isPaused=!0,this._startOffset=0},e.seek=function(t){this._startTime=this._now(),this._startOffset=$i(t,0,this.duration)},n(t,[{key:"duration",get:function(){return this._nativeAudio.duration}},{key:"currentTime",get:function(){return this._isPaused?this._startOffset:this._calculateCurrentTime()}}]),t}(),get=function(){function t(){this._audioBufferDataMap={}}var e=t.prototype;return e.addCache=function(t,e){this._audioBufferDataMap[t]?at(5204,t):this._audioBufferDataMap[t]={usedCount:1,audioBuffer:e}},e.retainCache=function(t){var e=this._audioBufferDataMap[t];e?e.usedCount++:at(5203,t)},e.getCache=function(t){var e=this._audioBufferDataMap[t];return null==e?void 0:e.audioBuffer},e.tryReleasingCache=function(t){var e=this._audioBufferDataMap[t];e?--e.usedCount<=0&&delete this._audioBufferDataMap[t]:at(5203,t)},t}(),vet=new get,yet=window.AudioContext||window.webkitAudioContext||window.mozAudioContext,bet="on-context-running",xet=function(){function t(){var t=this;this._eventTarget=void 0,this._context=void 0,this._isRunning=!1,this._context=new(window.AudioContext||window.webkitAudioContext||window.mozAudioContext),this._eventTarget=new Io,this._context.onstatechange=function(){"running"===t._context.state?(t._isRunning=!0,t._eventTarget.emit(bet)):t._isRunning=!1}}var e=t.prototype;return e.onceRunning=function(t,e){this._eventTarget.once(bet,t,e)},e.offRunning=function(t,e){this._eventTarget.off(bet,t,e)},e.decodeAudioData=function(t){var e=this;return new Promise((function(i,n){var r=e._context.decodeAudioData(t,(function(t){i(t)}),(function(t){console.error("failed to load Web Audio",t)}));null==r||r.catch(n)}))},e.runContext=function(){var t=this;return new Promise((function(e){if(t.isRunning)e();else{var i=t._context;if(i.resume){if("suspended"===i.state)i.resume().catch((function(t){Y("runContext error",t)}));else if("running"===i.state)return void e();var n=document.getElementById("GameCanvas"),r=function t(){i.resume().then((function(){null==n||n.removeEventListener("touchend",t,{capture:!0}),null==n||n.removeEventListener("mouseup",t,{capture:!0}),e()})).catch((function(t){Y("onGesture resume error",t)}))};null==n||n.addEventListener("touchend",r,{capture:!0}),null==n||n.addEventListener("mouseup",r,{capture:!0})}else e()}}))},e.createBufferSource=function(t,e){var i=this._context.createBufferSource();return void 0!==t&&(i.buffer=t),void 0!==e&&(i.loop=e),i},e.createGain=function(t){void 0===t&&(t=1);var e=this._context.createGain();return this.setGainValue(e,t),e},e.setGainValue=function(t,e){if(t.gain.setTargetAtTime)try{t.gain.setTargetAtTime(e,this._context.currentTime,0)}catch(i){t.gain.setTargetAtTime(e,this._context.currentTime,.01)}else t.gain.value=e},e.connectContext=function(t){this._context&&t.connect(this._context.destination)},n(t,[{key:"isRunning",get:function(){return this._isRunning}},{key:"currentTime",get:function(){return this._context.currentTime}}]),t}();xet.support=!!yet,xet.support&&(det=new xet);var wet,Tet,Cet,Aet,Det=function(){function t(t,e,i){this._duration=void 0,this._bufferSourceNode=void 0,this._onPlayCb=void 0,this._currentTimer=0,this._url=void 0,this._onEndCb=void 0,this._duration=t.duration,this._url=i,this._bufferSourceNode=det.createBufferSource(t,!1);var n=det.createGain(e);this._bufferSourceNode.connect(n),det.connectContext(n)}var e=t.prototype;return e.play=function(){var t=this;this._bufferSourceNode.start(),det.runContext().then((function(){null==t.onPlay||t.onPlay(),t._currentTimer=window.setTimeout((function(){vet.tryReleasingCache(t._url),null==t.onEnd||t.onEnd()}),1e3*t._duration)})).catch((function(t){Y("play error",t)}))},e.stop=function(){clearTimeout(this._currentTimer),vet.tryReleasingCache(this._url),this._bufferSourceNode.stop(),this._bufferSourceNode.disconnect(),this._bufferSourceNode.buffer=null},n(t,[{key:"onPlay",get:function(){return this._onPlayCb},set:function(t){this._onPlayCb=t}},{key:"onEnd",get:function(){return this._onEndCb},set:function(t){this._onEndCb=t}}]),t}(),Iet=(fet=function(){function t(t,e){this._src=void 0,this._audioBuffer=void 0,this._sourceNode=void 0,this._gainNode=void 0,this._currentTimer=0,this._volume=1,this._loop=!1,this._state=tet.INIT,this._audioTimer=void 0,this._runningCallback=void 0,this._eventTarget=new Io,this._operationQueue=[],this._audioBuffer=t,this._audioTimer=new met(t),this._gainNode=det.createGain(),det.connectContext(this._gainNode),this._src=e,Uk.on(zk.EVENT_PAUSE,this._onInterruptedBegin,this),Uk.on(zk.EVENT_RESUME,this._onInterruptedEnd,this)}var e=t.prototype;return e.destroy=function(){window.clearTimeout(this._currentTimer),this._audioTimer.destroy(),this._audioBuffer&&(this._audioBuffer=null),vet.tryReleasingCache(this._src),Uk.off(zk.EVENT_PAUSE,this._onInterruptedBegin,this),Uk.off(zk.EVENT_RESUME,this._onInterruptedEnd,this),this.offRunning()},t.load=function(e){return new Promise((function(i,n){t.loadNative(e).then((function(n){i(new t(n,e))})).catch(n)}))},t.loadNative=function(t){return new Promise((function(e,i){var n=vet.getCache(t);if(n)return vet.retainCache(t),void e(n);var r=new XMLHttpRequest,s="load audio failed: "+t+", status: ";r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(){200===r.status||0===r.status?det.decodeAudioData(r.response).then((function(i){vet.addCache(t,i),e(i)})).catch((function(e){Y("loadNative error",t,e)})):i(new Error(""+s+r.status+"(no response)"))},r.onerror=function(){i(new Error(""+s+r.status+"(error)"))},r.ontimeout=function(){i(new Error(""+s+r.status+"(time out)"))},r.onabort=function(){i(new Error(""+s+r.status+"(abort)"))},r.send(null)}))},t.loadOneShotAudio=function(e,i){return new Promise((function(n,r){t.loadNative(e).then((function(t){var r=new Det(t,i,e);n(r)})).catch(r)}))},e.getPCMData=function(t){return new ret(this._audioBuffer.getChannelData(t),1)},e._onInterruptedBegin=function(){var t=this;this._state===tet.PLAYING&&this.pause().then((function(){t._state=tet.INTERRUPTED,t._eventTarget.emit(Ztt.INTERRUPTION_BEGIN)})).catch((function(t){Y("_onInterruptedBegin error",t)}))},e._onInterruptedEnd=function(){var t=this;this._state===tet.INTERRUPTED&&this.play().then((function(){t._eventTarget.emit(Ztt.INTERRUPTION_END)})).catch((function(t){Y("_onInterruptedEnd error",t)}))},e.offRunning=function(){this._runningCallback&&(det.offRunning(this._runningCallback),this._runningCallback=void 0)},e.seek=function(t){var e=this;return new Promise((function(i){e.offRunning(),e._audioTimer.seek(t),e._state===tet.PLAYING?e._doPlay().then(i).catch((function(t){Y("seek error",t)})):i()}))},e.play=function(){return this.offRunning(),this._doPlay()},e._doPlay=function(){var t=this;return new Promise((function(e){det.isRunning?(t._startSourceNode(),e()):(t.offRunning(),t._runningCallback=function(){t._startSourceNode(),e()},det.onceRunning(t._runningCallback),det.runContext().catch((function(t){Y("doPlay error",t)})))}))},e._startSourceNode=function(){var t=this;this._stopSourceNode(),this._sourceNode=det.createBufferSource(this._audioBuffer,this.loop),this._sourceNode.connect(this._gainNode),this._sourceNode.loop=this._loop,this._sourceNode.start(0,this._audioTimer.currentTime),this._state=tet.PLAYING,this._audioTimer.start(),window.clearTimeout(this._currentTimer),this._currentTimer=window.setTimeout((function e(){t.loop?t._currentTimer=window.setTimeout(e,1e3*t._audioBuffer.duration):(t._audioTimer.stop(),t._eventTarget.emit(Ztt.ENDED),t._state=tet.INIT)}),1e3*(this._audioBuffer.duration-this._audioTimer.currentTime))},e._stopSourceNode=function(){try{this._sourceNode&&(this._sourceNode.stop(),this._sourceNode.disconnect(),this._sourceNode.buffer=null,this._sourceNode=void 0)}catch(t){}},e.pause=function(){return this.offRunning(),this._state===tet.PLAYING&&this._sourceNode?(this._audioTimer.pause(),this._state=tet.PAUSED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):Promise.resolve()},e.stop=function(){return this.offRunning(),this._sourceNode?(this._audioTimer.stop(),this._state=tet.STOPPED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):(this._audioTimer.stop(),this._state=tet.STOPPED,Promise.resolve())},e.onInterruptionBegin=function(t){this._eventTarget.on(Ztt.INTERRUPTION_BEGIN,t)},e.offInterruptionBegin=function(t){this._eventTarget.off(Ztt.INTERRUPTION_BEGIN,t)},e.onInterruptionEnd=function(t){this._eventTarget.on(Ztt.INTERRUPTION_END,t)},e.offInterruptionEnd=function(t){this._eventTarget.off(Ztt.INTERRUPTION_END,t)},e.onEnded=function(t){this._eventTarget.on(Ztt.ENDED,t)},e.offEnded=function(t){this._eventTarget.off(Ztt.ENDED,t)},n(t,[{key:"sampleRate",get:function(){return this._audioBuffer.sampleRate}},{key:"src",get:function(){return this._src}},{key:"type",get:function(){return $tt.WEB_AUDIO}},{key:"state",get:function(){return this._state}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t,this._sourceNode&&(this._sourceNode.loop=t)}},{key:"volume",get:function(){return this._volume},set:function(t){t=tn(t),this._volume=t,det.setGainValue(this._gainNode,t)}},{key:"duration",get:function(){return this._audioBuffer.duration}},{key:"currentTime",get:function(){return this._audioTimer.currentTime}}]),t}(),y(fet.prototype,"seek",[uet],Object.getOwnPropertyDescriptor(fet.prototype,"seek"),fet.prototype),y(fet.prototype,"play",[uet],Object.getOwnPropertyDescriptor(fet.prototype,"play"),fet.prototype),y(fet.prototype,"pause",[uet],Object.getOwnPropertyDescriptor(fet.prototype,"pause"),fet.prototype),y(fet.prototype,"stop",[uet],Object.getOwnPropertyDescriptor(fet.prototype,"stop"),fet.prototype),fet),Bet=function(){function t(t){this._audio=void 0,this._audio=t}var e=t.prototype;return e.play=function(){this._audio.play()},e.stop=function(){this._audio.stop()},n(t,[{key:"onPlay",get:function(){return this._audio.onPlay},set:function(t){this._audio.onPlay=t}},{key:"onEnd",get:function(){return this._audio.onEnd},set:function(t){this._audio.onEnd=t}}]),t}(),Met=function(){function t(t){this._player=void 0,this._player=t}t.load=function(e,i){return new Promise((function(n,r){(null==i?void 0:i.audioLoadMode)!==$tt.DOM_AUDIO&&xet.support?Iet.load(e).then((function(e){n(new t(e))})).catch(r):(xet.support||at(5201),pet.load(e).then((function(e){n(new t(e))})).catch(r))}))};var e=t.prototype;return e.destroy=function(){this._player.destroy()},t.loadNative=function(t,e){return(null==e?void 0:e.audioLoadMode)!==$tt.DOM_AUDIO&&xet.support?Iet.loadNative(t):(xet.support||at(5201),pet.loadNative(t))},t.loadOneShotAudio=function(t,e,i){return new Promise((function(n,r){(null==i?void 0:i.audioLoadMode)!==$tt.DOM_AUDIO&&xet.support?Iet.loadOneShotAudio(t,e).then((function(t){n(new Bet(t))})).catch(r):(xet.support||at(5201),pet.loadOneShotAudio(t,e).then((function(t){n(new Bet(t))})).catch(r))}))},e.getPCMData=function(t){return this._player.getPCMData(t)},e.seek=function(t){return this._player.seek(t)},e.play=function(){return this._player.play()},e.pause=function(){return this._player.pause()},e.stop=function(){return this._player.stop()},e.onInterruptionBegin=function(t){this._player.onInterruptionBegin(t)},e.offInterruptionBegin=function(t){this._player.offInterruptionBegin(t)},e.onInterruptionEnd=function(t){this._player.onInterruptionEnd(t)},e.offInterruptionEnd=function(t){this._player.offInterruptionEnd(t)},e.onEnded=function(t){this._player.onEnded(t)},e.offEnded=function(t){this._player.offEnded(t)},n(t,[{key:"src",get:function(){return this._player.src}},{key:"type",get:function(){return this._player.type}},{key:"state",get:function(){return this._player.state}},{key:"loop",get:function(){return this._player.loop},set:function(t){this._player.loop=t}},{key:"volume",get:function(){return this._player.volume},set:function(t){this._player.volume=t}},{key:"duration",get:function(){return this._player.duration}},{key:"currentTime",get:function(){return this._player.currentTime}},{key:"sampleRate",get:function(){return this._player.sampleRate}}]),t}();Met.maxAudioChannel=24;var Pet=t("aF",Qh("cc.AudioClip")((Aet=function(t){function e(e){var i;return(i=t.call(this,e)||this)._duration=Cet&&Cet(),i._loadMode=$tt.UNKNOWN_AUDIO,i._meta=null,i._player=null,i}s(e,t);var i=e.prototype;return i.destroy=function(){var e,i=t.prototype.destroy.call(this);return null==(e=this._player)||e.destroy(),this._player=null,this._meta&&(this._meta.player=null),i},i.validate=function(){return!!this._meta},i.getDuration=function(){return this._duration?this._duration:this._meta?this._meta.duration:0},i.getCurrentTime=function(){return this._player?this._player.currentTime:0},i.getVolume=function(){return this._player?this._player.volume:0},i.getLoop=function(){return!!this._player&&this._player.loop},i.setCurrentTime=function(t){var e;null==(e=this._player)||e.seek(t).catch((function(){}))},i.setVolume=function(t){this._player&&(this._player.volume=t)},i.setLoop=function(t){this._player&&(this._player.loop=t)},i.play=function(){var t;null==(t=this._player)||t.play().catch((function(){}))},i.pause=function(){var t;null==(t=this._player)||t.pause().catch((function(){}))},i.stop=function(){var t;null==(t=this._player)||t.stop().catch((function(){}))},i.playOneShot=function(t){void 0===t&&(t=1),this._nativeAsset&&Met.loadOneShotAudio(this._nativeAsset.url,t).then((function(t){t.play()})).catch((function(){}))},n(e,[{key:"duration",set:function(t){this._duration=t}},{key:"_nativeAsset",get:function(){return this._meta},set:function(t){this._meta=t,t?(this._loadMode=t.type,this._player=t.player):(this._meta=null,this._loadMode=$tt.UNKNOWN_AUDIO,this._duration=0)}},{key:"_nativeDep",get:function(){return{uuid:this._uuid,audioLoadMode:this.loadMode,ext:this._native,__isNative__:!0}}},{key:"loadMode",get:function(){return this._loadMode}},{key:"state",get:function(){return this._player?this._player.state:tet.INIT}}]),e}(Cm),Aet.AudioType=$tt,Cet=Nh((Tet=Aet).prototype,"_duration",[hu],(function(){return 0})),y(Tet.prototype,"_nativeDep",[Uu],Object.getOwnPropertyDescriptor(Tet.prototype,"_nativeDep"),Tet.prototype),wet=Tet))||wet);function Eet(t,e,i){Met.load(t,{audioLoadMode:e.audioLoadMode}).then((function(e){var n={player:e,url:t,duration:e.duration,type:e.type};i(null,n)})).catch((function(t){i(t)}))}function ket(t,e,i,n){var r=new Pet;r._nativeUrl=t,r._nativeAsset=e,r.duration=e.duration,n(null,r)}C.AudioClip=Pet,Iw.register({".mp3":Eet,".ogg":Eet,".wav":Eet,".m4a":Eet}),Uw.register({".mp3":ket,".ogg":ket,".wav":ket,".m4a":ket});var Ret,Oet,Fet,Let,Vet,Net,zet,Uet,Get,Het,Wet=new(function(){function t(){this._oneShotAudioInfoList=[],this._audioPlayerInfoList=[]}var e=t.prototype;return e._findIndex=function(t,e){return t.findIndex((function(t){return t.audio===e}))},e._tryAddPlaying=function(t,e){var i=this._findIndex(t,e);if(i>-1)return t[i].playTime=performance.now(),!1;var n={audio:e,playTime:performance.now()};return t.push(n),!0},e.addPlaying=function(t){t instanceof Met?this._tryAddPlaying(this._audioPlayerInfoList,t):this._tryAddPlaying(this._oneShotAudioInfoList,t)},e._tryRemovePlaying=function(t,e){var i=this._findIndex(t,e);return-1!==i&&(be(t,i),!0)},e.removePlaying=function(t){t instanceof Met?this._tryRemovePlaying(this._audioPlayerInfoList,t):this._tryRemovePlaying(this._oneShotAudioInfoList,t)},e.discardOnePlayingIfNeeded=function(){var t;this._audioPlayerInfoList.length+this._oneShotAudioInfoList.length0?this._oneShotAudioInfoList.forEach((function(e){(!t||e.playTime0;)n+="/",n+=i[r];return n}function _it(t,e,i){var n=t.N,r=i.split("/");if(0===r.length)return e;var s=e,a=0;""===r[0]&&(s=n,++a);for(var o=a;o!==r.length;++o){var h=r[o];if(""!==h&&"."!==h)if(".."!==h){if((s=t.locateChild(s,h))===n)return n}else{if(s===n)return n;s=t.getParent(s)}}return s}var pit=function(){function t(){}return t.prototype.terminate=function(){return!1},t}();function mit(t){var e=t.v().next();return e.done?t.N:e.value}var git=function(t,e,i){this.v=void 0,this.e=void 0,this.iter=void 0,this.v=t,this.e=e,this.iter=i};function vit(t,e,i,n,r){var s=null,a=null,o=new Array;for(n.put(e,1),i.discoverVertex(e,t),a=t.oe(e),r.terminate(e,t)?o.push(new git(e,null,null)):o.push(new git(e,null,a));o.length;){var h=o.pop();if(e=h.v,s=h.e,a=h.iter,null!==s&&i.finishEdge(s,t),a)for(var u=a.next();!u.done;u=a.next()){var l=u.value,c=l.target;i.examineEdge(l,t);var f=n.get(c);if(0===f){if(i.treeEdge(l,t),s=l,o.push(new git(e,s,a)),e=c,n.put(e,1),i.discoverVertex(e,t),a=t.oe(e),r.terminate(e,t))break}else 1===f?i.backEdge(l,t):i.forwardOrCrossEdge(l,t),i.finishEdge(l,t)}n.put(e,4),i.finishVertex(e,t)}}function yit(t,e,i,n){if(void 0===n&&(n=null),null!==(n=n||mit(t))&&0!==t.nv()){for(var r,s=p(t.v());!(r=s()).done;){var a=r.value;i.put(a,0),e.initializeVertex(a,t)}var o=new pit;n!==mit(t)&&(e.startVertex(n,t),vit(t,n,e,i,o));for(var h,u=p(t.v());!(h=u()).done;){var l=h.value;0===i.get(l)&&(e.startVertex(l,t),vit(t,l,e,i,o))}}}var bit=function(){function t(){}var e=t.prototype;return e.initializeVertex=function(){},e.startVertex=function(){},e.discoverVertex=function(){},e.examineEdge=function(){},e.treeEdge=function(){},e.backEdge=function(){},e.forwardOrCrossEdge=function(){},e.finishEdge=function(){},e.finishVertex=function(){},t}(),Sit=function(){function t(t){this.g=void 0,this.g=t,this.N=t.N}var e=t.prototype;return e.edge=function(t,e){return this.g.reference(t,e)},e.source=function(t){return this.g.parent(t)},e.target=function(t){return this.g.child(t)},e.oe=function(t){return this.g.children(t)},e.od=function(t){return this.g.numChildren(t)},e.v=function(){return this.g.v()},e.nv=function(){return this.g.nv()},t}();function xit(t){t.x=0,t.y=0,t.z=0,t.w=0}function wit(t){t.left=0,t.top=0,t.width=0,t.height=0,t.minDepth=0,t.maxDepth=1}var Tit=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.z=i,this.w=n}return t.prototype.reset=function(t,e,i,n){this.x=t,this.y=e,this.z=i,this.w=n},t}(),Cit=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=""),void 0===e&&(e=2),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=7),void 0===a&&(a=new n_),void 0===o&&(o=0),this.slotName1="",this.slotID=0,this.slotName=t,this.accessType=e,this.attachmentType=i,this.loadOp=n,this.storeOp=r,this.clearFlags=s,this.clearColor=a,this.shaderStageFlags=o}return t.prototype.reset=function(t,e,i,n,r,s,a){this.slotName=t,this.slotName1="",this.accessType=e,this.attachmentType=i,this.loadOp=n,this.storeOp=r,this.clearFlags=s,xit(this.clearColor),this.slotID=0,this.shaderStageFlags=a},t}(),Ait=function(){function t(t,e,i,n,r,s){void 0===t&&(t=""),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=new Tit),void 0===s&&(s=0),this.plane=0,this.name=t,this.accessType=e,this.clearFlags=i,this.clearValueType=n,this.clearValue=r,this.shaderStageFlags=s}return t.prototype.reset=function(t,e,i,n,r){this.name=t,this.accessType=e,this.plane=0,this.clearFlags=i,this.clearValueType=n,this.clearValue.reset(0,0,0,0),this.shaderStageFlags=r},t}(),Dit=function(){function t(){this.dimension=0,this.alignment=0,this.width=0,this.height=0,this.depthOrArraySize=0,this.mipLevels=0,this.format=0,this.sampleCount=1,this.textureFlags=0,this.flags=0,this.viewType=1}return t.prototype.reset=function(){this.dimension=0,this.alignment=0,this.width=0,this.height=0,this.depthOrArraySize=0,this.mipLevels=0,this.format=0,this.sampleCount=1,this.textureFlags=0,this.flags=0,this.viewType=1},t}(),Iit=function(){function t(t){void 0===t&&(t=0),this.residency=t}return t.prototype.reset=function(t){this.residency=t},t}(),Bit=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=!1),this.renderWindow=null,this.currentID=0,this.numBackBuffers=0,this.generation=4294967295,this.swapchain=t,this.isDepthStencil=e}return t.prototype.reset=function(t,e){this.swapchain=t,this.renderWindow=null,this.currentID=0,this.numBackBuffers=0,this.generation=4294967295,this.isDepthStencil=e},t}(),Mit=function(){function t(){this.states=0}return t.prototype.reset=function(){this.states=0},t}(),Pit=function(){function t(t){void 0===t&&(t=null),this.fenceValue=0,this.buffer=t}return t.prototype.reset=function(t){this.buffer=t,this.fenceValue=0},t}(),Eit=function(){function t(t){void 0===t&&(t=null),this.fenceValue=0,this.buffer=t}return t.prototype.reset=function(t){this.buffer=t,this.fenceValue=0},t}(),kit=function(){function t(t){void 0===t&&(t=null),this.fenceValue=0,this.texture=t}return t.prototype.reset=function(t){this.texture=t,this.fenceValue=0},t}(),Rit=function(){function t(t){void 0===t&&(t=null),this.fenceValue=0,this.texture=t}return t.prototype.reset=function(t){this.texture=t,this.fenceValue=0},t}(),Oit=function(){function t(){this.unused=0}return t.prototype.reset=function(){this.unused=0},t}(),Fit=function(){function t(){this.rasterViews=new Map,this.computeViews=new Map,this.resolvePairs=[]}return t.prototype.reset=function(){this.rasterViews.clear(),this.computeViews.clear(),this.resolvePairs.length=0},t}(),Lit=function(){this.o=[],this.i=[]},Vit=function(){function t(){this.N=4294967295,this.x=[],this._names=[],this._subpasses=[]}var e=t.prototype;return e.edge=function(t,e){for(var i,n=p(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.source=function(t){return t.source},e.target=function(t){return t.target},e.oe=function(t){return new lit(this.x[t].o.values(),t)},e.od=function(t){return this.x[t].o.length},e.ie=function(t){return new cit(this.x[t].i.values(),t)},e.id=function(t){return this.x[t].i.length},e.d=function(t){return this.od(t)+this.id(t)},e.adj=function(t){return new fit(this,this.oe(t))},e.v=function(){return this.x.keys()},e.nv=function(){return this.x.length},e.ne=function(){for(var t,e=0,i=p(this.v());!(t=i()).done;){var n=t.value;e+=this.od(n)}return e},e.clear=function(){this._names.length=0,this._subpasses.length=0,this.x.length=0},e.addVertex=function(t,e){var i=new Lit,n=this.x.length;return this.x.push(i),this._names.push(t),this._subpasses.push(e),n},e.addEdge=function(t,e){return this.x[t].o.push(new uit(e)),this.x[e].i.push(new uit(t)),new hit(t,e)},e.vertexName=function(t){return this._names[t]},e.getName=function(t){return this._names[t]},e.setName=function(t,e){this._names[t]=e},e.getSubpass=function(t){return this._subpasses[t]},t}(),Nit=function(){function t(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=1),void 0===i&&(i=0),this.rasterViews=new Map,this.computeViews=new Map,this.resolvePairs=[],this.viewport=new i_,this.showStatistics=!1,this.subpassID=t,this.count=e,this.quality=i}return t.prototype.reset=function(t,e,i){this.rasterViews.clear(),this.computeViews.clear(),this.resolvePairs.length=0,wit(this.viewport),this.subpassID=t,this.count=e,this.quality=i,this.showStatistics=!1},t}(),zit=function(){function t(t){void 0===t&&(t=4294967295),this.rasterViews=new Map,this.computeViews=new Map,this.subpassID=t}return t.prototype.reset=function(t){this.rasterViews.clear(),this.computeViews.clear(),this.subpassID=t},t}(),Uit=function(){function t(){this.rasterViews=new Map,this.computeViews=new Map,this.attachmentIndexMap=new Map,this.textures=new Map,this.subpassGraph=new Vit,this.width=0,this.height=0,this.count=1,this.quality=0,this.viewport=new i_,this.versionName="",this.version=0,this.hashValue=0,this.showStatistics=!1}return t.prototype.reset=function(){this.rasterViews.clear(),this.computeViews.clear(),this.attachmentIndexMap.clear(),this.textures.clear(),this.subpassGraph.clear(),this.width=0,this.height=0,this.count=1,this.quality=0,wit(this.viewport),this.versionName="",this.version=0,this.hashValue=0,this.showStatistics=!1},t}(),Git=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.clearColors=[],this.clearDepth=0,this.clearStencil=0,this.renderPass=t,this.framebuffer=e}return t.prototype.reset=function(t,e){this.renderPass=t,this.framebuffer=e,this.clearColors.length=0,this.clearDepth=0,this.clearStencil=0},t}(),Hit=function(){function t(){this.format=0}return t.prototype.reset=function(){this.format=0},t}(),Wit=function(){function t(){this.textureView=null,this.format=0,this.indexOrFirstMipLevel=0,this.numMipLevels=0,this.firstArraySlice=0,this.numArraySlices=0,this.firstPlane=0,this.numPlanes=0}return t.prototype.reset=function(){this.textureView=null,this.format=0,this.indexOrFirstMipLevel=0,this.numMipLevels=0,this.firstArraySlice=0,this.numArraySlices=0,this.firstPlane=0,this.numPlanes=0},t}(),jit=function(t,e){this.o=[],this.i=[],this.t=void 0,this.j=void 0,this.id=t,this.object=e,this.t=t,this.j=e},qit=function(){function t(){this.N=4294967295,this.x=[],this._names=[],this._descs=[],this._traits=[],this._states=[],this._samplerInfo=[],this._valueIndex=new Map,this.renderPasses=new Map,this.nextFenceValue=0,this.version=0}var e=t.prototype;return e.edge=function(t,e){for(var i,n=p(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.source=function(t){return t.source},e.target=function(t){return t.target},e.oe=function(t){return new lit(this.x[t].o.values(),t)},e.od=function(t){return this.x[t].o.length},e.ie=function(t){return new cit(this.x[t].i.values(),t)},e.id=function(t){return this.x[t].i.length},e.d=function(t){return this.od(t)+this.id(t)},e.adj=function(t){return new fit(this,this.oe(t))},e.v=function(){return this.x.keys()},e.nv=function(){return this.x.length},e.ne=function(){for(var t,e=0,i=p(this.v());!(t=i()).done;){var n=t.value;e+=this.od(n)}return e},e.clear=function(){this.renderPasses.clear(),this.nextFenceValue=0,this.version=0,this._valueIndex.clear(),this._names.length=0,this._descs.length=0,this._traits.length=0,this._states.length=0,this._samplerInfo.length=0,this.x.length=0},e.addVertex=function(t,e,i,n,r,s,a,o){void 0===o&&(o=4294967295);var h=new jit(t,e),u=this.x.length;return this.x.push(h),this._names.push(i),this._descs.push(n),this._traits.push(r),this._states.push(s),this._samplerInfo.push(a),this._valueIndex.set(i,u),4294967295!==o&&this.addEdge(o,u),u},e.addEdge=function(t,e){return this.x[t].o.push(new uit(e)),this.x[e].i.push(new uit(t)),new hit(t,e)},e.vertexName=function(t){return this._names[t]},e.getName=function(t){return this._names[t]},e.setName=function(t,e){this._names[t]=e},e.getDesc=function(t){return this._descs[t]},e.getTraits=function(t){return this._traits[t]},e.getStates=function(t){return this._states[t]},e.getSampler=function(t){return this._samplerInfo[t]},e.h=function(t,e){return this.x[e].t===t},e.w=function(t){return this.x[t].t},e.object=function(t){return this.x[t].j},e.value=function(t,e){if(this.x[e].t===t)return this.x[e].j;throw Error("value id not match")},e.visitVertex=function(t,e){var i=this.x[e];switch(i.t){case 0:return t.managed(i.j);case 1:return t.managedBuffer(i.j);case 2:return t.managedTexture(i.j);case 3:return t.persistentBuffer(i.j);case 4:return t.persistentTexture(i.j);case 5:return t.framebuffer(i.j);case 6:return t.swapchain(i.j);case 7:return t.formatView(i.j);case 8:return t.subresourceView(i.j);default:throw Error("polymorphic type not found")}},e.j=function(t){return this.x[t].j},e.reference=function(t,e){for(var i,n=p(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.parent=function(t){return t.source},e.child=function(t){return t.target},e.children=function(t){return new lit(this.x[t].o.values(),t)},e.numChildren=function(t){return this.x[t].o.length},e.getParent=function(t){if(4294967295===t)return 4294967295;var e=this.x[t].i;return 0===e.length?4294967295:e[0].target},e.addReference=function(t,e){return this.addEdge(t,e)},e.contains=function(t){return this._valueIndex.has(t)},e.vertex=function(t){return this._valueIndex.get(t)},e.find=function(t){var e=this._valueIndex.get(t);return void 0===e?4294967295:e},t}(),Xit=function(){function t(){this.computeViews=new Map,this.textures=new Map}return t.prototype.reset=function(){this.computeViews.clear(),this.textures.clear()},t}(),Yit=function(){function t(){this.resolvePairs=[]}return t.prototype.reset=function(){this.resolvePairs.length=0},t}(),Qit=function(){function t(){this.copyPairs=[],this.uploadPairs=[]}return t.prototype.reset=function(){this.copyPairs.length=0,this.uploadPairs.length=0},t}(),Jit=function(){function t(){this.movePairs=[]}return t.prototype.reset=function(){this.movePairs.length=0},t}(),Kit=function(){function t(){this.computeViews=new Map}return t.prototype.reset=function(){this.computeViews.clear()},t}(),Zit=function(){function t(t,e,i){void 0===t&&(t=""),void 0===e&&(e=7),void 0===i&&(i=new n_),this.slotName=t,this.clearFlags=e,this.clearColor=i}return t.prototype.reset=function(t,e){this.slotName=t,this.clearFlags=e,xit(this.clearColor)},t}(),$it=function(){function t(t,e,i){void 0===t&&(t=1),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295),this.viewport=null,this.hint=t,this.phaseID=e,this.passLayoutID=i}return t.prototype.reset=function(t,e,i){this.hint=t,this.phaseID=e,this.passLayoutID=i,this.viewport=null},t}(),tnt=function(){function t(t,e,i,n,r,s){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=0),void 0===n&&(n=new Ket),void 0===r&&(r=1),void 0===s&&(s=null),this.scene=t,this.camera=e,this.light=n,this.flags=i,this.cullingFlags=r,this.shadingLight=s}return t.prototype.reset=function(t,e,i,n,r){this.scene=t,this.camera=e,this.light.reset(null,0,!1,null),this.flags=i,this.cullingFlags=n,this.shadingLight=r},t}(),ent=function(){function t(t,e,i,n,r){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),this.material=t,this.passID=e,this.threadGroupCountX=i,this.threadGroupCountY=n,this.threadGroupCountZ=r}return t.prototype.reset=function(t,e,i,n,r){this.material=t,this.passID=e,this.threadGroupCountX=i,this.threadGroupCountY=n,this.threadGroupCountZ=r},t}(),int=function(){function t(t,e,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=null),this.material=t,this.passID=e,this.sceneFlags=i,this.camera=n}return t.prototype.reset=function(t,e,i,n){this.material=t,this.passID=e,this.sceneFlags=i,this.camera=n},t}(),nnt=function(){function t(){this.constants=new Map,this.buffers=new Map,this.textures=new Map,this.samplers=new Map,this.custom=""}return t.prototype.reset=function(){this.constants.clear(),this.buffers.clear(),this.textures.clear(),this.samplers.clear(),this.custom=""},t}(),rnt=function(t,e){this.o=[],this.i=[],this.c=[],this.p=[],this.t=void 0,this.j=void 0,this.id=t,this.object=e,this.t=t,this.j=e},snt=function(){function t(){this.N=4294967295,this.x=[],this._names=[],this._layoutNodes=[],this._data=[],this._valid=[],this.index=new Map,this.sortedVertices=[]}var e=t.prototype;return e.edge=function(t,e){for(var i,n=p(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.source=function(t){return t.source},e.target=function(t){return t.target},e.oe=function(t){return new lit(this.x[t].o.values(),t)},e.od=function(t){return this.x[t].o.length},e.ie=function(t){return new cit(this.x[t].i.values(),t)},e.id=function(t){return this.x[t].i.length},e.d=function(t){return this.od(t)+this.id(t)},e.adj=function(t){return new fit(this,this.oe(t))},e.v=function(){return this.x.keys()},e.nv=function(){return this.x.length},e.ne=function(){for(var t,e=0,i=p(this.v());!(t=i()).done;){var n=t.value;e+=this.od(n)}return e},e.clear=function(){this.index.clear(),this.sortedVertices.length=0,this._names.length=0,this._layoutNodes.length=0,this._data.length=0,this._valid.length=0,this.x.length=0},e.addVertex=function(t,e,i,n,r,s,a){void 0===a&&(a=4294967295);var o=new rnt(t,e),h=this.x.length;return this.x.push(o),this._names.push(i),this._layoutNodes.push(n),this._data.push(r),this._valid.push(s),4294967295!==a&&(this.x[a].c.push(new uit(h)),o.p.push(new uit(a))),h},e.addEdge=function(t,e){return this.x[t].o.push(new uit(e)),this.x[e].i.push(new uit(t)),new hit(t,e)},e.vertexName=function(t){return this._names[t]},e.getName=function(t){return this._names[t]},e.setName=function(t,e){this._names[t]=e},e.getLayout=function(t){return this._layoutNodes[t]},e.setLayout=function(t,e){this._layoutNodes[t]=e},e.getData=function(t){return this._data[t]},e.getValid=function(t){return this._valid[t]},e.setValid=function(t,e){this._valid[t]=e},e.h=function(t,e){return this.x[e].t===t},e.w=function(t){return this.x[t].t},e.object=function(t){return this.x[t].j},e.value=function(t,e){if(this.x[e].t===t)return this.x[e].j;throw Error("value id not match")},e.visitVertex=function(t,e){var i=this.x[e];switch(i.t){case 0:return t.rasterPass(i.j);case 1:return t.rasterSubpass(i.j);case 2:return t.computeSubpass(i.j);case 3:return t.compute(i.j);case 4:return t.resolve(i.j);case 5:return t.copy(i.j);case 6:return t.move(i.j);case 7:return t.raytrace(i.j);case 8:return t.queue(i.j);case 9:return t.scene(i.j);case 10:return t.blit(i.j);case 11:return t.dispatch(i.j);case 12:return t.clear(i.j);case 13:return t.viewport(i.j);default:throw Error("polymorphic type not found")}},e.j=function(t){return this.x[t].j},e.reference=function(t,e){for(var i,n=p(this.x[t].c);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.parent=function(t){return t.source},e.child=function(t){return t.target},e.children=function(t){return new lit(this.x[t].c.values(),t)},e.numChildren=function(t){return this.x[t].c.length},e.getParent=function(t){if(4294967295===t)return 4294967295;var e=this.x[t].p;return 0===e.length?4294967295:e[0].target},e.addReference=function(t,e){return this.x[t].c.push(new uit(e)),this.x[e].p.push(new uit(t)),new hit(t,e)},t}();function ant(t){return new ho((function(){return new t}),16)}var ont=function(){function t(t){this.renderCommon=void 0,this.cv=ant(Tit),this.rv=ant(Cit),this.cv1=ant(Ait),this.rd=ant(Dit),this.rt=ant(Iit),this.rs=ant(Bit),this.rs1=ant(Mit),this.mb=ant(Pit),this.pb=ant(Eit),this.mt=ant(kit),this.pt=ant(Rit),this.mr=ant(Oit),this.s=ant(Fit),this.sg=ant(Vit),this.rs2=ant(Nit),this.cs=ant(zit),this.rp=ant(Uit),this.prpaf=ant(Git),this.fv=ant(Hit),this.sv=ant(Wit),this.rg=ant(qit),this.cp=ant(Xit),this.rp1=ant(Yit),this.cp1=ant(Qit),this.mp=ant(Jit),this.rp2=ant(Kit),this.cv2=ant(Zit),this.rq=ant($it),this.sd=ant(tnt),this.d=ant(ent),this.b=ant(int),this.rd1=ant(nnt),this.rg1=ant(snt),this.renderCommon=t}var e=t.prototype;return e.reset=function(){this.cv.reset(),this.rv.reset(),this.cv1.reset(),this.rd.reset(),this.rt.reset(),this.rs.reset(),this.rs1.reset(),this.mb.reset(),this.pb.reset(),this.mt.reset(),this.pt.reset(),this.mr.reset(),this.s.reset(),this.sg.reset(),this.rs2.reset(),this.cs.reset(),this.rp.reset(),this.prpaf.reset(),this.fv.reset(),this.sv.reset(),this.rg.reset(),this.cp.reset(),this.rp1.reset(),this.cp1.reset(),this.mp.reset(),this.rp2.reset(),this.cv2.reset(),this.rq.reset(),this.sd.reset(),this.d.reset(),this.b.reset(),this.rd1.reset(),this.rg1.reset()},e.createClearValue=function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0);var r=this.cv.add();return r.reset(t,e,i,n),r},e.createRasterView=function(t,e,i,n,r,s,a){void 0===t&&(t=""),void 0===e&&(e=2),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=7),void 0===a&&(a=0);var o=this.rv.add();return o.reset(t,e,i,n,r,s,a),o},e.createComputeView=function(t,e,i,n,r){void 0===t&&(t=""),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0);var s=this.cv1.add();return s.reset(t,e,i,n,r),s},e.createResourceDesc=function(){var t=this.rd.add();return t.reset(),t},e.createResourceTraits=function(t){void 0===t&&(t=0);var e=this.rt.add();return e.reset(t),e},e.createRenderSwapchain=function(t,e){void 0===t&&(t=null),void 0===e&&(e=!1);var i=this.rs.add();return i.reset(t,e),i},e.createResourceStates=function(){var t=this.rs1.add();return t.reset(),t},e.createManagedBuffer=function(t){void 0===t&&(t=null);var e=this.mb.add();return e.reset(t),e},e.createPersistentBuffer=function(t){void 0===t&&(t=null);var e=this.pb.add();return e.reset(t),e},e.createManagedTexture=function(t){void 0===t&&(t=null);var e=this.mt.add();return e.reset(t),e},e.createPersistentTexture=function(t){void 0===t&&(t=null);var e=this.pt.add();return e.reset(t),e},e.createManagedResource=function(){var t=this.mr.add();return t.reset(),t},e.createSubpass=function(){var t=this.s.add();return t.reset(),t},e.createSubpassGraph=function(){var t=this.sg.add();return t.clear(),t},e.createRasterSubpass=function(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=1),void 0===i&&(i=0);var n=this.rs2.add();return n.reset(t,e,i),n},e.createComputeSubpass=function(t){void 0===t&&(t=4294967295);var e=this.cs.add();return e.reset(t),e},e.createRasterPass=function(){var t=this.rp.add();return t.reset(),t},e.createPersistentRenderPassAndFramebuffer=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null);var i=this.prpaf.add();return i.reset(t,e),i},e.createFormatView=function(){var t=this.fv.add();return t.reset(),t},e.createSubresourceView=function(){var t=this.sv.add();return t.reset(),t},e.createResourceGraph=function(){var t=this.rg.add();return t.clear(),t},e.createComputePass=function(){var t=this.cp.add();return t.reset(),t},e.createResolvePass=function(){var t=this.rp1.add();return t.reset(),t},e.createCopyPass=function(){var t=this.cp1.add();return t.reset(),t},e.createMovePass=function(){var t=this.mp.add();return t.reset(),t},e.createRaytracePass=function(){var t=this.rp2.add();return t.reset(),t},e.createClearView=function(t,e){void 0===t&&(t=""),void 0===e&&(e=7);var i=this.cv2.add();return i.reset(t,e),i},e.createRenderQueue=function(t,e,i){void 0===t&&(t=1),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295);var n=this.rq.add();return n.reset(t,e,i),n},e.createSceneData=function(t,e,i,n,r){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=null);var s=this.sd.add();return s.reset(t,e,i,n,r),s},e.createDispatch=function(t,e,i,n,r){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0);var s=this.d.add();return s.reset(t,e,i,n,r),s},e.createBlit=function(t,e,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=null);var r=this.b.add();return r.reset(t,e,i,n),r},e.createRenderData=function(){var t=this.rd1.add();return t.reset(),t},e.createRenderGraph=function(){var t=this.rg1.add();return t.clear(),t},t}(),hnt=function(){this.subpass=0};function unt(t,e){e.name=t.s(),e.type=t.n(),e.count=t.n()}function lnt(t,e){var i;e.set=t.n(),e.binding=t.n(),e.name=t.s(),i=t.n(),e.members.length=i;for(var n=0;n!==i;++n){var r=new m_;unt(t,r),e.members[n]=r}e.count=t.n()}function cnt(t,e){e.binding=t.n(),e.descriptorType=t.n(),e.count=t.n(),e.stageFlags=t.n()}function fnt(t,e){var i=t.n();e.bindings.length=i;for(var n=0;n!==i;++n){var r=new V_;cnt(t,r),e.bindings[n]=r}}var dnt=function(){};dnt.type=0,dnt.isWebGPU=!1;var _nt=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=1),this.descriptorID=t,this.type=e,this.count=i}return t.prototype.reset=function(t,e,i){this.descriptorID=t,this.type=e,this.count=i},t}(),pnt=function(){function t(t,e,i,n,r,s,a){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),this.offset=0,this.descriptors=[],this.type=t,this.visibility=e,this.capacity=i,this.accessType=n,this.viewDimension=r,this.sampleType=s,this.format=a}return t.prototype.reset=function(t,e,i,n,r,s,a){this.type=t,this.visibility=e,this.offset=0,this.capacity=i,this.accessType=n,this.viewDimension=r,this.sampleType=s,this.format=a,this.descriptors.length=0},t}(),mnt=function(){function t(t,e,i,n,r){void 0===t&&(t=4294967295),void 0===e&&(e=0),void 0===i&&(i=[]),void 0===n&&(n=new Map),void 0===r&&(r=new Map),this.uniformBlockCapacity=0,this.samplerTextureCapacity=0,this.slot=t,this.capacity=e,this.descriptorBlocks=i,this.uniformBlocks=n,this.bindingMap=r}return t.prototype.reset=function(t,e){this.slot=t,this.capacity=e,this.uniformBlockCapacity=0,this.samplerTextureCapacity=0,this.descriptorBlocks.length=0,this.uniformBlocks.clear(),this.bindingMap.clear()},t}(),gnt=function(){function t(t,e,i){void 0===t&&(t=new mnt),void 0===e&&(e=null),void 0===i&&(i=null),this.descriptorSetLayoutInfo=new N_,this.descriptorSetLayoutData=t,this.descriptorSetLayout=e,this.descriptorSet=i}return t.prototype.reset=function(t,e){this.descriptorSetLayoutData.reset(4294967295,0),this.descriptorSetLayoutInfo.bindings.length=0,this.descriptorSetLayout=t,this.descriptorSet=e},t}(),vnt=function(){function t(){this.descriptorSets=new Map,this.descriptorGroups=new Map}var e=t.prototype;return e.reset=function(){this.descriptorSets.clear(),this.descriptorGroups.clear()},e.getSets=function(){return dnt.isWebGPU?this.descriptorGroups:this.descriptorSets},e.getSet=function(t){return dnt.isWebGPU?this.descriptorGroups.get(t):this.descriptorSets.get(t)},t}(),ynt=function(){function t(){this.descriptorBindings=new Map}return t.prototype.reset=function(){this.descriptorBindings.clear()},t}(),bnt=function(){function t(){this.layoutData=new Map,this.bindingData=new Map}return t.prototype.reset=function(){this.layoutData.clear(),this.bindingData.clear()},t}(),Snt=function(){function t(){this.passes=[]}return t.prototype.reset=function(){this.passes.length=0},t}(),xnt=function(){function t(){this.techniques=new Map}return t.prototype.reset=function(){this.techniques.clear()},t}(),wnt=function(){function t(){this.layout=new vnt,this.pipelineLayout=null}return t.prototype.reset=function(){this.layout.reset(),this.pipelineLayout=null},t}(),Tnt=function(){function t(){this.descriptorVisibility=new Map}return t.prototype.reset=function(){this.descriptorVisibility.clear()},t}(),Cnt=function(){function t(){this.rootSignature="",this.shaderPrograms=[],this.shaderIndex=new Map,this.pipelineLayout=null}return t.prototype.reset=function(){this.rootSignature="",this.shaderPrograms.length=0,this.shaderIndex.clear(),this.pipelineLayout=null},t}(),Ant=function(t,e){this.o=[],this.i=[],this.t=void 0,this.j=void 0,this.id=t,this.object=e,this.t=t,this.j=e},Dnt=function(){function t(){this.N=4294967295,this.x=[],this._names=[],this._updateFrequencies=[],this._layouts=[],this.valueNames=[],this.attributeIndex=new Map,this.constantIndex=new Map,this.shaderLayoutIndex=new Map,this.effects=new Map,this.constantMacros=""}var e=t.prototype;return e.edge=function(t,e){for(var i,n=p(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.source=function(t){return t.source},e.target=function(t){return t.target},e.oe=function(t){return new lit(this.x[t].o.values(),t)},e.od=function(t){return this.x[t].o.length},e.ie=function(t){return new cit(this.x[t].i.values(),t)},e.id=function(t){return this.x[t].i.length},e.d=function(t){return this.od(t)+this.id(t)},e.adj=function(t){return new fit(this,this.oe(t))},e.v=function(){return this.x.keys()},e.nv=function(){return this.x.length},e.ne=function(){for(var t,e=0,i=p(this.v());!(t=i()).done;){var n=t.value;e+=this.od(n)}return e},e.clear=function(){this.valueNames.length=0,this.attributeIndex.clear(),this.constantIndex.clear(),this.shaderLayoutIndex.clear(),this.effects.clear(),this.constantMacros="",this._names.length=0,this._updateFrequencies.length=0,this._layouts.length=0,this.x.length=0},e.addVertex=function(t,e,i,n,r,s){void 0===s&&(s=4294967295);var a=new Ant(t,e),o=this.x.length;return this.x.push(a),this._names.push(i),this._updateFrequencies.push(n),this._layouts.push(r),4294967295!==s&&this.addEdge(s,o),o},e.addEdge=function(t,e){return this.x[t].o.push(new uit(e)),this.x[e].i.push(new uit(t)),new hit(t,e)},e.vertexName=function(t){return this._names[t]},e.getName=function(t){return this._names[t]},e.getUpdate=function(t){return this._updateFrequencies[t]},e.setUpdate=function(t,e){this._updateFrequencies[t]=e},e.getLayout=function(t){return this._layouts[t]},e.h=function(t,e){return this.x[e].t===t},e.w=function(t){return this.x[t].t},e.object=function(t){return this.x[t].j},e.value=function(t,e){if(this.x[e].t===t)return this.x[e].j;throw Error("value id not match")},e.visitVertex=function(t,e){var i=this.x[e];switch(i.t){case 0:return t.renderStage(i.j);case 1:return t.renderPhase(i.j);default:throw Error("polymorphic type not found")}},e.j=function(t){return this.x[t].j},e.reference=function(t,e){for(var i,n=p(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.parent=function(t){return t.source},e.child=function(t){return t.target},e.children=function(t){return new lit(this.x[t].o.values(),t)},e.numChildren=function(t){return this.x[t].o.length},e.getParent=function(t){if(4294967295===t)return 4294967295;var e=this.x[t].i;return 0===e.length?4294967295:e[0].target},e.addReference=function(t,e){return this.addEdge(t,e)},e.locateChild=function(t,e){if(4294967295===t){for(var i,n=p(this.x.keys());!(i=n()).done;){var r=i.value;if(0===this.x[r].i.length&&this._names[r]===e)return r}return 4294967295}for(var s,a=p(this.x[t].o);!(s=a()).done;){var o=s.value.target;if(e===this._names[o])return o}return 4294967295},e.locate=function(t){return _it(this,4294967295,t)},e.locateRelative=function(t,e){return void 0===e&&(e=4294967295),_it(this,e,t)},e.path=function(t){return dit(this,t)},t}();function Int(t,e){e.descriptorID=t.n(),e.type=t.n(),e.count=t.n()}function Bnt(t,e){var i;e.type=t.n(),e.visibility=t.n(),e.offset=t.n(),e.capacity=t.n(),e.accessType=t.n(),e.viewDimension=t.n(),e.sampleType=t.n(),e.format=t.n(),i=t.n(),e.descriptors.length=i;for(var n=0;n!==i;++n){var r=new _nt;Int(t,r),e.descriptors[n]=r}}function Mnt(t,e){e.slot=t.n(),e.capacity=t.n(),e.uniformBlockCapacity=t.n(),e.samplerTextureCapacity=t.n();var i=0;i=t.n(),e.descriptorBlocks.length=i;for(var n=0;n!==i;++n){var r=new pnt;Bnt(t,r),e.descriptorBlocks[n]=r}i=t.n();for(var s=0;s!==i;++s){var a=t.n(),o=new g_;lnt(t,o),e.uniformBlocks.set(a,o)}i=t.n();for(var h=0;h!==i;++h){var u=t.n(),l=t.n();e.bindingMap.set(u,l)}}function Pnt(t,e){Mnt(t,e.descriptorSetLayoutData),fnt(t,e.descriptorSetLayoutInfo)}function Ent(t,e){var i=0;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=new gnt;Pnt(t,s),e.descriptorSets.set(r,s)}i=t.n();for(var a=0;a!==i;++a){var o=t.n(),h=new gnt;Pnt(t,h),e.descriptorGroups.set(o,h)}}function knt(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=t.n();e.descriptorBindings.set(r,s)}}function Rnt(t,e){var i=0;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=new mnt;Mnt(t,s),e.layoutData.set(r,s)}i=t.n();for(var a=0;a!==i;++a){var o=t.n(),h=new ynt;knt(t,h),e.bindingData.set(o,h)}}function Ont(t,e){var i;i=t.n(),e.passes.length=i;for(var n=0;n!==i;++n){var r=new bnt;Rnt(t,r),e.passes[n]=r}}function Fnt(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.s(),s=new Snt;Ont(t,s),e.techniques.set(r,s)}}function Lnt(t,e){Ent(t,e.layout)}function Vnt(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=t.n();e.descriptorVisibility.set(r,s)}}function Nnt(t,e){e.rootSignature=t.s();var i=0;i=t.n(),e.shaderPrograms.length=i;for(var n=0;n!==i;++n){var r=new wnt;Lnt(t,r),e.shaderPrograms[n]=r}i=t.n();for(var s=0;s!==i;++s){var a=t.s(),o=t.n();e.shaderIndex.set(a,o)}}function znt(t,e){var i=t.n();t.n(),t.n(),t.n();for(var n=0;n!==i;++n){var r=t.n(),s=t.n(),a=t.s(),o=t.n(),h=new vnt;switch(Ent(t,h),r){case 0:var u=new Tnt;Vnt(t,u),e.addVertex(0,u,a,o,h,s);break;case 1:var l=new Cnt;Nnt(t,l),e.addVertex(1,l,a,o,h,s)}}var c=0;c=t.n(),e.valueNames.length=c;for(var f=0;f!==c;++f)e.valueNames[f]=t.s();c=t.n();for(var d=0;d!==c;++d){var _=t.s(),p=t.n();e.attributeIndex.set(_,p)}c=t.n();for(var m=0;m!==c;++m){var g=t.s(),v=t.n();e.constantIndex.set(g,v)}c=t.n();for(var y=0;y!==c;++y){var b=t.s(),S=t.n();e.shaderLayoutIndex.set(b,S)}c=t.n();for(var x=0;x!==c;++x){var w=t.s(),T=new xnt;Fnt(t,T),e.effects.set(w,T)}}var Unt=function(){function t(t){this.colors=void 0,this.colors=new Array(t)}var e=t.prototype;return e.get=function(t){return this.colors[t]},e.put=function(t,e){this.colors[t]=e},t}();function Gnt(t){switch(t){case 1:case 5:case 9:case 13:return 1;case 6:case 14:case 10:case 2:return 2;case 15:case 3:case 11:case 7:return 3;case 4:case 16:case 12:case 8:case 17:return 4;case 18:case 20:return 6;case 19:case 23:return 8;case 21:return 9;case 22:case 24:return 12;case 25:return 16;default:return 0}}function Hnt(t,e){var i=1;return 1&t||0!==e||(i=8&t?1:0),6&~t&&1===e&&(2&t||(i=0),4&t||(i=0)),i}function Wnt(t,e,i,n,r,s){void 0===n&&(n=null),void 0===r&&(r=0),void 0===s&&(s=void 0),s=s||new Qd;var a=t?t.viewport:new Qd(0,0,1,1),o=e,h=i;if(s.x=a.x*o,s.y=a.y*h,s.width=a.width*o,s.height=a.height*h,n)switch(n.type){case 0:var u=n;if(u.shadowFixedArea||u.csmLevel===zT.LEVEL_1)s.x=0,s.y=0,s.width=o,s.height=h;else{var l=C.director.root.device.capabilities.screenSpaceSignY;s.x=r%2*.5*o,s.y=l>0?.5*(1-Math.floor(r/2))*h:.5*Math.floor(r/2)*h,s.width=.5*o,s.height=.5*h}break;case 2:s.x=0,s.y=0,s.width=o,s.height=h}return s}function jnt(t,e,i,n,r){var s="Camera"+r,a=i.renderArea(),o=a.x,h=a.y,u=i.camera,l="reflectionProbePassColor"+s,c="reflectionProbePassDS"+s;e.containsResource(l)||(e.addRenderWindow(l,35,o,h,n),e.addDepthStencil(c,55,o,h,3)),e.updateRenderWindow(l,n),e.updateDepthStencil(c,o,h);var f=e.addRenderPass(o,h,"default");f.name="ReflectionProbePass"+r,f.setViewport(new i_(0,0,o,h)),f.addRenderTarget(l,Hnt(u.clearFlag,0),0,new n_(u.clearColor.x,u.clearColor.y,u.clearColor.z,u.clearColor.w)),f.addDepthStencil(c,Hnt(u.clearFlag,1),0,u.clearDepth,u.clearStencil,u.clearFlag);var d=f.addQueue(1,"reflect-map"),_=new Ket;_.probe=i,d.addSceneOfCamera(t,_,8193),qnt(d,u,e)}function qnt(t,e,i){var n=C.director.root.pipeline,r=i.pipelineSceneData,s=r.skybox;t.setMat4("cc_matView",e.matView),t.setMat4("cc_matViewInv",e.node.worldMatrix),t.setMat4("cc_matProj",e.matProj),t.setMat4("cc_matProjInv",e.matProjInv),t.setMat4("cc_matViewProj",e.matViewProj),t.setMat4("cc_matViewProjInv",e.matViewProjInv),t.setVec4("cc_cameraPos",new Vn(e.position.x,e.position.y,e.position.z,n.getCombineSignY())),t.setVec4("cc_surfaceTransform",new Vn(e.surfaceTransform,0,Math.cos(nn(s.getRotationAngle())),Math.sin(nn(s.getRotationAngle())))),t.setVec4("cc_screenScale",new Vn(r.shadingScale,r.shadingScale,1/r.shadingScale,1/r.shadingScale)),t.setVec4("cc_exposure",new Vn(e.exposure,1/e.exposure,r.isHDR?1:0,1/kM.standardExposureValue))}function Xnt(t,e,i){i instanceof _p?t.bindBuffer(e,i):i instanceof Rp?t.bindTexture(e,i):i instanceof Ep&&t.bindSampler(e,i)}function Ynt(t,e,i){Xnt(t,e,i)}function Qnt(t,e){for(var i,n=p(e.descriptorSetLayoutData.descriptorBlocks);!(i=n()).done;)for(var r=i.value,s=0;s!==r.descriptors.length;++s)if(t===r.descriptors[s].descriptorID)return r.offset+s;return-1}new mh(0,0,0,.5,.5,.5),new mh;var Jnt=function(){function t(t,e){void 0===e&&(e=2),this.buffers=[],this.currBuffIdx=0,this.device=void 0,this.currUniform=void 0,this._root=void 0;var i=(this._root=C.director.root).device;this.device=i,this.currUniform=new Float32Array(t/4);for(var n=0;nt.length)return n;for(var r=Math.min(e.length,t.length-i),s=0;s=this.instanceBuffers.length&&this.instanceBuffers.push(new mT(t)),this.passInstances.set(t,n);var r=this.instanceBuffers[n];r.pass=t,r.instances}this.instanceBuffers[this.passInstances.get(t)].merge(e,i)},e.clear=function(){this.passInstances.clear(),this.instanceBuffers.forEach((function(t){t.clear()}))},e.sort=function(){},e.uploadBuffers=function(t){for(var e,i=p(this.passInstances.entries());!(e=i()).done;){var n=e.value;n[0];var r=n[1],s=this.instanceBuffers[r];s.hasPendingModels&&s.uploadBuffers(t)}},e.recordCommandBuffer=function(t,e,i,n,r){void 0===i&&(i=null),void 0===n&&(n=0),void 0===r&&(r=null);for(var s,a=p(this.instanceBuffers);!(s=a()).done;){var o=s.value;if(o.hasPendingModels){var h=o.instances,u=o.pass;e.bindDescriptorSet(1,u.descriptorSet);for(var l,c=null,f=p(h);!(l=f()).done;){var d=l.value;if(d.count){var _=ET.getOrCreatePipelineState(Hp.gfxDevice,u,d.shader,t,d.ia);c!==_&&(e.bindPipelineState(_),c=_),i&&e.bindDescriptorSet(0,i,[n]),r?e.bindDescriptorSet(2,d.descriptorSet,r):e.bindDescriptorSet(2,d.descriptorSet,o.dynamicOffsets),e.bindInputAssembler(d.ia),e.draw(d.ia)}}}}},t}(),Vrt=function(){function t(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295),this.frustumCulledResultID=void 0,this.lightBoundsCulledResultID=void 0,this.renderQueueTarget=void 0,this.frustumCulledResultID=t,this.lightBoundsCulledResultID=e,this.renderQueueTarget=i}return t.prototype.update=function(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295),this.frustumCulledResultID=t,this.lightBoundsCulledResultID=e,this.renderQueueTarget=i},t}();function Nrt(t,e,i,n,r,s){var a;if(r&&s&&(a=ET.getOrCreatePipelineState(Hp.gfxDevice,i,r,e,s)),a){var o=s;t.bindPipelineState(a),t.bindDescriptorSet(1,i.descriptorSet),t.bindDescriptorSet(2,n),t.bindInputAssembler(o),t.draw(o)}}var zrt=function(){function t(){this.probeQueue=new Prt,this.opaqueQueue=new Frt,this.transparentQueue=new Frt,this.opaqueInstancingQueue=new Lrt,this.transparentInstancingQueue=new Lrt,this.camera=null,this.sceneFlags=0,this.lightByteOffset=4294967295}var e=t.prototype;return e.sort=function(){this.opaqueQueue.sortOpaqueOrCutout(),this.transparentQueue.sortTransparent(),this.opaqueInstancingQueue.sort(),this.transparentInstancingQueue.sort()},e.update=function(){this.probeQueue.clear(),this.opaqueQueue.clear(),this.transparentQueue.clear(),this.opaqueInstancingQueue.clear(),this.transparentInstancingQueue.clear(),this.camera=null,this.sceneFlags=0,this.lightByteOffset=4294967295},e.empty=function(){return this.opaqueQueue.empty()&&this.transparentQueue.empty()&&this.opaqueInstancingQueue.empty()&&this.transparentInstancingQueue.empty()},e.recordCommands=function(t,e,i){var n=4294967295===this.lightByteOffset?null:[this.lightByteOffset];3&i&&(this.opaqueQueue.recordCommandBuffer(Hp.gfxDevice,e,t,null,0,n),this.opaqueInstancingQueue.recordCommandBuffer(e,t,null,0,n)),4&i&&(this.transparentInstancingQueue.recordCommandBuffer(e,t,null,0,n),this.transparentQueue.recordCommandBuffer(Hp.gfxDevice,e,t,null,0,n))},t}(),Urt=4294967295;function Grt(t){switch(t){case 0:return 1;case 1:return 2;case 2:return 16;case 3:return 32;case 4:return 64;case 5:return 4;case 6:return 8;case 7:return 128;case 8:return 256;default:return Q("DescriptorType not found"),256}}function Hrt(t){switch(t){case 1:return 0;case 2:return 1;case 16:return 2;case 32:return 3;case 64:return 4;case 4:return 5;case 8:return 6;case 128:return 7;case 256:return 8;default:return Q("DescriptorTypeOrder not found"),8}}function Wrt(t,e){return t.locateChild(t.N,e||"default")}function jrt(t,e,i){return t.locateChild(e,i)}function qrt(t,e,i){return void 0===i?t.locateChild(e,"default"):"number"==typeof i?t.locateChild(e,i.toString()):t.locateChild(e,i)}var Xrt,Yrt,Qrt=new Map([["cc_lightPos",1],["cc_lightColor",1],["cc_lightSizeRangeAngle",1],["cc_lightDir",1],["cc_lightBoundingSizeVS",1]]);function Jrt(t){for(var e,i=0,n=p(t);!(e=n()).done;){var r=e.value;if(r.count)i+=up(r.type)*r.count;else{var s=Qrt.get(r.name);if(void 0===s)if("cc_joints"!==r.name)Q("Invalid uniform count: "+r.name);else{var a=up(r.type)*Qb.LAYOUT.members[0].count;J(a!==Qb.SIZE),i+=a}else i+=up(r.type)*s}}return J(!!i),i}function Krt(t,e){var i=JSON.parse(t[0]),n=JSON.parse(e[0]);return 1e4*i.updateFrequency+1e3*i.parameterType+100*i.descriptorType+i.visibility-(1e4*n.updateFrequency+1e3*n.parameterType+100*n.descriptorType+n.visibility)}function Zrt(t,e){var i=JSON.parse(t[0]),n=JSON.parse(e[0]);return 1e9*i.updateFrequency+1e8*i.parameterType+1e7*i.descriptorType+1e6*i.visibility+1e5*i.accessType+1e4*i.viewDimension+1e3*i.sampleType+i.format-(1e9*n.updateFrequency+1e8*n.parameterType+1e7*n.descriptorType+1e6*n.visibility+1e5*n.accessType+1e4*n.viewDimension+1e3*n.sampleType+n.format)}function $rt(t,e){var i=t.attributeIndex.get(e);if(void 0===i){var n=t.valueNames.length;return t.attributeIndex.set(e,n),t.valueNames.push(e),n}return i}function tst(t,e){e.bindings.length=0;for(var i=0;i=t.valueNames.length?"":t.valueNames[e]}var vst=function(){this.frustumCullingKeyRecycle=new ho((function(){return new Ast}),8),this.frustumCullingsRecycle=new ho((function(){return new Est}),8),this.lightBoundsCullingRecycle=new ho((function(){return new Ist}),8),this.lightBoundsCullingResultRecycle=new ho((function(){return new Bst}),8),this.lightBoundsCullingKeyRecycle=new ho((function(){return new Dst}),8),this.renderQueueRecycle=new ho((function(){return new zrt}),8),this.renderQueueQueryRecycle=new ho((function(){return new Vrt}),8)},yst=Fv.makeMaskExclude([Fv.BitMask.UI_2D,Fv.BitMask.UI_3D,Fv.BitMask.GIZMOS,Fv.BitMask.EDITOR,Fv.BitMask.SCENE_GIZMO,Fv.BitMask.PROFILER]),bst=new WeakMap,Sst="",xst=0;function wst(t){return bst.has(t)||bst.set(t,++xst),bst.get(t)}function Tst(t,e,i){void 0===i&&(i=-1),Sst="";var n=t.camera,r=t.light.light,s=t.light.level,a=t.light.probe,o=t.shadingLight;return Sst+=drt(n?wst(n):0),Sst+=drt(a?wst(a):0),Sst+=drt(-1===i&&r?wst(r):0),Sst+=drt(-1!==i&&o?wst(o):0),Sst+=drt(-1===i?s:0),Sst+=drt(e?1:0),Sst+=drt(i)}var Cst,Ast=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=!1),this.sceneData=null,this.castShadows=!1,this.sceneData=t,this.castShadows=e}return t.prototype.update=function(t,e){this.sceneData=t,this.castShadows=e},t}(),Dst=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=-1),this.sceneData=null,this.frustumCullingID=-1,this.sceneData=t,this.frustumCullingID=e}return t.prototype.update=function(t,e){void 0===t&&(t=null),void 0===e&&(e=-1),this.sceneData=t,this.frustumCullingID=e},t}(),Ist=function(){function t(){this.resultKeyIndex=new Map,this.resultIndex=new Map}return t.prototype.update=function(){this.resultIndex.clear(),this.resultKeyIndex.clear()},t}(),Bst=function(){function t(){this.instances=[],this.lightByteOffset=4294967295}return t.prototype.update=function(){return this.instances.length=0,this.lightByteOffset=4294967295,this},t}();function Mst(t,e,i){return t+"-"+e+"-"+i}function Pst(t){var e=t.split("-");return[parseInt(e[0]),parseInt(e[1]),parseInt(e[2])]}var Est=function(){function t(){this.resultIndex=new Map,this.resultKeyIndex=new Map}return t.prototype.update=function(){this.resultIndex.clear(),this.resultKeyIndex.clear()},t}();function kst(t,e){return t&&(e&t.layer)===t.layer}function Rst(t,e){return!!(e&t.visFlags)}function Ost(t,e){return kst(t.node,e)||Rst(t,e)}function Fst(t){return prt((t.node.layer&yst)===t.node.layer||yst&t.visFlags)}var Lst=new mh;function Vst(t,e,i){var n=t.worldBounds,r=Cst.shadows;return i&&r.type===VT.Planar?(mh.transform(Lst,n,r.matLight),!Ka.aabbFrustum(Lst,e)):!Ka.aabbFrustum(n,e)}function Nst(t,e,i,n,r,s){var a,o,h=Cst.skybox,u=h.model,l=e.visibility,c=8&e.clearFlag;!n&&h&&h.enabled&&u&&c&&s.push(u);for(var f,d=p(t.models);!(f=d()).done;){var _=f.value;if(_.enabled&&_.node&&(!n||_.castShadow)&&!t.isCulledByLod(e,_)){var m=_.worldBounds;if(r)if(0===r.probeType){if(!Ost(_,l))continue;if(m&&(a=m,o=r.boundingBox,!Ka.aabbWithAABB(a,o)))continue;s.push(_)}else Fst(_)&&s.push(_);else{if(!Ost(_,l))continue;if(m&&Vst(_,i,n))continue;s.push(_)}}}}var zst=new ir;function Ust(t,e){var i=0;return e.node&&(ir.subtract(zst,e.worldBounds?e.worldBounds.center:e.node.worldPosition,t.position),i=ir.dot(zst,t.forward)),i}function Gst(t,e,i,n,r,s,a){var o=a.probeQueue;n&&o.addToProbeQueue(s,t);for(var h=s.subModels,u=h.length,l=Cst.skybox.model,c=Ust(r,s),f=0;fthis.lightBoundsCullingResults.length&&this.lightBoundsCullingResults.push(this.cullingPools.lightBoundsCullingResultRecycle.add().update()),r.resultIndex.set(a,h);var u=this.cullingPools.lightBoundsCullingKeyRecycle.add();return u.update(t,e),r.resultKeyIndex.set(a,u),h},e.getOrCreateFrustumCulling=function(t){var e=this.renderGraph.j(t),i=e.scene,n=this.frustumCullings.get(i);if(!n){var r=this.cullingPools.frustumCullingsRecycle.add();r.update(),this.frustumCullings.set(i,r),n=this.frustumCullings.get(i)}var s=prt(8&e.flags),a=Tst(e,s),o=n.resultIndex.get(a);if(void 0!==o)return o;var h=this.numFrustumCulling++;this.numFrustumCulling>this.frustumCullingResults.length&&this.frustumCullingResults.push([]),n.resultIndex.set(a,h);var u=this.cullingPools.frustumCullingKeyRecycle.add();return u.update(e,s),n.resultKeyIndex.set(a,u),h},e.getOrCreateRenderQueue=function(t,e,i){var n=this.renderQueueIndex.get(t);if(void 0!==n)return this.renderQueues[n].sceneFlags|=e&this.kDrawMask,n;var r=this.numRenderQueues++;if(this.numRenderQueues>this.renderQueues.length){var s=this.cullingPools.renderQueueRecycle.add();s.update(),this.renderQueues.push(s)}var a=this.renderQueues[r];return this.renderQueueIndex.set(t,r),a.camera=i,a.sceneFlags=e&this.kAllMask,r},e.collectCullingQueries=function(t){for(var e,i=p(t.v());!(e=i()).done;){var n=e.value;if(t.h(9,n)&&t.getValid(n)){var r=t.j(n);if(r.scene){var s=this.getOrCreateFrustumCulling(n),a=this.getOrCreateLightBoundsCulling(r,s),o=t.getParent(n),h=Mst(s,a,t.j(o).phaseID),u=this.getOrCreateRenderQueue(h,r.flags,r.camera),l=this.cullingPools.renderQueueQueryRecycle.add();l.update(s,a,u),this.renderQueueQueryIndex.set(n,l)}}}},e.uploadInstancing=function(t){for(var e=0;e!==this.numRenderQueues;++e){var i=this.renderQueues[e];i.opaqueInstancingQueue.uploadBuffers(t),i.transparentInstancingQueue.uploadBuffers(t)}},e._getPhaseIdFromScene=function(t){var e=this.renderGraph,i=e.getParent(t);return e.j(i).phaseID},e.getBuiltinShadowFrustum=function(t,e,i,n){var r=t.csmLayers,s=i.csmLevel,a=t.shadows;return a.type===VT.Planar?e.frustum:(a.enabled&&a.type===VT.ShadowMap&&i&&i.node&&r.update(t,e),i.shadowFixedArea||s===zT.LEVEL_1?r.specialLayer.validFrustum:r.layers[n].validFrustum)},e.batchFrustumCulling=function(t){for(var e,i=p(this.frustumCullings);!(e=i()).done;)for(var n,r=e.value,s=r[0],a=r[1],o=p(a.resultIndex);!(n=o()).done;){var h=n.value,u=h[0],l=h[1],c=a.resultKeyIndex.get(u),f=c.sceneData,d=f.light.light,_=f.light.level,m=c.castShadows,g=f.light.probe,v=g?g.camera:f.camera,y=this.frustumCullingResults[l];if(g)Nst(s,v,v.frustum,m,g,y);else if(d)switch(d.type){case 2:Nst(s,v,d.frustum,m,null,y);break;case 0:Nst(s,v,this.getBuiltinShadowFrustum(t,v,d,_),m,null,y)}else Nst(s,v,v.frustum,m,null,y)}},e.executeSphereLightCulling=function(t,e,i){for(var n,r=t.aabb,s=p(e);!(n=s()).done;){var a=n.value,o=a.worldBounds;o&&!Ka.aabbWithAABB(o,r)||i.push(a)}},e.executeSpotLightCulling=function(t,e,i){for(var n,r=t.aabb,s=t.frustum,a=p(e);!(n=a()).done;){var o=n.value,h=o.worldBounds;(!h||Ka.aabbWithAABB(r,h)&&Ka.aabbFrustum(h,s))&&i.push(o)}},e.executePointLightCulling=function(t,e,i){for(var n,r=t.aabb,s=p(e);!(n=s()).done;){var a=n.value,o=a.worldBounds;o&&!Ka.aabbWithAABB(r,o)||i.push(a)}},e.executeRangedDirectionalLightCulling=function(t,e,i){Wst.transform(t.node.worldMatrix,null,null,null,jst);for(var n,r=p(e);!(n=r()).done;){var s=n.value,a=s.worldBounds;a&&!Ka.aabbWithAABB(jst,a)||i.push(s)}},e.batchLightBoundsCulling=function(){for(var t,e=p(this.lightBoundsCullings);!(t=e()).done;){var i=t.value;i[0];for(var n,r=i[1],s=p(r.resultIndex);!(n=s()).done;){var a=n.value,o=a[0],h=a[1],u=r.resultKeyIndex.get(o),l=u.sceneData,c=u.frustumCullingID,f=this.frustumCullingResults[c],d=this.lightBoundsCullingResults[h];switch(l.shadingLight.type){case 1:var _=l.shadingLight;this.executeSphereLightCulling(_,f,d.instances);break;case 2:var m=l.shadingLight;this.executeSpotLightCulling(m,f,d.instances);break;case 3:var g=l.shadingLight;this.executePointLightCulling(g,f,d.instances);break;case 4:var v=l.shadingLight;this.executeRangedDirectionalLightCulling(v,f,d.instances)}}}},e._getModelsByCullingResults=function(t,e){return 4294967295!==t?t=n.width},e.createDeviceBuf=function(t){var e,i=Hst.deviceBuffers.get(this.name);i&&this.checkBuffer(this.name)||(null!=(e=i)&&e.buffer&&i.buffer.destroy(),i=new Zst(this.name,t),Hst.deviceBuffers.set(this.name,i))},e.managed=function(t){this.createDeviceTex(t)},e.managedBuffer=function(t){this.createDeviceBuf(t)},e.managedTexture=function(){},e.persistentBuffer=function(t){this.createDeviceBuf(t)},e.persistentTexture=function(t){this.createDeviceTex(t)},e.framebuffer=function(t){this.createDeviceTex(t)},e.swapchain=function(t){this.createDeviceTex(t)},e.formatView=function(){},e.subresourceView=function(){},n(t,[{key:"resName",set:function(t){this.name=t}}]),t}(),Qst=function(){function t(t){this._name=void 0,this._name=t}return n(t,[{key:"name",get:function(){return this._name}}]),t}(),Jst=function(t){function e(e,i){var n;(n=t.call(this,e)||this)._texture=null,n._swapchain=null,n._framebuffer=null,n._desc=null,n._trait=null;var r=Hst.resourceGraph,s=r.vertex(e);return n._desc=r.getDesc(s),n._trait=r.getTraits(s),i instanceof Rp?n._texture=i:i instanceof yp?n._framebuffer=i:i instanceof Bit?n._swapchain=i.swapchain:n.createTextureFromDesc(n._desc),n}s(e,t);var i=e.prototype;return i.createTextureFromDesc=function(t){var e=1;switch(t.dimension){case 1:e=0;break;case 3:e=2}var i=[[16,16],[32,32],[64,64],[8,4],[4,8],[256,1],[512,2]].reduce((function(e,i){var n=i[0],r=i[1];return t.flags&n?e|r:e}),0);this._texture=Hst.device.createTexture(new d_(e,i,t.format,t.width,t.height))},i.release=function(){var t,e;null==(t=this.framebuffer)||t.destroy(),this._framebuffer=null,null==(e=this.texture)||e.destroy(),this._texture=null},n(e,[{key:"texture",get:function(){return this._texture}},{key:"framebuffer",get:function(){return this._framebuffer},set:function(t){this._framebuffer=t}},{key:"description",get:function(){return this._desc}},{key:"trait",get:function(){return this._trait}},{key:"swapchain",get:function(){return this._swapchain}}]),e}(Qst);function Kst(t){var e=C.director.root.pipeline.pipelineSceneData;return!!(e.shadows.enabled&&e.shadows.type===VT.ShadowMap&&t&&8&t.flags)}var Zst=function(t){function e(e){var i;(i=t.call(this,e)||this)._buffer=null;var n=Hst.resourceGraph,r=n.vertex(e),s=n.getDesc(r),a=new h_(i.calculateBufferUsage(s.flags),1,s.width);return i._buffer=Hst.device.createBuffer(a),i}s(e,t);var i=e.prototype;return i.calculateBufferUsage=function(t){return[[2,64],[1,16],[4,32],[256,1],[512,2]].reduce((function(e,i){var n=i[0],r=i[1];return t&n?e|r:e}),0)},i.release=function(){var t;null==(t=this._buffer)||t.destroy(),this._buffer=null},n(e,[{key:"buffer",get:function(){return this._buffer}}]),e}(Qst),$st=new Float32Array(4),tat=function(){function t(t){this._isUpdate=!1,this._isGatherLight=!1,this._blit=void 0,this._screenQuad=null,this._stageDesc=void 0,this._lightVolumeBuffer=null,this._lightMeterScale=1e4,this._lightBufferData=void 0,this._blit=t}var e=t.prototype;return e._createQuadInputAssembler=function(){return Hst.blit.pipelineIAData},e.createScreenQuad=function(){this._screenQuad||(this._screenQuad=this._createQuadInputAssembler())},e._gatherVolumeLights=function(t){var e=this;if(t.scene){for(var i,n=Hst.pipeline,r=Hst.commandBuffer,s=t.scene.sphereLights,a=t.scene.spotLights,o=t.exposure,h=jb.LIGHTS_PER_PASS,u=Vn.length,l=u*h,c=Ys.create(0,0,0,1),f=0,d=function(i,r){if(!(f>=h)&&(Ys.set(c,i.position.x,i.position.y,i.position.z,i.range),Ka.sphereFrustum(c,t.frustum))){if(ir.toArray($st,i.position),$st[3]=r?1:0,e._lightBufferData.set($st,f*u+0*l),ir.toArray($st,i.color),i.useColorTemperature){var s=i.colorTemperatureRGB;$st[0]*=s.x,$st[1]*=s.y,$st[2]*=s.z}$st[3]=n.pipelineSceneData.isHDR?i.luminance*o*e._lightMeterScale:i.luminance,e._lightBufferData.set($st,f*u+1*l),$st[0]=i.size,$st[1]=i.range,$st[2]=r?i.spotAngle:0,e._lightBufferData.set($st,f*u+2*l),r&&(ir.toArray($st,i.direction),e._lightBufferData.set($st,f*u+3*l)),f++}},_=p(s);!(i=_()).done;)d(i.value,!1);for(var m,g=p(a);!(m=g()).done;)d(m.value,!0);var v=3*l+3;this._lightBufferData.set([f],v),r.updateBuffer(this._lightVolumeBuffer,this._lightBufferData)}},e.update=function(){64&this.blit.sceneFlags&&this.blit.camera&&!this._isGatherLight&&(this._gatherVolumeLights(this.blit.camera),this._isGatherLight=!0,this._isUpdate=!1),this._isUpdate||(this._stageDesc.update(),this._isUpdate=!0)},e.reset=function(){this._isUpdate=!1,this._isGatherLight=!1},e.createStageDescriptor=function(){var t=this.blit,e=t.material.passes[t.passID],i=Hst.device;if(this._stageDesc=Hst.blit.stageDescs.get(e)||i.createDescriptorSet(new z_(e.localSetLayout)),Hst.blit.stageDescs.set(e,this._stageDesc),64&this.blit.sceneFlags){this._lightVolumeBuffer=Hst.blit.lightVolumeBuffer;var n=Hst.blit.deferredLitsBufView;this._lightBufferData=Hst.blit.lightBufferData,this._lightBufferData.fill(0),this._stageDesc.bindBuffer(Wb.BINDING,n)}this._stageDesc.bindBuffer(Nb.BINDING,Hst.blit.emptyLocalUBO)},n(t,[{key:"screenQuad",get:function(){return this._screenQuad}},{key:"blit",get:function(){return this._blit},set:function(t){this._blit=t}},{key:"stageDesc",get:function(){return this._stageDesc}}]),t}(),eat=function(){function t(){this._devicePass=void 0,this._hint=0,this._phaseID=pT("default"),this._renderPhase=null,this._descSetData=null,this._layoutID=-1,this._isUpdateUBO=!1,this._isUploadInstance=!1,this._isUploadBatched=!1,this._queueId=-1}var e=t.prototype;return e.preRecord=function(){},e.postRecord=function(){},e.init=function(t,e,i){this.reset(),this.queueHint=e.hint,this.queueId=i,this._devicePass=t,this._phaseID=C.rendering.getPhaseID(t.passID,Hst.renderGraph.getLayout(i))},e.reset=function(){this._isUpdateUBO=!1,this._isUploadInstance=!1,this._isUploadBatched=!1},e.record=function(){this._descSetData&&this._descSetData.descriptorSet&&Hst.commandBuffer.bindDescriptorSet(3,this._descSetData.descriptorSet)},n(t,[{key:"phaseID",get:function(){return this._phaseID}},{key:"layoutID",get:function(){return this._layoutID},set:function(t){this._layoutID=t;var e=Hst.layoutGraph;this._renderPhase=e.h(1,t)?e.j(t):null;var i=e.getLayout(t);this._descSetData=i.getSet(2)}},{key:"descSetData",get:function(){return this._descSetData}},{key:"renderPhase",get:function(){return this._renderPhase}},{key:"queueId",get:function(){return this._queueId},set:function(t){this._queueId=t}},{key:"isUpdateUBO",get:function(){return this._isUpdateUBO},set:function(t){this._isUpdateUBO=t}},{key:"isUploadInstance",get:function(){return this._isUploadInstance},set:function(t){this._isUploadInstance=t}},{key:"isUploadBatched",get:function(){return this._isUploadBatched},set:function(t){this._isUploadBatched=t}},{key:"queueHint",get:function(){return this._hint},set:function(t){this._hint=t}},{key:"devicePass",get:function(){return this._devicePass}}]),t}(),iat=function(){function t(){this._renderScenes=[],this._devicePass=void 0,this._hint=0,this._graphQueue=void 0,this._phaseID=pT("default"),this._renderPhase=null,this._descSetData=null,this._viewport=null,this._scissor=null,this._layoutID=-1,this._isUpdateUBO=!1,this._isUploadInstance=!1,this._isUploadBatched=!1,this._blitDesc=null,this._queueId=-1}var e=t.prototype;return e.init=function(t,e,i){this.reset(),this._graphQueue=e,this.queueHint=e.hint;var n=this._viewport=e.viewport;n&&(this._scissor=new Qd(n.left,n.top,n.width,n.height)),this.queueId=i,this._devicePass=t,this._phaseID=C.rendering.getPhaseID(t.passID,Hst.renderGraph.getLayout(i))},e.createBlitDesc=function(t){this._blitDesc||(this._blitDesc=new tat(t)),this._blitDesc.createScreenQuad(),this._blitDesc.createStageDescriptor()},e.setScene=function(t,e,i){var n=Hst.pools.addDeviceScene();return n.init(this,t,e,i),this._renderScenes.push(n),n},e.reset=function(){var t;this._renderScenes.length=0,this._isUpdateUBO=!1,this._isUploadInstance=!1,this._isUploadBatched=!1,null==(t=this._blitDesc)||t.reset()},e.preRecord=function(){},e.record=function(){this._descSetData&&this._descSetData.descriptorSet&&Hst.commandBuffer.bindDescriptorSet(3,this._descSetData.descriptorSet),this._renderScenes.forEach((function(t){t.record()}))},e.postRecord=function(){},n(t,[{key:"phaseID",get:function(){return this._phaseID}},{key:"layoutID",get:function(){return this._layoutID},set:function(t){this._layoutID=t;var e=Hst.layoutGraph;this._renderPhase=e.h(1,t)?e.j(t):null;var i=e.getLayout(t);this._descSetData=i.getSet(2)}},{key:"descSetData",get:function(){return this._descSetData}},{key:"renderPhase",get:function(){return this._renderPhase}},{key:"viewport",get:function(){return this._viewport}},{key:"scissor",get:function(){return this._scissor}},{key:"queueId",get:function(){return this._queueId},set:function(t){this._queueId=t}},{key:"isUpdateUBO",get:function(){return this._isUpdateUBO},set:function(t){this._isUpdateUBO=t}},{key:"isUploadInstance",get:function(){return this._isUploadInstance},set:function(t){this._isUploadInstance=t}},{key:"isUploadBatched",get:function(){return this._isUploadBatched},set:function(t){this._isUploadBatched=t}},{key:"graphQueue",get:function(){return this._graphQueue}},{key:"blitDesc",get:function(){return this._blitDesc}},{key:"renderScenes",get:function(){return this._renderScenes}},{key:"queueHint",get:function(){return this._hint},set:function(t){this._hint=t}},{key:"devicePass",get:function(){return this._devicePass}}]),t}(),nat=function(){function t(t,e,i){this._layoutID=0,this._vertID=-1,this._resID=-1,this._stage=null,this._layout=void 0,this._inputName=void 0,this._descriptorSet=null,this._inputName=i[0],this._layoutID=t,this._vertID=e;var n=Hst.layoutGraph;this._stage=n.j(t),this._layout=n.getLayout(t);var r=this._layout.getSet(3);if(r){var s=r.descriptorSet,a=Hst.deviceTextures.get(this._inputName),o=null==a?void 0:a.texture,h=Hst.deviceBuffers.get(this._inputName),u=null==h?void 0:h.buffer;if(!o&&!u)throw Error("Could not find texture with resource name "+this._inputName);this._resID=Hst.resourceGraph.vertex(this._inputName);for(var l,c=Hst.resourceGraph.getSampler(this._resID),f=p(i[1]);!(l=f()).done;){var d=l.value.name,_=n.attributeIndex.get(d);void 0!==_&&this.bindDescriptor(s,_,o,u,c,i[1][0].accessType)}}}return t.prototype.bindDescriptor=function(t,e,i,n,r,s){for(var a,o=this._layout.getSet(3),h=Hst.resourceGraph.getDesc(this._resID),u=p(o.descriptorSetLayoutData.descriptorBlocks);!(a=u()).done;)for(var l=a.value,c=0;c0){var a=[s,r];r=a[0],s=a[1]}var o=new Float32Array(16),h=function(t,e,i,n,r,s,a,h,u,l,c,f,d,_,p,m){o.set([t,e,i,n,r,s,a,h,u,l,c,f,d,_,p,m])};switch(t){case 0:h(-1,-1,i,s,1,-1,n,s,-1,1,i,r,1,1,n,r);break;case 1:h(-1,-1,n,s,1,-1,n,r,-1,1,i,s,1,1,i,r);break;case 2:h(-1,-1,i,r,1,-1,n,r,-1,1,i,s,1,1,n,s);break;case 3:h(-1,-1,i,r,1,-1,i,s,-1,1,n,r,1,1,n,s)}return o},e._createQuadInputAssembler=function(){var t=new jE,e=C.director.root.device,i=e.createBuffer(new h_(10,3,64,16));if(!i)return t;var n=e.createBuffer(new h_(6,1,12,2));if(!n)return t;var r=new Uint16Array(6);r[0]=0,r[1]=1,r[2]=2,r[3]=1,r[4]=3,r[5]=2,n.update(r.buffer);var s=new Array(2);s[0]=new C_("a_position",21),s[1]=new C_("a_texCoord",21);var a=e.createInputAssembler(new D_(s,[i],n));return t.quadIB=n,t.quadVB=i,t.quadIA=a,t},n(t,[{key:"pipelineIAData",get:function(){return this._pipelineIAData}},{key:"deferredLitsBufView",get:function(){return this._deferredLitsBufView}},{key:"lightVolumeBuffer",get:function(){return this._lightVolumeBuffer}},{key:"lightBufferData",get:function(){return this._lightBufferData}},{key:"stageDescs",get:function(){return this._stageDescs}},{key:"emptyLocalUBO",get:function(){return this._localUBO}}]),t}(),pat=function(){function t(t,e,i,n,r,s,a,o){void 0===o&&(o=null),this.device=void 0,this.pipeline=void 0,this.commandBuffer=void 0,this.pipelineSceneData=void 0,this.resourceGraph=void 0,this.devicePasses=new Map,this.deviceTextures=new Map,this.deviceBuffers=new Map,this.layoutGraph=void 0,this.root=void 0,this.pools=void 0,this.blit=void 0,this.culling=void 0,this.lightResource=new Xst,this.renderGraph=void 0,this.width=void 0,this.height=void 0,this.cullCamera=void 0,this.passDescriptorSet=void 0,this.profilerDescriptorSet=void 0,this.pipeline=t,this.device=e,this.commandBuffer=e.commandBuffer,this.pipelineSceneData=t.pipelineSceneData,this.resourceGraph=i,this.renderGraph=n,this.root=A.director.root,this.layoutGraph=r,this.width=s,this.height=a,this.pools=new fat,this.blit=new _at(this),this.culling=new qst,this.passDescriptorSet=o,this.profilerDescriptorSet=trt("default").descriptorSet}var e=t.prototype;return e.reset=function(){this.culling.clear(),this.pools.reset(),this.cullCamera=null,this.lightResource.clear()},e.resize=function(t,e){this.width=t,this.height=e,this.blit.resize(t,e)},t}(),mat=function(){function t(t,e,i,n,r,s){this._context=void 0,this._visitor=void 0,Hst=this._context=new pat(t,e,i,new snt,n,r,s);var a=C.rendering.programLib;Hst.lightResource.init(a,e,16)}var e=t.prototype;return e.resize=function(t,e){Hst.resize(t,e)},e._removeDeviceResource=function(){for(var t,e=Hst.pipeline.resourceUses,i=[],n=Hst.deviceTextures,r=p(n);!(t=r()).done;){var s=t.value,a=s[0];s[1];var o=Hst.resourceGraph.vertex(a),h=Hst.resourceGraph.getTraits(o);e.includes(a)||0!==h.residency||i.push(a)}for(var u=0,l=i;uthis.passID););s.set(this.passID,e)}else{var f=r.vertex(t);r.getTraits(f).residency;var d=new Cat;i.set(t,d),d.rasters.set(this.passID,e)}},e._fetchValidPass=function(){var t=this.context.renderGraph,e=this.context.resourceContext,i=this.resID,n=this.context.resourceGraph.vertexName(i);Sat.clear();for(var r,s=this._currPass,a=t.getValid(this.passID),o=p(s.rasterViews);!(r=o()).done;){var h=r.value,u=h[0],l=h[1];u!==n||0===l.accessType?2!==l.accessType&&Sat.set(u,l):(this._useResourceInfo(u,l),t.setValid(this.passID,!0),t.setValid(this.queueID,!0),t.setValid(this.sceneID,!0))}if(!a&&t.getValid(this.sceneID)){for(var c,f=p(s.rasterViews);!(c=f()).done;){var d=c.value,_=d[0];d[1],Dat.pipeline.resourceUses.push(_)}for(var m,g,v,y=p(Sat);!(v=y()).done;){var b=v.value,S=b[0];b[1],4294967295!==(g=(m=this.context.resourceGraph).find(S))&&(this._resVisitor.resID=g,m.visitVertex(this._resVisitor,g))}for(var x,w=p(s.computeViews);!(x=w()).done;){var T=x.value,C=T[0],A=T[1],D=e.get(C);D||(D=new Cat,e.set(C,D));var I=D.computes,B=I.get(this.passID);B?B.push(A):I.set(this.passID,[A]),4294967295!==(g=(m=this.context.resourceGraph).find(C))&&(this._resVisitor.resID=g,m.visitVertex(this._resVisitor,g))}vrt(s)}},e.applyID=function(t,e){this.resID=e,this._isRasterPass(t)||this._isCopyPass(t)||this._isCompute(t)?this.passID=t:this._isQueue(t)?this.queueID=t:this._isScene(t)||this._isBlit(t)?this.sceneID=t:this._isDispatch(t)&&(this.dispatchID=t)},e.rasterPass=function(t){this._currPass=t},e.rasterSubpass=function(){},e.computeSubpass=function(){},e.compute=function(t){this._currPass=t,Dat.renderGraph.setValid(this.passID,!0)},e.resolve=function(){},e.copy=function(t){var e=Dat.renderGraph;if(!e.getValid(this.passID)){var i=this.context.resourceGraph;this._currPass=t;for(var n,r,s=this.resID,a=i.vertexName(s),o=p(t.copyPairs);!(r=o()).done;){var h=r.value;h.target===a&&(e.setValid(this.passID,!0),4294967295!==(n=i.find(h.source))&&(this._resVisitor.resID=n,i.visitVertex(this._resVisitor,n)))}}},e.move=function(){},e.raytrace=function(){},e.queue=function(){},e.scene=function(){this._fetchValidPass()},e.blit=function(){this._fetchValidPass()},e.dispatch=function(){var t=this.context.renderGraph;t.setValid(this.queueID,!0),t.setValid(this.dispatchID,!0)},e.clear=function(){},e.viewport=function(){},t}(),wat=function(t){function e(e,i){var n;return(n=t.call(this)||this)._colorMap=void 0,n._graphView=void 0,n._passVisitor=void 0,n._resId=4294967295,n._resId=i,n._passVisitor=new xat(e),n._graphView=new Sit(e.renderGraph),n._colorMap=new Unt(e.renderGraph.nv()),n}return s(e,t),e.prototype.discoverVertex=function(t,e){var i=e.g;this._passVisitor.applyID(t,this.resId),i.visitVertex(this._passVisitor,t)},n(e,[{key:"resId",get:function(){return this._resId},set:function(t){this._resId=t,this._colorMap.colors.length=Dat.renderGraph.nv()}},{key:"graphView",get:function(){return this._graphView}},{key:"colorMap",get:function(){return this._colorMap}}]),e}(bit),Tat=function(){function t(t){this._context=void 0,this.resID=4294967295,this._passManagerVis=void 0,this._context=t}var e=t.prototype;return e.managedBuffer=function(){},e.managedTexture=function(){},e.managed=function(){this.dependency()},e.persistentBuffer=function(){},e.dependency=function(){this._passManagerVis?this._passManagerVis.resId=this.resID:this._passManagerVis=new wat(this._context,this.resID),yit(this._passManagerVis.graphView,this._passManagerVis,this._passManagerVis.colorMap)},e.persistentTexture=function(){this.dependency()},e.framebuffer=function(){this.dependency()},e.swapchain=function(){this.dependency()},e.formatView=function(){},e.subresourceView=function(){},t}(),Cat=function(){this.rasters=new Map,this.computes=new Map},Aat=function(){function t(){this.resourceGraph=void 0,this.pipeline=void 0,this.renderGraph=void 0,this.layoutGraph=void 0,this.resourceContext=void 0}return t.prototype.set=function(t,e,i,n){this.pipeline=t,this.resourceGraph=e,this.renderGraph=i,this.layoutGraph=n,this.resourceContext||(this.resourceContext=new Map),this.resourceContext.clear()},t}(),Dat=new Aat;!function(t){function e(e){var i;return(i=t.call(this)||this)._colorMap=void 0,i._resourceGraph=void 0,i._resVisitor=void 0,i._colorMap=new Unt(e.resourceGraph.nv()),i._resourceGraph=e.resourceGraph,i._resVisitor=new Tat(e),i}s(e,t),e.prototype.discoverVertex=function(t){var e=this._resourceGraph.getTraits(t);0!==e.residency&&1!==e.residency&&(this._resVisitor.resID=t,this._resourceGraph.visitVertex(this._resVisitor,t))},n(e,[{key:"colorMap",get:function(){return this._colorMap}}])}(bit);var Iat,Bat,Mat=new Vn,Pat=new p_(1,1,0,2,2,2),Eat=function(){function t(){var t=this;this.renderData=new nnt,this.layoutGraph=new Dnt,this.rg=new snt,this.vertId=-1,this.sceneData=new tnt,this.resourceGraph=new qit,this.computePass=new Xit,this.rasterPass=new Uit,this.rasterSubpass=new Nit,this.renderQueue=new $it,this.sceneBuilder=new ho((function(){return new Oat(t.renderData,t.layoutGraph,t.rg,t.vertId,t.sceneData)}),16),this.renderPassBuilder=new ho((function(){return new Vat(t.renderData,t.rg,t.layoutGraph,t.resourceGraph,t.vertId,t.rasterPass,t.getPipelineSceneData())}),16),this.computeQueueBuilder=new ho((function(){return new Nat(t.renderData,t.rg,t.layoutGraph,t.vertId,t.renderQueue,t.getPipelineSceneData())}),16),this.renderQueueBuilder=new ho((function(){return new Fat(t.renderData,t.rg,t.layoutGraph,t.vertId,t.renderQueue,t.getPipelineSceneData())}),16),this.renderSubpassBuilder=new ho((function(){return new Lat(t.renderData,t.rg,t.layoutGraph,t.vertId,t.rasterSubpass,t.getPipelineSceneData())}),16),this.computePassBuilder=new ho((function(){return new zat(t.renderData,t.rg,t.layoutGraph,t.resourceGraph,t.vertId,t.computePass,t.getPipelineSceneData())}),16),this.samplerInfo=new ho((function(){return new p_}),16),this.color=new ho((function(){return new n_}),16),this.renderCommonObjectPool=new oit,this.renderGraphPool=new ont(this.renderCommonObjectPool),this.viewport=new ho((function(){return new i_}),16)}var e=t.prototype;return e.getPipelineSceneData=function(){return A.director.root.pipeline.pipelineSceneData},e.createColor=function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0);var r=this.color.add();return r.set(t,e,i,n),r},e.createSamplerInfo=function(t,e,i,n,r,s,a,o){void 0===t&&(t=2),void 0===e&&(e=2),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=7);var h=this.samplerInfo.add();return h.minFilter=t,h.magFilter=e,h.mipFilter=i,h.addressU=n,h.addressV=r,h.addressW=s,h.maxAnisotropy=a,h.cmpFunc=o,h},e.reset=function(){this.sceneBuilder.reset(),this.renderPassBuilder.reset(),this.computePassBuilder.reset(),this.computeQueueBuilder.reset(),this.renderCommonObjectPool.reset(),this.renderGraphPool.reset(),this.viewport.reset(),this.samplerInfo.reset(),this.color.reset(),this.renderQueueBuilder.reset(),this.renderSubpassBuilder.reset()},t}();function kat(t,e){switch(t){case 1:return e>1?4:0;case 2:return e>1?5:1;case 3:return 2;case 0:return 1}return 1}function Rat(t){switch(t){case 0:case 4:return 1;case 1:case 5:case 3:return 2;case 2:return 3}return 2}var Oat=function(t){function e(e,i,n,r,s){var a;return(a=t.call(this,e,i)||this)._renderGraph=void 0,a._scene=void 0,a._renderGraph=n,a._scene=s,a._vertID=r,a}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r){this._data=t,this._lg=e,this._renderGraph=i,this._scene=r,this._vertID=n},i.useLightFrustum=function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=void 0),this._scene.light.light=t,this._scene.light.level=e,this._scene.light.culledByLight=!0,i&&(this._scene.camera=i),!(32768&this._scene.flags)){var n=this._renderGraph.getParent(this._vertID),r=this._renderGraph.getParent(n);this._renderGraph.getLayout(r),Ert(this,this._scene.camera,t,e)}},e}(Ort),Fat=function(t){function e(e,i,n,r,s,a){var o;return(o=t.call(this,e,n)||this)._renderGraph=void 0,o._queue=void 0,o._pipeline=void 0,o._renderGraph=i,o._vertID=r,o._queue=s,o._pipeline=a,o}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s){this._data=t,this._lg=i,this._renderGraph=e,this._vertID=n,this._queue=r,this._pipeline=s},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.addSceneOfCamera=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n="Camera");var r=e.light,s=Bat.createSceneData(t.scene,t,i,!r||8&i?1:5,r);this._renderGraph.addVertex(9,s,n,"",Bat.createRenderData(),!0,this._vertID),this.getParentLayout();var a=C.director.getScene();Crt(this,t,this._pipeline,t.scene||(a?a.renderScene:null)),8&i||r&&0!==r.type?Ert(this,t,r,e.level):Rrt(this,t)},i.addScene=function(t,e,i,n){void 0===e&&(e=0),void 0===i&&(i=void 0),void 0===n&&(n=void 0);var r=Bat.createSceneData(n||t.scene,t,e,!i||8&e?1:5,i),s=Bat.createRenderData(),a=this._renderGraph.addVertex(9,r,"Scene","",s,!0,this._vertID);32768&e||(this.getParentLayout(),Crt(this,t,this._pipeline,n||t.scene),i&&0!==i.type?Ert(this,t,i,0):8&e||Rrt(this,t));var o=Iat.sceneBuilder.add();return o.update(s,this._lg,this._renderGraph,a,r),o},i.addFullscreenQuad=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n="Quad"),this._renderGraph.addVertex(10,Bat.createBlit(t,e,i,null),n,"",Bat.createRenderData(),!0,this._vertID),this.getParentLayout();var r=C.director.getScene();Crt(this,null,this._pipeline,r?r.renderScene:null),8&i||Rrt(this,null)},i.addCameraQuad=function(t,e,i,n){void 0===n&&(n=0),this._renderGraph.addVertex(10,Bat.createBlit(e,i,n,t),"CameraQuad","",Bat.createRenderData(),!0,this._vertID),this.getParentLayout();var r=C.director.getScene();Crt(this,t,this._pipeline,t.scene||(r?r.renderScene:null)),8&n||Rrt(this,t)},i.clearRenderTarget=function(t,e){void 0===e&&(e=new n_);var i=Bat.createClearView(t,1);i.clearColor.copy(e),this._renderGraph.addVertex(12,[i],"ClearRenderTarget","",Bat.createRenderData(),!0,this._vertID)},i.setViewport=function(t){var e=Iat.viewport.add();this._queue.viewport=e.copy(t)},i.addCustomCommand=function(){throw new Error("Method not implemented.")},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}]),e}(Ort),Lat=function(t){function e(e,i,n,r,s,a){var o;(o=t.call(this,e,n)||this)._renderGraph=void 0,o._layoutID=void 0,o._subpass=void 0,o._pipeline=void 0,o._renderGraph=i,o._vertID=r,o._subpass=s,o._pipeline=a;var h=o._renderGraph.getLayout(o._vertID);return o._layoutID=n.locateChild(n.N,h),o}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s){this._data=t,this._lg=i,this._renderGraph=e,this._vertID=n,this._subpass=r,this._pipeline=s;var a=this._renderGraph.getLayout(this._vertID);this._layoutID=i.locateChild(i.N,a)},i.addRenderTarget=function(){throw new Error("Method not implemented.")},i.setCustomShaderStages=function(){throw new Error("Method not implemented.")},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.addDepthStencil=function(){throw new Error("Method not implemented.")},i.addTexture=function(){throw new Error("Method not implemented.")},i.addStorageBuffer=function(){throw new Error("Method not implemented.")},i.addStorageImage=function(){throw new Error("Method not implemented.")},i.setViewport=function(){throw new Error("Method not implemented.")},i.addQueue=function(t,e){void 0===t&&(t=1),void 0===e&&(e="default");var i=this._lg.locateChild(this._layoutID,e),n=Bat.createRenderQueue(t,i),r=Bat.createRenderData(),s=this._renderGraph.addVertex(8,n,"",e,r,!0,this._vertID),a=Iat.renderQueueBuilder.add();return a.update(r,this._renderGraph,this._lg,s,n,this._pipeline),a},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}},{key:"showStatistics",get:function(){return this._subpass.showStatistics},set:function(t){this._subpass.showStatistics=t}}]),e}(Ort),Vat=function(t){function e(e,i,n,r,s,a,o){var h;(h=t.call(this,e,n)||this)._renderGraph=void 0,h._layoutID=void 0,h._pass=void 0,h._pipeline=void 0,h._resourceGraph=void 0,h._renderGraph=i,h._resourceGraph=r,h._vertID=s,h._pass=a,h._pipeline=o;var u=h._renderGraph.getLayout(h._vertID);return h._layoutID=n.locateChild(n.N,u),h}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s,a){this._renderGraph=e,this._lg=i,this._resourceGraph=n,this._vertID=r,this._pass=s,this._pipeline=a,this._data=t;var o=this._renderGraph.getLayout(this._vertID);this._layoutID=i.locateChild(i.N,o)},i.setCustomShaderStages=function(){throw new Error("Method not implemented.")},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.setVersion=function(t,e){this._pass.versionName=t,this._pass.version=e},i.addRenderTarget=function(t,e,i,n){void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=new n_);var r=1;0===e&&(r=0);var s=Bat.createRasterView("",2,0,e,i,r);s.clearColor.copy(n),this._pass.rasterViews.set(t,s)},i.addDepthStencil=function(t,e,i,n,r,s){void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=6);var a=Bat.createRasterView("",2,1,e,i,s);a.clearColor.set(n,r,0,0),this._pass.rasterViews.set(t,a)},i.resolveRenderTarget=function(){},i.resolveDepthStencil=function(){},i._addComputeResource=function(t,e,i){var n,r=Bat.createComputeView(i);r.accessType=e,this._pass.computeViews.has(t)?null==(n=this._pass.computeViews.get(t))||n.push(r):this._pass.computeViews.set(t,[r])},i.addTexture=function(t,e,i){if(void 0===i&&(i=null),this._addComputeResource(t,0,e),i){var n=this._lg.attributeIndex.get(e);this._data.samplers.set(n,i)}},i.addStorageBuffer=function(t,e,i){this._addComputeResource(t,e,i)},i.addStorageImage=function(t,e,i){this._addComputeResource(t,e,i)},i.addRenderSubpass=function(t){void 0===t&&(t="");var e="Raster",i=this._pass.subpassGraph.nv();this._pass.subpassGraph.addVertex(e,Bat.createSubpass());var n=Bat.createRasterSubpass(i,1,0),r=Bat.createRenderData(),s=this._renderGraph.addVertex(1,n,e,t,r,!0),a=Iat.renderSubpassBuilder.add();return a.update(r,this._renderGraph,this._lg,s,n,this._pipeline),a},i.addQueue=function(t,e){void 0===t&&(t=1),void 0===e&&(e="default");var i=this._lg.locateChild(this._layoutID,e),n=Bat.createRenderQueue(t,i),r=Bat.createRenderData(),s=this._renderGraph.addVertex(8,n,"",e,r,!0,this._vertID),a=Iat.renderQueueBuilder.add();return a.update(r,this._renderGraph,this._lg,s,n,this._pipeline),a},i.addFullscreenQuad=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n="FullscreenQuad");var r=Bat.createRenderQueue(3),s=this._renderGraph.addVertex(8,r,"Queue","",Bat.createRenderData(),!0,this._vertID);this._renderGraph.addVertex(10,Bat.createBlit(t,e,i,null),n,"",Bat.createRenderData(),!0,s)},i.addCameraQuad=function(t,e,i,n,r){void 0===r&&(r="CameraQuad");var s=Bat.createRenderQueue(3),a=this._renderGraph.addVertex(8,s,"Queue","",Bat.createRenderData(),!0,this._vertID);this._renderGraph.addVertex(10,Bat.createBlit(e,i,n,t),r,"",Bat.createRenderData(),!0,a)},i.setViewport=function(t){this._pass.viewport.copy(t)},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}},{key:"showStatistics",get:function(){return this._pass.showStatistics},set:function(t){this._pass.showStatistics=t}}]),e}(Ort),Nat=function(t){function e(e,i,n,r,s,a){var o;return(o=t.call(this,e,n)||this)._renderGraph=void 0,o._queue=void 0,o._pipeline=void 0,o._renderGraph=i,o._vertID=r,o._queue=s,o._pipeline=a,o}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s){this._data=t,this._lg=i,this._renderGraph=e,this._vertID=n,this._queue=r,this._pipeline=s},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.addDispatch=function(t,e,i,n,r,s){void 0===n&&(n=null),void 0===r&&(r=0),void 0===s&&(s="Dispatch"),this._renderGraph.addVertex(11,Bat.createDispatch(n,r,t,e,i),s,"",Bat.createRenderData(),!0,this._vertID)},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}]),e}(Ort),zat=function(t){function e(e,i,n,r,s,a,o){var h;(h=t.call(this,e,n)||this)._renderGraph=void 0,h._resourceGraph=void 0,h._layoutID=void 0,h._pass=void 0,h._pipeline=void 0,h._renderGraph=i,h._resourceGraph=r,h._vertID=s,h._pass=a,h._pipeline=o;var u=h._renderGraph.getLayout(h._vertID);return h._layoutID=n.locateChild(n.N,u),h}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s,a){this._data=t,this._renderGraph=e,this._lg=i,this._resourceGraph=n,this._vertID=r,this._pass=s,this._pipeline=a;var o=this._renderGraph.getLayout(this._vertID);this._layoutID=i.locateChild(i.N,o)},i.setCustomShaderStages=function(){throw new Error("Method not implemented.")},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.addTexture=function(){throw new Error("Method not implemented.")},i.addStorageBuffer=function(t,e,i){this._addComputeResource(t,e,i)},i.addStorageImage=function(t,e,i){this._addComputeResource(t,e,i)},i.addMaterialTexture=function(){throw new Error("Method not implemented.")},i.addQueue=function(t){void 0===t&&(t="default");var e=this._lg.locateChild(this._layoutID,t),i=Bat.createRenderQueue(1,e),n=Bat.createRenderData(),r=this._renderGraph.addVertex(8,i,"",t,n,!0,this._vertID),s=Iat.computeQueueBuilder.add();return s.update(n,this._renderGraph,this._lg,r,i,this._pipeline),s},i._addComputeResource=function(t,e,i){var n,r=Bat.createComputeView(i);r.accessType=e,this._pass.computeViews.has(t)?null==(n=this._pass.computeViews.get(t))||n.push(r):this._pass.computeViews.set(t,[r])},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}]),e}(Ort);!function(){function t(t,e,i){this._renderGraph=void 0,this._vertID=void 0,this._pass=void 0,this._renderGraph=t,this._vertID=e,this._pass=i}var e=t.prototype;e.setCustomBehavior=function(){throw new Error("Method not implemented.")},e.addPair=function(t){this._pass.movePairs.push(t)},n(t,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}])}(),function(){function t(t,e,i){this._renderGraph=void 0,this._vertID=void 0,this._pass=void 0,this._renderGraph=t,this._vertID=e,this._pass=i}var e=t.prototype;e.addPair=function(){throw new Error("Method not implemented.")},e.setCustomBehavior=function(){throw new Error("Method not implemented.")},n(t,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}])}();var Uat=function(){function t(t){this.globalDSManager=void 0,this.descriptorSetLayout=void 0,this.descriptorSet=void 0,this._width=0,this._height=0,this._usesDeferredPipeline=!1,this._copyPassMat=new FT,this._device=void 0,this._defaultSampler=void 0,this._profilerDescriptorSet=null,this._macros={},this._pipelineSceneData=new bk,this._constantMacros="",this._lightingMode=1,this._profiler=null,this._cameras=[],this._resourceUses=[],this._layoutGraph=void 0,this._resourceGraph=new qit,this._renderGraph=null,this._compiler=null,this._executor=null,this._customPipelineName="",this._globalDescSetData=void 0,this._combineSignY=0,this._layoutGraph=t}var e=t.prototype;return e.addCustomBuffer=function(){throw new Error("Method not implemented.")},e.addCustomTexture=function(){throw new Error("Method not implemented.")},e.tryAddRenderWindowDepthStencil=function(t,e,i,n){i&&(n?this.addDepthStencilImpl(i,n.depthStencilTexture.format,t,e,4,n):this.addDepthStencilImpl(i,55,t,e,0))},e.addRenderWindow=function(t,e,i,n,r,s){var a=this._resourceGraph.find(t);if(4294967295!==a)return this.updateRenderWindow(t,r,s),a;this.tryAddRenderWindowDepthStencil(i,n,s,r.swapchain);var o=new Dit;return o.dimension=2,o.width=i,o.height=n,o.depthOrArraySize=1,o.mipLevels=1,o.format=r.framebuffer.colorTextures[0].format,o.flags=16,r.swapchain?this._resourceGraph.addVertex(6,new Bit(r.swapchain),t,o,new Iit(4),new Mit,new p_):(o.sampleCount=r.framebuffer.colorTextures[0].info.samples,this._resourceGraph.addVertex(5,r.framebuffer,t,o,new Iit(3),new Mit,new p_))},e.updateRenderWindow=function(t,e,i){var n=this.resourceGraph.vertex(t),r=this.resourceGraph.getDesc(n);r.width=e.width,r.height=e.height,this.resourceGraph.object(n)!==e.framebuffer&&(this.resourceGraph.x[n].j=e.framebuffer),this.tryAddRenderWindowDepthStencil(e.width,e.height,i,e.swapchain)},e.updateStorageBuffer=function(t,e,i){void 0===i&&(i=0);var n=this.resourceGraph.vertex(t),r=this.resourceGraph.getDesc(n);r.width=e,0!==i&&(r.format=i)},e.updateRenderTarget=function(t,e,i,n){void 0===n&&(n=0);var r=this.resourceGraph.vertex(t),s=this.resourceGraph.getDesc(r);s.width=e,s.height=i,0!==n&&(s.format=n)},e.updateDepthStencil=function(t,e,i,n){void 0===n&&(n=0);var r=this.resourceGraph.find(t);4294967295!==r&&this.updateDepthStencilImpl(r,e,i,n)},e.updateStorageTexture=function(t,e,i,n){void 0===n&&(n=0);var r=this.resourceGraph.vertex(t),s=this.resourceGraph.getDesc(r);s.width=e,s.height=i,0!==n&&(s.format=n)},e.updateShadingRateTexture=function(t,e,i){var n=this.resourceGraph.vertex(t),r=this.resourceGraph.getDesc(n);r.width=e,r.height=i},e.addBuffer=function(t,e,i,n){var r=this._resourceGraph.find(t);if(4294967295!==r)return this.updateBuffer(t,e),r;var s=new Dit;return s.dimension=0,s.width=e,s.flags=i,this._resourceGraph.addVertex(0,new Oit,t,s,new Iit(n),new Mit,new p_(2,2,0,2,2,2))},e.updateBuffer=function(t,e){this.updateResource(t,0,e,0,0,0,0,1)},e.addExternalTexture=function(){throw new Error("Method not implemented.")},e.updateExternalTexture=function(){throw new Error("Method not implemented.")},e.addTexture=function(t,e,i,n,r,s,a,o,h,u,l){var c=this._resourceGraph.find(t);if(4294967295!==c)return this.updateTexture(t,i,n,r,s,a,o,h),c;var f=new Dit;return f.dimension=Rat(e),f.width=n,f.height=r,f.depthOrArraySize=3===f.dimension?s:a,f.mipLevels=o,f.format=i,f.sampleCount=h,f.flags=u,f.viewType=e,this._resourceGraph.addVertex(0,new Oit,t,f,new Iit(l),new Mit,new p_(2,2,0,2,2,2))},e.updateTexture=function(t,e,i,n,r,s,a,o){this.updateResource(t,e,i,n,r,s,a,o)},e.addResource=function(t,e,i,n,r,s,a,o,h,u,l){var c=this._resourceGraph.find(t);return 4294967295!==c?(this.updateResource(t,i,n,r,s,a,o,h),c):0===e?this.addBuffer(t,n,u,l):this.addTexture(t,kat(e,a),i,n,r,s,a,o,h,u,l)},e.updateResource=function(t,e,i,n,r,s,a,o){var h=this.resourceGraph.vertex(t),u=this.resourceGraph.getDesc(h);u.width=i,u.height=n,u.depthOrArraySize=3===u.dimension?r:s,u.mipLevels=a,0!==e&&(u.format=e),u.sampleCount=o},e.containsResource=function(t){return this._resourceGraph.contains(t)},e.addResolvePass=function(){throw new Error("Method not implemented.")},e.addComputePass=function(t){var e=Bat.createComputePass(),i=Bat.createRenderData(),n=this._renderGraph.addVertex(3,e,"Compute",t,i,!0),r=Iat.computePassBuilder.add();return r.update(i,this._renderGraph,this._layoutGraph,this._resourceGraph,n,e,this._pipelineSceneData),C.director.root.pipeline,r},e.addUploadPass=function(t){for(var e,i=Bat.createCopyPass(),n=p(t);!(e=n()).done;){var r=e.value;i.uploadPairs.push(r)}this._renderGraph.addVertex(5,i,"UploadPass","",Bat.createRenderData(),!0)},e.addCopyPass=function(t){for(var e,i=p(t);!(e=i()).done;){var n=e.value,r=n.target,s=this.resourceGraph.find(r),a=this.resourceGraph.getDesc(s),o=this.addRenderPass(a.width,a.height,"copy-pass");o.addRenderTarget(r,1,0,Iat.createColor()),o.addTexture(n.source,"outputResultMap"),o.addQueue(0).addFullscreenQuad(this._copyPassMat,0,0)}},e._generateConstantMacros=function(){var t="";t+="#define CC_DEVICE_SUPPORT_FLOAT_TEXTURE "+(3&this._device.getFormatFeatures(44)?1:0)+"\n",t+="#define CC_DEVICE_MAX_VERTEX_UNIFORM_VECTORS "+this._device.capabilities.maxVertexUniformVectors+"\n",t+="#define CC_DEVICE_MAX_FRAGMENT_UNIFORM_VECTORS "+this._device.capabilities.maxFragmentUniformVectors+"\n",t+="#define CC_DEVICE_CAN_BENEFIT_FROM_INPUT_ATTACHMENT "+(this._device.hasFeature(5)?1:0)+"\n",t+="#define CC_PLATFORM_ANDROID_AND_WEBGL "+(Lo.os===Eo.ANDROID&&Lo.isBrowser?1:0)+"\n",t+="#define CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES "+(Ue.ENABLE_WEBGL_HIGHP_STRUCT_VALUES?1:0)+"\n",t+="#define CC_JOINT_UNIFORM_CAPACITY "+Qb.JOINT_UNIFORM_CAPACITY+"\n",this._constantMacros=t,this._layoutGraph.constantMacros=this._constantMacros},e.setCustomPipelineName=function(t){this._customPipelineName=t,"Deferred"===this._customPipelineName&&(this._usesDeferredPipeline=!0)},e.getGlobalDescriptorSetData=function(){var t=this.layoutGraph.locateChild(this.layoutGraph.N,"default");return this.layoutGraph.getLayout(t).getSet(3)},e._initCombineSignY=function(){var t=this._device;this._combineSignY=.5*t.capabilities.screenSpaceSignY+.5<<1|.5*t.capabilities.clipSpaceSignY+.5},e.getCombineSignY=function(){return this._combineSignY},e._compileMaterial=function(){this._copyPassMat.initialize({effectName:"pipeline/copy-pass"});for(var t=0;t=t.CSM_UNIFORM_VECTORS+t.GLOBAL_UNIFORM_VECTORS,this.setMacroBool("CC_SUPPORT_CASCADED_SHADOW_MAP",this.pipelineSceneData.csmSupported),this.setMacroInt("CC_SHADOW_TYPE",0),this.setMacroInt("CC_DIR_SHADOW_PCF_TYPE",NT.HARD),this.setMacroInt("CC_DIR_LIGHT_SHADOW_TYPE",0),this.setMacroBool("CC_CASCADED_LAYERS_TRANSITION",!1),this.usesDeferredPipeline&&this.setMacroInt("CC_PIPELINE_TYPE",1),!0},e.destroy=function(){var t;return null==(t=this._pipelineSceneData)||t.destroy(),!0},e.getMacroString=function(t){var e=this._macros[t];return void 0===e?"":e},e.getMacroInt=function(t){var e=this._macros[t];return void 0===e?0:e},e.getMacroBool=function(t){var e=this._macros[t];return void 0!==e&&e},e.getSamplerInfo=function(t){if(this.containsResource(t)){var e=this._resourceGraph.vertex(t);return this._resourceGraph.getSampler(e)}return null},e.setMacroString=function(t,e){this._macros[t]=e},e.setMacroInt=function(t,e){this._macros[t]=e},e.setMacroBool=function(t,e){this._macros[t]=e},e.onGlobalPipelineStateChanged=function(){var t=C.rendering.getCustomPipeline(Ue.CUSTOM_PIPELINE_NAME);t&&("function"==typeof t.onGlobalPipelineStateChanged&&t.onGlobalPipelineStateChanged(),C.rendering.forceResizeAllWindows())},e.beginSetup=function(){this._renderGraph||(this._renderGraph=new snt),Iat.reset()},e.endSetup=function(){this.compile()},e.addStorageBuffer=function(t,e,i,n){void 0===n&&(n=0);var r=this._resourceGraph.find(t);if(4294967295!==r)return this.updateStorageBuffer(t,i,e),r;var s=new Dit;return s.dimension=0,s.width=i,s.height=1,s.depthOrArraySize=1,s.mipLevels=1,s.format=e,s.flags=4,2===n?this._resourceGraph.addVertex(3,new Eit,t,s,new Iit(2),new Mit,new p_):this._resourceGraph.addVertex(1,new Pit,t,s,new Iit(n),new Mit,new p_)},e.addRenderTarget=function(t,e,i,n,r){void 0===r&&(r=0);var s=this._resourceGraph.find(t);if(4294967295!==s)return this.updateRenderTarget(t,i,n,e),s;var a=new Dit;return a.dimension=2,a.width=i,a.height=n,a.depthOrArraySize=1,a.mipLevels=1,a.format=e,a.sampleCount=1,a.flags=24,this._resourceGraph.addVertex(0,new Oit,t,a,new Iit(r),new Mit,new p_(2,2,0,2,2,2))},e.updateDepthStencilImpl=function(t,e,i,n,r){var s=this.resourceGraph.getDesc(t);if(s.width=e,s.height=i,r){var a=this.resourceGraph.j(t);a.swapchain=r,s.format=a.swapchain.depthStencilTexture.format}else 0!==n&&(s.format=n)},e.addDepthStencilImpl=function(t,e,i,n,r,s){var a=this._resourceGraph.find(t);if(4294967295!==a)return this.updateDepthStencilImpl(a,i,n,e,s),a;var o=new Dit;return o.dimension=2,o.width=i,o.height=n,o.depthOrArraySize=1,o.mipLevels=1,o.format=e,o.sampleCount=1,o.flags=40,s?this._resourceGraph.addVertex(6,new Bit(s,!0),t,o,new Iit(r),new Mit,new p_(1,1,0)):this._resourceGraph.addVertex(0,new Oit,t,o,new Iit(r),new Mit,new p_(1,1,0))},e.addDepthStencil=function(t,e,i,n,r){return void 0===r&&(r=0),this.addDepthStencilImpl(t,e,i,n,r)},e.addStorageTexture=function(t,e,i,n,r){void 0===r&&(r=0);var s=this._resourceGraph.find(t);if(4294967295!==s)return this.updateStorageTexture(t,i,n,e),s;var a=new Dit;return a.dimension=2,a.width=i,a.height=n,a.depthOrArraySize=1,a.mipLevels=1,a.format=e,a.flags=12,this._resourceGraph.addVertex(0,new Oit,t,a,new Iit(r),new Mit,new p_(1,1,0))},e.addShadingRateTexture=function(t,e,i,n){void 0===n&&(n=0);var r=this._resourceGraph.find(t);if(4294967295!==r)return this.addShadingRateTexture(t,e,i),r;var s=new Dit;return s.dimension=2,s.width=e,s.height=i,s.depthOrArraySize=1,s.mipLevels=1,s.format=6,s.flags=140,this._resourceGraph.addVertex(0,new Oit,t,s,new Iit(n),new Mit,new p_(2,2,0,2,2,2))},e.beginFrame=function(){C.director.buildRenderPipeline()},e.update=function(){},e.endFrame=function(){var t;null==(t=this.renderGraph)||t.clear()},e.compile=function(){if(!this._renderGraph)throw new Error("RenderGraph cannot be built without being created");this._renderGraph.x.forEach((function(t){0===t.t&&vrt(t.j)}))},e.execute=function(){if(!this._renderGraph)throw new Error("Cannot run without creating rendergraph");this._executor||(this._executor=new mat(this,this._device,this._resourceGraph,this.layoutGraph,this.width,this.height)),this._executor.resize(this.width,this.height),this._executor.execute(this._renderGraph)},e._applySize=function(t){var e=this,i=this._width,n=this._height;t.forEach((function(t){var r=t.window;i=Math.max(r.width,i),n=Math.max(r.height,n),e._cameras.includes(t)||e._cameras.push(t)})),i===this._width&&n===this._height||(this._width=i,this._height=n)},e.render=function(t){0!==t.length&&(this._applySize(t),RT(t),this.beginFrame(),this.execute(),this.endFrame())},e.addBuiltinReflectionProbePass=function(t){var e=C.internal.reflectionProbeManager;if(e){var i=e.getProbes();if(0!==i.length)for(var n=0;n>3)]+=(o.isCompositeModeEnabled(u)?1:0)*Math.pow(10,l)}h[3]+=(o.lightingWithAlbedo?1:0)*Math.pow(10,6),h[3]+=(o.csmLayerColoration?1:0)*Math.pow(10,7),Mat.set(h[0],h[1],h[2],h[3])}t.setVec4("cc_debug_view_mode",Mat)},n(t,[{key:"type",get:function(){return 0}},{key:"capabilities",get:function(){return new hnt}},{key:"enableCpuLightCulling",get:function(){return!this._executor||this._executor._context.culling.enableLightCulling},set:function(t){this._executor&&(this._executor._context.culling.enableLightCulling=t)}},{key:"globalDescriptorSetData",get:function(){return this._globalDescSetData}},{key:"defaultSampler",get:function(){return this._defaultSampler}},{key:"defaultShadowTexture",get:function(){return zS(this.device)}},{key:"device",get:function(){return this._device}},{key:"lightingMode",get:function(){return this._lightingMode},set:function(t){this._lightingMode=t}},{key:"usesDeferredPipeline",get:function(){return this._usesDeferredPipeline}},{key:"macros",get:function(){return this._macros}},{key:"profilerDescriptorSet",get:function(){return this._profilerDescriptorSet}},{key:"commandBuffers",get:function(){return[this._device.commandBuffer]}},{key:"pipelineSceneData",get:function(){return this._pipelineSceneData}},{key:"constantMacros",get:function(){return this._constantMacros}},{key:"profiler",get:function(){return this._profiler},set:function(t){this._profiler=t}},{key:"geometryRenderer",get:function(){throw new Error("Method not implemented.")}},{key:"shadingScale",get:function(){return this._pipelineSceneData.shadingScale},set:function(t){this._pipelineSceneData.shadingScale=t}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"renderGraph",get:function(){return this._renderGraph}},{key:"resourceGraph",get:function(){return this._resourceGraph}},{key:"layoutGraph",get:function(){return this._layoutGraph}},{key:"resourceUses",get:function(){return this._resourceUses}}]),t}();Uat.MAX_BLOOM_FILTER_PASS_NUM=6,Uat.CSM_UNIFORM_VECTORS=61,Uat.GLOBAL_UNIFORM_VECTORS=64,function(){function t(){this.capacity=0,this.size=0,this.buffer=void 0,this.dataView=void 0,this.capacity=4096,this.buffer=new Uint8Array(this.capacity),this.dataView=new DataView(this.buffer.buffer)}var e=t.prototype;e.b=function(t){var e=this.size+1;e>this.capacity&&this.reserve(e),this.dataView.setUint8(this.size,t?1:0),this.size=e},e.n=function(t){var e=this.size+8;e>this.capacity&&this.reserve(e),this.dataView.setFloat64(this.size,t,!0),this.size=e},e.s=function(t){this.n(t.length);var e=this.size+t.length;e>this.capacity&&this.reserve(e);for(var i=0;i=8){var i=new Uint8Array(e);if(new DataView(i.buffer,i.byteOffset,8).getUint32(0)===yot){var n=new cR.Inflate(new Uint8Array(i.buffer,i.byteOffset+8)).decompress();znt(new Gat(n.buffer,n.byteOffset),bot)}else znt(new Gat(i.buffer,i.byteOffset),bot)}ust(t,bot)},loadCopyPair:function(t,e){e.source=t.s(),e.target=t.s(),e.mipLevels=t.n(),e.numSlices=t.n(),e.sourceMostDetailedMip=t.n(),e.sourceFirstSlice=t.n(),e.sourcePlaneSlice=t.n(),e.targetMostDetailedMip=t.n(),e.targetFirstSlice=t.n(),e.targetPlaneSlice=t.n()},loadLightInfo:function(t,e){e.level=t.n(),e.culledByLight=t.b()},loadMovePair:function(t,e){e.source=t.s(),e.target=t.s(),e.mipLevels=t.n(),e.numSlices=t.n(),e.targetMostDetailedMip=t.n(),e.targetFirstSlice=t.n(),e.targetPlaneSlice=t.n()},loadPipelineStatistics:function(t,e){e.numRenderPasses=t.n(),e.numManagedTextures=t.n(),e.totalManagedTextures=t.n(),e.numUploadBuffers=t.n(),e.numUploadBufferViews=t.n(),e.numFreeUploadBuffers=t.n(),e.numFreeUploadBufferViews=t.n(),e.numDescriptorSets=t.n(),e.numFreeDescriptorSets=t.n(),e.numInstancingBuffers=t.n(),e.numInstancingUniformBlocks=t.n()},loadResolvePair:function(t,e){e.source=t.s(),e.target=t.s(),e.resolveFlags=t.n(),e.mode=t.n(),e.mode1=t.n()},packRGBE:function(t){var e=Math.max(Math.max(t.x,t.y),t.z),i=128;e>1e-4&&(i=Math.log(e)/Math.log(1.1),i=$i((i=Math.ceil(i))+128,0,255));var n=1/Math.pow(1.1,i-128),r=dr(t.multiplyScalar(n),new ir(0,0,0),new ir(1,1,1));r.multiplyScalar(255);var s,a,o=_r(r).add((s=r.subtract(_r(r)))<(a=new ir(.5,.5,.5))?a:s);return new Vn(o.x/255,o.y/255,o.z/255,i/255)},programLib:Sot,saveCopyPair:function(t,e){t.s(e.source),t.s(e.target),t.n(e.mipLevels),t.n(e.numSlices),t.n(e.sourceMostDetailedMip),t.n(e.sourceFirstSlice),t.n(e.sourcePlaneSlice),t.n(e.targetMostDetailedMip),t.n(e.targetFirstSlice),t.n(e.targetPlaneSlice)},saveLightInfo:function(t,e){t.n(e.level),t.b(e.culledByLight)},saveMovePair:function(t,e){t.s(e.source),t.s(e.target),t.n(e.mipLevels),t.n(e.numSlices),t.n(e.targetMostDetailedMip),t.n(e.targetFirstSlice),t.n(e.targetPlaneSlice)},savePipelineStatistics:function(t,e){t.n(e.numRenderPasses),t.n(e.numManagedTextures),t.n(e.totalManagedTextures),t.n(e.numUploadBuffers),t.n(e.numUploadBufferViews),t.n(e.numFreeUploadBuffers),t.n(e.numFreeUploadBufferViews),t.n(e.numDescriptorSets),t.n(e.numFreeDescriptorSets),t.n(e.numInstancingBuffers),t.n(e.numInstancingUniformBlocks)},saveResolvePair:function(t,e){t.s(e.source),t.s(e.target),t.n(e.resolveFlags),t.n(e.mode),t.n(e.mode1)},setCustomPipeline:function(t,e){xot.set(t,e),got()},setEditorPipelineSettings:function(t){pot=t,mot=!0}});t("eF",wot),A.rendering=wot;var Tot=Object.setPrototypeOf,Cot={};!function(t){var e=function(){function e(i){this._clock=new t.WorldClock,this._events=[],this._objects=[],this._eventManager=null,this._eventManager=i,console.info("DragonBones: "+e.VERSION+"\nWebsite: http://dragonbones.com/\nSource and Demo: https://github.com/DragonBones/")}return e.prototype.advanceTime=function(e){if(this._objects.length>0){for(var i=0,n=this._objects;i0){for(var r=0;ri&&(r.length=i),t._maxCountMap[n]=i;else for(var n in t._defaultMaxCount=i,t._poolsMap){var r;(r=t._poolsMap[n]).length>i&&(r.length=i),n in t._maxCountMap&&(t._maxCountMap[n]=i)}},t.clearPool=function(e){if(void 0===e&&(e=null),null!==e){var i=String(e);null!==(r=i in t._poolsMap?t._poolsMap[i]:null)&&r.length>0&&(r.length=0)}else for(var n in t._poolsMap){var r;(r=t._poolsMap[n]).length=0}},t.borrowObject=function(e){var i=String(e),n=i in t._poolsMap?t._poolsMap[i]:null;if(null!==n&&n.length>0){var r=n.pop();return r._isInPool=!1,r}var s=new e;return s._onClear(),s},t.prototype.returnToPool=function(){this._onClear(),t._returnObject(this)},t._hashCode=0,t._defaultMaxCount=3e3,t._maxCountMap={},t._poolsMap={},t}();t.BaseObject=e}(Cot),function(t){var e=function(){function t(t,e,i,n,r,s){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),this.a=t,this.b=e,this.c=i,this.d=n,this.tx=r,this.ty=s}return t.prototype.toString=function(){return"[object dragonBones.Matrix] a:"+this.a+" b:"+this.b+" c:"+this.c+" d:"+this.d+" tx:"+this.tx+" ty:"+this.ty},t.prototype.copyFrom=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},t.prototype.copyFromArray=function(t,e){return void 0===e&&(e=0),this.a=t[e],this.b=t[e+1],this.c=t[e+2],this.d=t[e+3],this.tx=t[e+4],this.ty=t[e+5],this},t.prototype.identity=function(){return this.a=this.d=1,this.b=this.c=0,this.tx=this.ty=0,this},t.prototype.concat=function(t){var e=this.a*t.a,i=0,n=0,r=this.d*t.d,s=this.tx*t.a+t.tx,a=this.ty*t.d+t.ty;return 0===this.b&&0===this.c||(e+=this.b*t.c,i+=this.b*t.d,n+=this.c*t.a,r+=this.c*t.b),0===t.b&&0===t.c||(i+=this.a*t.b,n+=this.d*t.c,s+=this.ty*t.c,a+=this.tx*t.b),this.a=e,this.b=i,this.c=n,this.d=r,this.tx=s,this.ty=a,this},t.prototype.invert=function(){var t=this.a,e=this.b,i=this.c,n=this.d,r=this.tx,s=this.ty;if(0===e&&0===i)return this.b=this.c=0,0===t||0===n?this.a=this.b=this.tx=this.ty=0:(t=this.a=1/t,n=this.d=1/n,this.tx=-t*r,this.ty=-n*s),this;var a=t*n-e*i;if(0===a)return this.a=this.d=1,this.b=this.c=0,this.tx=this.ty=0,this;a=1/a;var o=this.a=n*a;return e=this.b=-e*a,i=this.c=-i*a,n=this.d=t*a,this.tx=-(o*r+i*s),this.ty=-(e*r+n*s),this},t.prototype.transformPoint=function(t,e,i,n){void 0===n&&(n=!1),i.x=this.a*t+this.c*e,i.y=this.b*t+this.d*e,n||(i.x+=this.tx,i.y+=this.ty)},t.prototype.transformRectangle=function(t,e){void 0===e&&(e=!1);var i=this.a,n=this.b,r=this.c,s=this.d,a=e?0:this.tx,o=e?0:this.ty,h=t.x,u=t.y,l=h+t.width,c=u+t.height,f=i*h+r*u+a,d=n*h+s*u+o,_=i*l+r*u+a,p=n*l+s*u+o,m=i*l+r*c+a,g=n*l+s*c+o,v=i*h+r*c+a,y=n*h+s*c+o,b=0;f>_&&(b=f,f=_,_=b),m>v&&(b=m,m=v,v=b),t.x=Math.floor(fv?_:v)-t.x),d>p&&(b=d,d=p,p=b),g>y&&(b=g,g=y,y=b),t.y=Math.floor(dy?p:y)-t.y)},t}();t.Matrix=e}(Cot),function(t){var e=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=1),this.x=t,this.y=e,this.skew=i,this.rotation=n,this.scaleX=r,this.scaleY=s}return t.normalizeRadian=function(t){return(t=(t+Math.PI)%(2*Math.PI))+(t>0?-Math.PI:Math.PI)},t.prototype.toString=function(){return"[object dragonBones.Transform] x:"+this.x+" y:"+this.y+" skewX:"+180*this.skew/Math.PI+" skewY:"+180*this.rotation/Math.PI+" scaleX:"+this.scaleX+" scaleY:"+this.scaleY},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.skew=t.skew,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this},t.prototype.identity=function(){return this.x=this.y=0,this.skew=this.rotation=0,this.scaleX=this.scaleY=1,this},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.skew+=t.skew,this.rotation+=t.rotation,this.scaleX*=t.scaleX,this.scaleY*=t.scaleY,this},t.prototype.minus=function(t){return this.x-=t.x,this.y-=t.y,this.skew-=t.skew,this.rotation-=t.rotation,this.scaleX/=t.scaleX,this.scaleY/=t.scaleY,this},t.prototype.fromMatrix=function(e){var i=this.scaleX,n=this.scaleY,r=t.PI_Q;this.x=e.tx,this.y=e.ty,this.rotation=Math.atan(e.b/e.a);var s=Math.atan(-e.c/e.d);return this.scaleX=this.rotation>-r&&this.rotation-r&&s=0&&this.scaleX<0&&(this.scaleX=-this.scaleX,this.rotation=this.rotation-Math.PI),n>=0&&this.scaleY<0&&(this.scaleY=-this.scaleY,s-=Math.PI),this.skew=s-this.rotation,this},t.prototype.toMatrix=function(t){return 0===this.rotation?(t.a=1,t.b=0):(t.a=Math.cos(this.rotation),t.b=Math.sin(this.rotation)),0===this.skew?(t.c=-t.b,t.d=t.a):(t.c=-Math.sin(this.skew+this.rotation),t.d=Math.cos(this.skew+this.rotation)),1!==this.scaleX&&(t.a*=this.scaleX,t.b*=this.scaleX),1!==this.scaleY&&(t.c*=this.scaleY,t.d*=this.scaleY),t.tx=this.x,t.ty=this.y,this},t.PI=Math.PI,t.PI_D=2*Math.PI,t.PI_H=Math.PI/2,t.PI_Q=Math.PI/4,t.RAD_DEG=180/Math.PI,t.DEG_RAD=Math.PI/180,t}();t.Transform=e}(Cot),function(t){var e=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=1),void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),this.alphaMultiplier=t,this.redMultiplier=e,this.greenMultiplier=i,this.blueMultiplier=n,this.alphaOffset=r,this.redOffset=s,this.greenOffset=a,this.blueOffset=o}return t.prototype.copyFrom=function(t){this.alphaMultiplier=t.alphaMultiplier,this.redMultiplier=t.redMultiplier,this.greenMultiplier=t.greenMultiplier,this.blueMultiplier=t.blueMultiplier,this.alphaOffset=t.alphaOffset,this.redOffset=t.redOffset,this.greenOffset=t.greenOffset,this.blueOffset=t.blueOffset},t.prototype.identity=function(){this.alphaMultiplier=this.redMultiplier=this.greenMultiplier=this.blueMultiplier=1,this.alphaOffset=this.redOffset=this.greenOffset=this.blueOffset=0},t}();t.ColorTransform=e}(Cot),function(t){var e=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.copyFrom=function(t){this.x=t.x,this.y=t.y},t.prototype.clear=function(){this.x=this.y=0},t}();t.Point=e}(Cot),function(t){var e=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.width=i,this.height=n}return t.prototype.copyFrom=function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},t.prototype.clear=function(){this.x=this.y=0,this.width=this.height=0},t}();t.Rectangle=e}(Cot),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.ints=[],e.floats=[],e.strings=[],e}return Tot(e,t),e.toString=function(){return"[class dragonBones.UserData]"},e.prototype._onClear=function(){this.ints.length=0,this.floats.length=0,this.strings.length=0},e.prototype.addInt=function(t){this.ints.push(t)},e.prototype.addFloat=function(t){this.floats.push(t)},e.prototype.addString=function(t){this.strings.push(t)},e.prototype.getInt=function(t){return void 0===t&&(t=0),t>=0&&t=0&&t=0&&t=t&&(i=0),!(this.sortedBones.indexOf(r)>=0)){var s=!1;for(var a in this.constraints){var o=this.constraints[a];if(o.root===r&&this.sortedBones.indexOf(o.target)<0){s=!0;break}}s||null!==r.parent&&this.sortedBones.indexOf(r.parent)<0||(this.sortedBones.push(r),n++)}}}},i.prototype.cacheFrames=function(t){if(!(this.cacheFrameRate>0))for(var e in this.cacheFrameRate=t,this.animations)this.animations[e].cacheFrames(this.cacheFrameRate)},i.prototype.setCacheFrame=function(t,e){var i=this.parent.cachedFrames,n=i.length;return i.length+=10,i[n]=t.a,i[n+1]=t.b,i[n+2]=t.c,i[n+3]=t.d,i[n+4]=t.tx,i[n+5]=t.ty,i[n+6]=e.rotation,i[n+7]=e.skew,i[n+8]=e.scaleX,i[n+9]=e.scaleY,n},i.prototype.getCacheFrame=function(t,e,i){var n=this.parent.cachedFrames;t.a=n[i],t.b=n[i+1],t.c=n[i+2],t.d=n[i+3],t.tx=n[i+4],t.ty=n[i+5],e.rotation=n[i+6],e.skew=n[i+7],e.scaleX=n[i+8],e.scaleY=n[i+9],e.x=t.tx,e.y=t.ty},i.prototype.addBone=function(t){t.name in this.bones?console.warn("Same bone: "+t.name):(this.bones[t.name]=t,this.sortedBones.push(t))},i.prototype.addSlot=function(t){t.name in this.slots?console.warn("Same slot: "+t.name):(this.slots[t.name]=t,this.sortedSlots.push(t))},i.prototype.addConstraint=function(t){t.name in this.constraints?console.warn("Same constraint: "+t.name):this.constraints[t.name]=t},i.prototype.addSkin=function(t){t.name in this.skins?console.warn("Same skin: "+t.name):(t.parent=this,this.skins[t.name]=t,null===this.defaultSkin&&(this.defaultSkin=t),"default"===t.name&&(this.defaultSkin=t))},i.prototype.addAnimation=function(t){t.name in this.animations?console.warn("Same animation: "+t.name):(t.parent=this,this.animations[t.name]=t,this.animationNames.push(t.name),null===this.defaultAnimation&&(this.defaultAnimation=t))},i.prototype.addAction=function(t,e){e?this.defaultActions.push(t):this.actions.push(t)},i.prototype.getBone=function(t){return t in this.bones?this.bones[t]:null},i.prototype.getSlot=function(t){return t in this.slots?this.slots[t]:null},i.prototype.getConstraint=function(t){return t in this.constraints?this.constraints[t]:null},i.prototype.getSkin=function(t){return t in this.skins?this.skins[t]:null},i.prototype.getMesh=function(t,e,i){var n=this.getSkin(t);return null===n?null:n.getDisplay(e,i)},i.prototype.getAnimation=function(t){return t in this.animations?this.animations[t]:null},i}(t.BaseObject);t.ArmatureData=e;var i=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.transform=new t.Transform,i.userData=null,i}return Tot(i,e),i.toString=function(){return"[class dragonBones.BoneData]"},i.prototype._onClear=function(){null!==this.userData&&this.userData.returnToPool(),this.inheritTranslation=!1,this.inheritRotation=!1,this.inheritScale=!1,this.inheritReflection=!1,this.type=0,this.length=0,this.name="",this.transform.identity(),this.userData=null,this.parent=null},i}(t.BaseObject);t.BoneData=i;var n=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.vertices=[],e}return Tot(e,t),e.toString=function(){return"[class dragonBones.SurfaceData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=1,this.segmentX=0,this.segmentY=0,this.vertices.length=0},e}(i);t.SurfaceData=n;var r=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.color=null,t.userData=null,t}return Tot(i,e),i.createColor=function(){return new t.ColorTransform},i.toString=function(){return"[class dragonBones.SlotData]"},i.prototype._onClear=function(){null!==this.userData&&this.userData.returnToPool(),this.blendMode=0,this.displayIndex=0,this.zOrder=0,this.name="",this.color=null,this.userData=null,this.parent=null},i.DEFAULT_COLOR=new t.ColorTransform,i}(t.BaseObject);t.SlotData=r}(Cot),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Tot(e,t),e.prototype._onClear=function(){this.order=0,this.name="",this.type=0,this.target=null,this.root=null,this.bone=null},e}(t.BaseObject);t.ConstraintData=e;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Tot(e,t),e.toString=function(){return"[class dragonBones.IKConstraintData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.scaleEnabled=!1,this.bendPositive=!1,this.weight=1},e}(e);t.IKConstraintData=i;var n=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.bones=[],e}return Tot(e,t),e.toString=function(){return"[class dragonBones.PathConstraintData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.pathSlot=null,this.pathDisplayData=null,this.bones.length=0,this.positionMode=0,this.spacingMode=1,this.rotateMode=1,this.position=0,this.spacing=0,this.rotateOffset=0,this.rotateMix=0,this.translateMix=0},e.prototype.AddBone=function(t){this.bones.push(t)},e}(e);t.PathConstraintData=n}(Cot),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Tot(e,t),e.toString=function(){return"[class dragonBones.CanvasData]"},e.prototype._onClear=function(){this.hasBackground=!1,this.color=0,this.x=0,this.y=0,this.width=0,this.height=0},e}(t.BaseObject);t.CanvasData=e}(Cot),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.displays={},e}return Tot(e,t),e.toString=function(){return"[class dragonBones.SkinData]"},e.prototype._onClear=function(){for(var t in this.displays){for(var e=0,i=this.displays[t];er&&(a|=2),es&&(a|=8),a},e.rectangleIntersectsSegment=function(t,i,n,r,s,a,o,h,u,l,c){void 0===u&&(u=null),void 0===l&&(l=null),void 0===c&&(c=null);var f=t>s&&ta&&is&&na&&r=-i&&t<=i){var n=.5*this.height;if(e>=-n&&e<=n)return!0}return!1},e.prototype.intersectsSegment=function(t,i,n,r,s,a,o){void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null);var h=.5*this.width,u=.5*this.height;return e.rectangleIntersectsSegment(t,i,n,r,-h,-u,h,u,s,a,o)},e}(e);t.RectangleBoundingBoxData=i;var n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Tot(e,t),e.toString=function(){return"[class dragonBones.EllipseData]"},e.ellipseIntersectsSegment=function(t,e,i,n,r,s,a,o,h,u,l){void 0===h&&(h=null),void 0===u&&(u=null),void 0===l&&(l=null);var c=a/o,f=c*c,d=i-t,_=(n*=c)-(e*=c),p=Math.sqrt(d*d+_*_),m=d/p,g=_/p,v=(r-t)*m+(s-e)*g,y=a*a,b=y-(t*t+e*e)+v*v,S=0;if(b>=0){var x=Math.sqrt(b),w=v-x,T=v+x,C=w<0?-1:w<=p?0:1,A=T<0?-1:T<=p?0:1,D=C*A;if(D<0)return-1;0===D&&(-1===C?(S=2,i=t+T*m,n=(e+T*g)/c,null!==h&&(h.x=i,h.y=n),null!==u&&(u.x=i,u.y=n),null!==l&&(l.x=Math.atan2(n/y*f,i/y),l.y=l.x+Math.PI)):1===A?(S=1,t+=w*m,e=(e+w*g)/c,null!==h&&(h.x=t,h.y=e),null!==u&&(u.x=t,u.y=e),null!==l&&(l.x=Math.atan2(e/y*f,t/y),l.y=l.x+Math.PI)):(S=3,null!==h&&(h.x=t+w*m,h.y=(e+w*g)/c,null!==l&&(l.x=Math.atan2(h.y/y*f,h.x/y))),null!==u&&(u.x=t+T*m,u.y=(e+T*g)/c,null!==l&&(l.y=Math.atan2(u.y/y*f,u.x/y)))))}return S},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=1},e.prototype.containsPoint=function(t,e){var i=.5*this.width;if(t>=-i&&t<=i){var n=.5*this.height;if(e>=-n&&e<=n)return e*=i/n,Math.sqrt(t*t+e*e)<=i}return!1},e.prototype.intersectsSegment=function(t,i,n,r,s,a,o){return void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null),e.ellipseIntersectsSegment(t,i,n,r,0,0,.5*this.width,.5*this.height,s,a,o)},e}(e);t.EllipseBoundingBoxData=n;var r=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.vertices=[],e}return Tot(e,t),e.toString=function(){return"[class dragonBones.PolygonBoundingBoxData]"},e.polygonIntersectsSegment=function(t,e,i,n,r,s,a,o){void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null),t===i&&(t=i+1e-6),e===n&&(e=n+1e-6);for(var h=r.length,u=t-i,l=e-n,c=t*n-e*i,f=0,d=r[h-2],_=r[h-1],p=0,m=0,g=0,v=0,y=0,b=0,S=0;S=d&&I<=x||I>=x&&I<=d)&&(0===u||I>=t&&I<=i||I>=i&&I<=t)){var B=(c*C-l*A)/D;if((B>=_&&B<=w||B>=w&&B<=_)&&(0===l||B>=e&&B<=n||B>=n&&B<=e)){if(null===a){g=I,v=B,y=I,b=B,f++,null!==o&&(o.x=Math.atan2(w-_,x-d)-.5*Math.PI,o.y=o.x);break}var M=I-t;M<0&&(M=-M),0===f?(p=M,m=M,g=I,v=B,y=I,b=B,null!==o&&(o.x=Math.atan2(w-_,x-d)-.5*Math.PI,o.y=o.x)):(Mm&&(m=M,y=I,b=B,null!==o&&(o.y=Math.atan2(w-_,x-d)-.5*Math.PI))),f++}}d=x,_=w}return 1===f?(null!==s&&(s.x=g,s.y=v),null!==a&&(a.x=g,a.y=v),null!==o&&(o.y=o.x+Math.PI)):f>1&&(f++,null!==s&&(s.x=g,s.y=v),null!==a&&(a.x=y,a.y=b)),f},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=2,this.x=0,this.y=0,this.vertices.length=0},e.prototype.containsPoint=function(t,e){var i=!1;if(t>=this.x&&t<=this.width&&e>=this.y&&e<=this.height)for(var n=0,r=this.vertices.length,s=r-2;n=e||a=e){var h=this.vertices[s],u=this.vertices[n];(e-o)*(h-u)/(a-o)+u0)){this.cacheFrameRate=Math.max(Math.ceil(t*this.scale),1);var e=Math.ceil(this.cacheFrameRate*this.duration)+1;this.cachedFrames.length=e;for(var i=0,n=this.cacheFrames.length;i=0},e.prototype.addBoneMask=function(t,e,i){void 0===i&&(i=!0);var n=t.getBone(e);if(null!==n&&(this.boneMask.indexOf(e)<0&&this.boneMask.push(e),i))for(var r=0,s=t.getBones();r=0&&this.boneMask.splice(n,1),i){var r=t.getBone(e);if(null!==r)if(this.boneMask.length>0)for(var s=0,a=t.getBones();s=0&&r.contains(o)&&this.boneMask.splice(h,1)}else for(var u=0,l=t.getBones();ue._zOrder?1:-1},i.prototype._onClear=function(){null!==this._clock&&this._clock.remove(this);for(var t=0,e=this._bones;t=s)){var o=i[a],h=this.getSlot(o.name);null!==h&&h._setZorder(r)}}this._slotsDirty=!0,this._zOrderDirty=!n}},i.prototype._addBone=function(t){this._bones.indexOf(t)<0&&this._bones.push(t)},i.prototype._addSlot=function(t){this._slots.indexOf(t)<0&&this._slots.push(t)},i.prototype._addConstraint=function(t){this._constraints.indexOf(t)<0&&this._constraints.push(t)},i.prototype._bufferAction=function(t,e){this._actions.indexOf(t)<0&&(e?this._actions.push(t):this._actions.unshift(t))},i.prototype.dispose=function(){null!==this._armatureData&&(this._lockUpdate=!0,this._dragonBones.bufferObject(this))},i.prototype.init=function(e,i,n,r){null===this._armatureData&&(this._armatureData=e,this._animation=t.BaseObject.borrowObject(t.Animation),this._proxy=i,this._display=n,this._dragonBones=r,this._proxy.dbInit(this),this._animation.init(this),this._animation.animations=this._armatureData.animations)},i.prototype.advanceTime=function(t){if(!this._lockUpdate)if(null!==this._armatureData)if(null!==this._armatureData.parent){var e=this._cacheFrameIndex;if(this._animation.advanceTime(t),this._slotsDirty&&(this._slotsDirty=!1,this._slots.sort(i._onSortSlots)),this._cacheFrameIndex<0||this._cacheFrameIndex!==e){var n=0,r=0;for(n=0,r=this._bones.length;n0){this._lockUpdate=!0;for(var s=0,a=this._actions;s0){if(null!==(a=this.getBone(t))&&(a.invalidUpdate(),e))for(var i=0,n=this._slots;i0){if(null===r&&null===s){m=b;break}var S;null!==r&&((S=o?r.y-e:r.x-t)<0&&(S=-S),(null===m||Su)&&(u=S,f=s.x,d=s.y,g=b,null!==a&&(p=a.y)))}}return null!==m&&null!==r&&(r.x=l,r.y=c,null!==a&&(a.x=_)),null!==g&&null!==s&&(s.x=f,s.y=d,null!==a&&(a.y=p)),m},i.prototype.getBone=function(t){for(var e=0,i=this._bones;e=0&&null!==this._cachedFrameIndices){var e=this._cachedFrameIndices[t];if(e>=0&&this._cachedFrameIndex===e)this._transformDirty=!1;else if(e>=0)this._transformDirty=!0,this._cachedFrameIndex=e;else{if(this._hasConstraint)for(var i=0,n=this._armature._constraints;i=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}}else{if(this._hasConstraint)for(var r=0,s=this._armature._constraints;r=0;this._localDirty&&this._updateGlobalTransformMatrix(o),o&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);else this._childrenTransformDirty&&(this._childrenTransformDirty=!1);this._localDirty=!0},i.prototype.updateByConstraint=function(){this._localDirty&&(this._localDirty=!1,(this._transformDirty||null!==this._parent&&this._parent._childrenTransformDirty)&&this._updateGlobalTransformMatrix(!0),this._transformDirty=!0)},i.prototype.invalidUpdate=function(){this._transformDirty=!0},i.prototype.contains=function(t){if(t===this)return!1;for(var e=t;e!==this&&null!==e;)e=e.parent;return e===this},Object.defineProperty(i.prototype,"boneData",{get:function(){return this._boneData},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visible",{get:function(){return this._visible},set:function(t){if(this._visible!==t){this._visible=t;for(var e=0,i=this._armature.getSlots();e=s)return this.globalTransformMatrix;if(_=7*(2*(o*(h+1)+2*o+h+d)+((r=i>this._kX*(t+s)+m)?1:0)),this._matrixCahce[_]>0)v.copyFromArray(g,_+1);else{var y=d*(u+2),b=this._hullCache[4],S=this._hullCache[5],x=this._hullCache[2]-(h-d)*b,w=this._hullCache[3]-(h-d)*S,T=this._vertices;r?this._getAffineTransform(-200,m+c,800,c,T[y+u+2],T[y+u+3],x+b,w+S,T[y],T[y+1],e._helpTransform,v,!0):this._getAffineTransform(-1e3,m,800,c,x,w,T[y],T[y+1],x+b,w+S,e._helpTransform,v,!1),g[_]=1,g[_+1]=v.a,g[_+2]=v.b,g[_+3]=v.c,g[_+4]=v.d,g[_+5]=v.tx,g[_+6]=v.ty}}else if(t>=s){if(i<-200||i>=s)return this.globalTransformMatrix;_=7*(2*(o*(h+1)+o+d)+((r=i>this._kX*(t-n)+m)?1:0)),this._matrixCahce[_]>0?v.copyFromArray(g,_+1):(y=(d+1)*(u+2)-2,b=this._hullCache[4],S=this._hullCache[5],x=this._hullCache[0]+d*b,w=this._hullCache[1]+d*S,T=this._vertices,r?this._getAffineTransform(n,m+c,800,c,x+b,w+S,T[y+u+2],T[y+u+3],x,w,e._helpTransform,v,!0):this._getAffineTransform(s,m,800,c,T[y],T[y+1],x,w,T[y+u+2],T[y+u+3],e._helpTransform,v,!1),g[_]=1,g[_+1]=v.a,g[_+2]=v.b,g[_+3]=v.c,g[_+4]=v.d,g[_+5]=v.tx,g[_+6]=v.ty)}else if(i<-200){if(t<-200||t>=s)return this.globalTransformMatrix;_=7*(o*(h+1)+2*f+((r=i>this._kY*(t-p-l)-n)?1:0)),this._matrixCahce[_]>0?v.copyFromArray(g,_+1):(y=2*f,b=this._hullCache[10],S=this._hullCache[11],x=this._hullCache[8]+f*b,w=this._hullCache[9]+f*S,T=this._vertices,r?this._getAffineTransform(p+l,-200,l,800,T[y+2],T[y+3],T[y],T[y+1],x+b,w+S,e._helpTransform,v,!0):this._getAffineTransform(p,-1e3,l,800,x,w,x+b,w+S,T[y],T[y+1],e._helpTransform,v,!1),g[_]=1,g[_+1]=v.a,g[_+2]=v.b,g[_+3]=v.c,g[_+4]=v.d,g[_+5]=v.tx,g[_+6]=v.ty)}else if(i>=s){if(t<-200||t>=s)return this.globalTransformMatrix;_=7*(2*(o*(h+1)+o+h+d)+((r=i>this._kY*(t-p-l)+s)?1:0)),this._matrixCahce[_]>0?v.copyFromArray(g,_+1):(y=h*(u+2)+2*f,b=this._hullCache[10],S=this._hullCache[11],x=this._hullCache[6]-(o-f)*b,w=this._hullCache[7]-(o-f)*S,T=this._vertices,r?this._getAffineTransform(p+l,n,l,800,x+b,w+S,x,w,T[y+2],T[y+3],e._helpTransform,v,!0):this._getAffineTransform(p,s,l,800,T[y],T[y+1],T[y+2],T[y+3],x,w,e._helpTransform,v,!1),g[_]=1,g[_+1]=v.a,g[_+2]=v.b,g[_+3]=v.c,g[_+4]=v.d,g[_+5]=v.tx,g[_+6]=v.ty)}else _=7*(2*(o*d+f)+((r=i>this._k*(t-p-l)+m)?1:0)),this._matrixCahce[_]>0?v.copyFromArray(g,_+1):(y=2*f+d*(u+2),T=this._vertices,r?this._getAffineTransform(p+l,m+c,l,c,T[y+u+4],T[y+u+5],T[y+u+2],T[y+u+3],T[y+2],T[y+3],e._helpTransform,v,!0):this._getAffineTransform(p,m,l,c,T[y],T[y+1],T[y+2],T[y+3],T[y+u+2],T[y+u+3],e._helpTransform,v,!1),g[_]=1,g[_+1]=v.a,g[_+2]=v.b,g[_+3]=v.c,g[_+4]=v.d,g[_+5]=v.tx,g[_+6]=v.ty);return v},e.prototype.init=function(e,i){if(null===this._boneData){t.prototype.init.call(this,e,i);var n=e.segmentX,r=e.segmentY,s=e.vertices.length;this._dX=400/n,this._dY=400/r,this._k=-this._dY/this._dX,this._kX=-this._dY/800,this._kY=-800/this._dX,this._vertices.length=s,this._deformVertices.length=s,this._matrixCahce.length=14*(n*r+2*n+2*r),this._hullCache.length=10;for(var a=0;a=0&&null!==this._cachedFrameIndices){var i=this._cachedFrameIndices[t];if(i>=0&&this._cachedFrameIndex===i)this._transformDirty=!1;else if(i>=0)this._transformDirty=!0,this._cachedFrameIndex=i;else{if(this._hasConstraint)for(var n=0,r=this._armature._constraints;n=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}}else{if(this._hasConstraint)for(var s=0,a=this._armature._constraints;s=0;this._localDirty&&this._updateGlobalTransformMatrix(l),l&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);var c=2*this.global.x,f=2*this.global.y,d=e._helpPoint;this.globalTransformMatrix.transformPoint(1e3,-200,d),this._hullCache[0]=d.x,this._hullCache[1]=d.y,this._hullCache[2]=c-d.x,this._hullCache[3]=f-d.y,this.globalTransformMatrix.transformPoint(0,this._dY,d,!0),this._hullCache[4]=d.x,this._hullCache[5]=d.y,this.globalTransformMatrix.transformPoint(200,1e3,d),this._hullCache[6]=d.x,this._hullCache[7]=d.y,this._hullCache[8]=c-d.x,this._hullCache[9]=f-d.y,this.globalTransformMatrix.transformPoint(this._dX,0,d,!0),this._hullCache[10]=d.x,this._hullCache[11]=d.y}else this._childrenTransformDirty&&(this._childrenTransformDirty=!1);this._localDirty=!0},e}(t.Bone);t.Surface=e}(Cot),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i._localMatrix=new t.Matrix,i._colorTransform=new t.ColorTransform,i._displayDatas=[],i._displayList=[],i._deformVertices=null,i._rawDisplay=null,i._meshDisplay=null,i}return Tot(i,e),i.prototype._onClear=function(){e.prototype._onClear.call(this);for(var i=[],n=0,r=this._displayList;n=0&&(null!==this._rawDisplayDatas&&(s=this._displayIndex=0&&this._displayIndex=0&&null!==this._rawDisplayDatas){var a=this._displayIndex0)for(var o=0,h=s;o0){this._displayList.length!==e.length&&(this._displayList.length=e.length);for(var i=0,n=e.length;i0&&(this._displayList.length=0);return this._displayIndex>=0&&this._displayIndex=0&&null!==this._cachedFrameIndices){var e=this._cachedFrameIndices[t];e>=0&&this._cachedFrameIndex===e?this._transformDirty=!1:e>=0?(this._transformDirty=!0,this._cachedFrameIndex=e):this._transformDirty||this._parent._childrenTransformDirty?(this._transformDirty=!0,this._cachedFrameIndex=-1):this._cachedFrameIndex>=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}else(this._transformDirty||this._parent._childrenTransformDirty)&&(t=-1,this._transformDirty=!0,this._cachedFrameIndex=-1);if(null!==this._display){if(this._visibleDirty&&(this._visibleDirty=!1,this._updateVisible()),this._blendModeDirty&&(this._blendModeDirty=!1,this._updateBlendMode()),this._colorDirty&&(this._colorDirty=!1,this._updateColor()),null!==this._deformVertices&&null!==this._deformVertices.verticesData&&this._display===this._meshDisplay){var i=null!==this._deformVertices.verticesData.weight,n=0!==this._parent._boneData.type;if((this._deformVertices.verticesDirty||i&&this._deformVertices.isBonesUpdate()||n&&this._parent._childrenTransformDirty)&&(this._deformVertices.verticesDirty=!1,this._updateMesh()),i||n)return}if(this._transformDirty){if(this._transformDirty=!1,this._cachedFrameIndex<0){var r=t>=0;this._updateGlobalTransformMatrix(r),r&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._isFromCache=!0,this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);this._updateTransform()}}},i.prototype.updateTransformAndMatrix=function(){this._transformDirty&&(this._transformDirty=!1,this._updateGlobalTransformMatrix(!1))},i.prototype.replaceDisplayData=function(t,e){if(void 0===e&&(e=-1),e<0&&(e=this._displayIndex<0?0:this._displayIndex),this._displayDatas.length<=e){this._displayDatas.length=e+1;for(var i=0,n=this._displayDatas.length;i0&&(1===h||2===h?null!==s?(this.globalTransformMatrix.transformPoint(s.x,s.y,s),null!==a&&(a.x=s.x,a.y=s.y)):null!==a&&this.globalTransformMatrix.transformPoint(a.x,a.y,a):(null!==s&&this.globalTransformMatrix.transformPoint(s.x,s.y,s),null!==a&&this.globalTransformMatrix.transformPoint(a.x,a.y,a)),null!==o&&(this.globalTransformMatrix.transformPoint(Math.cos(o.x),Math.sin(o.x),i._helpPoint,!0),o.x=Math.atan2(i._helpPoint.y,i._helpPoint.x),this.globalTransformMatrix.transformPoint(Math.cos(o.y),Math.sin(o.y),i._helpPoint,!0),o.y=Math.atan2(i._helpPoint.y,i._helpPoint.x))),h},i.prototype.invalidUpdate=function(){this._displayDirty=!0,this._transformDirty=!0},Object.defineProperty(i.prototype,"visible",{get:function(){return this._visible},set:function(t){this._visible!==t&&(this._visible=t,this._updateVisible())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"displayIndex",{get:function(){return this._displayIndex},set:function(t){this._setDisplayIndex(t)&&this.update(-1)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"name",{get:function(){return this._slotData.name},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"displayList",{get:function(){return this._displayList.concat()},set:function(e){var i=this._displayList.concat(),n=new Array;this._setDisplayList(e)&&this.update(-1);for(var r=0,s=i;r_)continue}for(;;W++){var L=p[W];if(!(F>L)){0===W?F/=L:F=(F-(z=p[W-1]))/(L-z);break}}if(W!==f){f=W;var V=6*W;for(T=u[V],C=u[V+1],A=u[V+2],D=u[V+3],I=u[V+4],B=u[V+5],b=2*(m=.03*(T-2*A+I))+(v=.006*(3*(A-I)-T+(M=u[V+6]))),S=2*(g=.03*(C-2*D+B))+(y=.006*(3*(D-B)-C+(P=u[V+7]))),x=.3*(A-T)+m+.16666667*v,w=.3*(D-C)+g+.16666667*y,R=Math.sqrt(x*x+w*w),k[0]=R,V=1;V<8;V++)x+=b,w+=S,b+=v,S+=y,R+=Math.sqrt(x*x+w*w),k[V]=R;x+=b,w+=S,R+=Math.sqrt(x*x+w*w),k[8]=R,x+=b+v,w+=S+y,R+=Math.sqrt(x*x+w*w),k[9]=R,O=0}for(F*=R;;O++){var N=k[O];if(!(F>N)){var z;0===O?F/=N:F=O+(F-(z=k[O-1]))/(N-z);break}}this.addCurvePosition(.1*F,T,C,A,D,I,B,M,P,a,H,i)}}else{var U=t.curveLengths;if(_=U[c-=h?1:2],n&&(d*=_),r)for(var G=0;G_)continue}for(var j=0;;W++){var q=U[W];if(!(d>q)){if(0===W)j=d/q;else{var X=U[W-1];j=(d-X)/(q-X)}break}}W!==f&&(f=W,h&&W===c?(this._computeVertices(l-4,4,0,u),this._computeVertices(0,4,4,u)):this._computeVertices(6*W+2,8,0,u)),this.addCurvePosition(j,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],a,H,i)}}},i.prototype.addCurvePosition=function(t,e,i,n,r,s,a,o,h,u,l,c){if(0===t)return u[l]=e,u[l+1]=i,void(u[l+2]=0);if(1===t)return u[l]=o,u[l+1]=h,void(u[l+2]=0);var f=1-t,d=f*f,_=t*t,p=d*f,m=d*t*3,g=f*_*3,v=t*_,y=p*e+m*n+g*s+v*o,b=p*i+m*r+g*a+v*h;u[l]=y,u[l+1]=b,u[l+2]=c?Math.atan2(b-(p*i+m*r+g*a),y-(p*e+m*n+g*s)):0},i.prototype.init=function(t,e){this._constraintData=t,this._armature=e;var i=t;this.pathOffset=i.pathDisplayData.vertices.offset,this.position=i.position,this.spacing=i.spacing,this.rotateOffset=i.rotateOffset,this.rotateMix=i.rotateMix,this.translateMix=i.translateMix,this._root=this._armature.getBone(i.root.name),this._target=this._armature.getBone(i.target.name),this._pathSlot=this._armature.getSlot(i.pathSlot.name);for(var n=0,r=i.bones.length;n0?t.Transform.DEG_RAD:-t.Transform.DEG_RAD));for(var I=this.rotateMix,B=this.translateMix,M=(g=0,3);g0){var L=E.a,V=E.b,N=E.c,z=E.d,U=void 0,G=void 0,H=void 0;if(U=f?T[M-1]:Math.atan2(R,k),U-=Math.atan2(V,L),w){G=Math.cos(U),H=Math.sin(U);var W=P._boneData.length;A+=(W*(G*L-H*V)-k)*I,D+=(W*(H*L+G*V)-R)*I}else U+=C;U>t.Transform.PI?U-=t.Transform.PI_D:U<-t.Transform.PI&&(U+=t.Transform.PI_D),U*=I,G=Math.cos(U),H=Math.sin(U),E.a=G*L-H*V,E.b=H*L+G*V,E.c=G*N-H*z,E.d=H*N+G*z}P.global.fromMatrix(E)}this.dirty=!1}}},i.prototype.invalidUpdate=function(){},i}(e);t.PathConstraint=n}(Cot),function(t){var e=function(){function t(t){void 0===t&&(t=0),this.time=0,this.timeScale=1,this._systemTime=0,this._animatebles=[],this._clock=null,this.time=t,this._systemTime=.001*(new Date).getTime()}return t.prototype.advanceTime=function(t){t!=t&&(t=0);var e=.001*Date.now();if(t<0&&(t=e-this._systemTime),this._systemTime=e,1!==this.timeScale&&(t*=this.timeScale),0!==t){t<0?this.time-=t:this.time+=t;for(var i=0,n=0,r=this._animatebles.length;i0&&(this._animatebles[i-n]=s,this._animatebles[i]=null),s.advanceTime(t)):n++}if(n>0){for(r=this._animatebles.length;i=0&&(this._animatebles[e]=null,t.clock=null)},t.prototype.clear=function(){for(var t=0,e=this._animatebles;t0&&_._subFadeState>0)this._armature._dragonBones.bufferObject(_),this._animationStates.length=0,this._lastAnimationState=null;else{var i=_._animationData,n=i.cacheFrameRate;if(this._animationDirty&&n>0){this._animationDirty=!1;for(var r=0,s=this._armature.getBones();r0){var c=l[0];if(null!==c&&c.parent===this._armature.armatureData.defaultSkin){u._cachedFrameIndices=i.getSlotCachedFrameIndices(u.name);continue}}u._cachedFrameIndices=null}}_.advanceTime(t,n)}else if(e>1){for(var f=0,d=0;f0&&_._subFadeState>0?(d++,this._armature._dragonBones.bufferObject(_),this._animationDirty=!0,this._lastAnimationState===_&&(this._lastAnimationState=null)):(d>0&&(this._animationStates[f-d]=_),_.advanceTime(t,0)),f===e-1&&d>0&&(this._animationStates.length-=d,null===this._lastAnimationState&&this._animationStates.length>0&&(this._lastAnimationState=this._animationStates[this._animationStates.length-1]))}this._armature._cacheFrameIndex=-1}else this._armature._cacheFrameIndex=-1},i.prototype.reset=function(){for(var t=0,e=this._animationStates;t1?(e.position<0?(e.position%=n.duration,e.position=n.duration-e.position):e.position===n.duration?e.position-=1e-6:e.position>n.duration&&(e.position%=n.duration),e.duration>0&&e.position+e.duration>n.duration&&(e.duration=n.duration-e.position),e.playTimes<0&&(e.playTimes=n.playTimes)):(e.playTimes=1,e.position=0,e.duration>0&&(e.duration=0)),0===e.duration&&(e.duration=-1),this._fadeOut(e);var o=t.BaseObject.borrowObject(t.AnimationState);if(o.init(this._armature,n,e),this._animationDirty=!0,this._armature._cacheFrameIndex=-1,this._animationStates.length>0){for(var h=!1,u=0,l=this._animationStates.length;uthis._animationStates[u].layer){h=!0,this._animationStates.splice(u,0,o);break}if(u!==l-1&&o.layer>this._animationStates[u+1].layer){h=!0,this._animationStates.splice(u+1,0,o);break}}h||this._animationStates.push(o)}else this._animationStates.push(o);for(var c=0,f=this._armature.getSlots();c0)this.playConfig(this._animationConfig);else if(null===this._lastAnimationState){var i=this._armature.armatureData.defaultAnimation;null!==i&&(this._animationConfig.animation=i.name,this.playConfig(this._animationConfig))}else this._lastAnimationState.isPlaying||this._lastAnimationState.isCompleted?(this._animationConfig.animation=this._lastAnimationState.name,this.playConfig(this._animationConfig)):this._lastAnimationState.play();return this._lastAnimationState},i.prototype.fadeIn=function(t,e,i,n,r,s){return void 0===e&&(e=-1),void 0===i&&(i=-1),void 0===n&&(n=0),void 0===r&&(r=null),void 0===s&&(s=3),this._animationConfig.clear(),this._animationConfig.fadeOutMode=s,this._animationConfig.playTimes=i,this._animationConfig.layer=n,this._animationConfig.fadeInTime=e,this._animationConfig.animation=t,this._animationConfig.group=null!==r?r:"",this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByTime=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.position=e,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t,this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByFrame=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t;var n=t in this._animations?this._animations[t]:null;return null!==n&&(this._animationConfig.position=n.duration*e/n.frameCount),this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByProgress=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t;var n=t in this._animations?this._animations[t]:null;return null!==n&&(this._animationConfig.position=n.duration*(e>0?e:0)),this.playConfig(this._animationConfig)},i.prototype.gotoAndStopByTime=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByTime(t,e,1);return null!==i&&i.stop(),i},i.prototype.gotoAndStopByFrame=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByFrame(t,e,1);return null!==i&&i.stop(),i},i.prototype.gotoAndStopByProgress=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByProgress(t,e,1);return null!==i&&i.stop(),i},i.prototype.getState=function(t){for(var e=this._animationStates.length;e--;){var i=this._animationStates[e];if(i.name===t)return i}return null},i.prototype.hasAnimation=function(t){return t in this._animations},i.prototype.getStates=function(){return this._animationStates},Object.defineProperty(i.prototype,"isPlaying",{get:function(){for(var t=0,e=this._animationStates;t0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lastAnimationName",{get:function(){return null!==this._lastAnimationState?this._lastAnimationState.name:""},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animationNames",{get:function(){return this._animationNames},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animations",{get:function(){return this._animations},set:function(t){if(this._animations!==t){for(var e in this._animationNames.length=0,this._animations)delete this._animations[e];for(var e in t)this._animationNames.push(e),this._animations[e]=t[e]}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animationConfig",{get:function(){return this._animationConfig.clear(),this._animationConfig},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lastAnimationState",{get:function(){return this._lastAnimationState},enumerable:!0,configurable:!0}),i.prototype.gotoAndPlay=function(t,e,i,n,r,s,a){void 0===e&&(e=-1),void 0===i&&(i=-1),void 0===n&&(n=-1),void 0===r&&(r=0),void 0===s&&(s=null),void 0===a&&(a=3),console.warn("Deprecated."),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.fadeOutMode=a,this._animationConfig.playTimes=n,this._animationConfig.layer=r,this._animationConfig.fadeInTime=e,this._animationConfig.animation=t,this._animationConfig.group=null!==s?s:"";var o=this._animations[t];return o&&i>0&&(this._animationConfig.timeScale=o.duration/i),this.playConfig(this._animationConfig)},i.prototype.gotoAndStop=function(t,e){return void 0===e&&(e=0),console.warn("Deprecated."),this.gotoAndStopByTime(t,e)},Object.defineProperty(i.prototype,"animationList",{get:function(){return console.warn("Deprecated."),this._animationNames},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animationDataList",{get:function(){console.warn("Deprecated.");for(var t=[],e=0,i=this._animationNames.length;e0;if(this._subFadeState<0){this._subFadeState=0;var r=n?t.EventObject.FADE_OUT:t.EventObject.FADE_IN;this._armature.eventDispatcher.hasDBEventListener(r)&&((i=t.BaseObject.borrowObject(t.EventObject)).type=r,i.armature=this._armature,i.animationState=this,this._armature._dragonBones.bufferEvent(i))}(e<0&&(e=-e),this._fadeTime+=e,this._fadeTime>=this.fadeTotalTime?(this._subFadeState=1,this._fadeProgress=n?0:1):this._fadeTime>0?this._fadeProgress=n?1-this._fadeTime/this.fadeTotalTime:this._fadeTime/this.fadeTotalTime:this._fadeProgress=n?1:0,this._subFadeState>0)&&(n||(this._playheadState|=1,this._fadeState=0),r=n?t.EventObject.FADE_OUT_COMPLETE:t.EventObject.FADE_IN_COMPLETE,this._armature.eventDispatcher.hasDBEventListener(r)&&((i=t.BaseObject.borrowObject(t.EventObject)).type=r,i.armature=this._armature,i.animationState=this,this._armature._dragonBones.bufferEvent(i)))},r.prototype.init=function(e,i,n){if(null===this._armature){if(this._armature=e,this._animationData=i,this.resetToPose=n.resetToPose,this.additiveBlending=n.additiveBlending,this.displayControl=n.displayControl,this.actionEnabled=n.actionEnabled,this.layer=n.layer,this.playTimes=n.playTimes,this.timeScale=n.timeScale,this.fadeTotalTime=n.fadeInTime,this.autoFadeOutTime=n.autoFadeOutTime,this.weight=n.weight,this.name=n.name.length>0?n.name:n.animation,this.group=n.group,n.pauseFadeIn?this._playheadState=2:this._playheadState=3,n.duration<0?(this._position=0,this._duration=this._animationData.duration,0!==n.position?this.timeScale>=0?this._time=n.position:this._time=n.position-this._duration:this._time=0):(this._position=n.position,this._duration=n.duration,this._time=0),this.timeScale<0&&0===this._time&&(this._time=-1e-6),this.fadeTotalTime<=0&&(this._fadeProgress=.999999),n.boneMask.length>0){this._boneMask.length=n.boneMask.length;for(var r=0,s=this._boneMask.length;r0,r=!0,s=!0,a=this._time;if(this._weightResult=this.weight*this._fadeProgress,null!==this._parent&&(this._weightResult*=this._parent._weightResult/this._parent._fadeProgress),this._actionTimeline.playState<=0&&this._actionTimeline.update(a),n){var o=2*i;this._actionTimeline.currentTime=Math.floor(this._actionTimeline.currentTime*o)/o}if(null!==this._zOrderTimeline&&this._zOrderTimeline.playState<=0&&this._zOrderTimeline.update(a),n){var h=Math.floor(this._actionTimeline.currentTime*i);this._armature._cacheFrameIndex===h?(r=!1,s=!1):(this._armature._cacheFrameIndex=h,this._animationData.cachedFrames[h]?s=!1:this._animationData.cachedFrames[h]=!0)}if(r){if(s)for(var u=0,l=this._boneTimelines.length;u0&&(this._subFadeState=0,this._poseTimelines.length>0)){for(var d=0,_=this._poseTimelines;d<_.length;d++){var p;(p=_[d])instanceof t.BoneTimelineState?this._boneTimelines.splice(this._boneTimelines.indexOf(p),1):p instanceof t.SurfaceTimelineState?this._surfaceTimelines.splice(this._surfaceTimelines.indexOf(p),1):p instanceof t.SlotTimelineState?this._slotTimelines.splice(this._slotTimelines.indexOf(p),1):p instanceof t.ConstraintTimelineState&&this._constraintTimelines.splice(this._constraintTimelines.indexOf(p),1),p.returnToPool()}this._poseTimelines.length=0}this._actionTimeline.playState>0&&this.autoFadeOutTime>=0&&this.fadeOut(this.autoFadeOutTime)}}},r.prototype.play=function(){this._playheadState=3},r.prototype.stop=function(){this._playheadState&=1},r.prototype.fadeOut=function(t,e){if(void 0===e&&(e=!0),t<0&&(t=0),e&&(this._playheadState&=2),this._fadeState>0){if(t>this.fadeTotalTime-this._fadeTime)return}else{this._fadeState=1,this._subFadeState=-1,(t<=0||this._fadeProgress<=0)&&(this._fadeProgress=1e-6);for(var i=0,n=this._boneTimelines;i1e-6?t/this._fadeProgress:0,this._fadeTime=this.fadeTotalTime*(1-this._fadeProgress)},r.prototype.containsBoneMask=function(t){return 0===this._boneMask.length||this._boneMask.indexOf(t)>=0},r.prototype.addBoneMask=function(t,e){void 0===e&&(e=!0);var i=this._armature.getBone(t);if(null!==i){if(this._boneMask.indexOf(t)<0&&this._boneMask.push(t),e)for(var n=0,r=this._armature.getBones();n=0&&this._boneMask.splice(i,1),e){var n=this._armature.getBone(t);if(null!==n){var r=this._armature.getBones();if(this._boneMask.length>0)for(var s=0,a=r;s=0&&n.contains(o)&&this._boneMask.splice(h,1)}else for(var u=0,l=r;u0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isFadeComplete",{get:function(){return 0===this._fadeState},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isPlaying",{get:function(){return!!(2&this._playheadState)&&this._actionTimeline.playState<=0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isCompleted",{get:function(){return this._actionTimeline.playState>0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"currentPlayTimes",{get:function(){return this._actionTimeline.currentPlayTimes},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"totalTime",{get:function(){return this._duration},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"currentTime",{get:function(){return this._actionTimeline.currentTime},set:function(t){var e=this._actionTimeline.currentPlayTimes-(this._actionTimeline.playState>0?1:0);if((t<0||this._duration0&&e===this.playTimes-1&&t===this._duration&&(t=this._duration-1e-6),this._time!==t){this._time=t,this._actionTimeline.setCurrentTime(this._time),null!==this._zOrderTimeline&&(this._zOrderTimeline.playState=-1);for(var i=0,n=this._boneTimelines;i0))return 0;if(this.layer!==e){if(this.layerWeight>=this.leftWeight)return this.leftWeight=0,0;this.layer=e,this.leftWeight-=this.layerWeight,this.layerWeight=0}return t*=this.leftWeight,this.layerWeight+=t,this.blendWeight=t,2}return this.dirty=!0,this.layer=e,this.layerWeight=t,this.leftWeight=1,this.blendWeight=t,1},t.prototype.clear=function(){this.dirty=!1,this.layer=0,this.leftWeight=0,this.layerWeight=0,this.blendWeight=0},t}();t.BlendState=n}(Cot),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Tot(e,t),e.prototype._onClear=function(){this.playState=-1,this.currentPlayTimes=-1,this.currentTime=-1,this._tweenState=0,this._frameRate=0,this._frameValueOffset=0,this._frameCount=0,this._frameOffset=0,this._frameIndex=-1,this._frameRateR=0,this._position=0,this._duration=0,this._timeScale=1,this._timeOffset=0,this._dragonBonesData=null,this._animationData=null,this._timelineData=null,this._armature=null,this._animationState=null,this._actionTimeline=null,this._frameArray=null,this._frameIntArray=null,this._frameFloatArray=null,this._timelineArray=null,this._frameIndices=null},e.prototype._setCurrentTime=function(t){var e=this.playState,i=this.currentPlayTimes,n=this.currentTime;if(null!==this._actionTimeline&&this._frameCount<=1)this.playState=this._actionTimeline.playState>=0?1:-1,this.currentPlayTimes=1,this.currentTime=this._actionTimeline.currentTime;else if(null===this._actionTimeline||1!==this._timeScale||0!==this._timeOffset){var r=this._animationState.playTimes,s=r*this._duration;t*=this._timeScale,0!==this._timeOffset&&(t+=this._timeOffset*this._animationData.duration),r>0&&(t>=s||t<=-s)?(this.playState<=0&&3===this._animationState._playheadState&&(this.playState=1),this.currentPlayTimes=r,this.currentTime=t<0?0:this._duration+1e-6):(0!==this.playState&&3===this._animationState._playheadState&&(this.playState=0),t<0?(t=-t,this.currentPlayTimes=Math.floor(t/this._duration),this.currentTime=this._duration-t%this._duration):(this.currentPlayTimes=Math.floor(t/this._duration),this.currentTime=t%this._duration)),this.currentTime+=this._position}else this.playState=this._actionTimeline.playState,this.currentPlayTimes=this._actionTimeline.currentPlayTimes,this.currentTime=this._actionTimeline.currentTime;return(this.currentPlayTimes!==i||this.currentTime!==n)&&((e<0&&this.playState!==e||this.playState<=0&&this.currentPlayTimes!==i)&&(this._frameIndex=-1),!0)},e.prototype.init=function(t,e,i){this._armature=t,this._animationState=e,this._timelineData=i,this._actionTimeline=this._animationState._actionTimeline,this===this._actionTimeline&&(this._actionTimeline=null),this._animationData=this._animationState._animationData,this._frameRate=this._animationData.parent.frameRate,this._frameRateR=1/this._frameRate,this._position=this._animationState._position,this._duration=this._animationState._duration,this._dragonBonesData=this._animationData.parent.parent,null!==this._timelineData&&(this._frameIntArray=this._dragonBonesData.frameIntArray,this._frameFloatArray=this._dragonBonesData.frameFloatArray,this._frameArray=this._dragonBonesData.frameArray,this._timelineArray=this._dragonBonesData.timelineArray,this._frameIndices=this._dragonBonesData.frameIndices,this._frameCount=this._timelineArray[this._timelineData.offset+2],this._frameValueOffset=this._timelineArray[this._timelineData.offset+4],this._timeScale=100/this._timelineArray[this._timelineData.offset+0],this._timeOffset=.01*this._timelineArray[this._timelineData.offset+1])},e.prototype.fadeOut=function(){},e.prototype.update=function(t){if(this._setCurrentTime(t)){if(this._frameCount>1){var e=Math.floor(this.currentTime*this._frameRate),i=this._frameIndices[this._timelineData.frameIndicesOffset+e];this._frameIndex!==i&&(this._frameIndex=i,this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5+this._frameIndex],this._onArriveAtFrame())}else this._frameIndex<0&&(this._frameIndex=0,null!==this._timelineData&&(this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5]),this._onArriveAtFrame());0!==this._tweenState&&this._onUpdateFrame()}},e}(t.BaseObject);t.TimelineState=e;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Tot(e,t),e._getEasingValue=function(t,e,i){var n=e;switch(t){case 3:n=Math.pow(e,2);break;case 4:n=1-Math.pow(1-e,2);break;case 5:n=.5*(1-Math.cos(e*Math.PI))}return(n-e)*i+e},e._getEasingCurveValue=function(t,e,i,n){if(t<=0)return 0;if(t>=1)return 1;var r=i+1,s=Math.floor(t*r),a=0===s?0:e[n+s-1];return 1e-4*(a+((s===r-1?1e4:e[n+s])-a)*(t*r-s))},e.prototype._onClear=function(){t.prototype._onClear.call(this),this._tweenType=0,this._curveCount=0,this._framePosition=0,this._frameDurationR=0,this._tweenProgress=0,this._tweenEasing=0},e.prototype._onArriveAtFrame=function(){if(this._frameCount>1&&(this._frameIndex!==this._frameCount-1||0===this._animationState.playTimes||this._animationState.currentPlayTimes0?1/e:0}else this._tweenState=1},e.prototype._onUpdateFrame=function(){2===this._tweenState?(this._tweenProgress=(this.currentTime-this._framePosition)*this._frameDurationR,2===this._tweenType?this._tweenProgress=e._getEasingCurveValue(this._tweenProgress,this._frameArray,this._curveCount,this._frameOffset+3):1!==this._tweenType&&(this._tweenProgress=e._getEasingValue(this._tweenType,this._tweenProgress,this._tweenEasing))):this._tweenProgress=0},e}(e);t.TweenTimelineState=i;var n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Tot(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this.bone=null,this.bonePose=null},e.prototype.blend=function(t){var e=this.bone._blendState.blendWeight,i=this.bone.animationPose,n=this.bonePose.result;2===t?(i.x+=n.x*e,i.y+=n.y*e,i.rotation+=n.rotation*e,i.skew+=n.skew*e,i.scaleX+=(n.scaleX-1)*e,i.scaleY+=(n.scaleY-1)*e):1!==e?(i.x=n.x*e,i.y=n.y*e,i.rotation=n.rotation*e,i.skew=n.skew*e,i.scaleX=(n.scaleX-1)*e+1,i.scaleY=(n.scaleY-1)*e+1):(i.x=n.x,i.y=n.y,i.rotation=n.rotation,i.skew=n.skew,i.scaleX=n.scaleX,i.scaleY=n.scaleY),0===this._animationState._fadeState&&0===this._animationState._subFadeState||(this.bone._transformDirty=!0)},e}(i);t.BoneTimelineState=n;var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Tot(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this.slot=null},e}(i);t.SlotTimelineState=r;var s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Tot(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this.constraint=null},e}(i);t.ConstraintTimelineState=s}(Cot),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Tot(i,e),i.toString=function(){return"[class dragonBones.ActionTimelineState]"},i.prototype._onCrossFrame=function(e){var i=this._armature.eventDispatcher;if(this._animationState.actionEnabled)for(var n=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5+e],r=this._frameArray[n+1],s=this._animationData.parent.actions,a=0;a0&&s.hasDBEventListener(t.EventObject.COMPLETE)&&((u=t.BaseObject.borrowObject(t.EventObject)).type=t.EventObject.COMPLETE,u.armature=this._armature,u.animationState=this._animationState)),this._frameCount>1){var l=this._timelineData,c=Math.floor(this.currentTime*this._frameRate),f=this._frameIndices[l.frameIndicesOffset+c];if(this._frameIndex!==f){var d=this._frameIndex;if(this._frameIndex=f,null!==this._timelineArray)if(this._frameOffset=this._animationData.frameOffset+this._timelineArray[l.offset+5+this._frameIndex],o){if(d<0){var _=Math.floor(r*this._frameRate);d=this._frameIndices[l.frameIndicesOffset+_],this.currentPlayTimes===n&&d===f&&(d=-1)}for(;d>=0;){var p=this._animationData.frameOffset+this._timelineArray[l.offset+5+d],m=this._frameArray[p]/this._frameRate;if(this._position<=m&&m<=this._position+this._duration&&this._onCrossFrame(d),null!==h&&0===d&&(this._armature._dragonBones.bufferEvent(h),h=null),d>0?d--:d=this._frameCount-1,d===f)break}}else for(d<0&&(_=Math.floor(r*this._frameRate),d=this._frameIndices[l.frameIndicesOffset+_],p=this._animationData.frameOffset+this._timelineArray[l.offset+5+d],m=this._frameArray[p]/this._frameRate,this.currentPlayTimes===n&&(r<=m?d>0?d--:d=this._frameCount-1:d===f&&(d=-1)));d>=0&&(d=0&&(this._frameArray[this._frameOffset+1]>0?this._armature._sortZOrder(this._frameArray,this._frameOffset+2):this._armature._sortZOrder(null,0))},e.prototype._onUpdateFrame=function(){},e}(t.TimelineState);t.ZOrderTimelineState=i;var n=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Tot(i,e),i.toString=function(){return"[class dragonBones.BoneAllTimelineState]"},i.prototype._onArriveAtFrame=function(){if(e.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var t=this._animationData.frameFloatOffset+this._frameValueOffset+6*this._frameIndex,i=this._armature._armatureData.scale,n=this._frameFloatArray,r=this.bonePose.current,s=this.bonePose.delta;r.x=n[t++]*i,r.y=n[t++]*i,r.rotation=n[t++],r.skew=n[t++],r.scaleX=n[t++],r.scaleY=n[t++],2===this._tweenState?(this._frameIndex===this._frameCount-1&&(t=this._animationData.frameFloatOffset+this._frameValueOffset),s.x=n[t++]*i-r.x,s.y=n[t++]*i-r.y,s.rotation=n[t++]-r.rotation,s.skew=n[t++]-r.skew,s.scaleX=n[t++]-r.scaleX,s.scaleY=n[t++]-r.scaleY):(s.x=0,s.y=0,s.rotation=0,s.skew=0,s.scaleX=0,s.scaleY=0)}else r=this.bonePose.current,s=this.bonePose.delta,r.x=0,r.y=0,r.rotation=0,r.skew=0,r.scaleX=1,r.scaleY=1,s.x=0,s.y=0,s.rotation=0,s.skew=0,s.scaleX=0,s.scaleY=0},i.prototype._onUpdateFrame=function(){e.prototype._onUpdateFrame.call(this);var t=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.x=t.x+i.x*this._tweenProgress,n.y=t.y+i.y*this._tweenProgress,n.rotation=t.rotation+i.rotation*this._tweenProgress,n.skew=t.skew+i.skew*this._tweenProgress,n.scaleX=t.scaleX+i.scaleX*this._tweenProgress,n.scaleY=t.scaleY+i.scaleY*this._tweenProgress},i.prototype.fadeOut=function(){var e=this.bonePose.result;e.rotation=t.Transform.normalizeRadian(e.rotation),e.skew=t.Transform.normalizeRadian(e.skew)},i}(t.BoneTimelineState);t.BoneAllTimelineState=n;var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Tot(e,t),e.toString=function(){return"[class dragonBones.BoneTranslateTimelineState]"},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+2*this._frameIndex,i=this._armature._armatureData.scale,n=this._frameFloatArray,r=this.bonePose.current,s=this.bonePose.delta;r.x=n[e++]*i,r.y=n[e++]*i,2===this._tweenState?(this._frameIndex===this._frameCount-1&&(e=this._animationData.frameFloatOffset+this._frameValueOffset),s.x=n[e++]*i-r.x,s.y=n[e++]*i-r.y):(s.x=0,s.y=0)}else r=this.bonePose.current,s=this.bonePose.delta,r.x=0,r.y=0,s.x=0,s.y=0},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this);var e=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.x=e.x+i.x*this._tweenProgress,n.y=e.y+i.y*this._tweenProgress},e}(t.BoneTimelineState);t.BoneTranslateTimelineState=r;var s=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Tot(i,e),i.toString=function(){return"[class dragonBones.BoneRotateTimelineState]"},i.prototype._onArriveAtFrame=function(){if(e.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var i=this._animationData.frameFloatOffset+this._frameValueOffset+2*this._frameIndex,n=this._frameFloatArray,r=this.bonePose.current,s=this.bonePose.delta;r.rotation=n[i++],r.skew=n[i++],2===this._tweenState?(this._frameIndex===this._frameCount-1?(i=this._animationData.frameFloatOffset+this._frameValueOffset,s.rotation=t.Transform.normalizeRadian(n[i++]-r.rotation)):s.rotation=n[i++]-r.rotation,s.skew=n[i++]-r.skew):(s.rotation=0,s.skew=0)}else r=this.bonePose.current,s=this.bonePose.delta,r.rotation=0,r.skew=0,s.rotation=0,s.skew=0},i.prototype._onUpdateFrame=function(){e.prototype._onUpdateFrame.call(this);var t=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.rotation=t.rotation+i.rotation*this._tweenProgress,n.skew=t.skew+i.skew*this._tweenProgress},i.prototype.fadeOut=function(){var e=this.bonePose.result;e.rotation=t.Transform.normalizeRadian(e.rotation),e.skew=t.Transform.normalizeRadian(e.skew)},i}(t.BoneTimelineState);t.BoneRotateTimelineState=s;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Tot(e,t),e.toString=function(){return"[class dragonBones.BoneScaleTimelineState]"},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+2*this._frameIndex,i=this._frameFloatArray,n=this.bonePose.current,r=this.bonePose.delta;n.scaleX=i[e++],n.scaleY=i[e++],2===this._tweenState?(this._frameIndex===this._frameCount-1&&(e=this._animationData.frameFloatOffset+this._frameValueOffset),r.scaleX=i[e++]-n.scaleX,r.scaleY=i[e++]-n.scaleY):(r.scaleX=0,r.scaleY=0)}else n=this.bonePose.current,r=this.bonePose.delta,n.scaleX=1,n.scaleY=1,r.scaleX=0,r.scaleY=0},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this);var e=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.scaleX=e.scaleX+i.scaleX*this._tweenProgress,n.scaleY=e.scaleY+i.scaleY*this._tweenProgress},e}(t.BoneTimelineState);t.BoneScaleTimelineState=a;var o=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._current=[],e._delta=[],e._result=[],e}return Tot(e,t),e.toString=function(){return"[class dragonBones.SurfaceTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.surface=null,this._frameFloatOffset=0,this._valueCount=0,this._deformCount=0,this._valueOffset=0,this._current.length=0,this._delta.length=0,this._result.length=0},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+this._frameIndex*this._valueCount,i=this._armature._armatureData.scale,n=this._frameFloatArray;if(2===this._tweenState){var r=e+this._valueCount;this._frameIndex===this._frameCount-1&&(r=this._animationData.frameFloatOffset+this._frameValueOffset);for(var s=0;s=0){var t=null!==this._timelineData?this._frameArray[this._frameOffset+1]:this.slot._slotData.displayIndex;this.slot.displayIndex!==t&&this.slot._setDisplayIndex(t,!0)}},e}(t.SlotTimelineState);t.SlotDislayTimelineState=h;var u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._current=[0,0,0,0,0,0,0,0],e._delta=[0,0,0,0,0,0,0,0],e._result=[0,0,0,0,0,0,0,0],e}return Tot(e,t),e.toString=function(){return"[class dragonBones.SlotColorTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this._dirty=!1},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._dragonBonesData.intArray,i=this._frameIntArray,n=this._animationData.frameIntOffset+this._frameValueOffset+1*this._frameIndex,r=i[n];r<0&&(r+=65536),this._current[0]=e[r++],this._current[1]=e[r++],this._current[2]=e[r++],this._current[3]=e[r++],this._current[4]=e[r++],this._current[5]=e[r++],this._current[6]=e[r++],this._current[7]=e[r++],2===this._tweenState&&((r=this._frameIndex===this._frameCount-1?i[this._animationData.frameIntOffset+this._frameValueOffset]:i[n+1])<0&&(r+=65536),this._delta[0]=e[r++]-this._current[0],this._delta[1]=e[r++]-this._current[1],this._delta[2]=e[r++]-this._current[2],this._delta[3]=e[r++]-this._current[3],this._delta[4]=e[r++]-this._current[4],this._delta[5]=e[r++]-this._current[5],this._delta[6]=e[r++]-this._current[6],this._delta[7]=e[r++]-this._current[7])}else{var s=this.slot._slotData.color;this._current[0]=100*s.alphaMultiplier,this._current[1]=100*s.redMultiplier,this._current[2]=100*s.greenMultiplier,this._current[3]=100*s.blueMultiplier,this._current[4]=s.alphaOffset,this._current[5]=s.redOffset,this._current[6]=s.greenOffset,this._current[7]=s.blueOffset}},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this),this._dirty=!0,2!==this._tweenState&&(this._tweenState=0),this._result[0]=.01*(this._current[0]+this._delta[0]*this._tweenProgress),this._result[1]=.01*(this._current[1]+this._delta[1]*this._tweenProgress),this._result[2]=.01*(this._current[2]+this._delta[2]*this._tweenProgress),this._result[3]=.01*(this._current[3]+this._delta[3]*this._tweenProgress),this._result[4]=this._current[4]+this._delta[4]*this._tweenProgress,this._result[5]=this._current[5]+this._delta[5]*this._tweenProgress,this._result[6]=this._current[6]+this._delta[6]*this._tweenProgress,this._result[7]=this._current[7]+this._delta[7]*this._tweenProgress},e.prototype.fadeOut=function(){this._tweenState=0,this._dirty=!1},e.prototype.update=function(e){if(t.prototype.update.call(this,e),0!==this._tweenState||this._dirty){var i=this.slot._colorTransform;if(0!==this._animationState._fadeState||0!==this._animationState._subFadeState){if(i.alphaMultiplier!==this._result[0]||i.redMultiplier!==this._result[1]||i.greenMultiplier!==this._result[2]||i.blueMultiplier!==this._result[3]||i.alphaOffset!==this._result[4]||i.redOffset!==this._result[5]||i.greenOffset!==this._result[6]||i.blueOffset!==this._result[7]){var n=Math.pow(this._animationState._fadeProgress,4);i.alphaMultiplier+=(this._result[0]-i.alphaMultiplier)*n,i.redMultiplier+=(this._result[1]-i.redMultiplier)*n,i.greenMultiplier+=(this._result[2]-i.greenMultiplier)*n,i.blueMultiplier+=(this._result[3]-i.blueMultiplier)*n,i.alphaOffset+=(this._result[4]-i.alphaOffset)*n,i.redOffset+=(this._result[5]-i.redOffset)*n,i.greenOffset+=(this._result[6]-i.greenOffset)*n,i.blueOffset+=(this._result[7]-i.blueOffset)*n,this.slot._colorDirty=!0}}else this._dirty&&(this._dirty=!1,i.alphaMultiplier===this._result[0]&&i.redMultiplier===this._result[1]&&i.greenMultiplier===this._result[2]&&i.blueMultiplier===this._result[3]&&i.alphaOffset===this._result[4]&&i.redOffset===this._result[5]&&i.greenOffset===this._result[6]&&i.blueOffset===this._result[7]||(i.alphaMultiplier=this._result[0],i.redMultiplier=this._result[1],i.greenMultiplier=this._result[2],i.blueMultiplier=this._result[3],i.alphaOffset=this._result[4],i.redOffset=this._result[5],i.greenOffset=this._result[6],i.blueOffset=this._result[7],this.slot._colorDirty=!0))}},e}(t.SlotTimelineState);t.SlotColorTimelineState=u;var l=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._current=[],e._delta=[],e._result=[],e}return Tot(e,t),e.toString=function(){return"[class dragonBones.DeformTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.vertexOffset=0,this._dirty=!1,this._frameFloatOffset=0,this._valueCount=0,this._deformCount=0,this._valueOffset=0,this._current.length=0,this._delta.length=0,this._result.length=0},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+this._frameIndex*this._valueCount,i=this._armature._armatureData.scale,n=this._frameFloatArray;if(2===this._tweenState){var r=e+this._valueCount;this._frameIndex===this._frameCount-1&&(r=this._animationData.frameFloatOffset+this._frameValueOffset);for(var s=0;s=0&&(this._floats[2]=this._floats[0]+this._floats[1]*this._tweenProgress),this._floats[5]=this._floats[3]+this._floats[4]*this._tweenProgress},e.prototype.blend=function(t){var e=this.animationState,i=e._blendState.blendWeight;2===t?(e.weight+=this._floats[5]*i,e.currentTime+=this._floats[2]*i):(e.weight=this._floats[5]*i,e.currentTime=this._floats[2]*i)},e}(t.TweenTimelineState);t.AnimationTimelineState=f}(Cot),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Tot(e,t),e.actionDataToInstance=function(t,i,n){0===t.type?i.type=e.FRAME_EVENT:i.type=10===t.type?e.FRAME_EVENT:e.SOUND_EVENT,i.name=t.name,i.armature=n,i.actionData=t,i.data=t.data,null!==t.bone&&(i.bone=n.getBone(t.bone.name)),null!==t.slot&&(i.slot=n.getSlot(t.slot.name))},e.toString=function(){return"[class dragonBones.EventObject]"},e.prototype._onClear=function(){this.time=0,this.type="",this.name="",this.armature=null,this.bone=null,this.slot=null,this.animationState=null,this.actionData=null,this.data=null},e.START="start",e.LOOP_COMPLETE="loopComplete",e.COMPLETE="complete",e.FADE_IN="fadeIn",e.FADE_IN_COMPLETE="fadeInComplete",e.FADE_OUT="fadeOut",e.FADE_OUT_COMPLETE="fadeOutComplete",e.FRAME_EVENT="frameEvent",e.SOUND_EVENT="soundEvent",e}(t.BaseObject);t.EventObject=e}(Cot),function(t){var e=function(){function e(){}return e._getArmatureType=function(t){switch(t.toLowerCase()){case"stage":return 2;case"armature":default:return 0;case"movieclip":return 1}},e._getBoneType=function(t){switch(t.toLowerCase()){case"bone":default:return 0;case"surface":return 1}},e._getDisplayType=function(t){switch(t.toLowerCase()){case"image":default:return 0;case"mesh":return 2;case"armature":return 1;case"boundingbox":return 3;case"path":return 4}},e._getBoundingBoxType=function(t){switch(t.toLowerCase()){case"rectangle":default:return 0;case"ellipse":return 1;case"polygon":return 2}},e._getActionType=function(t){switch(t.toLowerCase()){case"play":default:return 0;case"frame":return 10;case"sound":return 11}},e._getBlendMode=function(t){switch(t.toLowerCase()){case"normal":default:return 0;case"add":return 1;case"alpha":return 2;case"darken":return 3;case"difference":return 4;case"erase":return 5;case"hardlight":return 6;case"invert":return 7;case"layer":return 8;case"lighten":return 9;case"multiply":return 10;case"overlay":return 11;case"screen":return 12;case"subtract":return 13}},e._getPositionMode=function(t){switch(t.toLocaleLowerCase()){case"percent":default:return 1;case"fixed":return 0}},e._getSpacingMode=function(t){switch(t.toLocaleLowerCase()){case"length":default:return 0;case"percent":return 2;case"fixed":return 1}},e._getRotateMode=function(t){switch(t.toLocaleLowerCase()){case"tangent":default:return 0;case"chain":return 1;case"chainscale":return 2}},e.parseDragonBonesData=function(e){return console.warn("Deprecated."),e instanceof ArrayBuffer?t.BinaryDataParser.getInstance().parseDragonBonesData(e):t.ObjectDataParser.getInstance().parseDragonBonesData(e)},e.parseTextureAtlasData=function(i,n){void 0===n&&(n=1),console.warn("已废弃");for(var r={},s=i[e.SUB_TEXTURE],a=0,o=s.length;a255)return encodeURI(r);return r}return String(r)}return n},n.prototype._getCurvePoint=function(t,e,i,n,r,s,a,o,h,u){var l=1-h,c=l*l,f=h*h,d=l*c,_=3*h*c,p=3*l*f,m=h*f;u.x=d*t+_*i+p*r+m*a,u.y=d*e+_*n+p*s+m*o},n.prototype._samplingEasingCurve=function(t,e){for(var i=t.length,n=-2,r=0,s=e.length;r=0&&n+61e-4;){var v=.5*(g+m);this._getCurvePoint(h,u,l,c,f,d,_,p,v,this._helpPoint),a-this._helpPoint.x>0?m=v:g=v}e[r]=this._helpPoint.y}},n.prototype._parseActionDataInFrame=function(e,i,n,r){t.DataParser.EVENT in e&&this._mergeActionFrame(e[t.DataParser.EVENT],i,10,n,r),t.DataParser.SOUND in e&&this._mergeActionFrame(e[t.DataParser.SOUND],i,11,n,r),t.DataParser.ACTION in e&&this._mergeActionFrame(e[t.DataParser.ACTION],i,0,n,r),t.DataParser.EVENTS in e&&this._mergeActionFrame(e[t.DataParser.EVENTS],i,10,n,r),t.DataParser.ACTIONS in e&&this._mergeActionFrame(e[t.DataParser.ACTIONS],i,0,n,r)},n.prototype._mergeActionFrame=function(e,n,r,s,a){for(var o=t.DragonBones.webAssembly?this._armature.actions.size():this._armature.actions.length,h=this._parseActionData(e,r,s,a),u=0,l=null,c=0,f=h;cn)break;u++}null===l&&((l=new i).frameStart=n,this._actionFrames.splice(u+1,0,l));for(var g=0;g0){var d=r.getBone(c);null!==d?f.parent=d:(c in this._cacheBones||(this._cacheBones[c]=[]),this._cacheBones[c].push(f))}if(f.name in this._cacheBones){for(var _=0,p=this._cacheBones[f.name];_0&&null!==i.parent?(s.root=i.parent,s.bone=i):(s.root=i,s.bone=null),s},n.prototype._parsePathConstraint=function(e){var i=this._armature.getSlot(n._getString(e,t.DataParser.TARGET,""));if(null===i)return null;var r=this._armature.defaultSkin;if(null===r)return null;var s=r.getDisplay(i.name,n._getString(e,t.DataParser.TARGET_DISPLAY,i.name));if(null===s||!(s instanceof t.PathDisplayData))return null;var a=e[t.DataParser.BONES];if(null===a||0===a.length)return null;var o=t.BaseObject.borrowObject(t.PathConstraintData);o.name=n._getString(e,t.DataParser.NAME,""),o.type=1,o.pathSlot=i,o.pathDisplayData=s,o.target=i.parent,o.positionMode=t.DataParser._getPositionMode(n._getString(e,t.DataParser.POSITION_MODE,"")),o.spacingMode=t.DataParser._getSpacingMode(n._getString(e,t.DataParser.SPACING_MODE,"")),o.rotateMode=t.DataParser._getRotateMode(n._getString(e,t.DataParser.ROTATE_MODE,"")),o.position=n._getNumber(e,t.DataParser.POSITION,0),o.spacing=n._getNumber(e,t.DataParser.SPACING,0),o.rotateOffset=n._getNumber(e,t.DataParser.ROTATE_OFFSET,0),o.rotateMix=n._getNumber(e,t.DataParser.ROTATE_MIX,1),o.translateMix=n._getNumber(e,t.DataParser.TRANSLATE_MIX,1);for(var h=0,u=a;h0?r:i,this._parsePivot(e,o);break;case 1:var h=a=t.BaseObject.borrowObject(t.ArmatureDisplayData);if(h.name=i,h.path=r.length>0?r:i,h.inheritAnimation=!0,t.DataParser.ACTIONS in e)for(var u=0,l=this._parseActionData(e[t.DataParser.ACTIONS],0,null,null);u0?r:i,p.vertices.data=this._data,t.DataParser.SHARE in e?(this._cacheRawMeshes.push(e),this._cacheMeshes.push(p)):this._parseMesh(e,p),t.DataParser.GLUE_WEIGHTS in e&&t.DataParser.GLUE_MESHES in e&&(this._cacheRawMeshes.push(e),this._cacheMeshes.push(p));break;case 3:var m=this._parseBoundingBox(e);if(null!==m){var g=a=t.BaseObject.borrowObject(t.BoundingBoxDisplayData);g.name=i,g.path=r.length>0?r:i,g.boundingBox=m}break;case 4:var v=e[t.DataParser.LENGTHS],y=a=t.BaseObject.borrowObject(t.PathDisplayData);y.closed=n._getBoolean(e,t.DataParser.CLOSED,!1),y.constantSpeed=n._getBoolean(e,t.DataParser.CONSTANT_SPEED,!1),y.name=i,y.path=r.length>0?r:i,y.vertices.data=this._data,y.curveLengths.length=v.length;for(var b=0,S=v.length;bi.width&&(i.width=h),ui.height&&(i.height=u))}i.width-=i.x,i.height-=i.y}else console.warn("Data error.\n Please reexport DragonBones Data to fixed the bug.");return i},n.prototype._parseAnimation=function(e){var i=t.BaseObject.borrowObject(t.AnimationData);if(i.frameCount=Math.max(n._getNumber(e,t.DataParser.DURATION,1),1),i.playTimes=n._getNumber(e,t.DataParser.PLAY_TIMES,1),i.duration=i.frameCount/this._armature.frameRate,i.fadeInTime=n._getNumber(e,t.DataParser.FADE_IN_TIME,0),i.scale=n._getNumber(e,t.DataParser.SCALE,1),i.name=n._getString(e,t.DataParser.NAME,t.DataParser.DEFAULT_NAME),0===i.name.length&&(i.name=t.DataParser.DEFAULT_NAME),i.frameIntOffset=this._frameIntArray.length,i.frameFloatOffset=this._frameFloatArray.length,i.frameOffset=this._frameArray.length,this._animation=i,t.DataParser.FRAME in e){var r=e[t.DataParser.FRAME],s=r.length;if(s>0)for(var a=0,o=0;a0&&(this._animation.actionTimeline=this._parseTimeline(null,this._actionFrames,"",0,!1,!1,0,this._parseActionFrame),this._actionFrames.length=0),this._animation=null,i},n.prototype._parseTimeline=function(e,r,s,a,o,h,u,l){if(null!==e&&s.length>0&&s in e&&(r=e[s]),null===r)return null;var c=r.length;if(0===c)return null;var f=this._frameIntArray.length,d=this._frameFloatArray.length,_=t.BaseObject.borrowObject(t.TimelineData),p=this._timelineArray.length;if(this._timelineArray.length+=5+c,null!==e?(this._timelineArray[p+0]=Math.round(100*n._getNumber(e,t.DataParser.SCALE,1)),this._timelineArray[p+1]=Math.round(100*n._getNumber(e,t.DataParser.OFFSET,0))):(this._timelineArray[p+0]=100,this._timelineArray[p+1]=0),this._timelineArray[p+2]=c,this._timelineArray[p+3]=u,this._timelineArray[p+4]=o?f-this._animation.frameIntOffset:h?d-this._animation.frameFloatOffset:0,this._timeline=_,_.type=a,_.offset=p,1===c)_.frameIndicesOffset=-1,this._timelineArray[p+5+0]=l.call(this,r[0],0,0)-this._animation.frameOffset;else{var m=this._animation.frameCount+1,g=this._data.frameIndices,v=0;t.DragonBones.webAssembly?(v=g.size(),g.resize(v+m,0)):(v=g.length,g.length+=m),_.frameIndicesOffset=v;for(var y=0,b=0,S=0,x=0;y0)if(t.DataParser.CURVE in e){var a=r+1;this._helpArray.length=a,this._samplingEasingCurve(e[t.DataParser.CURVE],this._helpArray),this._frameArray.length+=2+this._helpArray.length,this._frameArray[s+1]=2,this._frameArray[s+2]=a;for(var o=0;o0){for(var a=this._armature.sortedSlots.length,o=new Array(a-s.length/2),h=new Array(a),u=0;u0?s>=this._prevRotation:s<=this._prevRotation)&&(this._prevClockwise=this._prevClockwise>0?this._prevClockwise-1:this._prevClockwise+1),s=this._prevRotation+s-this._prevRotation+t.Transform.PI_D*this._prevClockwise)),this._prevClockwise=n._getNumber(e,t.DataParser.TWEEN_ROTATE,0),this._prevRotation=s;var a=this._parseTweenFrame(e,i,r),o=this._frameFloatArray.length;return this._frameFloatArray.length+=6,this._frameFloatArray[o++]=this._helpTransform.x,this._frameFloatArray[o++]=this._helpTransform.y,this._frameFloatArray[o++]=s,this._frameFloatArray[o++]=this._helpTransform.skew,this._frameFloatArray[o++]=this._helpTransform.scaleX,this._frameFloatArray[o++]=this._helpTransform.scaleY,this._parseActionDataInFrame(e,i,this._bone,this._slot),a},n.prototype._parseBoneTranslateFrame=function(e,i,r){var s=this._parseTweenFrame(e,i,r),a=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[a++]=n._getNumber(e,t.DataParser.X,0),this._frameFloatArray[a++]=n._getNumber(e,t.DataParser.Y,0),s},n.prototype._parseBoneRotateFrame=function(e,i,r){var s=n._getNumber(e,t.DataParser.ROTATE,0)*t.Transform.DEG_RAD;0!==i&&(0===this._prevClockwise?s=this._prevRotation+t.Transform.normalizeRadian(s-this._prevRotation):((this._prevClockwise>0?s>=this._prevRotation:s<=this._prevRotation)&&(this._prevClockwise=this._prevClockwise>0?this._prevClockwise-1:this._prevClockwise+1),s=this._prevRotation+s-this._prevRotation+t.Transform.PI_D*this._prevClockwise)),this._prevClockwise=n._getNumber(e,t.DataParser.CLOCK_WISE,0),this._prevRotation=s;var a=this._parseTweenFrame(e,i,r),o=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[o++]=s,this._frameFloatArray[o++]=n._getNumber(e,t.DataParser.SKEW,0)*t.Transform.DEG_RAD,a},n.prototype._parseBoneScaleFrame=function(e,i,r){var s=this._parseTweenFrame(e,i,r),a=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[a++]=n._getNumber(e,t.DataParser.X,1),this._frameFloatArray[a++]=n._getNumber(e,t.DataParser.Y,1),s},n.prototype._parseSurfaceFrame=function(e,i,r){var s=this._frameFloatArray.length,a=this._parseTweenFrame(e,i,r),o=e[t.DataParser.VERTICES],h=n._getNumber(e,t.DataParser.OFFSET,0),u=this._surface.vertices.length/2,l=0,c=0;this._frameFloatArray.length+=2*u;for(var f=0;f<2*u;f+=2)l=f=o.length?0:o[f-h],c=f+1=o.length?0:o[f+1-h],this._frameFloatArray[s+f]=l,this._frameFloatArray[s+f+1]=c;if(0===i){var d=this._frameIntArray.length;this._frameIntArray.length+=5,this._frameIntArray[d+0]=0,this._frameIntArray[d+1]=this._frameFloatArray.length-s,this._frameIntArray[d+2]=this._frameFloatArray.length-s,this._frameIntArray[d+3]=0,this._frameIntArray[d+4]=s-this._animation.frameFloatOffset,this._timelineArray[this._timeline.offset+3]=d-this._animation.frameIntOffset}return a},n.prototype._parseSlotDisplayFrame=function(e,i,r){var s=this._parseFrame(e,i,r);return this._frameArray.length+=1,t.DataParser.VALUE in e?this._frameArray[s+1]=n._getNumber(e,t.DataParser.VALUE,0):this._frameArray[s+1]=n._getNumber(e,t.DataParser.DISPLAY_INDEX,0),this._parseActionDataInFrame(e,i,this._slot.parent,this._slot),s},n.prototype._parseSlotColorFrame=function(e,i,n){var r=this._parseTweenFrame(e,i,n),s=-1;if(t.DataParser.VALUE in e||t.DataParser.COLOR in e){var a=t.DataParser.VALUE in e?e[t.DataParser.VALUE]:e[t.DataParser.COLOR];for(var o in a){this._parseColorTransform(a,this._helpColorTransform),s=this._intArray.length,this._intArray.length+=8,this._intArray[s++]=Math.round(100*this._helpColorTransform.alphaMultiplier),this._intArray[s++]=Math.round(100*this._helpColorTransform.redMultiplier),this._intArray[s++]=Math.round(100*this._helpColorTransform.greenMultiplier),this._intArray[s++]=Math.round(100*this._helpColorTransform.blueMultiplier),this._intArray[s++]=Math.round(this._helpColorTransform.alphaOffset),this._intArray[s++]=Math.round(this._helpColorTransform.redOffset),this._intArray[s++]=Math.round(this._helpColorTransform.greenOffset),this._intArray[s++]=Math.round(this._helpColorTransform.blueOffset),s-=8;break}}s<0&&(this._defaultColorOffset<0&&(this._defaultColorOffset=s=this._intArray.length,this._intArray.length+=8,this._intArray[s++]=100,this._intArray[s++]=100,this._intArray[s++]=100,this._intArray[s++]=100,this._intArray[s++]=0,this._intArray[s++]=0,this._intArray[s++]=0,this._intArray[s++]=0),s=this._defaultColorOffset);var h=this._frameIntArray.length;return this._frameIntArray.length+=1,this._frameIntArray[h]=s,r},n.prototype._parseSlotFFDFrame=function(e,i,r){var s=this._frameFloatArray.length,a=this._parseTweenFrame(e,i,r),o=t.DataParser.VERTICES in e?e[t.DataParser.VERTICES]:null,h=n._getNumber(e,t.DataParser.OFFSET,0),u=this._intArray[this._mesh.vertices.offset+0],l=this._mesh.parent.name+"_"+this._slot.name+"_"+this._mesh.name,c=this._mesh.vertices.weight,f=0,d=0,_=0,p=0;if(null!==c){var m=this._weightSlotPose[l];this._helpMatrixA.copyFromArray(m,0),this._frameFloatArray.length+=2*c.count,_=c.offset+2+c.bones.length}else this._frameFloatArray.length+=2*u;for(var g=0;g<2*u;g+=2)if(null===o?(f=0,d=0):(f=g=o.length?0:o[g-h],d=g+1=o.length?0:o[g+1-h]),null!==c){var v=this._weightBonePoses[l],y=this._intArray[_++];this._helpMatrixA.transformPoint(f,d,this._helpPoint,!0),f=this._helpPoint.x,d=this._helpPoint.y;for(var b=0;b=0||t.DataParser.DATA_VERSIONS.indexOf(s)>=0){var a=t.BaseObject.borrowObject(t.DragonBonesData);if(a.version=r,a.name=n._getString(e,t.DataParser.NAME,""),a.frameRate=n._getNumber(e,t.DataParser.FRAME_RATE,24),0===a.frameRate&&(a.frameRate=24),t.DataParser.ARMATURE in e){this._data=a,this._parseArray(e);for(var o=0,h=e[t.DataParser.ARMATURE];o0&&(a.stage=a.getArmature(a.armatureNames[0])),this._data=null}return t.DataParser.TEXTURE_ATLAS in e&&(this._rawTextureAtlases=e[t.DataParser.TEXTURE_ATLAS]),a}return console.assert(!1,"Nonsupport data version: "+r+"\nPlease convert DragonBones data to support version.\nRead more: https://github.com/DragonBones/Tools/"),null},n.prototype.parseTextureAtlasData=function(e,i,r){if(void 0===r&&(r=1),console.assert(void 0!==e),null===e){if(null===this._rawTextureAtlases||0===this._rawTextureAtlases.length)return!1;var s=this._rawTextureAtlases[this._rawTextureAtlasIndex++];return this.parseTextureAtlasData(s,i,r),this._rawTextureAtlasIndex>=this._rawTextureAtlases.length&&(this._rawTextureAtlasIndex=0,this._rawTextureAtlases=null),!0}if(i.width=n._getNumber(e,t.DataParser.WIDTH,0),i.height=n._getNumber(e,t.DataParser.HEIGHT,0),i.scale=1===r?1/n._getNumber(e,t.DataParser.SCALE,1):r,i.name=n._getString(e,t.DataParser.NAME,""),i.imagePath=n._getString(e,t.DataParser.IMAGE_PATH,""),t.DataParser.SUB_TEXTURE in e)for(var a=e[t.DataParser.SUB_TEXTURE],o=0,h=a.length;o0&&f>0&&(l.frame=t.TextureData.createRectangle(),l.frame.x=n._getNumber(u,t.DataParser.FRAME_X,0),l.frame.y=n._getNumber(u,t.DataParser.FRAME_Y,0),l.frame.width=c,l.frame.height=f),i.addTexture(l)}return!0},n.getInstance=function(){return null===n._objectDataParserInstance&&(n._objectDataParserInstance=new n),n._objectDataParserInstance},n._objectDataParserInstance=null,n}(t.DataParser);t.ObjectDataParser=e;var i=function(){this.frameStart=0,this.actions=[]};t.ActionFrame=i}(Cot),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Tot(i,e),i.prototype._inRange=function(t,e,i){return e<=t&&t<=i},i.prototype._decodeUTF8=function(t){for(var e,i=0,n="",r=0,s=0,a=0,o=0;t.length>i;){var h=t[i++];if(-1===h)e=0!==s?65533:-1;else if(0===s)this._inRange(h,0,127)?e=h:(this._inRange(h,194,223)?(s=1,o=128,r=h-192):this._inRange(h,224,239)?(s=2,o=2048,r=h-224):this._inRange(h,240,244)&&(s=3,o=65536,r=h-240),r*=Math.pow(64,s),e=null);else if(this._inRange(h,128,191))if(a+=1,r+=(h-128)*Math.pow(64,s-a),a!==s)e=null;else{var u=r,l=o;r=0,s=0,a=0,o=0,e=this._inRange(u,l,1114111)&&!this._inRange(u,55296,57343)?u:h}else r=0,s=0,a=0,o=0,i--,e=h;null!==e&&-1!==e&&(e<=65535?e>0&&(n+=String.fromCharCode(e)):(e-=65536,n+=String.fromCharCode(55296+(e>>10&1023)),n+=String.fromCharCode(56320+(1023&e))))}return n},i.prototype._getUTF16Key=function(t){for(var e=0,i=t.length;e255)return encodeURI(t);return t},i.prototype._parseBinaryTimeline=function(e,i,n){void 0===n&&(n=null);var r=null!==n?n:t.BaseObject.borrowObject(t.TimelineData);r.type=e,r.offset=i,this._timeline=r;var s=this._timelineArrayBuffer[r.offset+2];if(1===s)r.frameIndicesOffset=-1;else{var a=0,o=this._animation.frameCount+1,h=this._data.frameIndices;t.DragonBones.webAssembly?(a=h.size(),h.resize(a+o,0)):(a=h.length,h.length+=o),r.frameIndicesOffset=a;for(var u=0,l=0,c=0,f=0;u=0){var r=t.BaseObject.borrowObject(t.WeightData),s=this._intArrayBuffer[i.offset+0],a=this._intArrayBuffer[n+0];r.offset=n;for(var o=0;o0&&e in this._dragonBonesDataMap&&(a=(s=this._dragonBonesDataMap[e]).getArmature(i)),null===a&&(0===e.length||this.autoSearch))for(var o in this._dragonBonesDataMap)if(s=this._dragonBonesDataMap[o],(0===e.length||s.autoSearch)&&null!==(a=s.getArmature(i))){e=o;break}if(null!==a){if(t.dataName=e,t.textureAtlasName=r,t.data=s,t.armature=a,t.skin=null,n.length>0&&(t.skin=a.getSkin(n),null===t.skin&&this.autoSearch))for(var o in this._dragonBonesDataMap){var h=this._dragonBonesDataMap[o].getArmature(n);if(null!==h){t.skin=h.defaultSkin;break}}return null===t.skin&&(t.skin=a.defaultSkin),!0}return!1},e.prototype._buildBones=function(e,i){for(var n=0,r=e.armature.sortedBones;n0&&(o.texture=this._getTextureData(e.textureAtlasName,i.path)),null===o.texture&&(o.texture=this._getTextureData(s,i.path)),a=null!==n&&2===n.type&&this._isSupportMesh()?r.meshDisplay:r.rawDisplay;break;case 2:var h=i;null!==e&&e.textureAtlasName.length>0&&(h.texture=this._getTextureData(e.textureAtlasName,h.path)),null===h.texture&&(h.texture=this._getTextureData(s,h.path)),a=this._isSupportMesh()?r.meshDisplay:r.rawDisplay;break;case 1:var u=i,l=this._buildChildArmature(e,r,i);if(null!==l){if(l.inheritAnimation=u.inheritAnimation,!l.inheritAnimation){var c=u.actions.length>0?u.actions:l.armatureData.defaultActions;if(c.length>0)for(var f=0,d=c;f=0)){var l=i.getDisplays(u.name);if(l||(null!==a&&i!==a&&(l=a.getDisplays(u.name)),l)){var c=t.DragonBones.webAssembly?l.size():l.length,f=u.displayList;f.length=c;for(var d=0,_=c;d<_;++d){var p=t.DragonBones.webAssembly?l.get(d):l[d];f[d]=null!==p?this._getSlotDisplay(null,p,null,u):null}s=!0,u.rawDisplayDatas=l,u.displayList=f}else n&&(u.rawDisplayDatas=null,u.displayList=[])}}return s},e.prototype.replaceAnimation=function(e,i,n){void 0===n&&(n=!0);var r=i.defaultSkin;if(null===r)return!1;if(n)e.animation.animations=i.animations;else{var s=e.animation.animations,a={};for(var o in s)a[o]=s[o];for(var o in i.animations)a[o]=i.animations[o];e.animation.animations=a}for(var h=0,u=e.getSlots();h0&&n.inheritDeform,a=this._localVertices;if(r){var o=n.data,h=o.intArray,u=o.floatArray,l=h[n.offset+rut.MeshVertexCount],c=h[r.offset+rut.WeigthFloatOffset];c<0&&(c+=65536);for(var f=0,d=r.offset+rut.WeigthBoneIndices+i.length,_=c,p=0,m=0;f=0;o--)if(s>=e[o]._zOrder){e.splice(o+1,0,r),a=!0;break}a||e.unshift(r)}this._slots=e},i._buildArmature=function(t){var e=Not.borrowObject(Sht);e._skinData=t.skin,e._animation=Not.borrowObject(Mht),e._animation._armature=e,e._animation.animations=t.armature.animations,e._isChildArmature=!1;var i=new gut;return e.init(t.armature,i,i,this._dragonBones),e},i._buildSlot=function(t,e,i){var n=Not.borrowObject(mut),r=n;return n.init(e,i,r,r),n},i.getDragonBonesDataByUUID=function(t){for(var e in this._dragonBonesDataMap)if(-1!==e.indexOf(t))return this._dragonBonesDataMap[e];return null},i.removeDragonBonesDataByUUID=function(t,e){for(var i in void 0===e&&(e=!0),this._dragonBonesDataMap)-1!==i.indexOf(t)&&(e&&this._dragonBones.bufferObject(this._dragonBonesDataMap[i]),delete this._dragonBonesDataMap[i])},e}(iut),Pot._factory=null,Mot=Pot))||Mot,yut=1/60,but=[],Sut=[],xut=0,wut=0,Tut=0,Cut=null,Aut=null,Dut=0,Iut=0,But=0,Mut=0,Put=0,Eut=function(){function t(){this.maxVertexCount=0,this.maxIndexCount=0,this._privateMode=!1,this._inited=!1,this._invalid=!0,this._enableCacheAttachedInfo=!1,this.frames=[],this.totalTime=0,this.isCompleted=!1,this._frameIdx=-1,this._armatureInfo=null,this._animationName=null,this._tempSegments=null,this._tempColors=null,this._tempBoneInfos=null}var e=t.prototype;return e.init=function(t,e){this._inited=!0,this._armatureInfo=t,this._animationName=e},e.clear=function(){this._inited=!1;for(var t=0,e=this.frames.length;t0&&(r[Mut-1].vfOffset=Tut),r.length=Mut,s.length=xut;var a=But-1;if(a>=0)if(Iut>0){var o=n[a];o.indexCount=Iut,o.vfCount=9*Dut,o.vertexCount=Dut,n.length=But}else n.length=But-1;if(0!==n.length){var h,u=i.vertices,l=Tut/5,c=9*l;(!u||u.length>8&255)/255,u[f+7]=(h>>16&255)/255,u[f+8]=(h>>24&255)/255,f+=9;var _=i.indices;(!_||_.lengththis.maxVertexCount?l:this.maxVertexCount,this.maxIndexCount=_.length>this.maxIndexCount?_.length:this.maxIndexCount}},e._traverseArmature=function(t,e){var i,n,r,s,a,o,h,u,l,c=this._tempColors,f=this._tempSegments,d=this._tempBoneInfos,_=t._slots,p=t._bones;if(this._enableCacheAttachedInfo)for(var m=0,g=p.length;m=0&&(Iut>0?((l=f[u]).indexCount=Iut,l.vertexCount=Dut,l.vfCount=9*Dut):But--),f[But]={tex:h,blendMode:r._blendMode,indexCount:0,vertexCount:0,vfCount:0},But++,Iut=0,Dut=0),o=(a.a*e<<24>>>0)+(a.b<<16)+(a.g<<8)+a.r,Put!==o&&(Put=o,Mut>0&&(c[Mut-1].vfOffset=Tut),c[Mut++]={r:a.r,g:a.g,b:a.b,a:a.a*e,vfOffset:0}),i=r._localVertices,n=r._indices,s=r._worldMatrix;for(var w=0,T=i.length;w":0},r=i.animations,s=0;for(var a in r)r.hasOwnProperty(a)&&(n[a]=s+1,s++);return Ee(n)}return null},i.destroy=function(){return this._clear(),t.prototype.destroy.call(this)},i._clear=function(){this._factory&&(kut.sharedCache.resetArmature(this._uuid),this._factory.removeDragonBonesDataByUUID(this._uuid,!0))},n(e,[{key:"dragonBonesJson",get:function(){return this._dragonBonesJson},set:function(t){this._dragonBonesJson=t,this._dragonBonesJsonData=JSON.parse(t),this.reset()}}]),e}(Cm),Lot=Nh(Fot.prototype,"_dragonBonesJson",[Gut],(function(){return""})),Oot=Fot))||Oot;C.internal.DragonBonesAsset=Hut;var Wut,jut=hu,qut=Eu,Xut=(Rut=Qh("dragonBones.DragonBonesAtlasAsset"),Out=qut(Pv),Rut((Lut=function(t){function e(){var e;return(e=t.call(this)||this)._atlasJson=Vut&&Vut(),e._texture=Nut&&Nut(),e._atlasJsonData=zut&&zut(),e._factory=null,e._textureAtlasData=Uut&&Uut(),e._clear(),e}s(e,t);var i=e.prototype;return i.createNode=function(t){var e=new tb(this.name);return e.addComponent("dragonBones.ArmatureDisplay").dragonAtlasAsset=this,t(null,e)},i.init=function(t){this._factory=t,this._atlasJsonData||(this._atlasJsonData=JSON.parse(this.atlasJson));var e=this._atlasJsonData;this._uuid=this._uuid||e.name,this._textureAtlasData?t.addTextureAtlasData(this._textureAtlasData,this._uuid):this._textureAtlasData=t.parseTextureAtlasData(e,this.texture,this._uuid)},i.destroy=function(){return this._clear(),t.prototype.destroy.call(this)},i._clear=function(){this._factory&&(kut.sharedCache.resetArmature(this._uuid),this._factory.removeTextureAtlasData(this._uuid,!0),this._factory.removeDragonBonesDataByUUID(this._uuid,!0)),this._textureAtlasData=null},n(e,[{key:"atlasJson",get:function(){return this._atlasJson},set:function(t){this._atlasJson=t,this._atlasJsonData=JSON.parse(this.atlasJson),this._clear()}},{key:"texture",get:function(){return this._texture},set:function(t){this._texture=t,this._clear()}}]),e}(Cm),Vut=Nh(Lut.prototype,"_atlasJson",[jut],(function(){return""})),Nut=Nh(Lut.prototype,"_texture",[jut,Out],(function(){return null})),zut=Nh(Lut.prototype,"_atlasJsonData",[jut],(function(){return{}})),Uut=Nh(Lut.prototype,"_textureAtlasData",[jut],(function(){return null})),Fut=Lut))||Fut);C.internal.DragonBonesAtlasAsset=Xut;var Yut,Qut,Jut,Kut,Zut,$ut,tlt,elt,ilt,nlt,rlt,slt,alt,olt,hlt,ult,llt,clt,flt,dlt,_lt,plt,mlt,glt,vlt,ylt,blt,Slt,xlt,wlt,Tlt=new Qr,Clt=Qh("dragonBones.AttachUtil")(Wut=function(){function t(){this._inited=!1,this._armature=null,this._armatureNode=null,this._armatureDisplay=null}var e=t.prototype;return e.init=function(t){this._inited=!0,this._armature=t._armature,this._armatureNode=t.node,this._armatureDisplay=t},e.reset=function(){this._inited=!1,this._armature=null,this._armatureNode=null,this._armatureDisplay=null},e._syncAttachedNode=function(){if(this._inited){this._armatureNode.worldMatrix;var t=null,e=this._armatureDisplay.isAnimationCached();if(!e||!this._armatureDisplay||(t=this._armatureDisplay._curFrame&&this._armatureDisplay._curFrame.boneInfos))for(var i,n,r,s=this._armatureDisplay.sockets,a=this._armatureDisplay.socketNodes,o=this._armature.getBones(),h=s.length-1;h>=0;h--){var u=s[h],l=u.target;if(l)if(l.isValid){var c=e?t[u.boneIndex]:o[u.boneIndex];c&&(i=l,n=c.globalTransformMatrix,r=void 0,(r=Tlt).m00=n.a,r.m01=n.b,r.m04=-n.c,r.m05=-n.d,r.m12=n.tx,r.m13=n.ty,i.matrix=Tlt)}else a.delete(u.path),s.splice(h,1)}}},t}())||Wut,Alt=function(t){function e(){var e;return(e=t.call(this)||this)._armatures=new Set,e}s(e,t),e.getInstance=function(){return e._instance||(e._instance=new e,GE.registerSystem(e.ID,e._instance,200)),e._instance};var i=e.prototype;return i.add=function(t){t&&(this._armatures.has(t)||this._armatures.add(t))},i.remove=function(t){t&&this._armatures.has(t)&&this._armatures.delete(t)},i.postUpdate=function(t){this._armatures&&this._armatures.forEach((function(e){e.updateAnimation(t),e.syncAttachedNode()}))},i.prepareRenderData=function(){this._armatures&&this._armatures.forEach((function(t){t._markForUpdateRenderData()}))},e}(Of);Alt.ID="ARMATURE",Alt._instance=void 0,C.internal.ArmatureSystem=Alt;var Dlt={default:-1};Oe(Dlt);var Ilt={"":0};Oe(Ilt);var Blt={REALTIME:0};Oe(Blt);var Mlt={REALTIME:0,SHARED_CACHE:1,PRIVATE_CACHE:2};Oe(Mlt);var Plt=Qh,Elt=hu,klt=Eu,Rlt=Uu,Olt=(Yut=Plt("dragonBones.ArmatureDisplay.DragonBoneSocket"),Qut=klt(tb),Yut((Kut=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),this.path=Zut&&Zut(),this.target=$ut&&$ut(),this.boneIndex=null,this.path=t,this.target=e},Zut=Nh(Kut.prototype,"path",[Elt],(function(){return""})),$ut=Nh(Kut.prototype,"target",[Qut,Elt],(function(){return null})),Jut=Kut))||Jut);le(Olt,"dragonBones.ArmatureDisplay.DragonBoneSocket");var Flt=(tlt=Plt("dragonBones.ArmatureDisplay"),elt=klt(Hut),ilt=klt(Xut),nlt=klt(Dlt),rlt=klt(Ilt),slt=klt([Olt]),alt=klt(FT),tlt((wlt=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this).playTimes=ult&&ult(),e.premultipliedAlpha=llt&&llt(),e._armature=null,e.attachUtil=void 0,e._defaultArmatureIndexValue=clt&&clt(),e._dragonAsset=flt&&flt(),e._dragonAtlasAsset=dlt&&dlt(),e._armatureName=_lt&&_lt(),e._animationName=plt&&plt(),e._animationIndexValue=mlt&&mlt(),e._preCacheMode=-1,e._cacheMode=0,e._defaultCacheModeValue=glt&&glt(),e._timeScale=vlt&&vlt(),e._playTimes=ylt&&ylt(),e._debugBones=blt&&blt(),e._enableBatch=Slt&&Slt(),e._debugDraw=null,e._armatureKey="",e._accTime=0,e._playCount=0,e._frameCache=null,e._curFrame=null,e._playing=!1,e._armatureCache=null,e._eventTarget=void 0,e._factory=null,e._displayProxy=null,e._drawIdx=0,e._drawList=new ho((function(){return{material:null,texture:null,indexOffset:0,indexCount:0}}),1),e.maxVertexCount=0,e.maxIndexCount=0,e._materialCache={},e._enumArmatures=Ee({}),e._enumAnimations=Ee({}),e._socketNodes=new Map,e._cachedSockets=new Map,e._sockets=xlt&&xlt(),e._inited=void 0,e._drawInfoList=[],e._cacheModeEnum=void 0,e._eventTarget=new Io,e._inited=!1,e.attachUtil=new Clt,e.initFactory(),Ti(f(e),"_animationIndex",e._enumAnimations),Ti(f(e),"_defaultArmatureIndex",e._enumArmatures),e._useVertexOpacity=!0,e}return e.requestDrawInfo=function(t){return this._drawInfoList[t]||(this._drawInfoList[t]=new jF),this._drawInfoList[t]},e.initFactory=function(){this._factory=vut.getInstance()},e.onLoad=function(){t.prototype.onLoad.call(this)},e._requestDrawData=function(t,e,i,n){var r=this._drawList.add();return r.material=t,r.texture=e,r.indexOffset=i,r.indexCount=n,r},e.destroyRenderData=function(){this._drawList.reset(),t.prototype.destroyRenderData.call(this)},e.getMaterialTemplate=function(){return null!==this.customMaterial?this.customMaterial:(this.material||this.updateMaterial(),this.material)},e.getMaterialForBlend=function(t,e){var i=t+"/"+e,n=this._materialCache[i];if(n)return n;var r=this.getMaterialTemplate();return(n=new jT({parent:r,subModelIdx:0,owner:this})).recompileShaders({TWO_COLORED:!1,USE_LOCAL:!1}),this._materialCache[i]=n,n.overridePipelineStates({blendState:{targets:[{blendSrc:t,blendDst:e}]}}),n},e._updateBuiltinMaterial=function(){return _T.get("default-spine-material")},e.updateMaterial=function(){var t;t=this._customMaterial?this._customMaterial:this._updateBuiltinMaterial(),this.setSharedMaterial(t,0),this._cleanMaterialCache()},e._render=function(t){var e=0;if(this.renderData&&this._drawList){for(var i=this.renderData,n=i.chunk,r=n.vertexAccessor,s=i.getMeshBuffer(),a=s.indexOffset,o=0;othis.maxVertexCount?e.maxVertexCount:this.maxVertexCount,this.maxIndexCount=e.maxIndexCount>this.maxIndexCount?e.maxIndexCount:this.maxIndexCount,this.renderData.resize(this.maxVertexCount,this.maxIndexCount),(!this.renderData.indices||this.maxIndexCount>this.renderData.indices.length)&&(this.renderData.indices=new Uint16Array(this.maxIndexCount)))),e.isCompleted&&r>=i.length){if(this._playCount++,this.playTimes>0&&this._playCount>=this.playTimes)return this._curFrame=i[i.length-1],this._accTime=0,this._playing=!1,this._playCount=0,this._emitCacheCompleteEvent(),void this.attachUtil._syncAttachedNode();this._accTime=0,r=0,this._emitCacheCompleteEvent()}this._curFrame=i[r],this.attachUtil._syncAttachedNode()}else e.isInvalid()&&(e.updateToFrame(),this._curFrame=i[i.length-1],this.renderData&&(this.renderData.vertexCountthis.maxVertexCount?e.maxVertexCount:this.maxVertexCount,this.maxIndexCount=e.maxIndexCount>this.maxIndexCount?e.maxIndexCount:this.maxIndexCount,this.renderData.resize(this.maxVertexCount,this.maxIndexCount),(!this.renderData.indices||this.maxIndexCount>this.renderData.indices.length)&&(this.renderData.indices=new Uint16Array(this.maxIndexCount))))}}},e.onDestroy=function(){this._materialInstances=this._materialInstances.filter((function(t){return!!t})),this._inited=!1,2===this._cacheMode?(this._armatureCache.dispose(),this._armatureCache=null,this._armature=null):1===this._cacheMode?(this._armatureCache=null,this._armature=null):this._armature&&(this._armature.dispose(),this._armature=null),this._drawList.destroy(),t.prototype.onDestroy.call(this)},e._updateDebugDraw=function(){if(this.debugBones){if(!this._debugDraw){var t,e=new tb("DEBUG_DRAW_NODE");e.hideFlags|=1032;try{(t=e.addComponent("cc.Graphics")).lineWidth=1,t.strokeColor=new cr(255,0,0,255),this._debugDraw=t,this._debugDraw.node.parent=this.node}catch(t){ht(4501,t.message),e.destroy(),e=null}}}else this._debugDraw&&(this._debugDraw.node.parent=null);this._markForUpdateRenderData()},e._updateBatch=function(){this._cleanMaterialCache(),this._markForUpdateRenderData()},e._buildArmature=function(){if(this.dragonAsset&&this.dragonAtlasAsset&&this.armatureName){this._armature&&(2===this._preCacheMode?this._armatureCache.dispose():0===this._preCacheMode&&this._armature.dispose(),this._armatureCache=null,this._armature=null,this._displayProxy=null,this._frameCache=null,this._curFrame=null,this._playing=!1,this._preCacheMode=-1),1===this._cacheMode?this._armatureCache=kut.sharedCache:2===this._cacheMode&&(this._armatureCache=new kut,this._armatureCache.enablePrivateMode());var t=this.dragonAtlasAsset._uuid;if(this._armatureKey=this.dragonAsset.init(this._factory,t),this.isAnimationCached()&&(this._armature=this._armatureCache.getArmatureCache(this.armatureName,this._armatureKey,t),this._armature||(this._cacheMode=0)),this._preCacheMode=this._cacheMode,0===this._cacheMode){if(this._displayProxy=this._factory.buildArmatureDisplay(this.armatureName,this._armatureKey,"",t),!this._displayProxy)return;this._displayProxy._ccNode=this.node,this._displayProxy._ccComponent=this,this._displayProxy.setEventTarget(this._eventTarget),this._armature=this._displayProxy._armature,this._armature.animation.timeScale=this.timeScale}if(0!==this._cacheMode&&this.debugBones&&Y("Debug bones is invalid in cached mode"),this._armature){var e=this._armature.armatureData.aabb;this.node._getUITransformComp().setContentSize(e.width,e.height)}this.attachUtil.init(this),this.animationName&&this.playAnimation(this.animationName,this.playTimes),this._flushAssembler()}},e.querySockets=function(){return this._armature?(0===this._cachedSockets.size&&this._indexBoneSockets(),Array.from(this._cachedSockets.keys()).sort()):[]},e.querySocketPathByName=function(t){for(var e,i=[],n=p(this._cachedSockets.keys());!(e=n()).done;){var r=e.value;r.endsWith(t)&&i.push(r)}return i},e._parseDragonAtlasAsset=function(){this.dragonAtlasAsset&&this.dragonAtlasAsset.init(this._factory)},e._refresh=function(){this._buildArmature(),this._indexBoneSockets(),this._markForUpdateRenderData()},e._updateCacheModeEnum=function(){this._cacheModeEnum=Ee({}),this._armature?Object.assign(this._cacheModeEnum,Mlt):Object.assign(this._cacheModeEnum,Blt),Ti(this,"_defaultCacheMode",this._cacheModeEnum)},e._updateAnimEnum=function(){var t;t=this.dragonAsset?this.dragonAsset.getAnimsEnum(this.armatureName):Ilt,this._enumAnimations=Ee({}),Object.assign(this._enumAnimations,t||Ilt),Ee.update(this._enumAnimations),Ti(this,"_animationIndex",this._enumAnimations)},e._updateArmatureEnum=function(){var t;t=this.dragonAsset?this.dragonAsset.getArmatureEnum():Dlt,this._enumArmatures=Ee({}),Object.assign(this._enumArmatures,t||Dlt),Ee.update(this._enumArmatures),Ti(this,"_defaultArmatureIndex",this._enumArmatures)},e._indexBoneSockets=function(){if(this._armature){this._cachedSockets.clear();var t=this._cachedSockets,e=function t(e,i,n){if(n.has(e))return n.get(e);var r=i[e];if(!r.parent)return n.set(e,r.name),r.path=r.name,r.name;var s=t(r.parent._boneIndex,i,n)+"/"+r.name;return n.set(e,s),r.path=s,s};!function i(n,r){for(var s=r.getBones(),a=new Map,o=0;o0&&this._frameCache.enableCacheAttachedInfo(),this._frameCache.updateToFrame(0),this._playing=!0,this._curFrame=this._frameCache.frames[0])}else if(this._armature)return this._armature.animation.play(t,this.playTimes);return this._markForUpdateRenderData(),null},e.updateAnimationCache=function(t){this.isAnimationCached()&&this._armatureCache.updateAnimationCache(this._armatureKey,t)},e.invalidAnimationCache=function(){this.isAnimationCached()&&this._armatureCache.invalidAnimationCache(this._armatureKey)},e.getArmatureNames=function(){var t=this._factory.getDragonBonesData(this._armatureKey);return t&&t.armatureNames||[]},e.getAnimationNames=function(t){var e=[],i=this._factory.getDragonBonesData(this._armatureKey);if(i){var n=i.getArmature(t);if(n)for(var r in n.animations)n.animations.hasOwnProperty(r)&&e.push(r)}return e},e.on=function(t,e,i){this.addEventListener(t,e,i)},e.off=function(t,e,i){this.removeEventListener(t,e,i)},e.once=function(t,e,i){this._eventTarget.once(t,e,i)},e.addEventListener=function(t,e,i){this._eventTarget.on(t,e,i)},e.removeEventListener=function(t,e,i){this._eventTarget.off(t,e,i)},e.buildArmature=function(t,e){return this._factory.createArmatureNode(this,t,e)},e.armature=function(){return this._armature},e._flushAssembler=function(){var t=i.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t),this._armature&&this._assembler&&(this._renderData=this._assembler.createData(this),this._renderData&&(this.maxVertexCount=this._renderData.vertexCount,this.maxIndexCount=this._renderData.indexCount),this._markForUpdateRenderData(),this._updateColor())},e._updateSocketBindings=function(){if(this._armature){this._socketNodes.clear();for(var t=0,e=this._sockets.length;t0&&this._frameCache&&this._frameCache.enableCacheAttachedInfo()}},{key:"socketNodes",get:function(){return this._socketNodes}},{key:"drawList",get:function(){return this._drawList}},{key:"customMaterial",get:function(){return this._customMaterial},set:function(t){this._customMaterial=t,this.updateMaterial(),this._markForUpdateRenderData()}}]),i}(xL),wlt.AnimationCacheMode=Mlt,y((hlt=wlt).prototype,"dragonAsset",[elt],Object.getOwnPropertyDescriptor(hlt.prototype,"dragonAsset"),hlt.prototype),y(hlt.prototype,"dragonAtlasAsset",[ilt],Object.getOwnPropertyDescriptor(hlt.prototype,"dragonAtlasAsset"),hlt.prototype),y(hlt.prototype,"_defaultArmatureIndex",[nlt],Object.getOwnPropertyDescriptor(hlt.prototype,"_defaultArmatureIndex"),hlt.prototype),y(hlt.prototype,"_animationIndex",[rlt],Object.getOwnPropertyDescriptor(hlt.prototype,"_animationIndex"),hlt.prototype),y(hlt.prototype,"timeScale",[Elt],Object.getOwnPropertyDescriptor(hlt.prototype,"timeScale"),hlt.prototype),ult=Nh(hlt.prototype,"playTimes",[Elt],(function(){return-1})),llt=Nh(hlt.prototype,"premultipliedAlpha",[Elt],(function(){return!1})),y(hlt.prototype,"sockets",[slt],Object.getOwnPropertyDescriptor(hlt.prototype,"sockets"),hlt.prototype),clt=Nh(hlt.prototype,"_defaultArmatureIndexValue",[Elt],(function(){return-1})),flt=Nh(hlt.prototype,"_dragonAsset",[Elt],(function(){return null})),dlt=Nh(hlt.prototype,"_dragonAtlasAsset",[Elt],(function(){return null})),_lt=Nh(hlt.prototype,"_armatureName",[Elt],(function(){return""})),plt=Nh(hlt.prototype,"_animationName",[Elt],(function(){return""})),mlt=Nh(hlt.prototype,"_animationIndexValue",[Elt],(function(){return 0})),glt=Nh(hlt.prototype,"_defaultCacheModeValue",[Elt],(function(){return 0})),vlt=Nh(hlt.prototype,"_timeScale",[Elt],(function(){return 1})),ylt=Nh(hlt.prototype,"_playTimes",[Elt],(function(){return-1})),blt=Nh(hlt.prototype,"_debugBones",[Elt],(function(){return!1})),Slt=Nh(hlt.prototype,"_enableBatch",[Elt],(function(){return!1})),xlt=Nh(hlt.prototype,"_sockets",[Elt],(function(){return[]})),y(hlt.prototype,"customMaterial",[Rlt,alt],Object.getOwnPropertyDescriptor(hlt.prototype,"customMaterial"),hlt.prototype),olt=hlt))||olt);C.internal.ArmatureDisplay=Flt;var Llt,Vlt,Nlt,zlt,Ult,Glt,Hlt,Wlt,jlt,qlt,Xlt,Ylt=new cr(255,0,0,255),Qlt=new cr(0,0,255,255),Jlt=new cr(0,255,0,255),Klt=0,Zlt=0,$lt=0,tct=0,ect=0,ict=0,nct=0,rct=0,sct=0,act=new Float32Array(4),oct=new ir(0,0,0),hct=new Qr,uct=null,lct=null;function cct(t,e){if(!t)return null;var i,n;switch(e){case 1:i=Ult?1:2,n=1;break;case 10:i=7,n=4;break;case 12:i=1,n=8;break;default:i=Ult?1:2,n=4}return qlt.getMaterialForBlend(i,n)}function fct(t,e){var i=t.a*e*zlt,n=Ult?i/255:1,r=t.r*Llt*n/255,s=t.g*Vlt*n/255,a=t.b*Nlt*n/255;act[0]=r,act[1]=s,act[2]=a,act[3]=Ult?1:i/255}var dct=null,_ct=function(){function t(){this.accessor=dct,this.vCount=32767}var e=t.prototype;return e.ensureAccessor=function(){if(!dct){var t=GE.root.device,e=GE.root.batcher2D,i=wF;this.accessor=dct=new kF(t,i,this.vCount),e.registerBufferAccessor(Number.parseInt("DRAGONBONES",36),dct)}return this.accessor},e.createData=function(t){var e=t.renderData;if(!e){this.ensureAccessor();for(var i=t._armature._slots,n=0,r=0,s=0;s0&&(qlt._requestDrawData(uct,lct,sct,_),sct=ict),lct=d,uct=r}fct(o,e),hct.set(h._worldMatrix),s=h._localVertices,Zlt=s.length/4,Klt=9*Zlt,a=h._indices,ect=a.length;var p=!1;if($lt+Zlt>nct&&(nct=$lt+Zlt,p=!0),ict+ect>rct&&(rct=ict+ect,p=!0),p){var m=Wlt,g=n.chunk.vertexOffset;n.resizeAndCopy(nct,rct>n.indexCount?rct:n.indexCount),jlt=n.chunk.vb,rct>Wlt.length&&(Wlt=n.indices=new Uint16Array(rct));for(var v=n.chunk.vertexOffset-g,y=0;y0&&(qlt._requestDrawData(uct,lct,sct,u),sct=ict),qlt.maxIndexCount0&&(qlt._requestDrawData(uct,lct,sct,b),sct=ict),uct=n,lct=y.tex}Zlt=y.vertexCount,ect=y.indexCount,a=_.chunk.vertexOffset;for(var S=ict,x=ict+ect;S=d&&(fct(f=c[l++],1),d=f.vfOffset),p.set(act,I+5);o+=u,$lt+=Zlt,ict+=ect,Zlt=0,ect=0}}var M=ict-sct;lct&&M>0&&qlt._requestDrawData(uct,lct,sct,M)}}}function vct(t){var e=t._armature;if(e&&null!==t.renderData){Glt=!0,Ult=t.premultipliedAlpha,t.drawList.reset(),qlt=t,t.node,Hlt=t.renderData,qlt=t,Xlt=0,uct=null;var i=t.color;Llt=i.r/255,Vlt=i.g/255,Nlt=i.b/255,zlt=t.node._uiProps.opacity,4294967295!==cr.toUint32(i)&&(Xlt|=1);var n=t.node.getWorldMatrix();if(Klt=0,$lt=0,tct=0,ect=0,ict=0,sct=0,nct=qlt.maxVertexCount,rct=qlt.maxIndexCount,t.isAnimationCached())gct(t._curFrame,n);else{mct(e,1,n);var r=t._debugDraw;if(t.debugBones&&r){r.clear(),r.lineWidth=5,r.strokeColor=Ylt,r.fillColor=Qlt;for(var s=e.getBones(),a=0,o=s.length;a0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),Yct.gpuInputAssembler=null,n.glArrayBuffer!==e.glBuffer&&(i.bindBuffer(34962,e.glBuffer),n.glArrayBuffer=e.glBuffer),i.bufferData(34962,e.size,r),i.bindBuffer(34962,null),n.glArrayBuffer=null))}else if(4&e.usage){e.glTarget=34963;var a=i.createBuffer();a&&(e.glBuffer=a,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),Yct.gpuInputAssembler=null,n.glElementArrayBuffer!==e.glBuffer&&(i.bindBuffer(34963,e.glBuffer),n.glElementArrayBuffer=e.glBuffer),i.bufferData(34963,e.size,r),i.bindBuffer(34963,null),n.glElementArrayBuffer=null))}else 16&e.usage?(e.glTarget=0,e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer))):(64&e.usage||2&e.usage||1&e.usage||ht(16315),e.glTarget=0)}function Vct(t,e){var i=t.gl,n=t.stateCache;if(e.glBuffer){switch(e.glTarget){case 34962:t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),Yct.gpuInputAssembler=null,i.bindBuffer(34962,null),n.glArrayBuffer=null;break;case 34963:t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),Yct.gpuInputAssembler=null,i.bindBuffer(34963,null),n.glElementArrayBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}function Nct(t,e,i,n,r){if(16&e.usage)ArrayBuffer.isView(i)?e.vf32.set(i,n/4):e.vf32.set(new Float32Array(i),n/4);else if(64&e.usage){e.indirects.clearDraws();for(var s=i.drawInfos,a=0;at.capabilities.maxTextureSize&&ht(9100,a,t.capabilities.maxTextureSize),t.textureExclusive[e.format]||t.extensions.WEBGL_depth_texture||!ep[e.format].hasDepth){if(e.glTexture=i.createTexture(),e.size>0){var o=n.glTexUnits[n.texUnit];if(o.glTexture!==e.glTexture&&(i.bindTexture(3553,e.glTexture),o.glTexture=e.glTexture),ep[e.format].isCompressed)for(var h=0;h>1),s=wct(1,s>>1)}else for(var c=0;c>1),s=wct(1,s>>1);e.isPowerOf2?(e.glWrapS=10497,e.glWrapT=10497):(e.glWrapS=33071,e.glWrapT=33071),e.glMinFilter=9729,e.glMagFilter=9729,i.texParameteri(e.glTarget,10242,e.glWrapS),i.texParameteri(e.glTarget,10243,e.glWrapT),i.texParameteri(e.glTarget,10241,e.glMinFilter),i.texParameteri(e.glTarget,10240,e.glMagFilter)}}else e.glInternalFmt=Act(e.format),e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(n.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(36161,e.glRenderbuffer),n.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(36161,e.glInternalFmt,r,s));break;case 3:e.glTarget=34067;var f=wct(r,s);if(f>t.capabilities.maxCubeMapTextureSize&&ht(9100,f,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var d=n.glTexUnits[n.texUnit];if(d.glTexture!==e.glTexture&&(i.bindTexture(34067,e.glTexture),d.glTexture=e.glTexture),ep[e.format].isCompressed)for(var _=0;_<6;++_){r=e.width,s=e.height;for(var p=0;p>1),s=wct(1,s>>1)}}else for(var v=0;v<6;++v){r=e.width,s=e.height;for(var y=0;y>1),s=wct(1,s>>1)}e.isPowerOf2?(e.glWrapS=10497,e.glWrapT=10497):(e.glWrapS=33071,e.glWrapT=33071),e.glMinFilter=9729,e.glMagFilter=9729,i.texParameteri(e.glTarget,10242,e.glWrapS),i.texParameteri(e.glTarget,10243,e.glWrapT),i.texParameteri(e.glTarget,10241,e.glMinFilter),i.texParameteri(e.glTarget,10240,e.glMagFilter)}break;default:ht(16317),e.type=1,e.glTarget=3553}}function Uct(t,e){var i=t.gl,n=t.stateCache;if(e.glTexture){var r=n.glTexUnits,s=n.texUnit;i.deleteTexture(e.glTexture);for(var a=0;at.capabilities.maxTextureSize&&ht(9100,a,t.capabilities.maxTextureSize),e.glRenderbuffer)n.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(36161,e.glRenderbuffer),n.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(36161,e.glInternalFmt,r,s);else if(e.glTexture){var o=n.glTexUnits[n.texUnit];if(o.glTexture!==e.glTexture&&(i.bindTexture(3553,e.glTexture),o.glTexture=e.glTexture),ep[e.format].isCompressed)for(var h=0;h>1),s=wct(1,s>>1)}else for(var c=0;c>1),s=wct(1,s>>1)}break;case 3:e.glTarget=34067;var f=wct(r,s);f>t.capabilities.maxCubeMapTextureSize&&ht(9100,f,t.capabilities.maxTextureSize);var d=n.glTexUnits[n.texUnit];if(d.glTexture!==e.glTexture&&(i.bindTexture(34067,e.glTexture),d.glTexture=e.glTexture),ep[e.format].isCompressed)for(var _=0;_<6;++_){r=e.width,s=e.height;for(var p=0;p>1),s=wct(1,s>>1)}}else for(var v=0;v<6;++v){r=e.width,s=e.height;for(var y=0;y>1),s=wct(1,s>>1)}break;default:ht(16317),e.type=1,e.glTarget=3553}}}function Hct(t,e){for(var i=0;i0){e.glBlocks=new Array(e.blocks.length);for(var w=0;w0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var R=0;R=0&&D.gpuDescriptors[I],M=null,P=0;if(B&&B.gpuBuffer){var E=B.gpuBuffer,k=T[A.set],R=k&&k[A.binding];R>=0&&(P=r[R]),"vf32"in E?M=E.vf32:(P+=E.offset,M=E.gpuBuffer.vf32),P>>=2}if(M)for(var O=A.glActiveUniforms.length,F=0;F=0&&Pt.gpuDescriptors[Et],Rt=Mt.units.length,Ot=0;Ot0){var Lt=kt.gpuTexture,Vt=l.glTexUnits[Ft];Vt.glTexture!==Lt.glTexture&&(l.texUnit!==Ft&&(u.activeTexture(33984+Ft),l.texUnit=Ft),Lt.glTexture?u.bindTexture(Lt.glTarget,Lt.glTexture):u.bindTexture(Lt.glTarget,t.nullTex2D.gpuTexture.glTexture),Vt.glTexture=Lt.glTexture);var Nt=kt.gpuSampler;Lt.isPowerOf2?(a=Nt.glWrapS,o=Nt.glWrapT):(a=33071,o=33071),h=Lt.isPowerOf2?Lt.mipLevel<=1&&(9985===Nt.glMinFilter||9987===Nt.glMinFilter)?9729:Nt.glMinFilter:9729===Nt.glMinFilter||9985===Nt.glMinFilter||9987===Nt.glMinFilter?9729:9728,Lt.glWrapS!==a&&(l.texUnit!==Ft&&(u.activeTexture(33984+Ft),l.texUnit=Ft),u.texParameteri(Lt.glTarget,10242,a),Lt.glWrapS=a),Lt.glWrapT!==o&&(l.texUnit!==Ft&&(u.activeTexture(33984+Ft),l.texUnit=Ft),u.texParameteri(Lt.glTarget,10243,o),Lt.glWrapT=o),Lt.glMinFilter!==h&&(l.texUnit!==Ft&&(u.activeTexture(33984+Ft),l.texUnit=Ft),u.texParameteri(Lt.glTarget,10241,h),Lt.glMinFilter=h),Lt.glMagFilter!==Nt.glMagFilter&&(l.texUnit!==Ft&&(u.activeTexture(33984+Ft),l.texUnit=Ft),u.texParameteri(Lt.glTarget,10240,Nt.glMagFilter),Lt.glMagFilter=Nt.glMagFilter)}kt=Pt.gpuDescriptors[++Et]}}}if(i&&d&&(_||Yct.gpuInputAssembler!==i)){Yct.gpuInputAssembler=i;var zt=t.extensions.ANGLE_instanced_arrays;if(t.extensions.useVAO){var Ut=t.extensions.OES_vertex_array_object,Gt=i.glVAOs.get(d.glProgram);if(!Gt){var Ht;Gt=Ut.createVertexArrayOES(),i.glVAOs.set(d.glProgram,Gt),Ut.bindVertexArrayOES(Gt),u.bindBuffer(34962,null),u.bindBuffer(34963,null),l.glArrayBuffer=null,l.glElementArrayBuffer=null;for(var Wt=d.glInputs.length,jt=0;jt=0&&(u.enableVertexAttribArray(ue),l.glEnabledAttribLocs[ue]=!0),l.glCurrentAttribLocs[ue]=!0,u.vertexAttribPointer(ue,re.count,re.glType,re.isNormalized,re.stride,le),zt&&zt.vertexAttribDivisorANGLE(ue,re.isInstanced?1:0)}}}var ce=i.gpuIndexBuffer;ce&&l.glElementArrayBuffer!==ce.glBuffer&&(u.bindBuffer(34963,ce.glBuffer),l.glElementArrayBuffer=ce.glBuffer);for(var fe=0;fe0){var d=e.firstIndex*h.stride;r.drawElementsInstancedANGLE(o,e.indexCount,a.glIndexType,d,e.instanceCount)}}else e.vertexCount>0&&r.drawArraysInstancedANGLE(o,e.firstVertex,e.vertexCount,e.instanceCount);else if(h){if(e.indexCount>0){var _=e.firstIndex*h.stride;i.drawElements(o,e.indexCount,a.glIndexType,_)}}else e.vertexCount>0&&i.drawArrays(o,e.firstVertex,e.vertexCount)}}function $ct(t,e,i,n){var r=t.gl,s=t.stateCache,a=s.glTexUnits[s.texUnit];a.glTexture!==i.glTexture&&(r.bindTexture(i.glTarget,i.glTexture),a.glTexture=i.glTexture);var o=0,h=0;switch(i.glTarget){case 3553:for(var u=0;u0?C:d.width,p.height=g.buffTexHeight>0?g.buffTexHeight:d.height;var A=S+_.x===i.width>>v?S:d.width,D=x+_.y===i.height>>v?x:d.height,I=void 0,B=e[o++];if(p.width===d.width&&p.height===d.height){var M=ap(i.format,A,D,1)/l.BYTES_PER_ELEMENT;lt(Number.isInteger(M),9101),I=new l(B.buffer,B.byteOffset+g.buffOffset,M)}else I=eft(B,i.format,g.buffOffset,p,d);c?36196===i.glInternalFmt||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(3553,v,i.glInternalFmt,A,D,0,I):r.compressedTexSubImage2D(3553,v,_.x,_.y,A,D,i.glFormat,I):r.texSubImage2D(3553,v,_.x,_.y,A,D,i.glFormat,i.glType,I)}break;case 34067:for(var P=0;P0?E.buffStride:d.width,p.height=E.buffTexHeight>0?E.buffTexHeight:d.height;var U=L+_.x===i.width>>k?L:d.width,G=V+_.y===i.height>>k?V:d.height,H=F.baseArrayLayer+F.layerCount;for(h=F.baseArrayLayer;h0,this.instancedDraw=!!e.instanceCount,this.drawCount=Math.max(t+1,this.drawCount),this.drawByIndex?(this.counts[t]=e.indexCount,this.offsets[t]=e.firstIndex):(this.counts[t]=e.vertexCount,this.offsets[t]=e.firstVertex),this.instances[t]=Math.max(1,e.instanceCount)},e._ensureCapacity=function(t){if(!(this._capacity>t)){this._capacity=O(t);var e=aft(this._capacity),i=aft(this._capacity),n=aft(this._capacity);this.byteOffsets=aft(this._capacity),e.set(this.counts),i.set(this.offsets),n.set(this.instances),this.counts=e,this.offsets=i,this.instances=n}},t}(),hft=function(){function t(){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 t=sft.instance.bindingMappingInfo.maxBlockCounts[0];this._gpuShader={name:"Blit Pass",blocks:[new g_(0,0,"BlitParams",[new m_("tilingOffsetSrc",16,1),new m_("tilingOffsetDst",16,1)],1)],samplerTextures:[new v_(0,t,"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:[]},Wct(sft.instance,this._gpuShader),this._gpuDescriptorSetLayout={bindings:[new V_(0,1,1,1),new V_(t,16,1,16)],dynamicBindings:[],descriptorIndices:[],descriptorCount:t+1};for(var e=0;e0&&(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 oft,glTarget:0,glBuffer:null},16&this._usage&&(this._gpuBuffer.buffer=this._uniformBuffer),Lct(sft.instance,this._gpuBuffer),sft.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(Vct(sft.instance,this._gpuBuffer),sft.instance.memoryStatus.bufferSize-=this._size,this._gpuBuffer=null),this._gpuBufferView&&(this._gpuBufferView=null)},i.resize=function(t){if(this._isBufferView)at(16379);else{var e,i,n,r,s,a=this._size;a!==t&&(this._size=t,this._count=this._size/this._stride,this._uniformBuffer&&(this._uniformBuffer=new Uint8Array(t)),this._gpuBuffer&&(this._uniformBuffer&&(this._gpuBuffer.buffer=this._uniformBuffer),this._gpuBuffer.size=t,t>0&&(e=sft.instance,i=this._gpuBuffer,n=e.gl,r=e.stateCache,s=2&i.memUsage?35048:35044,8&i.usage?(e.extensions.useVAO&&r.glVAO&&(e.extensions.OES_vertex_array_object.bindVertexArrayOES(null),r.glVAO=null),Yct.gpuInputAssembler=null,r.glArrayBuffer!==i.glBuffer&&n.bindBuffer(34962,i.glBuffer),i.buffer?n.bufferData(34962,i.buffer,s):n.bufferData(34962,i.size,s),n.bindBuffer(34962,null),r.glArrayBuffer=null):4&i.usage?(e.extensions.useVAO&&r.glVAO&&(e.extensions.OES_vertex_array_object.bindVertexArrayOES(null),r.glVAO=null),Yct.gpuInputAssembler=null,r.glElementArrayBuffer!==i.glBuffer&&n.bindBuffer(34963,i.glBuffer),i.buffer?n.bufferData(34963,i.buffer,s):n.bufferData(34963,i.size,s),n.bindBuffer(34963,null),r.glElementArrayBuffer=null):16&i.usage?i.buffer&&(i.vf32=new Float32Array(i.buffer.buffer)):(64&i.usage||2&i.usage||1&i.usage||ht(16315),i.glTarget=0),sft.instance.memoryStatus.bufferSize-=a,sft.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?at(16380):(i=void 0!==e?e:64&this._usage?0:t.byteLength,Nct(sft.instance,this._gpuBuffer,t,0,i))},n(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}},{key:"gpuBufferView",get:function(){return this._gpuBufferView}}]),e}(_p),lft=function(t){function e(){var e;return(e=t.call(this)||this)._isInRenderPass=!1,e._curGPUPipelineState=null,e._curGPUInputAssembler=null,e._curGPUDescriptorSets=[],e._curDynamicOffsets=Array(8).fill(0),e._curDynamicStates=new Q_,e._isStateInvalied=!1,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._type=t.type,this._queue=t.queue;for(var e=sft.instance.bindingMappings.blockOffsets.length,i=0;i0?this.gpuColorTextures[0].width:this.gpuDepthStencilTexture?this.gpuDepthStencilTexture.width:u},set width(t){u=t},get height(){return this.gpuColorTextures.length>0?this.gpuColorTextures[0].height:this.gpuDepthStencilTexture?this.gpuDepthStencilTexture.height:l},set height(t){l=t},lodLevel:r},Hct(sft.instance,this._gpuFramebuffer),this._gpuFramebuffer.gpuColorTextures.forEach((function(t){return i._gpuColorTextures.push(t.glTexture)})),this._gpuDepthStencilTexture=null==(e=this._gpuFramebuffer.gpuDepthStencilTexture)?void 0:e.glTexture,this._width=this._gpuFramebuffer.width,this._height=this._gpuFramebuffer.height},e.destroy=function(){var t,e,i,n;this._gpuFramebuffer&&(t=sft.instance,e=this._gpuFramebuffer,i=t.gl,n=t.stateCache,e.glFramebuffer&&(i.deleteFramebuffer(e.glFramebuffer),n.glFramebuffer===e.glFramebuffer&&(i.bindFramebuffer(36160,null),n.glFramebuffer=null),e.glFramebuffer=null),this._gpuFramebuffer=null,this._gpuColorTextures.length=0,this._gpuDepthStencilTexture=null)},n(i,[{key:"needRebuild",get:function(){var t=this._gpuFramebuffer;if(t){for(var e,i=0;ii&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;o1&&(s.levelCount=Math.min(s.levelCount,e.getLevelCount(t,i)));var a=n._size;s.width=t,s.height=i,n._size=op(s.format,n.width,n.height,n.depth,s.levelCount)*s.layerCount;var o=n._gpuTexture;!n._isTextureView&&o&&(o.width=t,o.height=i,o.size=n._size,o.isSwapchainTexture||(Gct(r,o),r.memoryStatus.textureSize-=a,r.memoryStatus.textureSize+=n._size))}},i.initAsSwapchainTexture=function(t){var e=new d_;e.format=t.format,e.usage=ep[t.format].hasDepth?32:16,e.width=t.width,e.height=t.height,this.initialize(e,!0)},n(e,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"lodLevel",get:function(){return this._lodLevel}}]),e}(Rp),Cft="webglcontextlost";function Aft(t){t.activeTexture(33984),t.pixelStorei(3333,1),t.pixelStorei(3317,1),t.pixelStorei(37440,!1),t.bindFramebuffer(36160,null),t.enable(3089),t.enable(2884),t.cullFace(1029),t.frontFace(2305),t.disable(32823),t.polygonOffset(0,0),t.enable(2929),t.depthMask(!0),t.depthFunc(513),t.depthRange(0,1),t.stencilFuncSeparate(1028,519,1,65535),t.stencilOpSeparate(1028,7680,7680,7680),t.stencilMaskSeparate(1028,65535),t.stencilFuncSeparate(1029,519,1,65535),t.stencilOpSeparate(1029,7680,7680,7680),t.stencilMaskSeparate(1029,65535),t.disable(2960),t.disable(32926),t.disable(3042),t.blendEquationSeparate(32774,32774),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.blendColor(0,0,0,0)}function Dft(t,e){for(var i=["","WEBKIT_","MOZ_"],n=0;n0)for(s=e;s=e;s-=n)a=edt(s,t[s],t[s+1],a);return a&&Qft(a,a.next)&&(idt(a),a=a.next),a}function Lft(t,e){if(void 0===e&&(e=null),!t)return t;e||(e=t);var i=t,n=!1;do{if(n=!1,i.steiner||!Qft(i,i.next)&&0!==Yft(i.prev,i,i.next))i=i.next;else{if(idt(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function Vft(t,e,i,n,r,s,a){if(void 0===a&&(a=0),t){!a&&s&&Hft(t,n,r,s);for(var o=t,h=null,u=null;t.prev!==t.next;)if(h=t.prev,u=t.next,s?zft(t,n,r,s):Nft(t))e.push(h.i/i),e.push(t.i/i),e.push(u.i/i),idt(t),t=u.next,o=u.next;else if((t=u)===o){a?1===a?Vft(t=Uft(t,e,i),e,i,n,r,s,2):2===a&&Gft(t,e,i,n,r,s):Vft(Lft(t),e,i,n,r,s,1);break}}}function Nft(t){var e=t.prev,i=t,n=t.next;if(Yft(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(qft(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&Yft(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function zft(t,e,i,n){var r=t.prev,s=t,a=t.next;if(Yft(r,s,a)>=0)return!1;for(var o=r.xs.x?r.x>a.x?r.x:a.x:s.x>a.x?s.x:a.x,l=r.y>s.y?r.y>a.y?r.y:a.y:s.y>a.y?s.y:a.y,c=jft(o,h,e,i,n),f=jft(u,l,e,i,n),d=t.nextZ;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&qft(r.x,r.y,s.x,s.y,a.x,a.y,d.x,d.y)&&Yft(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&qft(r.x,r.y,s.x,s.y,a.x,a.y,d.x,d.y)&&Yft(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function Uft(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!Qft(r,s)&&Jft(r,n,n.next,s)&&Zft(r,s)&&Zft(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),idt(n),idt(n.next),n=t=s),n=n.next}while(n!==t);return n}function Gft(t,e,i,n,r,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&Xft(a,o)){var h=tdt(a,o);return a=Lft(a,a.next),h=Lft(h,h.next),Vft(a,e,i,n,r,s),void Vft(h,e,i,n,r,s)}o=o.next}a=a.next}while(a!==t)}function Hft(t,e,i,n){var r=t;do{null===r.z&&(r.z=jft(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,Wft(r)}function Wft(t){var e=0,i=null,n=null,r=null,s=null,a=0,o=0,h=0,u=1;do{for(i=t,t=null,s=null,a=0;i;){for(a++,n=i,o=0,e=0;e0||h>0&&n;)0===o?(r=n,n=n.nextZ,h--):0!==h&&n?i.z<=n.z?(r=i,i=i.nextZ,o--):(r=n,n=n.nextZ,h--):(r=i,i=i.nextZ,o--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,u*=2}while(a>1);return t}function jft(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)/r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function qft(t,e,i,n,r,s,a,o){return(r-a)*(e-o)-(t-a)*(s-o)>=0&&(t-a)*(n-o)-(i-a)*(e-o)>=0&&(i-a)*(s-o)-(r-a)*(n-o)>=0}function Xft(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Kft(t,e)&&Zft(t,e)&&Zft(e,t)&&$ft(t,e)}function Yft(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Qft(t,e){return t.x===e.x&&t.y===e.y}function Jft(t,e,i,n){return!!(Qft(t,e)&&Qft(i,n)||Qft(t,n)&&Qft(i,e))||Yft(t,e,i)>0!=Yft(t,e,n)>0&&Yft(i,n,t)>0!=Yft(i,n,e)>0}function Kft(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Jft(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}function Zft(t,e){return Yft(t.prev,t,t.next)<0?Yft(t,e,t.next)>=0&&Yft(t,t.prev,e)>=0:Yft(t,e,t.prev)<0||Yft(t,t.next,e)<0}function $ft(t,e){var i=t,n=!1,r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}function tdt(t,e){var i=new Oft(t.i,t.x,t.y),n=new Oft(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function edt(t,e,i,n){var r=new Oft(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function idt(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function ndt(t,e,i,n){for(var r=0,s=e,a=i-n;s80*i){a=h=t[0],o=u=t[1];for(var d=i;dh&&(h=l),c>u&&(u=c);f=Math.max(h-a,u-o)}return Vft(r,s,i,a,o,f),s}for(var sdt=Math.PI,adt=Math.min,odt=Math.max,hdt=Math.ceil,udt=Math.acos,ldt=Math.cos,cdt=Math.sin,fdt=Math.atan2,ddt=null,_dt=null,pdt=new cr,mdt=[],gdt=0;gdt<4;gdt++)mdt.push(new ir);function vdt(t,e,i){var n=2*udt(t/(t+i));return odt(2,hdt(e/n))}function ydt(t,e,i){return ti?i:t}var bdt=function(){function t(){}var e=t.prototype;return e.updateRenderData=function(){},e.getRenderData=function(t,e){if(!_dt)return null;var i=_dt.getRenderDataList(),n=i[_dt.dataOffset];if(!n)return null;var r=n,s=r?r.vertexStart+e:0;return(s>65535||3*s>131070)&&(++_dt.dataOffset,_dt.dataOffset0&&(r=1/e);for(var s=t.paths,a=t.pathOffset,o=t.pathLength;a1e-6){var b=1/_;b>600&&(b=600),f.dmx*=b,f.dmy*=b}f.dx*c.dy-c.dx*f.dy>0&&(f.flags|=2),_*(p=odt(11,adt(c.len,f.len)*r))*p<1&&(f.flags|=8),1&f.flags&&(_*n*n<1||0===i||1===i)&&(f.flags|=4),12&f.flags&&h.bevel++,c=f,f=u[d+1]}}},e._flattenPaths=function(t){for(var e=t.paths,i=t.pathOffset,n=t.pathLength;i2&&a.equals(o)&&(r.closed=!0,s.pop(),a=s[s.length-1]);for(var h=0,u=s.length;hm&&(g-=2*sdt),this._vSet(f,d,1),this._vSet(u-s*n,e.y-a*n,-1);for(var v=ydt(hdt((m-g)/sdt)*r,2,r),y=0;y=0&&o<=1&&h>=0&&h<=1)return!0}return!1}qN.Assembler=xdt,C.UI.graphicsAssembler=xdt;var Tdt=new ds,Cdt=new ds,Adt=new ds,Ddt=new ds;function Idt(t,e,i){for(var n=i.length,r=0;rr!=c>r&&n<(l-h)*(r-u)/(c-u)+h&&(i=!i)}return i}function Mdt(t,e,i,n){var r,s=i.x-e.x,a=i.y-e.y,o=s*s+a*a,h=((t.x-e.x)*s+(t.y-e.y)*a)/o;return r=n?o?h<0?e:h>1?i:Tdt.set(e.x+h*s,e.y+h*a):e:Tdt.set(e.x+h*s,e.y+h*a),s=t.x-r.x,a=t.y-r.y,Math.sqrt(s*s+a*a)}var Pdt=t("eJ",(function(){}));Pdt.lineLine=wdt,Pdt.lineRect=function(t,e,i){var n=Tdt.set(i.x,i.y),r=Cdt.set(i.x,i.yMax),s=Adt.set(i.xMax,i.yMax),a=Ddt.set(i.xMax,i.y);return!!(wdt(t,e,n,r)||wdt(t,e,r,s)||wdt(t,e,s,a)||wdt(t,e,a,n))},Pdt.linePolygon=Idt,Pdt.rectRect=function(t,e){var i=t.x,n=t.y,r=t.x+t.width,s=t.y+t.height,a=e.x,o=e.y,h=e.x+e.width,u=e.y+e.height;return i<=h&&r>=a&&n<=u&&s>=o},Pdt.rectPolygon=function(t,e){var i=Tdt.set(t.x,t.y),n=Cdt.set(t.x,t.yMax),r=Adt.set(t.xMax,t.yMax),s=Ddt.set(t.xMax,t.y);if(Idt(i,n,e))return!0;if(Idt(n,r,e))return!0;if(Idt(r,s,e))return!0;if(Idt(s,i,e))return!0;for(var a=0,o=e.length;as+o&&(u=s+o),ra+h&&(l=a+h);var c=n-u,f=r-l;return Math.sqrt(c*c+f*f)<=i},Pdt.polygonPolygon=function(t,e){var i,n;for(i=0,n=t.length;i=0){var s=t._probes,a=s[this.vertex0].position,o=s[this.vertex1].position,h=s[this.vertex2].position,u=s[this.vertex3].position;this.sphere.init(a,o,h,u)}}var e=t.prototype;return e.isInCircumSphere=function(t){return ir.squaredDistance(t,this.sphere.center)=0},e.isOuterCell=function(){return this.vertex3<0},t}(),n_t=Nh(i_t.prototype,"invalid",[p_t],(function(){return!1})),r_t=Nh(i_t.prototype,"vertex0",[p_t],(function(){return-1})),s_t=Nh(i_t.prototype,"vertex1",[p_t],(function(){return-1})),a_t=Nh(i_t.prototype,"vertex2",[p_t],(function(){return-1})),o_t=Nh(i_t.prototype,"vertex3",[p_t],(function(){return-1})),h_t=Nh(i_t.prototype,"neighbours",[p_t],(function(){return[-1,-1,-1,-1]})),u_t=Nh(i_t.prototype,"matrix",[p_t],(function(){return new gr})),l_t=Nh(i_t.prototype,"offset",[p_t],(function(){return new ir(0,0,0)})),c_t=Nh(i_t.prototype,"sphere",[p_t],(function(){return new D_t})),e_t=i_t))||e_t),B_t=t("eP",function(){function t(t){this._probes=[],this._tetrahedrons=[],this._triangles=[],this._edges=[],this._probes=t}var e=t.prototype;return e.build=function(){return this.reset(),this.tetrahedralize(),this.computeAdjacency(),this.computeMatrices(),this._tetrahedrons},e.reset=function(){this._tetrahedrons.length=0,this._triangles.length=0,this._edges.length=0},e.tetrahedralize=function(){for(var t=this._probes.length,e=this.initTetrahedron(),i=0;i0&&ir.negate(t,t),ir.add(l.normal,l.normal,t),ir.add(c.normal,c.normal,t),ir.add(f.normal,f.normal,t);var p=this._triangles[h].vertex0,m=_>0?this._triangles[h].vertex2:this._triangles[h].vertex1,g=_>0?this._triangles[h].vertex1:this._triangles[h].vertex2,v=new I_t(this,p,m,g);v.neighbours[3]=this._triangles[h].tetrahedron,this._tetrahedrons[this._triangles[h].tetrahedron].neighbours[this._triangles[h].index]=this._tetrahedrons.length,this._tetrahedrons.push(v)}}for(var y=0,b=r;b=0?this.computeTetrahedronMatrix(e):this.computeOuterCellMatrix(e)}},e.computeTetrahedronMatrix=function(t){var e=this._probes[t.vertex0].position,i=this._probes[t.vertex1].position,n=this._probes[t.vertex2].position,r=this._probes[t.vertex3].position;t.matrix.set(e.x-r.x,i.x-r.x,n.x-r.x,e.y-r.y,i.y-r.y,n.y-r.y,e.z-r.z,i.z-r.z,n.z-r.z),t.matrix.invert(),t.matrix.transpose()},e.computeOuterCellMatrix=function(t){var e=[],i=[];e[0]=this._probes[t.vertex0].normal,e[1]=this._probes[t.vertex1].normal,e[2]=this._probes[t.vertex2].normal,i[0]=this._probes[t.vertex0].position,i[1]=this._probes[t.vertex1].position,i[2]=this._probes[t.vertex2].position,ir.subtract(v_t,i[0],i[2]),ir.subtract(y_t,e[0],e[2]),ir.subtract(b_t,i[1],i[2]),ir.subtract(S_t,e[1],e[2]),x_t.set(i[2]),ir.negate(w_t,e[2]);var n=[];n[0]=y_t.y*S_t.z-y_t.z*S_t.y,n[3]=-y_t.x*S_t.z+y_t.z*S_t.x,n[6]=y_t.x*S_t.y-y_t.y*S_t.x,n[9]=v_t.x*S_t.y*w_t.z-v_t.y*S_t.x*w_t.z+y_t.x*b_t.y*w_t.z-y_t.y*b_t.x*w_t.z+v_t.z*S_t.x*w_t.y-v_t.z*S_t.y*w_t.x+y_t.z*b_t.x*w_t.y-y_t.z*b_t.y*w_t.x-v_t.x*S_t.z*w_t.y+v_t.y*S_t.z*w_t.x-y_t.x*b_t.z*w_t.y+y_t.y*b_t.z*w_t.x,n[9]-=x_t.x*n[0]+x_t.y*n[3]+x_t.z*n[6],n[1]=y_t.y*b_t.z+v_t.y*S_t.z-y_t.z*b_t.y-v_t.z*S_t.y,n[4]=-v_t.x*S_t.z-y_t.x*b_t.z+v_t.z*S_t.x+y_t.z*b_t.x,n[7]=v_t.x*S_t.y-v_t.y*S_t.x+y_t.x*b_t.y-y_t.y*b_t.x,n[10]=v_t.x*b_t.y*w_t.z-v_t.y*b_t.x*w_t.z-v_t.x*b_t.z*w_t.y+v_t.y*b_t.z*w_t.x+v_t.z*b_t.x*w_t.y-v_t.z*b_t.y*w_t.x,n[10]-=x_t.x*n[1]+x_t.y*n[4]+x_t.z*n[7],n[2]=-v_t.z*b_t.y+v_t.y*b_t.z,n[5]=-v_t.x*b_t.z+v_t.z*b_t.x,n[8]=v_t.x*b_t.y-v_t.y*b_t.x,n[11]=0,n[11]-=x_t.x*n[2]+x_t.y*n[5]+x_t.z*n[8];var r=y_t.x*S_t.y*w_t.z-y_t.y*S_t.x*w_t.z+y_t.z*S_t.x*w_t.y-y_t.z*S_t.y*w_t.x+y_t.y*S_t.z*w_t.x-y_t.x*S_t.z*w_t.y;if(Math.abs(r)>Ji)for(var s=0;s<12;s++)n[s]/=r;else t.vertex3=-2;t.matrix.set(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8]),t.offset.set(n[9],n[10],n[11])},t}()),M_t=t("eQ",function(){function t(){}return t.uniformSampleSphere=function(t,e){var i=1-2*t,n=Math.sqrt(Math.max(0,1-i*i)),r=2*Math.PI*e,s=n*Math.cos(r),a=n*Math.sin(r);return new ir(s,a,i)},t.uniformSampleSphereAll=function(t){for(var e=Math.floor(Math.sqrt(t)),i=e,n=[],r=1/e,s=1/i,a=0;a0&&(t.length,e.length);for(var i=this.getBasisCount(),n=t.length,r=1/(M_t.uniformSpherePdf()*n),s=[],a=0;a0){var h=Math.sqrt(o);n.push(Math.cbrt(-a+h)+Math.cbrt(-a-h))}else if(o<0){var u=Math.acos(-a*Math.sqrt(-s)/(s*s))/3;n.push(2*Math.sqrt(-s)*Math.cos(u)),n.push(2*Math.sqrt(-s)*Math.cos(u+2*Math.PI/3)),n.push(2*Math.sqrt(-s)*Math.cos(u+4*Math.PI/3))}else if(0===a)n.push(0);else{var l=Math.cbrt(a);n.push(l),n.push(-2*l)}for(var c=0;c=0)return n[c]+r;return 0},t}(),z_t=new ir(0,0,0),U_t=new ir(0,0,0),G_t=new ir(0,0,0),H_t=new ir(0,0,0),W_t=new ir(0,0,0),j_t=new ir(0,0,0),q_t=new ir(0,0,0),X_t=new ir(0,0,0),Y_t=new ir(0,0,0),Q_t=new ir(0,0,0),J_t=new ir(0,0,0),K_t=new ir(0,0,0),Z_t=new ir(0,0,0),$_t=new ir(0,0,0),tpt=new ir(0,0,0),ept=t("eS",(E_t=Qh("cc.LightProbesData"),k_t=Eu([T_t]),R_t=Eu([I_t]),E_t((F_t=function(){function t(){this._probes=L_t&&L_t(),this._tetrahedrons=V_t&&V_t()}var e=t.prototype;return e.empty=function(){return 0===this._probes.length||0===this._tetrahedrons.length},e.reset=function(){this._probes.length=0,this._tetrahedrons.length=0},e.updateProbes=function(t){this._probes.length=t.length;for(var e=this._probes.length,i=0;i=0)for(var h=this._probes[r.vertex3].coefficients,u=0;u=n)&&(e=0);for(var r=-1,s=-1,a=0;a=0&&i.y>=0&&i.z>=0&&i.w>=0)break;if(r===(s=i.x=0?this.getTetrahedronBarycentricCoord(t,e,i):this.getOuterCellBarycentricCoord(t,e,i)},e.getTetrahedronBarycentricCoord=function(t,e,i){var n=new ir(0,0,0);ir.subtract(n,t,this._probes[e.vertex3].position),ir.transformMat3(n,n,e.matrix),i.set(n.x,n.y,n.z,1-n.x-n.y-n.z)},e.getOuterCellBarycentricCoord=function(e,i,n){var r=this._probes[i.vertex0].position,s=this._probes[i.vertex1].position,a=this._probes[i.vertex2].position;ir.subtract(Q_t,s,r),ir.subtract(J_t,a,r),ir.cross(Y_t,Q_t,J_t),ir.subtract(K_t,e,r);var o=ir.dot(K_t,Y_t);if(o<0)n.set(0,0,0,-1);else{var h=new ir(0,0,0);ir.transformMat3(h,e,i.matrix),ir.add(h,h,i.offset),o=-1===i.vertex3?N_t.getCubicUniqueRoot(h.x,h.y,h.z):N_t.getQuadraticUniqueRoot(h.x,h.y,h.z),ir.scaleAndAdd(Z_t,r,this._probes[i.vertex0].normal,o),ir.scaleAndAdd($_t,s,this._probes[i.vertex1].normal,o),ir.scaleAndAdd(tpt,a,this._probes[i.vertex2].normal,o);var u=t.getTriangleBarycentricCoord(Z_t,$_t,tpt,e);n.set(u.x,u.y,u.z,0)}},n(t,[{key:"probes",get:function(){return this._probes}},{key:"tetrahedrons",get:function(){return this._tetrahedrons}}]),t}(),L_t=Nh(F_t.prototype,"_probes",[hu,k_t],(function(){return[]})),V_t=Nh(F_t.prototype,"_tetrahedrons",[hu,R_t],(function(){return[]})),O_t=F_t))||O_t));C.internal.LightProbesData=ept;var ipt,npt,rpt,spt,apt,opt,hpt,upt,lpt,cpt,fpt,dpt,_pt,ppt,mpt,gpt=t("eT",function(){function t(){this._giScale=1,this._giSamples=1024,this._bounces=2,this._reduceRinging=0,this._showProbe=!0,this._showWireframe=!0,this._showConvex=!1,this._data=null,this._lightProbeSphereVolume=1}var e=t.prototype;return e.initialize=function(t){this._giScale=t.giScale,this._giSamples=t.giSamples,this._bounces=t.bounces,this._reduceRinging=t.reduceRinging,this._showProbe=t.showProbe,this._showWireframe=t.showWireframe,this._showConvex=t.showConvex,this._data=t.data,this._lightProbeSphereVolume=t.lightProbeSphereVolume},e.empty=function(){return!this._data||this._data.empty()},n(t,[{key:"giScale",get:function(){return this._giScale},set:function(t){this._giScale=t}},{key:"giSamples",get:function(){return this._giSamples},set:function(t){this._giSamples=t}},{key:"bounces",get:function(){return this._bounces},set:function(t){this._bounces=t}},{key:"reduceRinging",get:function(){return this._reduceRinging},set:function(t){this._reduceRinging=t}},{key:"showProbe",get:function(){return this._showProbe},set:function(t){this._showProbe=t}},{key:"showWireframe",get:function(){return this._showWireframe},set:function(t){this._showWireframe=t}},{key:"showConvex",get:function(){return this._showConvex},set:function(t){this._showConvex=t}},{key:"data",get:function(){return this._data},set:function(t){this._data=t}},{key:"lightProbeSphereVolume",get:function(){return this._lightProbeSphereVolume},set:function(t){this._lightProbeSphereVolume=t}}]),t}());C.internal.LightProbes=gpt,t("eU",(ipt=Qh("cc.LightProbeGroup"),npt=Eu([ir]),rpt=Eu(f_t),spt=Eu(li),apt=Eu(li),opt=Eu(li),ipt(hpt=Zh((upt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=n.length&&(t=n.length-1),t<0&&(t=0),this._techIndex=t,this.updateTechnique()}}]),i}(gg),wpt=Nh(xpt.prototype,"_texture",[ypt],(function(){return null})),y(xpt.prototype,"texture",[bpt],Object.getOwnPropertyDescriptor(xpt.prototype,"texture"),xpt.prototype),Tpt=Nh(xpt.prototype,"_height",[hu],(function(){return 0})),Cpt=Nh(xpt.prototype,"_width",[hu],(function(){return 0})),Apt=Nh(xpt.prototype,"_rotation",[hu],(function(){return 0})),Dpt=Nh(xpt.prototype,"_techIndex",[hu],(function(){return 0})),Spt=xpt))||Spt)),Xpt=[new C_("a_position",32),new C_("a_texCoord",44),new C_("a_texCoord1",32),new C_("a_color",35,!0)],Ypt=new ir,Qpt=new ir,Jpt=function(t){function e(){var e;return(e=t.call(this)||this)._capacity=void 0,e._vertSize=0,e._vBuffer=null,e._vertAttrsFloatCount=0,e._vdataF32=null,e._vdataUint32=null,e._subMeshData=null,e._vertCount=0,e._indexCount=0,e._material=null,e._iaVertCount=0,e._iaIndexCount=0,e.type=5,e._capacity=100,e}s(e,t);var i=e.prototype;return i.setCapacity=function(t){this._capacity=t,this.createBuffer()},i.createBuffer=function(){this._vertSize=0;for(var t=0,e=Xpt;t1){var n=0;ir.subtract(Ypt,t[1],t[0]),this._vdataF32[n++]=t[0].x,this._vdataF32[n++]=t[0].y,this._vdataF32[n++]=t[0].z,this._vdataF32[n++]=0,this._vdataF32[n++]=e.evaluate(0,1),this._vdataF32[n++]=0,this._vdataF32[n++]=0,this._vdataF32[n++]=Ypt.x,this._vdataF32[n++]=Ypt.y,this._vdataF32[n++]=Ypt.z,this._vdataUint32[n++]=cr.toUint32(i.evaluate(0,1)),this._vdataF32[n++]=t[0].x,this._vdataF32[n++]=t[0].y,this._vdataF32[n++]=t[0].z,this._vdataF32[n++]=1,this._vdataF32[n++]=e.evaluate(0,1),this._vdataF32[n++]=0,this._vdataF32[n++]=1,this._vdataF32[n++]=Ypt.x,this._vdataF32[n++]=Ypt.y,this._vdataF32[n++]=Ypt.z,this._vdataUint32[n++]=cr.toUint32(i.evaluate(0,1));for(var r=1;r0&&this._models[0]&&this._detachFromScene()},i._attachToScene=function(){if(t.prototype._attachToScene.call(this),this._models.length>0&&this._models[0]&&this.node&&this.node.scene){var e=this._models[0];e.scene&&this._detachFromScene(),this._getRenderScene().addModel(e)}},i._detachFromScene=function(){if(t.prototype._detachFromScene.call(this),this._models.length>0&&this._models[0]){var e=this._models[0];e.scene&&e.scene.removeModel(e)}},i._onMaterialModified=function(e,i){t.prototype._onMaterialModified.call(this,e,i);var n=this.getMaterialInstance(0);n&&(Vmt[Lmt]=this.worldSpace,n.recompileShaders(Vmt),this._models[0]&&this._models[0].updateMaterial(n))},n(e,[{key:"texture",get:function(){return this._texture},set:function(t){this._texture=t,this.material&&this.material.setProperty("mainTexture",t)}},{key:"lineMaterial",get:function(){return this.getSharedMaterial(0)},set:function(t){this.setSharedMaterial(t,0)}},{key:"sharedMaterials",get:function(){return t.prototype.sharedMaterials},set:function(t){this.sharedMaterials=t}},{key:"worldSpace",get:function(){return this._worldSpace},set:function(t){this._worldSpace=t;var e=this.getMaterialInstance(0);e&&(Vmt[Lmt]=this.worldSpace,e.recompileShaders(Vmt),this._models[0]&&this._models[0].setSubModelMaterial(0,e))}},{key:"positions",get:function(){return this._positions},set:function(t){this._positions=t,this._models[0]&&this._models[0].addLineVertexData(this._positions,this.width,this.color)}},{key:"width",get:function(){return this._width},set:function(t){this._width=t,this._models[0]&&this._models[0].addLineVertexData(this._positions,this._width,this._color)}},{key:"color",get:function(){return this._color},set:function(t){this._color=t,this._models[0]&&this._models[0].addLineVertexData(this._positions,this._width,this._color)}},{key:"tile",get:function(){return this._tile},set:function(t){this._tile.set(t),this.material&&(this._tile_offset.x=this._tile.x,this._tile_offset.y=this._tile.y,this.material.setProperty("mainTiling_Offset",this._tile_offset))}},{key:"offset",get:function(){return this._offset},set:function(t){this._offset.set(t),this.material&&(this._tile_offset.z=this._offset.x,this._tile_offset.w=this._offset.y,this.material.setProperty("mainTiling_Offset",this._tile_offset))}}]),e}(LU),xmt=Nh(Smt.prototype,"_texture",[cmt],(function(){return null})),y(Smt.prototype,"texture",[fmt],Object.getOwnPropertyDescriptor(Smt.prototype,"texture"),Smt.prototype),wmt=Nh(Smt.prototype,"_material",[hu],(function(){return null})),y(Smt.prototype,"lineMaterial",[dmt],Object.getOwnPropertyDescriptor(Smt.prototype,"lineMaterial"),Smt.prototype),y(Smt.prototype,"sharedMaterials",[Uu,hu],Object.getOwnPropertyDescriptor(Smt.prototype,"sharedMaterials"),Smt.prototype),Tmt=Nh(Smt.prototype,"_worldSpace",[hu],(function(){return!1})),Cmt=Nh(Smt.prototype,"_positions",[_mt],(function(){return[]})),y(Smt.prototype,"positions",[pmt],Object.getOwnPropertyDescriptor(Smt.prototype,"positions"),Smt.prototype),y(Smt.prototype,"width",[mmt],Object.getOwnPropertyDescriptor(Smt.prototype,"width"),Smt.prototype),Amt=Nh(Smt.prototype,"_width",[hu],(function(){return new tmt})),y(Smt.prototype,"color",[gmt],Object.getOwnPropertyDescriptor(Smt.prototype,"color"),Smt.prototype),Dmt=Nh(Smt.prototype,"_color",[hu],(function(){return new kmt})),Imt=Nh(Smt.prototype,"_tile",[hu],(function(){return new ds(1,1)})),y(Smt.prototype,"tile",[vmt],Object.getOwnPropertyDescriptor(Smt.prototype,"tile"),Smt.prototype),Bmt=Nh(Smt.prototype,"_offset",[hu],(function(){return new ds(0,0)})),y(Smt.prototype,"offset",[ymt],Object.getOwnPropertyDescriptor(Smt.prototype,"offset"),Smt.prototype),bmt=Smt))||bmt)),zmt=function(){function t(t){this.particleSystem=void 0,this.position=void 0,this.velocity=void 0,this.animatedVelocity=void 0,this.ultimateVelocity=void 0,this.angularVelocity=void 0,this.axisOfRotation=void 0,this.rotation=void 0,this.startEuler=void 0,this.startRotation=void 0,this.startRotated=void 0,this.deltaQuat=void 0,this.deltaMat=void 0,this.localMat=void 0,this.startSize=void 0,this.size=void 0,this.startColor=void 0,this.color=void 0,this.randomSeed=void 0,this.remainingLifetime=void 0,this.loopCount=void 0,this.lastLoop=void 0,this.trailDelay=void 0,this.startLifetime=void 0,this.emitAccumulator0=void 0,this.emitAccumulator1=void 0,this.frameIndex=void 0,this.startRow=void 0,this.particleSystem=t,this.position=new ir(0,0,0),this.velocity=new ir(0,0,0),this.animatedVelocity=new ir(0,0,0),this.ultimateVelocity=new ir(0,0,0),this.angularVelocity=new ir(0,0,0),this.axisOfRotation=new ir(0,0,0),this.rotation=new ir(0,0,0),this.startEuler=new ir(0,0,0),this.startRotation=new kr,this.startRotated=!1,this.deltaQuat=new kr,this.deltaMat=new Qr,this.localMat=new Qr,this.startSize=new ir(0,0,0),this.size=new ir(0,0,0),this.startColor=cr.WHITE.clone(),this.color=cr.WHITE.clone(),this.randomSeed=0,this.remainingLifetime=0,this.loopCount=0,this.lastLoop=0,this.trailDelay=0,this.startLifetime=0,this.emitAccumulator0=0,this.emitAccumulator1=0,this.frameIndex=0,this.startRow=0}return t.prototype.reset=function(){this.rotation.set(0,0,0),this.startEuler.set(0,0,0),this.startRotation.set(0,0,0,1),this.startRotated=!1,this.deltaQuat.set(0,0,0,1),this.deltaMat.identity(),this.localMat.identity()},t}();zmt.INDENTIFY_NEG_QUAT=10,zmt.R2D=180/Math.PI;var Umt,Gmt,Hmt,Wmt,jmt,qmt,Xmt="noiseModule",Ymt=["sizeModule","colorModule","forceModule","velocityModule","limitModule","rotationModule","textureModule","noiseModule"],Qmt=["_colorOverLifetimeModule","_shapeModule","_sizeOvertimeModule","_velocityOvertimeModule","_forceOvertimeModule","_limitVelocityOvertimeModule","_rotationOvertimeModule","_textureAnimationModule","_noiseModule","_trailModule"],Jmt=function(){function t(){this.target=null,this.needUpdate=!1,this.needAnimate=!0,this.name=void 0}var e=t.prototype;return e.bindTarget=function(t){this.target=t},e.update=function(){},t}(),Kmt=new ir(0,0,-1);function Zmt(t,e,i,n){return e!==t?(0===t||Qr.invert(i,i),Qr.getRotation(n,i),!0):(kr.set(n,0,0,0,1),!1)}function $mt(t,e){ds.set(t,Math.cos(e),Math.sin(e))}function tgt(t){var e=on(-1,1),i=on(0,2*Math.PI),n=Math.sqrt(1-e*e),r=n*Math.cos(i),s=n*Math.sin(i);ir.set(t,r,s,e)}function egt(t,e,i){tgt(t),ir.multiplyScalar(t,t,e+(i-e)*sn())}function igt(t,e,i,n){$mt(t,n),t.z=0,ir.multiplyScalar(t,t,e+(i-e)*sn())}function ngt(t){for(var e=0;ee){var s=r-r*i;r=s>e?s:e}return r*n}var lvt,cvt,fvt,dvt,_vt,pvt,mvt,gvt,vvt,yvt,bvt,Svt,xvt,wvt,Tvt,Cvt,Avt,Dvt,Ivt,Bvt,Mvt,Pvt,Evt,kvt,Rvt,Ovt,Fvt,Lvt,Vvt,Nvt,zvt,Uvt,Gvt,Hvt,Wvt,jvt,qvt,Xvt,Yvt,Qvt,Jvt,Kvt,Zvt,$vt,tyt,eyt,iyt,nyt,ryt,syt,ayt,oyt,hyt,uyt,lyt,cyt,fyt,dyt,_yt,pyt,myt,gyt,vyt,yyt,byt,Syt,xyt,wyt,Tyt,Cyt,Ayt,Dyt,Iyt,Byt,Myt,Pyt,Eyt,kyt,Ryt,Oyt,Fyt,Lyt,Vyt,Nyt,zyt,Uyt,Gyt=125292,Hyt=(jgt=Qh("cc.RotationOvertimeModule"),qgt=Eu(tmt),Xgt=Eu(tmt),Ygt=Eu(tmt),jgt((Jgt=function(t){function e(){var e;return(e=t.call(this)||this)._enable=Kgt&&Kgt(),e._separateAxes=Zgt&&Zgt(),e.x=$gt&&$gt(),e.y=tvt&&tvt(),e.z=evt&&evt(),e.name="rotationModule",e._startMat=new Qr,e._matRot=new Qr,e._quatRot=new kr,e._otherEuler=new ir,e}s(e,t);var i=e.prototype;return i._processRotation=function(t){var e=t.particleSystem.processor.getInfo().renderMode;4!==e&&1===e&&this._quatRot.set(0,0,0,1),kr.normalize(this._quatRot,this._quatRot),this._quatRot.w<0&&(this._quatRot.x+=zmt.INDENTIFY_NEG_QUAT)},i.animate=function(t,e){var i=1-t.remainingLifetime/t.startLifetime,n=sgt(this.z)?un(t.randomSeed+Gyt):0,r=t.particleSystem.processor.getInfo().renderMode;if(this._separateAxes&&3!==r&&2!==r){var s=sgt(this.x)?un(t.randomSeed+Gyt):0,a=sgt(this.y)?un(t.randomSeed+Gyt):0;kr.fromEuler(t.deltaQuat,this.x.evaluate(i,s)*e*zmt.R2D,this.y.evaluate(i,a)*e*zmt.R2D,this.z.evaluate(i,n)*e*zmt.R2D)}else kr.fromEuler(t.deltaQuat,0,0,this.z.evaluate(i,n)*e*zmt.R2D);t.deltaMat=Qr.fromQuat(t.deltaMat,t.deltaQuat),t.localMat=t.localMat.multiply(t.deltaMat),t.startRotated||(4!==r&&(1===r?t.startEuler.set(0,0,0):0!==r&&t.startEuler.set(0,0,t.startEuler.z)),kr.fromEuler(t.startRotation,t.startEuler.x*zmt.R2D,t.startEuler.y*zmt.R2D,t.startEuler.z*zmt.R2D),t.startRotated=!0),this._startMat=Qr.fromQuat(this._startMat,t.startRotation),this._matRot=this._startMat.multiply(t.localMat),Qr.getRotation(this._quatRot,this._matRot),this._processRotation(t,zmt.R2D),t.rotation.set(this._quatRot.x,this._quatRot.y,this._quatRot.z)},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(this._enable=t,this.target&&this.target.enableModule(this.name,t,this))}},{key:"separateAxes",get:function(){return this._separateAxes},set:function(t){this._separateAxes=t}}]),e}(Jmt),Kgt=Nh(Jgt.prototype,"_enable",[hu],(function(){return!1})),Zgt=Nh(Jgt.prototype,"_separateAxes",[hu],(function(){return!1})),$gt=Nh(Jgt.prototype,"x",[qgt,hu],(function(){return new tmt})),tvt=Nh(Jgt.prototype,"y",[Xgt,hu],(function(){return new tmt})),evt=Nh(Jgt.prototype,"z",[Ygt,hu],(function(){return new tmt})),Qgt=Jgt))||Qgt),Wyt=39825,jyt=(lvt=Qh("cc.SizeOvertimeModule"),cvt=Eu(tmt),fvt=Eu(tmt),dvt=Eu(tmt),_vt=Eu(tmt),lvt((mvt=function(t){function e(){var e;return(e=t.call(this)||this)._enable=gvt&&gvt(),e.separateAxes=vvt&&vvt(),e.size=yvt&&yvt(),e.x=bvt&&bvt(),e.y=Svt&&Svt(),e.z=xvt&&xvt(),e.name="sizeModule",e}return s(e,t),e.prototype.animate=function(t){if(this.separateAxes){var e=1-t.remainingLifetime/t.startLifetime,i=sgt(this.x)?un(t.randomSeed+Wyt):0,n=sgt(this.y)?un(t.randomSeed+Wyt):0,r=sgt(this.z)?un(t.randomSeed+Wyt):0;t.size.x=t.startSize.x*this.x.evaluate(e,i),t.size.y=t.startSize.y*this.y.evaluate(e,n),t.size.z=t.startSize.z*this.z.evaluate(e,r)}else{var s=sgt(this.size)?un(t.randomSeed+Wyt):0;ir.multiplyScalar(t.size,t.startSize,this.size.evaluate(1-t.remainingLifetime/t.startLifetime,s))}},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(this._enable=t,this.target&&this.target.enableModule(this.name,t,this))}}]),e}(Jmt),gvt=Nh(mvt.prototype,"_enable",[hu],(function(){return!1})),vvt=Nh(mvt.prototype,"separateAxes",[hu],(function(){return!1})),yvt=Nh(mvt.prototype,"size",[cvt,hu],(function(){return new tmt})),bvt=Nh(mvt.prototype,"x",[fvt,hu],(function(){return new tmt})),Svt=Nh(mvt.prototype,"y",[dvt,hu],(function(){return new tmt})),xvt=Nh(mvt.prototype,"z",[_vt,hu],(function(){return new tmt})),pvt=mvt))||pvt),qyt=Ee({Grid:0}),Xyt=Ee({WholeSheet:0,SingleRow:1}),Yyt=(wvt=Qh("cc.TextureAnimationModule"),Tvt=uu("numTilesX"),Cvt=uu("numTilesY"),Avt=Eu(qyt),Dvt=Eu(qyt),Ivt=Eu(Xyt),Bvt=Eu(tmt),Mvt=Eu(tmt),wvt((Evt=function(t){function e(){var e;return(e=t.call(this)||this)._enable=kvt&&kvt(),e._numTilesX=Rvt&&Rvt(),e._numTilesY=Ovt&&Ovt(),e._mode=Fvt&&Fvt(),e.animation=Lvt&&Lvt(),e.frameOverTime=Vvt&&Vvt(),e.startFrame=Nvt&&Nvt(),e.cycleCount=zvt&&zvt(),e._flipU=Uvt&&Uvt(),e._flipV=Gvt&&Gvt(),e._uvChannelMask=Hvt&&Hvt(),e.randomRow=Wvt&&Wvt(),e.rowIndex=jvt&&jvt(),e.name="textureModule",e}s(e,t);var i=e.prototype;return i.init=function(t){t.startRow=Math.floor(sn()*this.numTilesY)},i.animate=function(t){var e=1-t.remainingLifetime/t.startLifetime,i=sgt(this.startFrame)?un(t.randomSeed+90794):0,n=sgt(this.frameOverTime)?un(t.randomSeed+90794):0,r=this.startFrame.evaluate(e,i)/(this.numTilesX*this.numTilesY);if(this.animation===Xyt.WholeSheet)t.frameIndex=dn(this.cycleCount*(this.frameOverTime.evaluate(e,n)+r),1);else if(this.animation===Xyt.SingleRow){var s=1/this.numTilesY;if(this.randomRow){var a=dn(this.cycleCount*(this.frameOverTime.evaluate(e,n)+r),1),o=t.startRow*s,h=o+s;t.frameIndex=en(o,h,a)}else{var u=this.rowIndex*s,l=u+s;t.frameIndex=en(u,l,dn(this.cycleCount*(this.frameOverTime.evaluate(e,n)+r),1))}}},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(this._enable=t,this.target&&(this.target.updateMaterialParams(),this.target.enableModule(this.name,t,this)))}},{key:"mode",get:function(){return this._mode},set:function(t){t!==qyt.Grid&&Q("particle texture animation's sprites is not supported!")}},{key:"numTilesX",get:function(){return this._numTilesX},set:function(t){this._numTilesX!==t&&(this._numTilesX=t,this.target.updateMaterialParams())}},{key:"numTilesY",get:function(){return this._numTilesY},set:function(t){this._numTilesY!==t&&(this._numTilesY=t,this.target.updateMaterialParams())}},{key:"flipU",get:function(){return this._flipU},set:function(){Q("particle texture animation's flipU is not supported!")}},{key:"flipV",get:function(){return this._flipV},set:function(){Q("particle texture animation's flipV is not supported!")}},{key:"uvChannelMask",get:function(){return this._uvChannelMask},set:function(){Q("particle texture animation's uvChannelMask is not supported!")}}]),e}(Jmt),kvt=Nh(Evt.prototype,"_enable",[hu],(function(){return!1})),Rvt=Nh(Evt.prototype,"_numTilesX",[Tvt],(function(){return 0})),Ovt=Nh(Evt.prototype,"_numTilesY",[Cvt],(function(){return 0})),Fvt=Nh(Evt.prototype,"_mode",[Avt],(function(){return qyt.Grid})),y(Evt.prototype,"mode",[Dvt],Object.getOwnPropertyDescriptor(Evt.prototype,"mode"),Evt.prototype),Lvt=Nh(Evt.prototype,"animation",[Ivt,hu],(function(){return Xyt.WholeSheet})),Vvt=Nh(Evt.prototype,"frameOverTime",[Bvt,hu],(function(){return new tmt})),Nvt=Nh(Evt.prototype,"startFrame",[Mvt,hu],(function(){return new tmt})),zvt=Nh(Evt.prototype,"cycleCount",[hu],(function(){return 0})),Uvt=Nh(Evt.prototype,"_flipU",[hu],(function(){return 0})),Gvt=Nh(Evt.prototype,"_flipV",[hu],(function(){return 0})),Hvt=Nh(Evt.prototype,"_uvChannelMask",[hu],(function(){return-1})),Wvt=Nh(Evt.prototype,"randomRow",[hu],(function(){return!1})),jvt=Nh(Evt.prototype,"rowIndex",[hu],(function(){return 0})),Pvt=Evt))||Pvt),Qyt=197866,Jyt=new ir,Kyt=(qvt=Qh("cc.VelocityOvertimeModule"),Xvt=Eu(tmt),Yvt=Eu(tmt),Qvt=Eu(tmt),Jvt=Eu(tmt),Kvt=Eu(hgt),qvt(($vt=function(t){function e(){var e;return(e=t.call(this)||this)._enable=tyt&&tyt(),e.x=eyt&&eyt(),e.y=iyt&&iyt(),e.z=nyt&&nyt(),e.speedModifier=ryt&&ryt(),e.space=syt&&syt(),e.rotation=void 0,e.needTransform=void 0,e.name="velocityModule",e.rotation=new kr,e.speedModifier.constant=1,e.needTransform=!1,e.needUpdate=!0,e}s(e,t);var i=e.prototype;return i.update=function(t,e){this.needTransform=Zmt(t,this.space,e,this.rotation)},i.animate=function(t){var e=1-t.remainingLifetime/t.startLifetime,i=sgt(this.x)?un(t.randomSeed^Qyt):0,n=sgt(this.y)?un(156497^t.randomSeed):0,r=sgt(this.z)?un(984136^t.randomSeed):0,s=sgt(this.speedModifier)?un(t.randomSeed+Qyt):0,a=ir.set(Jyt,this.x.evaluate(e,i),this.y.evaluate(e,n),this.z.evaluate(e,r));this.needTransform&&ir.transformQuat(a,a,this.rotation),ir.add(t.animatedVelocity,t.animatedVelocity,a),ir.add(t.ultimateVelocity,t.velocity,t.animatedVelocity),ir.multiplyScalar(t.ultimateVelocity,t.ultimateVelocity,this.speedModifier.evaluate(1-t.remainingLifetime/t.startLifetime,s))},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(this._enable=t,this.target&&this.target.enableModule(this.name,t,this))}}]),e}(Jmt),tyt=Nh($vt.prototype,"_enable",[hu],(function(){return!1})),eyt=Nh($vt.prototype,"x",[Xvt,hu],(function(){return new tmt})),iyt=Nh($vt.prototype,"y",[Yvt,hu],(function(){return new tmt})),nyt=Nh($vt.prototype,"z",[Qvt,hu],(function(){return new tmt})),ryt=Nh($vt.prototype,"speedModifier",[Jvt,hu],(function(){return new tmt})),syt=Nh($vt.prototype,"space",[Kvt,hu],(function(){return 1})),Zvt=$vt))||Zvt),Zyt=t("f0",(ayt=Qh("cc.Burst"),oyt=Eu(tmt),ayt((uyt=function(){function t(){this._time=lyt&&lyt(),this._repeatCount=cyt&&cyt(),this.repeatInterval=fyt&&fyt(),this.count=dyt&&dyt(),this._remainingCount=0,this._curTime=0}var e=t.prototype;return e.update=function(t,e){if(0===this._remainingCount&&(this._remainingCount=this._repeatCount,this._curTime=this._time),this._remainingCount>0){var i=dn(t.time-t.startDelay.evaluate(0,1),t.duration)-e;i=i>0?i:0;var n=dn(t.time-t.startDelay.evaluate(0,1),t.duration);this._curTime>=i&&this._curTime0&&(t.position.x+=on(-this.randomPositionAmount,this.randomPositionAmount),t.position.y+=on(-this.randomPositionAmount,this.randomPositionAmount),t.position.z+=on(-this.randomPositionAmount,this.randomPositionAmount)),ir.transformQuat(t.velocity,t.velocity,this.quat),ir.transformMat4(t.position,t.position,this.mat),this.sphericalDirectionAmount>0){var e=ir.normalize($yt,t.position);ir.lerp(t.velocity,t.velocity,e,this.sphericalDirectionAmount)}this.lastTime=this.particleSystem.time},e.constructMat=function(){kr.fromEuler(this.quat,this._rotation.x,this._rotation.y,this._rotation.z),Qr.fromRTS(this.mat,this.quat,this._position,this._scale)},e.generateArcAngle=function(){if(0===this.arcMode)return on(0,this._arc);var t=this.totalAngle+2*Math.PI*this.arcSpeed.evaluate(this.particleSystem.time,1)*(this.particleSystem.time-this.lastTime);switch(this.totalAngle=t,0!==this.arcSpread&&(t=Math.floor(t/(this._arc*this.arcSpread))*this._arc*this.arcSpread),this.arcMode){case 1:default:return dn(t,this._arc);case 2:return _n(t,this._arc)}},n(t,[{key:"position",get:function(){return this._position},set:function(t){this._position=t,this.constructMat()}},{key:"rotation",get:function(){return this._rotation},set:function(t){this._rotation=t,this.constructMat()}},{key:"scale",get:function(){return this._scale},set:function(t){this._scale=t,this.constructMat()}},{key:"arc",get:function(){return rn(this._arc)},set:function(t){this._arc=nn(t)}},{key:"angle",get:function(){return Math.round(100*rn(this._angle))/100},set:function(t){this._angle=nn(t)}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable=t}},{key:"shapeType",get:function(){return this._shapeType},set:function(t){switch(this._shapeType=t,this._shapeType){case 0:0===this.emitFrom&&(this.emitFrom=3);break;case 2:1===this.emitFrom&&(this.emitFrom=0);break;case 3:case 4:0!==this.emitFrom&&1!==this.emitFrom||(this.emitFrom=3)}}}]),t}(),wyt=Nh(xyt.prototype,"_enable",[hu],(function(){return!1})),Tyt=Nh(xyt.prototype,"_shapeType",[pyt,myt],(function(){return 2})),y(xyt.prototype,"shapeType",[gyt],Object.getOwnPropertyDescriptor(xyt.prototype,"shapeType"),xyt.prototype),Cyt=Nh(xyt.prototype,"emitFrom",[vyt,hu],(function(){return 3})),Ayt=Nh(xyt.prototype,"alignToDirection",[hu],(function(){return!1})),Dyt=Nh(xyt.prototype,"randomDirectionAmount",[hu],(function(){return 0})),Iyt=Nh(xyt.prototype,"sphericalDirectionAmount",[hu],(function(){return 0})),Byt=Nh(xyt.prototype,"randomPositionAmount",[hu],(function(){return 0})),Myt=Nh(xyt.prototype,"radius",[hu],(function(){return 1})),Pyt=Nh(xyt.prototype,"radiusThickness",[hu],(function(){return 1})),Eyt=Nh(xyt.prototype,"arcMode",[yyt,hu],(function(){return 0})),kyt=Nh(xyt.prototype,"arcSpread",[hu],(function(){return 0})),Ryt=Nh(xyt.prototype,"arcSpeed",[byt,hu],(function(){return new tmt})),Oyt=Nh(xyt.prototype,"length",[hu],(function(){return 5})),Fyt=Nh(xyt.prototype,"boxThickness",[hu],(function(){return new ir(0,0,0)})),Lyt=Nh(xyt.prototype,"_position",[hu],(function(){return new ir(0,0,0)})),Vyt=Nh(xyt.prototype,"_rotation",[hu],(function(){return new ir(0,0,0)})),Nyt=Nh(xyt.prototype,"_scale",[hu],(function(){return new ir(1,1,1)})),zyt=Nh(xyt.prototype,"_arc",[hu],(function(){return nn(360)})),Uyt=Nh(xyt.prototype,"_angle",[hu],(function(){return nn(25)})),Syt=xyt))||Syt);function nbt(t,e,i,n,r){switch(t){case 3:egt(n,e*(1-i),e),ir.normalize(r,n);break;case 2:tgt(n),ir.multiplyScalar(n,n,e),ir.normalize(r,n);break;default:Y(t+" is not supported for sphere emitter.")}}function rbt(t,e,i,n,r){switch(t){case 3:egt(n,e*(1-i),e),n.z>0&&(n.z*=-1),ir.normalize(r,n);break;case 2:tgt(n),ir.multiplyScalar(n,n,e),n.z>0&&(n.z*=-1),ir.normalize(r,n);break;default:Y(t+" is not supported for hemisphere emitter.")}}function sbt(t,e,i,n,r,s,a,o){switch(t){case 0:igt(a,e*(1-i),e,n),ds.multiplyScalar(o,a,Math.sin(r)),o.z=-Math.cos(r)*e,ir.normalize(o,o),a.z=0;break;case 2:$mt(a,n),ds.multiplyScalar(o,a,Math.sin(r)),o.z=-Math.cos(r),ir.normalize(o,o),ds.multiplyScalar(a,a,e),a.z=0;break;case 3:igt(a,e*(1-i),e,n),ds.multiplyScalar(o,a,Math.sin(r)),o.z=-Math.cos(r)*e,ir.normalize(o,o),a.z=0,ir.add(a,a,ir.multiplyScalar($yt,o,s*sn()/-o.z));break;default:Y(t+" is not supported for cone emitter.")}}function abt(t,e,i,n){switch(t){case 3:r=i,s=ebt,ir.set(r,on(-s.x,s.x),on(-s.y,s.y),on(-s.z,s.z));break;case 2:tbt[0]=on(-.5,.5),tbt[1]=on(-.5,.5),tbt[2]=.5*rgt(),ngt(tbt),hbt(tbt,e),ir.set(i,tbt[0],tbt[1],tbt[2]);break;case 1:tbt[0]=on(-.5,.5),tbt[1]=.5*rgt(),tbt[2]=.5*rgt(),ngt(tbt),hbt(tbt,e),ir.set(i,tbt[0],tbt[1],tbt[2]);break;default:Y(t+" is not supported for box emitter.")}var r,s;ir.copy(n,Kmt)}function obt(t,e,i,n,r){igt(n,t*(1-e),t,i),ir.normalize(r,n)}function hbt(t,e){e.x>0&&(t[0]+=.5*on(-e.x,e.x),t[0]=$i(t[0],-.5,.5)),e.y>0&&(t[1]+=.5*on(-e.y,e.y),t[1]=$i(t[1],-.5,.5)),e.z>0&&(t[2]+=.5*on(-e.z,e.z),t[2]=$i(t[2],-.5,.5))}var ubt=[0,0,1,0,0,1,1,1],lbt=[0,0,0,1,0,0,0,1,0,1,1,0],cbt=function(t){function e(){var e;return(e=t.call(this)||this)._capacity=void 0,e._bufferSize=void 0,e._vertAttrs=void 0,e._vertAttribSize=void 0,e._vBuffer=void 0,e._vertAttrsFloatCount=void 0,e._vdataF32=void 0,e._vdataUint32=void 0,e._subMeshData=void 0,e._mesh=void 0,e._vertCount=0,e._indexCount=0,e._startTimeOffset=0,e._lifeTimeOffset=0,e._material=null,e._vertAttribSizeStatic=void 0,e._vertStaticAttrsFloatCount=void 0,e._insBuffers=void 0,e._insIndices=void 0,e._useInstance=void 0,e._iaVertCount=0,e._iaIndexCount=0,e.type=4,e._capacity=0,e._bufferSize=16,e._vertAttrs=null,e._vertAttribSize=0,e._vBuffer=null,e._vertAttrsFloatCount=0,e._vdataF32=null,e._vdataUint32=null,e._vertAttribSizeStatic=0,e._vertStaticAttrsFloatCount=0,e._insBuffers=[],e._insIndices=null,Hp.gfxDevice.hasFeature(1)?e._useInstance=!0:e._useInstance=!1,e._subMeshData=null,e._mesh=null,e}s(e,t);var i=e.prototype;return i.setCapacity=function(t){var e=this._capacity!==t;this._capacity=t,this._bufferSize=Math.max(this._capacity,16),this._subMeshData&&e&&this.rebuild()},i.setVertexAttributes=function(t,e){if(this._useInstance)this.setVertexAttributesIns(t,e);else{if(this._mesh===t&&this._vertAttrs===e)return;this._mesh=t,this._vertAttrs=e,this._vertAttribSize=0;for(var i,n=p(this._vertAttrs);!(i=n()).done;){var r=i.value;r.offset=this._vertAttribSize,this._vertAttribSize+=ep[r.format].size}this._vertAttrsFloatCount=this._vertAttribSize/4,this.rebuild()}},i.setVertexAttributesIns=function(t,e){if(this._mesh!==t||this._vertAttrs!==e){this._mesh=t,this._vertAttrs=e,this._vertAttribSize=0,this._vertAttribSizeStatic=0;for(var i,n=p(this._vertAttrs);!(i=n()).done;){var r=i.value;0===r.stream?(r.offset=this._vertAttribSize,this._vertAttribSize+=ep[r.format].size):1===r.stream&&(r.offset=this._vertAttribSizeStatic,this._vertAttribSizeStatic+=ep[r.format].size)}this._vertAttrsFloatCount=this._vertAttribSize/4,this._vertStaticAttrsFloatCount=this._vertAttribSizeStatic/4,this.rebuild()}},i.createSubMeshData=function(){this.destroySubMeshData(),this._vertCount=4,this._indexCount=6,this._mesh&&(this._vertCount=this._mesh.struct.vertexBundles[this._mesh.struct.primitives[0].vertexBundelIndices[0]].view.count,this._indexCount=this._mesh.struct.primitives[0].indexView.count);var t=this._device.createBuffer(new h_(10,3,this._vertAttribSize*this._bufferSize*this._vertCount,this._vertAttribSize)),e=new ArrayBuffer(this._vertAttribSize*this._bufferSize*this._vertCount);if(this._mesh&&this._capacity>0){var i=this._vertAttrs[this._vertAttrs.findIndex((function(t){return"a_texCoord"===t.name}))].offset;this._mesh.copyAttribute(0,"a_texCoord",e,this._vertAttribSize,i);var n=this._vertAttrs.findIndex((function(t){return"a_texCoord3"===t.name}));if(i=this._vertAttrs[n++].offset,this._mesh.copyAttribute(0,"a_position",e,this._vertAttribSize,i),i=this._vertAttrs[n++].offset,this._mesh.copyAttribute(0,"a_normal",e,this._vertAttribSize,i),i=this._vertAttrs[n++].offset,!this._mesh.copyAttribute(0,"a_color",e,this._vertAttribSize,i))for(var r=new Uint32Array(e),s=0;s0){this._mesh.copyIndices(0,h);for(var u=1;u=this._particleSystem.capacity?null:this._particles.add()},i.getDefaultTrailMaterial=function(){return this._defaultTrailMat},i.setNewParticle=function(){},i._initModuleList=function(){var t=this;ybt.forEach((function(e){if(t._particleSystem){var i=t._particleSystem[e];i&&i.enable&&(i.needUpdate&&t._updateList.set(i.name,i),i.needAnimate&&t._animateList.set(i.name,i))}})),this._runAnimateList.length=0;for(var e=0,i=Ymt.length;e0,this._particles.length},i.getNoisePreview=function(t,e,i){var n=this;this._runAnimateList.forEach((function(r){r.name===Xmt&&r.getNoisePreview(t,n._particleSystem,e,i)}))},i.updateRenderData=function(){for(var t=0,e=0;e=(null==(t=this._particleSystem)?void 0:t.capacity)?null:this._tempParticle},i.setNewParticle=function(t){this._particleSystem&&(this._model.addGPUParticleVertexData(t,this._particleNum,this._particleSystem.time),this._particleNum++)},i.getDefaultMaterial=function(){return this._defaultMat},i.updateRotation=function(t){t&&this.doUpdateRotation(t)},i.doUpdateRotation=function(t){if(4===this._renderInfo.renderMode||2!==this._alignSpace){var e;if(1===this._alignSpace)null==(e=this._particleSystem)||e.node.getRotation(qbt);else if(0===this._alignSpace){var i;null==(i=this._particleSystem)||i.node.getWorldRotation(qbt)}else if(2===this._alignSpace){var n,r;qbt.set(0,0,0,1);var s=null==(n=this._particleSystem)||null==(r=n.node.scene.renderScene)?void 0:r.cameras;if(void 0!==s&&this._particleSystem)for(var a=0;a<(null==s?void 0:s.length);++a){var o=s[a];if((o.visibility&this._particleSystem.node.layer)===this._particleSystem.node.layer){kr.fromViewUp(qbt,o.forward);break}}}else qbt.set(0,0,0,1);t.setUniform(this._uNodeRotHandle,qbt)}},i.updateScale=function(t){t&&this.doUpdateScale(t)},i.doUpdateScale=function(t){var e,i=this._node_scale;switch(null==(e=this._particleSystem)?void 0:e.scaleSpace){case 1:this._particleSystem.node.getScale(i);break;case 0:this._particleSystem.node.getWorldScale(i)}t.setUniform(t.getHandle("scale"),Gbt.set(i.x,i.y,i.z))},i.updateParticles=function(t){return this._particleSystem?(this._particleNum=this._model.updateGPUParticles(this._particleNum,this._particleSystem.time,t),this.updateShaderUniform(t),this._model.enabled=this._particleNum>0,this._particleNum):this._particleNum},i.updateRenderData=function(){},i.beforeRender=function(){this._model.updateIA(this._particleNum)},i.updateAlignSpace=function(t){this._alignSpace=t},i.updateShaderUniform=function(t){if(this._particleSystem){var e=this._particleSystem.getMaterialInstance(0)||this._defaultMat;if(e){var i=e.passes[0];Wbt.x=this._particleSystem.time,Wbt.y=t,i.setUniform(this._uTimeHandle,Wbt),this._particleSystem.node.getWorldRotation(jbt),i.setUniform(this._uRotHandle,jbt),this.doUpdateRotation(i)}}},i.initShaderUniform=function(t){var e,i,n,r,s,a,o=t.passes[0];this._uTimeHandle=o.getHandle("u_timeDelta"),this._uRotHandle=o.getHandle("u_worldRot"),this._uNodeRotHandle=o.getHandle("nodeRotation"),this.doUpdateScale(o),o.setUniform(o.getHandle("frameTile_velLenScale"),this._unifrom_velLenScale),Wbt.x=_St,Wbt.y=.03125,o.setUniform(o.getHandle("u_sampleInfo"),Wbt);var h=!1,u=null==(e=this._particleSystem)?void 0:e._forceOvertimeModule;if(h=!!u&&u.enable,this._defines.FORCE_OVER_TIME_MODULE_ENABLE=h,h){var l=hmt(this._forceTexture,this._forceData,_St,u.x,u.y,u.z);this._forceTexture=l.texture,this._forceData=l.texdata;var c=o.getHandle("force_over_time_tex0"),f=QS(c);o.bindSampler(f,this._forceTexture.getGFXSampler()),o.bindTexture(f,this._forceTexture.getGFXTexture());var d=o.getHandle("u_force_space");o.setUniform(d,u.space);var _=o.getHandle("u_force_mode");o.setUniform(_,this._forceTexture.height)}var p=null==(i=this._particleSystem)?void 0:i._velocityOvertimeModule;if(h=!!p&&p.enable,this._defines.VELOCITY_OVER_TIME_MODULE_ENABLE=h,h){var m=umt(this._velocityTexture,this._velocityData,_St,p.x,p.y,p.z,p.speedModifier);this._velocityTexture=m.texture,this._velocityData=m.texdata;var g=o.getHandle("velocity_over_time_tex0"),v=QS(g);o.bindSampler(v,this._velocityTexture.getGFXSampler()),o.bindTexture(v,this._velocityTexture.getGFXTexture());var y=o.getHandle("u_velocity_space");o.setUniform(y,p.space);var b=o.getHandle("u_velocity_mode");o.setUniform(b,this._velocityTexture.height)}var S=null==(n=this._particleSystem)?void 0:n._colorOverLifetimeModule;if(h=!!S&&S.enable,this._defines.COLOR_OVER_TIME_MODULE_ENABLE=h,h){var x=Fmt(this._colorTexture,this._colorData,_St,S.color);this._colorTexture=x.texture,this._colorData=x.texdata;var w=o.getHandle("color_over_time_tex0"),T=QS(w);o.bindSampler(T,this._colorTexture.getGFXSampler()),o.bindTexture(T,this._colorTexture.getGFXTexture());var C=o.getHandle("u_color_mode");o.setUniform(C,this._colorTexture.height)}var A,D=null==(r=this._particleSystem)?void 0:r._rotationOvertimeModule;if(h=!!D&&D.enable,this._defines.ROTATION_OVER_TIME_MODULE_ENABLE=h,h&&(A=D.separateAxes?hmt(this._rotationTexture,this._rotationData,_St,D.x,D.y,D.z):smt(this._rotationTexture,this._rotationData,_St,D.z),this._rotationTexture=A.texture,this._rotationData=A.texdata,this._rotationTexture)){var I=o.getHandle("rotation_over_time_tex0"),B=QS(I);o.bindSampler(B,this._rotationTexture.getGFXSampler()),o.bindTexture(B,this._rotationTexture.getGFXTexture());var M=o.getHandle("u_rotation_mode");o.setUniform(M,this._rotationTexture.height)}var P,E=null==(s=this._particleSystem)?void 0:s._sizeOvertimeModule;if(h=!!E&&E.enable,this._defines.SIZE_OVER_TIME_MODULE_ENABLE=h,h&&(P=E.separateAxes?hmt(this._sizeTexture,this._sizeData,_St,E.x,E.y,E.z,!0):amt(this._sizeTexture,this._sizeData,_St,E.size),this._sizeTexture=P.texture,this._sizeData=P.texdata,this._sizeTexture)){var k=o.getHandle("size_over_time_tex0"),R=QS(k);o.bindSampler(R,this._sizeTexture.getGFXSampler()),o.bindTexture(R,this._sizeTexture.getGFXTexture());var O=o.getHandle("u_size_mode");o.setUniform(O,this._sizeTexture.height)}var F=null==(a=this._particleSystem)?void 0:a._textureAnimationModule;if(h=!!F&&F.enable,this._defines.TEXTURE_ANIMATION_MODULE_ENABLE=h,h){var L=omt(this._animTexture,this._animData,_St,F.startFrame,F.frameOverTime);this._animTexture=L.texture,this._animData=L.texdata;var V=o.getHandle("texture_animation_tex0"),N=QS(V);o.bindSampler(N,this._animTexture.getGFXSampler()),o.bindTexture(N,this._animTexture.getGFXTexture());var z=o.getHandle("u_anim_info");Wbt.x=this._animTexture.height,Wbt.y=F.numTilesX*F.numTilesY,Wbt.z=F.cycleCount,o.setUniform(z,Wbt)}this._defines.USE_VK_SHADER=4===Hp.gfxDevice.gfxAPI,this._defines.CC_INSTANCE_PARTICLE=this._useInstance},i.getParticleCount=function(){return this._particleNum},i.onMaterialModified=function(){this._inited&&this.updateMaterialParams()},i.onRebuildPSO=function(t,e){this._model&&0===t&&this._model.setSubModelMaterial(0,e)},i.updateVertexAttrib=function(){if(4===this._renderInfo.renderMode&&this._renderInfo.mesh){var t=this._renderInfo.mesh.readAttributeFormat(0,"a_color");if(t){for(var e=35,i=0;i=8&&3&t.getFormatFeatures(44))||(C.warn("Maybe the device has restrictions on vertex textures or does not support float textures."),!1)}var ESt,kSt,RSt,OSt,FSt,LSt,VSt,NSt,zSt,USt,GSt,HSt,WSt,jSt,qSt,XSt,YSt,QSt,JSt,KSt,ZSt,$St,txt,ext,ixt,nxt,rxt,sxt,axt,oxt,hxt,uxt,lxt,cxt,fxt,dxt,_xt,pxt,mxt,gxt,vxt,yxt,bxt,Sxt,xxt,wxt,Txt,Cxt,Axt,Dxt,Ixt,Bxt,Mxt,Pxt,Ext,kxt,Rxt,Oxt,Fxt,Lxt,Vxt,Nxt,zxt,Uxt,Gxt,Hxt,Wxt,jxt,qxt,Xxt,Yxt,Qxt,Jxt,Kxt,Zxt,$xt,twt,ewt,iwt,nwt,rwt,swt,awt,owt,hwt,uwt,lwt,cwt,fwt,dwt,_wt,pwt,mwt,gwt,vwt,ywt,bwt,Swt,xwt,wwt,Twt,Cwt,Awt,Dwt,Iwt,Bwt,Mwt,Pwt,Ewt,kwt,Rwt,Owt,Fwt,Lwt,Vwt,Nwt,zwt,Uwt,Gwt,Hwt,Wwt,jwt,qwt,Xwt,Ywt,Qwt,Jwt,Kwt,Zwt,$wt,tTt,eTt,iTt,nTt,rTt,sTt,aTt,oTt,hTt,uTt,lTt,cTt,fTt,dTt,_Tt,pTt=(Xbt=Qh("cc.ParticleSystemRenderer"),Ybt=Eu(cgt),Qbt=Eu(cgt),Jbt=Eu(CR),Kbt=Eu(FT),Zbt=Eu(FT),$bt=Eu(FT),tSt=Eu(FT),eSt=Eu(lgt),Xbt((dSt=function(){function t(){this._renderMode=rSt&&rSt(),this._velocityScale=sSt&&sSt(),this._lengthScale=aSt&&aSt(),this._mesh=oSt&&oSt(),this._cpuMaterial=hSt&&hSt(),this._gpuMaterial=uSt&&uSt(),this._mainTexture=lSt&&lSt(),this._useGPU=cSt&&cSt(),this._alignSpace=fSt&&fSt(),this._particleSystem=null}var e=t.prototype;return e.create=function(t){null===this._particleSystem?this._particleSystem=t:this._particleSystem!==t&&ht(6033)},e.onInit=function(t){this.create(t);var e=this._useGPU&&PSt();this._particleSystem.processor?ht(6034):(this._particleSystem.processor=e?new MSt(this):new Ubt(this),this._particleSystem.processor.updateAlignSpace(this.alignSpace),this._particleSystem.processor.onInit(t)),e?this.gpuMaterial=this.particleMaterial:(this.particleMaterial&&-1!==this.particleMaterial.effectName.indexOf("particle-gpu")&&(this.particleMaterial=null,at(6035)),this.cpuMaterial=this.particleMaterial)},e._switchProcessor=function(){if(this._particleSystem){this._particleSystem.processor&&(this._particleSystem.processor.detachFromScene(),this._particleSystem.processor.clear(),this._particleSystem.processor=null);var t=this._useGPU&&PSt();this.particleMaterial=t?this.gpuMaterial:this.cpuMaterial,this._particleSystem.processor=t?new MSt(this):new Ubt(this),this._particleSystem.processor.updateAlignSpace(this.alignSpace),this._particleSystem.processor.onInit(this._particleSystem),this._particleSystem.processor.onEnable(),this._particleSystem.bindModule()}},n(t,[{key:"renderMode",get:function(){return this._renderMode},set:function(t){this._renderMode!==t&&(this._renderMode=t,this._particleSystem&&this._particleSystem.processor.updateRenderMode())}},{key:"velocityScale",get:function(){return this._velocityScale},set:function(t){this._velocityScale=t,this._particleSystem&&this._particleSystem.processor.updateMaterialParams()}},{key:"lengthScale",get:function(){return this._lengthScale},set:function(t){this._lengthScale=t,this._particleSystem&&this._particleSystem.processor.updateMaterialParams()}},{key:"mesh",get:function(){return this._mesh},set:function(t){this._mesh=t,this._particleSystem&&this._particleSystem.processor.setVertexAttributes()}},{key:"particleMaterial",get:function(){return this._particleSystem?this._particleSystem.getSharedMaterial(0):null},set:function(t){this._particleSystem&&this._particleSystem.setSharedMaterial(t,0)}},{key:"cpuMaterial",get:function(){return this._cpuMaterial},set:function(t){if(t){var e=t.effectName;if(-1===e.indexOf("particle")||-1!==e.indexOf("particle-gpu"))return void at(6035)}this._cpuMaterial=t,this.particleMaterial=this._cpuMaterial}},{key:"gpuMaterial",get:function(){return this._gpuMaterial},set:function(t){t&&-1===t.effectName.indexOf("particle-gpu")?at(6035):(this._gpuMaterial=t,this.particleMaterial=this._gpuMaterial)}},{key:"trailMaterial",get:function(){return this._particleSystem?this._particleSystem.getSharedMaterial(1):null},set:function(t){this._particleSystem&&this._particleSystem.setSharedMaterial(t,1)}},{key:"mainTexture",get:function(){return this._mainTexture},set:function(t){this._mainTexture=t}},{key:"useGPU",get:function(){return this._useGPU},set:function(t){this._useGPU!==t&&(PSt()?this._useGPU=t:this._useGPU=!1,this._switchProcessor())}},{key:"alignSpace",get:function(){return this._alignSpace},set:function(t){this._alignSpace=t,this._particleSystem.processor.updateAlignSpace(this._alignSpace)}}]),t}(),dSt.AlignmentSpace=lgt,y((nSt=dSt).prototype,"renderMode",[Ybt],Object.getOwnPropertyDescriptor(nSt.prototype,"renderMode"),nSt.prototype),rSt=Nh(nSt.prototype,"_renderMode",[Qbt,hu],(function(){return 0})),sSt=Nh(nSt.prototype,"_velocityScale",[hu],(function(){return 1})),aSt=Nh(nSt.prototype,"_lengthScale",[hu],(function(){return 1})),oSt=Nh(nSt.prototype,"_mesh",[hu],(function(){return null})),y(nSt.prototype,"mesh",[Jbt],Object.getOwnPropertyDescriptor(nSt.prototype,"mesh"),nSt.prototype),y(nSt.prototype,"particleMaterial",[Kbt],Object.getOwnPropertyDescriptor(nSt.prototype,"particleMaterial"),nSt.prototype),y(nSt.prototype,"cpuMaterial",[Zbt],Object.getOwnPropertyDescriptor(nSt.prototype,"cpuMaterial"),nSt.prototype),hSt=Nh(nSt.prototype,"_cpuMaterial",[hu],(function(){return null})),y(nSt.prototype,"gpuMaterial",[$bt],Object.getOwnPropertyDescriptor(nSt.prototype,"gpuMaterial"),nSt.prototype),uSt=Nh(nSt.prototype,"_gpuMaterial",[hu],(function(){return null})),y(nSt.prototype,"trailMaterial",[tSt],Object.getOwnPropertyDescriptor(nSt.prototype,"trailMaterial"),nSt.prototype),lSt=Nh(nSt.prototype,"_mainTexture",[hu],(function(){return null})),cSt=Nh(nSt.prototype,"_useGPU",[hu],(function(){return!1})),y(nSt.prototype,"alignSpace",[eSt],Object.getOwnPropertyDescriptor(nSt.prototype,"alignSpace"),nSt.prototype),fSt=Nh(nSt.prototype,"_alignSpace",[hu],(function(){return 2})),iSt=nSt))||iSt),mTt=Math.cos(nn(100)),gTt={position:new ir,velocity:new ir},vTt=new kr,yTt=new ir,bTt=new ir,STt=new cr,xTt=function(){function t(t){for(this.start=void 0,this.end=void 0,this.trailElements=void 0,this.start=-1,this.end=-1,this.trailElements=[];t--;)this.trailElements.push({position:new ir,lifetime:0,width:0,velocity:new ir,direction:0,color:new cr})}var e=t.prototype;return e.getElement=function(t){return-1===this.start?null:(t<0&&(t=(t+this.trailElements.length)%this.trailElements.length),t>=this.trailElements.length&&(t%=this.trailElements.length),this.trailElements[t])},e.addElement=function(){if(0===this.trailElements.length)return null;if(-1===this.start)return this.start=0,this.end=1,this.trailElements[0];this.start===this.end&&(this.trailElements.splice(this.end,0,{position:new ir,lifetime:0,width:0,velocity:new ir,direction:0,color:new cr}),this.start++,this.start%=this.trailElements.length);var t=this.end++;return this.end%=this.trailElements.length,this.trailElements[t]},e.iterateElement=function(t,e,i,n){for(var r=this.start>=this.end?this.end+this.trailElements.length:this.end,s=this.start;st.lastLoop)t.trailDelay>1?(t.lastLoop=t.loopCount,t.trailDelay=0):t.trailDelay++;else{var i=this._particleTrail.get(t);if(!i)return i=this._trailSegments.alloc(),void this._particleTrail.set(t,i);var n=i.getElement(i.end-1);if(this._needTransform?ir.transformMat4(yTt,t.position,this._psTransform):ir.copy(yTt,t.position),!(n&&(i.iterateElement(this,this._updateTrailElement,t,e),ir.squaredDistance(n.position,yTt)2){var a=i.getElement(i.end-2),o=i.getElement(i.end-3);ir.subtract(yTt,o.position,a.position),ir.subtract(bTt,n.position,a.position),ir.subtract(a.velocity,bTt,yTt),ir.equals(ir.ZERO,a.velocity)&&ir.copy(a.velocity,yTt),ir.normalize(a.velocity,a.velocity),this._checkDirectionReverse(a,o)}this.colorFromParticle?n.color.set(t.color):n.color.set(this.colorOvertime.evaluate(0,1))}}},t.removeParticle=function(t){var e=this._particleTrail.get(t);e&&this._trailSegments&&(e.clear(),this._trailSegments.free(e),this._particleTrail.delete(t))},t.updateRenderData=function(){this.vbOffset=0,this.ibOffset=0;for(var t,e=p(this._particleTrail.keys());!(t=e()).done;){var i=t.value,n=this._particleTrail.get(i);if(-1!==n.start){var r=4*this.vbOffset/this._vertSize,s=n.start>=n.end?n.end+n.trailElements.length:n.end,a=s-n.start,o=1/a,h=n.trailElements[n.start];this._fillVertexBuffer(h,this.colorOverTrail.evaluate(1,1),r,1,0,4);for(var u=n.start+1;u2){var y=n.getElement(n.end-1),b=n.getElement(n.end-2);ir.subtract(yTt,b.position,y.position),ir.subtract(bTt,gTt.position,y.position),ir.normalize(yTt,yTt),ir.normalize(bTt,bTt),ir.subtract(y.velocity,bTt,yTt),ir.normalize(y.velocity,y.velocity),this._checkDirectionReverse(y,b),this.vbOffset-=this._vertSize/4*2,this.ibOffset-=6,this._fillVertexBuffer(y,this.colorOverTrail.evaluate(o,1),r,o,a-1,5),ir.subtract(gTt.velocity,gTt.position,y.position),ir.normalize(gTt.velocity,gTt.velocity),this._checkDirectionReverse(gTt,y)}this.widthFromParticle?gTt.width=i.size.x*this.widthRatio.evaluate(0,1):gTt.width=this.widthRatio.evaluate(0,1),gTt.color=i.color,ir.equals(gTt.velocity,ir.ZERO)?this.ibOffset-=3:this._fillVertexBuffer(gTt,this.colorOverTrail.evaluate(0,1),r,0,a,1)}}this._trailModel&&(this._trailModel.enabled=this.ibOffset>0)},t.updateIA=function(t){var e=this._trailModel&&this._trailModel.subModels;if(e&&e.length>0){var i=e[0];i.inputAssembler.vertexBuffers[0].update(this._vbF32),i.inputAssembler.indexBuffer.update(this._iBuffer),i.inputAssembler.firstIndex=0,i.inputAssembler.indexCount=t,i.inputAssembler.vertexCount=this._iaVertCount}},t.beforeRender=function(){this.updateIA(this.ibOffset)},t._createModel=function(){this._trailModel||(this._trailModel=C.director.root.createModel(WM))},t.rebuild=function(){var t=this,e=GE.root.device,i=e.createBuffer(new h_(10,3,t._vertSize*(t._trailNum+1)*2,t._vertSize)),n=new ArrayBuffer(t._vertSize*(t._trailNum+1)*2);t._vbF32=new Float32Array(n),t._vbUint32=new Uint32Array(n),i.update(n);var r=e.createBuffer(new h_(6,3,12*Math.max(1,t._trailNum),2));t._iBuffer=new Uint16Array(6*Math.max(1,t._trailNum)),r.update(t._iBuffer),t._iaVertCount=2*(t._trailNum+1),t._iaIndexCount=6*t._trailNum,t._subMeshData=new $E([i],t._vertAttrs,7,r);var s=t._trailModel;s&&t._material&&(s.node=s.transform=t._particleSystem.node,s.visFlags=t._particleSystem.visibility,s.initSubModel(0,t._subMeshData,t._material),s.enabled=!0)},t._updateTrailElement=function(t,e,i,n){return e.lifetime+=n,t.colorFromParticle?(e.color.set(i.color),e.color.multiply(t.colorOvertime.evaluate(1-i.remainingLifetime/i.startLifetime,1))):e.color.set(t.colorOvertime.evaluate(1-i.remainingLifetime/i.startLifetime,1)),t.widthFromParticle?e.width=i.size.x*t.widthRatio.evaluate(e.lifetime/t._trailLifetime,1):e.width=t.widthRatio.evaluate(e.lifetime/t._trailLifetime,1),e.lifetime>t._trailLifetime},t._fillVertexBuffer=function(t,e,i,n,r,s){this._vbF32[this.vbOffset++]=t.position.x,this._vbF32[this.vbOffset++]=t.position.y,this._vbF32[this.vbOffset++]=t.position.z,this._vbF32[this.vbOffset++]=t.direction,this._vbF32[this.vbOffset++]=t.width,this._vbF32[this.vbOffset++]=n,this._vbF32[this.vbOffset++]=0,this._vbF32[this.vbOffset++]=t.velocity.x,this._vbF32[this.vbOffset++]=t.velocity.y,this._vbF32[this.vbOffset++]=t.velocity.z,STt.set(t.color),STt.multiply(e),this._vbUint32[this.vbOffset++]=cr.toUint32(STt),this._vbF32[this.vbOffset++]=t.position.x,this._vbF32[this.vbOffset++]=t.position.y,this._vbF32[this.vbOffset++]=t.position.z,this._vbF32[this.vbOffset++]=1-t.direction,this._vbF32[this.vbOffset++]=t.width,this._vbF32[this.vbOffset++]=n,this._vbF32[this.vbOffset++]=1,this._vbF32[this.vbOffset++]=t.velocity.x,this._vbF32[this.vbOffset++]=t.velocity.y,this._vbF32[this.vbOffset++]=t.velocity.z,this._vbUint32[this.vbOffset++]=cr.toUint32(STt),1&s&&(this._iBuffer[this.ibOffset++]=i+2*r,this._iBuffer[this.ibOffset++]=i+2*r-1,this._iBuffer[this.ibOffset++]=i+2*r+1),4&s&&(this._iBuffer[this.ibOffset++]=i+2*r,this._iBuffer[this.ibOffset++]=i+2*r+1,this._iBuffer[this.ibOffset++]=i+2*r+2)},t._checkDirectionReverse=function(t,e){ir.dot(t.velocity,e.velocity)0&&!n._isCulled&&(null!=(e=r.getModel())&&e.scene||r.attachToScene(),s&&s.enable&&(null!=(i=s.getModel())&&i.scene||s._attachToScene()),n._needAttach=!1);!n.renderer.useGPU&&s&&s.enable&&(s.inited||(s.clear(),s.destroy(),s.onInit(this),s.enable=!1,s.enable=!0))},i.beforeRender=function(){var t,e,i=this,n=i.processor,r=i.trailModule;i.getParticleCount()<=0?null!=(e=n.getModel())&&e.scene&&(n.detachFromScene(),r&&r.enable&&r._detachFromScene(),i._needAttach=!1):null!=(t=n.getModel())&&t.scene||(i._needAttach=!0),i._isPlaying&&(n.updateRenderData(),n.beforeRender(),r&&r.enable&&(r.updateRenderData(),r.beforeRender()))},i._onVisibilityChange=function(t){this.processor.model&&(this.processor.model.visFlags=t)},i.emit=function(t,e){var i=this,n=i.node,r=i._time%i.duration/i.duration;i._needRefresh&&(n.invalidateChildren(1),i._needRefresh=!1),0===i._simulationSpace&&(n.getWorldMatrix(kTt),n.getWorldRotation(RTt));for(var s=0;si){if(e._time>e.duration+i&&(e.loop||(e._isEmitting=!1)),!e._isEmitting)return;if(e._emitRateTimeCounter+=e.rateOverTime.evaluate(e._time/e.duration,1)*t,e._emitRateTimeCounter>1){var n=Math.floor(e._emitRateTimeCounter);e._emitRateTimeCounter-=n,e.emit(n,t)}var r=e.rateOverDistance.evaluate(e._time/e.duration,1);if(r>0){ir.copy(e._oldWPos,e._curWPos),e.node.getWorldPosition(e._curWPos);var s=ir.distance(e._curWPos,e._oldWPos);e._emitRateDistanceCounter+=s*r}if(e._emitRateDistanceCounter>1){var a=Math.floor(e._emitRateDistanceCounter);e._emitRateDistanceCounter-=a,e.emit(a,t)}for(var o,h=p(e.bursts);!(o=h()).done;)o.value.update(e,t)}},i._resetPosition=function(){this.node.getWorldPosition(this._oldWPos),ir.copy(this._curWPos,this._oldWPos)},i.addSubEmitter=function(t){this._subEmitters.push(t)},i.removeSubEmitter=function(t){this._subEmitters.splice(this._subEmitters.indexOf(t),1)},i.addBurst=function(t){this.bursts.push(t)},i.removeBurst=function(t){var e=this.bursts.indexOf(t);e>-1&&this.bursts.splice(e,1)},i.getBoundingX=function(){return this._aabbHalfX},i.getBoundingY=function(){return this._aabbHalfY},i.getBoundingZ=function(){return this._aabbHalfZ},i.setBoundingX=function(t){this._boundingBox&&this._culler&&(this._boundingBox.halfExtents.x=t,this._culler.setBoundingBoxSize(this._boundingBox.halfExtents),this._aabbHalfX=t)},i.setBoundingY=function(t){this._boundingBox&&this._culler&&(this._boundingBox.halfExtents.y=t,this._culler.setBoundingBoxSize(this._boundingBox.halfExtents),this._aabbHalfY=t)},i.setBoundingZ=function(t){this._boundingBox&&this._culler&&(this._boundingBox.halfExtents.z=t,this._culler.setBoundingBoxSize(this._boundingBox.halfExtents),this._aabbHalfZ=t)},i._onBeforeSerialize=function(t){var e=this;return this.dataCulling?t.filter((function(t){return!Qmt.includes(t)||e[t]&&e[t].enable})):t},i.getNoisePreview=function(t,e){var i=[];return this.processor&&this.processor.getNoisePreview(i,t,e),i},n(e,[{key:"capacity",get:function(){return this._capacity},set:function(t){this._capacity=Math.floor(t>0?t:0),this.processor&&this.processor.model&&this.processor.model.setCapacity(this._capacity)}},{key:"prewarm",get:function(){return this._prewarm},set:function(t){!0===t&&this.loop,this._prewarm=t}},{key:"simulationSpace",get:function(){return this._simulationSpace},set:function(t){t!==this._simulationSpace&&(this._simulationSpace=t,this.processor&&(this.processor.updateMaterialParams(),this.processor.updateTrailMaterial()))}},{key:"renderCulling",get:function(){return this._renderCulling},set:function(t){this._renderCulling=t,t&&(this._boundingBox||(this._boundingBox=new mh,this._calculateBounding(!1)))}},{key:"cullingMode",get:function(){return this._cullingMode},set:function(t){this._cullingMode=t}},{key:"aabbHalfX",get:function(){return this.getBoundingX()||0},set:function(t){this.setBoundingX(t)}},{key:"aabbHalfY",get:function(){return this.getBoundingY()||0},set:function(t){this.setBoundingY(t)}},{key:"aabbHalfZ",get:function(){return this.getBoundingZ()||0},set:function(t){this.setBoundingZ(t)}},{key:"dataCulling",get:function(){return this._dataCulling},set:function(t){this._dataCulling=t}},{key:"sharedMaterials",get:function(){return OTt.get.call(this)},set:function(t){OTt.set.call(this,t)}},{key:"colorOverLifetimeModule",get:function(){return this._colorOverLifetimeModule},set:function(t){t&&(this._colorOverLifetimeModule=t)}},{key:"shapeModule",get:function(){return this._shapeModule},set:function(t){t&&(this._shapeModule=t)}},{key:"sizeOvertimeModule",get:function(){return this._sizeOvertimeModule},set:function(t){t&&(this._sizeOvertimeModule=t)}},{key:"velocityOvertimeModule",get:function(){return this._velocityOvertimeModule},set:function(t){t&&(this._velocityOvertimeModule=t)}},{key:"forceOvertimeModule",get:function(){return this._forceOvertimeModule},set:function(t){t&&(this._forceOvertimeModule=t)}},{key:"limitVelocityOvertimeModule",get:function(){return this._limitVelocityOvertimeModule},set:function(t){t&&(this._limitVelocityOvertimeModule=t)}},{key:"rotationOvertimeModule",get:function(){return this._rotationOvertimeModule},set:function(t){t&&(this._rotationOvertimeModule=t)}},{key:"textureAnimationModule",get:function(){return this._textureAnimationModule},set:function(t){t&&(this._textureAnimationModule=t)}},{key:"noiseModule",get:function(){return this._noiseModule},set:function(t){t&&(this._noiseModule=t)}},{key:"trailModule",get:function(){return this._trailModule},set:function(t){t&&(this._trailModule=t)}},{key:"isPlaying",get:function(){return this._isPlaying}},{key:"isPaused",get:function(){return this._isPaused}},{key:"isStopped",get:function(){return this._isStopped}},{key:"isEmitting",get:function(){return this._isEmitting}},{key:"time",get:function(){return this._time}}]),e}(LU),_Tt.CullingMode=ugt,Dwt=Nh((Awt=_Tt).prototype,"startColor",[Rxt,hu],(function(){return new kmt})),Iwt=Nh(Awt.prototype,"scaleSpace",[Oxt,hu],(function(){return 1})),Bwt=Nh(Awt.prototype,"startSize3D",[hu],(function(){return!1})),Mwt=Nh(Awt.prototype,"startSizeX",[Fxt,Lxt],(function(){return new tmt})),Pwt=Nh(Awt.prototype,"startSizeY",[Vxt,hu],(function(){return new tmt})),Ewt=Nh(Awt.prototype,"startSizeZ",[Nxt,hu],(function(){return new tmt})),kwt=Nh(Awt.prototype,"startSpeed",[zxt,hu],(function(){return new tmt})),Rwt=Nh(Awt.prototype,"startRotation3D",[hu],(function(){return!1})),Owt=Nh(Awt.prototype,"startRotationX",[Uxt,hu],(function(){return new tmt})),Fwt=Nh(Awt.prototype,"startRotationY",[Gxt,hu],(function(){return new tmt})),Lwt=Nh(Awt.prototype,"startRotationZ",[Hxt,Wxt],(function(){return new tmt})),Vwt=Nh(Awt.prototype,"startDelay",[jxt,hu],(function(){return new tmt})),Nwt=Nh(Awt.prototype,"startLifetime",[qxt,hu],(function(){return new tmt})),zwt=Nh(Awt.prototype,"duration",[hu],(function(){return 5})),Uwt=Nh(Awt.prototype,"loop",[hu],(function(){return!0})),y(Awt.prototype,"simulationSpace",[Xxt,hu],Object.getOwnPropertyDescriptor(Awt.prototype,"simulationSpace"),Awt.prototype),Gwt=Nh(Awt.prototype,"simulationSpeed",[hu],(function(){return 1})),Hwt=Nh(Awt.prototype,"playOnAwake",[hu],(function(){return!0})),Wwt=Nh(Awt.prototype,"gravityModifier",[Yxt,hu],(function(){return new tmt})),jwt=Nh(Awt.prototype,"rateOverTime",[Qxt,hu],(function(){return new tmt})),qwt=Nh(Awt.prototype,"rateOverDistance",[Jxt,hu],(function(){return new tmt})),Xwt=Nh(Awt.prototype,"bursts",[Kxt,hu],(function(){return[]})),y(Awt.prototype,"renderCulling",[Zxt],Object.getOwnPropertyDescriptor(Awt.prototype,"renderCulling"),Awt.prototype),Ywt=Nh(Awt.prototype,"_renderCulling",[hu],(function(){return!1})),y(Awt.prototype,"cullingMode",[$xt],Object.getOwnPropertyDescriptor(Awt.prototype,"cullingMode"),Awt.prototype),Qwt=Nh(Awt.prototype,"_cullingMode",[hu],(function(){return 0})),y(Awt.prototype,"aabbHalfX",[twt],Object.getOwnPropertyDescriptor(Awt.prototype,"aabbHalfX"),Awt.prototype),Jwt=Nh(Awt.prototype,"_aabbHalfX",[hu],(function(){return 0})),y(Awt.prototype,"aabbHalfY",[ewt],Object.getOwnPropertyDescriptor(Awt.prototype,"aabbHalfY"),Awt.prototype),Kwt=Nh(Awt.prototype,"_aabbHalfY",[hu],(function(){return 0})),y(Awt.prototype,"aabbHalfZ",[iwt],Object.getOwnPropertyDescriptor(Awt.prototype,"aabbHalfZ"),Awt.prototype),Zwt=Nh(Awt.prototype,"_aabbHalfZ",[hu],(function(){return 0})),$wt=Nh(Awt.prototype,"_dataCulling",[hu,nwt],(function(){return!1})),y(Awt.prototype,"sharedMaterials",[Uu,hu],Object.getOwnPropertyDescriptor(Awt.prototype,"sharedMaterials"),Awt.prototype),tTt=Nh(Awt.prototype,"_colorOverLifetimeModule",[rwt],(function(){return null})),y(Awt.prototype,"colorOverLifetimeModule",[swt],Object.getOwnPropertyDescriptor(Awt.prototype,"colorOverLifetimeModule"),Awt.prototype),eTt=Nh(Awt.prototype,"_shapeModule",[awt],(function(){return null})),y(Awt.prototype,"shapeModule",[owt],Object.getOwnPropertyDescriptor(Awt.prototype,"shapeModule"),Awt.prototype),iTt=Nh(Awt.prototype,"_sizeOvertimeModule",[hwt],(function(){return null})),y(Awt.prototype,"sizeOvertimeModule",[uwt],Object.getOwnPropertyDescriptor(Awt.prototype,"sizeOvertimeModule"),Awt.prototype),nTt=Nh(Awt.prototype,"_velocityOvertimeModule",[lwt],(function(){return null})),y(Awt.prototype,"velocityOvertimeModule",[cwt],Object.getOwnPropertyDescriptor(Awt.prototype,"velocityOvertimeModule"),Awt.prototype),rTt=Nh(Awt.prototype,"_forceOvertimeModule",[fwt],(function(){return null})),y(Awt.prototype,"forceOvertimeModule",[dwt],Object.getOwnPropertyDescriptor(Awt.prototype,"forceOvertimeModule"),Awt.prototype),sTt=Nh(Awt.prototype,"_limitVelocityOvertimeModule",[_wt],(function(){return null})),y(Awt.prototype,"limitVelocityOvertimeModule",[pwt],Object.getOwnPropertyDescriptor(Awt.prototype,"limitVelocityOvertimeModule"),Awt.prototype),aTt=Nh(Awt.prototype,"_rotationOvertimeModule",[mwt],(function(){return null})),y(Awt.prototype,"rotationOvertimeModule",[gwt],Object.getOwnPropertyDescriptor(Awt.prototype,"rotationOvertimeModule"),Awt.prototype),oTt=Nh(Awt.prototype,"_textureAnimationModule",[vwt],(function(){return null})),y(Awt.prototype,"textureAnimationModule",[ywt],Object.getOwnPropertyDescriptor(Awt.prototype,"textureAnimationModule"),Awt.prototype),hTt=Nh(Awt.prototype,"_noiseModule",[bwt],(function(){return null})),y(Awt.prototype,"noiseModule",[Swt],Object.getOwnPropertyDescriptor(Awt.prototype,"noiseModule"),Awt.prototype),uTt=Nh(Awt.prototype,"_trailModule",[xwt],(function(){return null})),y(Awt.prototype,"trailModule",[wwt],Object.getOwnPropertyDescriptor(Awt.prototype,"trailModule"),Awt.prototype),lTt=Nh(Awt.prototype,"renderer",[Twt,hu],(function(){return new pTt})),cTt=Nh(Awt.prototype,"_prewarm",[hu],(function(){return!1})),fTt=Nh(Awt.prototype,"_capacity",[hu],(function(){return 100})),dTt=Nh(Awt.prototype,"_simulationSpace",[hu],(function(){return 1})),Cwt=Awt))||Cwt)||Cwt)),LTt=t("eZ",function(){function t(){}return t.instantiate=function(t){this.registeredSceneEvent||(GE.on("director_before_scene_launch",this.onSceneUnload,this),this.registeredSceneEvent=!0);var e=t._uuid;if(!this.particleSystemPool.has(e)){var i=new oo((function(){return H$(t)||new tb}),1,(function(t){return t.destroy()}));this.particleSystemPool.set(e,i)}return this.particleSystemPool.get(e).alloc()},t.destroy=function(t){var e,i,n=null==(e=t.prefab)||null==(i=e.asset)?void 0:i.uuid;n&&this.particleSystemPool.has(n)&&(this.stop(t),this.particleSystemPool.get(n).free(t))},t.play=function(t){for(var e,i=p(t.getComponentsInChildren(FTt));!(e=i()).done;)e.value.play()},t.stop=function(t){for(var e,i=p(t.getComponentsInChildren(FTt));!(e=i()).done;)e.value.stop()},t.onSceneUnload=function(){this.particleSystemPool.forEach((function(t){return t.destroy()})),this.particleSystemPool.clear()},t}());LTt.particleSystemPool=new Map,LTt.registeredSceneEvent=!1,mt(Zyt.prototype,"Burst.prototype",[{name:"minCount"},{name:"maxCount"}]),pt(FTt.prototype,"ParticleSystem.prototype",[{name:"enableCulling",newName:"dataCulling"}]),C.ParticleSystemComponent=FTt,le(FTt,"cc.ParticleSystemComponent"),C.BillboardComponent=qpt,le(qpt,"cc.BillboardComponent"),C.LineComponent=Nmt,le(Nmt,"cc.LineComponent"),C.ParticleUtils=LTt;var VTt=Ee({GRAVITY:0,RADIUS:1}),NTt=Ee({FREE:0,RELATIVE:1,GROUPED:2}),zTt=new ds,UTt=new ds,GTt=new ds,HTt=new ds,WTt=new Vn,jTt=DF(wF);function qTt(t){for(var e=0,i=t;i;)e+=i.eulerAngles.z,i=i.parent;return e}var XTt,YTt,QTt,JTt=function(){this.pos=new ds(0,0),this.startPos=new ds(0,0),this.color=new cr(0,0,0,255),this.deltaColor={r:0,g:0,b:0,a:255},this.size=0,this.deltaSize=0,this.rotation=0,this.deltaRotation=0,this.timeToLive=0,this.drawPos=new ds(0,0),this.aspectRatio=1,this.dir=new ds(0,0),this.radialAccel=0,this.tangentialAccel=0,this.angle=0,this.degreesPerSecond=0,this.radius=0,this.deltaRadius=0},KTt=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.get=function(){return this._get()||new JTt},e}(ge),ZTt=new KTt((function(t){t.pos.set(ds.ZERO),t.startPos.set(ds.ZERO),t.color.set(0,0,0,255),t.deltaColor.r=t.deltaColor.g=t.deltaColor.b=0,t.deltaColor.a=255,t.size=0,t.deltaSize=0,t.rotation=0,t.deltaRotation=0,t.timeToLive=0,t.drawPos.set(ds.ZERO),t.aspectRatio=1,t.dir.set(ds.ZERO),t.radialAccel=0,t.tangentialAccel=0,t.angle=0,t.degreesPerSecond=0,t.radius=0,t.deltaRadius=0}),1024),$Tt=function(){function t(t){this.particles=[],this.active=!1,this.uvFilled=0,this.finished=!1,this.renderData=null,this.readyToPlay=!0,this.elapsed=0,this.emitCounter=0,this._worldRotation=0,this.sys=t,this.particles=[],this.active=!1,this.readyToPlay=!0,this.finished=!1,this.elapsed=0,this.emitCounter=0,this.uvFilled=0,this._worldRotation=0}var e=t.prototype;return e.stop=function(){this.active=!1,this.readyToPlay=!1,this.elapsed=this.sys.duration,this.emitCounter=0},e.reset=function(){this.active=!0,this.readyToPlay=!0,this.elapsed=0,this.emitCounter=0,this.finished=!1;for(var t=this.particles,e=0;e1?h=o/u:o=h*u;var l=o/2,c=h/2;if(t.rotation){var f=-l,d=-c,_=l,p=c,m=-nn(t.rotation),g=Math.cos(m),v=Math.sin(m);r[n]=f*g-d*v+s,r[n+1]=f*v+d*g+a,r[n+2]=0,r[n+9]=_*g-d*v+s,r[n+10]=_*v+d*g+a,r[n+11]=0,r[n+18]=f*g-p*v+s,r[n+19]=f*v+p*g+a,r[n+20]=0,r[n+27]=_*g-p*v+s,r[n+28]=_*v+p*g+a,r[n+29]=0}else r[n]=s-l,r[n+1]=a-c,r[n+2]=0,r[n+9]=s+l,r[n+10]=a-c,r[n+11]=0,r[n+18]=s-l,r[n+19]=a+c,r[n+20]=0,r[n+27]=s+l,r[n+28]=a+c,r[n+29]=0;var y=t.color;WTt.x=y.r/255,WTt.y=y.g/255,WTt.z=y.b/255,WTt.w=y.a/255,Vn.toArray(r,WTt,n+5),Vn.toArray(r,WTt,n+14),Vn.toArray(r,WTt,n+23),Vn.toArray(r,WTt,n+32)},e.step=function(t){var e=this.sys.assembler,i=this.sys,n=i.node,r=this.particles;if(t=t>e.maxParticleDeltaTime?e.maxParticleDeltaTime:t,n.updateWorldTransform(),i.positionType===NTt.FREE){this._worldRotation=qTt(n);var s=n.worldMatrix;zTt.x=s.m12,zTt.y=s.m13}else i.positionType===NTt.RELATIVE?(this._worldRotation=n.eulerAngles.z,zTt.x=n.position.x,zTt.y=n.position.y):this._worldRotation=0;if(this.active&&i.emissionRate){var a=1/i.emissionRate;for(r.lengtha;)this.emitParticle(zTt),this.emitCounter-=a;this.elapsed+=t,-1!==i.duration&&i.durationthis.uvFilled&&this.updateUVs();for(var u=0;u0){if(i.emitterMode===VTt.GRAVITY){var c=HTt,f=UTt,d=GTt;(l.pos.x||l.pos.y)&&(f.set(l.pos),f.normalize()),d.set(f),f.multiplyScalar(l.radialAccel);var _=d.x;d.x=-d.y,d.y=_,d.multiplyScalar(l.tangentialAccel),c.set(f),c.add(d),c.add(i.gravity),c.multiplyScalar(t),l.dir.add(c),c.set(l.dir),c.multiplyScalar(t),l.pos.add(c)}else l.angle+=l.degreesPerSecond*t,l.radius+=l.deltaRadius*t,l.pos.x=-Math.cos(l.angle)*l.radius,l.pos.y=-Math.sin(l.angle)*l.radius;l.color.r+=l.deltaColor.r*t,l.color.g+=l.deltaColor.g*t,l.color.b+=l.deltaColor.b*t,l.color.a+=l.deltaColor.a*t,l.size+=l.deltaSize*t,l.size<0&&(l.size=0),l.rotation+=l.deltaRotation*t;var p=UTt;p.set(l.pos),i.positionType!==NTt.GROUPED&&p.add(l.startPos);var m=jTt*u*4;this.updateParticleBuffer(l,p,o,m),++u}else{var g=r[u];u!==r.length-1&&(r[u]=r[r.length-1]),ZTt.put(g),r.length--,o.resize(o.vertexCount-4,o.indexCount-6)}}o.material=this.sys.getRenderMaterial(0),o.frame=this.sys._renderSpriteFrame,o.setRenderDrawInfoAttributes(),0!==r.length||this.active||this.readyToPlay||(this.finished=!0,i._finishedSimulation())}},e.requestData=function(t,e){if(this.renderData){var i=this.renderData.indexCount;this.renderData.request(t,e);for(var n=this.renderData.indexCount/6,r=this.renderData.iData,s=i;s=0?hr;r>=0?++h:--h)t.push(n[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:this.transparency.indexed=this.read(r);var u=255-this.transparency.indexed.length;if(u>0)for(var l=0;u>=0?lu;u>=0?++l:--l)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(r)[0];break;case 2:this.transparency.rgb=this.read(r)}break;case"tEXt":var c=this.read(r),f=c.indexOf(0),d=String.fromCharCode.apply(String,c.slice(0,f));this.text[d]=String.fromCharCode.apply(String,c.slice(f+1));break;case"IEND":i&&this.animation.frames.push(i),this.colors=function(){switch(e.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3;default:return}}.call(this);var _=this.colorType;this.hasAlphaChannel=4===_||6===_;var p=this.colors+(this.hasAlphaChannel?1:0);return this.pixelBitlength=this.bits*p,this.colorSpace=function(){switch(e.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB";default:return}}.call(this),void(this.imgData instanceof Uint8Array||(this.imgData=new Uint8Array(this.imgData)));default:this.pos+=r}if(this.pos+=4,this.pos>n.length)throw new Error(ft(6017))}}var e=t.prototype;return e.read=function(t){var e=0,i=[];for(e=0;t>=0?et;t>=0?++e:--e)i.push(this.data[this.pos++]);return i},e.readUInt32=function(){var t=this.data;return t[this.pos++]<<24|t[this.pos++]<<16|t[this.pos++]<<8|t[this.pos++]},e.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},e.decodePixels=function(t){if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);t=new cR.Inflate(t,{index:0,verify:!1}).decompress();for(var e=this.pixelBitlength/8,i=e*this.width,n=new Uint8Array(i*this.height),r=t.length,s=0,a=0,o=0,h=0,u=0,l=0,c=0,f=0,d=0,_=0,p=0,m=0,g=0,v=0,y=0,b=0,S=0,x=0,w=0;a>>8*(4-s)):r.push(n);else for(var a=0;a=8?-1!==["RATIONAL","SRATIONAL"].indexOf(e)?(r.push(this.getUint32(n+o)),r.push(this.getUint32(n+o+4))):it(8e3):r.push(this.getBytes(s,n+o))}return"ASCII"===e&&r.forEach((function(t,e,i){i[e]=String.fromCharCode(t)})),r},e.getBytes=function(t,e){if(t<=0)it(8001);else{if(t<=1)return this.getUint8(e);if(t<=2)return this.getUint16(e);if(t<=3)return this.getUint32(e)>>>8;if(t<=4)return this.getUint32(e);it(8002)}return 0},e.getBits=function(t,e,i){i=i||0;var n=e+Math.floor(i/8),r=i+t,s=32-t,a=0,o=0;return r<=0?it(6023):r<=8?(a=24+i,o=this.getUint8(n)):r<=16?(a=16+i,o=this.getUint16(n)):r<=32?(a=i,o=this.getUint32(n)):it(6022),{bits:o<>>s,byteOffset:n+Math.floor(r/8),bitOffset:r%8}},e.parseFileDirectory=function(t){var e=this.getUint16(t),i={},n=0,r=0;for(n=t+2,r=0;r=0&&O<=127?g=O+1:O>=-127&&O<=-1?v=1-O:C=!0}else{for(var F=this.getUint8(b+x),L=0;L0)for(var a=0;a>4,i=(15&r)<<4|(s=oCt[t.charCodeAt(h++)])>>2,n=(3&s)<<6|(a=oCt[t.charCodeAt(h++)]),o.push(String.fromCharCode(e)),64!==s&&o.push(String.fromCharCode(i)),64!==a&&o.push(String.fromCharCode(n));return o.join("")},decodeAsArray:function(t,e){var i,n,r,s=this.decode(t),a=[];for(i=0,r=s.length/e;i=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a}},cCt=function(t){this.data=t,this.debug=!1,this.gpflags=void 0,this.files=0,this.unzipped=[],this.buf32k=new Array(32768),this.bIdx=0,this.modeZIP=!1,this.bytepos=0,this.bb=1,this.bits=0,this.nameBuf=[],this.fileout=void 0,this.literalTree=new Array(cCt.LITERALS),this.distanceTree=new Array(32),this.treepos=0,this.Places=null,this.len=0,this.fpos=new Array(17),this.fpos[0]=0,this.flens=void 0,this.fmax=void 0};cCt.gunzip=function(t){return t.constructor===Array||t.constructor,new cCt(t).gunzip()[0][0]},cCt.HufNode=function(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1},cCt.LITERALS=288,cCt.NAMEMAX=256,cCt.bitReverse=[0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255],cCt.cplens=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],cCt.cplext=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],cCt.cpdist=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],cCt.cpdext=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],cCt.border=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],cCt.prototype.gunzip=function(){return this.outputArr=[],this.nextFile(),this.unzipped},cCt.prototype.readByte=function(){return this.bits+=8,this.bytepos>=1,0===this.bb&&(this.bb=this.readByte(),t=1&this.bb,this.bb=this.bb>>1|128),t},cCt.prototype.readBits=function(t){for(var e=0,i=t;i--;)e=e<<1|this.readBit();return t&&(e=cCt.bitReverse[e]>>8-t),e},cCt.prototype.flushBuffer=function(){this.bIdx=0},cCt.prototype.addBuffer=function(t){this.buf32k[this.bIdx++]=t,this.outputArr.push(String.fromCharCode(t)),32768===this.bIdx&&(this.bIdx=0)},cCt.prototype.IsPat=function(){for(;;){if(this.fpos[this.len]>=this.fmax)return-1;if(this.flens[this.fpos[this.len]]===this.len)return this.fpos[this.len]++;this.fpos[this.len]++}},cCt.prototype.Rec=function(){var t,e=this.Places[this.treepos];if(17===this.len)return-1;if(this.treepos++,this.len++,(t=this.IsPat())>=0)e.b0=t;else if(e.b0=32768,this.Rec())return-1;if((t=this.IsPat())>=0)e.b1=t,e.jump=null;else if(e.b1=32768,e.jump=this.Places[this.treepos],e.jumppos=this.treepos,this.Rec())return-1;return this.len--,0},cCt.prototype.CreateTree=function(t,e,i){var n;for(this.Places=t,this.treepos=0,this.flens=i,this.fmax=e,n=0;n<17;n++)this.fpos[n]=0;return this.len=0,this.Rec()?-1:0},cCt.prototype.DecodeValue=function(t){for(var e,i,n=0,r=t[n];;)if(this.readBit()){if(!(32768&r.b1))return r.b1;for(r=r.jump,e=t.length,i=0;i>1)>23?(a=a<<1|this.readBit())>199?a=(a-=128)<<1|this.readBit():(a-=48)>143&&(a+=136):a+=256,a<256)this.addBuffer(a);else{if(256===a)break;for(a-=257,_=this.readBits(cCt.cplext[a])+cCt.cplens[a],a=cCt.bitReverse[this.readBits(5)]>>3,cCt.cpdext[a]>8?(p=this.readBits(8),p|=this.readBits(cCt.cpdext[a]-8)<<8):p=this.readBits(cCt.cpdext[a]),p+=cCt.cpdist[a],a=0;a<_;a++){var s=this.buf32k[this.bIdx-p&32767];this.addBuffer(s)}}else if(2===e){var a,o,h,u,l,c=new Array(320);for(h=257+this.readBits(5),u=1+this.readBits(5),l=4+this.readBits(4),a=0;a<19;a++)c[a]=0;for(a=0;ao)return this.flushBuffer(),1;for(f=i?c[i-1]:0;a--;)c[i++]=f}else{if(i+(a=17===a?3+this.readBits(3):11+this.readBits(7))>o)return this.flushBuffer(),1;for(;a--;)c[i++]=0}for(_=this.literalTree.length,i=0;i<_;i++)this.literalTree[i]=new cCt.HufNode;if(this.CreateTree(this.literalTree,h,c,0))return this.flushBuffer(),1;for(_=this.literalTree.length,i=0;i<_;i++)this.distanceTree[i]=new cCt.HufNode;var d=new Array;for(i=h;i=256){var _,p;if(0==(a-=256))break;for(a--,_=this.readBits(cCt.cplext[a])+cCt.cplens[a],a=this.DecodeValue(this.distanceTree),cCt.cpdext[a]>8?(p=this.readBits(8),p|=this.readBits(cCt.cpdext[a]-8)<<8):p=this.readBits(cCt.cpdext[a]),p+=cCt.cpdist[a];_--;)s=this.buf32k[this.bIdx-p&32767],this.addBuffer(s)}else this.addBuffer(a)}}while(!t);return this.flushBuffer(),this.byteAlign(),0},cCt.prototype.unzipFile=function(t){var e;for(this.gunzip(),e=0;e=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a},lAt.unzipAsArray=function(t,e){e=e||1;var i,n,r,s=this.unzip(t),a=[];for(i=0,r=s.length/e;i=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a};var fAt,dAt,_At,pAt,mAt,gAt,vAt,yAt,bAt,SAt,xAt,wAt=parseInt,TAt=parseFloat,CAt=t("f1",(fCt=Qh("cc.ParticleSystem2D"),dCt=Eu(eCt),_Ct=Eu(KR),pCt=Eu(NTt),mCt=Eu(VTt),gCt=uu("preview"),fCt((uAt=function(t){function e(){var e;return(e=t.call(this)||this).duration=bCt&&bCt(),e.emissionRate=SCt&&SCt(),e.life=xCt&&xCt(),e.lifeVar=wCt&&wCt(),e.angle=TCt&&TCt(),e.angleVar=CCt&&CCt(),e.startSize=ACt&&ACt(),e.startSizeVar=DCt&&DCt(),e.endSize=ICt&&ICt(),e.endSizeVar=BCt&&BCt(),e.startSpin=MCt&&MCt(),e.startSpinVar=PCt&&PCt(),e.endSpin=ECt&&ECt(),e.endSpinVar=kCt&&kCt(),e.sourcePos=RCt&&RCt(),e.posVar=OCt&&OCt(),e.emitterMode=FCt&&FCt(),e.gravity=LCt&&LCt(),e.speed=VCt&&VCt(),e.speedVar=NCt&&NCt(),e.tangentialAccel=zCt&&zCt(),e.tangentialAccelVar=UCt&&UCt(),e.radialAccel=GCt&&GCt(),e.radialAccelVar=HCt&&HCt(),e.rotationIsDir=WCt&&WCt(),e.startRadius=jCt&&jCt(),e.startRadiusVar=qCt&&qCt(),e.endRadius=XCt&&XCt(),e.endRadiusVar=YCt&&YCt(),e.rotatePerS=QCt&&QCt(),e.rotatePerSVar=JCt&&JCt(),e.aspectRatio=1,e.playOnLoad=KCt&&KCt(),e.autoRemoveOnFinish=ZCt&&ZCt(),e._preview=$Ct&&$Ct(),e._custom=tAt&&tAt(),e._file=eAt&&eAt(),e._spriteFrame=iAt&&iAt(),e._totalParticles=nAt&&nAt(),e._startColor=rAt&&rAt(),e._startColorVar=sAt&&sAt(),e._endColor=aAt&&aAt(),e._endColorVar=oAt&&oAt(),e._positionType=hAt&&hAt(),e._stopped=!0,e._useFile=void 0,e.initProperties(),e._useFile=!1,e}s(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this._updateMaterial(),this._updatePositionType()},i.onDestroy=function(){t.prototype.onDestroy.call(this),this.autoRemoveOnFinish&&(this.autoRemoveOnFinish=!1),this._simulator.uvFilled=0,this.destroyRenderData()},i.initProperties=function(){this._previewTimer=null,this._focused=!1,this.aspectRatio=1,this._simulator=new $Tt(this)},i.onFocusInEditor=function(){this._focused=!0;for(var t=cAt(this.node),e=0;e=this.totalParticles},i._applyFile=function(){var t=this._file;if(t){if(!t)return void ht(6029);if(!this.isValid)return;this._plistFile=t.nativeUrl,this._custom||(this._spriteFrame!==t.spriteFrame&&(this.spriteFrame=t.spriteFrame),this._initWithDictionary(t._nativeAsset)),this._spriteFrame?!this._renderSpriteFrame&&this._spriteFrame&&this._applySpriteFrame():t.spriteFrame?this.spriteFrame=t.spriteFrame:this._custom&&this._initTextureWithDictionary(t._nativeAsset)}},i._initTextureWithDictionary=function(t){var e,i=this;if(t.spriteFrameUuid){var n=t.spriteFrameUuid;lT.loadAny(n,(function(e,n){e?(t.spriteFrameUuid=void 0,i._initTextureWithDictionary(t),Q(e)):i.spriteFrame=n}))}else{var r=Xo(this._plistFile,t.textureFileName||"");if(t.textureFileName)lT.loadRemote(r,(function(e,n){e?(t.textureFileName=void 0,i._initTextureWithDictionary(t),Q(e)):i.spriteFrame=n?KR.createWithImage(n):KR.createWithImage(_T.get("white-texture"))}));else if(t.textureImageData){var s=t.textureImageData;if(!(s&&s.length>0))return!1;var a=r;this.file&&(a+="-"+this.file.uuid);var o=lT.assets.get(a);if(!o){var h=lAt.unzipBase64AsArray(s,1);if(!h)return at(6030,this._file.name),!1;var u=(e=h).length>8&&137===e[0]&&80===e[1]&&78===e[2]&&71===e[3]&&13===e[4]&&10===e[5]&&26===e[6]&&10===e[7]?1:e.length>2&&(73===e[0]&&73===e[1]||77===e[0]&&77===e[1]||255===e[0]&&216===e[1])?2:10;if(2!==u&&1!==u)return at(6031,this._file.name),!1;var l=I.document.createElement("canvas");1===u?new iCt(h).render(l):(aCt.parseTIFF(h,l),aCt.reset()),o=new Gm(l),lT.assets.add(a,o)}o||at(6032,this._file.name),this.spriteFrame=o?KR.createWithImage(o):KR.createWithImage(_T.get("white-texture"))}}return!0},i._initWithDictionary=function(t){this._useFile=!0,this.totalParticles=wAt(t.maxParticles||0),this.life=TAt(t.particleLifespan||0),this.lifeVar=TAt(t.particleLifespanVariance||0);var e=t.emissionRate;this.emissionRate=e||Math.min(this.totalParticles/this.life,Number.MAX_VALUE),this.duration=TAt(t.duration||0),this._srcBlendFactor=wAt(t.blendFuncSource||2),this._dstBlendFactor=wAt(t.blendFuncDestination||4);var i=this._startColor;i.r=255*TAt(t.startColorRed||0),i.g=255*TAt(t.startColorGreen||0),i.b=255*TAt(t.startColorBlue||0),i.a=255*TAt(t.startColorAlpha||0);var n=this._startColorVar;n.r=255*TAt(t.startColorVarianceRed||0),n.g=255*TAt(t.startColorVarianceGreen||0),n.b=255*TAt(t.startColorVarianceBlue||0),n.a=255*TAt(t.startColorVarianceAlpha||0);var r=this._endColor;r.r=255*TAt(t.finishColorRed||0),r.g=255*TAt(t.finishColorGreen||0),r.b=255*TAt(t.finishColorBlue||0),r.a=255*TAt(t.finishColorAlpha||0);var s=this._endColorVar;if(s.r=255*TAt(t.finishColorVarianceRed||0),s.g=255*TAt(t.finishColorVarianceGreen||0),s.b=255*TAt(t.finishColorVarianceBlue||0),s.a=255*TAt(t.finishColorVarianceAlpha||0),this.startSize=TAt(t.startParticleSize||0),this.startSizeVar=TAt(t.startParticleSizeVariance||0),this.endSize=TAt(t.finishParticleSize||0),this.endSizeVar=TAt(t.finishParticleSizeVariance||0),this.positionType=TAt(void 0!==t.positionType?t.positionType:NTt.FREE),this.sourcePos.set(0,0),this.posVar.set(TAt(t.sourcePositionVariancex||0),TAt(t.sourcePositionVariancey||0)),this.angle=TAt(t.angle||0),this.angleVar=TAt(t.angleVariance||0),this.startSpin=TAt(t.rotationStart||0),this.startSpinVar=TAt(t.rotationStartVariance||0),this.endSpin=TAt(t.rotationEnd||0),this.endSpinVar=TAt(t.rotationEndVariance||0),this.emitterMode=wAt(t.emitterType||VTt.GRAVITY),this.emitterMode===VTt.GRAVITY){this.gravity.set(TAt(t.gravityx||0),TAt(t.gravityy||0)),this.speed=TAt(t.speed||0),this.speedVar=TAt(t.speedVariance||0),this.radialAccel=TAt(t.radialAcceleration||0),this.radialAccelVar=TAt(t.radialAccelVariance||0),this.tangentialAccel=TAt(t.tangentialAcceleration||0),this.tangentialAccelVar=TAt(t.tangentialAccelVariance||0);var a=t.rotationIsDir||"";null!==a?(a=a.toString().toLowerCase(),this.rotationIsDir="true"===a||"1"===a):this.rotationIsDir=!1}else{if(this.emitterMode!==VTt.RADIUS)return at(6009),!1;this.startRadius=TAt(t.maxRadius||0),this.startRadiusVar=TAt(t.maxRadiusVariance||0),this.endRadius=TAt(t.minRadius||0),this.endRadiusVar=TAt(t.minRadiusVariance||0),this.rotatePerS=TAt(t.rotatePerSecond||0),this.rotatePerSVar=TAt(t.rotatePerSecondVariance||0)}return this._initTextureWithDictionary(t),!0},i._syncAspect=function(){if(this._renderSpriteFrame){var t=this._renderSpriteFrame.rect;this.aspectRatio=t.width/t.height}},i._applySpriteFrame=function(){this._renderSpriteFrame=this._renderSpriteFrame||this._spriteFrame,this._renderSpriteFrame?this._renderSpriteFrame.texture&&(this._simulator&&this._simulator.updateUVs(!0),this._syncAspect(),this._updateMaterial(),this._stopped=!1,this._markForUpdateRenderData()):this.resetSystem()},i._getTexture=function(){return this._renderSpriteFrame&&this._renderSpriteFrame.texture},i._updateMaterial=function(){if(this._customMaterial){this.setSharedMaterial(this._customMaterial,0);var t=this.getRenderMaterial(0).passes[0].blendState.targets[0];this._dstBlendFactor=t.blendDst,this._srcBlendFactor=t.blendSrc}var e=this.getMaterialInstance(0);e&&e.recompileShaders({USE_LOCAL:this._positionType!==NTt.FREE}),e&&e.passes.length>0&&this._updateBlendFunc()},i._finishedSimulation=function(){this.resetSystem(),this.stopSystem(),this._markForUpdateRenderData(),this.autoRemoveOnFinish&&this._stopped&&this.node.destroy()},i._canRender=function(){return t.prototype._canRender.call(this)&&!this._stopped&&null!==this._renderSpriteFrame&&void 0!==this._renderSpriteFrame},i._render=function(t){this._positionType===NTt.RELATIVE?t.commitComp(this,this._simulator.renderData,this._renderSpriteFrame,this._assembler,this.node.parent):this.positionType===NTt.GROUPED?t.commitComp(this,this._simulator.renderData,this._renderSpriteFrame,this._assembler,this.node):t.commitComp(this,this._simulator.renderData,this._renderSpriteFrame,this._assembler,null)},i._updatePositionType=function(){this._positionType===NTt.RELATIVE?(this._renderEntity.setRenderTransform(this.node.parent),this._renderEntity.setUseLocal(!0)):this.positionType===NTt.GROUPED?(this._renderEntity.setRenderTransform(this.node),this._renderEntity.setUseLocal(!0)):(this._renderEntity.setRenderTransform(null),this._renderEntity.setUseLocal(!1))},n(e,[{key:"custom",get:function(){return this._custom},set:function(t){this._custom!==t&&(this._custom=t,this._applyFile(),this._updateMaterial())}},{key:"file",get:function(){return this._file},set:function(t){this._file!==t&&(this._file=t,t?this._applyFile():this.custom=!0)}},{key:"spriteFrame",get:function(){return this._spriteFrame},set:function(t){this._renderSpriteFrame!==t&&(this._renderSpriteFrame=t,t&&!t._uuid||(this._spriteFrame=t),this._applySpriteFrame())}},{key:"particleCount",get:function(){return this._simulator.particles.length}},{key:"totalParticles",get:function(){return this._totalParticles},set:function(t){this._totalParticles!==t&&(this._totalParticles=t)}},{key:"startColor",get:function(){return this._startColor},set:function(t){this._startColor.r=t.r,this._startColor.g=t.g,this._startColor.b=t.b,this._startColor.a=t.a}},{key:"startColorVar",get:function(){return this._startColorVar},set:function(t){this._startColorVar.r=t.r,this._startColorVar.g=t.g,this._startColorVar.b=t.b,this._startColorVar.a=t.a}},{key:"color",get:function(){return this._color},set:function(){}},{key:"endColor",get:function(){return this._endColor},set:function(t){this._endColor.r=t.r,this._endColor.g=t.g,this._endColor.b=t.b,this._endColor.a=t.a}},{key:"endColorVar",get:function(){return this._endColorVar},set:function(t){this._endColorVar.r=t.r,this._endColorVar.g=t.g,this._endColorVar.b=t.b,this._endColorVar.a=t.a}},{key:"positionType",get:function(){return this._positionType},set:function(t){this._positionType=t,this._updateMaterial(),this._updatePositionType()}},{key:"preview",get:function(){return this._preview},set:function(t){t?this._startPreview():this._stopPreview(),this._preview=t}},{key:"stopped",get:function(){return this._stopped}},{key:"active",get:function(){return this._simulator.active}},{key:"assembler",get:function(){return this._assembler}}]),e}(xL),uAt.EmitterMode=VTt,uAt.PositionType=NTt,uAt.DURATION_INFINITY=-1,uAt.START_SIZE_EQUAL_TO_END_SIZE=-1,uAt.START_RADIUS_EQUAL_TO_END_RADIUS=-1,y((yCt=uAt).prototype,"file",[dCt],Object.getOwnPropertyDescriptor(yCt.prototype,"file"),yCt.prototype),y(yCt.prototype,"spriteFrame",[_Ct],Object.getOwnPropertyDescriptor(yCt.prototype,"spriteFrame"),yCt.prototype),bCt=Nh(yCt.prototype,"duration",[hu],(function(){return-1})),SCt=Nh(yCt.prototype,"emissionRate",[hu],(function(){return 10})),xCt=Nh(yCt.prototype,"life",[hu],(function(){return 1})),wCt=Nh(yCt.prototype,"lifeVar",[hu],(function(){return 0})),y(yCt.prototype,"color",[Uu],Object.getOwnPropertyDescriptor(yCt.prototype,"color"),yCt.prototype),TCt=Nh(yCt.prototype,"angle",[hu],(function(){return 90})),CCt=Nh(yCt.prototype,"angleVar",[hu],(function(){return 20})),ACt=Nh(yCt.prototype,"startSize",[hu],(function(){return 50})),DCt=Nh(yCt.prototype,"startSizeVar",[hu],(function(){return 0})),ICt=Nh(yCt.prototype,"endSize",[hu],(function(){return 0})),BCt=Nh(yCt.prototype,"endSizeVar",[hu],(function(){return 0})),MCt=Nh(yCt.prototype,"startSpin",[hu],(function(){return 0})),PCt=Nh(yCt.prototype,"startSpinVar",[hu],(function(){return 0})),ECt=Nh(yCt.prototype,"endSpin",[hu],(function(){return 0})),kCt=Nh(yCt.prototype,"endSpinVar",[hu],(function(){return 0})),RCt=Nh(yCt.prototype,"sourcePos",[hu],(function(){return ds.ZERO.clone()})),OCt=Nh(yCt.prototype,"posVar",[hu],(function(){return ds.ZERO.clone()})),y(yCt.prototype,"positionType",[pCt],Object.getOwnPropertyDescriptor(yCt.prototype,"positionType"),yCt.prototype),FCt=Nh(yCt.prototype,"emitterMode",[hu,mCt],(function(){return VTt.GRAVITY})),LCt=Nh(yCt.prototype,"gravity",[hu],(function(){return ds.ZERO.clone()})),VCt=Nh(yCt.prototype,"speed",[hu],(function(){return 180})),NCt=Nh(yCt.prototype,"speedVar",[hu],(function(){return 50})),zCt=Nh(yCt.prototype,"tangentialAccel",[hu],(function(){return 80})),UCt=Nh(yCt.prototype,"tangentialAccelVar",[hu],(function(){return 0})),GCt=Nh(yCt.prototype,"radialAccel",[hu],(function(){return 0})),HCt=Nh(yCt.prototype,"radialAccelVar",[hu],(function(){return 0})),WCt=Nh(yCt.prototype,"rotationIsDir",[hu],(function(){return!1})),jCt=Nh(yCt.prototype,"startRadius",[hu],(function(){return 0})),qCt=Nh(yCt.prototype,"startRadiusVar",[hu],(function(){return 0})),XCt=Nh(yCt.prototype,"endRadius",[hu],(function(){return 0})),YCt=Nh(yCt.prototype,"endRadiusVar",[hu],(function(){return 0})),QCt=Nh(yCt.prototype,"rotatePerS",[hu],(function(){return 0})),JCt=Nh(yCt.prototype,"rotatePerSVar",[hu],(function(){return 0})),KCt=Nh(yCt.prototype,"playOnLoad",[hu],(function(){return!0})),ZCt=Nh(yCt.prototype,"autoRemoveOnFinish",[hu],(function(){return!1})),$Ct=Nh(yCt.prototype,"_preview",[gCt],(function(){return!0})),tAt=Nh(yCt.prototype,"_custom",[hu],(function(){return!1})),eAt=Nh(yCt.prototype,"_file",[hu],(function(){return null})),iAt=Nh(yCt.prototype,"_spriteFrame",[hu],(function(){return null})),nAt=Nh(yCt.prototype,"_totalParticles",[hu],(function(){return 150})),rAt=Nh(yCt.prototype,"_startColor",[hu],(function(){return new cr(255,255,255,255)})),sAt=Nh(yCt.prototype,"_startColorVar",[hu],(function(){return new cr(0,0,0,0)})),aAt=Nh(yCt.prototype,"_endColor",[hu],(function(){return new cr(255,255,255,0)})),oAt=Nh(yCt.prototype,"_endColorVar",[hu],(function(){return new cr(0,0,0,0)})),hAt=Nh(yCt.prototype,"_positionType",[hu],(function(){return NTt.FREE})),vCt=yCt))||vCt)),AAt=function(){function t(t,e){this.point=new ds,this.dir=new ds,this.distance=0,this.time=0,t&&this.point.set(t),e&&this.dir.set(e)}var e=t.prototype;return e.setPoint=function(t,e){this.point.x=t,this.point.y=e},e.setDir=function(t,e){this.dir.x=t,this.dir.y=e},t}(),DAt=t("f2",(fAt=Qh("cc.MotionStreak"),dAt=Eu(Pv),fAt((xAt=function(t){function e(){var e;return(e=t.call(this)||this)._preview=mAt&&mAt(),e._fadeTime=gAt&&gAt(),e._minSeg=vAt&&vAt(),e._stroke=yAt&&yAt(),e._texture=bAt&&bAt(),e._fastMode=SAt&&SAt(),e._points=[],e}s(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this.reset()},i._flushAssembler=function(){var t=e.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t),this._renderData||this._assembler&&this._assembler.createData&&(this._renderData=this._assembler.createData(this),this._renderData.material=this.material,this._updateColor())},i.onFocusInEditor=function(){this._preview&&this.reset()},i.onLostFocusInEditor=function(){this._preview&&this.reset()},i.reset=function(){this._points.length=0,this._renderData&&this._renderData.clear()},i.lateUpdate=function(t){this._assembler&&this._assembler.update&&this._assembler.update(this,t)},i._render=function(t){t.commitComp(this,this._renderData,this._texture,this._assembler,null)},n(e,[{key:"preview",get:function(){return this._preview},set:function(t){this._preview=t,this.reset()}},{key:"fadeTime",get:function(){return this._fadeTime},set:function(t){this._fadeTime=t,this.reset()}},{key:"minSeg",get:function(){return this._minSeg},set:function(t){this._minSeg=t}},{key:"stroke",get:function(){return this._stroke},set:function(t){this._stroke=t}},{key:"texture",get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture=t)}},{key:"fastMode",get:function(){return this._fastMode},set:function(t){this._fastMode=t}},{key:"points",get:function(){return this._points}}]),e}(xL),xAt.Point=AAt,y((pAt=xAt).prototype,"texture",[dAt],Object.getOwnPropertyDescriptor(pAt.prototype,"texture"),pAt.prototype),mAt=Nh(pAt.prototype,"_preview",[hu],(function(){return!1})),gAt=Nh(pAt.prototype,"_fadeTime",[hu],(function(){return 1})),vAt=Nh(pAt.prototype,"_minSeg",[hu],(function(){return 1})),yAt=Nh(pAt.prototype,"_stroke",[hu],(function(){return 64})),bAt=Nh(pAt.prototype,"_texture",[hu],(function(){return null})),SAt=Nh(pAt.prototype,"_fastMode",[hu],(function(){return!1})),_At=pAt))||_At)),IAt=new ds,BAt=new ds,MAt=null;function PAt(t,e){return t.x=-e.y,t.y=e.x,t}var EAt=function(){function t(){}var e=t.prototype;return e.createData=function(t){var e=t.requestRenderData();return e.dataLength=4,e.resize(16,42),e},e.update=function(t,e){var i,n=t.stroke/2,r=t.node.worldMatrix,s=r.m12,a=r.m13,o=t.points;if(o.length>1){var h=o[0],u=h.point.x-s,l=h.point.y-a;u*u+l*l=0;w--){var T=o[w],C=T.point,A=T.dir;if(T.time-=e,T.time<0)o.splice(w,1);else{var D=T.time/S,I=o[w-1];if(!x){if(!I){o.splice(w,1);continue}C.x=I.point.x-A.x*D,C.y=I.point.y-A.y*D}x=!0,PAt(IAt,A);var B=D*v,M=f;b[M].x=C.x+IAt.x*n,b[M].y=C.y+IAt.y*n,b[M].u=1,b[M].v=D,b[M].color.set(p,m,g,B),b[M+=1].x=C.x-IAt.x*n,b[M].y=C.y-IAt.y*n,b[M].u=0,b[M].v=D,b[M].color.set(p,m,g,B),f+=2}}c=f<=2?0:3*(f-2),d.resize(f,c)}},e.updateWorldVertexAllData=function(t){for(var e=t.renderData,i=e.floatStride,n=e.data,r=e.chunk.vb,s=0;se?t:e}function R(t,e,i){return ti?i:t}var O=isFinite;function F(t){return t*t}function L(t){return 1/Math.sqrt(t)}var V=Math.sqrt,N=Math.pow;var z=Math.cos,U=Math.sin,G=Math.acos,H=Math.asin,W=Math.atan2;var j=function(){function t(){for(var t=arguments.length,e=new Array(t),i=0;i=r){var e=1/t;this.x*=e,this.y*=e}return t},e.SelfNormalize=function(){var t=this.Length();if(t>=r){var e=1/t;this.x*=e,this.y*=e}return this},e.SelfRotate=function(t){var e=Math.cos(t),i=Math.sin(t),n=this.x;return this.x=e*n-i*this.y,this.y=i*n+e*this.y,this},e.SelfRotateCosSin=function(t,e){var i=this.x;return this.x=t*i-e*this.y,this.y=e*i+t*this.y,this},e.IsValid=function(){return isFinite(this.x)&&isFinite(this.y)},e.SelfCrossVS=function(t){var e=this.x;return this.x=t*this.y,this.y=-t*e,this},e.SelfCrossSV=function(t){var e=this.x;return this.x=-t*this.y,this.y=t*e,this},e.SelfMinV=function(t){return this.x=E(this.x,t.x),this.y=E(this.y,t.y),this},e.SelfMaxV=function(t){return this.x=k(this.x,t.x),this.y=k(this.y,t.y),this},e.SelfAbs=function(){return this.x=P(this.x),this.y=P(this.y),this},e.SelfNeg=function(){return this.x=-this.x,this.y=-this.y,this},e.SelfSkew=function(){var t=this.x;return this.x=-this.y,this.y=t,this},t.MakeArray=function(e){return A(e,(function(){return new t}))},t.AbsV=function(t,e){return e.x=P(t.x),e.y=P(t.y),e},t.MinV=function(t,e,i){return i.x=E(t.x,e.x),i.y=E(t.y,e.y),i},t.MaxV=function(t,e,i){return i.x=k(t.x,e.x),i.y=k(t.y,e.y),i},t.ClampV=function(t,e,i,n){return n.x=R(t.x,e.x,i.x),n.y=R(t.y,e.y,i.y),n},t.RotateV=function(t,e,i){var n=t.x,r=t.y,s=Math.cos(e),a=Math.sin(e);return i.x=s*n-a*r,i.y=a*n+s*r,i},t.DotVV=function(t,e){return t.x*e.x+t.y*e.y},t.CrossVV=function(t,e){return t.x*e.y-t.y*e.x},t.CrossVS=function(t,e,i){var n=t.x;return i.x=e*t.y,i.y=-e*n,i},t.CrossVOne=function(t,e){var i=t.x;return e.x=t.y,e.y=-i,e},t.CrossSV=function(t,e,i){var n=e.x;return i.x=-t*e.y,i.y=t*n,i},t.CrossOneV=function(t,e){var i=t.x;return e.x=-t.y,e.y=i,e},t.AddVV=function(t,e,i){return i.x=t.x+e.x,i.y=t.y+e.y,i},t.SubVV=function(t,e,i){return i.x=t.x-e.x,i.y=t.y-e.y,i},t.MulSV=function(t,e,i){return i.x=e.x*t,i.y=e.y*t,i},t.MulVS=function(t,e,i){return i.x=t.x*e,i.y=t.y*e,i},t.AddVMulSV=function(t,e,i,n){return n.x=t.x+e*i.x,n.y=t.y+e*i.y,n},t.SubVMulSV=function(t,e,i,n){return n.x=t.x-e*i.x,n.y=t.y-e*i.y,n},t.AddVCrossSV=function(t,e,i,n){var r=i.x;return n.x=t.x-e*i.y,n.y=t.y+e*r,n},t.MidVV=function(t,e,i){return i.x=.5*(t.x+e.x),i.y=.5*(t.y+e.y),i},t.ExtVV=function(t,e,i){return i.x=.5*(e.x-t.x),i.y=.5*(e.y-t.y),i},t.IsEqualToV=function(t,e){return t.x===e.x&&t.y===e.y},t.DistanceVV=function(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)},t.DistanceSquaredVV=function(t,e){var i=t.x-e.x,n=t.y-e.y;return i*i+n*n},t.NegV=function(t,e){return e.x=-t.x,e.y=-t.y,e},n(t,[{key:"x",get:function(){return this.data[0]},set:function(t){this.data[0]=t}},{key:"y",get:function(){return this.data[1]},set:function(t){this.data[1]=t}}]),t}();j.ZERO=new j(0,0),j.UNITX=new j(1,0),j.UNITY=new j(0,1),j.s_t0=new j,j.s_t1=new j,j.s_t2=new j,j.s_t3=new j;var q=new j(0,0),X=function(){function t(){for(var t=arguments.length,e=new Array(t),i=0;ithis.m_count&&(this.m_min_count=this.m_count)},t}(),rt=function(){function t(t){this.m_stack=[],this.m_count=0,this.m_stack=A(t,(function(){return null})),this.m_count=0}var e=t.prototype;return e.Reset=function(){return this.m_count=0,this},e.Push=function(t){this.m_stack[this.m_count]=t,this.m_count++},e.Pop=function(){this.m_count--;var t=this.m_stack[this.m_count];if(this.m_stack[this.m_count]=null,null===t)throw new Error;return t},e.GetCount=function(){return this.m_count},t}(),st=function(){function t(){this.m_buffer=j.MakeArray(2),this.m_vertices=this.m_buffer,this.m_count=0,this.m_radius=0}var e=t.prototype;return e.Copy=function(t){return t.m_vertices===t.m_buffer?(this.m_vertices=this.m_buffer,this.m_buffer[0].Copy(t.m_buffer[0]),this.m_buffer[1].Copy(t.m_buffer[1])):this.m_vertices=t.m_vertices,this.m_count=t.m_count,this.m_radius=t.m_radius,this},e.Reset=function(){return this.m_vertices=this.m_buffer,this.m_count=0,this.m_radius=0,this},e.SetShape=function(t,e){t.SetupDistanceProxy(this,e)},e.SetVerticesRadius=function(t,e,i){this.m_vertices=t,this.m_count=e,this.m_radius=i},e.GetSupport=function(t){for(var e=0,i=j.DotVV(this.m_vertices[0],t),n=1;ni&&(e=n,i=r)}return e},e.GetSupportVertex=function(t){for(var e=0,i=j.DotVV(this.m_vertices[0],t),n=1;ni&&(e=n,i=r)}return this.m_vertices[e]},e.GetVertexCount=function(){return this.m_count},e.GetVertex=function(t){return this.m_vertices[t]},t}(),at=function(){function t(){this.metric=0,this.count=0,this.indexA=[0,0,0],this.indexB=[0,0,0]}return t.prototype.Reset=function(){return this.metric=0,this.count=0,this},t}(),ot=function(){function t(){this.proxyA=new st,this.proxyB=new st,this.transformA=new K,this.transformB=new K,this.useRadii=!1}return t.prototype.Reset=function(){return this.proxyA.Reset(),this.proxyB.Reset(),this.transformA.SetIdentity(),this.transformB.SetIdentity(),this.useRadii=!1,this},t}(),ht=function(){function t(){this.pointA=new j,this.pointB=new j,this.distance=0,this.iterations=0}return t.prototype.Reset=function(){return this.pointA.SetZero(),this.pointB.SetZero(),this.distance=0,this.iterations=0,this},t}();t.b2_gjkCalls=0,t.b2_gjkIters=0,t.b2_gjkMaxIters=0;var ut=function(){function t(){this.wA=new j,this.wB=new j,this.w=new j,this.a=0,this.indexA=0,this.indexB=0}return t.prototype.Copy=function(t){return this.wA.Copy(t.wA),this.wB.Copy(t.wB),this.w.Copy(t.w),this.a=t.a,this.indexA=t.indexA,this.indexB=t.indexB,this},t}(),lt=function(){function t(){this.m_v1=new ut,this.m_v2=new ut,this.m_v3=new ut,this.m_vertices=[],this.m_count=0,this.m_vertices[0]=this.m_v1,this.m_vertices[1]=this.m_v2,this.m_vertices[2]=this.m_v3}var e=t.prototype;return e.ReadCache=function(t,e,i,n,s){this.m_count=t.count;for(var a=this.m_vertices,o=0;o1){var c=t.metric,f=this.GetMetric();(f<.5*c||2*c0?j.CrossOneV(e,t):j.CrossVOne(e,t);default:return t.SetZero()}},e.GetClosestPoint=function(t){switch(this.m_count){case 0:case 3:default:return t.SetZero();case 1:return t.Copy(this.m_v1.w);case 2:return t.Set(this.m_v1.a*this.m_v1.w.x+this.m_v2.a*this.m_v2.w.x,this.m_v1.a*this.m_v1.w.y+this.m_v2.a*this.m_v2.w.y)}},e.GetWitnessPoints=function(t,e){switch(this.m_count){case 0:break;case 1:t.Copy(this.m_v1.wA),e.Copy(this.m_v1.wB);break;case 2:t.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x,t.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y,e.x=this.m_v1.a*this.m_v1.wB.x+this.m_v2.a*this.m_v2.wB.x,e.y=this.m_v1.a*this.m_v1.wB.y+this.m_v2.a*this.m_v2.wB.y;break;case 3:e.x=t.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x+this.m_v3.a*this.m_v3.wA.x,e.y=t.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y+this.m_v3.a*this.m_v3.wA.y}},e.GetMetric=function(){switch(this.m_count){case 0:case 1:default:return 0;case 2:return j.DistanceVV(this.m_v1.w,this.m_v2.w);case 3:return j.CrossVV(j.SubVV(this.m_v2.w,this.m_v1.w,j.s_t0),j.SubVV(this.m_v3.w,this.m_v1.w,j.s_t1))}},e.Solve2=function(){var e=this.m_v1.w,i=this.m_v2.w,n=j.SubVV(i,e,t.s_e12),r=-j.DotVV(e,n);if(r<=0)return this.m_v1.a=1,void(this.m_count=1);var s=j.DotVV(i,n);if(s<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v2);var a=1/(s+r);this.m_v1.a=s*a,this.m_v2.a=r*a,this.m_count=2},e.Solve3=function(){var e=this.m_v1.w,i=this.m_v2.w,n=this.m_v3.w,r=j.SubVV(i,e,t.s_e12),s=j.DotVV(e,r),a=j.DotVV(i,r),o=-s,h=j.SubVV(n,e,t.s_e13),u=j.DotVV(e,h),l=j.DotVV(n,h),c=-u,f=j.SubVV(n,i,t.s_e23),d=j.DotVV(i,f),_=j.DotVV(n,f),p=-d,m=j.CrossVV(r,h),g=m*j.CrossVV(i,n),v=m*j.CrossVV(n,e),y=m*j.CrossVV(e,i);if(o<=0&&c<=0)return this.m_v1.a=1,void(this.m_count=1);if(a>0&&o>0&&y<=0){var b=1/(a+o);return this.m_v1.a=a*b,this.m_v2.a=o*b,void(this.m_count=2)}if(l>0&&c>0&&v<=0){var S=1/(l+c);return this.m_v1.a=l*S,this.m_v3.a=c*S,this.m_count=2,void this.m_v2.Copy(this.m_v3)}if(a<=0&&p<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v2);if(l<=0&&_<=0)return this.m_v3.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v3);if(_>0&&p>0&&g<=0){var x=1/(_+p);return this.m_v2.a=_*x,this.m_v3.a=p*x,this.m_count=2,void this.m_v1.Copy(this.m_v3)}var w=1/(g+v+y);this.m_v1.a=g*w,this.m_v2.a=v*w,this.m_v3.a=y*w,this.m_count=3},t}();lt.s_e12=new j,lt.s_e13=new j,lt.s_e23=new j;var ct=new lt,ft=[0,0,0],dt=[0,0,0],_t=new j,pt=new j,mt=new j,gt=new j,vt=new j;function yt(e,i,n){++t.b2_gjkCalls;var s=n.proxyA,o=n.proxyB,h=n.transformA,u=n.transformB,l=ct;l.ReadCache(i,s,h,o,u);for(var c=l.m_vertices,f=ft,d=dt,_=0,p=0;p<20;){_=l.m_count;for(var m=0;m<_;++m)f[m]=c[m].indexA,d[m]=c[m].indexB;switch(l.m_count){case 1:break;case 2:l.Solve2();break;case 3:l.Solve3()}if(3===l.m_count)break;var g=l.GetSearchDirection(pt);if(g.LengthSquared()S+x&&e.distance>r){e.distance-=S+x;var w=j.SubVV(e.pointB,e.pointA,mt);w.Normalize(),e.pointA.SelfMulAdd(S,w),e.pointB.SelfMulSub(x,w)}else{var T=j.MidVV(e.pointA,e.pointB,_t);e.pointA.Copy(T),e.pointB.Copy(T),e.distance=0}}}var bt,St=new j,xt=new lt,wt=new j,Tt=new j,Ct=new j,At=new j,Dt=new j,It=new j;(bt=t.b2ContactFeatureType||(t.b2ContactFeatureType={}))[bt.e_vertex=0]="e_vertex",bt[bt.e_face=1]="e_face";var Bt,Mt=function(){function t(){this._key=0,this._key_invalid=!1,this._indexA=0,this._indexB=0,this._typeA=0,this._typeB=0}return n(t,[{key:"key",get:function(){return this._key_invalid&&(this._key_invalid=!1,this._key=this._indexA|this._indexB<<8|this._typeA<<16|this._typeB<<24),this._key},set:function(t){this._key=t,this._key_invalid=!1,this._indexA=255&this._key,this._indexB=this._key>>8&255,this._typeA=this._key>>16&255,this._typeB=this._key>>24&255}},{key:"indexA",get:function(){return this._indexA},set:function(t){this._indexA=t,this._key_invalid=!0}},{key:"indexB",get:function(){return this._indexB},set:function(t){this._indexB=t,this._key_invalid=!0}},{key:"typeA",get:function(){return this._typeA},set:function(t){this._typeA=t,this._key_invalid=!0}},{key:"typeB",get:function(){return this._typeB},set:function(t){this._typeB=t,this._key_invalid=!0}}]),t}(),Pt=function(){function t(){this.cf=new Mt}var e=t.prototype;return e.Copy=function(t){return this.key=t.key,this},e.Clone=function(){return(new t).Copy(this)},n(t,[{key:"key",get:function(){return this.cf.key},set:function(t){this.cf.key=t}}]),t}(),Et=function(){function t(){this.localPoint=new j,this.normalImpulse=0,this.tangentImpulse=0,this.id=new Pt}t.MakeArray=function(e){return A(e,(function(){return new t}))};var e=t.prototype;return e.Reset=function(){this.localPoint.SetZero(),this.normalImpulse=0,this.tangentImpulse=0,this.id.key=0},e.Copy=function(t){return this.localPoint.Copy(t.localPoint),this.normalImpulse=t.normalImpulse,this.tangentImpulse=t.tangentImpulse,this.id.Copy(t.id),this},t}();(Bt=t.b2ManifoldType||(t.b2ManifoldType={}))[Bt.e_unknown=-1]="e_unknown",Bt[Bt.e_circles=0]="e_circles",Bt[Bt.e_faceA=1]="e_faceA",Bt[Bt.e_faceB=2]="e_faceB";var kt,Rt=function(){function e(){this.points=Et.MakeArray(2),this.localNormal=new j,this.localPoint=new j,this.type=t.b2ManifoldType.e_unknown,this.pointCount=0}var i=e.prototype;return i.Reset=function(){for(var e=0;e<2;++e)this.points[e].Reset();this.localNormal.SetZero(),this.localPoint.SetZero(),this.type=t.b2ManifoldType.e_unknown,this.pointCount=0},i.Copy=function(t){this.pointCount=t.pointCount;for(var e=0;e<2;++e)this.points[e].Copy(t.points[e]);return this.localNormal.Copy(t.localNormal),this.localPoint.Copy(t.localPoint),this.type=t.type,this},i.Clone=function(){return(new e).Copy(this)},e}(),Ot=function(){function e(){this.normal=new j,this.points=j.MakeArray(2),this.separations=D(2)}return e.prototype.Initialize=function(i,n,r,s,o){if(0!==i.pointCount)switch(i.type){case t.b2ManifoldType.e_circles:this.normal.Set(1,0);var h=K.MulXV(n,i.localPoint,e.Initialize_s_pointA),u=K.MulXV(s,i.points[0].localPoint,e.Initialize_s_pointB);j.DistanceSquaredVV(h,u)>a&&j.SubVV(u,h,this.normal).SelfNormalize();var l=j.AddVMulSV(h,r,this.normal,e.Initialize_s_cA),c=j.SubVMulSV(u,o,this.normal,e.Initialize_s_cB);j.MidVV(l,c,this.points[0]),this.separations[0]=j.DotVV(j.SubVV(c,l,j.s_t0),this.normal);break;case t.b2ManifoldType.e_faceA:J.MulRV(n.q,i.localNormal,this.normal);for(var f=K.MulXV(n,i.localPoint,e.Initialize_s_planePoint),d=0;dp){var g=_;_=p,p=g,m=1}if(_>n&&(f.x=m,f.y=0,n=_),n>(s=E(s,p)))return!1}if(cb){var x=y;y=b,b=x,S=1}if(y>n&&(f.x=0,f.y=S,n=y),n>(s=E(s,b)))return!1}return!(n<0||e.maxFraction0;){var n=i.Pop();if(null!==n&&n.aabb.TestOverlap(t))if(n.IsLeaf()){if(!e(n))return}else i.Push(n.child1),i.Push(n.child2)}},e.QueryPoint=function(t,e){var i=this.m_stack.Reset();for(i.Push(this.m_root);i.GetCount()>0;){var n=i.Pop();if(null!==n&&n.aabb.TestContain(t))if(n.IsLeaf()){if(!e(n))return}else i.Push(n.child1),i.Push(n.child2)}},e.RayCast=function(e,i){var n=e.p1,r=e.p2,s=j.SubVV(r,n,t.s_r);s.Normalize();var a=j.CrossOneV(s,t.s_v),o=j.AbsV(a,t.s_abs_v),h=e.maxFraction,u=t.s_segmentAABB,l=n.x+h*(r.x-n.x),c=n.y+h*(r.y-n.y);u.lowerBound.x=E(n.x,l),u.lowerBound.y=E(n.y,c),u.upperBound.x=k(n.x,l),u.upperBound.y=k(n.y,c);var f=this.m_stack.Reset();for(f.Push(this.m_root);f.GetCount()>0;){var d=f.Pop();if(null!==d&&zt(d.aabb,u)){var _=d.aabb.GetCenter(),p=d.aabb.GetExtents();if(!(P(j.DotVV(a,j.SubVV(n,_,j.s_t0)))-j.DotVV(o,p)>0))if(d.IsLeaf()){var m=t.s_subInput;m.p1.Copy(e.p1),m.p2.Copy(e.p2),m.maxFraction=h;var g=i(m,d);if(0===g)return;g>0&&(h=g,l=n.x+h*(r.x-n.x),c=n.y+h*(r.y-n.y),u.lowerBound.x=E(n.x,l),u.lowerBound.y=E(n.y,c),u.upperBound.x=k(n.x,l),u.upperBound.y=k(n.y,c))}else f.Push(d.child1),f.Push(d.child2)}}},e.AllocateNode=function(){if(null!==this.m_freeList){var e=this.m_freeList;return this.m_freeList=e.parent,e.parent=null,e.child1=null,e.child2=null,e.height=0,e}return new Xt(t.s_node_id++)},e.FreeNode=function(t){t.parent=this.m_freeList,t.child1=null,t.child2=null,t.height=-1,t.Reset(),this.m_freeList=t},e.CreateProxy=function(t,e){var i=this.AllocateNode();return i.aabb.lowerBound.x=t.lowerBound.x-.1,i.aabb.lowerBound.y=t.lowerBound.y-.1,i.aabb.upperBound.x=t.upperBound.x+.1,i.aabb.upperBound.y=t.upperBound.y+.1,i.userData=e,i.height=0,this.InsertLeaf(i),i},e.DestroyProxy=function(t){this.RemoveLeaf(t),this.FreeNode(t)},e.MoveProxy=function(t,e,i){if(t.aabb.Contains(e))return!1;this.RemoveLeaf(t);t.aabb.lowerBound.x=e.lowerBound.x-.1,t.aabb.lowerBound.y=e.lowerBound.y-.1,t.aabb.upperBound.x=e.upperBound.x+.1,t.aabb.upperBound.y=e.upperBound.y+.1;var n=2*i.x,r=2*i.y;return n<0?t.aabb.lowerBound.x+=n:t.aabb.upperBound.x+=n,r<0?t.aabb.lowerBound.y+=r:t.aabb.upperBound.y+=r,this.InsertLeaf(t),!0},e.InsertLeaf=function(e){if(++this.m_insertionCount,null===this.m_root)return this.m_root=e,void(this.m_root.parent=null);for(var i=e.aabb,n=this.m_root;!n.IsLeaf();){var r=qt(n.child1),s=qt(n.child2),a=n.aabb.GetPerimeter(),o=t.s_combinedAABB;o.Combine2(n.aabb,i);var h=o.GetPerimeter(),u=2*h,l=2*(h-a),c=void 0,f=t.s_aabb,d=void 0;r.IsLeaf()?(f.Combine2(i,r.aabb),c=f.GetPerimeter()+l):(f.Combine2(i,r.aabb),d=r.aabb.GetPerimeter(),c=f.GetPerimeter()-d+l);var _=void 0;if(s.IsLeaf()?(f.Combine2(i,s.aabb),_=f.GetPerimeter()+l):(f.Combine2(i,s.aabb),d=s.aabb.GetPerimeter(),_=f.GetPerimeter()-d+l),u1){var r=qt(i.child1),s=qt(i.child2);return i.child1=t,i.parent=t.parent,t.parent=i,null!==i.parent?i.parent.child1===t?i.parent.child1=i:i.parent.child2=i:this.m_root=i,r.height>s.height?(i.child2=r,t.child2=s,s.parent=t,t.aabb.Combine2(e.aabb,s.aabb),i.aabb.Combine2(t.aabb,r.aabb),t.height=1+k(e.height,s.height),i.height=1+k(t.height,r.height)):(i.child2=s,t.child2=r,r.parent=t,t.aabb.Combine2(e.aabb,r.aabb),i.aabb.Combine2(t.aabb,s.aabb),t.height=1+k(e.height,r.height),i.height=1+k(t.height,s.height)),i}if(n<-1){var a=qt(e.child1),o=qt(e.child2);return e.child1=t,e.parent=t.parent,t.parent=e,null!==e.parent?e.parent.child1===t?e.parent.child1=e:e.parent.child2=e:this.m_root=e,a.height>o.height?(e.child2=a,t.child1=o,o.parent=t,t.aabb.Combine2(i.aabb,o.aabb),e.aabb.Combine2(t.aabb,a.aabb),t.height=1+k(i.height,o.height),e.height=1+k(t.height,a.height)):(e.child2=o,t.child1=a,a.parent=t,t.aabb.Combine2(i.aabb,a.aabb),e.aabb.Combine2(t.aabb,o.aabb),t.height=1+k(i.height,a.height),e.height=1+k(t.height,o.height)),e}return t},e.GetHeight=function(){return null===this.m_root?0:this.m_root.height},t.GetAreaNode=function(e){if(null===e)return 0;if(e.IsLeaf())return 0;var i=e.aabb.GetPerimeter();return(i+=t.GetAreaNode(e.child1))+t.GetAreaNode(e.child2)},e.GetAreaRatio=function(){if(null===this.m_root)return 0;var e=this.m_root.aabb.GetPerimeter();return t.GetAreaNode(this.m_root)/e},t.ComputeHeightNode=function(e){return null===e||e.IsLeaf()?0:1+k(t.ComputeHeightNode(e.child1),t.ComputeHeightNode(e.child2))},e.ComputeHeight=function(){return t.ComputeHeightNode(this.m_root)},e.ValidateStructure=function(t){if(null!==t&&(this.m_root,!t.IsLeaf())){var e=qt(t.child1),i=qt(t.child2);this.ValidateStructure(e),this.ValidateStructure(i)}},e.ValidateMetrics=function(e){if(null!==e&&!e.IsLeaf()){var i=qt(e.child1),n=qt(e.child2);t.s_aabb.Combine2(i.aabb,n.aabb),this.ValidateMetrics(i),this.ValidateMetrics(n)}},e.Validate=function(){},t.GetMaxBalanceNode=function(t,e){if(null===t)return e;if(t.height<=1)return e;var i=qt(t.child1),n=qt(t.child2);return k(e,P(n.height-i.height))},e.GetMaxBalance=function(){return t.GetMaxBalanceNode(this.m_root,0)},e.RebuildBottomUp=function(){this.Validate()},t.ShiftOriginNode=function(e,i){if(null!==e&&!(e.height<=1)){var n=e.child1,r=e.child2;t.ShiftOriginNode(n,i),t.ShiftOriginNode(r,i),e.aabb.lowerBound.SelfSub(i),e.aabb.upperBound.SelfSub(i)}},e.ShiftOrigin=function(e){t.ShiftOriginNode(this.m_root,e)},t}();function Qt(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function Jt(t,e){return t=i)break;Qt(t,h,i)}}if(0===a)break;r=i,i=s[--a]}return t}Yt.s_r=new j,Yt.s_v=new j,Yt.s_abs_v=new j,Yt.s_segmentAABB=new Nt,Yt.s_subInput=new Lt,Yt.s_combinedAABB=new Nt,Yt.s_aabb=new Nt,Yt.s_node_id=0;var Zt=function(t,e){this.proxyA=t,this.proxyB=e},$t=function(){function t(){this.m_tree=new Yt,this.m_proxyCount=0,this.m_moveCount=0,this.m_moveBuffer=[],this.m_pairCount=0,this.m_pairBuffer=[]}var e=t.prototype;return e.CreateProxy=function(t,e){var i=this.m_tree.CreateProxy(t,e);return++this.m_proxyCount,this.BufferMove(i),i},e.DestroyProxy=function(t){this.UnBufferMove(t),--this.m_proxyCount,this.m_tree.DestroyProxy(t)},e.MoveProxy=function(t,e,i){this.m_tree.MoveProxy(t,e,i)&&this.BufferMove(t)},e.TouchProxy=function(t){this.BufferMove(t)},e.GetProxyCount=function(){return this.m_proxyCount},e.UpdatePairs=function(t){var e=this;this.m_pairCount=0;for(var i=function(){var t=e.m_moveBuffer[n];if(null===t)return 1;var i=t.aabb;e.m_tree.Query(i,(function(i){if(i.m_id===t.m_id)return!0;var n,r;if(i.m_idf+d){e.state=t.b2TOIOutputState.e_separated,e.t=u,x=!0;break}if(D>f-d){_=w;break}var I=S.Evaluate(C[0],A[0],_);if(If?(M=R,I=O):(E=R,D=O),50===B)break}if(t.b2_toiMaxRootIters=k(t.b2_toiMaxRootIters,B),++T===a)break}if(++p,++t.b2_toiIters,x)break;if(20===p){e.state=t.b2TOIOutputState.e_failed,e.t=_;break}}t.b2_toiMaxIters=k(t.b2_toiMaxIters,p);var F=n.GetMilliseconds();t.b2_toiMaxTime=k(t.b2_toiMaxTime,F),t.b2_toiTime+=F}var we=new j,Te=new j;function Ce(e,i,n,r,s){e.pointCount=0;var a=K.MulXV(n,i.m_p,we),o=K.MulXV(s,r.m_p,Te),h=j.DistanceSquaredVV(a,o),u=i.m_radius+r.m_radius;h>u*u||(e.type=t.b2ManifoldType.e_circles,e.localPoint.Copy(i.m_p),e.localNormal.SetZero(),e.pointCount=1,e.points[0].localPoint.Copy(r.m_p),e.points[0].id.key=0)}var Ae=new j,De=new j,Ie=new j;function Be(e,i,n,s,a){e.pointCount=0;for(var o=K.MulXV(a,s.m_p,Ae),h=K.MulTXV(n,o,De),u=0,l=-1e37,c=i.m_radius+s.m_radius,f=i.m_count,d=i.m_vertices,_=i.m_normals,p=0;pc)return;m>l&&(l=m,u=p)}var g=u,v=(g+1)%f,y=d[g],b=d[v];if(lc*c)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,j.SubVV(h,y,e.localNormal).SelfNormalize(),e.localPoint.Copy(y),e.points[0].localPoint.Copy(s.m_p),e.points[0].id.key=0}else if(x<=0){if(j.DistanceSquaredVV(h,b)>c*c)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,j.SubVV(h,b,e.localNormal).SelfNormalize(),e.localPoint.Copy(b),e.points[0].localPoint.Copy(s.m_p),e.points[0].id.key=0}else{var w=j.MidVV(y,b,Ie);if(j.DotVV(j.SubVV(h,w,j.s_t1),_[g])>c)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(_[g]).SelfNormalize(),e.localPoint.Copy(w),e.points[0].localPoint.Copy(s.m_p),e.points[0].id.key=0}}var Me=new j,Pe=new j,Ee=new j,ke=new j;function Re(t,e,n,r,s){for(var a=t.m_vertices,o=t.m_normals,h=r.m_count,u=r.m_vertices,l=J.MulRV(e.q,o[n],Me),c=J.MulTRV(s.q,l,Pe),f=0,d=i,_=0;_l&&(l=f,u=c)}var d=Re(e,i,u,n,r),_=(u+s-1)%s,p=Re(e,i,_,n,r),m=(u+1)%s,g=Re(e,i,m,n,r),v=0,y=0,b=0;if(p>d&&p>g)b=-1,v=_,y=p;else{if(!(g>d))return t[0]=u,d;b=1,v=m,y=g}for(;(d=Re(e,i,u=-1===b?(v+s-1)%s:(v+1)%s,n,r))>y;)v=u,y=d;return t[0]=v,y}var Ve=new j;function Ne(e,n,r,s,a,o){for(var h=n.m_normals,u=a.m_count,l=a.m_vertices,c=a.m_normals,f=J.MulTRV(o.q,J.MulRV(r.q,h[s],j.s_t0),Ve),d=0,_=i,p=0;pa)){var u=We;u[0]=0;var l=Le(u,r,s,i,n);if(!(l>a)){var c,f,d,_,p=0,m=0;l>.98*h+.001?(c=r,f=i,d=s,_=n,p=u[0],e.type=t.b2ManifoldType.e_faceB,m=1):(c=i,f=r,d=n,_=s,p=o[0],e.type=t.b2ManifoldType.e_faceA,m=0);var g=ze;Ne(g,c,d,p,f,_);var v=c.m_count,y=c.m_vertices,b=p,S=(p+1)%v,x=y[b],w=y[S],T=j.SubVV(w,x,je);T.Normalize();var C=j.CrossVOne(T,qe),A=j.MidVV(x,w,Xe),D=J.MulRV(d.q,T,Qe),I=j.CrossVOne(D,Ye),B=K.MulXV(d,x,Ke),M=K.MulXV(d,w,Ze),P=j.DotVV(I,B),E=-j.DotVV(D,B)+a,k=j.DotVV(D,M)+a,R=Ue,O=Ge;if(!(Ut(R,g,j.NegV(D,Je),E,b)<2||Ut(O,R,D,k,S)<2)){e.localNormal.Copy(C),e.localPoint.Copy(A);for(var F=0,L=0;L<2;++L){var V=O[L];if(j.DotVV(I,V.v)-P<=a){var N=e.points[F];if(K.MulTXV(_,V.v,N.localPoint),N.id.Copy(V.id),m){var z=N.id.cf;N.id.cf.indexA=z.indexB,N.id.cf.indexB=z.indexA,N.id.cf.typeA=z.typeB,N.id.cf.typeB=z.typeA}++F}}e.pointCount=F}}}}var ti,ei=new j,ii=new j,ni=new j,ri=new j,si=new j,ai=new j,oi=new j,hi=new Pt;function ui(e,i,n,r,s){e.pointCount=0;var a=K.MulTXV(n,K.MulXV(s,r.m_p,j.s_t0),ei),o=i.m_vertex1,h=i.m_vertex2,u=j.SubVV(h,o,ii),l=j.DotVV(u,j.SubVV(h,a,j.s_t0)),c=j.DotVV(u,j.SubVV(a,o,j.s_t0)),f=i.m_radius+r.m_radius,d=hi;if(d.cf.indexB=0,d.cf.typeB=t.b2ContactFeatureType.e_vertex,c<=0){var _=o,p=j.SubVV(a,_,ni);if(j.DotVV(p,p)>f*f)return;if(i.m_hasVertex0){var m=i.m_vertex0,g=o,v=j.SubVV(g,m,ri);if(j.DotVV(v,j.SubVV(g,a,j.s_t0))>0)return}return d.cf.indexA=0,d.cf.typeA=t.b2ContactFeatureType.e_vertex,e.pointCount=1,e.type=t.b2ManifoldType.e_circles,e.localNormal.SetZero(),e.localPoint.Copy(_),e.points[0].id.Copy(d),void e.points[0].localPoint.Copy(r.m_p)}if(l<=0){var y=h,b=j.SubVV(a,y,ni);if(j.DotVV(b,b)>f*f)return;if(i.m_hasVertex3){var S=i.m_vertex3,x=h,w=j.SubVV(S,x,si);if(j.DotVV(w,j.SubVV(a,x,j.s_t0))>0)return}return d.cf.indexA=1,d.cf.typeA=t.b2ContactFeatureType.e_vertex,e.pointCount=1,e.type=t.b2ManifoldType.e_circles,e.localNormal.SetZero(),e.localPoint.Copy(y),e.points[0].id.Copy(d),void e.points[0].localPoint.Copy(r.m_p)}var T=j.DotVV(u,u),C=ai;C.x=1/T*(l*o.x+c*h.x),C.y=1/T*(l*o.y+c*h.y);var A=j.SubVV(a,C,ni);if(!(j.DotVV(A,A)>f*f)){var D=oi.Set(-u.y,u.x);j.DotVV(D,j.SubVV(a,o,j.s_t0))<0&&D.Set(-D.x,-D.y),D.Normalize(),d.cf.indexA=0,d.cf.typeA=t.b2ContactFeatureType.e_face,e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(D),e.localPoint.Copy(o),e.points[0].id.Copy(d),e.points[0].localPoint.Copy(r.m_p)}}!function(t){t[t.e_unknown=0]="e_unknown",t[t.e_edgeA=1]="e_edgeA",t[t.e_edgeB=2]="e_edgeB"}(ti||(ti={}));var li,ci=function(){this.type=ti.e_unknown,this.index=0,this.separation=0},fi=function(){this.vertices=[],this.normals=[],this.count=0};!function(t){t[t.e_isolated=0]="e_isolated",t[t.e_concave=1]="e_concave",t[t.e_convex=2]="e_convex"}(li||(li={}));var di=function(){function e(){this.m_polygonB=new fi,this.m_xf=new K,this.m_centroidB=new j,this.m_v0=new j,this.m_v1=new j,this.m_v2=new j,this.m_v3=new j,this.m_normal0=new j,this.m_normal1=new j,this.m_normal2=new j,this.m_normal=new j,this.m_type1=li.e_isolated,this.m_type2=li.e_isolated,this.m_lowerLimit=new j,this.m_upperLimit=new j,this.m_radius=0,this.m_front=!1}var n=e.prototype;return n.Collide=function(i,n,r,s,a){K.MulTXX(r,a,this.m_xf),K.MulXV(this.m_xf,s.m_centroid,this.m_centroidB),this.m_v0.Copy(n.m_vertex0),this.m_v1.Copy(n.m_vertex1),this.m_v2.Copy(n.m_vertex2),this.m_v3.Copy(n.m_vertex3);var o=n.m_hasVertex0,h=n.m_hasVertex3,u=j.SubVV(this.m_v2,this.m_v1,e.s_edge1);u.Normalize(),this.m_normal1.Set(u.y,-u.x);var l=j.DotVV(this.m_normal1,j.SubVV(this.m_centroidB,this.m_v1,j.s_t0)),c=0,f=0,d=!1,_=!1;if(o){var p=j.SubVV(this.m_v1,this.m_v0,e.s_edge0);p.Normalize(),this.m_normal0.Set(p.y,-p.x),d=j.CrossVV(p,u)>=0,c=j.DotVV(this.m_normal0,j.SubVV(this.m_centroidB,this.m_v0,j.s_t0))}if(h){var m=j.SubVV(this.m_v3,this.m_v2,e.s_edge2);m.Normalize(),this.m_normal2.Set(m.y,-m.x),_=j.CrossVV(u,m)>0,f=j.DotVV(this.m_normal2,j.SubVV(this.m_centroidB,this.m_v2,j.s_t0))}o&&h?d&&_?(this.m_front=c>=0||l>=0||f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):d?(this.m_front=c>=0||l>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):_?(this.m_front=f>=0||c>=0&&l>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):(this.m_front=c>=0&&l>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):o?d?(this.m_front=c>=0||l>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):(this.m_front=c>=0&&l>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):h?_?(this.m_front=l>=0||f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1))):(this.m_front=l>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1))):(this.m_front=l>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1))),this.m_polygonB.count=s.m_count;for(var g=0;gthis.m_radius)){var y=this.ComputePolygonSeparation(e.s_polygonAxis);if(!(y.type!==ti.e_unknown&&y.separation>this.m_radius)){var b;b=y.type===ti.e_unknown?v:y.separation>.98*v.separation+.001?y:v;var S=e.s_ie,x=e.s_rf;if(b.type===ti.e_edgeA){i.type=t.b2ManifoldType.e_faceA;for(var w=0,T=j.DotVV(this.m_normal,this.m_polygonB.normals[0]),C=1;Cthis.m_radius)return i.type=ti.e_edgeB,i.index=r,i.separation=a,i;if(j.DotVV(s,n)>=0){if(j.DotVV(j.SubVV(s,this.m_upperLimit,j.s_t0),this.m_normal)<-.03490658503988889)continue}else if(j.DotVV(j.SubVV(s,this.m_lowerLimit,j.s_t0),this.m_normal)<-.03490658503988889)continue;a>i.separation&&(i.type=ti.e_edgeB,i.index=r,i.separation=a)}return i},e}();di.s_edge1=new j,di.s_edge0=new j,di.s_edge2=new j,di.s_ie=Ft.MakeArray(2),di.s_rf=new function(){this.i1=0,this.i2=0,this.v1=new j,this.v2=new j,this.normal=new j,this.sideNormal1=new j,this.sideOffset1=0,this.sideNormal2=new j,this.sideOffset2=0},di.s_clipPoints1=Ft.MakeArray(2),di.s_clipPoints2=Ft.MakeArray(2),di.s_edgeAxis=new ci,di.s_polygonAxis=new ci,di.s_n=new j,di.s_perp=new j;var _i=new di;function pi(t,e,i,n,r){_i.Collide(t,e,i,n,r)}var mi,gi=function(){this.mass=0,this.center=new j(0,0),this.I=0};(mi=t.b2ShapeType||(t.b2ShapeType={}))[mi.e_unknown=-1]="e_unknown",mi[mi.e_circleShape=0]="e_circleShape",mi[mi.e_edgeShape=1]="e_edgeShape",mi[mi.e_polygonShape=2]="e_polygonShape",mi[mi.e_chainShape=3]="e_chainShape",mi[mi.e_shapeTypeCount=4]="e_shapeTypeCount";var vi=function(){function e(e,i){this.m_type=t.b2ShapeType.e_unknown,this.m_radius=0,this.m_type=e,this.m_radius=i}var i=e.prototype;return i.Copy=function(t){return this.m_radius=t.m_radius,this},i.GetType=function(){return this.m_type},e}(),yi=function(e){function i(i){var n;return void 0===i&&(i=0),(n=e.call(this,t.b2ShapeType.e_circleShape,i)||this).m_p=new j,n}s(i,e);var n=i.prototype;return n.Set=function(t,e){return void 0===e&&(e=this.m_radius),this.m_p.Copy(t),this.m_radius=e,this},n.Clone=function(){return(new i).Copy(this)},n.Copy=function(t){return e.prototype.Copy.call(this,t),this.m_p.Copy(t.m_p),this},n.GetChildCount=function(){return 1},n.TestPoint=function(t,e){var n=K.MulXV(t,this.m_p,i.TestPoint_s_center),r=j.SubVV(e,n,i.TestPoint_s_d);return j.DotVV(r,r)<=F(this.m_radius)},n.ComputeDistance=function(t,e,n){var r=K.MulXV(t,this.m_p,i.ComputeDistance_s_center);return j.SubVV(e,r,n),n.Normalize()-this.m_radius},n.RayCast=function(t,e,n){var s=K.MulXV(n,this.m_p,i.RayCast_s_position),a=j.SubVV(e.p1,s,i.RayCast_s_s),o=j.DotVV(a,a)-F(this.m_radius),h=j.SubVV(e.p2,e.p1,i.RayCast_s_r),u=j.DotVV(a,h),l=j.DotVV(h,h),c=u*u-l*o;if(c<0||lthis.m_radius)return n.Copy(s),o*this.m_radius*this.m_radius;var h=this.m_radius*this.m_radius,u=a*a,l=h*(H(a/this.m_radius)+o/2)+a*V(h-u),c=-2/3*N(h-u,1.5)/l;return n.x=s.x+t.x*c,n.y=s.y+t.y*c,l},n.Dump=function(t){t(" const shape: b2CircleShape = new b2CircleShape();\n"),t(" shape.m_radius = %.15f;\n",this.m_radius),t(" shape.m_p.Set(%.15f, %.15f);\n",this.m_p.x,this.m_p.y)},i}(vi);yi.TestPoint_s_center=new j,yi.TestPoint_s_d=new j,yi.ComputeDistance_s_center=new j,yi.RayCast_s_position=new j,yi.RayCast_s_s=new j,yi.RayCast_s_r=new j,yi.ComputeAABB_s_p=new j;var bi=function(e){function i(){var i;return(i=e.call(this,t.b2ShapeType.e_polygonShape,f)||this).m_centroid=new j(0,0),i.m_vertices=[],i.m_normals=[],i.m_count=0,i}s(i,e);var n=i.prototype;return n.Clone=function(){return(new i).Copy(this)},n.Copy=function(t){e.prototype.Copy.call(this,t),this.m_centroid.Copy(t.m_centroid),this.m_count=t.m_count,this.m_vertices=j.MakeArray(this.m_count),this.m_normals=j.MakeArray(this.m_count);for(var i=0;il||f===l&&r[c].yv.LengthSquared()&&(m=g)}else m=g;if(++_,p=m,m===u)break}this.m_count=_,this.m_vertices=j.MakeArray(this.m_count),this.m_normals=j.MakeArray(this.m_count);for(var S=0;S<_;++S)this.m_vertices[S].Copy(r[d[S]]);for(var x=0;x<_;++x){var w=this.m_vertices[x],T=this.m_vertices[(x+1)%_],C=j.SubVV(T,w,j.s_t0);j.CrossVOne(C,this.m_normals[x]).SelfNormalize()}return i.ComputeCentroid(this.m_vertices,_,this.m_centroid),this},n.SetAsBox=function(t,e,i,n){if(void 0===n&&(n=0),this.m_count=4,this.m_vertices=j.MakeArray(this.m_count),this.m_normals=j.MakeArray(this.m_count),this.m_vertices[0].Set(-t,-e),this.m_vertices[1].Set(t,-e),this.m_vertices[2].Set(t,e),this.m_vertices[3].Set(-t,e),this.m_normals[0].Set(0,-1),this.m_normals[1].Set(1,0),this.m_normals[2].Set(0,1),this.m_normals[3].Set(-1,0),this.m_centroid.SetZero(),i){this.m_centroid.Copy(i);var r=new K;r.SetPosition(i),r.SetRotationAngle(n);for(var s=0;s0)return!1;return!0},n.ComputeDistance=function(t,e,n){for(var r=K.MulTXV(t,e,i.ComputeDistance_s_pLocal),s=-1e37,a=i.ComputeDistance_s_normalForMaxDistance.Copy(r),o=0;os&&(s=h,a.Copy(this.m_normals[o]))}if(s>0){for(var u=i.ComputeDistance_s_minDistance.Copy(a),l=s*s,c=0;cd&&(u.Copy(f),l=d)}return J.MulRV(t.q,u,n),n.Normalize(),Math.sqrt(l)}return J.MulRV(t.q,a,n),s},n.RayCast=function(t,e,n){for(var r=K.MulTXV(n,e.p1,i.RayCast_s_p1),s=K.MulTXV(n,e.p2,i.RayCast_s_p2),a=j.SubVV(s,r,i.RayCast_s_d),o=0,h=e.maxFraction,u=-1,l=0;l0&&c=0&&(t.fraction=o,J.MulRV(n.q,this.m_normals[u],t.normal),!0)},n.ComputeAABB=function(t,e){for(var n=K.MulXV(e,this.m_vertices[0],t.lowerBound),r=t.upperBound.Copy(n),s=0;s0&&(d?c||(u=f-1,h++):c&&(l=f-1,h++)),c=d}switch(h){case 0:if(c){var _=i.ComputeSubmergedArea_s_md;return this.ComputeMass(_,1),K.MulXV(n,_.center,r),_.mass}return 0;case 1:-1===u?u=this.m_count-1:l=this.m_count-1}for(var p,m=(u+1)%this.m_count,g=(l+1)%this.m_count,v=(0-o[u])/(o[m]-o[u]),y=(0-o[l])/(o[g]-o[l]),b=i.ComputeSubmergedArea_s_intoVec.Set(this.m_vertices[u].x*(1-v)+this.m_vertices[m].x*v,this.m_vertices[u].y*(1-v)+this.m_vertices[m].y*v),S=i.ComputeSubmergedArea_s_outoVec.Set(this.m_vertices[l].x*(1-y)+this.m_vertices[g].x*y,this.m_vertices[l].y*(1-y)+this.m_vertices[g].y*y),x=0,w=i.ComputeSubmergedArea_s_center.SetZero(),T=this.m_vertices[m],C=m;C!==g;){p=(C=(C+1)%this.m_count)===g?S:this.m_vertices[C];var A=.5*((T.x-b.x)*(p.y-b.y)-(T.y-b.y)*(p.x-b.x));x+=A,w.x+=A*(b.x+T.x+p.x)/3,w.y+=A*(b.y+T.y+p.y)/3,T=p}return w.SelfMul(1/x),K.MulXV(n,w,r),x},n.Dump=function(t){t(" const shape: b2PolygonShape = new b2PolygonShape();\n"),t(" const vs: b2Vec2[] = [];\n");for(var e=0;e0){var u=j.DotVV(o,o);h>u?j.SubVV(e,s,a):a.SelfMulSub(h/u,o)}return n.Copy(a),n.Normalize()},n.RayCast=function(t,e,n){var r=K.MulTXV(n,e.p1,i.RayCast_s_p1),s=K.MulTXV(n,e.p2,i.RayCast_s_p2),a=j.SubVV(s,r,i.RayCast_s_d),o=this.m_vertex1,h=this.m_vertex2,u=j.SubVV(h,o,i.RayCast_s_e),l=t.normal.Set(u.y,-u.x).SelfNormalize(),c=j.DotVV(l,j.SubVV(o,r,j.s_t0)),f=j.DotVV(l,a);if(0===f)return!1;var d=c/f;if(d<0||e.maxFraction0&&t.normal.SelfNeg(),0))},n.ComputeAABB=function(t,e){var n=K.MulXV(e,this.m_vertex1,i.ComputeAABB_s_v1),r=K.MulXV(e,this.m_vertex2,i.ComputeAABB_s_v2);j.MinV(n,r,t.lowerBound),j.MaxV(n,r,t.upperBound);var s=this.m_radius;t.lowerBound.SelfSubXY(s,s),t.upperBound.SelfAddXY(s,s)},n.ComputeMass=function(t){t.mass=0,j.MidVV(this.m_vertex1,this.m_vertex2,t.center),t.I=0},n.SetupDistanceProxy=function(t){t.m_vertices=t.m_buffer,t.m_vertices[0].Copy(this.m_vertex1),t.m_vertices[1].Copy(this.m_vertex2),t.m_count=2,t.m_radius=this.m_radius},n.ComputeSubmergedArea=function(t,e,i,n){return n.SetZero(),0},n.Dump=function(t){t(" const shape: b2EdgeShape = new b2EdgeShape();\n"),t(" shape.m_radius = %.15f;\n",this.m_radius),t(" shape.m_vertex0.Set(%.15f, %.15f);\n",this.m_vertex0.x,this.m_vertex0.y),t(" shape.m_vertex1.Set(%.15f, %.15f);\n",this.m_vertex1.x,this.m_vertex1.y),t(" shape.m_vertex2.Set(%.15f, %.15f);\n",this.m_vertex2.x,this.m_vertex2.y),t(" shape.m_vertex3.Set(%.15f, %.15f);\n",this.m_vertex3.x,this.m_vertex3.y),t(" shape.m_hasVertex0 = %s;\n",this.m_hasVertex0),t(" shape.m_hasVertex3 = %s;\n",this.m_hasVertex3)},i}(vi);Si.ComputeDistance_s_v1=new j,Si.ComputeDistance_s_v2=new j,Si.ComputeDistance_s_d=new j,Si.ComputeDistance_s_s=new j,Si.RayCast_s_p1=new j,Si.RayCast_s_p2=new j,Si.RayCast_s_d=new j,Si.RayCast_s_e=new j,Si.RayCast_s_q=new j,Si.RayCast_s_r=new j,Si.ComputeAABB_s_v1=new j,Si.ComputeAABB_s_v2=new j;var xi=function(e){function i(){var i;return(i=e.call(this,t.b2ShapeType.e_chainShape,f)||this).m_vertices=[],i.m_count=0,i.m_prevVertex=new j,i.m_nextVertex=new j,i.m_hasPrevVertex=!1,i.m_hasNextVertex=!1,i}s(i,e);var n=i.prototype;return n.CreateLoop=function(){for(var t=arguments.length,e=new Array(t),i=0;i0?(t.m_vertex0.Copy(this.m_vertices[e-1]),t.m_hasVertex0=!0):(t.m_vertex0.Copy(this.m_prevVertex),t.m_hasVertex0=this.m_hasPrevVertex),e0&&this.ResetMassData(),this.m_world.m_newFixture=!0,e},n.CreateFixtureShapeDensity=function(t,e){void 0===e&&(e=0);var n=i.CreateFixtureShapeDensity_s_def;return n.shape=t,n.density=e,this.CreateFixtureDef(n)},n.DestroyFixture=function(t){if(this.m_world.IsLocked())throw new Error;for(var e=this.m_fixtureList,i=null;null!==e;){if(e===t){i?i.m_next=t.m_next:this.m_fixtureList=t.m_next;break}i=e,e=e.m_next}for(var n=this.m_contactList;n;){var r=n.contact;n=n.next;var s=r.GetFixtureA(),a=r.GetFixtureB();t!==s&&t!==a||this.m_world.m_contactManager.Destroy(r)}this.m_activeFlag&&t.DestroyProxies(),t.m_next=null,t.Reset(),--this.m_fixtureCount,this.ResetMassData()},n.SetTransformVec=function(t,e){this.SetTransformXY(t.x,t.y,e)},n.SetTransformXY=function(t,e,i){if(this.m_world.IsLocked())throw new Error;this.m_xf.q.SetAngle(i),this.m_xf.p.Set(t,e),this.m_xf0.Copy(this.m_xf),K.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.a=i,this.m_sweep.c0.Copy(this.m_sweep.c),this.m_sweep.a0=i;for(var n=this.m_fixtureList;n;n=n.m_next)n.SynchronizeProxies(this.m_xf,this.m_xf,j.ZERO);this.m_world.m_contactManager.FindNewContacts()},n.SetTransform=function(t){this.SetTransformVec(t.p,t.GetAngle())},n.GetTransform=function(){return this.m_xf},n.GetPosition=function(){return this.m_xf.p},n.SetPosition=function(t){this.SetTransformVec(t,this.GetAngle())},n.SetPositionXY=function(t,e){this.SetTransformXY(t,e,this.GetAngle())},n.GetAngle=function(){return this.m_sweep.a},n.SetAngle=function(t){this.SetTransformVec(this.GetPosition(),t)},n.GetWorldCenter=function(){return this.m_sweep.c},n.GetLocalCenter=function(){return this.m_sweep.localCenter},n.SetLinearVelocity=function(e){this.m_type!==t.b2BodyType.b2_staticBody&&(j.DotVV(e,e)>0&&this.SetAwake(!0),this.m_linearVelocity.Copy(e))},n.GetLinearVelocity=function(){return this.m_linearVelocity},n.SetAngularVelocity=function(e){this.m_type!==t.b2BodyType.b2_staticBody&&(e*e>0&&this.SetAwake(!0),this.m_angularVelocity=e)},n.GetAngularVelocity=function(){return this.m_angularVelocity},n.GetDefinition=function(t){return t.type=this.GetType(),t.allowSleep=this.m_autoSleepFlag,t.angle=this.GetAngle(),t.angularDamping=this.m_angularDamping,t.gravityScale=this.m_gravityScale,t.angularVelocity=this.m_angularVelocity,t.fixedRotation=this.m_fixedRotationFlag,t.bullet=this.m_bulletFlag,t.awake=this.m_awakeFlag,t.linearDamping=this.m_linearDamping,t.linearVelocity.Copy(this.GetLinearVelocity()),t.position.Copy(this.GetPosition()),t.userData=this.GetUserData(),t},n.ApplyForce=function(e,i,n){void 0===n&&(n=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(n&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_force.x+=e.x,this.m_force.y+=e.y,this.m_torque+=(i.x-this.m_sweep.c.x)*e.y-(i.y-this.m_sweep.c.y)*e.x))},n.ApplyForceToCenter=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_force.x+=e.x,this.m_force.y+=e.y))},n.ApplyTorque=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_torque+=e))},n.ApplyLinearImpulse=function(e,i,n){void 0===n&&(n=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(n&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_linearVelocity.x+=this.m_invMass*e.x,this.m_linearVelocity.y+=this.m_invMass*e.y,this.m_angularVelocity+=this.m_invI*((i.x-this.m_sweep.c.x)*e.y-(i.y-this.m_sweep.c.y)*e.x)))},n.ApplyLinearImpulseToCenter=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_linearVelocity.x+=this.m_invMass*e.x,this.m_linearVelocity.y+=this.m_invMass*e.y))},n.ApplyAngularImpulse=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_angularVelocity+=this.m_invI*e))},n.GetMass=function(){return this.m_mass},n.GetInertia=function(){return this.m_I+this.m_mass*j.DotVV(this.m_sweep.localCenter,this.m_sweep.localCenter)},n.GetMassData=function(t){return t.mass=this.m_mass,t.I=this.m_I+this.m_mass*j.DotVV(this.m_sweep.localCenter,this.m_sweep.localCenter),t.center.Copy(this.m_sweep.localCenter),t},n.SetMassData=function(e){if(this.m_world.IsLocked())throw new Error;if(this.m_type===t.b2BodyType.b2_dynamicBody){this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_mass=e.mass,this.m_mass<=0&&(this.m_mass=1),this.m_invMass=1/this.m_mass,e.I>0&&!this.m_fixedRotationFlag&&(this.m_I=e.I-this.m_mass*j.DotVV(e.center,e.center),this.m_invI=1/this.m_I);var n=i.SetMassData_s_oldCenter.Copy(this.m_sweep.c);this.m_sweep.localCenter.Copy(e.center),K.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.c0.Copy(this.m_sweep.c),j.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,j.SubVV(this.m_sweep.c,n,j.s_t0),this.m_linearVelocity)}},n.ResetMassData=function(){if(this.m_mass=0,this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_sweep.localCenter.SetZero(),this.m_type===t.b2BodyType.b2_staticBody||this.m_type===t.b2BodyType.b2_kinematicBody)return this.m_sweep.c0.Copy(this.m_xf.p),this.m_sweep.c.Copy(this.m_xf.p),void(this.m_sweep.a0=this.m_sweep.a);for(var e=i.ResetMassData_s_localCenter.SetZero(),n=this.m_fixtureList;n;n=n.m_next)if(0!==n.m_density){var r=n.GetMassData(i.ResetMassData_s_massData);this.m_mass+=r.mass,e.x+=r.center.x*r.mass,e.y+=r.center.y*r.mass,this.m_I+=r.I}this.m_mass>0?(this.m_invMass=1/this.m_mass,e.x*=this.m_invMass,e.y*=this.m_invMass):(this.m_mass=1,this.m_invMass=1),this.m_I>0&&!this.m_fixedRotationFlag?(this.m_I-=this.m_mass*j.DotVV(e,e),this.m_invI=1/this.m_I):(this.m_I=0,this.m_invI=0);var s=i.ResetMassData_s_oldCenter.Copy(this.m_sweep.c);this.m_sweep.localCenter.Copy(e),K.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.c0.Copy(this.m_sweep.c),j.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,j.SubVV(this.m_sweep.c,s,j.s_t0),this.m_linearVelocity)},n.GetWorldPoint=function(t,e){return K.MulXV(this.m_xf,t,e)},n.GetWorldVector=function(t,e){return J.MulRV(this.m_xf.q,t,e)},n.GetLocalPoint=function(t,e){return K.MulTXV(this.m_xf,t,e)},n.GetLocalVector=function(t,e){return J.MulTRV(this.m_xf.q,t,e)},n.GetLinearVelocityFromWorldPoint=function(t,e){return j.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,j.SubVV(t,this.m_sweep.c,j.s_t0),e)},n.GetLinearVelocityFromLocalPoint=function(t,e){return this.GetLinearVelocityFromWorldPoint(this.GetWorldPoint(t,e),e)},n.GetLinearDamping=function(){return this.m_linearDamping},n.SetLinearDamping=function(t){this.m_linearDamping=t},n.GetAngularDamping=function(){return this.m_angularDamping},n.SetAngularDamping=function(t){this.m_angularDamping=t},n.GetGravityScale=function(){return this.m_gravityScale},n.SetGravityScale=function(t){this.m_gravityScale=t},n.SetType=function(e){if(this.m_world.IsLocked())throw new Error;if(this.m_type!==e){this.m_type=e,this.ResetMassData(),this.m_type===t.b2BodyType.b2_staticBody&&(this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,this.m_sweep.a0=this.m_sweep.a,this.m_sweep.c0.Copy(this.m_sweep.c),this.SynchronizeFixtures()),this.SetAwake(!0),this.m_force.SetZero(),this.m_torque=0;for(var i=this.m_contactList;i;){var n=i;i=i.next,this.m_world.m_contactManager.Destroy(n.contact)}this.m_contactList=null;for(var r=this.m_fixtureList;r;r=r.m_next)r.TouchProxies()}},n.GetType=function(){return this.m_type},n.SetBullet=function(t){this.m_bulletFlag=t},n.IsBullet=function(){return this.m_bulletFlag},n.SetSleepingAllowed=function(t){this.m_autoSleepFlag=t,t||this.SetAwake(!0)},n.IsSleepingAllowed=function(){return this.m_autoSleepFlag},n.SetAwake=function(t){t?(this.m_awakeFlag=!0,this.m_sleepTime=0):(this.m_awakeFlag=!1,this.m_sleepTime=0,this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,this.m_force.SetZero(),this.m_torque=0)},n.IsAwake=function(){return this.m_awakeFlag},n.SetActive=function(t){if(this.m_world.IsLocked())throw new Error;if(t!==this.IsActive())if(this.m_activeFlag=t,t)for(var e=this.m_fixtureList;e;e=e.m_next)e.CreateProxies();else{for(var i=this.m_fixtureList;i;i=i.m_next)i.DestroyProxies();for(var n=this.m_contactList;n;){var r=n;n=n.next,this.m_world.m_contactManager.Destroy(r.contact)}this.m_contactList=null}},n.IsActive=function(){return this.m_activeFlag},n.SetFixedRotation=function(t){this.m_fixedRotationFlag!==t&&(this.m_fixedRotationFlag=t,this.m_angularVelocity=0,this.ResetMassData())},n.IsFixedRotation=function(){return this.m_fixedRotationFlag},n.GetFixtureList=function(){return this.m_fixtureList},n.GetJointList=function(){return this.m_jointList},n.GetContactList=function(){return this.m_contactList},n.GetNext=function(){return this.m_next},n.GetUserData=function(){return this.m_userData},n.SetUserData=function(t){this.m_userData=t},n.GetWorld=function(){return this.m_world},n.Dump=function(e){var i=this.m_islandIndex;e("{\n"),e(" const bd: b2BodyDef = new b2BodyDef();\n");var n="";switch(this.m_type){case t.b2BodyType.b2_staticBody:n="b2BodyType.b2_staticBody";break;case t.b2BodyType.b2_kinematicBody:n="b2BodyType.b2_kinematicBody";break;case t.b2BodyType.b2_dynamicBody:n="b2BodyType.b2_dynamicBody"}e(" bd.type = %s;\n",n),e(" bd.position.Set(%.15f, %.15f);\n",this.m_xf.p.x,this.m_xf.p.y),e(" bd.angle = %.15f;\n",this.m_sweep.a),e(" bd.linearVelocity.Set(%.15f, %.15f);\n",this.m_linearVelocity.x,this.m_linearVelocity.y),e(" bd.angularVelocity = %.15f;\n",this.m_angularVelocity),e(" bd.linearDamping = %.15f;\n",this.m_linearDamping),e(" bd.angularDamping = %.15f;\n",this.m_angularDamping),e(" bd.allowSleep = %s;\n",this.m_autoSleepFlag?"true":"false"),e(" bd.awake = %s;\n",this.m_awakeFlag?"true":"false"),e(" bd.fixedRotation = %s;\n",this.m_fixedRotationFlag?"true":"false"),e(" bd.bullet = %s;\n",this.m_bulletFlag?"true":"false"),e(" bd.active = %s;\n",this.m_activeFlag?"true":"false"),e(" bd.gravityScale = %.15f;\n",this.m_gravityScale),e("\n"),e(" bodies[%d] = this.m_world.CreateBody(bd);\n",this.m_islandIndex),e("\n");for(var r=this.m_fixtureList;r;r=r.m_next)e(" {\n"),r.Dump(e,i),e(" }\n");e("}\n")},n.SynchronizeFixtures=function(){var t=i.SynchronizeFixtures_s_xf1;t.q.SetAngle(this.m_sweep.a0),J.MulRV(t.q,this.m_sweep.localCenter,t.p),j.SubVV(this.m_sweep.c0,t.p,t.p);for(var e=j.SubVV(this.m_sweep.c,this.m_sweep.c0,i.SynchronizeFixtures_s_displacement),n=this.m_fixtureList;n;n=n.m_next)n.SynchronizeProxies(t,this.m_xf,e)},n.SynchronizeTransform=function(){this.m_xf.q.SetAngle(this.m_sweep.a),J.MulRV(this.m_xf.q,this.m_sweep.localCenter,this.m_xf.p),j.SubVV(this.m_sweep.c,this.m_xf.p,this.m_xf.p)},n.ShouldCollide=function(e){return(this.m_type!==t.b2BodyType.b2_staticBody||e.m_type!==t.b2BodyType.b2_staticBody)&&this.ShouldCollideConnected(e)},n.ShouldCollideConnected=function(t){for(var e=this.m_jointList;e;e=e.next)if(e.other===t&&!e.joint.m_collideConnected)return!1;return!0},n.Advance=function(t){this.m_sweep.Advance(t),this.m_sweep.c.Copy(this.m_sweep.c0),this.m_sweep.a=this.m_sweep.a0,this.m_xf.q.SetAngle(this.m_sweep.a),J.MulRV(this.m_xf.q,this.m_sweep.localCenter,this.m_xf.p),j.SubVV(this.m_sweep.c,this.m_xf.p,this.m_xf.p)},n.GetControllerList=function(){return this.m_controllerList},n.GetControllerCount=function(){return this.m_controllerCount},i}();Mi.CreateFixtureShapeDensity_s_def=new Ti,Mi.SetMassData_s_oldCenter=new j,Mi.ResetMassData_s_localCenter=new j,Mi.ResetMassData_s_oldCenter=new j,Mi.ResetMassData_s_massData=new gi,Mi.SynchronizeFixtures_s_xf1=new K,Mi.SynchronizeFixtures_s_displacement=new j,(Bi=t.b2JointType||(t.b2JointType={}))[Bi.e_unknownJoint=0]="e_unknownJoint",Bi[Bi.e_revoluteJoint=1]="e_revoluteJoint",Bi[Bi.e_prismaticJoint=2]="e_prismaticJoint",Bi[Bi.e_distanceJoint=3]="e_distanceJoint",Bi[Bi.e_pulleyJoint=4]="e_pulleyJoint",Bi[Bi.e_mouseJoint=5]="e_mouseJoint",Bi[Bi.e_gearJoint=6]="e_gearJoint",Bi[Bi.e_wheelJoint=7]="e_wheelJoint",Bi[Bi.e_weldJoint=8]="e_weldJoint",Bi[Bi.e_frictionJoint=9]="e_frictionJoint",Bi[Bi.e_ropeJoint=10]="e_ropeJoint",Bi[Bi.e_motorJoint=11]="e_motorJoint",Bi[Bi.e_areaJoint=12]="e_areaJoint",(Ii=t.b2LimitState||(t.b2LimitState={}))[Ii.e_inactiveLimit=0]="e_inactiveLimit",Ii[Ii.e_atLowerLimit=1]="e_atLowerLimit",Ii[Ii.e_atUpperLimit=2]="e_atUpperLimit",Ii[Ii.e_equalLimits=3]="e_equalLimits";var Pi=function(){function t(){this.linear=new j,this.angularA=0,this.angularB=0}var e=t.prototype;return e.SetZero=function(){return this.linear.SetZero(),this.angularA=0,this.angularB=0,this},e.Set=function(t,e,i){return this.linear.Copy(t),this.angularA=e,this.angularB=i,this},t}(),Ei=function(){function t(t){this._other=null,this.prev=null,this.next=null,this.joint=t}return t.prototype.Reset=function(){this._other=null,this.prev=null,this.next=null},n(t,[{key:"other",get:function(){if(null===this._other)throw new Error;return this._other},set:function(t){if(null!==this._other)throw new Error;this._other=t}}]),t}(),ki=function(e){this.type=t.b2JointType.e_unknownJoint,this.userData=null,this.collideConnected=!1,this.type=e},Ri=function(){function i(i){this.m_type=t.b2JointType.e_unknownJoint,this.m_prev=null,this.m_next=null,this.m_edgeA=new Ei(this),this.m_edgeB=new Ei(this),this.m_index=0,this.m_islandFlag=!1,this.m_collideConnected=!1,this.m_userData=null,this.m_type=i.type,this.m_edgeA.other=i.bodyB,this.m_edgeB.other=i.bodyA,this.m_bodyA=i.bodyA,this.m_bodyB=i.bodyB,this.m_collideConnected=e(i.collideConnected,!1),this.m_userData=e(i.userData,null)}var n=i.prototype;return n.GetType=function(){return this.m_type},n.GetBodyA=function(){return this.m_bodyA},n.GetBodyB=function(){return this.m_bodyB},n.GetNext=function(){return this.m_next},n.GetUserData=function(){return this.m_userData},n.SetUserData=function(t){this.m_userData=t},n.IsActive=function(){return this.m_bodyA.IsActive()&&this.m_bodyB.IsActive()},n.GetCollideConnected=function(){return this.m_collideConnected},n.Dump=function(t){t("// Dump is not supported for this joint type.\n")},n.ShiftOrigin=function(){},i}(),Oi=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_distanceJoint)||this).localAnchorA=new j,i.localAnchorB=new j,i.length=1,i.frequencyHz=0,i.dampingRatio=0,i}return s(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(n,this.localAnchorB),this.length=j.DistanceVV(i,n),this.frequencyHz=0,this.dampingRatio=0},i}(ki),Fi=function(t){function i(i){var n;return(n=t.call(this,i)||this).m_frequencyHz=0,n.m_dampingRatio=0,n.m_bias=0,n.m_localAnchorA=new j,n.m_localAnchorB=new j,n.m_gamma=0,n.m_impulse=0,n.m_length=0,n.m_indexA=0,n.m_indexB=0,n.m_u=new j,n.m_rA=new j,n.m_rB=new j,n.m_localCenterA=new j,n.m_localCenterB=new j,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_mass=0,n.m_qA=new J,n.m_qB=new J,n.m_lalcA=new j,n.m_lalcB=new j,n.m_frequencyHz=e(i.frequencyHz,0),n.m_dampingRatio=e(i.dampingRatio,0),n.m_localAnchorA.Copy(i.localAnchorA),n.m_localAnchorB.Copy(i.localAnchorB),n.m_length=i.length,n}s(i,t);var n=i.prototype;return n.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return e.x=t*this.m_impulse*this.m_u.x,e.y=t*this.m_impulse*this.m_u.y,e},n.GetReactionTorque=function(){return 0},n.GetLocalAnchorA=function(){return this.m_localAnchorA},n.GetLocalAnchorB=function(){return this.m_localAnchorB},n.SetLength=function(t){this.m_length=t},n.Length=function(){return this.m_length},n.SetFrequency=function(t){this.m_frequencyHz=t},n.GetFrequency=function(){return this.m_frequencyHz},n.SetDampingRatio=function(t){this.m_dampingRatio=t},n.GetDampingRatio=function(){return this.m_dampingRatio},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2DistanceJointDef = new b2DistanceJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.length = %.15f;\n",this.m_length),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.velocities[this.m_indexA].v,s=t.velocities[this.m_indexA].w,a=t.positions[this.m_indexB].c,h=t.positions[this.m_indexB].a,u=t.velocities[this.m_indexB].v,c=t.velocities[this.m_indexB].w,f=this.m_qA.SetAngle(n),d=this.m_qB.SetAngle(h);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),J.MulRV(f,this.m_lalcA,this.m_rA),j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),J.MulRV(d,this.m_lalcB,this.m_rB),this.m_u.x=a.x+this.m_rB.x-e.x-this.m_rA.x,this.m_u.y=a.y+this.m_rB.y-e.y-this.m_rA.y;var _=this.m_u.Length();_>l?this.m_u.SelfMul(1/_):this.m_u.SetZero();var p=j.CrossVV(this.m_rA,this.m_u),m=j.CrossVV(this.m_rB,this.m_u),g=this.m_invMassA+this.m_invIA*p*p+this.m_invMassB+this.m_invIB*m*m;if(this.m_mass=0!==g?1/g:0,this.m_frequencyHz>0){var v=_-this.m_length,y=2*o*this.m_frequencyHz,b=2*this.m_mass*this.m_dampingRatio*y,S=this.m_mass*y*y,x=t.step.dt;this.m_gamma=x*(b+x*S),this.m_gamma=0!==this.m_gamma?1/this.m_gamma:0,this.m_bias=v*x*S*this.m_gamma,g+=this.m_gamma,this.m_mass=0!==g?1/g:0}else this.m_gamma=0,this.m_bias=0;if(t.step.warmStarting){this.m_impulse*=t.step.dtRatio;var w=j.MulSV(this.m_impulse,this.m_u,i.InitVelocityConstraints_s_P);r.SelfMulSub(this.m_invMassA,w),s-=this.m_invIA*j.CrossVV(this.m_rA,w),u.SelfMulAdd(this.m_invMassB,w),c+=this.m_invIB*j.CrossVV(this.m_rB,w)}else this.m_impulse=0;t.velocities[this.m_indexA].w=s,t.velocities[this.m_indexB].w=c},n.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=j.AddVCrossSV(e,n,this.m_rA,i.SolveVelocityConstraints_s_vpA),o=j.AddVCrossSV(r,s,this.m_rB,i.SolveVelocityConstraints_s_vpB),h=j.DotVV(this.m_u,j.SubVV(o,a,j.s_t0)),u=-this.m_mass*(h+this.m_bias+this.m_gamma*this.m_impulse);this.m_impulse+=u;var l=j.MulSV(u,this.m_u,i.SolveVelocityConstraints_s_P);e.SelfMulSub(this.m_invMassA,l),n-=this.m_invIA*j.CrossVV(this.m_rA,l),r.SelfMulAdd(this.m_invMassB,l),s+=this.m_invIB*j.CrossVV(this.m_rB,l),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(t){if(this.m_frequencyHz>0)return!0;var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s),h=J.MulRV(a,this.m_lalcA,this.m_rA),u=J.MulRV(o,this.m_lalcB,this.m_rB),c=this.m_u;c.x=r.x+u.x-e.x-h.x,c.y=r.y+u.y-e.y-h.y;var f=this.m_u.Normalize()-this.m_length;f=R(f,-.2,d);var _=-this.m_mass*f,p=j.MulSV(_,c,i.SolvePositionConstraints_s_P);return e.SelfMulSub(this.m_invMassA,p),n-=this.m_invIA*j.CrossVV(h,p),r.SelfMulAdd(this.m_invMassB,p),s+=this.m_invIB*j.CrossVV(u,p),t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,P(f)F(d)&&y.SelfMul(d/V(b)),b>F(l)&&(_=!1),g.x+=y.x,g.y+=y.y}return _},i}(Ri),Ni=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_frictionJoint)||this).localAnchorA=new j,i.localAnchorB=new j,i.maxForce=0,i.maxTorque=0,i}return s(i,e),i.prototype.Initialize=function(t,e,i){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB)},i}(ki),zi=function(t){function i(i){var n;return(n=t.call(this,i)||this).m_localAnchorA=new j,n.m_localAnchorB=new j,n.m_linearImpulse=new j,n.m_angularImpulse=0,n.m_maxForce=0,n.m_maxTorque=0,n.m_indexA=0,n.m_indexB=0,n.m_rA=new j,n.m_rB=new j,n.m_localCenterA=new j,n.m_localCenterB=new j,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_linearMass=new Y,n.m_angularMass=0,n.m_qA=new J,n.m_qB=new J,n.m_lalcA=new j,n.m_lalcB=new j,n.m_K=new Y,n.m_localAnchorA.Copy(i.localAnchorA),n.m_localAnchorB.Copy(i.localAnchorB),n.m_linearImpulse.SetZero(),n.m_maxForce=e(i.maxForce,0),n.m_maxTorque=e(i.maxTorque,0),n.m_linearMass.SetZero(),n}s(i,t);var n=i.prototype;return n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexA].a,i=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.positions[this.m_indexB].a,s=t.velocities[this.m_indexB].v,a=t.velocities[this.m_indexB].w,o=this.m_qA.SetAngle(e),h=this.m_qB.SetAngle(r);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var u=J.MulRV(o,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var l=J.MulRV(h,this.m_lalcB,this.m_rB),c=this.m_invMassA,f=this.m_invMassB,d=this.m_invIA,_=this.m_invIB,p=this.m_K;if(p.ex.x=c+f+d*u.y*u.y+_*l.y*l.y,p.ex.y=-d*u.x*u.y-_*l.x*l.y,p.ey.x=p.ex.y,p.ey.y=c+f+d*u.x*u.x+_*l.x*l.x,p.GetInverse(this.m_linearMass),this.m_angularMass=d+_,this.m_angularMass>0&&(this.m_angularMass=1/this.m_angularMass),t.step.warmStarting){this.m_linearImpulse.SelfMul(t.step.dtRatio),this.m_angularImpulse*=t.step.dtRatio;var m=this.m_linearImpulse;i.SelfMulSub(c,m),n-=d*(j.CrossVV(this.m_rA,m)+this.m_angularImpulse),s.SelfMulAdd(f,m),a+=_*(j.CrossVV(this.m_rB,m)+this.m_angularImpulse)}else this.m_linearImpulse.SetZero(),this.m_angularImpulse=0;t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=a},n.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=this.m_invMassA,o=this.m_invMassB,h=this.m_invIA,u=this.m_invIB,l=t.step.dt,c=s-n,f=-this.m_angularMass*c,d=this.m_angularImpulse,_=l*this.m_maxTorque;this.m_angularImpulse=R(this.m_angularImpulse+f,-_,_),n-=h*(f=this.m_angularImpulse-d),s+=u*f;var p=j.SubVV(j.AddVCrossSV(r,s,this.m_rB,j.s_t0),j.AddVCrossSV(e,n,this.m_rA,j.s_t1),i.SolveVelocityConstraints_s_Cdot_v2),m=Y.MulMV(this.m_linearMass,p,i.SolveVelocityConstraints_s_impulseV).SelfNeg(),g=i.SolveVelocityConstraints_s_oldImpulseV.Copy(this.m_linearImpulse);this.m_linearImpulse.SelfAdd(m);var v=l*this.m_maxForce;this.m_linearImpulse.LengthSquared()>v*v&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.SelfMul(v)),j.SubVV(this.m_linearImpulse,g,m),e.SelfMulSub(a,m),n-=h*j.CrossVV(this.m_rA,m),r.SelfMulAdd(o,m),s+=u*j.CrossVV(this.m_rB,m),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(){return!0},n.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return e.x=t*this.m_linearImpulse.x,e.y=t*this.m_linearImpulse.y,e},n.GetReactionTorque=function(t){return t*this.m_angularImpulse},n.GetLocalAnchorA=function(){return this.m_localAnchorA},n.GetLocalAnchorB=function(){return this.m_localAnchorB},n.SetMaxForce=function(t){this.m_maxForce=t},n.GetMaxForce=function(){return this.m_maxForce},n.SetMaxTorque=function(t){this.m_maxTorque=t},n.GetMaxTorque=function(){return this.m_maxTorque},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2FrictionJointDef = new b2FrictionJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.maxForce = %.15f;\n",this.m_maxForce),t(" jd.maxTorque = %.15f;\n",this.m_maxTorque),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i}(Ri);zi.SolveVelocityConstraints_s_Cdot_v2=new j,zi.SolveVelocityConstraints_s_impulseV=new j,zi.SolveVelocityConstraints_s_oldImpulseV=new j;var Ui=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_gearJoint)||this).ratio=1,i}return s(i,e),i}(ki),Gi=function(i){function n(n){var r,s,a;(r=i.call(this,n)||this).m_typeA=t.b2JointType.e_unknownJoint,r.m_typeB=t.b2JointType.e_unknownJoint,r.m_localAnchorA=new j,r.m_localAnchorB=new j,r.m_localAnchorC=new j,r.m_localAnchorD=new j,r.m_localAxisC=new j,r.m_localAxisD=new j,r.m_referenceAngleA=0,r.m_referenceAngleB=0,r.m_constant=0,r.m_ratio=0,r.m_impulse=0,r.m_indexA=0,r.m_indexB=0,r.m_indexC=0,r.m_indexD=0,r.m_lcA=new j,r.m_lcB=new j,r.m_lcC=new j,r.m_lcD=new j,r.m_mA=0,r.m_mB=0,r.m_mC=0,r.m_mD=0,r.m_iA=0,r.m_iB=0,r.m_iC=0,r.m_iD=0,r.m_JvAC=new j,r.m_JvBD=new j,r.m_JwA=0,r.m_JwB=0,r.m_JwC=0,r.m_JwD=0,r.m_mass=0,r.m_qA=new J,r.m_qB=new J,r.m_qC=new J,r.m_qD=new J,r.m_lalcA=new j,r.m_lalcB=new j,r.m_lalcC=new j,r.m_lalcD=new j,r.m_joint1=n.joint1,r.m_joint2=n.joint2,r.m_typeA=r.m_joint1.GetType(),r.m_typeB=r.m_joint2.GetType(),r.m_bodyC=r.m_joint1.GetBodyA(),r.m_bodyA=r.m_joint1.GetBodyB();var o=r.m_bodyA.m_xf,h=r.m_bodyA.m_sweep.a,u=r.m_bodyC.m_xf,l=r.m_bodyC.m_sweep.a;if(r.m_typeA===t.b2JointType.e_revoluteJoint){var c=n.joint1;r.m_localAnchorC.Copy(c.m_localAnchorA),r.m_localAnchorA.Copy(c.m_localAnchorB),r.m_referenceAngleA=c.m_referenceAngle,r.m_localAxisC.SetZero(),s=h-l-r.m_referenceAngleA}else{var f=n.joint1;r.m_localAnchorC.Copy(f.m_localAnchorA),r.m_localAnchorA.Copy(f.m_localAnchorB),r.m_referenceAngleA=f.m_referenceAngle,r.m_localAxisC.Copy(f.m_localXAxisA);var d=r.m_localAnchorC,_=J.MulTRV(u.q,j.AddVV(J.MulRV(o.q,r.m_localAnchorA,j.s_t0),j.SubVV(o.p,u.p,j.s_t1),j.s_t0),j.s_t0);s=j.DotVV(j.SubVV(_,d,j.s_t0),r.m_localAxisC)}r.m_bodyD=r.m_joint2.GetBodyA(),r.m_bodyB=r.m_joint2.GetBodyB();var p=r.m_bodyB.m_xf,m=r.m_bodyB.m_sweep.a,g=r.m_bodyD.m_xf,v=r.m_bodyD.m_sweep.a;if(r.m_typeB===t.b2JointType.e_revoluteJoint){var y=n.joint2;r.m_localAnchorD.Copy(y.m_localAnchorA),r.m_localAnchorB.Copy(y.m_localAnchorB),r.m_referenceAngleB=y.m_referenceAngle,r.m_localAxisD.SetZero(),a=m-v-r.m_referenceAngleB}else{var b=n.joint2;r.m_localAnchorD.Copy(b.m_localAnchorA),r.m_localAnchorB.Copy(b.m_localAnchorB),r.m_referenceAngleB=b.m_referenceAngle,r.m_localAxisD.Copy(b.m_localXAxisA);var S=r.m_localAnchorD,x=J.MulTRV(g.q,j.AddVV(J.MulRV(p.q,r.m_localAnchorB,j.s_t0),j.SubVV(p.p,g.p,j.s_t1),j.s_t0),j.s_t0);a=j.DotVV(j.SubVV(x,S,j.s_t0),r.m_localAxisD)}return r.m_ratio=e(n.ratio,1),r.m_constant=s+r.m_ratio*a,r.m_impulse=0,r}s(n,i);var r=n.prototype;return r.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_indexC=this.m_bodyC.m_islandIndex,this.m_indexD=this.m_bodyD.m_islandIndex,this.m_lcA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_lcB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_lcC.Copy(this.m_bodyC.m_sweep.localCenter),this.m_lcD.Copy(this.m_bodyD.m_sweep.localCenter),this.m_mA=this.m_bodyA.m_invMass,this.m_mB=this.m_bodyB.m_invMass,this.m_mC=this.m_bodyC.m_invMass,this.m_mD=this.m_bodyD.m_invMass,this.m_iA=this.m_bodyA.m_invI,this.m_iB=this.m_bodyB.m_invI,this.m_iC=this.m_bodyC.m_invI,this.m_iD=this.m_bodyD.m_invI;var i=e.positions[this.m_indexA].a,r=e.velocities[this.m_indexA].v,s=e.velocities[this.m_indexA].w,a=e.positions[this.m_indexB].a,o=e.velocities[this.m_indexB].v,h=e.velocities[this.m_indexB].w,u=e.positions[this.m_indexC].a,l=e.velocities[this.m_indexC].v,c=e.velocities[this.m_indexC].w,f=e.positions[this.m_indexD].a,d=e.velocities[this.m_indexD].v,_=e.velocities[this.m_indexD].w,p=this.m_qA.SetAngle(i),m=this.m_qB.SetAngle(a),g=this.m_qC.SetAngle(u),v=this.m_qD.SetAngle(f);if(this.m_mass=0,this.m_typeA===t.b2JointType.e_revoluteJoint)this.m_JvAC.SetZero(),this.m_JwA=1,this.m_JwC=1,this.m_mass+=this.m_iA+this.m_iC;else{var y=J.MulRV(g,this.m_localAxisC,n.InitVelocityConstraints_s_u);j.SubVV(this.m_localAnchorC,this.m_lcC,this.m_lalcC);var b=J.MulRV(g,this.m_lalcC,n.InitVelocityConstraints_s_rC);j.SubVV(this.m_localAnchorA,this.m_lcA,this.m_lalcA);var S=J.MulRV(p,this.m_lalcA,n.InitVelocityConstraints_s_rA);this.m_JvAC.Copy(y),this.m_JwC=j.CrossVV(b,y),this.m_JwA=j.CrossVV(S,y),this.m_mass+=this.m_mC+this.m_mA+this.m_iC*this.m_JwC*this.m_JwC+this.m_iA*this.m_JwA*this.m_JwA}if(this.m_typeB===t.b2JointType.e_revoluteJoint)this.m_JvBD.SetZero(),this.m_JwB=this.m_ratio,this.m_JwD=this.m_ratio,this.m_mass+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD);else{var x=J.MulRV(v,this.m_localAxisD,n.InitVelocityConstraints_s_u);j.SubVV(this.m_localAnchorD,this.m_lcD,this.m_lalcD);var w=J.MulRV(v,this.m_lalcD,n.InitVelocityConstraints_s_rD);j.SubVV(this.m_localAnchorB,this.m_lcB,this.m_lalcB);var T=J.MulRV(m,this.m_lalcB,n.InitVelocityConstraints_s_rB);j.MulSV(this.m_ratio,x,this.m_JvBD),this.m_JwD=this.m_ratio*j.CrossVV(w,x),this.m_JwB=this.m_ratio*j.CrossVV(T,x),this.m_mass+=this.m_ratio*this.m_ratio*(this.m_mD+this.m_mB)+this.m_iD*this.m_JwD*this.m_JwD+this.m_iB*this.m_JwB*this.m_JwB}this.m_mass=this.m_mass>0?1/this.m_mass:0,e.step.warmStarting?(r.SelfMulAdd(this.m_mA*this.m_impulse,this.m_JvAC),s+=this.m_iA*this.m_impulse*this.m_JwA,o.SelfMulAdd(this.m_mB*this.m_impulse,this.m_JvBD),h+=this.m_iB*this.m_impulse*this.m_JwB,l.SelfMulSub(this.m_mC*this.m_impulse,this.m_JvAC),c-=this.m_iC*this.m_impulse*this.m_JwC,d.SelfMulSub(this.m_mD*this.m_impulse,this.m_JvBD),_-=this.m_iD*this.m_impulse*this.m_JwD):this.m_impulse=0,e.velocities[this.m_indexA].w=s,e.velocities[this.m_indexB].w=h,e.velocities[this.m_indexC].w=c,e.velocities[this.m_indexD].w=_},r.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,i=t.velocities[this.m_indexA].w,n=t.velocities[this.m_indexB].v,r=t.velocities[this.m_indexB].w,s=t.velocities[this.m_indexC].v,a=t.velocities[this.m_indexC].w,o=t.velocities[this.m_indexD].v,h=t.velocities[this.m_indexD].w,u=j.DotVV(this.m_JvAC,j.SubVV(e,s,j.s_t0))+j.DotVV(this.m_JvBD,j.SubVV(n,o,j.s_t0));u+=this.m_JwA*i-this.m_JwC*a+(this.m_JwB*r-this.m_JwD*h);var l=-this.m_mass*u;this.m_impulse+=l,e.SelfMulAdd(this.m_mA*l,this.m_JvAC),i+=this.m_iA*l*this.m_JwA,n.SelfMulAdd(this.m_mB*l,this.m_JvBD),r+=this.m_iB*l*this.m_JwB,s.SelfMulSub(this.m_mC*l,this.m_JvAC),a-=this.m_iC*l*this.m_JwC,o.SelfMulSub(this.m_mD*l,this.m_JvBD),h-=this.m_iD*l*this.m_JwD,t.velocities[this.m_indexA].w=i,t.velocities[this.m_indexB].w=r,t.velocities[this.m_indexC].w=a,t.velocities[this.m_indexD].w=h},r.SolvePositionConstraints=function(e){var i,r,s,a,o,h,u=e.positions[this.m_indexA].c,l=e.positions[this.m_indexA].a,c=e.positions[this.m_indexB].c,f=e.positions[this.m_indexB].a,d=e.positions[this.m_indexC].c,_=e.positions[this.m_indexC].a,p=e.positions[this.m_indexD].c,m=e.positions[this.m_indexD].a,g=this.m_qA.SetAngle(l),v=this.m_qB.SetAngle(f),y=this.m_qC.SetAngle(_),b=this.m_qD.SetAngle(m),S=this.m_JvAC,x=this.m_JvBD,w=0;if(this.m_typeA===t.b2JointType.e_revoluteJoint)S.SetZero(),s=1,o=1,w+=this.m_iA+this.m_iC,i=l-_-this.m_referenceAngleA;else{var T=J.MulRV(y,this.m_localAxisC,n.SolvePositionConstraints_s_u),C=J.MulRV(y,this.m_lalcC,n.SolvePositionConstraints_s_rC),A=J.MulRV(g,this.m_lalcA,n.SolvePositionConstraints_s_rA);S.Copy(T),o=j.CrossVV(C,T),s=j.CrossVV(A,T),w+=this.m_mC+this.m_mA+this.m_iC*o*o+this.m_iA*s*s;var D=this.m_lalcC,I=J.MulTRV(y,j.AddVV(A,j.SubVV(u,d,j.s_t0),j.s_t0),j.s_t0);i=j.DotVV(j.SubVV(I,D,j.s_t0),this.m_localAxisC)}if(this.m_typeB===t.b2JointType.e_revoluteJoint)x.SetZero(),a=this.m_ratio,h=this.m_ratio,w+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD),r=f-m-this.m_referenceAngleB;else{var B=J.MulRV(b,this.m_localAxisD,n.SolvePositionConstraints_s_u),M=J.MulRV(b,this.m_lalcD,n.SolvePositionConstraints_s_rD),P=J.MulRV(v,this.m_lalcB,n.SolvePositionConstraints_s_rB);j.MulSV(this.m_ratio,B,x),h=this.m_ratio*j.CrossVV(M,B),a=this.m_ratio*j.CrossVV(P,B),w+=this.m_ratio*this.m_ratio*(this.m_mD+this.m_mB)+this.m_iD*h*h+this.m_iB*a*a;var E=this.m_lalcD,k=J.MulTRV(b,j.AddVV(P,j.SubVV(c,p,j.s_t0),j.s_t0),j.s_t0);r=j.DotVV(j.SubVV(k,E,j.s_t0),this.m_localAxisD)}var R=i+this.m_ratio*r-this.m_constant,O=0;return w>0&&(O=-R/w),u.SelfMulAdd(this.m_mA*O,S),l+=this.m_iA*O*s,c.SelfMulAdd(this.m_mB*O,x),f+=this.m_iB*O*a,d.SelfMulSub(this.m_mC*O,S),_-=this.m_iC*O*o,p.SelfMulSub(this.m_mD*O,x),m-=this.m_iD*O*h,e.positions[this.m_indexA].a=l,e.positions[this.m_indexB].a=f,e.positions[this.m_indexC].a=_,e.positions[this.m_indexD].a=m,!0},r.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},r.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},r.GetReactionForce=function(t,e){return j.MulSV(t*this.m_impulse,this.m_JvAC,e)},r.GetReactionTorque=function(t){return t*this.m_impulse*this.m_JwA},r.GetJoint1=function(){return this.m_joint1},r.GetJoint2=function(){return this.m_joint2},r.GetRatio=function(){return this.m_ratio},r.SetRatio=function(t){this.m_ratio=t},r.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex,n=this.m_joint1.m_index,r=this.m_joint2.m_index;t(" const jd: b2GearJointDef = new b2GearJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.joint1 = joints[%d];\n",n),t(" jd.joint2 = joints[%d];\n",r),t(" jd.ratio = %.15f;\n",this.m_ratio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n}(Ri);Gi.InitVelocityConstraints_s_u=new j,Gi.InitVelocityConstraints_s_rA=new j,Gi.InitVelocityConstraints_s_rB=new j,Gi.InitVelocityConstraints_s_rC=new j,Gi.InitVelocityConstraints_s_rD=new j,Gi.SolvePositionConstraints_s_u=new j,Gi.SolvePositionConstraints_s_rA=new j,Gi.SolvePositionConstraints_s_rB=new j,Gi.SolvePositionConstraints_s_rC=new j,Gi.SolvePositionConstraints_s_rD=new j;var Hi=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_motorJoint)||this).linearOffset=new j(0,0),i.angularOffset=0,i.maxForce=1,i.maxTorque=1,i.correctionFactor=.3,i}return s(i,e),i.prototype.Initialize=function(t,e){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(this.bodyB.GetPosition(),this.linearOffset);var i=this.bodyA.GetAngle(),n=this.bodyB.GetAngle();this.angularOffset=n-i},i}(ki),Wi=function(t){function i(i){var n;return(n=t.call(this,i)||this).m_linearOffset=new j,n.m_angularOffset=0,n.m_linearImpulse=new j,n.m_angularImpulse=0,n.m_maxForce=0,n.m_maxTorque=0,n.m_correctionFactor=.3,n.m_indexA=0,n.m_indexB=0,n.m_rA=new j,n.m_rB=new j,n.m_localCenterA=new j,n.m_localCenterB=new j,n.m_linearError=new j,n.m_angularError=0,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_linearMass=new Y,n.m_angularMass=0,n.m_qA=new J,n.m_qB=new J,n.m_K=new Y,n.m_linearOffset.Copy(e(i.linearOffset,j.ZERO)),n.m_linearImpulse.SetZero(),n.m_maxForce=e(i.maxForce,0),n.m_maxTorque=e(i.maxTorque,0),n.m_correctionFactor=e(i.correctionFactor,.3),n}s(i,t);var n=i.prototype;return n.GetAnchorA=function(t){var e=this.m_bodyA.GetPosition();return t.x=e.x,t.y=e.y,t},n.GetAnchorB=function(t){var e=this.m_bodyB.GetPosition();return t.x=e.x,t.y=e.y,t},n.GetReactionForce=function(t,e){return j.MulSV(t,this.m_linearImpulse,e)},n.GetReactionTorque=function(t){return t*this.m_angularImpulse},n.SetLinearOffset=function(t){j.IsEqualToV(t,this.m_linearOffset)||(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_linearOffset.Copy(t))},n.GetLinearOffset=function(){return this.m_linearOffset},n.SetAngularOffset=function(t){t!==this.m_angularOffset&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_angularOffset=t)},n.GetAngularOffset=function(){return this.m_angularOffset},n.SetMaxForce=function(t){this.m_maxForce=t},n.GetMaxForce=function(){return this.m_maxForce},n.SetMaxTorque=function(t){this.m_maxTorque=t},n.GetMaxTorque=function(){return this.m_maxTorque},n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexA].c,i=t.positions[this.m_indexA].a,n=t.velocities[this.m_indexA].v,r=t.velocities[this.m_indexA].w,s=t.positions[this.m_indexB].c,a=t.positions[this.m_indexB].a,o=t.velocities[this.m_indexB].v,h=t.velocities[this.m_indexB].w,u=this.m_qA.SetAngle(i),l=this.m_qB.SetAngle(a),c=J.MulRV(u,j.SubVV(this.m_linearOffset,this.m_localCenterA,j.s_t0),this.m_rA),f=J.MulRV(l,j.NegV(this.m_localCenterB,j.s_t0),this.m_rB),d=this.m_invMassA,_=this.m_invMassB,p=this.m_invIA,m=this.m_invIB,g=this.m_K;if(g.ex.x=d+_+p*c.y*c.y+m*f.y*f.y,g.ex.y=-p*c.x*c.y-m*f.x*f.y,g.ey.x=g.ex.y,g.ey.y=d+_+p*c.x*c.x+m*f.x*f.x,g.GetInverse(this.m_linearMass),this.m_angularMass=p+m,this.m_angularMass>0&&(this.m_angularMass=1/this.m_angularMass),j.SubVV(j.AddVV(s,f,j.s_t0),j.AddVV(e,c,j.s_t1),this.m_linearError),this.m_angularError=a-i-this.m_angularOffset,t.step.warmStarting){this.m_linearImpulse.SelfMul(t.step.dtRatio),this.m_angularImpulse*=t.step.dtRatio;var v=this.m_linearImpulse;n.SelfMulSub(d,v),r-=p*(j.CrossVV(c,v)+this.m_angularImpulse),o.SelfMulAdd(_,v),h+=m*(j.CrossVV(f,v)+this.m_angularImpulse)}else this.m_linearImpulse.SetZero(),this.m_angularImpulse=0;t.velocities[this.m_indexA].w=r,t.velocities[this.m_indexB].w=h},n.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=this.m_invMassA,o=this.m_invMassB,h=this.m_invIA,u=this.m_invIB,l=t.step.dt,c=t.step.inv_dt,f=s-n+c*this.m_correctionFactor*this.m_angularError,d=-this.m_angularMass*f,_=this.m_angularImpulse,p=l*this.m_maxTorque;this.m_angularImpulse=R(this.m_angularImpulse+d,-p,p),n-=h*(d=this.m_angularImpulse-_),s+=u*d;var m=this.m_rA,g=this.m_rB,v=j.AddVV(j.SubVV(j.AddVV(r,j.CrossSV(s,g,j.s_t0),j.s_t0),j.AddVV(e,j.CrossSV(n,m,j.s_t1),j.s_t1),j.s_t2),j.MulSV(c*this.m_correctionFactor,this.m_linearError,j.s_t3),i.SolveVelocityConstraints_s_Cdot_v2),y=Y.MulMV(this.m_linearMass,v,i.SolveVelocityConstraints_s_impulse_v2).SelfNeg(),b=i.SolveVelocityConstraints_s_oldImpulse_v2.Copy(this.m_linearImpulse);this.m_linearImpulse.SelfAdd(y);var S=l*this.m_maxForce;this.m_linearImpulse.LengthSquared()>S*S&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.SelfMul(S)),j.SubVV(this.m_linearImpulse,b,y),e.SelfMulSub(a,y),n-=h*j.CrossVV(m,y),r.SelfMulAdd(o,y),s+=u*j.CrossVV(g,y),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(){return!0},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2MotorJointDef = new b2MotorJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.linearOffset.Set(%.15f, %.15f);\n",this.m_linearOffset.x,this.m_linearOffset.y),t(" jd.angularOffset = %.15f;\n",this.m_angularOffset),t(" jd.maxForce = %.15f;\n",this.m_maxForce),t(" jd.maxTorque = %.15f;\n",this.m_maxTorque),t(" jd.correctionFactor = %.15f;\n",this.m_correctionFactor),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i}(Ri);Wi.SolveVelocityConstraints_s_Cdot_v2=new j,Wi.SolveVelocityConstraints_s_impulse_v2=new j,Wi.SolveVelocityConstraints_s_oldImpulse_v2=new j;var ji=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_mouseJoint)||this).target=new j,i.maxForce=0,i.frequencyHz=5,i.dampingRatio=.7,i}return s(i,e),i}(ki),qi=function(t){function i(i){var n;return(n=t.call(this,i)||this).m_localAnchorB=new j,n.m_targetA=new j,n.m_frequencyHz=0,n.m_dampingRatio=0,n.m_beta=0,n.m_impulse=new j,n.m_maxForce=0,n.m_gamma=0,n.m_indexA=0,n.m_indexB=0,n.m_rB=new j,n.m_localCenterB=new j,n.m_invMassB=0,n.m_invIB=0,n.m_mass=new Y,n.m_C=new j,n.m_qB=new J,n.m_lalcB=new j,n.m_K=new Y,n.m_targetA.Copy(e(i.target,j.ZERO)),K.MulTXV(n.m_bodyB.GetTransform(),n.m_targetA,n.m_localAnchorB),n.m_maxForce=e(i.maxForce,0),n.m_impulse.SetZero(),n.m_frequencyHz=e(i.frequencyHz,0),n.m_dampingRatio=e(i.dampingRatio,0),n.m_beta=0,n.m_gamma=0,n}s(i,t);var n=i.prototype;return n.SetTarget=function(t){this.m_bodyB.IsAwake()||this.m_bodyB.SetAwake(!0),this.m_targetA.Copy(t)},n.GetTarget=function(){return this.m_targetA},n.SetMaxForce=function(t){this.m_maxForce=t},n.GetMaxForce=function(){return this.m_maxForce},n.SetFrequency=function(t){this.m_frequencyHz=t},n.GetFrequency=function(){return this.m_frequencyHz},n.SetDampingRatio=function(t){this.m_dampingRatio=t},n.GetDampingRatio=function(){return this.m_dampingRatio},n.InitVelocityConstraints=function(t){this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexB].c,i=t.positions[this.m_indexB].a,n=t.velocities[this.m_indexB].v,r=t.velocities[this.m_indexB].w,s=this.m_qB.SetAngle(i),a=this.m_bodyB.GetMass(),h=2*o*this.m_frequencyHz,u=2*a*this.m_dampingRatio*h,l=a*h*h,c=t.step.dt;this.m_gamma=c*(u+c*l),0!==this.m_gamma&&(this.m_gamma=1/this.m_gamma),this.m_beta=c*l*this.m_gamma,j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),J.MulRV(s,this.m_lalcB,this.m_rB);var f=this.m_K;f.ex.x=this.m_invMassB+this.m_invIB*this.m_rB.y*this.m_rB.y+this.m_gamma,f.ex.y=-this.m_invIB*this.m_rB.x*this.m_rB.y,f.ey.x=f.ex.y,f.ey.y=this.m_invMassB+this.m_invIB*this.m_rB.x*this.m_rB.x+this.m_gamma,f.GetInverse(this.m_mass),this.m_C.x=e.x+this.m_rB.x-this.m_targetA.x,this.m_C.y=e.y+this.m_rB.y-this.m_targetA.y,this.m_C.SelfMul(this.m_beta),r*=.98,t.step.warmStarting?(this.m_impulse.SelfMul(t.step.dtRatio),n.x+=this.m_invMassB*this.m_impulse.x,n.y+=this.m_invMassB*this.m_impulse.y,r+=this.m_invIB*j.CrossVV(this.m_rB,this.m_impulse)):this.m_impulse.SetZero(),t.velocities[this.m_indexB].w=r},n.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexB].v,n=t.velocities[this.m_indexB].w,r=j.AddVCrossSV(e,n,this.m_rB,i.SolveVelocityConstraints_s_Cdot),s=Y.MulMV(this.m_mass,j.AddVV(r,j.AddVV(this.m_C,j.MulSV(this.m_gamma,this.m_impulse,j.s_t0),j.s_t0),j.s_t0).SelfNeg(),i.SolveVelocityConstraints_s_impulse),a=i.SolveVelocityConstraints_s_oldImpulse.Copy(this.m_impulse);this.m_impulse.SelfAdd(s);var o=t.step.dt*this.m_maxForce;this.m_impulse.LengthSquared()>o*o&&this.m_impulse.SelfMul(o/this.m_impulse.Length()),j.SubVV(this.m_impulse,a,s),e.SelfMulAdd(this.m_invMassB,s),n+=this.m_invIB*j.CrossVV(this.m_rB,s),t.velocities[this.m_indexB].w=n},n.SolvePositionConstraints=function(){return!0},n.GetAnchorA=function(t){return t.x=this.m_targetA.x,t.y=this.m_targetA.y,t},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return j.MulSV(t,this.m_impulse,e)},n.GetReactionTorque=function(){return 0},n.Dump=function(t){t("Mouse joint dumping is not supported.\n")},n.ShiftOrigin=function(t){this.m_targetA.SelfSub(t)},i}(Ri);qi.SolveVelocityConstraints_s_Cdot=new j,qi.SolveVelocityConstraints_s_impulse=new j,qi.SolveVelocityConstraints_s_oldImpulse=new j;var Xi=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_prismaticJoint)||this).localAnchorA=new j,i.localAnchorB=new j,i.localAxisA=new j(1,0),i.referenceAngle=0,i.enableLimit=!1,i.lowerTranslation=0,i.upperTranslation=0,i.enableMotor=!1,i.maxMotorForce=0,i.motorSpeed=0,i}return s(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB),this.bodyA.GetLocalVector(n,this.localAxisA),this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()},i}(ki),Yi=function(i){function n(n){var r;return(r=i.call(this,n)||this).m_localAnchorA=new j,r.m_localAnchorB=new j,r.m_localXAxisA=new j,r.m_localYAxisA=new j,r.m_referenceAngle=0,r.m_impulse=new X(0,0,0),r.m_motorImpulse=0,r.m_lowerTranslation=0,r.m_upperTranslation=0,r.m_maxMotorForce=0,r.m_motorSpeed=0,r.m_enableLimit=!1,r.m_enableMotor=!1,r.m_limitState=t.b2LimitState.e_inactiveLimit,r.m_indexA=0,r.m_indexB=0,r.m_localCenterA=new j,r.m_localCenterB=new j,r.m_invMassA=0,r.m_invMassB=0,r.m_invIA=0,r.m_invIB=0,r.m_axis=new j(0,0),r.m_perp=new j(0,0),r.m_s1=0,r.m_s2=0,r.m_a1=0,r.m_a2=0,r.m_K=new Q,r.m_K3=new Q,r.m_K2=new Y,r.m_motorMass=0,r.m_qA=new J,r.m_qB=new J,r.m_lalcA=new j,r.m_lalcB=new j,r.m_rA=new j,r.m_rB=new j,r.m_localAnchorA.Copy(e(n.localAnchorA,j.ZERO)),r.m_localAnchorB.Copy(e(n.localAnchorB,j.ZERO)),r.m_localXAxisA.Copy(e(n.localAxisA,new j(1,0))).SelfNormalize(),j.CrossOneV(r.m_localXAxisA,r.m_localYAxisA),r.m_referenceAngle=e(n.referenceAngle,0),r.m_lowerTranslation=e(n.lowerTranslation,0),r.m_upperTranslation=e(n.upperTranslation,0),r.m_maxMotorForce=e(n.maxMotorForce,0),r.m_motorSpeed=e(n.motorSpeed,0),r.m_enableLimit=e(n.enableLimit,!1),r.m_enableMotor=e(n.enableMotor,!1),r}s(n,i);var r=n.prototype;return r.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=e.positions[this.m_indexA].c,r=e.positions[this.m_indexA].a,s=e.velocities[this.m_indexA].v,a=e.velocities[this.m_indexA].w,o=e.positions[this.m_indexB].c,h=e.positions[this.m_indexB].a,u=e.velocities[this.m_indexB].v,l=e.velocities[this.m_indexB].w,c=this.m_qA.SetAngle(r),f=this.m_qB.SetAngle(h);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var d=J.MulRV(c,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var _=J.MulRV(f,this.m_lalcB,this.m_rB),p=j.AddVV(j.SubVV(o,i,j.s_t0),j.SubVV(_,d,j.s_t1),n.InitVelocityConstraints_s_d),m=this.m_invMassA,g=this.m_invMassB,v=this.m_invIA,y=this.m_invIB;if(J.MulRV(c,this.m_localXAxisA,this.m_axis),this.m_a1=j.CrossVV(j.AddVV(p,d,j.s_t0),this.m_axis),this.m_a2=j.CrossVV(_,this.m_axis),this.m_motorMass=m+g+v*this.m_a1*this.m_a1+y*this.m_a2*this.m_a2,this.m_motorMass>0&&(this.m_motorMass=1/this.m_motorMass),J.MulRV(c,this.m_localYAxisA,this.m_perp),this.m_s1=j.CrossVV(j.AddVV(p,d,j.s_t0),this.m_perp),this.m_s2=j.CrossVV(_,this.m_perp),this.m_K.ex.x=m+g+v*this.m_s1*this.m_s1+y*this.m_s2*this.m_s2,this.m_K.ex.y=v*this.m_s1+y*this.m_s2,this.m_K.ex.z=v*this.m_s1*this.m_a1+y*this.m_s2*this.m_a2,this.m_K.ey.x=this.m_K.ex.y,this.m_K.ey.y=v+y,0===this.m_K.ey.y&&(this.m_K.ey.y=1),this.m_K.ey.z=v*this.m_a1+y*this.m_a2,this.m_K.ez.x=this.m_K.ex.z,this.m_K.ez.y=this.m_K.ey.z,this.m_K.ez.z=m+g+v*this.m_a1*this.m_a1+y*this.m_a2*this.m_a2,this.m_enableLimit){var b=j.DotVV(this.m_axis,p);P(this.m_upperTranslation-this.m_lowerTranslation)<.016?this.m_limitState=t.b2LimitState.e_equalLimits:b<=this.m_lowerTranslation?this.m_limitState!==t.b2LimitState.e_atLowerLimit&&(this.m_limitState=t.b2LimitState.e_atLowerLimit,this.m_impulse.z=0):b>=this.m_upperTranslation?this.m_limitState!==t.b2LimitState.e_atUpperLimit&&(this.m_limitState=t.b2LimitState.e_atUpperLimit,this.m_impulse.z=0):(this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0)}else this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0;if(this.m_enableMotor||(this.m_motorImpulse=0),e.step.warmStarting){this.m_impulse.SelfMul(e.step.dtRatio),this.m_motorImpulse*=e.step.dtRatio;var S=j.AddVV(j.MulSV(this.m_impulse.x,this.m_perp,j.s_t0),j.MulSV(this.m_motorImpulse+this.m_impulse.z,this.m_axis,j.s_t1),n.InitVelocityConstraints_s_P),x=this.m_impulse.x*this.m_s1+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a1,w=this.m_impulse.x*this.m_s2+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a2;s.SelfMulSub(m,S),a-=v*x,u.SelfMulAdd(g,S),l+=y*w}else this.m_impulse.SetZero(),this.m_motorImpulse=0;e.velocities[this.m_indexA].w=a,e.velocities[this.m_indexB].w=l},r.SolveVelocityConstraints=function(e){var i=e.velocities[this.m_indexA].v,r=e.velocities[this.m_indexA].w,s=e.velocities[this.m_indexB].v,a=e.velocities[this.m_indexB].w,o=this.m_invMassA,h=this.m_invMassB,u=this.m_invIA,l=this.m_invIB;if(this.m_enableMotor&&this.m_limitState!==t.b2LimitState.e_equalLimits){var c=j.DotVV(this.m_axis,j.SubVV(s,i,j.s_t0))+this.m_a2*a-this.m_a1*r,f=this.m_motorMass*(this.m_motorSpeed-c),d=this.m_motorImpulse,_=e.step.dt*this.m_maxMotorForce;this.m_motorImpulse=R(this.m_motorImpulse+f,-_,_),f=this.m_motorImpulse-d;var p=j.MulSV(f,this.m_axis,n.SolveVelocityConstraints_s_P),m=f*this.m_a1,g=f*this.m_a2;i.SelfMulSub(o,p),r-=u*m,s.SelfMulAdd(h,p),a+=l*g}var v=j.DotVV(this.m_perp,j.SubVV(s,i,j.s_t0))+this.m_s2*a-this.m_s1*r,y=a-r;if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit){var b=j.DotVV(this.m_axis,j.SubVV(s,i,j.s_t0))+this.m_a2*a-this.m_a1*r,S=n.SolveVelocityConstraints_s_f1.Copy(this.m_impulse),x=this.m_K.Solve33(-v,-y,-b,n.SolveVelocityConstraints_s_df3);this.m_impulse.SelfAdd(x),this.m_limitState===t.b2LimitState.e_atLowerLimit?this.m_impulse.z=k(this.m_impulse.z,0):this.m_limitState===t.b2LimitState.e_atUpperLimit&&(this.m_impulse.z=E(this.m_impulse.z,0));var w=-v-(this.m_impulse.z-S.z)*this.m_K.ez.x,T=-y-(this.m_impulse.z-S.z)*this.m_K.ez.y,C=this.m_K.Solve22(w,T,n.SolveVelocityConstraints_s_f2r);C.x+=S.x,C.y+=S.y,this.m_impulse.x=C.x,this.m_impulse.y=C.y,x.x=this.m_impulse.x-S.x,x.y=this.m_impulse.y-S.y,x.z=this.m_impulse.z-S.z;var A=j.AddVV(j.MulSV(x.x,this.m_perp,j.s_t0),j.MulSV(x.z,this.m_axis,j.s_t1),n.SolveVelocityConstraints_s_P),D=x.x*this.m_s1+x.y+x.z*this.m_a1,I=x.x*this.m_s2+x.y+x.z*this.m_a2;i.SelfMulSub(o,A),r-=u*D,s.SelfMulAdd(h,A),a+=l*I}else{var B=this.m_K.Solve22(-v,-y,n.SolveVelocityConstraints_s_df2);this.m_impulse.x+=B.x,this.m_impulse.y+=B.y;var M=j.MulSV(B.x,this.m_perp,n.SolveVelocityConstraints_s_P),P=B.x*this.m_s1+B.y,O=B.x*this.m_s2+B.y;i.SelfMulSub(o,M),r-=u*P,s.SelfMulAdd(h,M),a+=l*O}e.velocities[this.m_indexA].w=r,e.velocities[this.m_indexB].w=a},r.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,i=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(i),o=this.m_qB.SetAngle(s),h=this.m_invMassA,u=this.m_invMassB,f=this.m_invIA,_=this.m_invIB,p=J.MulRV(a,this.m_lalcA,this.m_rA),m=J.MulRV(o,this.m_lalcB,this.m_rB),g=j.SubVV(j.AddVV(r,m,j.s_t0),j.AddVV(e,p,j.s_t1),n.SolvePositionConstraints_s_d),v=J.MulRV(a,this.m_localXAxisA,this.m_axis),y=j.CrossVV(j.AddVV(g,p,j.s_t0),v),b=j.CrossVV(m,v),S=J.MulRV(a,this.m_localYAxisA,this.m_perp),x=j.CrossVV(j.AddVV(g,p,j.s_t0),S),w=j.CrossVV(m,S),T=n.SolvePositionConstraints_s_impulse,C=j.DotVV(S,g),A=s-i-this.m_referenceAngle,D=P(C),I=P(A),B=!1,M=0;if(this.m_enableLimit){var E=j.DotVV(v,g);P(this.m_upperTranslation-this.m_lowerTranslation)<.016?(M=R(E,-.2,d),D=k(D,P(E)),B=!0):E<=this.m_lowerTranslation?(M=R(E-this.m_lowerTranslation+l,-.2,0),D=k(D,this.m_lowerTranslation-E),B=!0):E>=this.m_upperTranslation&&(M=R(E-this.m_upperTranslation-l,0,d),D=k(D,E-this.m_upperTranslation),B=!0)}if(B){var O=h+u+f*x*x+_*w*w,F=f*x+_*w,L=f*x*y+_*w*b,V=f+_;0===V&&(V=1);var N=f*y+_*b,z=h+u+f*y*y+_*b*b,U=this.m_K3;U.ex.SetXYZ(O,F,L),U.ey.SetXYZ(F,V,N),U.ez.SetXYZ(L,N,z),T=U.Solve33(-C,-A,-M,T)}else{var G=h+u+f*x*x+_*w*w,H=f*x+_*w,W=f+_;0===W&&(W=1);var q=this.m_K2;q.ex.Set(G,H),q.ey.Set(H,W);var X=q.Solve(-C,-A,n.SolvePositionConstraints_s_impulse1);T.x=X.x,T.y=X.y,T.z=0}var Y=j.AddVV(j.MulSV(T.x,S,j.s_t0),j.MulSV(T.z,v,j.s_t1),n.SolvePositionConstraints_s_P),Q=T.x*x+T.y+T.z*y,K=T.x*w+T.y+T.z*b;return e.SelfMulSub(h,Y),i-=f*Q,r.SelfMulAdd(u,Y),s+=_*K,t.positions[this.m_indexA].a=i,t.positions[this.m_indexB].a=s,D<=l&&I<=c},r.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},r.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},r.GetReactionForce=function(t,e){return e.x=t*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x),e.y=t*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y),e},r.GetReactionTorque=function(t){return t*this.m_impulse.y},r.GetLocalAnchorA=function(){return this.m_localAnchorA},r.GetLocalAnchorB=function(){return this.m_localAnchorB},r.GetLocalAxisA=function(){return this.m_localXAxisA},r.GetReferenceAngle=function(){return this.m_referenceAngle},r.GetJointTranslation=function(){var t=this.m_bodyA.GetWorldPoint(this.m_localAnchorA,n.GetJointTranslation_s_pA),e=this.m_bodyB.GetWorldPoint(this.m_localAnchorB,n.GetJointTranslation_s_pB),i=j.SubVV(e,t,n.GetJointTranslation_s_d),r=this.m_bodyA.GetWorldVector(this.m_localXAxisA,n.GetJointTranslation_s_axis);return j.DotVV(i,r)},r.GetJointSpeed=function(){var t=this.m_bodyA,e=this.m_bodyB;j.SubVV(this.m_localAnchorA,t.m_sweep.localCenter,this.m_lalcA);var i=J.MulRV(t.m_xf.q,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,e.m_sweep.localCenter,this.m_lalcB);var n=J.MulRV(e.m_xf.q,this.m_lalcB,this.m_rB),r=j.AddVV(t.m_sweep.c,i,j.s_t0),s=j.AddVV(e.m_sweep.c,n,j.s_t1),a=j.SubVV(s,r,j.s_t2),o=t.GetWorldVector(this.m_localXAxisA,this.m_axis),h=t.m_linearVelocity,u=e.m_linearVelocity,l=t.m_angularVelocity,c=e.m_angularVelocity;return j.DotVV(a,j.CrossSV(l,o,j.s_t0))+j.DotVV(o,j.SubVV(j.AddVCrossSV(u,c,n,j.s_t0),j.AddVCrossSV(h,l,i,j.s_t1),j.s_t0))},r.IsLimitEnabled=function(){return this.m_enableLimit},r.EnableLimit=function(t){t!==this.m_enableLimit&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableLimit=t,this.m_impulse.z=0)},r.GetLowerLimit=function(){return this.m_lowerTranslation},r.GetUpperLimit=function(){return this.m_upperTranslation},r.SetLimits=function(t,e){t===this.m_lowerTranslation&&e===this.m_upperTranslation||(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_lowerTranslation=t,this.m_upperTranslation=e,this.m_impulse.z=0)},r.IsMotorEnabled=function(){return this.m_enableMotor},r.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},r.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},r.GetMotorSpeed=function(){return this.m_motorSpeed},r.SetMaxMotorForce=function(t){t!==this.m_maxMotorForce&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorForce=t)},r.GetMaxMotorForce=function(){return this.m_maxMotorForce},r.GetMotorForce=function(t){return t*this.m_motorImpulse},r.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2PrismaticJointDef = new b2PrismaticJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.localAxisA.Set(%.15f, %.15f);\n",this.m_localXAxisA.x,this.m_localXAxisA.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.enableLimit = %s;\n",this.m_enableLimit?"true":"false"),t(" jd.lowerTranslation = %.15f;\n",this.m_lowerTranslation),t(" jd.upperTranslation = %.15f;\n",this.m_upperTranslation),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorForce = %.15f;\n",this.m_maxMotorForce),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n}(Ri);Yi.InitVelocityConstraints_s_d=new j,Yi.InitVelocityConstraints_s_P=new j,Yi.SolveVelocityConstraints_s_P=new j,Yi.SolveVelocityConstraints_s_f2r=new j,Yi.SolveVelocityConstraints_s_f1=new X,Yi.SolveVelocityConstraints_s_df3=new X,Yi.SolveVelocityConstraints_s_df2=new j,Yi.SolvePositionConstraints_s_d=new j,Yi.SolvePositionConstraints_s_impulse=new X,Yi.SolvePositionConstraints_s_impulse1=new j,Yi.SolvePositionConstraints_s_P=new j,Yi.GetJointTranslation_s_pA=new j,Yi.GetJointTranslation_s_pB=new j,Yi.GetJointTranslation_s_d=new j,Yi.GetJointTranslation_s_axis=new j;var Qi=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_pulleyJoint)||this).groundAnchorA=new j(-1,1),i.groundAnchorB=new j(1,1),i.localAnchorA=new j(-1,0),i.localAnchorB=new j(1,0),i.lengthA=0,i.lengthB=0,i.ratio=1,i.collideConnected=!0,i}return s(i,e),i.prototype.Initialize=function(t,e,i,n,r,s,a){this.bodyA=t,this.bodyB=e,this.groundAnchorA.Copy(i),this.groundAnchorB.Copy(n),this.bodyA.GetLocalPoint(r,this.localAnchorA),this.bodyB.GetLocalPoint(s,this.localAnchorB),this.lengthA=j.DistanceVV(r,i),this.lengthB=j.DistanceVV(s,n),this.ratio=a},i}(ki),Ji=function(t){function i(i){var n;return(n=t.call(this,i)||this).m_groundAnchorA=new j,n.m_groundAnchorB=new j,n.m_lengthA=0,n.m_lengthB=0,n.m_localAnchorA=new j,n.m_localAnchorB=new j,n.m_constant=0,n.m_ratio=0,n.m_impulse=0,n.m_indexA=0,n.m_indexB=0,n.m_uA=new j,n.m_uB=new j,n.m_rA=new j,n.m_rB=new j,n.m_localCenterA=new j,n.m_localCenterB=new j,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_mass=0,n.m_qA=new J,n.m_qB=new J,n.m_lalcA=new j,n.m_lalcB=new j,n.m_groundAnchorA.Copy(e(i.groundAnchorA,new j(-1,1))),n.m_groundAnchorB.Copy(e(i.groundAnchorB,new j(1,0))),n.m_localAnchorA.Copy(e(i.localAnchorA,new j(-1,0))),n.m_localAnchorB.Copy(e(i.localAnchorB,new j(1,0))),n.m_lengthA=e(i.lengthA,0),n.m_lengthB=e(i.lengthB,0),n.m_ratio=e(i.ratio,1),n.m_constant=e(i.lengthA,0)+n.m_ratio*e(i.lengthB,0),n.m_impulse=0,n}s(i,t);var n=i.prototype;return n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.velocities[this.m_indexA].v,s=t.velocities[this.m_indexA].w,a=t.positions[this.m_indexB].c,o=t.positions[this.m_indexB].a,h=t.velocities[this.m_indexB].v,u=t.velocities[this.m_indexB].w,l=this.m_qA.SetAngle(n),c=this.m_qB.SetAngle(o);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),J.MulRV(l,this.m_lalcA,this.m_rA),j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),J.MulRV(c,this.m_lalcB,this.m_rB),this.m_uA.Copy(e).SelfAdd(this.m_rA).SelfSub(this.m_groundAnchorA),this.m_uB.Copy(a).SelfAdd(this.m_rB).SelfSub(this.m_groundAnchorB);var f=this.m_uA.Length(),d=this.m_uB.Length();f>.08?this.m_uA.SelfMul(1/f):this.m_uA.SetZero(),d>.08?this.m_uB.SelfMul(1/d):this.m_uB.SetZero();var _=j.CrossVV(this.m_rA,this.m_uA),p=j.CrossVV(this.m_rB,this.m_uB),m=this.m_invMassA+this.m_invIA*_*_,g=this.m_invMassB+this.m_invIB*p*p;if(this.m_mass=m+this.m_ratio*this.m_ratio*g,this.m_mass>0&&(this.m_mass=1/this.m_mass),t.step.warmStarting){this.m_impulse*=t.step.dtRatio;var v=j.MulSV(-this.m_impulse,this.m_uA,i.InitVelocityConstraints_s_PA),y=j.MulSV(-this.m_ratio*this.m_impulse,this.m_uB,i.InitVelocityConstraints_s_PB);r.SelfMulAdd(this.m_invMassA,v),s+=this.m_invIA*j.CrossVV(this.m_rA,v),h.SelfMulAdd(this.m_invMassB,y),u+=this.m_invIB*j.CrossVV(this.m_rB,y)}else this.m_impulse=0;t.velocities[this.m_indexA].w=s,t.velocities[this.m_indexB].w=u},n.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=j.AddVCrossSV(e,n,this.m_rA,i.SolveVelocityConstraints_s_vpA),o=j.AddVCrossSV(r,s,this.m_rB,i.SolveVelocityConstraints_s_vpB),h=-j.DotVV(this.m_uA,a)-this.m_ratio*j.DotVV(this.m_uB,o),u=-this.m_mass*h;this.m_impulse+=u;var l=j.MulSV(-u,this.m_uA,i.SolveVelocityConstraints_s_PA),c=j.MulSV(-this.m_ratio*u,this.m_uB,i.SolveVelocityConstraints_s_PB);e.SelfMulAdd(this.m_invMassA,l),n+=this.m_invIA*j.CrossVV(this.m_rA,l),r.SelfMulAdd(this.m_invMassB,c),s+=this.m_invIB*j.CrossVV(this.m_rB,c),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=J.MulRV(a,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u=J.MulRV(o,this.m_lalcB,this.m_rB),c=this.m_uA.Copy(e).SelfAdd(h).SelfSub(this.m_groundAnchorA),f=this.m_uB.Copy(r).SelfAdd(u).SelfSub(this.m_groundAnchorB),d=c.Length(),_=f.Length();d>.08?c.SelfMul(1/d):c.SetZero(),_>.08?f.SelfMul(1/_):f.SetZero();var p=j.CrossVV(h,c),m=j.CrossVV(u,f),g=this.m_invMassA+this.m_invIA*p*p,v=this.m_invMassB+this.m_invIB*m*m,y=g+this.m_ratio*this.m_ratio*v;y>0&&(y=1/y);var b=this.m_constant-d-this.m_ratio*_,S=P(b),x=-y*b,w=j.MulSV(-x,c,i.SolvePositionConstraints_s_PA),T=j.MulSV(-this.m_ratio*x,f,i.SolvePositionConstraints_s_PB);return e.SelfMulAdd(this.m_invMassA,w),n+=this.m_invIA*j.CrossVV(h,w),r.SelfMulAdd(this.m_invMassB,T),s+=this.m_invIB*j.CrossVV(u,T),t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,S0&&(this.m_motorMass=1/this.m_motorMass),this.m_enableMotor&&!m||(this.m_motorImpulse=0),this.m_enableLimit&&!m){var g=a-i-this.m_referenceAngle;P(this.m_upperAngle-this.m_lowerAngle)<2*c?this.m_limitState=t.b2LimitState.e_equalLimits:g<=this.m_lowerAngle?(this.m_limitState!==t.b2LimitState.e_atLowerLimit&&(this.m_impulse.z=0),this.m_limitState=t.b2LimitState.e_atLowerLimit):g>=this.m_upperAngle?(this.m_limitState!==t.b2LimitState.e_atUpperLimit&&(this.m_impulse.z=0),this.m_limitState=t.b2LimitState.e_atUpperLimit):(this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0)}else this.m_limitState=t.b2LimitState.e_inactiveLimit;if(e.step.warmStarting){this.m_impulse.SelfMul(e.step.dtRatio),this.m_motorImpulse*=e.step.dtRatio;var v=n.InitVelocityConstraints_s_P.Set(this.m_impulse.x,this.m_impulse.y);r.SelfMulSub(f,v),s-=_*(j.CrossVV(this.m_rA,v)+this.m_motorImpulse+this.m_impulse.z),o.SelfMulAdd(d,v),h+=p*(j.CrossVV(this.m_rB,v)+this.m_motorImpulse+this.m_impulse.z)}else this.m_impulse.SetZero(),this.m_motorImpulse=0;e.velocities[this.m_indexA].w=s,e.velocities[this.m_indexB].w=h},r.SolveVelocityConstraints=function(e){var i=e.velocities[this.m_indexA].v,r=e.velocities[this.m_indexA].w,s=e.velocities[this.m_indexB].v,a=e.velocities[this.m_indexB].w,o=this.m_invMassA,h=this.m_invMassB,u=this.m_invIA,l=this.m_invIB,c=u+l===0;if(this.m_enableMotor&&this.m_limitState!==t.b2LimitState.e_equalLimits&&!c){var f=a-r-this.m_motorSpeed,d=-this.m_motorMass*f,_=this.m_motorImpulse,p=e.step.dt*this.m_maxMotorTorque;this.m_motorImpulse=R(this.m_motorImpulse+d,-p,p),r-=u*(d=this.m_motorImpulse-_),a+=l*d}if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit&&!c){var m=j.SubVV(j.AddVCrossSV(s,a,this.m_rB,j.s_t0),j.AddVCrossSV(i,r,this.m_rA,j.s_t1),n.SolveVelocityConstraints_s_Cdot1),g=a-r,v=this.m_mass.Solve33(m.x,m.y,g,n.SolveVelocityConstraints_s_impulse_v3).SelfNeg();if(this.m_limitState===t.b2LimitState.e_equalLimits)this.m_impulse.SelfAdd(v);else if(this.m_limitState===t.b2LimitState.e_atLowerLimit)if(this.m_impulse.z+v.z<0){var y=-m.x+this.m_impulse.z*this.m_mass.ez.x,b=-m.y+this.m_impulse.z*this.m_mass.ez.y,S=this.m_mass.Solve22(y,b,n.SolveVelocityConstraints_s_reduced_v2);v.x=S.x,v.y=S.y,v.z=-this.m_impulse.z,this.m_impulse.x+=S.x,this.m_impulse.y+=S.y,this.m_impulse.z=0}else this.m_impulse.SelfAdd(v);else if(this.m_limitState===t.b2LimitState.e_atUpperLimit)if(this.m_impulse.z+v.z>0){var x=-m.x+this.m_impulse.z*this.m_mass.ez.x,w=-m.y+this.m_impulse.z*this.m_mass.ez.y,T=this.m_mass.Solve22(x,w,n.SolveVelocityConstraints_s_reduced_v2);v.x=T.x,v.y=T.y,v.z=-this.m_impulse.z,this.m_impulse.x+=T.x,this.m_impulse.y+=T.y,this.m_impulse.z=0}else this.m_impulse.SelfAdd(v);var C=n.SolveVelocityConstraints_s_P.Set(v.x,v.y);i.SelfMulSub(o,C),r-=u*(j.CrossVV(this.m_rA,C)+v.z),s.SelfMulAdd(h,C),a+=l*(j.CrossVV(this.m_rB,C)+v.z)}else{var A=j.SubVV(j.AddVCrossSV(s,a,this.m_rB,j.s_t0),j.AddVCrossSV(i,r,this.m_rA,j.s_t1),n.SolveVelocityConstraints_s_Cdot_v2),D=this.m_mass.Solve22(-A.x,-A.y,n.SolveVelocityConstraints_s_impulse_v2);this.m_impulse.x+=D.x,this.m_impulse.y+=D.y,i.SelfMulSub(o,D),r-=u*j.CrossVV(this.m_rA,D),s.SelfMulAdd(h,D),a+=l*j.CrossVV(this.m_rB,D)}e.velocities[this.m_indexA].w=r,e.velocities[this.m_indexB].w=a},r.SolvePositionConstraints=function(e){var i,r=e.positions[this.m_indexA].c,s=e.positions[this.m_indexA].a,a=e.positions[this.m_indexB].c,o=e.positions[this.m_indexB].a,h=this.m_qA.SetAngle(s),u=this.m_qB.SetAngle(o),f=0,d=this.m_invIA+this.m_invIB===0;if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit&&!d){var p=o-s-this.m_referenceAngle,m=0;if(this.m_limitState===t.b2LimitState.e_equalLimits){var g=R(p-this.m_lowerAngle,-.13962634015955555,_);m=-this.m_motorMass*g,f=P(g)}else if(this.m_limitState===t.b2LimitState.e_atLowerLimit){var v=p-this.m_lowerAngle;f=-v,v=R(v+c,-.13962634015955555,0),m=-this.m_motorMass*v}else if(this.m_limitState===t.b2LimitState.e_atUpperLimit){var y=p-this.m_upperAngle;f=y,y=R(y-c,0,_),m=-this.m_motorMass*y}s-=this.m_invIA*m,o+=this.m_invIB*m}h.SetAngle(s),u.SetAngle(o),j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var b=J.MulRV(h,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var S=J.MulRV(u,this.m_lalcB,this.m_rB),x=j.SubVV(j.AddVV(a,S,j.s_t0),j.AddVV(r,b,j.s_t1),n.SolvePositionConstraints_s_C_v2);i=x.Length();var w=this.m_invMassA,T=this.m_invMassB,C=this.m_invIA,A=this.m_invIB,D=this.m_K;D.ex.x=w+T+C*b.y*b.y+A*S.y*S.y,D.ex.y=-C*b.x*b.y-A*S.x*S.y,D.ey.x=D.ex.y,D.ey.y=w+T+C*b.x*b.x+A*S.x*S.x;var I=D.Solve(x.x,x.y,n.SolvePositionConstraints_s_impulse).SelfNeg();return r.SelfMulSub(w,I),s-=C*j.CrossVV(b,I),a.SelfMulAdd(T,I),o+=A*j.CrossVV(S,I),e.positions[this.m_indexA].a=s,e.positions[this.m_indexB].a=o,i<=l&&f<=c},r.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},r.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},r.GetReactionForce=function(t,e){return e.x=t*this.m_impulse.x,e.y=t*this.m_impulse.y,e},r.GetReactionTorque=function(t){return t*this.m_impulse.z},r.GetLocalAnchorA=function(){return this.m_localAnchorA},r.GetLocalAnchorB=function(){return this.m_localAnchorB},r.GetReferenceAngle=function(){return this.m_referenceAngle},r.GetJointAngle=function(){return this.m_bodyB.m_sweep.a-this.m_bodyA.m_sweep.a-this.m_referenceAngle},r.GetJointSpeed=function(){return this.m_bodyB.m_angularVelocity-this.m_bodyA.m_angularVelocity},r.IsMotorEnabled=function(){return this.m_enableMotor},r.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},r.GetMotorTorque=function(t){return t*this.m_motorImpulse},r.GetMotorSpeed=function(){return this.m_motorSpeed},r.SetMaxMotorTorque=function(t){t!==this.m_maxMotorTorque&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorTorque=t)},r.GetMaxMotorTorque=function(){return this.m_maxMotorTorque},r.IsLimitEnabled=function(){return this.m_enableLimit},r.EnableLimit=function(t){t!==this.m_enableLimit&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableLimit=t,this.m_impulse.z=0)},r.GetLowerLimit=function(){return this.m_lowerAngle},r.GetUpperLimit=function(){return this.m_upperAngle},r.SetLimits=function(t,e){t===this.m_lowerAngle&&e===this.m_upperAngle||(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_impulse.z=0,this.m_lowerAngle=t,this.m_upperAngle=e)},r.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},r.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2RevoluteJointDef = new b2RevoluteJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.enableLimit = %s;\n",this.m_enableLimit?"true":"false"),t(" jd.lowerAngle = %.15f;\n",this.m_lowerAngle),t(" jd.upperAngle = %.15f;\n",this.m_upperAngle),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorTorque = %.15f;\n",this.m_maxMotorTorque),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n}(Ri);Zi.InitVelocityConstraints_s_P=new j,Zi.SolveVelocityConstraints_s_P=new j,Zi.SolveVelocityConstraints_s_Cdot_v2=new j,Zi.SolveVelocityConstraints_s_Cdot1=new j,Zi.SolveVelocityConstraints_s_impulse_v3=new X,Zi.SolveVelocityConstraints_s_reduced_v2=new j,Zi.SolveVelocityConstraints_s_impulse_v2=new j,Zi.SolvePositionConstraints_s_C_v2=new j,Zi.SolvePositionConstraints_s_impulse=new j;var $i=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_ropeJoint)||this).localAnchorA=new j(-1,0),i.localAnchorB=new j(1,0),i.maxLength=0,i}return s(i,e),i}(ki),tn=function(i){function n(n){var r;return(r=i.call(this,n)||this).m_localAnchorA=new j,r.m_localAnchorB=new j,r.m_maxLength=0,r.m_length=0,r.m_impulse=0,r.m_indexA=0,r.m_indexB=0,r.m_u=new j,r.m_rA=new j,r.m_rB=new j,r.m_localCenterA=new j,r.m_localCenterB=new j,r.m_invMassA=0,r.m_invMassB=0,r.m_invIA=0,r.m_invIB=0,r.m_mass=0,r.m_state=t.b2LimitState.e_inactiveLimit,r.m_qA=new J,r.m_qB=new J,r.m_lalcA=new j,r.m_lalcB=new j,r.m_localAnchorA.Copy(e(n.localAnchorA,new j(-1,0))),r.m_localAnchorB.Copy(e(n.localAnchorB,new j(1,0))),r.m_maxLength=e(n.maxLength,0),r}s(n,i);var r=n.prototype;return r.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=e.positions[this.m_indexA].c,r=e.positions[this.m_indexA].a,s=e.velocities[this.m_indexA].v,a=e.velocities[this.m_indexA].w,o=e.positions[this.m_indexB].c,h=e.positions[this.m_indexB].a,u=e.velocities[this.m_indexB].v,c=e.velocities[this.m_indexB].w,f=this.m_qA.SetAngle(r),d=this.m_qB.SetAngle(h);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),J.MulRV(f,this.m_lalcA,this.m_rA),j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),J.MulRV(d,this.m_lalcB,this.m_rB),this.m_u.Copy(o).SelfAdd(this.m_rB).SelfSub(i).SelfSub(this.m_rA),this.m_length=this.m_u.Length();var _=this.m_length-this.m_maxLength;if(this.m_state=_>0?t.b2LimitState.e_atUpperLimit:t.b2LimitState.e_inactiveLimit,!(this.m_length>l))return this.m_u.SetZero(),this.m_mass=0,void(this.m_impulse=0);this.m_u.SelfMul(1/this.m_length);var p=j.CrossVV(this.m_rA,this.m_u),m=j.CrossVV(this.m_rB,this.m_u),g=this.m_invMassA+this.m_invIA*p*p+this.m_invMassB+this.m_invIB*m*m;if(this.m_mass=0!==g?1/g:0,e.step.warmStarting){this.m_impulse*=e.step.dtRatio;var v=j.MulSV(this.m_impulse,this.m_u,n.InitVelocityConstraints_s_P);s.SelfMulSub(this.m_invMassA,v),a-=this.m_invIA*j.CrossVV(this.m_rA,v),u.SelfMulAdd(this.m_invMassB,v),c+=this.m_invIB*j.CrossVV(this.m_rB,v)}else this.m_impulse=0;e.velocities[this.m_indexA].w=a,e.velocities[this.m_indexB].w=c},r.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,i=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=j.AddVCrossSV(e,i,this.m_rA,n.SolveVelocityConstraints_s_vpA),o=j.AddVCrossSV(r,s,this.m_rB,n.SolveVelocityConstraints_s_vpB),h=this.m_length-this.m_maxLength,u=j.DotVV(this.m_u,j.SubVV(o,a,j.s_t0));h<0&&(u+=t.step.inv_dt*h);var l=-this.m_mass*u,c=this.m_impulse;this.m_impulse=E(0,this.m_impulse+l),l=this.m_impulse-c;var f=j.MulSV(l,this.m_u,n.SolveVelocityConstraints_s_P);e.SelfMulSub(this.m_invMassA,f),i-=this.m_invIA*j.CrossVV(this.m_rA,f),r.SelfMulAdd(this.m_invMassB,f),s+=this.m_invIB*j.CrossVV(this.m_rB,f),t.velocities[this.m_indexA].w=i,t.velocities[this.m_indexB].w=s},r.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,i=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(i),o=this.m_qB.SetAngle(s);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=J.MulRV(a,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u=J.MulRV(o,this.m_lalcB,this.m_rB),c=this.m_u.Copy(r).SelfAdd(u).SelfSub(e).SelfSub(h),f=c.Normalize(),_=f-this.m_maxLength;_=R(_,0,d);var p=-this.m_mass*_,m=j.MulSV(p,c,n.SolvePositionConstraints_s_P);return e.SelfMulSub(this.m_invMassA,m),i-=this.m_invIA*j.CrossVV(h,m),r.SelfMulAdd(this.m_invMassB,m),s+=this.m_invIB*j.CrossVV(u,m),t.positions[this.m_indexA].a=i,t.positions[this.m_indexB].a=s,f-this.m_maxLength0){p.GetInverse22(this.m_mass);var m=d+_,g=m>0?1/m:0,v=s-e-this.m_referenceAngle,y=2*o*this.m_frequencyHz,b=2*g*this.m_dampingRatio*y,S=g*y*y,x=t.step.dt;this.m_gamma=x*(b+x*S),this.m_gamma=0!==this.m_gamma?1/this.m_gamma:0,this.m_bias=v*x*S*this.m_gamma,m+=this.m_gamma,this.m_mass.ez.z=0!==m?1/m:0}else p.GetSymInverse33(this.m_mass),this.m_gamma=0,this.m_bias=0;if(t.step.warmStarting){this.m_impulse.SelfMul(t.step.dtRatio);var w=i.InitVelocityConstraints_s_P.Set(this.m_impulse.x,this.m_impulse.y);n.SelfMulSub(c,w),r-=d*(j.CrossVV(this.m_rA,w)+this.m_impulse.z),a.SelfMulAdd(f,w),h+=_*(j.CrossVV(this.m_rB,w)+this.m_impulse.z)}else this.m_impulse.SetZero();t.velocities[this.m_indexA].w=r,t.velocities[this.m_indexB].w=h},n.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=this.m_invMassA,o=this.m_invMassB,h=this.m_invIA,u=this.m_invIB;if(this.m_frequencyHz>0){var l=s-n,c=-this.m_mass.ez.z*(l+this.m_bias+this.m_gamma*this.m_impulse.z);this.m_impulse.z+=c,n-=h*c,s+=u*c;var f=j.SubVV(j.AddVCrossSV(r,s,this.m_rB,j.s_t0),j.AddVCrossSV(e,n,this.m_rA,j.s_t1),i.SolveVelocityConstraints_s_Cdot1),d=Q.MulM33XY(this.m_mass,f.x,f.y,i.SolveVelocityConstraints_s_impulse1).SelfNeg();this.m_impulse.x+=d.x,this.m_impulse.y+=d.y;var _=d;e.SelfMulSub(a,_),n-=h*j.CrossVV(this.m_rA,_),r.SelfMulAdd(o,_),s+=u*j.CrossVV(this.m_rB,_)}else{var p=j.SubVV(j.AddVCrossSV(r,s,this.m_rB,j.s_t0),j.AddVCrossSV(e,n,this.m_rA,j.s_t1),i.SolveVelocityConstraints_s_Cdot1),m=s-n,g=Q.MulM33XYZ(this.m_mass,p.x,p.y,m,i.SolveVelocityConstraints_s_impulse).SelfNeg();this.m_impulse.SelfAdd(g);var v=i.SolveVelocityConstraints_s_P.Set(g.x,g.y);e.SelfMulSub(a,v),n-=h*(j.CrossVV(this.m_rA,v)+g.z),r.SelfMulAdd(o,v),s+=u*(j.CrossVV(this.m_rB,v)+g.z)}t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s),h=this.m_invMassA,u=this.m_invMassB,f=this.m_invIA,d=this.m_invIB;j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var _=J.MulRV(a,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var p,m,g=J.MulRV(o,this.m_lalcB,this.m_rB),v=this.m_K;if(v.ex.x=h+u+_.y*_.y*f+g.y*g.y*d,v.ey.x=-_.y*_.x*f-g.y*g.x*d,v.ez.x=-_.y*f-g.y*d,v.ex.y=v.ey.x,v.ey.y=h+u+_.x*_.x*f+g.x*g.x*d,v.ez.y=_.x*f+g.x*d,v.ex.z=v.ez.x,v.ey.z=v.ez.y,v.ez.z=f+d,this.m_frequencyHz>0){var y=j.SubVV(j.AddVV(r,g,j.s_t0),j.AddVV(e,_,j.s_t1),i.SolvePositionConstraints_s_C1);p=y.Length(),m=0;var b=v.Solve22(y.x,y.y,i.SolvePositionConstraints_s_P).SelfNeg();e.SelfMulSub(h,b),n-=f*j.CrossVV(_,b),r.SelfMulAdd(u,b),s+=d*j.CrossVV(g,b)}else{var S=j.SubVV(j.AddVV(r,g,j.s_t0),j.AddVV(e,_,j.s_t1),i.SolvePositionConstraints_s_C1),x=s-n-this.m_referenceAngle;p=S.Length(),m=P(x);var w=v.Solve33(S.x,S.y,x,i.SolvePositionConstraints_s_impulse).SelfNeg(),T=i.SolvePositionConstraints_s_P.Set(w.x,w.y);e.SelfMulSub(h,T),n-=f*(j.CrossVV(this.m_rA,T)+w.z),r.SelfMulAdd(u,T),s+=d*(j.CrossVV(this.m_rB,T)+w.z)}return t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,p<=l&&m<=c},n.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return e.x=t*this.m_impulse.x,e.y=t*this.m_impulse.y,e},n.GetReactionTorque=function(t){return t*this.m_impulse.z},n.GetLocalAnchorA=function(){return this.m_localAnchorA},n.GetLocalAnchorB=function(){return this.m_localAnchorB},n.GetReferenceAngle=function(){return this.m_referenceAngle},n.SetFrequency=function(t){this.m_frequencyHz=t},n.GetFrequency=function(){return this.m_frequencyHz},n.SetDampingRatio=function(t){this.m_dampingRatio=t},n.GetDampingRatio=function(){return this.m_dampingRatio},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2WeldJointDef = new b2WeldJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i}(Ri);nn.InitVelocityConstraints_s_P=new j,nn.SolveVelocityConstraints_s_Cdot1=new j,nn.SolveVelocityConstraints_s_impulse1=new j,nn.SolveVelocityConstraints_s_impulse=new X,nn.SolveVelocityConstraints_s_P=new j,nn.SolvePositionConstraints_s_C1=new j,nn.SolvePositionConstraints_s_P=new j,nn.SolvePositionConstraints_s_impulse=new X;var rn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_wheelJoint)||this).localAnchorA=new j(0,0),i.localAnchorB=new j(0,0),i.localAxisA=new j(1,0),i.enableMotor=!1,i.maxMotorTorque=0,i.motorSpeed=0,i.frequencyHz=2,i.dampingRatio=.7,i}return s(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB),this.bodyA.GetLocalVector(n,this.localAxisA)},i}(ki),sn=function(t){function i(i){var n;return(n=t.call(this,i)||this).m_frequencyHz=0,n.m_dampingRatio=0,n.m_localAnchorA=new j,n.m_localAnchorB=new j,n.m_localXAxisA=new j,n.m_localYAxisA=new j,n.m_impulse=0,n.m_motorImpulse=0,n.m_springImpulse=0,n.m_maxMotorTorque=0,n.m_motorSpeed=0,n.m_enableMotor=!1,n.m_indexA=0,n.m_indexB=0,n.m_localCenterA=new j,n.m_localCenterB=new j,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_ax=new j,n.m_ay=new j,n.m_sAx=0,n.m_sBx=0,n.m_sAy=0,n.m_sBy=0,n.m_mass=0,n.m_motorMass=0,n.m_springMass=0,n.m_bias=0,n.m_gamma=0,n.m_qA=new J,n.m_qB=new J,n.m_lalcA=new j,n.m_lalcB=new j,n.m_rA=new j,n.m_rB=new j,n.m_frequencyHz=e(i.frequencyHz,2),n.m_dampingRatio=e(i.dampingRatio,.7),n.m_localAnchorA.Copy(e(i.localAnchorA,j.ZERO)),n.m_localAnchorB.Copy(e(i.localAnchorB,j.ZERO)),n.m_localXAxisA.Copy(e(i.localAxisA,j.UNITX)),j.CrossOneV(n.m_localXAxisA,n.m_localYAxisA),n.m_maxMotorTorque=e(i.maxMotorTorque,0),n.m_motorSpeed=e(i.motorSpeed,0),n.m_enableMotor=e(i.enableMotor,!1),n.m_ax.SetZero(),n.m_ay.SetZero(),n}s(i,t);var n=i.prototype;return n.GetMotorSpeed=function(){return this.m_motorSpeed},n.GetMaxMotorTorque=function(){return this.m_maxMotorTorque},n.SetSpringFrequencyHz=function(t){this.m_frequencyHz=t},n.GetSpringFrequencyHz=function(){return this.m_frequencyHz},n.SetSpringDampingRatio=function(t){this.m_dampingRatio=t},n.GetSpringDampingRatio=function(){return this.m_dampingRatio},n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=this.m_invMassA,n=this.m_invMassB,r=this.m_invIA,s=this.m_invIB,a=t.positions[this.m_indexA].c,h=t.positions[this.m_indexA].a,u=t.velocities[this.m_indexA].v,l=t.velocities[this.m_indexA].w,c=t.positions[this.m_indexB].c,f=t.positions[this.m_indexB].a,d=t.velocities[this.m_indexB].v,_=t.velocities[this.m_indexB].w,p=this.m_qA.SetAngle(h),m=this.m_qB.SetAngle(f);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var g=J.MulRV(p,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var v=J.MulRV(m,this.m_lalcB,this.m_rB),y=j.SubVV(j.AddVV(c,v,j.s_t0),j.AddVV(a,g,j.s_t1),i.InitVelocityConstraints_s_d);if(J.MulRV(p,this.m_localYAxisA,this.m_ay),this.m_sAy=j.CrossVV(j.AddVV(y,g,j.s_t0),this.m_ay),this.m_sBy=j.CrossVV(v,this.m_ay),this.m_mass=e+n+r*this.m_sAy*this.m_sAy+s*this.m_sBy*this.m_sBy,this.m_mass>0&&(this.m_mass=1/this.m_mass),this.m_springMass=0,this.m_bias=0,this.m_gamma=0,this.m_frequencyHz>0){J.MulRV(p,this.m_localXAxisA,this.m_ax),this.m_sAx=j.CrossVV(j.AddVV(y,g,j.s_t0),this.m_ax),this.m_sBx=j.CrossVV(v,this.m_ax);var b=e+n+r*this.m_sAx*this.m_sAx+s*this.m_sBx*this.m_sBx;if(b>0){this.m_springMass=1/b;var S=j.DotVV(y,this.m_ax),x=2*o*this.m_frequencyHz,w=2*this.m_springMass*this.m_dampingRatio*x,T=this.m_springMass*x*x,C=t.step.dt;this.m_gamma=C*(w+C*T),this.m_gamma>0&&(this.m_gamma=1/this.m_gamma),this.m_bias=S*C*T*this.m_gamma,this.m_springMass=b+this.m_gamma,this.m_springMass>0&&(this.m_springMass=1/this.m_springMass)}}else this.m_springImpulse=0;if(this.m_enableMotor?(this.m_motorMass=r+s,this.m_motorMass>0&&(this.m_motorMass=1/this.m_motorMass)):(this.m_motorMass=0,this.m_motorImpulse=0),t.step.warmStarting){this.m_impulse*=t.step.dtRatio,this.m_springImpulse*=t.step.dtRatio,this.m_motorImpulse*=t.step.dtRatio;var A=j.AddVV(j.MulSV(this.m_impulse,this.m_ay,j.s_t0),j.MulSV(this.m_springImpulse,this.m_ax,j.s_t1),i.InitVelocityConstraints_s_P),D=this.m_impulse*this.m_sAy+this.m_springImpulse*this.m_sAx+this.m_motorImpulse,I=this.m_impulse*this.m_sBy+this.m_springImpulse*this.m_sBx+this.m_motorImpulse;u.SelfMulSub(this.m_invMassA,A),l-=this.m_invIA*D,d.SelfMulAdd(this.m_invMassB,A),_+=this.m_invIB*I}else this.m_impulse=0,this.m_springImpulse=0,this.m_motorImpulse=0;t.velocities[this.m_indexA].w=l,t.velocities[this.m_indexB].w=_},n.SolveVelocityConstraints=function(t){var e=this.m_invMassA,n=this.m_invMassB,r=this.m_invIA,s=this.m_invIB,a=t.velocities[this.m_indexA].v,o=t.velocities[this.m_indexA].w,h=t.velocities[this.m_indexB].v,u=t.velocities[this.m_indexB].w,l=j.DotVV(this.m_ax,j.SubVV(h,a,j.s_t0))+this.m_sBx*u-this.m_sAx*o,c=-this.m_springMass*(l+this.m_bias+this.m_gamma*this.m_springImpulse);this.m_springImpulse+=c;var f=j.MulSV(c,this.m_ax,i.SolveVelocityConstraints_s_P),d=c*this.m_sAx,_=c*this.m_sBx;a.SelfMulSub(e,f),o-=r*d,h.SelfMulAdd(n,f);var p=(u+=s*_)-o-this.m_motorSpeed,m=-this.m_motorMass*p,g=this.m_motorImpulse,v=t.step.dt*this.m_maxMotorTorque;this.m_motorImpulse=R(this.m_motorImpulse+m,-v,v),o-=r*(m=this.m_motorImpulse-g),u+=s*m;var y=j.DotVV(this.m_ay,j.SubVV(h,a,j.s_t0))+this.m_sBy*u-this.m_sAy*o,b=-this.m_mass*y;this.m_impulse+=b;var S=j.MulSV(b,this.m_ay,i.SolveVelocityConstraints_s_P),x=b*this.m_sAy,w=b*this.m_sBy;a.SelfMulSub(e,S),o-=r*x,h.SelfMulAdd(n,S),u+=s*w,t.velocities[this.m_indexA].w=o,t.velocities[this.m_indexB].w=u},n.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=J.MulRV(a,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u,c=J.MulRV(o,this.m_lalcB,this.m_rB),f=j.AddVV(j.SubVV(r,e,j.s_t0),j.SubVV(c,h,j.s_t1),i.SolvePositionConstraints_s_d),d=J.MulRV(a,this.m_localYAxisA,this.m_ay),_=j.CrossVV(j.AddVV(f,h,j.s_t0),d),p=j.CrossVV(c,d),m=j.DotVV(f,this.m_ay),g=this.m_invMassA+this.m_invMassB+this.m_invIA*this.m_sAy*this.m_sAy+this.m_invIB*this.m_sBy*this.m_sBy;u=0!==g?-m/g:0;var v=j.MulSV(u,d,i.SolvePositionConstraints_s_P),y=u*_,b=u*p;return e.SelfMulSub(this.m_invMassA,v),n-=this.m_invIA*y,r.SelfMulAdd(this.m_invMassB,v),s+=this.m_invIB*b,t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,P(m)<=l},n.GetDefinition=function(t){return t},n.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return e.x=t*(this.m_impulse*this.m_ay.x+this.m_springImpulse*this.m_ax.x),e.y=t*(this.m_impulse*this.m_ay.y+this.m_springImpulse*this.m_ax.y),e},n.GetReactionTorque=function(t){return t*this.m_motorImpulse},n.GetLocalAnchorA=function(){return this.m_localAnchorA},n.GetLocalAnchorB=function(){return this.m_localAnchorB},n.GetLocalAxisA=function(){return this.m_localXAxisA},n.GetJointTranslation=function(){return this.GetPrismaticJointTranslation()},n.GetJointLinearSpeed=function(){return this.GetPrismaticJointSpeed()},n.GetJointAngle=function(){return this.GetRevoluteJointAngle()},n.GetJointAngularSpeed=function(){return this.GetRevoluteJointSpeed()},n.GetPrismaticJointTranslation=function(){var t=this.m_bodyA,e=this.m_bodyB,i=t.GetWorldPoint(this.m_localAnchorA,new j),n=e.GetWorldPoint(this.m_localAnchorB,new j),r=j.SubVV(n,i,new j),s=t.GetWorldVector(this.m_localXAxisA,new j);return j.DotVV(r,s)},n.GetPrismaticJointSpeed=function(){var t=this.m_bodyA,e=this.m_bodyB;j.SubVV(this.m_localAnchorA,t.m_sweep.localCenter,this.m_lalcA);var i=J.MulRV(t.m_xf.q,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,e.m_sweep.localCenter,this.m_lalcB);var n=J.MulRV(e.m_xf.q,this.m_lalcB,this.m_rB),r=j.AddVV(t.m_sweep.c,i,j.s_t0),s=j.AddVV(e.m_sweep.c,n,j.s_t1),a=j.SubVV(s,r,j.s_t2),o=t.GetWorldVector(this.m_localXAxisA,new j),h=t.m_linearVelocity,u=e.m_linearVelocity,l=t.m_angularVelocity,c=e.m_angularVelocity;return j.DotVV(a,j.CrossSV(l,o,j.s_t0))+j.DotVV(o,j.SubVV(j.AddVCrossSV(u,c,n,j.s_t0),j.AddVCrossSV(h,l,i,j.s_t1),j.s_t0))},n.GetRevoluteJointAngle=function(){return this.m_bodyB.m_sweep.a-this.m_bodyA.m_sweep.a},n.GetRevoluteJointSpeed=function(){var t=this.m_bodyA.m_angularVelocity;return this.m_bodyB.m_angularVelocity-t},n.IsMotorEnabled=function(){return this.m_enableMotor},n.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},n.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},n.SetMaxMotorTorque=function(t){t!==this.m_maxMotorTorque&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorTorque=t)},n.GetMotorTorque=function(t){return t*this.m_motorImpulse},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2WheelJointDef = new b2WheelJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.localAxisA.Set(%.15f, %.15f);\n",this.m_localXAxisA.x,this.m_localXAxisA.y),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorTorque = %.15f;\n",this.m_maxMotorTorque),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i}(Ri);function an(t,e){return V(t*e)}function on(t,e){return t>e?t:e}sn.InitVelocityConstraints_s_d=new j,sn.InitVelocityConstraints_s_P=new j,sn.SolveVelocityConstraints_s_P=new j,sn.SolvePositionConstraints_s_d=new j,sn.SolvePositionConstraints_s_P=new j;var hn=function(){function t(t){this._other=null,this.prev=null,this.next=null,this.contact=t}return t.prototype.Reset=function(){this._other=null,this.prev=null,this.next=null},n(t,[{key:"other",get:function(){if(null===this._other)throw new Error;return this._other},set:function(t){if(null!==this._other)throw new Error;this._other=t}}]),t}(),un=function(){function t(){this.m_islandFlag=!1,this.m_touchingFlag=!1,this.m_enabledFlag=!1,this.m_filterFlag=!1,this.m_bulletHitFlag=!1,this.m_toiFlag=!1,this.m_prev=null,this.m_next=null,this.m_nodeA=new hn(this),this.m_nodeB=new hn(this),this.m_indexA=0,this.m_indexB=0,this.m_manifold=new Rt,this.m_toiCount=0,this.m_toi=0,this.m_friction=0,this.m_restitution=0,this.m_tangentSpeed=0,this.m_oldManifold=new Rt}var e=t.prototype;return e.GetManifold=function(){return this.m_manifold},e.GetWorldManifold=function(t){var e=this.m_fixtureA.GetBody(),i=this.m_fixtureB.GetBody(),n=this.GetShapeA(),r=this.GetShapeB();t.Initialize(this.m_manifold,e.GetTransform(),n.m_radius,i.GetTransform(),r.m_radius)},e.IsTouching=function(){return this.m_touchingFlag},e.SetEnabled=function(t){this.m_enabledFlag=t},e.IsEnabled=function(){return this.m_enabledFlag},e.GetNext=function(){return this.m_next},e.GetFixtureA=function(){return this.m_fixtureA},e.GetChildIndexA=function(){return this.m_indexA},e.GetShapeA=function(){return this.m_fixtureA.GetShape()},e.GetFixtureB=function(){return this.m_fixtureB},e.GetChildIndexB=function(){return this.m_indexB},e.GetShapeB=function(){return this.m_fixtureB.GetShape()},e.FlagForFiltering=function(){this.m_filterFlag=!0},e.SetFriction=function(t){this.m_friction=t},e.GetFriction=function(){return this.m_friction},e.ResetFriction=function(){this.m_friction=an(this.m_fixtureA.m_friction,this.m_fixtureB.m_friction)},e.SetRestitution=function(t){this.m_restitution=t},e.GetRestitution=function(){return this.m_restitution},e.ResetRestitution=function(){this.m_restitution=on(this.m_fixtureA.m_restitution,this.m_fixtureB.m_restitution)},e.SetTangentSpeed=function(t){this.m_tangentSpeed=t},e.GetTangentSpeed=function(){return this.m_tangentSpeed},e.Reset=function(t,e,i,n){this.m_islandFlag=!1,this.m_touchingFlag=!1,this.m_enabledFlag=!0,this.m_filterFlag=!1,this.m_bulletHitFlag=!1,this.m_toiFlag=!1,this.m_fixtureA=t,this.m_fixtureB=i,this.m_indexA=e,this.m_indexB=n,this.m_manifold.pointCount=0,this.m_prev=null,this.m_next=null,this.m_nodeA.Reset(),this.m_nodeB.Reset(),this.m_toiCount=0,this.m_friction=an(this.m_fixtureA.m_friction,this.m_fixtureB.m_friction),this.m_restitution=on(this.m_fixtureA.m_restitution,this.m_fixtureB.m_restitution)},e.Update=function(t){var e=this.m_oldManifold;this.m_oldManifold=this.m_manifold,this.m_manifold=e,this.m_enabledFlag=!0;var i=!1,n=this.m_touchingFlag,r=this.m_fixtureA.IsSensor(),s=this.m_fixtureB.IsSensor(),a=r||s,o=this.m_fixtureA.GetBody(),h=this.m_fixtureB.GetBody(),u=o.GetTransform(),l=h.GetTransform();if(a){var c=this.GetShapeA(),f=this.GetShapeB();i=jt(c,this.m_indexA,f,this.m_indexB,u,l),this.m_manifold.pointCount=0}else{this.Evaluate(this.m_manifold,u,l),i=this.m_manifold.pointCount>0;for(var d=0;d0:!!(s.maskBits&a.categoryBits)&&!!(s.categoryBits&a.maskBits)},i.ShouldCollideFixtureParticle=function(){return!0},i.ShouldCollideParticleParticle=function(){return!0},e}();bn.b2_defaultFilter=new bn;var Sn=function(){this.normalImpulses=D(2),this.tangentImpulses=D(2),this.count=0},xn=function(){function t(){}var e=t.prototype;return e.BeginContact=function(){},e.EndContact=function(){},e.BeginContactFixtureParticle=function(){},e.EndContactFixtureParticle=function(){},e.BeginContactParticleParticle=function(){},e.EndContactParticleParticle=function(){},e.PreSolve=function(){},e.PostSolve=function(){},t}();xn.b2_defaultListener=new xn;var wn=function(){function t(){}var e=t.prototype;return e.ReportFixture=function(){return!0},e.ReportParticle=function(){return!1},e.ShouldQueryParticleSystem=function(){return!0},t}(),Tn=function(){function t(){}var e=t.prototype;return e.ReportFixture=function(t,e,i,n){return n},e.ReportParticle=function(){return 0},e.ShouldQueryParticleSystem=function(){return!0},t}(),Cn=function(){function e(){this.m_broadPhase=new $t,this.m_contactList=null,this.m_contactCount=0,this.m_contactFilter=bn.b2_defaultFilter,this.m_contactListener=xn.b2_defaultListener,this.m_contactFactory=new vn}var i=e.prototype;return i.AddPair=function(t,e){var i=t.fixture,n=e.fixture,r=t.childIndex,s=e.childIndex,a=i.GetBody(),o=n.GetBody();if(a!==o){for(var h=o.GetContactList();h;){if(h.other===a){var u=h.contact.GetFixtureA(),l=h.contact.GetFixtureB(),c=h.contact.GetChildIndexA(),f=h.contact.GetChildIndexB();if(u===i&&l===n&&c===r&&f===s)return;if(u===n&&l===i&&c===s&&f===r)return}h=h.next}if(!this.m_contactFilter||this.m_contactFilter.ShouldCollide(i,n)){var d=this.m_contactFactory.Create(i,r,n,s);null!==d&&(i=d.GetFixtureA(),n=d.GetFixtureB(),r=d.GetChildIndexA(),s=d.GetChildIndexB(),a=i.m_body,o=n.m_body,d.m_prev=null,d.m_next=this.m_contactList,null!==this.m_contactList&&(this.m_contactList.m_prev=d),this.m_contactList=d,d.m_nodeA.other=o,d.m_nodeA.prev=null,d.m_nodeA.next=a.m_contactList,null!==a.m_contactList&&(a.m_contactList.prev=d.m_nodeA),a.m_contactList=d.m_nodeA,d.m_nodeB.other=a,d.m_nodeB.prev=null,d.m_nodeB.next=o.m_contactList,null!==o.m_contactList&&(o.m_contactList.prev=d.m_nodeB),o.m_contactList=d.m_nodeB,i.IsSensor()||n.IsSensor()||(a.SetAwake(!0),o.SetAwake(!0)),++this.m_contactCount)}}},i.FindNewContacts=function(){var t=this;this.m_broadPhase.UpdatePairs((function(e,i){t.AddPair(e,i)}))},i.Destroy=function(t){var e=t.GetFixtureA(),i=t.GetFixtureB(),n=e.GetBody(),r=i.GetBody();this.m_contactListener&&t.IsTouching()&&this.m_contactListener.EndContact(t),t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_contactList&&(this.m_contactList=t.m_next),t.m_nodeA.prev&&(t.m_nodeA.prev.next=t.m_nodeA.next),t.m_nodeA.next&&(t.m_nodeA.next.prev=t.m_nodeA.prev),t.m_nodeA===n.m_contactList&&(n.m_contactList=t.m_nodeA.next),t.m_nodeB.prev&&(t.m_nodeB.prev.next=t.m_nodeB.next),t.m_nodeB.next&&(t.m_nodeB.next.prev=t.m_nodeB.prev),t.m_nodeB===r.m_contactList&&(r.m_contactList=t.m_nodeB.next),t.m_manifold.pointCount>0&&!e.IsSensor()&&!i.IsSensor()&&(e.GetBody().SetAwake(!0),i.GetBody().SetAwake(!0)),this.m_contactFactory.Destroy(t),--this.m_contactCount},i.Collide=function(){for(var e=this.m_contactList;e;){var i=e.GetFixtureA(),n=e.GetFixtureB(),r=e.GetChildIndexA(),s=e.GetChildIndexB(),a=i.GetBody(),o=n.GetBody();if(e.m_filterFlag){if(this.m_contactFilter&&!this.m_contactFilter.ShouldCollide(i,n)){var h=e;e=h.m_next,this.Destroy(h);continue}e.m_filterFlag=!1}var u=a.IsAwake()&&a.m_type!==t.b2BodyType.b2_staticBody,l=o.IsAwake()&&o.m_type!==t.b2BodyType.b2_staticBody;if(u||l){var c=i.m_proxies[r].treeNode,f=n.m_proxies[s].treeNode;if(zt(c.aabb,f.aabb))e.Update(this.m_contactListener),e=e.m_next;else{var d=e;e=d.m_next,this.Destroy(d)}}else e=e.m_next}},e}(),An=function(){function t(){this.step=0,this.collide=0,this.solve=0,this.solveInit=0,this.solveVelocity=0,this.solvePosition=0,this.broadphase=0,this.solveTOI=0}return t.prototype.Reset=function(){return this.step=0,this.collide=0,this.solve=0,this.solveInit=0,this.solveVelocity=0,this.solvePosition=0,this.broadphase=0,this.solveTOI=0,this},t}(),Dn=function(){function t(){this.dt=0,this.inv_dt=0,this.dtRatio=0,this.velocityIterations=0,this.positionIterations=0,this.particleIterations=0,this.warmStarting=!1}return t.prototype.Copy=function(t){return this.dt=t.dt,this.inv_dt=t.inv_dt,this.dtRatio=t.dtRatio,this.positionIterations=t.positionIterations,this.velocityIterations=t.velocityIterations,this.particleIterations=t.particleIterations,this.warmStarting=t.warmStarting,this},t}(),In=function(){function t(){this.c=new j,this.a=0}return t.MakeArray=function(e){return A(e,(function(){return new t}))},t}(),Bn=function(){function t(){this.v=new j,this.w=0}return t.MakeArray=function(e){return A(e,(function(){return new t}))},t}(),Mn=function(){this.step=new Dn},Pn=!1,En=function(){function t(){this.rA=new j,this.rB=new j,this.normalImpulse=0,this.tangentImpulse=0,this.normalMass=0,this.tangentMass=0,this.velocityBias=0}return t.MakeArray=function(e){return A(e,(function(){return new t}))},t}(),kn=function(){function t(){this.points=En.MakeArray(2),this.normal=new j,this.tangent=new j,this.normalMass=new Y,this.K=new Y,this.indexA=0,this.indexB=0,this.invMassA=0,this.invMassB=0,this.invIA=0,this.invIB=0,this.friction=0,this.restitution=0,this.tangentSpeed=0,this.pointCount=0,this.contactIndex=0}return t.MakeArray=function(e){return A(e,(function(){return new t}))},t}(),Rn=function(){function e(){this.localPoints=j.MakeArray(2),this.localNormal=new j,this.localPoint=new j,this.indexA=0,this.indexB=0,this.invMassA=0,this.invMassB=0,this.localCenterA=new j,this.localCenterB=new j,this.invIA=0,this.invIB=0,this.type=t.b2ManifoldType.e_unknown,this.radiusA=0,this.radiusB=0,this.pointCount=0}return e.MakeArray=function(t){return A(t,(function(){return new e}))},e}(),On=function(){this.step=new Dn,this.count=0},Fn=function(){function e(){this.normal=new j,this.point=new j,this.separation=0}return e.prototype.Initialize=function(i,n,r,s){var a=e.Initialize_s_pointA,o=e.Initialize_s_pointB,h=e.Initialize_s_planePoint,u=e.Initialize_s_clipPoint;switch(i.type){case t.b2ManifoldType.e_circles:K.MulXV(n,i.localPoint,a),K.MulXV(r,i.localPoints[0],o),j.SubVV(o,a,this.normal).SelfNormalize(),j.MidVV(a,o,this.point),this.separation=j.DotVV(j.SubVV(o,a,j.s_t0),this.normal)-i.radiusA-i.radiusB;break;case t.b2ManifoldType.e_faceA:J.MulRV(n.q,i.localNormal,this.normal),K.MulXV(n,i.localPoint,h),K.MulXV(r,i.localPoints[s],u),this.separation=j.DotVV(j.SubVV(u,h,j.s_t0),this.normal)-i.radiusA-i.radiusB,this.point.Copy(u);break;case t.b2ManifoldType.e_faceB:J.MulRV(r.q,i.localNormal,this.normal),K.MulXV(r,i.localPoint,h),K.MulXV(n,i.localPoints[s],u),this.separation=j.DotVV(j.SubVV(u,h,j.s_t0),this.normal)-i.radiusA-i.radiusB,this.point.Copy(u),this.normal.SelfNeg()}},e}();Fn.Initialize_s_pointA=new j,Fn.Initialize_s_pointB=new j,Fn.Initialize_s_planePoint=new j,Fn.Initialize_s_clipPoint=new j;var Ln=function(){function t(){this.m_step=new Dn,this.m_positionConstraints=Rn.MakeArray(1024),this.m_velocityConstraints=kn.MakeArray(1024),this.m_count=0}var e=t.prototype;return e.Initialize=function(t){if(this.m_step.Copy(t.step),this.m_count=t.count,this.m_positionConstraints.length0?1/P:0;var E=s.tangent,k=j.CrossVV(I.rA,E),R=j.CrossVV(I.rB,E),O=f+d+_*k*k+p*R*R;I.tangentMass=O>0?1/O:0,I.velocityBias=0;var F=j.DotVV(s.normal,j.SubVV(j.AddVCrossSV(T,C,I.rB,j.s_t0),j.AddVCrossSV(b,S,I.rA,j.s_t1),j.s_t0));F<-1&&(I.velocityBias+=-s.restitution*F)}s.pointCount}},e.WarmStart=function(){for(var e=t.WarmStart_s_P,i=0;i0?-I/P:0;j.MulSV(k,C,a),b.SelfMulSub(_,a),S-=p*j.CrossVV(r,a),x.SelfMulAdd(g,a),w+=v*j.CrossVV(s,a)}this.m_positions[c].a=S,this.m_positions[f].a=w}return o>-.024},e.SolveTOIPositionConstraints=function(e,i){for(var n=t.SolveTOIPositionConstraints_s_xfA,r=t.SolveTOIPositionConstraints_s_xfB,s=t.SolveTOIPositionConstraints_s_psm,a=t.SolveTOIPositionConstraints_s_rA,o=t.SolveTOIPositionConstraints_s_rB,h=t.SolveTOIPositionConstraints_s_P,u=0,c=0;c0?-M/O:0;j.MulSV(F,D,h),x.SelfMulSub(v,h),w-=y*j.CrossVV(a,h),T.SelfMulAdd(b,h),C+=S*j.CrossVV(o,h)}this.m_positions[d].a=w,this.m_positions[_].a=C}return u>=-.012},t}();Ln.InitializeVelocityConstraints_s_xfA=new K,Ln.InitializeVelocityConstraints_s_xfB=new K,Ln.InitializeVelocityConstraints_s_worldManifold=new Ot,Ln.WarmStart_s_P=new j,Ln.SolveVelocityConstraints_s_dv=new j,Ln.SolveVelocityConstraints_s_dv1=new j,Ln.SolveVelocityConstraints_s_dv2=new j,Ln.SolveVelocityConstraints_s_P=new j,Ln.SolveVelocityConstraints_s_a=new j,Ln.SolveVelocityConstraints_s_b=new j,Ln.SolveVelocityConstraints_s_x=new j,Ln.SolveVelocityConstraints_s_d=new j,Ln.SolveVelocityConstraints_s_P1=new j,Ln.SolveVelocityConstraints_s_P2=new j,Ln.SolveVelocityConstraints_s_P1P2=new j,Ln.SolvePositionConstraints_s_xfA=new K,Ln.SolvePositionConstraints_s_xfB=new K,Ln.SolvePositionConstraints_s_psm=new Fn,Ln.SolvePositionConstraints_s_rA=new j,Ln.SolvePositionConstraints_s_rB=new j,Ln.SolvePositionConstraints_s_P=new j,Ln.SolveTOIPositionConstraints_s_xfA=new K,Ln.SolveTOIPositionConstraints_s_xfB=new K,Ln.SolveTOIPositionConstraints_s_psm=new Fn,Ln.SolveTOIPositionConstraints_s_rA=new j,Ln.SolveTOIPositionConstraints_s_rB=new j,Ln.SolveTOIPositionConstraints_s_P=new j;var Vn,Nn=function(){function e(){this.m_bodies=[],this.m_contacts=[],this.m_joints=[],this.m_positions=In.MakeArray(1024),this.m_velocities=Bn.MakeArray(1024),this.m_bodyCount=0,this.m_jointCount=0,this.m_contactCount=0,this.m_bodyCapacity=0,this.m_contactCapacity=0,this.m_jointCapacity=0}var n=e.prototype;return n.Initialize=function(t,e,i,n){if(this.m_bodyCapacity=t,this.m_contactCapacity=e,this.m_jointCapacity=i,this.m_bodyCount=0,this.m_contactCount=0,this.m_jointCount=0,this.m_listener=n,this.m_positions.length4){var I=2/D.Length();C.SelfMul(I)}var B=h*A;B*B>g&&(A*=m/P(B)),w.x+=h*C.x,w.y+=h*C.y,T+=h*A,this.m_positions[x].a=T,this.m_velocities[x].w=A}o.Reset();for(var M=!1,k=0;k.0012184696791469947||j.DotVV(G.m_linearVelocity,G.m_linearVelocity)>1e-4?(G.m_sleepTime=0,z=0):(G.m_sleepTime+=h,z=E(z,G.m_sleepTime)))}if(z>=.5&&M)for(var H=0;H4){var y=2/v.Length();_.SelfMul(y)}var b=l*p;b*b>g&&(p*=m/P(b)),f.SelfMulAdd(l,_),d+=l*p,this.m_positions[c].a=d,this.m_velocities[c].w=p;var S=this.m_bodies[c];S.m_sweep.c.Copy(f),S.m_sweep.a=d,S.m_linearVelocity.Copy(_),S.m_angularVelocity=p,S.SynchronizeTransform()}this.Report(o.m_velocityConstraints)},n.Report=function(t){if(null!==this.m_listener)for(var i=0;i0){var r=1/this.m_mass;this.m_center.SelfMul(r),this.m_linearVelocity.SelfMul(r)}this.m_inertia=0,this.m_angularVelocity=0;for(var s=this.m_firstIndex;s0&&(this.m_angularVelocity*=1/this.m_inertia),this.m_timestamp=this.m_system.m_timestamp}},e}();jn.GetLinearVelocityFromWorldPoint_s_t0=new j;var qn=function(){function t(t){this.m_buffer=[],this.m_front=0,this.m_back=0,this.m_buffer.fill(null,0,t)}var e=t.prototype;return e.Push=function(t){if(this.m_back>=this.m_capacity){for(var e=this.m_front;e=0&&f>=0&&c0&&h.Push(new Qn(_-1,p,m-1,g)),p>0&&h.Push(new Qn(_,p-1,m-this.m_countX,g)),_L*L+V*V&&(this.m_diagram[P]=R,B>0&&h.Push(new Qn(B-1,M,P-1,R)),M>0&&h.Push(new Qn(B,M-1,P-this.m_countX,R)),B=i)break;Jn(t,h,i)}}if(0===a)break;r=i,i=s[--a]}return t}function $n(t,e,i,n){return void 0===i&&(i=t.length-e),void 0===n&&(n=Kn),Zn(t,e,i,n)}function tr(t,e,i){void 0===i&&(i=t.length);for(var n=0,r=0;r0;){var a=Math.floor(s/2),o=e+a;r(t[o],n)?(e=++o,s-=a+1):s=a}return e}function ir(t,e,i,n,r){for(var s=i-e;s>0;){var a=Math.floor(s/2),o=e+a;r(n,t[o])?s=a:(e=++o,s-=a+1)}return e}function nr(t,e,i,n){for(var r=i;e!==r;)Jn(t,e++,r++),r===n?r=i:e===i&&(i=r)}function rr(t,e,i,n){if(e===i)return i;for(var r=e;++e!==i;)n(t[r],t[e])||Jn(t,++r,e);return++r}var sr=function(){function t(t){this.data=[],this.count=0,this.capacity=0,this.allocator=t}var e=t.prototype;return e.Append=function(){return this.count>=this.capacity&&this.Grow(),this.count++},e.Reserve=function(t){if(!(this.capacity>=t)){for(var e=this.capacity;e=0;)this.ReportFixtureAndParticle(t,i,s);return!0},i.ReportParticle=function(){return!1},i.ReportFixtureAndParticle=function(){},e}(wn),or=function(){function t(){this.indexA=0,this.indexB=0,this.weight=0,this.normal=new j,this.flags=0}var e=t.prototype;return e.SetIndices=function(t,e){this.indexA=t,this.indexB=e},e.SetWeight=function(t){this.weight=t},e.SetNormal=function(t){this.normal.Copy(t)},e.SetFlags=function(t){this.flags=t},e.GetIndexA=function(){return this.indexA},e.GetIndexB=function(){return this.indexB},e.GetWeight=function(){return this.weight},e.GetNormal=function(){return this.normal},e.GetFlags=function(){return this.flags},e.IsEqual=function(t){return this.indexA===t.indexA&&this.indexB===t.indexB&&this.flags===t.flags&&this.weight===t.weight&&this.normal.x===t.normal.x&&this.normal.y===t.normal.y},e.IsNotEqual=function(t){return!this.IsEqual(t)},e.ApproximatelyEqual=function(t){return this.indexA===t.indexA&&this.indexB===t.indexB&&this.flags===t.flags&&P(this.weight-t.weight)<.01&&j.DistanceSquaredVV(this.normal,t.normal)<1e-4},t}(),hr=function(){this.index=0,this.weight=0,this.normal=new j,this.mass=0},ur=function(){this.indexA=0,this.indexB=0,this.flags=0,this.strength=0,this.distance=0},lr=function(){this.indexA=0,this.indexB=0,this.indexC=0,this.flags=0,this.strength=0,this.pa=new j(0,0),this.pb=new j(0,0),this.pc=new j(0,0),this.ka=0,this.kb=0,this.kc=0,this.s=0},cr=function(){function t(){this.strictContactCheck=!1,this.density=1,this.gravityScale=1,this.radius=1,this.maxCount=0,this.pressureStrength=.005,this.dampingStrength=1,this.elasticStrength=.25,this.springStrength=.25,this.viscousStrength=.25,this.surfaceTensionPressureStrength=.2,this.surfaceTensionNormalStrength=.2,this.repulsiveStrength=1,this.powderStrength=.5,this.ejectionStrength=.5,this.staticPressureStrength=.2,this.staticPressureRelaxation=.2,this.staticPressureIterations=8,this.colorMixingStrength=.5,this.destroyByAge=!0,this.lifetimeGranularity=1/60}var e=t.prototype;return e.Copy=function(t){return this.strictContactCheck=t.strictContactCheck,this.density=t.density,this.gravityScale=t.gravityScale,this.radius=t.radius,this.maxCount=t.maxCount,this.pressureStrength=t.pressureStrength,this.dampingStrength=t.dampingStrength,this.elasticStrength=t.elasticStrength,this.springStrength=t.springStrength,this.viscousStrength=t.viscousStrength,this.surfaceTensionPressureStrength=t.surfaceTensionPressureStrength,this.surfaceTensionNormalStrength=t.surfaceTensionNormalStrength,this.repulsiveStrength=t.repulsiveStrength,this.powderStrength=t.powderStrength,this.ejectionStrength=t.ejectionStrength,this.staticPressureStrength=t.staticPressureStrength,this.staticPressureRelaxation=t.staticPressureRelaxation,this.staticPressureIterations=t.staticPressureIterations,this.colorMixingStrength=t.colorMixingStrength,this.destroyByAge=t.destroyByAge,this.lifetimeGranularity=t.lifetimeGranularity,this},e.Clone=function(){return(new t).Copy(this)},t}(),fr=function(){function n(t,e){this.m_paused=!1,this.m_timestamp=0,this.m_allParticleFlags=0,this.m_needsUpdateAllParticleFlags=!1,this.m_allGroupFlags=0,this.m_needsUpdateAllGroupFlags=!1,this.m_hasForce=!1,this.m_iterationIndex=0,this.m_inverseDensity=0,this.m_particleDiameter=0,this.m_inverseDiameter=0,this.m_squaredDiameter=0,this.m_count=0,this.m_internalAllocatedCapacity=0,this.m_handleIndexBuffer=new dr,this.m_flagsBuffer=new dr,this.m_positionBuffer=new dr,this.m_velocityBuffer=new dr,this.m_forceBuffer=[],this.m_weightBuffer=[],this.m_staticPressureBuffer=[],this.m_accumulationBuffer=[],this.m_accumulation2Buffer=[],this.m_depthBuffer=[],this.m_colorBuffer=new dr,this.m_groupBuffer=[],this.m_userDataBuffer=new dr,this.m_stuckThreshold=0,this.m_lastBodyContactStepBuffer=new dr,this.m_bodyContactCountBuffer=new dr,this.m_consecutiveContactStepsBuffer=new dr,this.m_stuckParticleBuffer=new sr((function(){return 0})),this.m_proxyBuffer=new sr((function(){return new _r})),this.m_contactBuffer=new sr((function(){return new or})),this.m_bodyContactBuffer=new sr((function(){return new hr})),this.m_pairBuffer=new sr((function(){return new ur})),this.m_triadBuffer=new sr((function(){return new lr})),this.m_expirationTimeBuffer=new dr,this.m_indexByExpirationTimeBuffer=new dr,this.m_timeElapsed=0,this.m_expirationTimeBufferRequiresSorting=!1,this.m_groupCount=0,this.m_groupList=null,this.m_def=new cr,this.m_prev=null,this.m_next=null,this.UpdateBodyContacts_callback=null,this.SolveCollision_callback=null,this.SetStrictContactCheck(t.strictContactCheck),this.SetDensity(t.density),this.SetGravityScale(t.gravityScale),this.SetRadius(t.radius),this.SetMaxParticleCount(t.maxCount),this.m_def=t.Clone(),this.m_world=e,this.SetDestructionByAge(this.m_def.destroyByAge)}n.computeTag=function(t,e){return(e+n.yOffset>>>0<>>0)>>>0},n.computeRelativeTag=function(t,e,i){return t+(i<>>0};var r=n.prototype;return r.Drop=function(){for(;this.m_groupList;)this.DestroyParticleGroup(this.m_groupList);this.FreeUserOverridableBuffer(this.m_handleIndexBuffer),this.FreeUserOverridableBuffer(this.m_flagsBuffer),this.FreeUserOverridableBuffer(this.m_lastBodyContactStepBuffer),this.FreeUserOverridableBuffer(this.m_bodyContactCountBuffer),this.FreeUserOverridableBuffer(this.m_consecutiveContactStepsBuffer),this.FreeUserOverridableBuffer(this.m_positionBuffer),this.FreeUserOverridableBuffer(this.m_velocityBuffer),this.FreeUserOverridableBuffer(this.m_colorBuffer),this.FreeUserOverridableBuffer(this.m_userDataBuffer),this.FreeUserOverridableBuffer(this.m_expirationTimeBuffer),this.FreeUserOverridableBuffer(this.m_indexByExpirationTimeBuffer),this.FreeBuffer(this.m_forceBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_weightBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_staticPressureBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_accumulationBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_accumulation2Buffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_depthBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_groupBuffer,this.m_internalAllocatedCapacity)},r.CreateParticle=function(t){if(this.m_world.IsLocked())throw new Error;if(this.m_count>=this.m_internalAllocatedCapacity){var i=this.m_count?2*this.m_count:S;this.ReallocateInternalAllocatedBuffers(i)}if(this.m_count>=this.m_internalAllocatedCapacity){if(!this.m_def.destroyByAge)return v;this.DestroyOldestParticle(0,!1),this.SolveZombie()}var n=this.m_count++;this.m_flagsBuffer.data[n]=0,this.m_lastBodyContactStepBuffer.data&&(this.m_lastBodyContactStepBuffer.data[n]=0),this.m_bodyContactCountBuffer.data&&(this.m_bodyContactCountBuffer.data[n]=0),this.m_consecutiveContactStepsBuffer.data&&(this.m_consecutiveContactStepsBuffer.data[n]=0),this.m_positionBuffer.data[n]=(this.m_positionBuffer.data[n]||new j).Copy(e(t.position,j.ZERO)),this.m_velocityBuffer.data[n]=(this.m_velocityBuffer.data[n]||new j).Copy(e(t.velocity,j.ZERO)),this.m_weightBuffer[n]=0,this.m_forceBuffer[n]=(this.m_forceBuffer[n]||new j).SetZero(),this.m_staticPressureBuffer&&(this.m_staticPressureBuffer[n]=0),this.m_depthBuffer&&(this.m_depthBuffer[n]=0);var r=(new tt).Copy(e(t.color,tt.ZERO));!this.m_colorBuffer.data&&r.IsZero()||(this.m_colorBuffer.data=this.RequestBuffer(this.m_colorBuffer.data),this.m_colorBuffer.data[n]=(this.m_colorBuffer.data[n]||new tt).Copy(r)),(this.m_userDataBuffer.data||t.userData)&&(this.m_userDataBuffer.data=this.RequestBuffer(this.m_userDataBuffer.data),this.m_userDataBuffer.data[n]=t.userData),this.m_handleIndexBuffer.data&&(this.m_handleIndexBuffer.data[n]=null);var s=this.m_proxyBuffer.data[this.m_proxyBuffer.Append()],a=e(t.lifetime,0),o=a>0;(this.m_expirationTimeBuffer.data||o)&&(this.SetParticleLifetime(n,o?a:this.ExpirationTimeToLifetime(-this.GetQuantizedTimeElapsed())),this.m_indexByExpirationTimeBuffer.data[n]=n),s.index=n;var h=e(t.group,null);return this.m_groupBuffer[n]=h,h&&(h.m_firstIndex0?n:r,e)},r.DestroyParticlesInShape=function(t,e,i){void 0===i&&(i=!1);var r=n.DestroyParticlesInShape_s_aabb;if(this.m_world.IsLocked())throw new Error;var s=new Sr(this,t,e,i),a=r;return t.ComputeAABB(a,e,0),this.m_world.QueryAABB(s,a),s.Destroyed()},r.CreateParticleGroup=function(t){var i=n.CreateParticleGroup_s_transform;if(this.m_world.IsLocked())throw new Error;var r=i;r.SetPositionAngle(e(t.position,j.ZERO),e(t.angle,0));var s=this.m_count;if(t.shape&&this.CreateParticlesWithShapeForGroup(t.shape,t,r),t.shapes&&this.CreateParticlesWithShapesForGroup(t.shapes,e(t.shapeCount,t.shapes.length),t,r),t.positionData)for(var a=e(t.particleCount,t.positionData.length),o=0;o0&&(this.m_lastBodyContactStepBuffer.data=this.RequestBuffer(this.m_lastBodyContactStepBuffer.data),this.m_bodyContactCountBuffer.data=this.RequestBuffer(this.m_bodyContactCountBuffer.data),this.m_consecutiveContactStepsBuffer.data=this.RequestBuffer(this.m_consecutiveContactStepsBuffer.data))},r.GetStuckCandidates=function(){return this.m_stuckParticleBuffer.Data()},r.GetStuckCandidateCount=function(){return this.m_stuckParticleBuffer.GetCount()},r.ComputeCollisionEnergy=function(){for(var t=n.ComputeCollisionEnergy_s_v,e=this.m_velocityBuffer.data,i=0,r=0;r0?this.GetQuantizedTimeElapsed()+s:s;a!==this.m_expirationTimeBuffer.data[t]&&(this.m_expirationTimeBuffer.data[t]=a,this.m_expirationTimeBufferRequiresSorting=!0)},r.GetParticleLifetime=function(t){return this.ExpirationTimeToLifetime(this.GetExpirationTimeBuffer()[t])},r.SetDestructionByAge=function(t){t&&this.GetExpirationTimeBuffer(),this.m_def.destroyByAge=t},r.GetDestructionByAge=function(){return this.m_def.destroyByAge},r.GetExpirationTimeBuffer=function(){return this.m_expirationTimeBuffer.data=this.RequestBuffer(this.m_expirationTimeBuffer.data),this.m_expirationTimeBuffer.data},r.ExpirationTimeToLifetime=function(t){return(t>0?t-this.GetQuantizedTimeElapsed():t)*this.m_def.lifetimeGranularity},r.GetIndexByExpirationTimeBuffer=function(){return this.GetParticleCount()?this.SetParticleLifetime(0,this.GetParticleLifetime(0)):this.m_indexByExpirationTimeBuffer.data=this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data),this.m_indexByExpirationTimeBuffer.data},r.ParticleApplyLinearImpulse=function(t,e){this.ApplyLinearImpulse(t,t+1,e)},r.ApplyLinearImpulse=function(t,e,i){for(var n=this.m_velocityBuffer.data,r=(e-t)*this.GetParticleMass(),s=(new j).Copy(i).SelfMul(1/r),a=t;a=0;){var m=j.SubVV(e,u[c],s),g=j.DotVV(m,d),v=g*g-_*(j.DotVV(m,m)-this.m_squaredDiameter);if(v>=0){var y=V(v),b=(-g-y)/_;if(b>f)continue;if(b<0&&((b=(-g+y)/_)<0||b>f))continue;var S=j.AddVMulSV(m,b,d,o);if(S.Normalize(),(f=E(f,t.ReportParticle(this,c,j.AddVMulSV(e,b,d,h),S,b)))<=0)break}}}},r.ComputeAABB=function(t){var e=this.GetParticleCount();t.lowerBound.x=1e37,t.lowerBound.y=1e37,t.upperBound.x=-1e37,t.upperBound.y=-1e37;for(var i=this.m_positionBuffer.data,n=0;ne?e:t}if(t=e(t,this.m_def.maxCount),t=e(t,this.m_flagsBuffer.userSuppliedCapacity),t=e(t,this.m_positionBuffer.userSuppliedCapacity),t=e(t,this.m_velocityBuffer.userSuppliedCapacity),t=e(t,this.m_colorBuffer.userSuppliedCapacity),t=e(t,this.m_userDataBuffer.userSuppliedCapacity),this.m_internalAllocatedCapacity0;this.m_lastBodyContactStepBuffer.data=this.ReallocateBuffer4(this.m_lastBodyContactStepBuffer,this.m_internalAllocatedCapacity,t,i),this.m_bodyContactCountBuffer.data=this.ReallocateBuffer4(this.m_bodyContactCountBuffer,this.m_internalAllocatedCapacity,t,i),this.m_consecutiveContactStepsBuffer.data=this.ReallocateBuffer4(this.m_consecutiveContactStepsBuffer,this.m_internalAllocatedCapacity,t,i),this.m_positionBuffer.data=this.ReallocateBuffer4(this.m_positionBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_velocityBuffer.data=this.ReallocateBuffer4(this.m_velocityBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_forceBuffer=this.ReallocateBuffer5(this.m_forceBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_weightBuffer=this.ReallocateBuffer5(this.m_weightBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_staticPressureBuffer=this.ReallocateBuffer5(this.m_staticPressureBuffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_accumulationBuffer=this.ReallocateBuffer5(this.m_accumulationBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_accumulation2Buffer=this.ReallocateBuffer5(this.m_accumulation2Buffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_depthBuffer=this.ReallocateBuffer5(this.m_depthBuffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_colorBuffer.data=this.ReallocateBuffer4(this.m_colorBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_groupBuffer=this.ReallocateBuffer5(this.m_groupBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_userDataBuffer.data=this.ReallocateBuffer4(this.m_userDataBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_expirationTimeBuffer.data=this.ReallocateBuffer4(this.m_expirationTimeBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_indexByExpirationTimeBuffer.data=this.ReallocateBuffer4(this.m_indexByExpirationTimeBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_internalAllocatedCapacity=t}},r.CreateParticleForGroup=function(t,i,n){var r=new zn;r.flags=e(t.flags,0),K.MulXV(i,n,r.position),j.AddVV(e(t.linearVelocity,j.ZERO),j.CrossSV(e(t.angularVelocity,0),j.SubVV(r.position,e(t.position,j.ZERO),j.s_t0),j.s_t0),r.velocity),r.color.Copy(e(t.color,tt.ZERO)),r.lifetime=e(t.lifetime,0),r.userData=t.userData,this.CreateParticle(r)},r.CreateParticlesStrokeShapeForGroup=function(i,r,s){var a=n.CreateParticlesStrokeShapeForGroup_s_edge,o=n.CreateParticlesStrokeShapeForGroup_s_d,h=n.CreateParticlesStrokeShapeForGroup_s_p,u=e(r.stride,0);0===u&&(u=this.GetParticleStride());for(var l=0,c=i.GetChildCount(),f=0;f=e&&d=e&&_v||j.DotVV(m,m)>v||j.DotVV(g,g)>v)return;var y=C.m_groupBuffer[t],b=C.m_groupBuffer[e],S=C.m_groupBuffer[i],x=C.m_triadBuffer.data[C.m_triadBuffer.Append()];x.indexA=t,x.indexB=e,x.indexC=i,x.flags=u|l|c,x.strength=E(E(y?y.m_strength:1,b?b.m_strength:1),S?S.m_strength:1);var w=(f.x+d.x+_.x)/3,T=(f.y+d.y+_.y)/3;x.pa.x=f.x-w,x.pa.y=f.y-T,x.pb.x=d.x-w,x.pb.y=d.y-T,x.pc.x=_.x-w,x.pc.y=_.y-T,x.ka=-j.DotVV(g,p),x.kb=-j.DotVV(p,m),x.kc=-j.DotVV(m,g),x.s=j.CrossVV(f,d)+j.CrossVV(d,_)+j.CrossVV(_,f)}})),$n(this.m_triadBuffer.data,0,this.m_triadBuffer.count,n.CompareTriadIndices),this.m_triadBuffer.Unique(n.MatchTriadIndices)}},r.UpdatePairsAndTriadsWithReactiveParticles=function(){var e=new Tr(this.m_flagsBuffer);this.UpdatePairsAndTriads(0,this.m_count,e);for(var i=0;ik&&(this.m_depthBuffer[I]=k,C=!0),E>R&&(this.m_depthBuffer[B]=R,C=!0)}if(!C)break}for(var O=0;O0)for(var i=this.GetParticleCount(),r=0;rthis.m_lastBodyContactStepBuffer.data[r]+1&&(this.m_consecutiveContactStepsBuffer.data[r]=0);this.m_bodyContactBuffer.SetCount(0),this.m_stuckParticleBuffer.SetCount(0);var s=t;this.ComputeAABB(s),null===this.UpdateBodyContacts_callback&&(this.UpdateBodyContacts_callback=new Cr(this));var a=this.UpdateBodyContacts_callback;a.m_contactFilter=this.GetFixtureContactFilter(),this.m_world.QueryAABB(a,s),this.m_def.strictContactCheck&&this.RemoveSpuriousBodyContacts(),this.NotifyBodyContactListenerPostContact(e)},r.Solve=function(e){var i=n.Solve_s_subStep;if(0!==this.m_count&&(this.m_expirationTimeBuffer.data&&this.SolveLifetimes(e),this.m_allParticleFlags&t.b2ParticleFlag.b2_zombieParticle&&this.SolveZombie(),this.m_needsUpdateAllParticleFlags&&this.UpdateAllParticleFlags(),this.m_needsUpdateAllGroupFlags&&this.UpdateAllGroupFlags(),!this.m_paused))for(this.m_iterationIndex=0;this.m_iterationIndexi&&r.SelfMul(V(i/s))}},r.SolveGravity=function(t){for(var e=n.SolveGravity_s_gravity,i=this.m_velocityBuffer.data,r=j.MulSV(t.dt*this.m_def.gravityScale,this.m_world.GetGravity(),e),s=0;s=0;){var O=p[R],F=this.m_groupBuffer[R];if(D!==F&&I!==F){var L=this.GetLinearVelocity(F,R,O,h),N=j.SubVV(O,T,u),z=j.SubVV(L,B,l),U=j.CrossVV(E,z),G=j.CrossVV(P,z)-j.CrossVV(N,E),H=j.CrossVV(P,N),W=void 0,q=void 0,X=c,Y=f;if(0===U){if(0===G)continue;if(!((q=-H/G)>=0&&q=0&&W<=1))continue}else{var Q=G*G-4*H*U;if(Q<0)continue;var J=V(Q),K=(-G-J)/(2*U),Z=(-G+J)/(2*U);if(K>Z){var $=K;K=Z,Z=$}if(q=K,j.AddVMulSV(P,q,E,X),j.AddVMulSV(N,q,z,Y),W=j.DotVV(X,Y)/j.DotVV(X,X),!(q>=0&&q=0&&W<=1)){if(!((q=Z)>=0&&q=0&&W<=1))continue}}var tt=d;tt.x=B.x+W*E.x-L.x,tt.y=B.y+W*E.y-L.y;var et=j.MulSV(y,tt,_);if(F&&this.IsRigidGroup(F)){var it=F.GetMass(),nt=F.GetInertia();it>0&&F.m_linearVelocity.SelfMulAdd(1/it,et),nt>0&&(F.m_angularVelocity+=j.CrossVV(j.SubVV(O,F.GetCenter(),j.s_t0),et)/nt)}else m[R].SelfAdd(tt);this.ParticleApplyForce(R,et.SelfMul(-e.inv_dt))}}}}},r.SolveStaticPressure=function(e){this.m_staticPressureBuffer=this.RequestBuffer(this.m_staticPressureBuffer);for(var i=this.GetCriticalPressure(e),n=this.m_def.staticPressureStrength*i,r=b*i,s=this.m_def.staticPressureRelaxation,a=0;ao){var d=l.body,_=l.mass,p=r[c],m=l.normal,g=j.MulSV(a*_*(f-o),m,i);s[c].SelfMulSub(h,g),d.ApplyLinearImpulse(g,p,!0)}}}for(var v=0;vo){var S=y.indexA,x=y.indexB,w=y.normal,T=j.MulSV(a*(b-o),w,i);s[S].SelfSub(T),s[x].SelfAdd(T)}}}},r.SolveSolid=function(t){var e=n.SolveSolid_s_f,i=this.m_velocityBuffer.data;this.m_depthBuffer=this.RequestBuffer(this.m_depthBuffer);for(var r=t.inv_dt*this.m_def.ejectionStrength,s=0;s=0?(A=E(A,M),D=k(D,M+1)):I=!0}Ar:s})),this.m_expirationTimeBufferRequiresSorting=!1);for(var s=r-1;s>=0;--s){var a=n[s],o=i[a];if(ee.weight:t.index3)return!0;var o=t.Copy(n.normal);o.SelfMul(r.m_particleDiameter*(1-n.weight));var h=j.AddVV(r.m_positionBuffer.data[n.index],o,e);if(!n.fixture.TestPoint(h)){for(var u=n.fixture.GetShape().GetChildCount(),c=0;cthis.m_stuckThreshold&&(this.m_stuckParticleBuffer.data[this.m_stuckParticleBuffer.Append()]=t)),this.m_lastBodyContactStepBuffer.data[t]=this.m_timestamp)},r.ValidateParticleIndex=function(t){return t>=0&&t0?1/n:0,e[0]=r>0?1/r:0,i[0]=j.CrossVV(j.SubVV(a,s,j.s_t0),o)},r.InitDampingParameterWithRigidGroupOrParticle=function(e,i,n,r,s,a,o,h){if(s&&r)this.InitDampingParameter(e,i,n,s.GetMass(),s.GetInertia(),s.GetCenter(),o,h);else{var u=this.m_flagsBuffer.data[a];this.InitDampingParameter(e,i,n,u&t.b2ParticleFlag.b2_wallParticle?0:this.GetParticleMass(),0,o,o,h)}},r.ComputeDampingImpulse=function(t,e,i,n,r,s,a){var o=t+e*i*i+n+r*s*s;return o>0?a/o:0},r.ApplyDamping=function(t,e,i,n,r,s,a,o){r&&n?(r.m_linearVelocity.SelfMulAdd(a*t,o),r.m_angularVelocity+=a*i*e):this.m_velocityBuffer.data[s].SelfMulAdd(a*t,o)},n}();fr.xTruncBits=12,fr.yTruncBits=12,fr.tagBits=32,fr.yOffset=1<>>0,this.m_xUpper=(i&fr.xMask)>>>0,this.m_yLower=(e&fr.yMask)>>>0,this.m_yUpper=(i&fr.yMask)>>>0,this.m_first=n,this.m_last=r}return t.prototype.GetNext=function(){for(;this.m_first>>0;if(t>=this.m_xLower&&t<=this.m_xUpper)return this.m_system.m_proxyBuffer.data[this.m_first++].index;this.m_first++}return v},t}(),mr=function(){this.next=null,this.count=0,this.index=0},gr=function(){function t(){}var e=t.prototype;return e.Allocate=function(t,e){return e},e.Clear=function(){},e.GetCount=function(){return 0},e.Invalidate=function(){},e.GetValidBuffer=function(){return[]},e.GetBuffer=function(){return[]},e.SetCount=function(){},t}(),vr=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.Initialize=function(){},i.Find=function(){return v},e}(gr),yr=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.Initialize=function(){},i.Find=function(){return v},e}(gr),br=function(){function t(){}var e=t.prototype;return e.IsNecessary=function(){return!0},e.ShouldCreatePair=function(){return!0},e.ShouldCreateTriad=function(){return!0},t}(),Sr=function(t){function e(e,i,n,r){var s;return(s=t.call(this)||this).m_callDestructionListener=!1,s.m_destroyed=0,s.m_system=e,s.m_shape=i,s.m_xf=n,s.m_callDestructionListener=r,s.m_destroyed=0,s}s(e,t);var i=e.prototype;return i.ReportFixture=function(){return!1},i.ReportParticle=function(t,e){return t===this.m_system&&(this.m_shape.TestPoint(this.m_xf,this.m_system.m_positionBuffer.data[e])&&(this.m_system.DestroyParticle(e,this.m_callDestructionListener),this.m_destroyed++),!0)},i.Destroyed=function(){return this.m_destroyed},e}(wn),xr=function(t){function e(e){var i;return(i=t.call(this)||this).m_threshold=0,i.m_threshold=e,i}s(e,t);var i=e.prototype;return i.ShouldCreatePair=function(t,e){return t0?1/f:0,p=d>0?1/d:0,m=this.m_system.m_flagsBuffer.data[r]&t.b2ParticleFlag.b2_wallParticle?0:this.m_system.GetParticleInvMass(),g=j.SubVV(o,c,a),v=j.CrossVV(g,h),y=m+_+p*v*v,b=this.m_system.m_bodyContactBuffer.data[this.m_system.m_bodyContactBuffer.Append()];b.index=r,b.body=l,b.fixture=e,b.weight=1-u*this.m_system.m_inverseDiameter,b.normal.Copy(h.SelfNeg()),b.mass=y>0?1/y:0,this.m_system.DetectStuckParticle(r)}},i}(ar);Cr.ReportFixtureAndParticle_s_n=new j,Cr.ReportFixtureAndParticle_s_rp=new j;var Ar=function(e){function i(t,i){var n;return(n=e.call(this,t)||this).m_step=i,n}s(i,e);var n=i.prototype;return n.ReportFixtureAndParticle=function(e,n,r){var s=i.ReportFixtureAndParticle_s_p1,a=i.ReportFixtureAndParticle_s_output,o=i.ReportFixtureAndParticle_s_input,h=i.ReportFixtureAndParticle_s_p,u=i.ReportFixtureAndParticle_s_v,c=i.ReportFixtureAndParticle_s_f,f=e.GetBody(),d=this.m_system.m_positionBuffer.data[r],_=this.m_system.m_velocityBuffer.data[r],p=a,m=o;if(0===this.m_system.m_iterationIndex){var g=K.MulTXV(f.m_xf0,d,s);e.GetShape().GetType()===t.b2ShapeType.e_circleShape&&(g.SelfSub(f.GetLocalCenter()),J.MulRV(f.m_xf0.q,g,g),J.MulTRV(f.m_xf.q,g,g),g.SelfAdd(f.GetLocalCenter())),K.MulXV(f.m_xf,g,m.p1)}else m.p1.Copy(d);if(j.AddVMulSV(d,this.m_step.dt,_,m.p2),m.maxFraction=1,e.RayCast(p,m,n)){var v=p.normal,y=h;y.x=(1-p.fraction)*m.p1.x+p.fraction*m.p2.x+l*v.x,y.y=(1-p.fraction)*m.p1.y+p.fraction*m.p2.y+l*v.y;var b=u;b.x=this.m_step.inv_dt*(y.x-d.x),b.y=this.m_step.inv_dt*(y.y-d.y),this.m_system.m_velocityBuffer.data[r].Copy(b);var S=c;S.x=this.m_step.inv_dt*this.m_system.GetParticleMass()*(_.x-b.x),S.y=this.m_step.inv_dt*this.m_system.GetParticleMass()*(_.y-b.y),this.m_system.ParticleApplyForce(r,S)}},n.ReportParticle=function(){return!1},i}(ar);Ar.ReportFixtureAndParticle_s_p1=new j,Ar.ReportFixtureAndParticle_s_output=new Vt,Ar.ReportFixtureAndParticle_s_input=new Lt,Ar.ReportFixtureAndParticle_s_p=new j,Ar.ReportFixtureAndParticle_s_v=new j,Ar.ReportFixtureAndParticle_s_f=new j;var Dr=function(){function e(t){this.m_newFixture=!1,this.m_locked=!1,this.m_clearForces=!0,this.m_contactManager=new Cn,this.m_bodyList=null,this.m_jointList=null,this.m_particleSystemList=null,this.m_bodyCount=0,this.m_jointCount=0,this.m_gravity=new j,this.m_allowSleep=!0,this.m_destructionListener=null,this.m_debugDraw=null,this.m_inv_dt0=0,this.m_warmStarting=!0,this.m_continuousPhysics=!0,this.m_subStepping=!1,this.m_stepComplete=!0,this.m_profile=new An,this.m_island=new Nn,this.s_stack=[],this.m_controllerList=null,this.m_controllerCount=0,this.m_gravity.Copy(t)}var n=e.prototype;return n.SetDestructionListener=function(t){this.m_destructionListener=t},n.SetContactFilter=function(t){this.m_contactManager.m_contactFilter=t},n.SetContactListener=function(t){this.m_contactManager.m_contactListener=t},n.SetDebugDraw=function(t){this.m_debugDraw=t},n.CreateBody=function(t){if(void 0===t&&(t={}),this.IsLocked())throw new Error;var e=new Mi(t,this);return e.m_prev=null,e.m_next=this.m_bodyList,this.m_bodyList&&(this.m_bodyList.m_prev=e),this.m_bodyList=e,++this.m_bodyCount,e},n.DestroyBody=function(t){if(this.IsLocked())throw new Error;for(var e=t.m_jointList;e;){var i=e;e=e.next,this.m_destructionListener&&this.m_destructionListener.SayGoodbyeJoint(i.joint),this.DestroyJoint(i.joint),t.m_jointList=e}t.m_jointList=null;for(var n=t.m_controllerList;n;){var r=n;n=n.nextController,r.controller.RemoveBody(t)}for(var s=t.m_contactList;s;){var a=s;s=s.next,this.m_contactManager.Destroy(a.contact)}t.m_contactList=null;for(var o=t.m_fixtureList;o;){var h=o;o=o.m_next,this.m_destructionListener&&this.m_destructionListener.SayGoodbyeFixture(h),h.DestroyProxies(),h.Reset(),t.m_fixtureList=o,t.m_fixtureCount-=1}t.m_fixtureList=null,t.m_fixtureCount=0,t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_bodyList&&(this.m_bodyList=t.m_next),--this.m_bodyCount},e._Joint_Create=function(e){switch(e.type){case t.b2JointType.e_distanceJoint:return new Fi(e);case t.b2JointType.e_mouseJoint:return new qi(e);case t.b2JointType.e_prismaticJoint:return new Yi(e);case t.b2JointType.e_revoluteJoint:return new Zi(e);case t.b2JointType.e_pulleyJoint:return new Ji(e);case t.b2JointType.e_gearJoint:return new Gi(e);case t.b2JointType.e_wheelJoint:return new sn(e);case t.b2JointType.e_weldJoint:return new nn(e);case t.b2JointType.e_frictionJoint:return new zi(e);case t.b2JointType.e_ropeJoint:return new tn(e);case t.b2JointType.e_motorJoint:return new Wi(e);case t.b2JointType.e_areaJoint:return new Vi(e)}throw new Error},e._Joint_Destroy=function(){},n.CreateJoint=function(t){if(this.IsLocked())throw new Error;var i=e._Joint_Create(t);i.m_prev=null,i.m_next=this.m_jointList,this.m_jointList&&(this.m_jointList.m_prev=i),this.m_jointList=i,++this.m_jointCount,i.m_edgeA.prev=null,i.m_edgeA.next=i.m_bodyA.m_jointList,i.m_bodyA.m_jointList&&(i.m_bodyA.m_jointList.prev=i.m_edgeA),i.m_bodyA.m_jointList=i.m_edgeA,i.m_edgeB.prev=null,i.m_edgeB.next=i.m_bodyB.m_jointList,i.m_bodyB.m_jointList&&(i.m_bodyB.m_jointList.prev=i.m_edgeB),i.m_bodyB.m_jointList=i.m_edgeB;var n=i.m_bodyA,r=i.m_bodyB;if(!i.m_collideConnected)for(var s=r.GetContactList();s;)s.other===n&&s.contact.FlagForFiltering(),s=s.next;return i},n.DestroyJoint=function(t){if(this.IsLocked())throw new Error;t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_jointList&&(this.m_jointList=t.m_next);var i=t.m_bodyA,n=t.m_bodyB,r=t.m_collideConnected;if(i.SetAwake(!0),n.SetAwake(!0),t.m_edgeA.prev&&(t.m_edgeA.prev.next=t.m_edgeA.next),t.m_edgeA.next&&(t.m_edgeA.next.prev=t.m_edgeA.prev),t.m_edgeA===i.m_jointList&&(i.m_jointList=t.m_edgeA.next),t.m_edgeA.Reset(),t.m_edgeB.prev&&(t.m_edgeB.prev.next=t.m_edgeB.next),t.m_edgeB.next&&(t.m_edgeB.next.prev=t.m_edgeB.prev),t.m_edgeB===n.m_jointList&&(n.m_jointList=t.m_edgeB.next),t.m_edgeB.Reset(),e._Joint_Destroy(t),--this.m_jointCount,!r)for(var s=n.GetContactList();s;)s.other===i&&s.contact.FlagForFiltering(),s=s.next},n.CreateParticleSystem=function(t){if(this.IsLocked())throw new Error;var e=new fr(t,this);return e.m_prev=null,e.m_next=this.m_particleSystemList,this.m_particleSystemList&&(this.m_particleSystemList.m_prev=e),this.m_particleSystemList=e,e},n.DestroyParticleSystem=function(t){if(this.IsLocked())throw new Error;t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_particleSystemList&&(this.m_particleSystemList=t.m_next)},n.CalculateReasonableParticleIterations=function(t){if(null===this.m_particleSystemList)return 1;return Un(this.m_gravity.Length(),function(t){for(var e=i,n=t.GetParticleSystemList();null!==n;n=n.m_next)e=E(e,n.GetRadius());return e}(this),t)},n.Step=function(t,i,n,r){void 0===r&&(r=this.CalculateReasonableParticleIterations(t));var s=e.Step_s_stepTimer.Reset();this.m_newFixture&&(this.m_contactManager.FindNewContacts(),this.m_newFixture=!1),this.m_locked=!0;var a=e.Step_s_step;a.dt=t,a.velocityIterations=i,a.positionIterations=n,a.particleIterations=r,a.inv_dt=t>0?1/t:0,a.dtRatio=this.m_inv_dt0*t,a.warmStarting=this.m_warmStarting;var o=e.Step_s_timer.Reset();if(this.m_contactManager.Collide(),this.m_profile.collide=o.GetMilliseconds(),this.m_stepComplete&&a.dt>0){for(var h=e.Step_s_timer.Reset(),u=this.m_particleSystemList;u;u=u.m_next)u.Solve(a);this.Solve(a),this.m_profile.solve=h.GetMilliseconds()}if(this.m_continuousPhysics&&a.dt>0){var l=e.Step_s_timer.Reset();this.SolveTOI(a),this.m_profile.solveTOI=l.GetMilliseconds()}a.dt>0&&(this.m_inv_dt0=a.inv_dt),this.m_clearForces&&this.ClearForces(),this.m_locked=!1,this.m_profile.step=s.GetMilliseconds()},n.ClearForces=function(){for(var t=this.m_bodyList;t;t=t.m_next)t.m_force.SetZero(),t.m_torque=0},n.DrawParticleSystem=function(t){if(null!==this.m_debugDraw){var e=t.GetParticleCount();if(e){var i=t.GetRadius(),n=t.GetPositionBuffer();if(t.m_colorBuffer.data){var r=t.GetColorBuffer();this.m_debugDraw.DrawParticles(n,i,r,e)}else this.m_debugDraw.DrawParticles(n,i,null,e)}}},n.DrawDebugData=function(){if(null!==this.m_debugDraw){var i=this.m_debugDraw.GetFlags(),n=e.DrawDebugData_s_color.SetRGB(0,0,0);if(i&t.b2DrawFlags.e_shapeBit)for(var r=this.m_bodyList;r;r=r.m_next){var s=r.m_xf;this.m_debugDraw.PushTransform(s);for(var a=r.GetFixtureList();a;a=a.m_next)r.IsActive()?r.GetType()===t.b2BodyType.b2_staticBody?(n.SetRGB(.5,.9,.5),this.DrawShape(a,n)):r.GetType()===t.b2BodyType.b2_kinematicBody?(n.SetRGB(.5,.5,.9),this.DrawShape(a,n)):r.IsAwake()?(n.SetRGB(.9,.7,.7),this.DrawShape(a,n)):(n.SetRGB(.6,.6,.6),this.DrawShape(a,n)):(n.SetRGB(.5,.5,.3),this.DrawShape(a,n));this.m_debugDraw.PopTransform(s)}if(i&t.b2DrawFlags.e_particleBit)for(var o=this.m_particleSystemList;o;o=o.m_next)this.DrawParticleSystem(o);if(i&t.b2DrawFlags.e_jointBit)for(var h=this.m_jointList;h;h=h.m_next)this.DrawJoint(h);if(i&t.b2DrawFlags.e_aabbBit){n.SetRGB(.9,.3,.9);for(var u=e.DrawDebugData_s_vs,l=this.m_bodyList;l;l=l.m_next)if(l.IsActive())for(var c=l.GetFixtureList();c;c=c.m_next)for(var f=0;f0;){var c=h[--l];if(!c)throw new Error;if(r.AddBody(c),c.m_awakeFlag=!0,c.GetType()!==t.b2BodyType.b2_staticBody){for(var f=c.m_contactList;f;f=f.next){var d=f.contact;if(!d.m_islandFlag&&d.IsEnabled()&&d.IsTouching()){var _=d.m_fixtureA.m_isSensor,p=d.m_fixtureB.m_isSensor;if(!_&&!p){r.AddContact(d),d.m_islandFlag=!0;var m=f.other;m.m_islandFlag||(h[l++]=m,m.m_islandFlag=!0)}}}for(var g=c.m_jointList;g;g=g.next)if(!g.joint.m_islandFlag){var v=g.other;v.IsActive()&&(r.AddJoint(g.joint),g.joint.m_islandFlag=!0,v.m_islandFlag||(h[l++]=v,v.m_islandFlag=!0))}}}var y=new An;r.Solve(y,e,this.m_gravity,this.m_allowSleep),this.m_profile.solveInit+=y.solveInit,this.m_profile.solveVelocity+=y.solveVelocity,this.m_profile.solvePosition+=y.solvePosition;for(var b=0;b8)){var u=1;if(h.m_toiFlag)u=h.m_toi;else{var l=h.GetFixtureA(),c=h.GetFixtureB();if(l.IsSensor()||c.IsSensor())continue;var f=l.GetBody(),d=c.GetBody(),_=f.m_type,p=d.m_type,m=f.IsAwake()&&_!==t.b2BodyType.b2_staticBody,g=d.IsAwake()&&p!==t.b2BodyType.b2_staticBody;if(!m&&!g)continue;var v=f.IsBullet()||_!==t.b2BodyType.b2_dynamicBody,y=d.IsBullet()||p!==t.b2BodyType.b2_dynamicBody;if(!v&&!y)continue;var b=f.m_sweep.alpha0;f.m_sweep.alpha0this.maxTimestep&&this.maxTimestep>0&&(i=this.maxTimestep);for(var n=this.m_bodyList;n;n=n.nextBody){var s=n.body;if(s.IsAwake()){var a=s.GetWorldVector(Y.MulMV(this.T,s.GetLocalVector(s.GetLinearVelocity(),j.s_t0),j.s_t1),e.Step_s_damping);s.SetLinearVelocity(j.AddVV(s.GetLinearVelocity(),j.MulSV(i,a,j.s_t0),j.s_t1))}}}},i.Draw=function(){},i.SetAxisAligned=function(t,e){this.T.ex.x=-t,this.T.ex.y=0,this.T.ey.x=0,this.T.ey.y=-e,this.maxTimestep=t>0||e>0?1/k(t,e):0},e}(Br);Rr.Step_s_damping=new j;var Or=function(){function t(){this.m_count=0,this.m_ps=[],this.m_p0s=[],this.m_vs=[],this.m_ims=[],this.m_Ls=[],this.m_as=[],this.m_gravity=new j,this.m_damping=0,this.m_k2=1,this.m_k3=.1}var e=t.prototype;return e.GetVertexCount=function(){return this.m_count},e.GetVertices=function(){return this.m_ps},e.Initialize=function(t){this.m_count=t.count,this.m_ps=j.MakeArray(this.m_count),this.m_p0s=j.MakeArray(this.m_count),this.m_vs=j.MakeArray(this.m_count),this.m_ims=D(this.m_count);for(var e=0;e0?1/i:0}var n=this.m_count-1,r=this.m_count-2;this.m_Ls=D(n),this.m_as=D(r);for(var s=0;s0&&this.m_vs[n].SelfMulAdd(t,this.m_gravity),this.m_vs[n].SelfMul(i),this.m_ps[n].SelfMulAdd(t,this.m_vs[n]);for(var r=0;ro;)w=(m-=2*o)-this.m_as[i];for(;w<-3.14159265359;)w=(m+=2*o)-this.m_as[i];var T=-this.m_k3*x*w;n.SelfMulAdd(a*T,y),r.SelfMulAdd(h*T,b),s.SelfMulAdd(u*T,S)}}}},e.Draw=function(t){for(var e=new tt(.4,.5,.7),i=0;i1?e-1:0),n=1;n0&&!(t&t-1)},t.b2IsValid=O,t.b2Island=Nn,t.b2Jacobian=Pi,t.b2Joint=Ri,t.b2JointDef=ki,t.b2JointEdge=Ei,t.b2Log=function(){},t.b2MakeArray=A,t.b2MakeNullArray=function(t){for(var e=new Array(t),i=0;i>1&2147483647,t|=t>>2&1073741823,t|=t>>4&268435455,1+((t|=t>>8&16777215)|t>>16&65535)},t.b2Pair=Zt,t.b2PairLessThan=te,t.b2ParseInt=function(t){return parseInt(t,10)},t.b2ParseUInt=function(t){return Math.abs(parseInt(t,10))},t.b2ParticleBodyContact=hr,t.b2ParticleContact=or,t.b2ParticleDef=zn,t.b2ParticleGroup=jn,t.b2ParticleGroupDef=Wn,t.b2ParticleHandle=Hn,t.b2ParticlePair=ur,t.b2ParticlePairSet=yr,t.b2ParticleSystem=fr,t.b2ParticleSystemDef=cr,t.b2ParticleSystem_CompositeShape=wr,t.b2ParticleSystem_ConnectionFilter=br,t.b2ParticleSystem_DestroyParticlesInShapeCallback=Sr,t.b2ParticleSystem_FixedSetAllocator=gr,t.b2ParticleSystem_FixtureParticle=function(t,e){this.second=v,this.first=t,this.second=e},t.b2ParticleSystem_FixtureParticleSet=vr,t.b2ParticleSystem_InsideBoundsEnumerator=pr,t.b2ParticleSystem_JoinParticleGroupsFilter=xr,t.b2ParticleSystem_ParticleListNode=mr,t.b2ParticleSystem_ParticlePair=function(t,e){this.first=v,this.second=v,this.first=t,this.second=e},t.b2ParticleSystem_Proxy=_r,t.b2ParticleSystem_ReactiveFilter=Tr,t.b2ParticleSystem_SolveCollisionCallback=Ar,t.b2ParticleSystem_UpdateBodyContactsCallback=Cr,t.b2ParticleSystem_UserOverridableBuffer=dr,t.b2ParticleTriad=lr,t.b2PolygonAndCircleContact=fn,t.b2PolygonContact=cn,t.b2PolygonShape=bi,t.b2Position=In,t.b2PositionSolverManifold=Fn,t.b2Pow=N,t.b2PrismaticJoint=Yi,t.b2PrismaticJointDef=Xi,t.b2Profile=An,t.b2PulleyJoint=Ji,t.b2PulleyJointDef=Qi,t.b2QueryCallback=wn,t.b2RadToDeg=function(t){return t*B},t.b2Random=function(){return 2*Math.random()-1},t.b2RandomRange=function(t,e){return(e-t)*Math.random()+t},t.b2RayCastCallback=Tn,t.b2RayCastInput=Lt,t.b2RayCastOutput=Vt,t.b2RevoluteJoint=Zi,t.b2RevoluteJointDef=Ki,t.b2Rope=Or,t.b2RopeDef=function(){this.vertices=[],this.count=0,this.masses=[],this.gravity=new j(0,0),this.damping=.1,this.k2=.9,this.k3=.1},t.b2RopeJoint=tn,t.b2RopeJointDef=$i,t.b2Rot=J,t.b2SeparationFunction=fe,t.b2Shape=vi,t.b2ShapeCast=function(t,e){t.iterations=0,t.lambda=1,t.normal.SetZero(),t.point.SetZero();var i=e.proxyA,n=e.proxyB,r=k(i.m_radius,f)+k(n.m_radius,f),s=e.transformA,a=e.transformB,o=e.translationB,h=St.Set(0,0),u=0,l=xt;l.m_count=0;for(var c=l.m_vertices,d=i.GetSupport(J.MulTRV(s.q,j.NegV(o,j.s_t1),j.s_t0)),_=K.MulXV(s,i.GetVertex(d),wt),p=n.GetSupport(J.MulTRV(a.q,o,j.s_t0)),m=K.MulXV(a,n.GetVertex(p),Tt),g=j.SubVV(_,m,Ct),v=k(f,r-f),y=0;y<20&&P(g.Length()-v)>.004;){t.iterations+=1,d=i.GetSupport(J.MulTRV(s.q,j.NegV(g,j.s_t1),j.s_t0)),_=K.MulXV(s,i.GetVertex(d),wt),p=n.GetSupport(J.MulTRV(a.q,g,j.s_t0)),m=K.MulXV(a,n.GetVertex(p),Tt);var b=j.SubVV(_,m,At);g.Normalize();var S=j.DotVV(g,b),x=j.DotVV(g,o);if(S-v>u*x){if(x<=0)return!1;if((u=(S-v)/x)>1)return!1;h.Copy(g).SelfNeg(),l.m_count=0}var w=c[l.m_count];switch(w.indexA=p,w.wA.Copy(m).SelfMulAdd(u,o),w.indexB=d,w.wB.Copy(_),w.w.Copy(w.wB).SelfSub(w.wA),w.a=1,l.m_count+=1,l.m_count){case 1:break;case 2:l.Solve2();break;case 3:l.Solve3()}if(3===l.m_count)return!1;l.GetClosestPoint(g),++y}var T=Dt,C=It;return l.GetWitnessPoints(T,C),g.LengthSquared()>0&&(h.Copy(g).SelfNeg(),h.Normalize()),t.normal.Copy(h),t.lambda=u,t.iterations=y,!0},t.b2ShapeCastInput=function(){this.proxyA=new st,this.proxyB=new st,this.transformA=new K,this.transformB=new K,this.translationB=new j},t.b2ShapeCastOutput=function(){this.point=new j,this.normal=new j,this.lambda=0,this.iterations=0},t.b2Simplex=lt,t.b2SimplexCache=at,t.b2SimplexVertex=ut,t.b2Sin=U,t.b2SolverData=Mn,t.b2Sq=F,t.b2Sqrt=V,t.b2StackAllocator=function(){},t.b2Swap=function(t,e){var i=t[0];t[0]=e[0],e[0]=i},t.b2Sweep=$,t.b2TOIInput=ue,t.b2TOIOutput=ce,t.b2TensorDampingController=Rr,t.b2TestOverlapAABB=zt,t.b2TestOverlapShape=jt,t.b2TimeOfImpact=xe,t.b2TimeStep=Dn,t.b2Timer=it,t.b2Transform=K,t.b2TreeNode=Xt,t.b2Vec2=j,t.b2Vec2_zero=q,t.b2Vec3=X,t.b2Velocity=Bn,t.b2VelocityConstraintPoint=En,t.b2Version=T,t.b2WeldJoint=nn,t.b2WeldJointDef=en,t.b2WheelJoint=sn,t.b2WheelJointDef=rn,t.b2World=Dr,t.b2WorldManifold=Ot,t.b2_180_over_pi=B,t.b2_aabbExtension=h,t.b2_aabbMultiplier=2,t.b2_angularSleepTolerance=w,t.b2_angularSlop=c,t.b2_barrierCollisionTime=2.5,t.b2_baumgarte=.2,t.b2_branch="master",t.b2_commit="fbf51801d80fc389d43dc46524520e89043b6faf",t.b2_epsilon=r,t.b2_epsilon_sq=a,t.b2_gjk_reset=function(){t.b2_gjkCalls=0,t.b2_gjkIters=0,t.b2_gjkMaxIters=0},t.b2_invalidParticleIndex=v,t.b2_linearSleepTolerance=x,t.b2_linearSlop=l,t.b2_maxAngularCorrection=_,t.b2_maxFloat=i,t.b2_maxLinearCorrection=d,t.b2_maxManifoldPoints=2,t.b2_maxParticleForce=.5,t.b2_maxParticleIndex=2147483647,t.b2_maxParticlePressure=b,t.b2_maxPolygonVertices=8,t.b2_maxRotation=m,t.b2_maxRotationSquared=g,t.b2_maxSubSteps=8,t.b2_maxTOIContacts=32,t.b2_maxTranslation=2,t.b2_maxTranslationSquared=4,t.b2_maxTriadDistance=2,t.b2_maxTriadDistanceSquared=4,t.b2_minParticleSystemBufferCapacity=S,t.b2_minParticleWeight=1,t.b2_minPulleyLength=2,t.b2_particleStride=y,t.b2_pi=o,t.b2_pi_over_180=I,t.b2_polygonRadius=f,t.b2_timeToSleep=.5,t.b2_toiBaumgarte=.75,t.b2_toi_reset=function(){t.b2_toiTime=0,t.b2_toiMaxTime=0,t.b2_toiCalls=0,t.b2_toiIters=0,t.b2_toiMaxIters=0,t.b2_toiRootIters=0,t.b2_toiMaxRootIters=0},t.b2_two_pi=M,t.b2_velocityThreshold=1,t.b2_version=C,t.g_blockSolve=Pn,Object.defineProperty(t,"__esModule",{value:!0})}(YAt);var QAt=YAt;XAt(QAt);var JAt=QAt,KAt={};for(var ZAt in JAt)-1===ZAt.indexOf("b2_")&&(KAt[ZAt.replace("b2","")]=JAt[ZAt]);var $At=XAt(KAt),tDt=t("f8",{Static:0,Kinematic:1,Dynamic:2,Animated:3});Ee(tDt),Ee(t("f9",{None:0,BOX:1,CIRCLE:2,POLYGON:3})),Ee(t("fa",{None:0,DISTANCE:1,SPRING:2,WHEEL:3,MOUSE:4,FIXED:5,SLIDER:6,RELATIVE:7,HINGE:8}));var eDt=t("fb",{DEFAULT:1});Ee(eDt),t("fc",eDt),t("fd",{Closest:0,Any:1,AllClosest:2,All:3});var iDt=t("fe",{None:"none-contact",BEGIN_CONTACT:"begin-contact",END_CONTACT:"end-contact",PRE_SOLVE:"pre-solve",POST_SOLVE:"post-solve"}),nDt=(t("ff",{None:0,Shape:1,Joint:2,Aabb:4,Pair:8,CenterOfMass:16,Particle:32,Controller:64,All:63}),t("fg",32)),rDt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=3?1:n):-1},i.getFixtures=function(){return this._fixtures},i.getPoints=function(){return this._points},i.getNormals=function(){return this._normals},i.getFractions=function(){return this._fractions},e}($At.RayCastCallback);function oDt(t,e){var i=e.length;return e[t<0?i- -t%i:t%i]}function hDt(t,e,i){for(var n=[];e0}function dDt(t,e,i){return SDt(t,e,i)>=0}function _Dt(t,e,i){return SDt(t,e,i)<=0}function pDt(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function mDt(t){gDt(t)||t.reverse()}function gDt(t){return t.length<3||vDt(t)>0}function vDt(t){var e,i=0;for(e=0;e0&&d<1&&_>0&&_<1&&(r.x=s+d*(o-s),r.y=a+d*(h-a),!0))}function SDt(t,e,i){return t.x*(e.y-i.y)+e.x*(i.y-t.y)+i.x*(t.y-e.y)}var xDt=Object.freeze({__proto__:null,ConvexPartition:function t(e){mDt(e);for(var i,n,r,s=[],a=0,o=0,h=0,u=new ds,l=new ds,c=0,f=0,d=0;dm&&(g=v,m=y)}n=hDt(d,g,e),r=hDt(g,d,e)}return(s=s.concat(t(n))).concat(t(r))}s.push(e);for(var b=s.length-1;b>=0;b--)0==s[b].length&&s.splice(b,0);return s},ForceCounterClockWise:mDt,IsCounterClockWise:gDt});function wDt(t){BDt(t);for(var e=!0,i=0,n=t.length;i0||CDt(c,l,a[(o+2)%h])>0)){for(var m=[],g=(o+1)%h;g!==o;g=(g+1)%h)m.push(a[g]);m.push(u,c),a=m,h=m.length,o=-1,s.splice(f,1)}}r.push(a)}return r}var TDt=function(){this.isActive=!1,this.isConvex=!1,this.isEar=!1,this.point=null,this.angleCos=0,this.shouldUpdate=!1,this.index=0,this.prev=null,this.next=null};function CDt(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ADt(t,e,i){return CDt(t,e,i)<0}function DDt(t,e){return t.x===e.x&&t.y===e.y}function IDt(t){for(var e=0,i=0,n=t.length;i0}function BDt(t){IDt(t)&&t.reverse()}function MDt(t,e){if(t.shouldUpdate){t.shouldUpdate=!1;var i=t.prev.point,n=t.point,r=t.next.point;t.isConvex=ADt(i,n,r);var s=i.x-n.x,a=i.y-n.y,o=Math.sqrt(s*s+a*a);s/=o,a/=o;var h=r.x-n.x,u=r.y-n.y,l=Math.sqrt(h*h+u*u);if(h/=l,u/=l,t.angleCos=s*h+a*u,t.isConvex){t.isEar=!0;for(var c=0,f=e.length;c0&&m>0&&g>0){t.isEar=!1;break}if(0===p&&m>=0&&g>=0&&(CDt(i,d.prev.point,n)>0||CDt(i,d.next.point,n)>0)){t.isEar=!1;break}if(0===m&&p>=0&&g>=0&&(CDt(n,d.prev.point,r)>0||CDt(n,d.next.point,r)>0)){t.isEar=!1;break}if(0===g&&p>=0&&m>=0&&(CDt(r,d.prev.point,i)>0||CDt(r,d.next.point,i)>0)){t.isEar=!1;break}}}}}else t.isEar=!1}}function PDt(t){for(var e=t,i=t;;)if(DDt(e.point,e.next.point)||0===CDt(e.prev.point,e.point,e.next.point)){if(e.prev.next=e.next,e.next.prev=e.prev,e.prev.shouldUpdate=!0,e.next.shouldUpdate=!0,e===e.next)break;i=e.prev,e=e.next}else if((e=e.next)===i)break}function EDt(t){if(BDt(t),t.length<4)return[t];for(var e=t.length,i=[],n=[],r=0;ru.angleCos&&(u=c):u=c)}if(!u){for(var f=0;f1e-5)return it(9644),null}}break}if(n.push([u.prev.point,u.point,u.next.point]),u.isActive=!1,u.prev.next=u.next,u.next.prev=u.prev,u.prev.shouldUpdate=!0,u.next.shouldUpdate=!0,PDt(u.next),h===e-4)break;for(var g=0;g1e-5&&n.push([b,S,x])}}return n}var kDt=Object.freeze({__proto__:null,ConvexPartition:wDt}),RDt=function(t){if(1===t){for(var e=this,i=function(t){var i="_"+(1<e;)this.physicsWorld.step(e,i,n),this._accumulator-=e;for(var s=this._delayEvents,a=0,o=s.length;a0){for(var a=r.getPoints(),o=r.getNormals(),h=r.getFractions(),u=[],l=0,c=s.length;lMath.PI&&(r-=Qi);var s=(this._animatedAngle-r)*n;this._animatedAngle<-Yi&&r>Yi&&(s=(this._animatedAngle+Qi-r)*n),this._animatedAngle>Yi&&r<-Yi&&(s=(this._animatedAngle-Qi-r)*n),e.SetAngularVelocity(s)}},e.syncSceneToPhysics=function(){var t=this._rigidBody.node.hasChangedFlags;t&&this.nodeTransformChanged(t)},e.syncPositionToPhysics=function(t){void 0===t&&(t=!1);var e=this._body;if(e){var i,n=this._rigidBody.node.worldPosition,r=this._rigidBody.type;(i=3===r?e.GetLinearVelocity():e.GetPosition()).x=n.x/nDt,i.y=n.y/nDt,3===r&&t?this._animatedPos.set(i.x,i.y):e.SetTransformVec(i,e.GetAngle())}},e.syncRotationToPhysics=function(t){void 0===t&&(t=!1);var e=this._body;if(e){var i=this._rigidBody.node.worldRotation,n=APt;kr.toEulerInYXZOrder(n,i);var r=nn(n.z);3===this._rigidBody.type&&t?this._animatedAngle=r:e.SetTransformVec(e.GetPosition(),r)}},e.resetVelocity=function(){var t=this._body;if(t){var e=t.m_linearVelocity;e.Set(0,0),t.SetLinearVelocity(e),t.SetAngularVelocity(0)}},e.setType=function(t){FDt.instance.physicsWorld._updateBodyType(this),this._body.SetType(t)},e.setLinearDamping=function(t){this._body.SetLinearDamping(t)},e.setAngularDamping=function(t){this._body.SetAngularDamping(t)},e.setGravityScale=function(t){this._body.SetGravityScale(t)},e.setFixedRotation=function(t){this._body.SetFixedRotation(t)},e.setAllowSleep=function(t){this._body.SetSleepingAllowed(t)},e.isActive=function(){return this._body.IsActive()},e.setActive=function(t){this._body.m_world.IsLocked()||this._body.SetActive(t)},e.wakeUp=function(){this._body.SetAwake(!0)},e.sleep=function(){this._body.SetAwake(!1)},e.getMass=function(){return this._body.GetMass()},e.setLinearVelocity=function(t){this._body.SetLinearVelocity(t)},e.getLinearVelocity=function(t){var e=this._body.GetLinearVelocity();return t.x=e.x,t.y=e.y,t},e.getLinearVelocityFromWorldPoint=function(t,e){return DPt.Set(t.x/nDt,t.y/nDt),this._body.GetLinearVelocityFromWorldPoint(DPt,e),e.x*=nDt,e.y*=nDt,e},e.setAngularVelocity=function(t){this._body.SetAngularVelocity(t)},e.getAngularVelocity=function(){return this._body.GetAngularVelocity()},e.getLocalVector=function(t,e){return e=e||new ds,DPt.Set(t.x/nDt,t.y/nDt),this._body.GetLocalVector(DPt,e),e.x*=nDt,e.y*=nDt,e},e.getWorldVector=function(t,e){return DPt.Set(t.x/nDt,t.y/nDt),this._body.GetWorldVector(DPt,e),e.x*=nDt,e.y*=nDt,e},e.getLocalPoint=function(t,e){return e=e||new ds,DPt.Set(t.x/nDt,t.y/nDt),this._body.GetLocalPoint(DPt,e),e.x*=nDt,e.y*=nDt,e},e.getWorldPoint=function(t,e){return e=e||new ds,DPt.Set(t.x/nDt,t.y/nDt),this._body.GetWorldPoint(DPt,e),e.x*=nDt,e.y*=nDt,e},e.getLocalCenter=function(t){t=t||new ds;var e=this._body.GetLocalCenter();return t.x=e.x*nDt,t.y=e.y*nDt,t},e.getWorldCenter=function(t){t=t||new ds;var e=this._body.GetWorldCenter();return t.x=e.x*nDt,t.y=e.y*nDt,t},e.getInertia=function(){return this._body.GetInertia()},e.applyForce=function(t,e,i){this._body&&(DPt.Set(e.x/nDt,e.y/nDt),this._body.ApplyForce(t,DPt,i))},e.applyForceToCenter=function(t,e){this._body&&this._body.ApplyForceToCenter(t,e)},e.applyTorque=function(t,e){this._body&&this._body.ApplyTorque(t,e)},e.applyLinearImpulse=function(t,e,i){this._body&&(DPt.Set(e.x/nDt,e.y/nDt),this._body.ApplyLinearImpulse(t,DPt,i))},e.applyLinearImpulseToCenter=function(t,e){this._body&&this._body.ApplyLinearImpulse(t,this._body.GetPosition(),e)},e.applyAngularImpulse=function(t,e){this._body&&this._body.ApplyAngularImpulse(t,e)},n(t,[{key:"impl",get:function(){return this._body}},{key:"_imp",set:function(t){this._body=t}},{key:"rigidBody",get:function(){return this._rigidBody}},{key:"isAwake",get:function(){return this._body.IsAwake()}},{key:"isSleeping",get:function(){return!this._body.IsAwake()}}]),t}(),BPt=new $At.Filter,MPt=new $At.Vec2,PPt=new $At.Vec2;function EPt(t){var e=t.collider;return e.body?BPt.categoryBits=1===e.group?e.body.group:e.group:BPt.categoryBits=e.group,BPt.maskBits=FDt.instance.collisionMatrix[BPt.categoryBits],BPt}var kPt,RPt=function(){function t(){this._shapes=[],this._fixtures=[],this._collider=null,this._body=null,this._inited=!1,this._rect=new ys}var e=t.prototype;return e.initialize=function(t){this._collider=t},e.onLoad=function(){},e.onEnable=function(){FDt.instance._callAfterStep(this,this._init)},e.onDisable=function(){FDt.instance._callAfterStep(this,this._destroy)},e.start=function(){},e.onGroupChanged=function(){var t=EPt(this);this._fixtures.forEach((function(e){e.SetFilterData(t)}))},e.apply=function(){this._destroy(),this.collider.enabledInHierarchy&&this._init()},e.getFixtureIndex=function(t){return this._fixtures.indexOf(t)},e._createShapes=function(){return[]},e._init=function(){if(!this._inited){var t=this.collider,e=t.node.worldScale,i=ir.ZERO,n=t.getComponent(KMt);n&&n.impl&&n.impl.impl?this._body=n.impl.impl:(this._body=FDt.instance.physicsWorld.groundBodyImpl,i=t.node.worldPosition);for(var r=0===e.x&&0===e.y?[]:this._createShapes(e.x,e.y,i.x,i.y),s=EPt(this),a=0;a=0;i--){var n=t[i];n.m_userData=null,FDt.instance.physicsWorld.unregisterContactFixture(n),e&&e.DestroyFixture(n)}this._body=null,this._fixtures.length=0,this._shapes.length=0,this._inited=!1}},n(t,[{key:"impl",get:function(){return this._shapes}},{key:"collider",get:function(){return this._collider}},{key:"worldAABB",get:function(){for(var t=1e7,e=t,i=t,n=-1e7,r=-1e7,s=this._fixtures,a=0;an&&(n=PPt.x),PPt.y>r&&(r=PPt.y)}e*=nDt,i*=nDt,n*=nDt,r*=nDt;var c=this._rect;return c.x=e,c.y=i,c.width=n-e,c.height=r-i,c}}]),t}(),OPt=new ys,FPt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&a[0].equals(a[a.length-1])&&(a.length-=1);var o=wDt(a);if(!o)return it(16408,s.node.name),r;for(var h=s.offset,u=0;u=0&&e.allMaterials.splice(i,1),!0}return!1},i.setValues=function(t,i,n,r){var s=this._friction!==t||this._rollingFriction!==i||this._spinningFriction!==n||this._restitution!==r;this._friction=t,this._rollingFriction=i,this._spinningFriction=n,this._restitution=r,s&&this.emit(e.EVENT_UPDATE)},n(e,[{key:"friction",get:function(){return this._friction},set:function(t){Ki(this._friction,t)||(this._friction=t,this.emit(e.EVENT_UPDATE))}},{key:"rollingFriction",get:function(){return this._rollingFriction},set:function(t){Ki(this._rollingFriction,t)||(this._rollingFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"spinningFriction",get:function(){return this._spinningFriction},set:function(t){Ki(this._spinningFriction,t)||(this._spinningFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"restitution",get:function(){return this._restitution},set:function(t){Ki(this._restitution,t)||(this._restitution=t,this.emit(e.EVENT_UPDATE))}}]),e}(Cm),FEt.allMaterials=[],FEt.EVENT_UPDATE="event_update",FEt._idCounter=0,y((PEt=FEt).prototype,"friction",[AEt],Object.getOwnPropertyDescriptor(PEt.prototype,"friction"),PEt.prototype),y(PEt.prototype,"rollingFriction",[DEt],Object.getOwnPropertyDescriptor(PEt.prototype,"rollingFriction"),PEt.prototype),y(PEt.prototype,"spinningFriction",[IEt],Object.getOwnPropertyDescriptor(PEt.prototype,"spinningFriction"),PEt.prototype),y(PEt.prototype,"restitution",[BEt],Object.getOwnPropertyDescriptor(PEt.prototype,"restitution"),PEt.prototype),EEt=Nh(PEt.prototype,"_friction",[hu],(function(){return.6})),kEt=Nh(PEt.prototype,"_rollingFriction",[hu],(function(){return 0})),REt=Nh(PEt.prototype,"_spinningFriction",[hu],(function(){return 0})),OEt=Nh(PEt.prototype,"_restitution",[hu],(function(){return 0})),MEt=PEt))||MEt)),jEt=t("fE",function(){function t(){this._hitPoint=new ir,this._hitNormal=new ir,this._distance=0,this._collider=null,this._closestHitFraction=0}var e=t.prototype;return e._assign=function(t,e,i,n,r){ir.copy(this._hitPoint,t),ir.copy(this._hitNormal,n),this._distance=e,this._collider=i,r&&(this._closestHitFraction=r)},e.clone=function(){var e=new t;return ir.copy(e._hitPoint,this._hitPoint),ir.copy(e._hitNormal,this._hitNormal),e._distance=this._distance,e._collider=this._collider,e._closestHitFraction=this._closestHitFraction,e},n(t,[{key:"hitPoint",get:function(){return this._hitPoint}},{key:"distance",get:function(){return this._distance}},{key:"collider",get:function(){return this._collider}},{key:"hitNormal",get:function(){return this._hitNormal}},{key:"closestHitFraction",get:function(){return this._closestHitFraction}}]),t}()),qEt=t("fF",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=this._fixedTimeStep)){this.physicsWorld.syncSceneToPhysics();break}this.physicsWorld.syncSceneToPhysics(),this.physicsWorld.step(this._fixedTimeStep),this.physicsWorld.emitEvents(),this.physicsWorld.syncAfterEvents(),this._accumulator-=this._fixedTimeStep,this._subStepCount++}GE.emit("director_after_physics")}}else this.physicsWorld.syncSceneToPhysics()},e.resetConfiguration=function(t){var e=t?t.allowSleep:ukt("physics","allowSleep");"boolean"==typeof e&&(this._allowSleep=e);var i=t?t.fixedTimeStep:ukt("physics","fixedTimeStep");"number"==typeof i&&(this._fixedTimeStep=i);var n=t?t.maxSubSteps:ukt("physics","maxSubSteps");"number"==typeof n&&(this._maxSubSteps=n);var r=t?t.sleepThreshold:ukt("physics","sleepThreshold");"number"==typeof r&&(this._sleepThreshold=r);var s=t?t.autoSimulation:ukt("physics","autoSimulation");"boolean"==typeof s&&(this.autoSimulation=s);var a=t?t.gravity:ukt("physics","gravity");a&&ir.copy(this._gravity,a);var o=t?t.collisionMatrix:ukt("physics","collisionMatrix");if(o)for(var h in o)this.collisionMatrix[""+(1<>>0,this.raycastOptions.maxDistance=i,this.raycastOptions.queryTrigger=n,this.physicsWorld.raycast(t,this.raycastOptions,this.raycastResultPool,this.raycastResults))},e.raycastClosest=function(t,e,i,n){return void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),!!this.physicsWorld&&(this.raycastOptions.mask=e>>>0,this.raycastOptions.maxDistance=i,this.raycastOptions.queryTrigger=n,this.physicsWorld.raycastClosest(t,this.raycastOptions,this.raycastClosestResult))},e.lineStripCast=function(t,e,i,n){if(void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),t.length<2)return!1;this.lineStripCastResults=[];for(var r=0,s=new Ls,a=1;ai);++a){var o=t[a-1],h=t[a],u=new ir;ir.subtract(u,h,o);var l=ir.len(u);if(r+=l,ir.multiplyScalar(u,u,1/l),s.d=u,s.o=o,this.raycast(s,e,l,n))for(var c=0;c0},e.lineStripCastClosest=function(t,e,i,n){if(void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),t.length<2)return!1;for(var r=0,s=new Ls,a=!1,o=1;oi);++o){var h=t[o-1],u=t[o],l=new ir;ir.subtract(l,u,h);var c=ir.len(l);if(r+=c,ir.multiplyScalar(l,l,1/c),s.d=l,s.o=h,a=this.raycastClosest(s,e,c,n)){var f=this.raycastClosestResult,d=new qEt;d._assign(f.hitPoint,f.distance,f.collider,f.hitNormal,o-1),this.lineStripCastClosestResult=d;break}}return a},e.sweepBox=function(t,e,i,n,r,s){return void 0===n&&(n=4294967295),void 0===r&&(r=1e7),void 0===s&&(s=!0),!!this.physicsWorld&&(this.sweepResultPool.reset(),this.sweepCastResults.length=0,this.raycastOptions.mask=n>>>0,this.raycastOptions.maxDistance=r,this.raycastOptions.queryTrigger=s,this.physicsWorld.sweepBox(t,e,i,this.raycastOptions,this.sweepResultPool,this.sweepCastResults))},e.sweepBoxClosest=function(t,e,i,n,r,s){return void 0===n&&(n=4294967295),void 0===r&&(r=1e7),void 0===s&&(s=!0),!!this.physicsWorld&&(this.raycastOptions.mask=n>>>0,this.raycastOptions.maxDistance=r,this.raycastOptions.queryTrigger=s,this.physicsWorld.sweepBoxClosest(t,e,i,this.raycastOptions,this.sweepCastClosestResult))},e.sweepSphere=function(t,e,i,n,r){return void 0===i&&(i=4294967295),void 0===n&&(n=1e7),void 0===r&&(r=!0),!!this.physicsWorld&&(this.sweepResultPool.reset(),this.sweepCastResults.length=0,this.raycastOptions.mask=i>>>0,this.raycastOptions.maxDistance=n,this.raycastOptions.queryTrigger=r,this.physicsWorld.sweepSphere(t,e,this.raycastOptions,this.sweepResultPool,this.sweepCastResults))},e.sweepSphereClosest=function(t,e,i,n,r){return void 0===i&&(i=4294967295),void 0===n&&(n=1e7),void 0===r&&(r=!0),!!this.physicsWorld&&(this.raycastOptions.mask=i>>>0,this.raycastOptions.maxDistance=n,this.raycastOptions.queryTrigger=r,this.physicsWorld.sweepSphereClosest(t,e,this.raycastOptions,this.sweepCastClosestResult))},e.sweepCapsule=function(t,e,i,n,r,s,a){return void 0===r&&(r=4294967295),void 0===s&&(s=1e7),void 0===a&&(a=!0),!!this.physicsWorld&&(this.sweepResultPool.reset(),this.sweepCastResults.length=0,this.raycastOptions.mask=r>>>0,this.raycastOptions.maxDistance=s,this.raycastOptions.queryTrigger=a,this.physicsWorld.sweepCapsule(t,e,i,n,this.raycastOptions,this.sweepResultPool,this.sweepCastResults))},e.sweepCapsuleClosest=function(t,e,i,n,r,s,a){return void 0===r&&(r=4294967295),void 0===s&&(s=1e7),void 0===a&&(a=!0),!!this.physicsWorld&&(this.raycastOptions.mask=r>>>0,this.raycastOptions.maxDistance=s,this.raycastOptions.queryTrigger=a,this.physicsWorld.sweepCapsuleClosest(t,e,i,n,this.raycastOptions,this.sweepCastClosestResult))},e._updateMaterial=function(){this.physicsWorld&&this.physicsWorld.setDefaultMaterial(this._material)},i.constructAndRegister=function(){if(!i._instance){var t=this.doConstructAndRegister();t&&Uk.onPostProjectInitDelegate.add(t.initDefaultMaterial.bind(t))}},i.constructAndRegisterManually=function(){return Promise.resolve()},i.doConstructAndRegister=function(){var t;if(null!==(t=ukt("physics","enabled"))&&void 0!==t&&!t)return null;if(!i._instance){var e=new i;i._instance=e,e.resetConfiguration(),KPt(e),GE.registerSystem(i.ID,e,e.priority)}return i._instance},n(i,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable=t}},{key:"allowSleep",get:function(){return this._allowSleep},set:function(t){this._allowSleep=t,this.physicsWorld&&this.physicsWorld.setAllowSleep(t)}},{key:"maxSubSteps",get:function(){return this._maxSubSteps},set:function(t){this._maxSubSteps=t}},{key:"fixedTimeStep",get:function(){return this._fixedTimeStep},set:function(t){this._fixedTimeStep=t}},{key:"gravity",get:function(){return this._gravity},set:function(t){this._gravity.set(t),this.physicsWorld&&this.physicsWorld.setGravity(t)}},{key:"sleepThreshold",get:function(){return this._sleepThreshold},set:function(t){this._sleepThreshold=t}},{key:"autoSimulation",get:function(){return this._autoSimulation},set:function(t){this._autoSimulation=t}},{key:"defaultMaterial",get:function(){return this._material}},{key:"physicsWorld",get:function(){return JPt.physicsWorld}},{key:"debugDrawFlags",get:function(){return this.physicsWorld.debugDrawFlags},set:function(t){this.physicsWorld.debugDrawFlags=t}},{key:"debugDrawConstraintSize",get:function(){return this.physicsWorld.debugDrawConstraintSize},set:function(t){this.physicsWorld.debugDrawConstraintSize=t}}],[{key:"PHYSICS_NONE",get:function(){return!JPt.id}},{key:"PHYSICS_BUILTIN",get:function(){return"builtin"===JPt.id}},{key:"PHYSICS_CANNON",get:function(){return"cannon.js"===JPt.id}},{key:"PHYSICS_BULLET",get:function(){return"bullet"===JPt.id}},{key:"PHYSICS_PHYSX",get:function(){return"physx"===JPt.id}},{key:"PhysicsGroup",get:function(){return qDt}},{key:"instance",get:function(){return i._instance}}]),i}(Of));lkt.ID="PHYSICS",lkt._instance=null,GE.once("director_init",(function(){lkt.constructAndRegister()}));var ckt,fkt,dkt,_kt,pkt,mkt,gkt,vkt,ykt,bkt,Skt,xkt=t("fA",(XEt=Qh("cc.RigidBody"),YEt=Kh(-1),QEt=Eu(lkt.PhysicsGroup),JEt=Eu(LDt),XEt(KEt=Zh(KEt=YEt((hkt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r2||this._direction!==t&&(this._direction=t,this._shape&&this.shape.setDirection(t))}},{key:"height",get:function(){return 2*this._radius+this._cylinderHeight},set:function(t){var e=t-2*this._radius;e<0&&(e=0),this.cylinderHeight=e}},{key:"worldHeight",get:function(){return 2*this._radius*this._getRadiusScale()+this._cylinderHeight*this._getHeightScale()}},{key:"shape",get:function(){return this._shape}}]),e}(Ikt),y(Okt.prototype,"direction",[kkt],Object.getOwnPropertyDescriptor(Okt.prototype,"direction"),Okt.prototype),Fkt=Nh(Okt.prototype,"_radius",[hu],(function(){return.5})),Lkt=Nh(Okt.prototype,"_cylinderHeight",[hu],(function(){return 1})),Vkt=Nh(Okt.prototype,"_direction",[hu],(function(){return 1})),Rkt=Okt))||Rkt)),WRt=t("fL",(Nkt=Qh("cc.CylinderCollider"),zkt=Eu(VDt),Nkt((Gkt=function(t){function e(){var e;return(e=t.call(this,3)||this)._radius=Hkt&&Hkt(),e._height=Wkt&&Wkt(),e._direction=jkt&&jkt(),e}return s(e,t),n(e,[{key:"radius",get:function(){return this._radius},set:function(t){this._radius!==t&&(this._radius=Math.abs(t),this._shape&&this.shape.setRadius(t))}},{key:"height",get:function(){return this._height},set:function(t){this._height!==t&&(this._height=Math.abs(t),this._shape&&this.shape.setHeight(t))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(t<0||t>2||(this._direction=t,this._shape&&this.shape.setDirection(t)))}},{key:"shape",get:function(){return this._shape}}]),e}(Ikt),y(Gkt.prototype,"direction",[zkt],Object.getOwnPropertyDescriptor(Gkt.prototype,"direction"),Gkt.prototype),Hkt=Nh(Gkt.prototype,"_radius",[hu],(function(){return.5})),Wkt=Nh(Gkt.prototype,"_height",[hu],(function(){return 2})),jkt=Nh(Gkt.prototype,"_direction",[hu],(function(){return 1})),Ukt=Gkt))||Ukt)),jRt=t("fM",(qkt=Qh("cc.ConeCollider"),Xkt=Eu(VDt),qkt((Qkt=function(t){function e(){var e;return(e=t.call(this,4)||this)._radius=Jkt&&Jkt(),e._height=Kkt&&Kkt(),e._direction=Zkt&&Zkt(),e}return s(e,t),n(e,[{key:"radius",get:function(){return this._radius},set:function(t){this._radius!==t&&(this._radius=Math.abs(t),this._shape&&this.shape.setRadius(t))}},{key:"height",get:function(){return this._height},set:function(t){this._height!==t&&(t<0&&(t=0),this._height=t,this._shape&&this.shape.setHeight(t))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(t<0||t>2||(this._direction=t,this._shape&&this.shape.setDirection(t)))}},{key:"shape",get:function(){return this._shape}}]),e}(Ikt),y(Qkt.prototype,"direction",[Xkt],Object.getOwnPropertyDescriptor(Qkt.prototype,"direction"),Qkt.prototype),Jkt=Nh(Qkt.prototype,"_radius",[hu],(function(){return.5})),Kkt=Nh(Qkt.prototype,"_height",[hu],(function(){return 1})),Zkt=Nh(Qkt.prototype,"_direction",[hu],(function(){return 1})),Ykt=Qkt))||Ykt)),qRt=t("fK",($kt=Qh("cc.MeshCollider"),tRt=Eu(CR),$kt((iRt=function(t){function e(){var e;return(e=t.call(this,5)||this)._mesh=nRt&&nRt(),e._convex=rRt&&rRt(),e}return s(e,t),e.prototype.onEnable=function(){if(t.prototype.onEnable.call(this),this.node){var e=this.node.getComponent(xkt);e&&e.isValid&&1===e.type&&!this.convex&&at(9630,this.node.name)}},n(e,[{key:"mesh",get:function(){return this._mesh},set:function(t){this._mesh!==t&&(this._mesh=t,this._shape&&this.shape.setMesh(this._mesh))}},{key:"convex",get:function(){return this._convex},set:function(t){this._convex!==t&&(this._convex=t,this._shape&&this._mesh&&this.shape.setMesh(this._mesh))}},{key:"shape",get:function(){return this._shape}}]),e}(Ikt),y(iRt.prototype,"mesh",[tRt],Object.getOwnPropertyDescriptor(iRt.prototype,"mesh"),iRt.prototype),nRt=Nh(iRt.prototype,"_mesh",[hu],(function(){return null})),rRt=Nh(iRt.prototype,"_convex",[hu],(function(){return!1})),eRt=iRt))||eRt)),XRt=t("fC",Qh("cc.ConstantForce")(sRt=Jh(xkt)(sRt=Zh((aRt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rt)){for(var e=this.buffer.byteLength;e=lOt?this.tileSize=e.readDouble():this.tileSize=e.readFloat(),this.tileSize=Math.floor(100*this.tileSize)/100,e.readIntArray(this._blockCount),this.weightMapSize=e.readInt16(),this.lightMapSize=e.readInt16();var i=e.readInt();this.heights=new Uint16Array(i);for(var n=0;n=uOt){var o=e.readInt();this.normals=new Float32Array(o);for(var h=0;h=sOt){var c=e.readInt();this.layerBuffer=new Array(c);for(var f=0;f=aOt){var d=e.readInt();this._layerBinaryInfos=new Array(d);for(var _=0;_=lOt?this._layerBinaryInfos[_].tileSize=e.readDouble():this._layerBinaryInfos[_].tileSize=e.readFloat(),this._layerBinaryInfos[_].detailMapId=e.readString(),this._version>=oOt&&(this._layerBinaryInfos[_].normalMapId=e.readString(),this._version>=lOt?(this._layerBinaryInfos[_].roughness=e.readDouble(),this._layerBinaryInfos[_].metallic=e.readDouble()):(this._layerBinaryInfos[_].roughness=e.readFloat(),this._layerBinaryInfos[_].metallic=e.readFloat()))}return!0},i._exportNativeData=function(){var t=new dOt;t.writeInt32(cOt),t.writeDouble(this.tileSize),t.writeIntArray(this._blockCount),t.writeInt16(this.weightMapSize),t.writeInt16(this.lightMapSize),t.writeInt32(this.heights.length);for(var e=0;e=0&&(be(this.ghostStruct.wrappedShapes,i),t.setCompound(0),this.ghostEnabled=!1)}else{var n=this.bodyStruct.wrappedShapes.indexOf(t);n>=0&&(this.bodyStruct.useCompound?t.setCompound(0):dEt.CollisionObject_setCollisionShape(this.body,dEt.EmptyShape_static()),dEt.CollisionObject_activate(this.body,!0),this.dirty|=1,be(this.bodyStruct.wrappedShapes,n),this.bodyEnabled=!1)}},e.addJoint=function(t,e){e?this.wrappedJoints1.indexOf(t)<0&&this.wrappedJoints1.push(t):this.wrappedJoints0.indexOf(t)<0&&this.wrappedJoints0.push(t)},e.removeJoint=function(t,e){if(e){var i=this.wrappedJoints1.indexOf(t);i>=0&&be(this.wrappedJoints1,i)}else{var n=this.wrappedJoints0.indexOf(t);n>=0&&be(this.wrappedJoints0,n)}},e.updateDirty=function(){this.dirty&&(this.bodyIndex>=0&&1&this.dirty&&this.updateBodyByReAdd(),this.ghostIndex>=0&&2&this.dirty&&this.updateGhostByReAdd(),this.dirty=0)},e.syncSceneToPhysics=function(){if(this.node.hasChangedFlags){var t=vEt.instance.BT_QUAT_0,e=dEt.CollisionObject_getWorldTransform(this.body);if(zEt(t,this.node.worldRotation),VEt(dEt.Transform_getOrigin(e),this.node.worldPosition),dEt.Transform_setRotation(e,t),4&this.node.hasChangedFlags&&this.syncBodyScale(),dEt.CollisionObject_isKinematicObject(this.body)){var i=dEt.RigidBody_getMotionState(this.body);i&&dEt.MotionState_setWorldTransform(i,e)}else this.isBodySleeping()&&dEt.CollisionObject_activate(this.body,!1)}},e.syncPhysicsToScene=function(){dEt.CollisionObject_isStaticOrKinematicObject(this.body)||this.syncPhysicsToGraphics()},e.syncPhysicsToGraphics=function(){if(!this.isBodySleeping()){var t=vEt.instance.BT_QUAT_0,e=vEt.instance.BT_TRANSFORM_0;dEt.RigidBody_getWorldTransform(this.body,e);var i=dEt.Transform_getRotationAndOrigin(e,t);if(this.node.worldRotation=UEt(UNt,t),this.node.worldPosition=NEt(zNt,i),this._ghostStruct){var n=dEt.CollisionObject_getWorldTransform(this.ghost);VEt(dEt.Transform_getOrigin(n),this.node.worldPosition),zEt(t,this.node.worldRotation),dEt.Transform_setRotation(n,t)}}},e.syncSceneToGhost=function(){if(this.node.hasChangedFlags){var t=vEt.instance.BT_QUAT_0,e=dEt.CollisionObject_getWorldTransform(this.ghost);VEt(dEt.Transform_getOrigin(e),this.node.worldPosition),zEt(t,this.node.worldRotation),dEt.Transform_setRotation(e,t),4&this.node.hasChangedFlags&&this.syncGhostScale(),dEt.CollisionObject_activate(this.ghost,!1)}},e.syncInitialBody=function(){var t=vEt.instance.BT_QUAT_0,e=dEt.CollisionObject_getWorldTransform(this.body);VEt(dEt.Transform_getOrigin(e),this.node.worldPosition),zEt(t,this.node.worldRotation),dEt.Transform_setRotation(e,t),this.syncBodyScale(),dEt.CollisionObject_activate(this.body,!1)},e.syncInitialGhost=function(){var t=vEt.instance.BT_QUAT_0,e=dEt.CollisionObject_getWorldTransform(this.ghost);VEt(dEt.Transform_getOrigin(e),this.node.worldPosition),zEt(t,this.node.worldRotation),dEt.Transform_setRotation(e,t),this.syncGhostScale(),dEt.CollisionObject_activate(this.body,!1)},e.syncBodyScale=function(){for(var t=0;t=0&&(this.wrappedWorld.removeSharedBody(this),this.bodyIndex=this.wrappedWorld.bodies.length,this.wrappedWorld.addSharedBody(this))},e.updateGhostByReAdd=function(){this.ghostIndex>=0&&(this.wrappedWorld.removeGhostObject(this),this.ghostIndex=this.wrappedWorld.ghosts.length,this.wrappedWorld.addGhostObject(this))},e.destroy=function(){if(t.sharedBodesMap.delete(this.node.uuid),this.node=null,this.wrappedWorld=null,this._bodyStruct){var e=this._bodyStruct;vEt.delWrapper(this.id,_Et.BODY_CACHE_NAME),dEt._safe_delete(e.motionState,3),dEt._safe_delete(e.compound,5),dEt._safe_delete(e.body,4),this._bodyStruct=null}if(this._ghostStruct){var i=this._ghostStruct;dEt._safe_delete(i.compound,5),dEt._safe_delete(i.ghost,4),this._ghostStruct=null}},e.isBodySleeping=function(){return dEt.CollisionObject_isSleeping(this.body)},n(t,[{key:"wrappedBody",get:function(){return this._wrappedBody}},{key:"bodyCompoundShape",get:function(){return this.bodyStruct.compound}},{key:"ghostCompoundShape",get:function(){return this.ghostStruct.compound}},{key:"body",get:function(){return this.bodyStruct.body}},{key:"ghost",get:function(){return this.ghostStruct.ghost}},{key:"collisionFilterGroup",get:function(){return this._collisionFilterGroup},set:function(t){t!==this._collisionFilterGroup&&(this._collisionFilterGroup=t,this.dirty|=1,this.dirty|=2)}},{key:"collisionFilterMask",get:function(){return this._collisionFilterMask},set:function(t){t!==this._collisionFilterMask&&(this._collisionFilterMask=t,this.dirty|=1,this.dirty|=2)}},{key:"bodyStruct",get:function(){return this._instantiateBodyStruct(),this._bodyStruct}},{key:"ghostStruct",get:function(){return this._instantiateGhostStruct(),this._ghostStruct}},{key:"bodyEnabled",set:function(t){if(t){if(this.bodyIndex<0){if(0===this.bodyStruct.wrappedShapes.length){if(!this.wrappedBody)return;if(!this.wrappedBody.rigidBody.isDynamic)return}this.bodyIndex=this.wrappedWorld.bodies.length,this.wrappedWorld.addSharedBody(this),this.syncInitialBody()}}else this.bodyIndex>=0&&(0===this.bodyStruct.wrappedShapes.length&&null==this.wrappedBody||0===this.bodyStruct.wrappedShapes.length&&null!=this.wrappedBody&&!this.wrappedBody.isEnabled||0===this.bodyStruct.wrappedShapes.length&&null!=this.wrappedBody&&!this.wrappedBody.rigidBody.enabledInHierarchy)&&(dEt.RigidBody_clearState(this.body),this.bodyIndex=-1,this.wrappedWorld.removeSharedBody(this))}},{key:"ghostEnabled",set:function(t){t?this.ghostIndex<0&&this.ghostStruct.wrappedShapes.length>0&&(this.ghostIndex=1,this.wrappedWorld.addGhostObject(this),this.syncInitialGhost()):this.ghostIndex>=0&&0===this.ghostStruct.wrappedShapes.length&&this.ghost&&(this.ghostIndex=-1,this.wrappedWorld.removeGhostObject(this))}},{key:"reference",set:function(t){t?this.ref++:this.ref--,0===this.ref&&this.destroy()}}]),t}();HNt.idCounter=0,HNt.sharedBodesMap=new Map;var WNt=yEt,jNt={},qNt=function(){function t(){this.id=t.idCounter++,this._isEnabled=!1,this._isTrigger=!1,this._isInitialized=!1,this._impl=0,this._compound=0,this.quat=dEt.Quat_new(0,0,0,1),this.transform=dEt.Transform_new(),this._collider=void 0,this._sharedBody=void 0}var e=t.prototype;return e.updateEventListener=function(){this._sharedBody.wrappedWorld.updateNeedEmitEvents(this.collider.needCollisionEvent||this.collider.needTriggerEvent)},e.setMaterial=function(t){var e=null==t?lkt.instance.defaultMaterial:t;if(!this._isTrigger&&this._isEnabled)if(this._compound){jNt[e._uuid]||(jNt[e._uuid]=dEt.ccMaterial_new());var i=jNt[e._uuid];dEt.ccMaterial_set(i,e.restitution,e.friction,e.rollingFriction,e.spinningFriction),dEt.CollisionShape_setMaterial(this._impl,i)}else dEt.CollisionObject_setMaterial(this._sharedBody.body,e.restitution,e.friction,e.rollingFriction,e.spinningFriction)},e.setCenter=function(t){ir.copy(WNt,t),WNt.multiply(this._collider.node.worldScale),VEt(dEt.Transform_getOrigin(this.transform),WNt),this.updateCompoundTransform()},e.setAsTrigger=function(t){this._isTrigger!==t&&(this._isEnabled&&(this._sharedBody.removeShape(this,!t),this._sharedBody.addShape(this,t)),this._isTrigger=t)},e.getAABB=function(t){var e=vEt.instance.BT_TRANSFORM_0;dEt.Transform_setIdentity(e),dEt.Transform_setRotation(e,zEt(vEt.instance.BT_QUAT_0,this._collider.node.worldRotation));var i=vEt.instance.BT_V3_0,n=vEt.instance.BT_V3_1;dEt.CollisionShape_getAabb(this._impl,e,i,n),t.halfExtents.x=(dEt.Vec3_x(n)-dEt.Vec3_x(i))/2,t.halfExtents.y=(dEt.Vec3_y(n)-dEt.Vec3_y(i))/2,t.halfExtents.z=(dEt.Vec3_z(n)-dEt.Vec3_z(i))/2,ir.add(t.center,this._collider.node.worldPosition,this._collider.center)},e.getBoundingSphere=function(t){t.radius=dEt.CollisionShape_getLocalBoundingSphere(this._impl),ir.add(t.center,this._collider.node.worldPosition,this._collider.center)},e.initialize=function(t){this._collider=t,this._isInitialized=!0,this._sharedBody=lkt.instance.physicsWorld.getSharedBody(this._collider.node),this._sharedBody.reference=!0,this.onComponentSet(),this.setWrapper()},e.setWrapper=function(){vEt.isNotEmptyShape(this._impl)&&(dEt.CollisionShape_setUserPointer(this._impl,this._impl),vEt.setWrapper(this._impl,t.TYPE,this))},e.onLoad=function(){this.setCenter(this._collider.center),this.setAsTrigger(this._collider.isTrigger)},e.onEnable=function(){this._isEnabled=!0,this._sharedBody.addShape(this,this._isTrigger),this.setMaterial(this.collider.sharedMaterial)},e.onDisable=function(){this._isEnabled=!1,this._sharedBody.removeShape(this,this._isTrigger)},e.onDestroy=function(){this._sharedBody.reference=!1,this._collider=null,dEt._safe_delete(this.quat,1),dEt._safe_delete(this.transform,2),this._compound&&dEt._safe_delete(this._compound,5),vEt.isNotEmptyShape(this._impl)&&(dEt._safe_delete(this._impl,5),vEt.delWrapper(this._impl,t.TYPE))},e.updateByReAdd=function(){this._isEnabled&&(this._sharedBody.removeShape(this,this._isTrigger),this._sharedBody.addShape(this,this._isTrigger))},e.getGroup=function(){return this._sharedBody.collisionFilterGroup},e.setGroup=function(t){this._sharedBody.collisionFilterGroup=t},e.addGroup=function(t){this._sharedBody.collisionFilterGroup|=t},e.removeGroup=function(t){this._sharedBody.collisionFilterGroup&=~t},e.getMask=function(){return this._sharedBody.collisionFilterMask},e.setMask=function(t){this._sharedBody.collisionFilterMask=t},e.addMask=function(t){this._sharedBody.collisionFilterMask|=t},e.removeMask=function(t){this._sharedBody.collisionFilterMask&=~t},e.setCompound=function(t){this._compound&&dEt.CompoundShape_removeChildShape(this._compound,this._impl),t&&dEt.CompoundShape_addChildShape(t,this.transform,this._impl),this._compound=t},e.updateScale=function(){this.setCenter(this._collider.center)},e.updateCompoundTransform=function(){this._compound?dEt.CompoundShape_updateChildTransform(this._compound,this._impl,this.transform,!0):this._isEnabled&&!this._isTrigger&&this._sharedBody&&!this._sharedBody.bodyStruct.useCompound&&(this._sharedBody.dirty|=1)},e.needCompound=function(){return 8===this._collider.type||!this._collider.center.equals(ir.ZERO)},n(t,[{key:"attachedRigidBody",get:function(){return this._sharedBody.wrappedBody?this._sharedBody.wrappedBody.rigidBody:null}},{key:"impl",get:function(){return this._impl}},{key:"collider",get:function(){return this._collider}},{key:"sharedBody",get:function(){return this._sharedBody}}]),t}();qNt.TYPE="shape",qNt.idCounter=0;var XNt=function(){function t(){this.matrix=[]}var e=t.prototype;return e.get=function(t,e){if(e>t){var i=e;e=t,t=i}return this.matrix[(t*(t+1)>>1)+e-1]},e.set=function(t,e,i){if(e>t){var n=e;e=t,t=n}this.matrix[(t*(t+1)>>1)+e-1]=i?1:0},e.reset=function(){this.matrix.length=0},e.setNumObjects=function(t){this.matrix.length=t*(t-1)>>1},t}(),YNt=function(){function t(){this.data=void 0,this.data={keys:[]}}var e=t.prototype;return e.get=function(t,e){if(t>e){var i=e;e=t,t=i}return this.data[t+"-"+e]},e.set=function(t,e,i){if(t>e){var n=e;e=t,t=n}var r=t+"-"+e;if(null==i){var s=this.data.keys.indexOf(r);if(-1!==s)return this.data.keys.splice(s,1),delete this.data[r],i}return this.get(t,e)||this.data.keys.push(r),this.data[r]=i,this.data[r]},e.reset=function(){this.data={keys:[]}},e.getLength=function(){return this.data.keys.length},e.getKeyByIndex=function(t){return this.data.keys[t]},e.getDataByKey=function(t){return this.data[t]},t}(),QNt=function(){function t(t){this.impl=0,this.event=void 0,this.event=t}var e=t.prototype;return e.getLocalPointOnA=function(t){this.impl&&NEt(t,dEt.ManifoldPoint_get_m_localPointA(this.impl))},e.getLocalPointOnB=function(t){this.impl&&NEt(t,dEt.ManifoldPoint_get_m_localPointB(this.impl))},e.getWorldPointOnA=function(t){this.impl&&NEt(t,dEt.ManifoldPoint_get_m_positionWorldOnA(this.impl))},e.getWorldPointOnB=function(t){this.impl&&NEt(t,dEt.ManifoldPoint_get_m_positionWorldOnB(this.impl))},e.getLocalNormalOnA=function(t){if(this.impl){var e=vEt.instance.BT_QUAT_0,i=dEt.PersistentManifold_getBody0(this.event.impl),n=dEt.CollisionObject_getWorldTransform(i);dEt.Transform_getRotation(n,e);var r=xEt;UEt(r,e),kr.conjugate(r,r),NEt(t,dEt.ManifoldPoint_get_m_normalWorldOnB(this.impl)),this.isBodyA||ir.negate(t,t),ir.transformQuat(t,t,r)}},e.getLocalNormalOnB=function(t){if(this.impl){var e=vEt.instance.BT_QUAT_0,i=dEt.PersistentManifold_getBody1(this.event.impl),n=dEt.CollisionObject_getWorldTransform(i);dEt.Transform_getRotation(n,e);var r=xEt;UEt(r,e),kr.conjugate(r,r),NEt(t,dEt.ManifoldPoint_get_m_normalWorldOnB(this.impl)),ir.transformQuat(t,t,r)}},e.getWorldNormalOnA=function(t){this.impl&&(NEt(t,dEt.ManifoldPoint_get_m_normalWorldOnB(this.impl)),this.isBodyA||ir.negate(t,t))},e.getWorldNormalOnB=function(t){this.impl&&NEt(t,dEt.ManifoldPoint_get_m_normalWorldOnB(this.impl))},n(t,[{key:"isBodyA",get:function(){return this.event.selfCollider.shape.sharedBody.body===dEt.PersistentManifold_getBody0(this.event.impl)}}]),t}(),JNt=[],KNt=yEt,ZNt=bEt,$Nt=SEt,tzt=LEt,ezt=new RNt,izt=function(){var t=e.prototype;function e(){this._world=void 0,this._broadphase=void 0,this._solver=void 0,this._dispatcher=void 0,this._debugDraw=void 0,this._debugLineCount=0,this._MAX_DEBUG_LINE_COUNT=16384,this._debugDrawFlags=0,this._debugConstraintSize=.3,this._needEmitEvents=!1,this._needSyncAfterEvents=!1,this._needEmitCCTEvents=!1,this.bodies=[],this.ghosts=[],this.ccts=[],this.constraints=[],this.triggerArrayMat=new XNt,this.characterControllerArrayMat=new XNt,this.collisionArrayMat=new XNt,this.contactsDic=new YNt,this.oldContactsDic=new YNt,this.cctShapeEventDic=new YNt,this.cctContactsDic=new YNt,this.cctOldContactsDic=new YNt,_Et.CACHE.world=this,this._broadphase=dEt.DbvtBroadphase_new(),this._dispatcher=dEt.CollisionDispatcher_new(),this._solver=dEt.SequentialImpulseConstraintSolver_new(),this._world=dEt.ccDiscreteDynamicsWorld_new(this._dispatcher,this._broadphase,this._solver);var t=dEt.DebugDraw.implement(NNt);this._debugDraw=t.$$.ptr,dEt.CollisionWorld_setDebugDrawer(this._world,this._debugDraw),dEt.DebugDraw_setDebugMode(this._debugDraw,0),dEt.DebugDraw_setAABBColor(this._debugDraw,0,1,1),dEt.DebugDraw_setActiveObjectColor(this._debugDraw,1,0,1),dEt.DebugDraw_setDeactiveObjectColor(this._debugDraw,1,0,1),dEt.DebugDraw_setWantsDeactivationObjectColor(this._debugDraw,1,0,1),dEt.DebugDraw_setDisabledDeactivationObjectColor(this._debugDraw,1,0,1),dEt.DebugDraw_setDisabledSimulationObjectColor(this._debugDraw,1,0,1),dEt.DebugDraw_setConstraintLimitColor(this._debugDraw,.5,.5,.5)}return t.setDefaultMaterial=function(){},t.setAllowSleep=function(t){dEt.ccDiscreteDynamicsWorld_setAllowSleep(this._world,t)},t.setGravity=function(t){dEt.DynamicsWorld_setGravity(this._world,VEt(vEt.instance.BT_V3_0,t))},t.updateNeedEmitEvents=function(t){if(this.ghosts)if(t)this._needEmitEvents=!0;else{this._needEmitEvents=!1;for(var e=0;e=0;t--){var e=this.ghosts[t];e.updateDirty(),e.syncSceneToGhost()}for(var i=this.bodies.length-1;i>=0;i--){var n=this.bodies[i];n.updateDirty(),n.syncSceneToPhysics()}for(var r=this.ccts,s=r.length-1;s>=0;s--){var a=r[s];a.updateDirty(),a.syncSceneToPhysics()}},t.syncAfterEvents=function(){this._needSyncAfterEvents&&this.syncSceneToPhysics()},t.raycast=function(t,e,i,n){t.computeHit(KNt,e.maxDistance);var r=VEt(vEt.instance.BT_V3_0,KNt),s=VEt(vEt.instance.BT_V3_1,t.o),a=dEt.ccAllRayCallback_static();if(dEt.ccAllRayCallback_reset(a,s,r,e.mask>>>0,e.queryTrigger),dEt.ccAllRayCallback_setFlags(a,4),dEt.CollisionWorld_rayTest(this._world,s,r,a),dEt.RayCallback_hasHit(a)){for(var o=dEt.ccAllRayCallback_getHitPointWorld(a),h=dEt.ccAllRayCallback_getHitNormalWorld(a),u=dEt.ccAllRayCallback_getCollisionShapePtrs(a),l=dEt.ccAllRayCallback_getClosestHitFraction(a),c=0,f=dEt.int_array_size(u);c>>0,e.queryTrigger),dEt.ccClosestRayCallback_setFlags(s,4),dEt.CollisionWorld_rayTest(this._world,r,n,s),dEt.RayCallback_hasHit(s)){NEt(KNt,dEt.ccClosestRayCallback_getHitPointWorld(s)),NEt(ZNt,dEt.ccClosestRayCallback_getHitNormalWorld(s));var a=vEt.getWrapper(dEt.ccClosestRayCallback_getCollisionShapePtr(s),qNt.TYPE),o=dEt.ccClosestConvexCallback_getClosestHitFraction(s);return i._assign(KNt,ir.distance(t.o,KNt),a.collider,ZNt,o),!0}return!1},t.sweepBox=function(t,i,n,r,s,a){var o=vEt.instance.BT_V3_0;return VEt(o,i),e._sweepBoxGeometry||(e._sweepBoxGeometry=dEt.BoxShape_new(o)),dEt.BoxShape_setUnscaledHalfExtents(e._sweepBoxGeometry,o),this.sweep(t,e._sweepBoxGeometry,n,r,s,a)},t.sweepBoxClosest=function(t,i,n,r,s){var a=vEt.instance.BT_V3_0;return VEt(a,i),e._sweepBoxGeometry||(e._sweepBoxGeometry=dEt.BoxShape_new(a)),dEt.BoxShape_setUnscaledHalfExtents(e._sweepBoxGeometry,a),this.sweepClosest(t,e._sweepBoxGeometry,n,r,s)},t.sweepSphere=function(t,i,n,r,s){return e._sweepSphereGeometry||(e._sweepSphereGeometry=dEt.SphereShape_new(i)),dEt.SphereShape_setUnscaledRadius(e._sweepSphereGeometry,i),this.sweep(t,e._sweepSphereGeometry,kr.IDENTITY,n,r,s)},t.sweepSphereClosest=function(t,i,n,r){return e._sweepSphereGeometry||(e._sweepSphereGeometry=dEt.SphereShape_new(i)),dEt.SphereShape_setUnscaledRadius(e._sweepSphereGeometry,i),this.sweepClosest(t,e._sweepSphereGeometry,kr.IDENTITY,n,r)},t.sweepCapsule=function(t,i,n,r,s,a,o){return e._sweepCapsuleGeometry||(e._sweepCapsuleGeometry=dEt.CapsuleShape_new(i,n)),dEt.CapsuleShape_updateProp(e._sweepCapsuleGeometry,i,.5*n,1),this.sweep(t,e._sweepCapsuleGeometry,r,s,a,o)},t.sweepCapsuleClosest=function(t,i,n,r,s,a){return e._sweepCapsuleGeometry||(e._sweepCapsuleGeometry=dEt.CapsuleShape_new(i,n)),dEt.CapsuleShape_updateProp(e._sweepCapsuleGeometry,i,.5*n,1),this.sweepClosest(t,e._sweepCapsuleGeometry,r,s,a)},t.sweep=function(t,e,i,n,r,s){var a=vEt.instance.BT_TRANSFORM_0,o=vEt.instance.BT_TRANSFORM_1,h=vEt.instance.BT_QUAT_0;VEt(dEt.Transform_getOrigin(a),t.o),zEt(h,i),dEt.Transform_setRotation(a,h),t.computeHit(KNt,n.maxDistance),VEt(dEt.Transform_getOrigin(o),KNt),zEt(h,i),dEt.Transform_setRotation(o,h);var u=dEt.ccAllConvexCallback_static();if(dEt.ccAllConvexCallback_reset(u,a,o,n.mask>>>0,n.queryTrigger),dEt.CollisionWorld_convexSweepTest(this._world,e,a,o,u,0),dEt.ConvexCallback_hasHit(u)){for(var l=dEt.ccAllConvexCallback_getHitPointWorld(u),c=dEt.ccAllConvexCallback_getHitNormalWorld(u),f=dEt.ccAllConvexCallback_getCollisionShapePtrs(u),d=dEt.ccAllConvexCallback_getClosestHitFraction(u),_=0,p=dEt.int_array_size(f);_>>0,n.queryTrigger),dEt.CollisionWorld_convexSweepTest(this._world,e,s,a,h,0),dEt.ConvexCallback_hasHit(h)){NEt(KNt,dEt.ccClosestConvexCallback_getHitPointWorld(h)),NEt(ZNt,dEt.ccClosestConvexCallback_getHitNormalWorld(h));var u=vEt.getWrapper(dEt.ccClosestConvexCallback_getCollisionShapePtr(h),qNt.TYPE),l=dEt.ccClosestConvexCallback_getClosestHitFraction(h);return r._assign(KNt,ir.distance(t.o,KNt),u.collider,ZNt,l),!0}return!1},t.getSharedBody=function(t,e){return HNt.getSharedBody(t,this,e)},t.addSharedBody=function(t){if(this.bodies.indexOf(t)<0){this.bodies.push(t);var e=t.collisionFilterGroup,i=t.collisionFilterMask;dEt.DynamicsWorld_addRigidBody(this._world,t.body,e>>>0,i>>>0)}},t.removeSharedBody=function(t){var e=this.bodies.indexOf(t);e>=0&&(be(this.bodies,e),dEt.DynamicsWorld_removeRigidBody(this._world,t.body))},t.addGhostObject=function(t){if(this.ghosts.indexOf(t)<0){this.ghosts.push(t);var e=t.collisionFilterGroup,i=t.collisionFilterMask;dEt.CollisionWorld_addCollisionObject(this._world,t.ghost,e>>>0,i>>>0)}},t.removeGhostObject=function(t){var e=this.ghosts.indexOf(t);e>=0&&(be(this.ghosts,e),dEt.CollisionWorld_removeCollisionObject(this._world,t.ghost))},t.addCCT=function(t){if(this.ccts.indexOf(t)<0){this.ccts.push(t);var e=dEt.CharacterController_getGhostObject(t.impl),i=t.getGroup(),n=t.getMask();dEt.CollisionWorld_addCollisionObject(this._world,e,i>>>0,n>>>0),dEt.DynamicsWorld_addAction(this._world,t.impl)}},t.removeCCT=function(t){var e=this.ccts.indexOf(t);if(e>=0){be(this.ccts,e);var i=dEt.CharacterController_getGhostObject(t.impl);dEt.CollisionWorld_removeCollisionObject(this._world,i),dEt.DynamicsWorld_removeAction(this._world,t.impl)}},t.addConstraint=function(t){var e=this.constraints.indexOf(t);e<0&&(this.constraints.push(t),dEt.DynamicsWorld_addConstraint(this.impl,t.impl,!t.constraint.enableCollision),t.index=e)},t.removeConstraint=function(t){var e=this.constraints.indexOf(t);e>=0&&(this.constraints.splice(e,1),dEt.DynamicsWorld_removeConstraint(this.impl,t.impl),t.index=-1)},t.emitEvents=function(){this._needSyncAfterEvents=!1,this._needEmitEvents&&(this.gatherConatactData(),this.emitCollisionAndTriggerEvent(),this.emitCCTTriggerEvent()),this._needEmitCCTEvents&&this.emitCCTCollisionEvent()},t.emitCollisionAndTriggerEvent=function(){for(var t=this.contactsDic.getLength();t--;){JNt.push.apply(JNt,mEt.contacts),mEt.contacts.length=0;var e=this.contactsDic.getKeyByIndex(t),i=this.contactsDic.getDataByKey(e),n=i.shape0,r=i.shape1;this.oldContactsDic.set(n.id,r.id,i);var s=n.collider,a=r.collider;if(s&&a){if(s.isTrigger||a.isTrigger)this.triggerArrayMat.get(n.id,r.id)?pEt.type="onTriggerStay":(pEt.type="onTriggerEnter",this.triggerArrayMat.set(n.id,r.id,!0)),pEt.impl=i.impl,pEt.selfCollider=s,pEt.otherCollider=a,s.emit(pEt.type,pEt),pEt.selfCollider=a,pEt.otherCollider=s,a.emit(pEt.type,pEt),this._needSyncAfterEvents=!0;else{var o=s.attachedRigidBody,h=a.attachedRigidBody;if(o&&h){if(o.isSleeping&&h.isSleeping)continue}else if(!o&&h){if(h.isSleeping)continue}else if(!h&&o&&o.isSleeping)continue;this.collisionArrayMat.get(n.id,r.id)?mEt.type="onCollisionStay":(mEt.type="onCollisionEnter",this.collisionArrayMat.set(n.id,r.id,!0));for(var u=0;u0){var c=JNt.pop();c.impl=l,mEt.contacts.push(c)}else{var f=new QNt(mEt);f.impl=l,mEt.contacts.push(f)}}mEt.impl=i.impl,mEt.selfCollider=s,mEt.otherCollider=a,s.emit(mEt.type,mEt),mEt.selfCollider=a,mEt.otherCollider=s,a.emit(mEt.type,mEt),this._needSyncAfterEvents=!0}null==this.oldContactsDic.get(n.id,r.id)&&this.oldContactsDic.set(n.id,r.id,i)}}for(var d=this.oldContactsDic.getLength();d--;){var _=this.oldContactsDic.getKeyByIndex(d),p=this.oldContactsDic.getDataByKey(_),m=p.shape0,g=p.shape1,v=m.collider,y=g.collider;if(v&&y){var b=v.isTrigger||y.isTrigger;null==this.contactsDic.getDataByKey(_)&&(b?this.triggerArrayMat.get(m.id,g.id)&&(pEt.type="onTriggerExit",pEt.selfCollider=v,pEt.otherCollider=y,v.emit(pEt.type,pEt),pEt.selfCollider=y,pEt.otherCollider=v,y.emit(pEt.type,pEt),this.triggerArrayMat.set(m.id,g.id,!1),this.oldContactsDic.set(m.id,g.id,null),this._needSyncAfterEvents=!0):this.collisionArrayMat.get(m.id,g.id)&&(JNt.push.apply(JNt,mEt.contacts),mEt.contacts.length=0,mEt.type="onCollisionExit",mEt.selfCollider=v,mEt.otherCollider=y,v.emit(mEt.type,mEt),mEt.selfCollider=y,mEt.otherCollider=v,y.emit(mEt.type,mEt),this.collisionArrayMat.set(m.id,g.id,!1),this.oldContactsDic.set(m.id,g.id,null),this._needSyncAfterEvents=!0))}}this.contactsDic.reset()},t.emitCCTTriggerEvent=function(){for(var t=this.cctContactsDic.getLength();t--;){var e=this.cctContactsDic.getKeyByIndex(t),i=this.cctContactsDic.getDataByKey(e),n=i.shape,r=i.cct;this.cctOldContactsDic.set(n.id,r.id,i);var s=n.collider,a=r.characterController;s&&a&&(s.isTrigger&&(this.characterControllerArrayMat.get(n.id,r.id)?gEt.type="onControllerTriggerStay":(gEt.type="onControllerTriggerEnter",this.characterControllerArrayMat.set(n.id,r.id,!0)),gEt.impl=i.impl,gEt.collider=s,gEt.characterController=a,s.emit(gEt.type,gEt),gEt.collider=s,gEt.characterController=a,a.emit(gEt.type,gEt),this._needSyncAfterEvents=!0),null==this.cctOldContactsDic.get(n.id,r.id)&&this.cctOldContactsDic.set(n.id,r.id,i))}for(var o=this.cctOldContactsDic.getLength();o--;){var h=this.cctOldContactsDic.getKeyByIndex(o),u=this.cctOldContactsDic.getDataByKey(h),l=u.shape,c=u.cct,f=l.collider,d=c.characterController;if(f&&d){var _=f.isTrigger;null==this.cctContactsDic.getDataByKey(h)&&_&&this.characterControllerArrayMat.get(l.id,c.id)&&(gEt.type="onControllerTriggerExit",gEt.collider=f,gEt.characterController=d,f.emit(gEt.type,gEt),gEt.collider=f,gEt.characterController=d,d.emit(gEt.type,gEt),this.characterControllerArrayMat.set(l.id,c.id,!1),this.cctOldContactsDic.set(l.id,c.id,null),this._needSyncAfterEvents=!0)}}this.cctContactsDic.reset()},t.emitCCTCollisionEvent=function(){for(var t=this.cctShapeEventDic.getLength();t--;){var e,i=this.cctShapeEventDic.getKeyByIndex(t),n=this.cctShapeEventDic.getDataByKey(i),r=n.BulletCharacterController,s=n.BulletShape,a=n.worldPos,o=n.worldNormal,h=n.motionDir,u=n.motionLength;ezt.controller=r.characterController,ezt.collider=s.collider,ezt.worldPosition.set(a.x,a.y,a.z),ezt.worldNormal.set(o.x,o.y,o.z),ezt.motionDirection.set(h.x,h.y,h.z),ezt.motionLength=u,null==(e=ezt.controller)||e.emit("onControllerColliderHit",ezt),this._needSyncAfterEvents=!0}this.cctShapeEventDic.reset()},t.gatherConatactData=function(){for(var t=dEt.Dispatcher_getNumManifolds(this._dispatcher),e=0;e0){if(this.collider.convex){var i=this._getBtTriangleMesh(e);this._impl=dEt.ConvexTriangleMeshShape_new(i)}else this.btBVHMeshShape=azt.getBulletBvhTriangleMeshShape(e.hash,e),this._impl=dEt.ScaledBvhTriangleMeshShape_new(this.btBVHMeshShape.bulletBvhTriangleMeshShapePtr,1,1,1);var n=vEt.instance.BT_V3_0;VEt(n,this._collider.node.worldScale),dEt.CollisionShape_setLocalScaling(this._impl,n),dEt.CollisionShape_setMargin(this._impl,.01),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=dEt.EmptyShape_static()}},i.onComponentSet=function(){this.setMesh(this.collider.mesh)},i.onDestroy=function(){this.collider.convex?this.refBtTriangleMesh&&dEt._safe_delete(this.refBtTriangleMesh,8):this.btBVHMeshShape&&(this.btBVHMeshShape.reference=!1),t.prototype.onDestroy.call(this)},i.updateScale=function(){t.prototype.updateScale.call(this);var e=vEt.instance.BT_V3_0;VEt(e,this._collider.node.worldScale),dEt.CollisionShape_setLocalScaling(this._impl,e),this.updateCompoundTransform()},i._getBtTriangleMesh=function(t){return this.refBtTriangleMesh=dEt.TriangleMesh_new(),GEt(this.refBtTriangleMesh,t),this.refBtTriangleMesh},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(qNt),hzt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setHeight=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setDirection=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setRadius=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.onComponentSet=function(){var t=vEt.instance.BT_V3_0;dEt.Vec3_set(t,.5,1,.5),this._impl=dEt.CylinderShape_new(t),this.setRadius(this.collider.radius)},i.updateScale=function(){t.prototype.updateScale.call(this),this.setRadius(this.collider.radius)},i.updateProperties=function(t,e,i,n){var r,s,a=n,o=i;1===o?(s=e*Math.abs(a.y),r=t*Math.abs(gn(a.x,a.z))):0===o?(s=e*Math.abs(a.x),r=t*Math.abs(gn(a.y,a.z))):(s=e*Math.abs(a.z),r=t*Math.abs(gn(a.x,a.y))),dEt.CylinderShape_updateProp(this._impl,r,s/2,o),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(qNt),uzt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setHeight=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setDirection=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setRadius=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.onComponentSet=function(){this._impl=dEt.ConeShape_new(.5,1),this.setRadius(this.collider.radius)},i.updateScale=function(){t.prototype.updateScale.call(this),this.setRadius(this.collider.radius)},i.updateProperties=function(t,e,i,n){var r,s,a=n,o=i;1===o?(s=e*Math.abs(a.y),r=t*Math.abs(gn(a.x,a.z))):0===o?(s=e*Math.abs(a.x),r=t*Math.abs(gn(a.y,a.z))):(s=e*Math.abs(a.z),r=t*Math.abs(gn(a.x,a.y))),dEt.ConeShape_setRadius(this._impl,r),dEt.ConeShape_setHeight(this._impl,s),dEt.ConeShape_setConeUpIndex(this._impl,o);var h=vEt.instance.BT_V3_0;dEt.Vec3_set(h,1,1,1),dEt.CollisionShape_setLocalScaling(this._impl,h),this.updateCompoundTransform()},n(e,[{key:"impl",get:function(){return this._impl}},{key:"collider",get:function(){return this._collider}}]),e}(qNt),lzt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;ru&&(s=u),u>a&&(a=u),r+=4}a+=.01,s-=.01,this._localOffset.set((i-1)/2*this._tileSize,(a+s)/2,(n-1)/2*this._tileSize),this._impl=dEt.TerrainShape_new(i,n,this._bufPtr,1,s,a);var l=vEt.instance.BT_V3_0;dEt.Vec3_set(l,this._tileSize,1,this._tileSize),dEt.CollisionShape_setLocalScaling(this._impl,l),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=dEt.EmptyShape_static()}},i.onComponentSet=function(){this.setTerrain(this.collider.terrain)},i.onDestroy=function(){this._bufPtr&&dEt._free(this._bufPtr),t.prototype.onDestroy.call(this)},i.setCenter=function(t){ir.copy(yEt,t),yEt.add(this._localOffset),VEt(dEt.Transform_getOrigin(this.transform),yEt),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(qNt),czt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setShapeType=function(){},i.setVertices=function(){},i.onComponentSet=function(){this._impl=dEt.SimplexShape_new();for(var t=this.collider.shapeType,e=this.collider.vertices,i=vEt.instance.BT_V3_0,n=0;n=0){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.removeConstraint(this),t.wrappedWorld.addConstraint(this)}},e.initialize=function(t){this._com=t,this._rigidBody=t.attachedBody,this._connectedBody=t.connectedBody,this._collided=t.enableCollision,this.onComponentSet(),this.setEnableCollision(this._collided)},e.updateDebugDrawSize=function(){if(this.impl){var t=lkt.instance.physicsWorld.debugDrawConstraintSize;dEt.TypedConstraint_setDbgDrawSize(this.impl,t)}},e.onEnable=function(){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.addConstraint(this),t.addJoint(this,0);var e=this._connectedBody;e&&e.body.sharedBody.addJoint(this,1)},e.onDisable=function(){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.removeConstraint(this),t.removeJoint(this,0);var e=this._connectedBody;e&&e.body.sharedBody.removeJoint(this,1)},e.onDestroy=function(){dEt._safe_delete(this._impl,13),this._com=null,this._rigidBody=null,this._connectedBody=null},n(t,[{key:"impl",get:function(){return this._impl}},{key:"constraint",get:function(){return this._com}}]),t}(),_zt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setPivotA=function(){var t=this.constraint,e=vEt.instance.BT_V3_0;ir.multiply(yEt,t.node.worldScale,t.pivotA),VEt(e,yEt),dEt.P2PConstraint_setPivotA(this._impl,e),t.connectedBody||this.setPivotB(t.pivotB)},i.setPivotB=function(){var t=this.constraint,e=this._rigidBody.node,i=vEt.instance.BT_V3_0,n=t.connectedBody;n?(ir.multiply(yEt,n.node.worldScale,t.pivotB),VEt(i,yEt)):(ir.multiply(yEt,e.worldScale,t.pivotA),ir.transformQuat(yEt,yEt,e.worldRotation),ir.add(yEt,yEt,e.worldPosition),VEt(i,yEt)),dEt.P2PConstraint_setPivotB(this._impl,i)},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:dEt.TypedConstraint_getFixedBody(),n=vEt.instance.BT_V3_0,r=vEt.instance.BT_V3_1;this._impl=dEt.P2PConstraint_new(e,i,n,r),this.setPivotA(this.constraint.pivotA),this.setPivotB(this.constraint.pivotB),this.updateDebugDrawSize()},i.updateScale0=function(){this.setPivotA(this.constraint.pivotA)},i.updateScale1=function(){this.setPivotB(this.constraint.pivotB)},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(dzt),pzt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setBreakForce=function(t){dEt.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.setBreakTorque=function(){},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:dEt.TypedConstraint_getFixedBody(),n=vEt.instance.BT_TRANSFORM_0,r=vEt.instance.BT_TRANSFORM_1;this._impl=dEt.FixedConstraint_new(e,i,n,r),this.setBreakForce(this.constraint.breakForce),this.setBreakTorque(this.constraint.breakTorque),this.updateFrames(),this.updateDebugDrawSize()},i.updateFrames=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.sharedBody,i=yEt,n=xEt,r=vEt.instance.BT_TRANSFORM_0,s=vEt.instance.BT_TRANSFORM_1,a=vEt.instance.BT_QUAT_0,o=TEt;if(Qr.fromRT(o,e.node.worldRotation,e.node.worldPosition),Qr.invert(o,o),Qr.getRotation(n,o),Qr.getTranslation(i,o),VEt(dEt.Transform_getOrigin(r),i),zEt(a,n),dEt.Transform_setRotation(r,a),t){var h=t.body.sharedBody;Qr.fromRT(o,h.node.worldRotation,h.node.worldPosition),Qr.invert(o,o),Qr.getRotation(n,o),Qr.getTranslation(i,o),VEt(dEt.Transform_getOrigin(s),i),zEt(a,n),dEt.Transform_setRotation(s,a)}else dEt.Transform_setIdentity(s);dEt.FixedConstraint_setFrames(this._impl,r,s)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(dzt),mzt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setPivotA=function(){this.updateFrames()},i.setPivotB=function(){this.updateFrames()},i.setAxis=function(){this.updateFrames()},i.setLimitEnabled=function(){this.constraint.limitEnabled?dEt.HingeConstraint_setLimit(this._impl,nn(this.constraint.lowerLimit),nn(this.constraint.upperLimit),.9,.3,1):dEt.HingeConstraint_setLimit(this._impl,1,0,.9,.3,1)},i.setLowerLimit=function(){this.constraint.limitEnabled&&dEt.HingeConstraint_setLimit(this._impl,nn(this.constraint.lowerLimit),nn(this.constraint.upperLimit),.9,.3,1)},i.setUpperLimit=function(){this.constraint.limitEnabled&&dEt.HingeConstraint_setLimit(this._impl,nn(this.constraint.lowerLimit),nn(this.constraint.upperLimit),.9,.3,1)},i.setMotorEnabled=function(t){dEt.HingeConstraint_enableMotor(this._impl,t);var e=-this.constraint.motorVelocity/60,i=HEt(this.constraint.motorForceLimit,lkt.instance.fixedTimeStep);dEt.HingeConstraint_setMotorVelocity(this._impl,e),dEt.HingeConstraint_setMaxMotorImpulse(this._impl,i)},i.setMotorVelocity=function(t){if(this.constraint.motorEnabled){var e=-t/60;dEt.HingeConstraint_setMotorVelocity(this._impl,e)}},i.setMotorForceLimit=function(t){if(this.constraint.motorEnabled){var e=HEt(t,lkt.instance.fixedTimeStep);dEt.HingeConstraint_setMaxMotorImpulse(this._impl,e)}},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:dEt.TypedConstraint_getFixedBody(),n=vEt.instance.BT_TRANSFORM_0,r=vEt.instance.BT_TRANSFORM_1;this._impl=dEt.HingeConstraint_new(e,i,n,r),this.setLimitEnabled(this.constraint.limitEnabled),this.setLowerLimit(this.constraint.lowerLimit),this.setUpperLimit(this.constraint.upperLimit),this.setMotorEnabled(this.constraint.motorEnabled),this.setMotorVelocity(this.constraint.motorVelocity),this.setMotorForceLimit(this.constraint.motorForceLimit),this.updateFrames(),this.updateDebugDrawSize()},i.updateFrames=function(){var t=this.constraint,e=t.node,i=yEt,n=xEt,r=wEt,s=vEt.instance.BT_TRANSFORM_0;ir.multiply(i,e.worldScale,t.pivotA),VEt(dEt.Transform_getOrigin(s),i);var a=vEt.instance.BT_QUAT_0;ir.normalize(i,t.axis),kr.rotationTo(r,ir.UNIT_Z,i),zEt(a,r),dEt.Transform_setRotation(s,a);var o=vEt.instance.BT_TRANSFORM_1,h=this.constraint.connectedBody;h?(ir.multiply(i,h.node.worldScale,t.pivotB),kr.multiply(r,e.worldRotation,r),kr.invert(n,h.node.worldRotation),kr.multiply(r,n,r)):(ir.multiply(i,e.worldScale,t.pivotA),ir.transformQuat(i,i,e.worldRotation),ir.add(i,i,e.worldPosition),kr.multiply(r,e.worldRotation,r)),VEt(dEt.Transform_getOrigin(o),i),zEt(a,r),dEt.Transform_setRotation(o,a),dEt.HingeConstraint_setFrames(this._impl,s,o)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(dzt),gzt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i._setLimit=function(t,e,i,n){switch(t){case 2:dEt.Generic6DofSpring2Constraint_setLimit(this._impl,e,0,0);break;case 1:dEt.Generic6DofSpring2Constraint_setLimit(this._impl,e,i,n);break;case 0:dEt.Generic6DofSpring2Constraint_setLimit(this._impl,e,1,0)}},i.setConstraintMode=function(t,e){var i=this.constraint.linearLimitSettings,n=this.constraint.angularLimitSettings,r=[0,0,0],s=[0,0,0],a=0,o=0;switch(t){case 0:case 1:case 2:ir.toArray(r,i.lower),ir.toArray(s,i.upper),o=r[t],a=s[t];break;case 3:o=-(a=.5*nn(n.twistExtent));break;case 4:o=-(a=.5*nn(n.swingExtent1));break;case 5:o=-(a=.5*nn(n.swingExtent2));break;default:Q("idx should be in [0, 5], but give "+t)}this._setLimit(e,t,o,a)},i.setLinearLimit=function(t,e,i){var n=0,r=this.constraint.linearLimitSettings;switch(t){case 0:n=r.xMotion;break;case 1:n=r.yMotion;break;case 2:n=r.zMotion}this._setLimit(n,t,e,i)},i.setAngularExtent=function(t,e,i){var n=this.constraint.angularLimitSettings;this._setLimit(n.twistMotion,3,.5*-nn(t),.5*nn(t)),this._setLimit(n.swingMotion1,4,.5*-nn(e),.5*nn(e)),this._setLimit(n.swingMotion2,5,.5*-nn(i),.5*nn(i))},i.setSwingSoftConstraint=function(t){dEt.Generic6DofSpring2Constraint_enableSpring(this._impl,4,t),dEt.Generic6DofSpring2Constraint_enableSpring(this._impl,5,t)},i.setTwistSoftConstraint=function(t){dEt.Generic6DofSpring2Constraint_enableSpring(this._impl,3,t)},i.setLinearSoftConstraint=function(t){dEt.Generic6DofSpring2Constraint_enableSpring(this._impl,0,t),dEt.Generic6DofSpring2Constraint_enableSpring(this._impl,1,t),dEt.Generic6DofSpring2Constraint_enableSpring(this._impl,2,t)},i.setLinearStiffness=function(t){dEt.Generic6DofSpring2Constraint_setStiffness(this._impl,0,t),dEt.Generic6DofSpring2Constraint_setStiffness(this._impl,1,t),dEt.Generic6DofSpring2Constraint_setStiffness(this._impl,2,t)},i.setLinearDamping=function(t){dEt.Generic6DofSpring2Constraint_setDamping(this._impl,0,t),dEt.Generic6DofSpring2Constraint_setDamping(this._impl,1,t),dEt.Generic6DofSpring2Constraint_setDamping(this._impl,2,t)},i.setLinearRestitution=function(t){dEt.Generic6DofSpring2Constraint_setBounce(this._impl,0,t),dEt.Generic6DofSpring2Constraint_setBounce(this._impl,1,t),dEt.Generic6DofSpring2Constraint_setBounce(this._impl,2,t)},i.setSwingStiffness=function(t){dEt.Generic6DofSpring2Constraint_setStiffness(this._impl,4,t),dEt.Generic6DofSpring2Constraint_setStiffness(this._impl,5,t)},i.setSwingDamping=function(t){dEt.Generic6DofSpring2Constraint_setDamping(this._impl,4,t),dEt.Generic6DofSpring2Constraint_setDamping(this._impl,5,t)},i.setSwingRestitution=function(t){dEt.Generic6DofSpring2Constraint_setBounce(this._impl,4,t),dEt.Generic6DofSpring2Constraint_setBounce(this._impl,5,t)},i.setTwistStiffness=function(t){dEt.Generic6DofSpring2Constraint_setStiffness(this._impl,3,t)},i.setTwistDamping=function(t){dEt.Generic6DofSpring2Constraint_setDamping(this._impl,3,t)},i.setTwistRestitution=function(t){dEt.Generic6DofSpring2Constraint_setBounce(this._impl,3,t)},i.setDriverMode=function(t,e){0===e?dEt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!1):1===e?(dEt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!0),dEt.Generic6DofSpring2Constraint_setServo(this._impl,t,!0)):2===e&&(dEt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!0),dEt.Generic6DofSpring2Constraint_setServo(this._impl,t,!1))},i._updateMotorTargetAndVelocity=function(t){var e=0,i=0,n=0,r=0,s=this.constraint.linearDriverSettings,a=this.constraint.angularDriverSettings;switch(t){case 0:i=0,e=s.xDrive,n=s.targetPosition.x,r=-s.targetVelocity.x;break;case 1:i=1,e=s.yDrive,n=s.targetPosition.y,r=-s.targetVelocity.y;break;case 2:i=2,e=s.zDrive,n=s.targetPosition.z,r=-s.targetVelocity.z;break;case 3:i=3,e=a.twistDrive,n=-nn(a.targetOrientation.x),r=-nn(a.targetVelocity.x);break;case 4:i=4,e=a.swingDrive1,n=-nn(a.targetOrientation.y),r=-nn(a.targetVelocity.y);break;case 5:i=5,e=a.swingDrive2,n=-nn(a.targetOrientation.z),r=-nn(a.targetVelocity.z)}var o=t>2?a.strength:s.strength;dEt.Generic6DofSpring2Constraint_setServoTarget(this._impl,i,n),1===e?t>2?dEt.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,-n*o*.1):dEt.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,n*o*.1):2===e&&dEt.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,r)},i.setLinearMotorTarget=function(){this._updateMotorTargetAndVelocity(0),this._updateMotorTargetAndVelocity(1),this._updateMotorTargetAndVelocity(2)},i.setLinearMotorVelocity=function(){this._updateMotorTargetAndVelocity(0),this._updateMotorTargetAndVelocity(1),this._updateMotorTargetAndVelocity(2)},i.setLinearMotorForceLimit=function(t){dEt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,0,t),dEt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,1,t),dEt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,2,t)},i.setAngularMotorTarget=function(){this._updateMotorTargetAndVelocity(3),this._updateMotorTargetAndVelocity(4),this._updateMotorTargetAndVelocity(5)},i.setAngularMotorVelocity=function(){this._updateMotorTargetAndVelocity(3),this._updateMotorTargetAndVelocity(4),this._updateMotorTargetAndVelocity(5)},i.setAngularMotorForceLimit=function(t){dEt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,3,t),dEt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,4,t),dEt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,5,t)},i.setPivotA=function(){this.updateFrames()},i.setPivotB=function(){this.updateFrames()},i.setAutoPivotB=function(){this.updateFrames()},i.setAxis=function(){this.updateFrames()},i.setSecondaryAxis=function(){this.updateFrames()},i.setBreakForce=function(){var t=HEt(Math.max(this.constraint.breakForce,this.constraint.breakTorque),lkt.instance.fixedTimeStep);dEt.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.setBreakTorque=function(){var t=HEt(Math.max(this.constraint.breakForce,this.constraint.breakTorque),lkt.instance.fixedTimeStep);dEt.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t&&t.body.impl||dEt.TypedConstraint_getFixedBody(),n=vEt.instance.BT_TRANSFORM_0,r=vEt.instance.BT_TRANSFORM_1;this._impl=dEt.Generic6DofSpring2Constraint_new(e,i,n,r,3);var s=this.constraint.linearLimitSettings,a=this.constraint.angularLimitSettings;this.setConstraintMode(0,s.xMotion),this.setConstraintMode(1,s.yMotion),this.setConstraintMode(2,s.zMotion),this.setConstraintMode(3,a.twistMotion),this.setConstraintMode(4,a.swingMotion1),this.setConstraintMode(5,a.swingMotion2),this.setLinearSoftConstraint(s.enableSoftConstraint),this.setLinearStiffness(s.stiffness),this.setLinearDamping(s.damping),this.setLinearRestitution(s.restitution),this.setSwingSoftConstraint(a.enableSoftConstraintSwing),this.setSwingRestitution(a.swingRestitution),this.setSwingStiffness(a.swingStiffness),this.setSwingDamping(a.swingDamping),this.setTwistSoftConstraint(a.enableSoftConstraintTwist),this.setTwistRestitution(a.twistRestitution),this.setTwistStiffness(a.twistStiffness),this.setTwistDamping(a.twistDamping);var o=this.constraint.linearDriverSettings,h=this.constraint.angularDriverSettings;this.setDriverMode(0,o.xDrive),this.setDriverMode(1,o.yDrive),this.setDriverMode(2,o.zDrive),this.setDriverMode(3,h.twistDrive),this.setDriverMode(4,h.swingDrive1),this.setDriverMode(5,h.swingDrive2),this.setLinearMotorTarget(o.targetPosition),this.setLinearMotorVelocity(o.targetVelocity),this.setLinearMotorForceLimit(o.strength),this.setAngularMotorTarget(h.targetOrientation),this.setAngularMotorVelocity(h.targetVelocity),this.setAngularMotorForceLimit(h.strength),this.setBreakForce(this.constraint.breakForce),this.setBreakTorque(this.constraint.breakTorque),this.updateFrames(),this.updateDebugDrawSize()},i.updateFrames=function(){var t=this.constraint,e=t.node,i=yEt,n=xEt,r=wEt,s=vEt.instance.BT_TRANSFORM_0;ir.multiply(i,e.worldScale,t.pivotA),VEt(dEt.Transform_getOrigin(s),i);var a=vEt.instance.BT_QUAT_0,o=t.axis,h=t.secondaryAxis,u=ir.cross(bEt,o,h);Qr.set(TEt,o.x,o.y,o.z,0,h.x,h.y,h.z,0,u.x,u.y,u.z,0,0,0,0,1).getRotation(n),zEt(a,n),dEt.Transform_setRotation(s,a);var l=vEt.instance.BT_TRANSFORM_1,c=this.constraint.connectedBody;c?(kr.multiply(n,e.worldRotation,n),kr.invert(r,c.node.worldRotation),kr.multiply(n,r,n),t.autoPivotB?(ir.multiply(i,t.node.worldScale,t.pivotA),ir.transformQuat(i,i,e.worldRotation),ir.add(i,i,t.node.worldPosition),ir.subtract(i,i,c.node.worldPosition),ir.transformQuat(i,i,r)):ir.multiply(i,c.node.worldScale,t.pivotB)):(ir.multiply(i,e.worldScale,t.pivotA),ir.transformQuat(i,i,e.worldRotation),ir.add(i,i,e.worldPosition),kr.multiply(n,e.worldRotation,n)),VEt(dEt.Transform_getOrigin(l),i),zEt(a,n),dEt.Transform_setRotation(l,a),dEt.Generic6DofSpring2Constraint_setFrames(this._impl,s,l)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(dzt),vzt=new ir(0,0,0),yzt=new ir(0,0,0);new ir(0,0,0);var bzt=function(){function t(){this.wrappedWorld=void 0,this._isEnabled=!1,this._impl=0,this._comp=null,this._btCollisionFlags=0,this._word3=0,this._dirty=!1,this._collisionFilterGroup=1,this._collisionFilterMask=-1,this.id=t.idCounter++,this.wrappedWorld=lkt.instance.physicsWorld}var e=t.prototype;return e.onComponentSet=function(){},e.updateScale=function(){},e.initialize=function(t){this._comp=t;var e=this._comp.group,i=lkt.instance.collisionMatrix[e];return this._collisionFilterGroup=e,this._collisionFilterMask=i,this.onComponentSet(),0!==this._impl||(Q("[Physics]: Initialize BulletCharacterController failed"),!1)},e.setWrapper=function(){vEt.setWrapper(this._impl,_Et.CCT_CACHE_NAME,this);var t=dEt.CharacterController_getCollisionShape(this.impl);vEt.setWrapper(t,_Et.CCT_CACHE_NAME,this)},e.onEnable=function(){this._isEnabled=!0,this._impl||this.onComponentSet(),this.setDetectCollisions(!1),this.setOverlapRecovery(!0),lkt.instance.physicsWorld.addCCT(this),this.setWrapper()},e.onDisable=function(){this._isEnabled=!1,this.wrappedWorld.removeCCT(this),this.onDestroy()},e.onDestroy=function(){dEt._safe_delete(this._impl,6),vEt.delWrapper(this._impl,_Et.CCT_CACHE_NAME),this._impl=0},e.onLoad=function(){},e.getPosition=function(t){this._impl&&NEt(t,dEt.CharacterController_getPosition(this.impl))},e.setPosition=function(t){this._impl&&(VEt(dEt.CharacterController_getPosition(this.impl),t),this.syncPhysicsToScene())},e.setContactOffset=function(t){this._impl&&dEt.CharacterController_setContactOffset(this._impl,t)},e.setStepOffset=function(t){this._impl&&dEt.CharacterController_setStepOffset(this._impl,t)},e.setSlopeLimit=function(t){this._impl&&dEt.CharacterController_setSlopeLimit(this._impl,ei(t))},e.setDetectCollisions=function(t){this._impl&&dEt.CharacterController_setCollision(this.impl,t)},e.setOverlapRecovery=function(t){this._impl&&dEt.CharacterController_setOverlapRecovery(this.impl,t)},e.onGround=function(){return(4&this._btCollisionFlags)>0},e.syncSceneToPhysics=function(){var t=this.characterController.node;t.hasChangedFlags&&(4&t.hasChangedFlags&&this.syncScale(),1&t.hasChangedFlags&&(ir.add(vzt,t.worldPosition,this.scaledCenter),this.setPosition(vzt)))},e.syncPhysicsToScene=function(){this.getPosition(vzt),vzt.subtract(this.scaledCenter),this._comp.node.setWorldPosition(vzt)},e.syncScale=function(){this.updateScale()},e.move=function(t,e,i){if(this._isEnabled){var n=vEt.instance.BT_V3_0;dEt.Vec3_set(n,t.x,t.y,t.z),this._btCollisionFlags=dEt.CharacterController_move(this.impl,n,e,i)}},e.setGroup=function(t){t!==this._collisionFilterGroup&&(this._collisionFilterGroup=t,this._dirty=!0)},e.getGroup=function(){return this._collisionFilterGroup},e.addGroup=function(t){this._collisionFilterGroup|=t,this._dirty=!0},e.removeGroup=function(t){this._collisionFilterGroup&=~t,this._dirty=!0},e.setMask=function(t){t!==this._collisionFilterMask&&(this._collisionFilterMask=t,this._dirty=!0)},e.getMask=function(){return this._collisionFilterMask},e.addMask=function(t){this._collisionFilterMask|=t,this._dirty=!0},e.removeMask=function(t){this._collisionFilterMask&=~t,this._dirty=!0},e.updateEventListener=function(){this.wrappedWorld.updateNeedEmitCCTEvents(this.characterController.needCollisionEvent)},e.updateDirty=function(){this._dirty&&(lkt.instance.physicsWorld.removeCCT(this),lkt.instance.physicsWorld.addCCT(this),this._dirty=!1)},e.onShapeHitExt=function(t){var e=dEt.ControllerShapeHit_getHitShape(t),i=lkt.instance.physicsWorld;i.cctShapeEventDic.get(this.impl,e);var n=new ir;NEt(n,dEt.ControllerHit_getHitWorldPos(t));var r=new ir;NEt(r,dEt.ControllerHit_getHitWorldNormal(t));var s=new ir;NEt(s,dEt.ControllerHit_getHitMotionDir(t));var a=dEt.ControllerHit_getHitMotionLength(t),o=vEt.getWrapper(e,qNt.TYPE);o&&i.cctShapeEventDic.set(this.impl,e,{BulletCharacterController:this,BulletShape:o,worldPos:n,worldNormal:r,motionDir:s,motionLength:a})},n(t,[{key:"isEnabled",get:function(){return this._isEnabled}},{key:"impl",get:function(){return this._impl}},{key:"characterController",get:function(){return this._comp}},{key:"scaledCenter",get:function(){return ir.multiply(yzt,this._comp.center,this._comp.node.worldScale),yzt}}]),t}();bzt.idCounter=0;var Szt,xzt,wzt,Tzt,Czt,Azt,Dzt,Izt=new ir(0,0,0),Bzt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onComponentSet=function(){this.component.node.getWorldPosition(Izt),Izt.add(this.scaledCenter);var t=vEt.instance.BT_V3_0;dEt.Vec3_set(t,Izt.x,Izt.y,Izt.z);var e=ir.UNIT_Y,i=vEt.instance.BT_V3_1;dEt.Vec3_set(i,e.x,e.y,e.z);var n=dEt.ControllerHitReport.implement(NNt).$$.ptr,r=lkt.instance.physicsWorld,s=dEt.CapsuleCharacterControllerDesc_new(ei(this.component.slopeLimit),this.component.stepOffset,this.component.skinWidth,i,t,n,this.component.radius,this.component.height);this._impl=dEt.CapsuleCharacterController_new(r.impl,s,0),this.updateScale()},i.setRadius=function(){this.updateScale()},i.setHeight=function(){this.updateScale()},i.updateScale=function(){this.updateGeometry()},i.updateGeometry=function(){var t=this.component.node.worldScale,e=this.component.radius*gn(t.x,t.z),i=this.component.height*Math.abs(t.y);dEt.CapsuleCharacterController_setRadius(this.impl,e),dEt.CapsuleCharacterController_setHeight(this.impl,i),this._dirty=!0},n(e,[{key:"component",get:function(){return this._comp}}]),e}(bzt),Mzt=new ir(0,0,0),Pzt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onComponentSet=function(){this.component.node.getWorldPosition(Mzt),Mzt.add(this.scaledCenter);var t=vEt.instance.BT_V3_0;dEt.Vec3_set(t,Mzt.x,Mzt.y,Mzt.z);var e=ir.UNIT_Y,i=vEt.instance.BT_V3_1;dEt.Vec3_set(i,e.x,e.y,e.z);var n=dEt.ControllerHitReport.implement(NNt).$$.ptr,r=lkt.instance.physicsWorld,s=dEt.BoxCharacterControllerDesc_new(ei(this.component.slopeLimit),this.component.stepOffset,this.component.skinWidth,i,t,n,this.component.halfHeight,this.component.halfSideExtent,this.component.halfForwardExtent);this._impl=dEt.BoxCharacterController_new(r.impl,s,0),this.updateScale()},i.setHalfHeight=function(){this.updateScale()},i.setHalfSideExtent=function(){this.updateScale()},i.setHalfForwardExtent=function(){this.updateScale()},i.updateScale=function(){this.updateGeometry()},i.updateGeometry=function(){var t=this.component.node.worldScale;dEt.BoxCharacterController_setHalfSideExtent(this.impl,this.component.halfSideExtent*t.x),dEt.BoxCharacterController_setHalfHeight(this.impl,this.component.halfHeight*t.y),dEt.BoxCharacterController_setHalfForwardExtent(this.impl,this.component.halfForwardExtent*t.z),this._dirty=!0},n(e,[{key:"component",get:function(){return this._comp}}]),e}(bzt);Uk.once(zk.EVENT_PRE_SUBSYSTEM_INIT,(function(){JPt.register("bullet",{PhysicsWorld:izt,RigidBody:VNt,BoxShape:nzt,SphereShape:rzt,CapsuleShape:szt,TrimeshShape:ozt,CylinderShape:hzt,ConeShape:uzt,TerrainShape:lzt,SimplexShape:czt,PlaneShape:fzt,PointToPointConstraint:_zt,HingeConstraint:mzt,FixedConstraint:pzt,ConfigurableConstraint:gzt,BoxCharacterController:Pzt,CapsuleCharacterController:Bzt})}));var Ezt={BOX:0,SPHERE:1,CYLINDER:2,CONE:3,CAPSULE:4,TORUS:5,PLANE:6,QUAD:7};Ee(Ezt);var kzt=t("g0",(Szt=Qh("cc.Primitive"),xzt=Eu(Ezt),Szt((Dzt=function(t){function e(e){var i;return void 0===e&&(e=0),(i=t.call(this)||this).type=Czt&&Czt(),i.info=Azt&&Azt(),i.type=e,i}return s(e,t),e.prototype.onLoaded=function(){FR((0,mJ[Ezt[this.type].toLowerCase()])(this.info),this)},e}(CR),Dzt.PrimitiveType=Ezt,Czt=Nh((Tzt=Dzt).prototype,"type",[xzt],(function(){return 0})),Azt=Nh(Tzt.prototype,"info",[hu],(function(){return{}})),wzt=Tzt))||wzt));C.Primitive=kzt,A.primitives=mJ;var Rzt,Ozt=function(){function t(t,e,i){this._total=0,this._value=0,this._averageValue=0,this._accumValue=0,this._accumSamples=0,this._id=t,this._opts=e,this._accumStart=i}var e=t.prototype;return e.sample=function(t){this._average(this._value,t)},e.human=function(){var t=this._opts,e=t.average,i=t.isInteger,n=e?this._averageValue:this._value;return i?Math.round(n):Math.round(100*n)/100},e.alarm=function(){return void 0!==this._opts.below&&this._valuethis._opts.over},e._average=function(t,e){if(void 0===e&&(e=0),this._opts.average){this._accumValue+=t,++this._accumSamples;var i=e;i-this._accumStart>=this._opts.average&&(this._averageValue=this._accumValue/this._accumSamples,this._accumValue=0,this._accumStart=i,this._accumSamples=0)}},n(t,[{key:"value",get:function(){return this._value},set:function(t){this._value=t}}]),t}(),Fzt=Qh("cc.PerfCounter")(Rzt=function(t){function e(e,i,n){var r;return(r=t.call(this,e,i,n)||this)._time=n,r}s(e,t);var i=e.prototype;return i.start=function(t){void 0===t&&(t=0),this._time=t},i.end=function(t){void 0===t&&(t=0),this._value=t-this._time,this._average(this._value)},i.tick=function(){this.end(),this.start()},i.frame=function(t){var e=t,i=e-this._time;this._total++,i>(this._opts.average||1e3)&&(this._value=1e3*this._total/i,this._total=0,this._time=e,this._average(this._value))},e}(Ozt))||Rzt,Lzt="0123456789. ",Vzt=500,Nzt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,".":10},zzt={fps:{desc:"Framerate (FPS)",below:30,average:Vzt,isInteger:!0},draws:{desc:"Draw call",isInteger:!0},frame:{desc:"Frame time (ms)",min:0,max:50,average:Vzt},instances:{desc:"Instance Count",isInteger:!0},tricount:{desc:"Triangle",isInteger:!0},logic:{desc:"Game Logic (ms)",min:0,max:50,average:Vzt,color:"#080"},physics:{desc:"Physics (ms)",min:0,max:50,average:Vzt},render:{desc:"Renderer (ms)",min:0,max:50,average:Vzt,color:"#f90"},present:{desc:"Present (ms)",min:0,max:50,average:Vzt,color:"#f90"},textureMemory:{desc:"GFX Texture Mem(M)"},bufferMemory:{desc:"GFX Buffer Mem(M)"}},Uzt=t("g1",function(t){function e(){var e;return(e=t.call(this)||this)._profilerStats=null,e._showFPS=!1,e._rootNode=null,e._device=null,e._swapchain=null,e._meshRenderer=null,e._canvas=null,e._ctx=null,e._texture=null,e._region=new e_,e._canvasArr=[],e._regionArr=[e._region],e.digitsData=null,e.offsetData=null,e.pass=null,e._canvasDone=!1,e._statsDone=!1,e._inited=!1,e._lineHeight=280/(Object.keys(zzt).length+1),e._wordHeight=0,e._eachNumWidth=0,e._totalLines=0,e.lastTime=0,e._canvas=I.document.createElement("canvas"),e._ctx=e._canvas.getContext("2d"),e._canvasArr.push(e._canvas),e}s(e,t);var i=e.prototype;return i.init=function(){ze.querySettings("profiling","showFPS")?this.showStats():this.hideStats()},i.isShowingStats=function(){return this._showFPS},i.hideStats=function(){this._showFPS&&(this._rootNode&&(this._rootNode.active=!1),GE.off("director_before_update",this.beforeUpdate,this),GE.off("director_after_update",this.afterUpdate,this),GE.off("director_before_physics",this.beforePhysics,this),GE.off("director_after_physics",this.afterPhysics,this),GE.off("director_before_draw",this.beforeDraw,this),GE.off("director_after_render",this.afterRender,this),GE.off("director_after_draw",this.afterPresent,this),this._showFPS=!1,GE.root.pipeline.profiler=null,C.game.config.showFPS=!1)},i.showStats=function(){if(!this._showFPS){if(!this._device){var t=C.director.root;this._device=Hp.gfxDevice,this._swapchain=t.mainWindow.swapchain}this.generateCanvas(),this.generateStats(),C.game.once(C.Game.EVENT_ENGINE_INITED,this.generateNode,this),C.game.on(C.Game.EVENT_RESTART,this.generateNode,this),this._rootNode&&(this._rootNode.active=!0),GE.on("director_before_update",this.beforeUpdate,this),GE.on("director_after_update",this.afterUpdate,this),GE.on("director_before_physics",this.beforePhysics,this),GE.on("director_after_physics",this.afterPhysics,this),GE.on("director_before_draw",this.beforeDraw,this),GE.on("director_after_render",this.afterRender,this),GE.on("director_after_draw",this.afterPresent,this),this._showFPS=!0,this._canvasDone=!0,this._statsDone=!0,C.game.config.showFPS=!0}},i.generateCanvas=function(){if(!this._canvasDone){var t=this._canvas,e=this._ctx;if(e&&t){t.width=280,t.height=280,t.style.width=""+t.width,t.style.height=""+t.height,e.font="23px Arial",e.textBaseline="top",e.fillStyle="#fff",this._texture=this._device.createTexture(new d_(1,6,35,280,280));var i=this._region.texExtent;i.width=280,i.height=280}}},i.generateStats=function(){if(!this._statsDone&&this._ctx&&this._canvas){this._profilerStats=null;var t=performance.now();this._ctx.textAlign="left";var e=0;for(var i in zzt){var n=zzt[i];this._ctx.fillText(n.desc,0,e*this._lineHeight),n.counter=new Fzt(i,n,t),e++}this._totalLines=e,this._wordHeight=this._totalLines*this._lineHeight/this._canvas.height;for(var r=0;r<12;++r){var s=this._ctx.measureText(Lzt[r]).width;this._eachNumWidth=Math.max(this._eachNumWidth,s)}for(var a=0;a<12;++a)this._ctx.fillText(Lzt[a],a*this._eachNumWidth,this._totalLines*this._lineHeight);this._eachNumWidth/=this._canvas.width,this._profilerStats=zzt,this._canvasArr[0]=this._canvas,this._device.copyTexImagesToTexture(this._canvasArr,this._texture,this._regionArr)}},i.generateNode=function(){if(!this._rootNode||!this._rootNode.isValid){this._rootNode=new tb("PROFILER_NODE"),this._rootNode._objFlags=1032,Uk.addPersistRootNode(this._rootNode);var t=new tb("Profiler_Root");t.parent=this._rootNode;for(var e=.4,i=e/this._totalLines,n=e/this._wordHeight,r=i/23,s=this._eachNumWidth*this._canvas.width*r,a=[0,e,0,n,e,0,n,0,0,0,0,0],o=[0,2,1,0,3,2],h=[0,0,-1,0,1,0,-1,0,1,this._wordHeight,-1,0,0,this._wordHeight,-1,0],u=0,l=0;l=0;o--){var h=8*i+o,u=a[a.length-(8-o)],l=Nzt[u];void 0===l&&(l=11),n[h]=l}i++}}}},n(e,[{key:"_stats",get:function(){return at(16381),this._profilerStats}},{key:"stats",get:function(){return this._profilerStats}}]),e}(Of)),Gzt=t("g2",new Uzt);GE.registerSystem("profiler",Gzt,0),C.profiler=Gzt;var Hzt=function(){function t(t){this.jointTexturePool=void 0,this.jointAnimationInfo=void 0,this.jointTexturePool=new mY(t),this.jointAnimationInfo=new gY(t)}var e=t.prototype;return e.releaseSkeleton=function(t){this.jointTexturePool.releaseSkeleton(t)},e.releaseAnimationClip=function(t){this.jointTexturePool.releaseAnimationClip(t)},e.clear=function(){this.jointTexturePool.clear(),this.jointAnimationInfo.clear()},t}();C.internal.DataPoolManager=Hzt;var Wzt,jzt,qzt,Xzt,Yzt,Qzt,Jzt,Kzt,Zzt,$zt,tUt,eUt,iUt,nUt,rUt,sUt=new Qr,aUt=new Qr,oUt=t("g4",function(t){function e(e,i){var n;return void 0===i&&(i=""),(n=t.call(this,e,i)||this)._frames=1,n._bakedDuration=0,n._animInfo=null,n._sockets=[],n._animInfoMgr=void 0,n._parent=null,n._curvesInited=!1,n._animInfoMgr=C.director.root.dataPoolManager.jointAnimationInfo,n}s(e,t);var i=e.prototype;return i.initialize=function(e){if(!this._curveLoaded){this._parent=e.getComponent("cc.SkeletalAnimation");var i=this._parent.useBakedAnimation;this._doNotCreateEval=i,t.prototype.initialize.call(this,e),this._curvesInited=!i;var n=eY.getOrExtract(this.clip),r=n.frames,s=n.samples;this._frames=r-1,this._animInfo=this._animInfoMgr.getData(e.uuid),this._bakedDuration=this._frames/s,this.setUseBaked(i)}},i.onPlay=function(){var e=this;t.prototype.onPlay.call(this),this._parent.useBakedAnimation&&(this._animInfoMgr.switchClip(this._animInfo,this.clip),this._parent.getUsers().forEach((function(t){t.uploadAnimation(e.clip)})))},i.setUseBaked=function(e){e?(this._sampleCurves=this._sampleCurvesBaked,this.duration=this._bakedDuration):(this._sampleCurves=t.prototype._sampleCurves,this.duration=this.clip.duration,this._curvesInited||(this._curveLoaded=!1,t.prototype.initialize.call(this,this._targetNode),this._curvesInited=!0))},i.rebuildSocketCurves=function(t){if(this._sockets.length=0,this._targetNode)for(var e=this._targetNode,i=0;ii?i:t},t.cosDeg=function(t){return Math.cos(t*u)},t.sinDeg=function(t){return Math.sin(t*u)},t.signum=function(t){return t>0?1:t<0?-1:0},t.toInt=function(t){return t>0?Math.floor(t):Math.ceil(t)},t.cbrt=function(t){var e=Math.pow(Math.abs(t),1/3);return t<0?-e:e},t.randomTriangular=function(e,i){return t.randomTriangularWith(e,i,.5*(e+i))},t.randomTriangularWith=function(t,e,i){var n=Math.random(),r=e-t;return n<=(i-t)/r?t+Math.sqrt(n*r*(i-t)):e-Math.sqrt((1-n)*r*(e-i))},t}(),e.PI=r,e.PI2=s,e.radiansToDegrees=a,e.radDeg=o,e.degreesToRadians=h,e.degRad=u,e)}(fUt||(fUt={}));var _Ut=fUt;function pUt(t,e){return t?e===t.length?t:e=this._maxFrameIdex&&(this.isCompleted=!0)}while(this.needToUpdate(t))},e.getFrame=function(t){var e=t%this._maxFrameIdex;return this.frames[e]},e.invalidAnimationFrames=function(){this._curIndex=-1,this._isCompleted=!1,this.frames.length=0},e.updateRenderData=function(t,e){var i=e.vCount,n=e.iCount,r=aGt/4,s=new Uint8Array(4*r*i),a=new Uint16Array(n),o=_Ut.wasmUtil.wasm.HEAPU8,h=e.vPtr,u=4*i*r;s.set(o.subarray(h,h+u));var l=e.iPtr,c=2*n;new Uint8Array(a.buffer).set(o.subarray(l,l+c));var f=new hGt;f.vCount=i,f.iCount=n,f.vData=s,f.iData=a;for(var d=e.getData(),_=e.getTextures(),p=d.size(),m=0;m0)return void this._sharedCacheMap.set(t,i);this._sharedCacheMap.delete(t)}}var n=this._skeletonCache[t];if(n){var r=this._privateMode?function(t,e){e.destroy()}:function(i,n){e._animationPool[t+"#"+i]=n,n.clear()},s=n.animationsCache;for(var a in s){var o=s[a];o&&r(a,o)}n.skeleton&&_Ut.wasmUtil.destroySpineSkeleton(n.skeleton),delete this._skeletonCache[t]}},e.createSkeletonInfo=function(t){var e=t.uuid,i=t.getRuntimeData();if(!this._privateMode){var n=this._sharedCacheMap.get(e);n?n+=1:n=1,this._sharedCacheMap.set(e,n)}if(this._skeletonCache[e])return this._skeletonCache[e];var r=new _Ut.Skeleton(i),s=new YUt;return this._skeletonCache[e]={skeleton:r,clipper:null,state:null,listener:s,animationsCache:{},curAnimationCache:null,assetUUID:e}},e.getSkeletonInfo=function(t){var e=t.uuid;return this._skeletonCache[e]},e.getAnimationCache=function(t,e){var i=this._skeletonCache[t];return i?i.animationsCache[e]:null},e.initAnimationCache=function(t,e,i){var n=e.getRuntimeData();if(!n)return null;var r=this._skeletonCache[t];if(!r||!r.skeleton)return null;var s=r.animationsCache,a=s[i];if(!a){var o=t+"#"+i;(a=this._animationPool[o])?delete this._animationPool[o]:(a=new lGt(n))._privateMode=this._privateMode,a.init(r,i),s[i]=a}return a.init(r,i),a.setAnimation(i),a},e.destroyCachedAnimations=function(t){if(t){var e=this._animationPool;for(var i in e)i.includes(t)&&(e[i].destroy(),delete e[i]);var n=this._skeletonCache[t],r=n&&n.skeleton;r&&_Ut.wasmUtil.destroySpineSkeleton(r),n&&delete this._skeletonCache[t]}else{var s=this._animationPool;for(var a in s)s[a].destroy(),delete s[a]}},t}();jUt=cGt,cGt.FrameTime=QUt,cGt.sharedCache=new jUt;var fGt=(JUt=Qh("sp.SkeletonData"),KUt=Eu([Pv]),ZUt=Eu([di]),JUt((tGt=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonJson=eGt&&eGt(),e.textures=iGt&&iGt(),e.textureNames=nGt&&nGt(),e.scale=rGt&&rGt(),e._atlasText=sGt&&sGt(),e._buffer=void 0,e._skeletonCache=null,e._skinsEnum=null,e._animsEnum=null,e.reset(),e}s(e,t);var i=e.prototype;return i.createNode=function(t){var e=new tb(this.name);return e.addComponent("cc.Skeleton").skeletonData=this,t(null,e)},i.reset=function(){this._skeletonCache=null},i.resetEnums=function(){},i.getRuntimeData=function(t){if(this._skeletonCache)return this._skeletonCache;if(!(this.textures&&this.textures.length>0)&&this.textureNames&&this.textureNames.length>0)return t||Q(this.name+" no textures found!"),null;var e=this.mergedUUID(),i=_Ut.wasmUtil.querySpineSkeletonDataByUUID(e);if(i)this._skeletonCache=i;else{for(var n=this.textures.length,r=[],s=0;s1)return this._animsEnum;var t=this.getRuntimeData(!0);if(t){for(var e={"":0},i=t.animations,n=0;n":0};Oe(QGt);var JGt=QGt,KGt=(_Gt=Qh("sp.Skeleton.SpineSocket"),pGt=Eu(tb),_Gt((gGt=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),this.path=vGt&&vGt(),this.target=yGt&&yGt(),this.path=t,this.target=e},vGt=Nh(gGt.prototype,"path",[hu],(function(){return""})),yGt=Nh(gGt.prototype,"target",[pGt,hu],(function(){return null})),mGt=gGt))||mGt);le(KGt,"sp.Skeleton.SpineSocket");var ZGt=(bGt=Qh("sp.Skeleton"),SGt=Eu(fGt),xGt=Eu(YGt),wGt=Eu(QGt),TGt=Eu(qGt),CGt=Eu([KGt]),AGt=Eu(FT),bGt((HGt=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonData=BGt&&BGt(),e.defaultSkin=MGt&&MGt(),e.defaultAnimation=PGt&&PGt(),e._premultipliedAlpha=EGt&&EGt(),e._timeScale=kGt&&kGt(),e._preCacheMode=RGt&&RGt(),e._cacheMode=OGt&&OGt(),e._sockets=FGt&&FGt(),e._useTint=LGt&&LGt(),e._debugMesh=VGt&&VGt(),e._debugBones=NGt&&NGt(),e._debugSlots=zGt&&zGt(),e._enableBatch=UGt&&UGt(),e._runtimeData=null,e._skeleton=null,e._instance=null,e._state=null,e._textures=[],e._skeletonInfo=null,e._animationName="",e._skinName="",e._drawList=new ho((function(){return{material:null,texture:null,indexOffset:0,indexCount:0}}),1),e._materialCache={},e.paused=!1,e._enumSkins=Ee({}),e._enumAnimations=Ee({}),e.attachUtil=void 0,e._socketNodes=new Map,e._cachedSockets=new Map,e._startEntry=void 0,e._endEntry=void 0,e._paused=!1,e._accTime=0,e._playCount=0,e._skeletonCache=null,e._animCache=null,e._animationQueue=[],e._headAniInfo=null,e._isAniComplete=!0,e._playTimes=0,e._curFrame=null,e._needUpdateSkeltonData=!0,e._listener=null,e._debugRenderer=null,e._startSlotIndex=void 0,e._endSlotIndex=void 0,e._customMaterialInstance=null,e._vLength=0,e._vBuffer=null,e._iLength=0,e._iBuffer=null,e._model=void 0,e._tempColor={r:0,g:0,b:0,a:0},e._eventListenerID=-1,e._slotTextures=null,e.loop=GGt&&GGt(),e._useVertexOpacity=!0,e._startEntry={animation:{name:""},trackIndex:0},e._endEntry={animation:{name:""},trackIndex:0},e._startSlotIndex=-1,e._endSlotIndex=-1,e._instance=new _Ut.SkeletonInstance,e._instance.dtRate=1*e._timeScale,e._instance.isCache=e.isAnimationCached(),e.attachUtil=new jGt,e}s(e,t);var i=e.prototype;return i.__preload=function(){t.prototype.__preload.call(this),this._updateSkeletonData(),this._updateDebugDraw()},i.onRestore=function(){this.updateMaterial(),this._markForUpdateRenderData()},i.getState=function(){return this._state},i.onEnable=function(){t.prototype.onEnable.call(this),this._instance&&(this._instance.enable=!0),this._flushAssembler(),dGt.getInstance().add(this)},i.onDisable=function(){t.prototype.onDisable.call(this),this._instance&&(this._instance.enable=!1),dGt.getInstance().remove(this)},i.onDestroy=function(){var e;this._eventListenerID>0&&(YUt.removeListener(this._eventListenerID),this._eventListenerID=-1),this._drawList.destroy(),this.destroyRenderData(),this._cleanMaterialCache(),this._vBuffer=null,this._iBuffer=null,this.attachUtil.reset(),null==(e=this._slotTextures)||e.clear(),this._slotTextures=null,this._cachedSockets.clear(),this._socketNodes.clear(),this._animCache=null,dGt.getInstance().remove(this),this._instance&&(this._instance.destroy(),this._instance=null),this._destroySkeletonInfo(this._skeletonCache),this._skeletonCache=null,t.prototype.onDestroy.call(this)},i.clearAnimation=function(t){this.isAnimationCached()||(this.clearTrack(t||0),this.setToSetupPose())},i.clearAnimations=function(){this.isAnimationCached()||(this.clearTracks(),this.setToSetupPose())},i._updateSkeletonData=function(){var t=this._skeletonData;if(!t)return this._runtimeData=null,this._state=null,this._skeleton=null,this._textures=[],void this._refreshInspector();this._instance&&(this._instance.dtRate=1*this._timeScale),this._needUpdateSkeltonData=!1,this._runtimeData=t.getRuntimeData(),this._runtimeData&&(this.setSkeletonData(this._runtimeData),this._textures=t.textures,this._refreshInspector(),this.defaultSkin&&""!==this.defaultSkin?this.setSkin(this.defaultSkin):this._skinName&&""!==this._skinName&&this.setSkin(this._skinName),this.defaultAnimation?this.animation=this.defaultAnimation.toString():this._animationName?this.animation=this._animationName:this.animation="",this._updateUseTint(),this._indexBoneSockets(),this._updateSocketBindings(),this.attachUtil.init(this),this._preCacheMode=this._cacheMode)},i.setSkeletonData=function(t){var e=this._skeletonCache;if(1===this._cacheMode?this._skeletonCache=cGt.sharedCache:2===this._cacheMode?(this._skeletonCache=new cGt,this._skeletonCache.enablePrivateMode()):this._skeletonCache=null,e!==this._skeletonCache&&this._destroySkeletonInfo(e),this.isAnimationCached()){(this.debugBones||this.debugSlots)&&at(16410);var i=this._skeletonCache.getSkeletonInfo(this._skeletonData);this._skeletonInfo!==i&&(this._destroySkeletonInfo(this._skeletonCache),i||2!==this._cacheMode||(this._animCache=this._skeletonCache.initAnimationCache(this.skeletonData.uuid,this._skeletonData,this._animationName)),this._skeletonInfo=this._skeletonCache.createSkeletonInfo(this._skeletonData)),this._skeletonInfo&&(this._skeleton=this._skeletonInfo.skeleton)}else this._skeleton=this._instance.initSkeleton(t),this._state=this._instance.getAnimationState(),this._instance.setPremultipliedAlpha(this._premultipliedAlpha);this._flushAssembler()},i.setSlotsRange=function(t,e){this.isAnimationCached()?at(16411):(this._startSlotIndex=t,this._endSlotIndex=e)},i.getAttachment=function(t,e){return this._skeleton?this._skeleton.getAttachmentByName(t,e):null},i.setAttachment=function(t,e){this._skeleton&&this._skeleton.setAttachment(t,e),this.invalidAnimationCache()},i.getTextureAtlas=function(t){return t.region},i.setAnimation=function(t,e,i){if("string"!=typeof e)return it(7511),null;var n=this._skeleton;if(!n||!n.data.findAnimation(e))return it(7509,e),null;var r=null;if(void 0===i&&(i=!0),this._playTimes=i?0:1,this.isAnimationCached()){if(0!==t&&at(16412),!this._skeletonCache)return null;var s=this._skeletonCache.getAnimationCache(this._skeletonData.uuid,e);s||(s=this._skeletonCache.initAnimationCache(this.skeletonData.uuid,this._skeletonData,e))&&this._skinName&&s.setSkin(this._skinName),s&&(this._animationName=e,this._isAniComplete=!1,this._accTime=0,this._playCount=0,this._animCache=s,this._socketNodes.size>0&&this._animCache.enableCacheAttachedInfo(),this._animCache.updateToFrame(0),this._curFrame=this._animCache.frames[0])}else this._animationName=e,r=this._instance.setAnimation(t,e,i);return this._markForUpdateRenderData(),r},i.addAnimation=function(t,e,i,n){if(n=n||0,this.isAnimationCached())return 0!==t&&at(16413),this._animationQueue.push({animationName:e,loop:i,delay:n}),null;if(this._skeleton){var r,s=this._skeleton.data.findAnimation(e);return s?null==(r=this._state)?void 0:r.addAnimationWith(t,s,i,n):(it(7510,e),null)}return null},i.findAnimation=function(t){return this._skeleton?this._skeleton.data.findAnimation(t):null},i.getCurrent=function(t){if(this.isAnimationCached())at(16414);else if(this._state)return this._state.getCurrent(t);return null},i.setSkin=function(t){t&&(this._skeleton&&this._skeleton.setSkinByName(t),this._instance.setSkin(t),this.isAnimationCached()&&this._animCache&&this._animCache.setSkin(t),this._skinName=t,this.invalidAnimationCache())},i.updateAnimation=function(t){if(this._markForUpdateRenderData(),!this.paused)if(this.isAnimationCached()){if(t*=1*this._timeScale,this._isAniComplete){var e;if(0===this._animationQueue.length&&!this._headAniInfo){var i=this._animCache;if(i&&i.isInvalid()){i.updateToFrame(0);var n=i.frames;this._curFrame=n[n.length-1]}return}if(this._headAniInfo||(this._headAniInfo=this._animationQueue.shift()),this._accTime+=t,this._accTime>(null==(e=this._headAniInfo)?void 0:e.delay)){var r=this._headAniInfo;this._headAniInfo=null,this.setAnimation(0,null==r?void 0:r.animationName,null==r?void 0:r.loop)}return}this._updateCache(t)}else this._instance.updateAnimation(t)},i._updateCache=function(t){var e=this._animCache;if(e.isInited()){var i=e.frames,n=cGt.FrameTime;0===this._accTime&&0===this._playCount&&(this._startEntry.animation.name=this._animationName,this._listener&&this._listener.start&&this._listener.start(this._startEntry)),this._accTime+=t;var r=Math.floor(this._accTime/n);if(e.isCompleted||e.updateToFrame(r),this._curFrame=i[r],void 0!==this._curFrame&&this.attachUtil.updateSkeletonBones(this._curFrame.boneInfos),e.isCompleted&&r>=i.length){if(this._playCount++,this._playTimes>0&&this._playCount>=this._playTimes)return this._curFrame=i[i.length-1],this._accTime=0,this._playCount=0,this._isAniComplete=!0,void this._emitCacheCompleteEvent();this._accTime=0,r=0,this._curFrame=i[r],this._emitCacheCompleteEvent()}}},i._emitCacheCompleteEvent=function(){this._listener&&(this._endEntry.animation.name=this._animationName,this._listener.complete&&this._listener.complete(this._endEntry),this._listener.end&&this._listener.end(this._endEntry))},i.updateRenderData=function(){return this.isAnimationCached()?this._curFrame?this._curFrame.model:null:this._instance.updateRenderData()},i._flushAssembler=function(){var t=e.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t),this._skeleton&&this._assembler&&this._assembler.createData&&(this._renderData=this._assembler.createData(this),this._markForUpdateRenderData(),this._updateColor())},i._render=function(t){var e=0;if(this.renderData&&this._drawList.length>0){for(var i=this.renderData,n=i.chunk,r=n.vertexAccessor,s=i.getMeshBuffer(),a=s.indexOffset,o=0;o":e(t[i.parent.data.index])+"/"+i.data.name},i=0,n=t.length;i0?Array.from(this._cachedSockets.keys()).sort():[]):[]},i._updateUseTint=function(){this._cleanMaterialCache(),this.destroyRenderData(),this.isAnimationCached()||this._instance.setUseTint(this._useTint);var t=this._assembler;t&&t.createData&&this._skeleton&&(this._renderData=t.createData(this),this._markForUpdateRenderData())},i._updateBatch=function(){this._cleanMaterialCache(),this._markForUpdateRenderData()},i._updateDebugDraw=function(){if(this.debugBones||this.debugSlots||this.debugMesh){if(!this._debugRenderer){var t=new tb("DEBUG_DRAW_NODE");t.layer=this.node.layer,t.hideFlags|=1032;var e=null;try{(e=t.addComponent("cc.Graphics")).lineWidth=5,e.strokeColor=new cr(255,0,0,255),this._debugRenderer=e,t.parent=this.node,this.node.on("layer-changed",this._applyLayer,this)}catch(e){ht(4501,e.message),t.destroy(),t=null}}this.isAnimationCached()?at(16418):this._instance.setDebugMode(!0)}else this._debugRenderer&&(this.node.off("layer-changed",this._applyLayer,this),this._debugRenderer.node.destroy(),this._debugRenderer=null,this.isAnimationCached()||this._instance&&this._instance.setDebugMode(!1))},i._updateUITransform=function(){var t=this.node._getUITransformComp(),e=this._runtimeData;if(!e)return t.setContentSize(100,100),t.anchorX=.5,void(t.anchorX=.5);var i=e.width,n=e.height;i&&n&&(t.setContentSize(i,n),0!==i&&(t.anchorX=Math.abs(e.x)/i),0!==n&&(t.anchorY=Math.abs(e.y)/n))},i._updateColor=function(){var t=this,e=t.node._uiProps,i=t._tempColor,n=t._color,r=t.node.parent?t.node.parent._uiProps.opacity:1,s=e.localOpacity*r*n.a/255;if(i.r!==n.r||i.g!==n.g||i.b!==n.b||i.a!==s){e.colorDirty=!0,i.r=n.r,i.g=n.g,i.b=n.b,i.a=s;var a=n.r/255,o=n.g/255,h=n.b/255;this._instance.setColor(a,o,h,s)}},i.setVertexEffectDelegate=function(t){if(this._instance)if(t){var e=null==t?void 0:t.getEffectType();if("jitter"===e){var i=null==t?void 0:t.getJitterVertexEffect();this._instance.setJitterEffect(i)}else if("swirl"===e){var n=null==t?void 0:t.getJitterVertexEffect();this._instance.setSwirlEffect(n)}}else this._instance.clearEffect()},i._ensureListener=function(){this._listener||(this._listener=new YUt,this._eventListenerID=YUt.addListener(this._listener),this._instance.setListener(this._eventListenerID))},i.setStartListener=function(t){this._ensureListener(),this._listener.start=t},i.setInterruptListener=function(t){this._ensureListener(),this._listener.interrupt=t},i.setEndListener=function(t){this._ensureListener(),this._listener.end=t},i.setDisposeListener=function(t){this._ensureListener(),this._listener.dispose=t},i.setCompleteListener=function(t){this._ensureListener(),this._listener.complete=t},i.setEventListener=function(t){this._ensureListener(),this._listener.event=t},i.setTrackStartListener=function(t,e){YUt.getListeners(t,this._instance).start=e},i.setTrackInterruptListener=function(t,e){YUt.getListeners(t,this._instance).interrupt=e},i.setTrackEndListener=function(t,e){YUt.getListeners(t,this._instance).end=e},i.setTrackDisposeListener=function(t,e){YUt.getListeners(t,this._instance).dispose=e},i.setTrackCompleteListener=function(t,e){YUt.getListeners(t,this._instance).complete=function(t){var i=Math.floor(t.trackTime/t.animationEnd);e(t,i)}},i.setTrackEventListener=function(t,e){YUt.getListeners(t,this._instance).event=e},i.getDebugShapes=function(){return this._instance.getDebugShapes()},i.setSlotTexture=function(t,e,i){if(this.isAnimationCached())Q("Cached mode can't change texture of slot");else if(this.findSlot(t)){var n=e.width,r=e.height,s=i||!1;this._instance.resizeSlotRegion(t,n,r,s);var a=e.uuid;a||(a=e.getId()),this._instance.setSlotTexture(t,a),this._slotTextures||(this._slotTextures=new Map),this._slotTextures.set(a,e)}else Q("No slot named:"+t)},i._destroySkeletonInfo=function(t){t&&this._skeletonInfo&&(t.destroySkeleton(this._skeletonInfo.assetUUID),this._skeletonInfo=null)},i._applyLayer=function(){this._debugRenderer&&(this._debugRenderer.node.layer=this.node.layer)},n(e,[{key:"drawList",get:function(){return this._drawList}},{key:"skeletonData",get:function(){return this._skeletonData},set:function(t){t&&t.resetEnums(),this._skeletonData!==t&&(this.destroyRenderData(),this._skeletonData=t,this.defaultSkin="",this.defaultAnimation="",this._animationName="",this._skinName="",this._updateSkeletonData(),this._updateUITransform())}},{key:"_defaultSkinIndex",get:function(){if(this.skeletonData){var t=this.skeletonData.getSkinsEnum();if(t)if(""===this.defaultSkin){if(t.hasOwnProperty(0))return this._defaultSkinIndex=0,0}else{var e=t[this.defaultSkin];if(void 0!==e)return e}}return 0},set:function(t){var e;if(this.skeletonData&&(e=this.skeletonData.getSkinsEnum()),e){var i=e[t];void 0!==i?(this.defaultSkin=String(i),this.setSkin(this.defaultSkin),this._refreshInspector(),this._markForUpdateRenderData()):Q(this.name+" skin enums are invalid")}else Q(this.name+" skin enums are invalid")}},{key:"_animationIndex",get:function(){var t=this.animation;if(this.skeletonData)if(t){var e=this.skeletonData.getAnimsEnum();if(e){var i=e[t];if(void 0!==i)return i}}else this._refreshInspector();return 0},set:function(t){var e;if(this.skeletonData&&(e=this.skeletonData.getAnimsEnum()),e){var i=String(e[t]);void 0!==i?(this.animation=i,this.animation=i):Q(this.name+" animation enums are invalid")}else Q(this.name+" animation enums are invalid")}},{key:"defaultCacheMode",get:function(){return this._cacheMode},set:function(t){this._cacheMode=t,this.setAnimationCacheMode(this._cacheMode)}},{key:"premultipliedAlpha",get:function(){return this._premultipliedAlpha},set:function(t){t!==this._premultipliedAlpha&&(this._premultipliedAlpha=t,this._instance.setPremultipliedAlpha(t),this._markForUpdateRenderData())}},{key:"timeScale",get:function(){return this._timeScale},set:function(t){t!==this._timeScale&&(this._timeScale=t,this._instance&&(this._instance.dtRate=1*this._timeScale))}},{key:"useTint",get:function(){return this._useTint},set:function(t){t!==this._useTint&&(this._useTint=t,this._updateUseTint())}},{key:"enableBatch",get:function(){return this._enableBatch},set:function(t){t!==this._enableBatch&&(this._enableBatch=t,this._updateBatch())}},{key:"sockets",get:function(){return this._sockets},set:function(t){this._sockets=t,this._updateSocketBindings(),this.attachUtil.init(this)}},{key:"debugSlots",get:function(){return this._debugSlots},set:function(t){t!==this._debugSlots&&(this._debugSlots=t,this._updateDebugDraw(),this._markForUpdateRenderData())}},{key:"debugBones",get:function(){return this._debugBones},set:function(t){t!==this._debugBones&&(this._debugBones=t,this._updateDebugDraw(),this._markForUpdateRenderData())}},{key:"debugMesh",get:function(){return this._debugMesh},set:function(t){t!==this._debugMesh&&(this._debugMesh=t,this._updateDebugDraw(),this._markForUpdateRenderData())}},{key:"socketNodes",get:function(){return this._socketNodes}},{key:"animation",get:function(){return this._animationName},set:function(t){t?this.setAnimation(0,t,this.loop):this.clearAnimation(0)}},{key:"customMaterial",get:function(){return this._customMaterial},set:function(t){this._customMaterial=t,this.updateMaterial(),this._markForUpdateRenderData()}},{key:"customMaterialInstance",get:function(){if(!this._customMaterial)return null;if(!this._customMaterialInstance){var t={parent:this._customMaterial,subModelIdx:0,owner:this};this._customMaterialInstance=new jT(t)}return this._customMaterialInstance}}]),e}(xL),HGt.SpineSocket=KGt,HGt.AnimationCacheMode=qGt,BGt=Nh((IGt=HGt).prototype,"_skeletonData",[hu],(function(){return null})),MGt=Nh(IGt.prototype,"defaultSkin",[hu],(function(){return""})),PGt=Nh(IGt.prototype,"defaultAnimation",[hu],(function(){return""})),EGt=Nh(IGt.prototype,"_premultipliedAlpha",[hu],(function(){return!0})),kGt=Nh(IGt.prototype,"_timeScale",[hu],(function(){return 1})),RGt=Nh(IGt.prototype,"_preCacheMode",[hu],(function(){return-1})),OGt=Nh(IGt.prototype,"_cacheMode",[hu],(function(){return 0})),FGt=Nh(IGt.prototype,"_sockets",[hu],(function(){return[]})),LGt=Nh(IGt.prototype,"_useTint",[hu],(function(){return!1})),VGt=Nh(IGt.prototype,"_debugMesh",[hu],(function(){return!1})),NGt=Nh(IGt.prototype,"_debugBones",[hu],(function(){return!1})),zGt=Nh(IGt.prototype,"_debugSlots",[hu],(function(){return!1})),UGt=Nh(IGt.prototype,"_enableBatch",[hu],(function(){return!1})),y(IGt.prototype,"skeletonData",[SGt],Object.getOwnPropertyDescriptor(IGt.prototype,"skeletonData"),IGt.prototype),y(IGt.prototype,"_defaultSkinIndex",[xGt],Object.getOwnPropertyDescriptor(IGt.prototype,"_defaultSkinIndex"),IGt.prototype),y(IGt.prototype,"_animationIndex",[wGt],Object.getOwnPropertyDescriptor(IGt.prototype,"_animationIndex"),IGt.prototype),y(IGt.prototype,"defaultCacheMode",[TGt],Object.getOwnPropertyDescriptor(IGt.prototype,"defaultCacheMode"),IGt.prototype),GGt=Nh(IGt.prototype,"loop",[hu],(function(){return!0})),y(IGt.prototype,"sockets",[CGt],Object.getOwnPropertyDescriptor(IGt.prototype,"sockets"),IGt.prototype),y(IGt.prototype,"customMaterial",[Uu,AGt],Object.getOwnPropertyDescriptor(IGt.prototype,"customMaterial"),IGt.prototype),DGt=IGt))||DGt);A.internal.SpineSkeleton=ZGt;var $Gt,tHt,eHt,iHt,nHt=function(){function t(){this.name="sp.VertexEffectDelegate",this._vertexEffect=void 0,this._interpolation=void 0,this._effectType=void 0,this._vertexEffect=null,this._interpolation=null,this._effectType="none"}var e=t.prototype;return e.clear=function(){this._vertexEffect=null,this._interpolation=null,this._effectType="none"},e.initJitter=function(t,e){return this._effectType="jitter",this._vertexEffect=new _Ut.JitterEffect(t,e),this._vertexEffect},e.initSwirlWithPow=function(t,e){return this._effectType="swirl",this._interpolation=new _Ut.Pow(e),this._vertexEffect=new _Ut.SwirlEffect(t,this._interpolation),this._vertexEffect},e.initSwirlWithPowOut=function(t,e){return this._effectType="swirl",this._interpolation=new _Ut.PowOut(e),this._vertexEffect=new _Ut.SwirlEffect(t,this._interpolation),this._vertexEffect},e.getJitterVertexEffect=function(){return this._vertexEffect},e.getSwirlVertexEffect=function(){return this._vertexEffect},e.getVertexEffect=function(){return this._vertexEffect},e.getEffectType=function(){return this._effectType},t}(),rHt=new cr(0,0,255,255),sHt=new cr(255,0,0,255),aHt=new cr(0,255,0,255),oHt=new cr(255,255,0,255),hHt=null,uHt=null,lHt=!1,cHt=!1,fHt=IF(TF),dHt=IF(AF),_Ht=new ir(0,0,0);function pHt(t,e){var i,n;switch(t){case 1:i=lHt?1:2,n=1;break;case 2:i=7,n=4;break;case 3:i=lHt?1:2,n=8;break;default:i=lHt?1:2,n=4}return e.getMaterialForBlendAndTint(i,n,cHt?1:0)}var mHt=function(){function t(){this.vCount=32767}var e=t.prototype;return e.ensureAccessor=function(t){var e=t?uHt:hHt;if(!e){var i=GE.root.device,n=GE.root.batcher2D,r=t?AF:TF;t?(e=uHt=new kF(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINETINT",36),uHt)):(e=hHt=new kF(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINE",36),hHt))}return e},e.createData=function(t){var e=t.renderData;if(!e){var i=t.useTint||t.isAnimationCached(),n=this.ensureAccessor(i);e=YF.add(i?AF:TF,n)}return e},e.updateRenderData=function(t){var e;t._skeleton&&t.node.active&&null!=(e=t.skeletonData)&&e.isValid&&vHt(t)},t}(),gHt=new mHt;function vHt(t){if(t.drawList.reset(),0!==t.color.a){t._updateColor(),lHt=t.premultipliedAlpha,cHt=t.useTint||t.isAnimationCached(),t.isAnimationCached()?bHt(t):yHt(t);var e=t.renderData,i=cHt?uHt:hHt;t.syncAttachedNode(),(e.vertexCount>0||e.indexCount>0)&&i.getMeshBuffer(e.chunk.bufferId).setDirty()}}function yHt(t){var e,i,n=(t.useTint?dHt:fHt)/4,r=t.updateRenderData(),s=r.vCount,a=r.iCount;if(!(s<1||a<1)){var o=t.renderData;o.vertexCount===s&&o.indexCount===a||(o.resize(s,a),o.indices=new Uint16Array(a),t._vLength=4*s*n,t._vBuffer=new Uint8Array(o.chunk.vb.buffer,o.chunk.vb.byteOffset,4*o.chunk.vb.length),t._iLength=2*a,t._iBuffer=new Uint8Array(o.indices.buffer));var h=o.chunk.vb,u=r.vPtr,l=r.iPtr,c=o.indices,f=_Ut.wasmUtil.wasm.HEAPU8;null==(e=t._vBuffer)||e.set(f.subarray(u,u+t._vLength),0),null==(i=t._iBuffer)||i.set(f.subarray(l,l+t._iLength),0);for(var d=o.chunk.vertexOffset,_=0;_Ji||4294967295!==cr.toUint32(o)||lHt){$Gt=o.r/255,tHt=o.g/255,eHt=o.b/255,iHt=h;for(var u=0;u>t,n=0;if(t<3&&(i-=2,n=e*uWt+e),0!==i&&0!==i){var r=i*i*6;this._bodyIndexPool[t].indices=new Uint16Array(r);for(var s=0,a=new Uint16Array(r),o=n,h=o+uWt*e,u=0;u>e,o=0,h=new Uint16Array(2*a+2);h[o++]=0,h[o++]=0;for(var u=1;u>e,o=0,h=new Uint16Array(2*a+2);h[o++]=1056,h[o++]=1056;for(var u=1;u>e,o=0,h=new Uint16Array(2*a+2);h[o++]=0,h[o++]=0;for(var u=1;u>e,o=0,h=new Uint16Array(2*a+2);h[o++]=32,h[o++]=32;for(var u=1;u0&&(this._brushPass=n.passes[0],this._currentMaterial.passes.push(this._brushPass),n.passes.pop())}return e&&this._model.initSubModel(0,this._meshData,this._currentMaterial),this.setSharedMaterial(this._currentMaterial,0),this._currentMaterialLayers=i,this._model.enabled=!0,this._model.receiveShadow=t.getTerrain().receiveShadow,!0}return!1},i._updateLightingmap=function(t,e){null!=this._model&&(this._lightmap=t,this._updateReceiveDirLight(),this._model.updateLightingmap(t,e))},i._onMaterialModified=function(t,e){null!=this._model&&this._onRebuildPSO(t,e||this._getBuiltinMaterial())},i._onRebuildPSO=function(t,e){this._model&&this._model.setSubModelMaterial(t,e)},i._clearMaterials=function(){null!=this._model&&this._onMaterialModified(0,null)},i._onUpdateReceiveDirLight=function(t,e){void 0===e&&(e=!1),this._model&&(e?this._model.receiveDirLight=!1:this.node&&(t&this.node.layer)===this.node.layer||t&this._model.visFlags?this._model.receiveDirLight=!0:this._model.receiveDirLight=!1)},i._updateReceiveDirLight=function(){var t=this.node.scene;if(t&&t.renderScene){var e=t.renderScene.mainLight;if(e){var i=e.visibility;e.node&&(e.node.mobility===zv.Static&&this._lightmap?this._onUpdateReceiveDirLight(i,!0):this._onUpdateReceiveDirLight(i))}}},i._getBuiltinMaterial=function(){return _T.get("missing-material")},e}(LU),vWt=t("gc",Qh("cc.TerrainBlockLightmapInfo")((NHt=function(){this.texture=zHt&&zHt(),this.UOff=UHt&&UHt(),this.VOff=GHt&&GHt(),this.UScale=HHt&&HHt(),this.VScale=WHt&&WHt()},zHt=Nh(NHt.prototype,"texture",[hu],(function(){return null})),UHt=Nh(NHt.prototype,"UOff",[hu],(function(){return 0})),GHt=Nh(NHt.prototype,"VOff",[hu],(function(){return 0})),HHt=Nh(NHt.prototype,"UScale",[hu],(function(){return 0})),WHt=Nh(NHt.prototype,"VScale",[hu],(function(){return 0})),VHt=NHt))||VHt),yWt=t("gd",function(){function t(t,e,i){this._terrain=void 0,this._node=void 0,this._renderable=void 0,this._index=[1,1],this._weightMap=null,this._lightmapInfo=null,this._lodLevel=0,this._lodKey=new cWt,this._errorMetrics=[0,0,0,0],this._LevelDistances=[lWt,lWt,lWt,lWt],this._bbMin=nr(),this._bbMax=nr(),this._terrain=t,this._index[0]=e,this._index[1]=i,this._lightmapInfo=t._getLightmapInfo(e,i),this._node=new tb("TerrainBlock"),this._node.setParent(this._terrain.node),this._node.hideFlags|=1032,this._node.layer=this._terrain.node.layer,this._renderable=this._node.addComponent(gWt)}var e=t.prototype;return e.build=function(){var t=GE.root.device,e=new Float32Array(ZRt*KRt*KRt);this._buildVertexData(e);var i=t.createBuffer(new h_(10,1,4*ZRt*KRt*KRt,4*ZRt));i.update(e),this._buildBoundingBox();var n=[new C_("a_position",32),new C_("a_normal",32),new C_("a_texCoord",21)];this._renderable._meshData=new $E([i],n,7,this._terrain._getSharedIndexBuffer(),null,!1),this._renderable._model=A.director.root.createModel(WM),this._renderable._model.createBoundingShape(this._bbMin,this._bbMax),this._renderable._model.node=this._renderable._model.transform=this._node,null!=this._renderable.node.scene&&(this.visible=!0),this._updateWeightMap(),this._updateMaterial(!0),this._terrain.lodEnable&&(this._updateLodBuffer(e),this._updateIndexBuffer())},e.rebuild=function(){this._updateHeight(),this._updateWeightMap(),this._renderable._invalidMaterial(),this._updateMaterial(!1)},e.destroy=function(){this.visible=!1,this._renderable._destroyModel(),null!=this._node&&this._node.isValid&&this._node.destroy(),null!=this._weightMap&&this._weightMap.destroy()},e.update=function(){this._updateMaterial(!1),this.lightmap!==this._renderable._lightmap&&this._renderable._updateLightingmap(this.lightmap,this.lightmapUVParam);var t=this._terrain.useNormalMap,e=this._terrain.usePBR,i=function(t){return null!==t?t.detailMap:null},n=function(t){var e=null!==t?t.normalMap:null;return null===e&&(e=_T.get("normal-texture")),e},r=this._renderable._currentMaterial;if(null!==r){var s=this.getMaxLayer(),a=new Vn(1,1,1,1),o=new Vn(1,1,1,1),h=new Vn(0,0,0,0);if(0===s)if(-1!==this.layers[0]){var u=this._terrain.getLayer(this.layers[0]);null!==u&&(a.x=1/u.tileSize,o.x=u.roughness,h.x=u.metallic),r.setProperty("detailMap0",i(u)),t&&r.setProperty("normalMap0",n(u))}else r.setProperty("detailMap0",_T.get("default-texture")),t&&r.setProperty("normalMap0",_T.get("normal-texture"));else if(1===s){var l=this._terrain.getLayer(this.layers[0]),c=this._terrain.getLayer(this.layers[1]);null!==l&&(a.x=1/l.tileSize,o.x=l.roughness,h.x=l.metallic),null!==c&&(a.y=1/c.tileSize,o.y=c.roughness,h.y=c.metallic),r.setProperty("weightMap",this._weightMap),r.setProperty("detailMap0",i(l)),r.setProperty("detailMap1",i(c)),t&&(r.setProperty("normalMap0",n(l)),r.setProperty("normalMap1",n(c)))}else if(2===s){var f=this._terrain.getLayer(this.layers[0]),d=this._terrain.getLayer(this.layers[1]),_=this._terrain.getLayer(this.layers[2]);null!==f&&(a.x=1/f.tileSize,o.x=f.roughness,h.x=f.metallic),null!==d&&(a.y=1/d.tileSize,o.y=d.roughness,h.y=d.metallic),null!==_&&(a.z=1/_.tileSize,o.z=_.roughness,h.z=_.metallic),r.setProperty("weightMap",this._weightMap),r.setProperty("detailMap0",i(f)),r.setProperty("detailMap1",i(d)),r.setProperty("detailMap2",i(_)),t&&(r.setProperty("normalMap0",n(f)),r.setProperty("normalMap1",n(d)),r.setProperty("normalMap2",n(_)))}else if(3===s){var p=this._terrain.getLayer(this.layers[0]),m=this._terrain.getLayer(this.layers[1]),g=this._terrain.getLayer(this.layers[2]),v=this._terrain.getLayer(this.layers[3]);null!==p&&(a.x=1/p.tileSize,o.x=p.roughness,h.x=p.metallic),null!==m&&(a.y=1/m.tileSize,o.y=m.roughness,h.y=m.metallic),null!==g&&(a.z=1/g.tileSize,o.z=g.roughness,h.z=g.metallic),null!==v&&(a.w=1/v.tileSize,o.w=v.roughness,h.w=v.metallic),r.setProperty("weightMap",this._weightMap),r.setProperty("detailMap0",i(p)),r.setProperty("detailMap1",i(m)),r.setProperty("detailMap2",i(g)),r.setProperty("detailMap3",i(v)),t&&(r.setProperty("normalMap0",n(p)),r.setProperty("normalMap1",n(m)),r.setProperty("normalMap2",n(g)),r.setProperty("normalMap3",n(v)))}r.setProperty("UVScale",a),e&&(r.setProperty("roughness",o),r.setProperty("metallic",h))}},e._buildLodInfo=function(){var t=new Float32Array(ZRt*KRt*KRt);this._buildVertexData(t),this._updateLodBuffer(t),this._updateIndexBuffer()},e._updateLevel=function(t){var e=this._terrain,i=e.node,n=nr(),r=nr();ir.add(n,this._bbMin,i.worldPosition),ir.add(r,this._bbMax,i.worldPosition);var s=ir.distance(n,t),a=ir.distance(r,t),o=Math.min(s,a);for(o-=e.LodBias,this._lodLevel=0;this._lodLevel<3&&!(o<=this._LevelDistances[this._lodLevel+1]);)++this._lodLevel},e.setBrushMaterial=function(t){this._renderable._brushMaterial!==t&&(this._renderable._invalidMaterial(),this._renderable._brushMaterial=t)},e._getBrushMaterial=function(){return this._renderable?this._renderable._brushMaterial:null},e._getBrushPass=function(){return this._renderable?this._renderable._brushPass:null},e.getTerrain=function(){return this._terrain},e.getIndex=function(){return this._index},e.getRect=function(){var t=new ys;return t.x=this._index[0]*JRt,t.y=this._index[1]*JRt,t.width=JRt,t.height=JRt,t},e.setLayer=function(t,e){this.layers[t]!==e&&(this._terrain.setBlockLayer(this._index[0],this._index[1],t,e),this._renderable._invalidMaterial(),this._updateMaterial(!1))},e.getLayer=function(t){return this.layers[t]},e.getMaxLayer=function(){return this.layers[3]>=0?3:this.layers[2]>=0?2:this.layers[1]>=0?1:0},e._getMaterialDefines=function(t){var e=1;return this._terrain.node&&this._terrain.node.scene&&this._terrain.node.scene.globals.bakedWithStationaryMainLight&&(e=2),{LAYERS:t+1,CC_USE_LIGHTMAP:null!==this.lightmap?e:0,USE_NORMALMAP:this._terrain.useNormalMap?1:0,USE_PBR:this._terrain.usePBR?1:0}},e._invalidMaterial=function(){this._renderable._invalidMaterial()},e._updateMaterial=function(t){this._renderable._updateMaterial(this,t)&&(null!==this.lightmap&&this.lightmap.setWrapMode(3,3),this._renderable._updateLightingmap(this.lightmap,this.lightmapUVParam))},e._updateHeight=function(){if(null!=this._renderable._meshData){var t=new Float32Array(ZRt*KRt*KRt);this._buildVertexData(t),this._renderable._meshData.vertexBuffers[0].update(t),this._buildBoundingBox(),this._renderable._model.createBoundingShape(this._bbMin,this._bbMax),this._renderable._model.updateWorldBound(),this._updateLodBuffer(t),this._updateIndexBuffer()}},e._updateWeightMap=function(){if(0!==this.getMaxLayer()){null==this._weightMap&&(this._weightMap=new Pv,this._weightMap.create(this._terrain.weightMapSize,this._terrain.weightMapSize,35),this._weightMap.setFilters(2,2),this._weightMap.setWrapMode(2,2));for(var t=new Uint8Array(this._terrain.weightMapSize*this._terrain.weightMapSize*4),e=0,i=0;i0){var e=this.getTerrain().getBlock(this._index[0]-1,this._index[1]);t.west=e._lodLevel,t.west0){var n=this.getTerrain().getBlock(this._index[0],this._index[1]-1);t.north=n._lodLevel,t.north>t,o=s-1>>t,h=0;hthis.vertexCount[0]-1||s<0||s>this.vertexCount[1]-1)return null;r=$i(r,0,this.vertexCount[0]-1),s=$i(s,0,this.vertexCount[1]-1),a=$i(a,0,this.vertexCount[0]-1),o=$i(o,0,this.vertexCount[1]-1);var l=this.getHeight(r,s),c=this.getHeight(a,s),f=this.getHeight(r,o),d=this.getHeight(a,o),_=.5*(c+f);return h+u<=1?d=_+(_-l):l=_+(_-d),(l*(1-h)+c*h)*(1-u)+(f*(1-h)+d*h)*u},i._setNormal=function(t,e,i){var n=e*this.vertexCount[0]+t;this._normals[3*n+0]=i.x,this._normals[3*n+1]=i.y,this._normals[3*n+2]=i.z},i.getNormal=function(t,e){var i=e*this.vertexCount[0]+t,n=nr();return n.x=this._normals[3*i+0],n.y=this._normals[3*i+1],n.z=this._normals[3*i+2],n},i.getNormalAt=function(t,e){var i=t/this.tileSize,n=e/this.tileSize,r=Math.floor(i),s=Math.floor(n),a=r+1,o=s+1,h=i-r,u=n-s;if(r<0||r>this.vertexCount[0]-1||s<0||s>this.vertexCount[1]-1)return null;r=$i(r,0,this.vertexCount[0]-1),s=$i(s,0,this.vertexCount[1]-1),a=$i(a,0,this.vertexCount[0]-1),o=$i(o,0,this.vertexCount[1]-1);var l=this.getNormal(r,s),c=this.getNormal(a,s),f=this.getNormal(r,o),d=this.getNormal(a,o),_=nr();ir.add(_,c,f).multiplyScalar(.5),h+u<=1?(d.set(_),d.subtract(l),d.add(_)):(l.set(_),l.subtract(d),l.add(_));var p=nr(),m=nr(),g=nr();return ir.lerp(p,l,c,h),ir.lerp(m,f,d,h),ir.lerp(g,p,m,u),g},i.setWeight=function(t,e,i){var n=e*this._weightMapSize*this._blockCount[0]+t;this._weights[4*n+0]=255*i.x,this._weights[4*n+1]=255*i.y,this._weights[4*n+2]=255*i.z,this._weights[4*n+3]=255*i.w},i.getWeight=function(t,e){var i=e*this._weightMapSize*this._blockCount[0]+t,n=new Vn;return n.x=this._weights[4*i+0]/255,n.y=this._weights[4*i+1]/255,n.z=this._weights[4*i+2]/255,n.w=this._weights[4*i+3]/255,n},i.getWeightAt=function(t,e){var i=this.weightMapSize*this.blockCount[0],n=this.weightMapSize*this.blockCount[1];if(0===i||0===n)return null;var r=t/i,s=e/n,a=Math.floor(r),o=Math.floor(s),h=a+1,u=o+1,l=r-a,c=s-o;if(a<0||a>i-1||o<0||o>n-1)return null;a=$i(a,0,i-1),o=$i(o,0,n-1),h=$i(h,0,i-1),u=$i(u,0,n-1);var f=this.getWeight(a,o),d=this.getWeight(h,o),_=this.getWeight(a,u),p=this.getWeight(h,u),m=new Vn;Vn.add(m,d,_).multiplyScalar(.5),l+c<=1?(p=new Vn,Vn.subtract(p,m,f).add(m)):(f=new Vn,Vn.subtract(f,m,p).add(m));var g=new Vn,v=new Vn,y=new Vn;return Vn.lerp(g,f,d,l),Vn.lerp(v,_,p,l),Vn.lerp(y,g,v,c),y},i.getMaxWeightLayerAt=function(t,e){var i=this.weightMapSize*this.blockCount[0],n=this.weightMapSize*this.blockCount[1];if(0===i||0===n)return null;var r=t/i,s=e/n,a=Math.floor(r),o=Math.floor(s);if(a<0||a>i-1||o<0||o>n-1)return null;var h=this.getWeight(a,o),u=Math.floor(t/this.weightMapSize),l=Math.floor(e/this.weightMapSize),c=this.getBlock(u,l),f=0;return h.y>h[f]&&-1!==c.getLayer(1)&&(f=1),h.y>h[f]&&-1!==c.getLayer(2)&&(f=2),h.z>h[f]&&-1!==c.getLayer(3)&&(f=3),f=c.getLayer(f),this.getLayer(f)},i.getBlockLayers=function(t,e){var i=(e*this._blockCount[0]+t)*YRt;return[this._layerBuffer[i],this._layerBuffer[i+1],this._layerBuffer[i+2],this._layerBuffer[i+3]]},i.getBlockLayer=function(t,e,i){var n=(e*this._blockCount[0]+t)*YRt;return this._layerBuffer[n+i]},i.setBlockLayer=function(t,e,i,n){var r=(e*this._blockCount[0]+t)*YRt;this._layerBuffer[r+i]=n},i.getBlock=function(t,e){return this._blocks[e*this._blockCount[0]+t]},i.getBlocks=function(){return this._blocks},i.rayCheck=function(t,e,i,n){void 0===n&&(n=!0);var r=t;n&&ir.subtract(r,t,this.node.worldPosition);var s=nr();s.set(e),s.multiplyScalar(i);var a=null;if(e.equals(nr(0,1,0))){var o=this.getHeightAt(r.x,r.z);null!=o&&r.y<=o&&(a=nr(r.x,o,r.z))}else if(e.equals(nr(0,-1,0))){var h=this.getHeightAt(r.x,r.z);null!=h&&r.y>=h&&(a=nr(r.x,h,r.z))}else{for(var u=0;u++<2e3;){var l=this.getHeightAt(r.x,r.z);if(null!=l&&r.y<=l)break;r.add(e)}for(;u++<2e3;){var c=this.getHeightAt(r.x,r.z);if(null!=c&&r.y<=c){a=nr(r.x,c,r.z);break}r.add(s)}}return a},i._createSharedIndexBuffer=function(){var t=Hp.gfxDevice;if(null!==this._lod){var e=t.createBuffer(new h_(6,1,2*this._lod._indexBuffer.length,2));return e.update(this._lod._indexBuffer),e}for(var i=new Uint16Array(JRt*JRt*6),n=0,r=0;r0}},{key:"info",get:function(){var t=new pWt;return t.tileSize=this.tileSize,t.blockCount[0]=this.blockCount[0],t.blockCount[1]=this.blockCount[1],t.weightMapSize=this.weightMapSize,t.lightMapSize=this.lightMapSize,t}}]),e}(gg),eWt=Nh(tWt.prototype,"__asset",[qHt,hu],(function(){return null})),iWt=Nh(tWt.prototype,"_effectAsset",[XHt,hu],(function(){return null})),nWt=Nh(tWt.prototype,"_lightmapInfos",[YHt,hu],(function(){return[]})),rWt=Nh(tWt.prototype,"_receiveShadow",[hu],(function(){return!1})),sWt=Nh(tWt.prototype,"_useNormalmap",[hu],(function(){return!1})),aWt=Nh(tWt.prototype,"_usePBR",[hu],(function(){return!1})),oWt=Nh(tWt.prototype,"_lodEnable",[hu],(function(){return!1})),hWt=Nh(tWt.prototype,"_lodBias",[QHt,hu],(function(){return 0})),y(tWt.prototype,"_asset",[JHt],Object.getOwnPropertyDescriptor(tWt.prototype,"_asset"),tWt.prototype),y(tWt.prototype,"effectAsset",[KHt],Object.getOwnPropertyDescriptor(tWt.prototype,"effectAsset"),tWt.prototype),y(tWt.prototype,"info",[ZHt],Object.getOwnPropertyDescriptor(tWt.prototype,"info"),tWt.prototype),$Ht=tWt))||$Ht)||$Ht)),{ORTHO:0,HEX:1,ISO:2});Oe(bWt);var SWt={NONE:0,MAP:1,LAYER:2,OBJECTGROUP:3,OBJECT:4,TILE:5};Oe(SWt);var xWt={HORIZONTAL:2147483648,VERTICAL:1073741824,DIAGONAL:536870912,FLIPPED_ALL:4026531840,FLIPPED_MASK:268435455};Oe(xWt);var wWt={STAGGERAXIS_X:0,STAGGERAXIS_Y:1};Oe(wWt);var TWt={STAGGERINDEX_ODD:0,STAGGERINDEX_EVEN:1};Oe(TWt);var CWt={RightDown:0,RightUp:1,LeftDown:2,LeftUp:3};Oe(CWt);var AWt={RECT:0,ELLIPSE:1,POLYGON:2,POLYLINE:3,IMAGE:4,TEXT:5};Oe(AWt);var DWt=function(){function t(){this.name="",this.firstGid=0,this.spacing=0,this.margin=0,this.sourceImage=void 0,this.imageName=null,this.imageOffset=null,this.imageSize=new ps(0,0),this.tileOffset=new ds(0,0),this._tileSize=new ps(0,0),this.collection=!1}return t.prototype.rectForGID=function(t,e){var i=e||new ys(0,0,0,0);i.width=this._tileSize.width,i.height=this._tileSize.height;var n=t;if(n&=268435455,n-=this.firstGid,this.imageOffset)i.x=this.imageOffset.x,i.y=this.imageOffset.y;else{var r=Math.floor((this.imageSize.width-2*this.margin+this.spacing)/(this._tileSize.width+this.spacing));i.x=Math.round(n%r*(this._tileSize.width+this.spacing)+this.margin),i.y=Math.round(Math.floor(n/r)*(this._tileSize.height+this.spacing)+this.margin)}return i},t}(),IWt=function(){function t(){this.properties={},this.name="",this.objects=[],this.visible=!0,this.opacity=0,this.color=new cr(255,255,255,255),this.offset=new ds(0,0),this.draworder="topdown",this.tintColor=null}var e=t.prototype;return e.getProperties=function(){return this.properties},e.setProperties=function(t){this.properties=t},t}(),BWt=function(){function t(){this.properties={},this.name="",this.layerSize=null,this.tiles=[],this.visible=!0,this.opacity=0,this.ownTiles=!0,this.minGID=1e5,this.maxGID=0,this.offset=new ds(0,0),this.tintColor=null}var e=t.prototype;return e.getProperties=function(){return this.properties},e.setProperties=function(t){this.properties=t},t}();BWt.ATTRIB_NONE=1,BWt.ATTRIB_BASE64=2,BWt.ATTRIB_GZIP=4,BWt.ATTRIB_ZLIB=8;var MWt=function(){this.name="",this.visible=!0,this.width=0,this.height=0,this.offset=new ds(0,0),this.opacity=0,this.trans=new cr(255,255,255,255),this.sourceImage=void 0,this.tintColor=null};function PWt(t){if(t.length%4!=0)return null;for(var e=t.length/4,i=window.Uint32Array?new Uint32Array(e):[],n=0;n1,x=b[0],w=x.getAttribute("source");w=w.replace(/\\/g,"/");var T=m.getElementsByTagName("tile"),C=T&&T.length||1,A=null,D=m.getAttribute("name")||"",I=parseInt(m.getAttribute("spacing"))||0,B=parseInt(m.getAttribute("margin"))||0,M=i||parseInt(m.getAttribute("firstgid"))||0,P=new ps(0,0);P.width=parseFloat(m.getAttribute("tilewidth")),P.height=parseFloat(m.getAttribute("tileheight"));var E=m.getElementsByTagName("tileoffset")[0],k=0,R=0;E&&(k=parseFloat(E.getAttribute("x"))||0,R=parseFloat(E.getAttribute("y"))||0);for(var O=null,F=0;F0){var H=U[0],W=H.getAttribute("source");if(W=W.replace(/\\/g,"/"),O.imageName=W,O.imageSize.width=parseFloat(H.getAttribute("width"))||0,O.imageSize.height=parseFloat(H.getAttribute("height"))||0,G||(O._tileSize.width=O.imageSize.width,O._tileSize.height=O.imageSize.height),O.sourceImage=this._spriteFrameMap[W],!O.sourceImage){var j=t.getNameWithPostfix(W);if(O.imageName=j,O.sourceImage=this._spriteFrameMap[j],!O.sourceImage){var q=t.getShortName(W);O.imageName=q,O.sourceImage=this._spriteFrameMap[q],O.sourceImage||(ht(7221,W),Y("Please try asset type of "+W+" to 'sprite-frame'"))}}O.firstGid=268435455&this.parentGID}var X=(268435455&this.parentGID)>>>0;this._tileProperties.set(X,OWt(A));var J=A.getElementsByTagName("animation");if(J&&J.length>0){var K=J[0].getElementsByTagName("frame"),Z={frames:[],dt:0,frameIdx:0};this._tileAnimations.set(X,Z);for(var $=Z.frames,tt=0;tt0){var d=f[0];l.type=5,l.wrap="1"===d.getAttribute("wrap"),l.color=RWt(d.getAttribute("color")),l.halign=EWt(d.getAttribute("halign")),l.valign=kWt(d.getAttribute("valign")),l.pixelsize=parseInt(d.getAttribute("pixelsize"))||16,l.text=d.childNodes[0].nodeValue}var _=u.getAttribute("gid");_&&(l.gid=parseInt(_),l.type=4);var p=u.getElementsByTagName("ellipse");p&&p.length>0&&(l.type=1);var m=u.getElementsByTagName("polygon");if(m&&m.length>0){l.type=2;var g=m[0].getAttribute("points");g&&(l.points=this._parsePointsString(g))}var v=u.getElementsByTagName("polyline");if(v&&v.length>0){l.type=3;var y=v[0].getAttribute("points");y&&(l.polylinePoints=this._parsePointsString(y))}l.type||(l.type=0),e.objects.push(l)}"index"!==a&&e.objects.sort((function(t,e){return t.y-e.y}))}return e},e._parsePointsString=function(t){if(!t)return null;for(var e=[],i=t.split(" "),n=0;n1||t.imageOffset)if(i){y._name=i.name;var w=i.unbiasUV[0],T=i.rotated?i.unbiasUV[1]:i.unbiasUV[5];KWt?(y.l=w+(y.x+.5)/c,y.t=T+(y.y+.5)/f,y.r=w+(y.x+y.width-.5)/c,y.b=T+(y.y+y.height-.5)/f):(y.l=w+y.x/c,y.t=T+y.y/f,y.r=w+(y.x+y.width)/c,y.b=T+(y.y+y.height)/f),y._rect=new ys(y.x,y.y,y.width,y.height)}else y.l=y.x/c,y.t=y.y/f,y.r=(y.x+y.width)/c,y.b=(y.y+y.height)/f,y._rect=new ys(y.x,y.y,y.width,y.height);else i.rotated?(y._rotated=!0,y._name=i.name,y._rect=i.getRect(),y.l=i.unbiasUV[0],y.t=i.unbiasUV[1],y.r=i.unbiasUV[4],y.b=i.unbiasUV[3]):(y._name=i.name,y._rect=i.getRect(),y.l=i.unbiasUV[0],y.t=i.unbiasUV[5],y.r=i.unbiasUV[2],y.b=i.unbiasUV[1]);y.cx=(y.l+y.r)/2,y.cy=(y.t+y.b)/2,e.set(x,y)}}var tjt=new Qr,ejt=new ds,ijt=new ir,njt=new ir,rjt={row:0,col:0};function sjt(t){return"subNodes"in t}for(var ajt,ojt,hjt,ujt,ljt,cjt,fjt,djt,_jt,pjt,mjt,gjt,vjt,yjt,bjt,Sjt,xjt,wjt,Tjt,Cjt,Ajt,Djt,Ijt,Bjt,Mjt,Pjt,Ejt,kjt,Rjt,Ojt,Fjt,Ljt,Vjt=t("gI",Qh("cc.TiledUserNodeData")(XWt=function(t){function e(){var e;return(e=t.call(this)||this)._index=-1,e._row=-1,e._col=-1,e._tiledLayer=null,e}return s(e,t),e}(gg))||XWt),Njt=t("gJ",Qh("cc.TiledLayer")(YWt=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this)._userNodeGrid={},e._userNodeMap={},e._userNodeDirty=!1,e.tiledTiles=[],e._viewPort={x:-1,y:-1,width:-1,height:-1},e._cullingRect={leftDown:{row:-1,col:-1},rightTop:{row:-1,col:-1}},e._cullingDirty=!0,e._rightTop={row:-1,col:-1},e._layerInfo=null,e._mapInfo=null,e._topOffset=0,e._downOffset=0,e._leftOffset=0,e._rightOffset=0,e.tiles=[],e.vertices=[],e._verticesDirty=!0,e._layerName="",e._layerSize=void 0,e._minGID=void 0,e._maxGID=void 0,e._layerOrientation=null,e._opacity=void 0,e._tintColor=void 0,e.texGrids=null,e._textures=[],e._tilesets=[],e._leftDownToCenterX=0,e._leftDownToCenterY=0,e._hasTiledNodeGrid=!1,e._hasAniGrid=!1,e._animations=null,e._enableCulling=void 0,e.colorChanged=!1,e._properties=void 0,e.renderOrder=void 0,e._staggerAxis=void 0,e._staggerIndex=void 0,e._hexSideLength=void 0,e._mapTileSize=void 0,e._odd_even=void 0,e._diffX1=void 0,e._diffY1=void 0,e._useAutomaticVertexZ=void 0,e._vertexZvalue=void 0,e._offset=void 0,e._tiledDataArray=[],e._cameraNode=void 0,e._drawInfoList=[],e._tiledDataArrayIdx=0,e}return e.requestDrawInfo=function(t){return this._drawInfoList[t]||(this._drawInfoList[t]=new jF,this._drawInfoList[t].setDrawInfoType(2)),this._drawInfoList[t]},e.hasTiledNode=function(){return this._hasTiledNodeGrid},e.hasAnimation=function(){return this._hasAniGrid},e.addUserNode=function(t){var e=t.getComponent(Vjt);return e?(at(7242),!1):(e=t.addComponent(Vjt),t.parent=this.node,this._userNodeMap[t.uuid]=e,e._row=-1,e._col=-1,e._tiledLayer=this,this._nodeLocalPosToLayerPos(t.getPosition(),ejt),this._positionToRowCol(ejt.x,ejt.y,rjt),this._addUserNodeToGrid(e,rjt),this._updateCullingOffsetByUserNode(t),t.on("transform-changed",this._userNodePosChange,e),t.on("size-changed",this._userNodeSizeChange,e),!0)},e.removeUserNode=function(t){var e=t.getComponent(Vjt);return e?(t.off("transform-changed",this._userNodePosChange,e),t.off("size-changed",this._userNodeSizeChange,e),this._removeUserNodeFromGrid(e),delete this._userNodeMap[t.uuid],t._removeComponent(e),e.destroy(),t.removeFromParent(),!0):(at(7243),!1)},e.destroyUserNode=function(t){this.removeUserNode(t),t.destroy()},e._nodeLocalPosToLayerPos=function(t,e){e.x=t.x+this._leftDownToCenterX,e.y=t.y+this._leftDownToCenterY},e.getNodesByRowCol=function(t,e){var i=this._userNodeGrid[t];return i?i[e]:null},e.getNodesCountByRow=function(t){var e=this._userNodeGrid[t];return e?e.count:0},e._updateAllUserNode=function(){for(var t in this._userNodeGrid={},this._userNodeMap){var e=this._userNodeMap[t];this._nodeLocalPosToLayerPos(e.node.getPosition(),ejt),this._positionToRowCol(ejt.x,ejt.y,rjt),this._addUserNodeToGrid(e,rjt),this._updateCullingOffsetByUserNode(e.node)}},e._updateCullingOffsetByUserNode=function(t){var e=t._getUITransformComp().contentSize;this._topOffsetthis._rightTop.row&&(t.row=this._rightTop.row),i<0&&(t.col=0),i>this._rightTop.col&&(t.col=this._rightTop.col)},e._addUserNodeToGrid=function(t,e){var i=e.row,n=e.col,r=this._userNodeGrid[i]=this._userNodeGrid[i]||{count:0},s=r[n]=r[n]||{count:0,list:[]};t._row=i,t._col=n,t._index=s.list.length,r.count++,s.count++,s.list.push(t),this._userNodeDirty=!0,this._markForUpdateRenderData()},e.isUserNodeDirty=function(){return this._userNodeDirty},e.setUserNodeDirty=function(t){this._userNodeDirty=t},e._reinstallCamera=function(){var t=GE.root.batcher2D.getFirstRenderCamera(this.node),e=null==t?void 0:t.node;return this._cameraNode!==e&&(this._uninstallCamera(),e&&(e.on("transform-changed",this.updateCulling,this),e.on("size-changed",this.updateCulling,this),this._cameraNode=e)),t},e._uninstallCamera=function(){this._cameraNode&&(this._cameraNode.off("transform-changed",this.updateCulling,this),this._cameraNode.off("size-changed",this.updateCulling,this),delete this._cameraNode)},e.onEnable=function(){t.prototype.onEnable.call(this),this.node.on("anchor-changed",this._syncAnchorPoint,this),this.node.on("transform-changed",this.updateCulling,this),this.node.on("size-changed",this.updateCulling,this),this.node.parent.on("transform-changed",this.updateCulling,this),this.node.parent.on("size-changed",this.updateCulling,this),this._markForUpdateRenderData(),this.scheduleOnce(this.updateCulling.bind(this))},e.onDisable=function(){var e,i;t.prototype.onDisable.call(this),null==(e=this.node.parent)||e.off("size-changed",this.updateCulling,this),null==(i=this.node.parent)||i.off("transform-changed",this.updateCulling,this),this.node.off("size-changed",this.updateCulling,this),this.node.off("transform-changed",this.updateCulling,this),this.node.off("anchor-changed",this._syncAnchorPoint,this),this._uninstallCamera()},e._syncAnchorPoint=function(){var t=this.node,e=t._getUITransformComp(),i=t.getScale();this._leftDownToCenterX=e.width*e.anchorX*i.x,this._leftDownToCenterY=e.height*e.anchorY*i.y,this._cullingDirty=!0,this._markForUpdateRenderData()},e.getLayerName=function(){return this._layerName},e.setLayerName=function(t){this._layerName=t},e.getProperty=function(t){return this._properties[t]},e.getPositionAt=function(t,e){var i;switch(void 0!==e?(i=Math.floor(t),e=Math.floor(e)):(i=Math.floor(t.x),e=Math.floor(t.y)),this._layerOrientation){case 0:return this._positionForOrthoAt(i,e);case 2:return this._positionForIsoAt(i,e);case 1:return this._positionForHexAt(i,e)}return null},e.isInvalidPosition=function(t,e){return t>=this._layerSize.width||e>=this._layerSize.height||t<0||e<0},e._positionForIsoAt=function(t,e){var i=0,n=0,r=Math.floor(t)+Math.floor(e)*this._layerSize.width,s=this.tiles[r];if(s){var a=(268435455&s)>>>0,o=this.texGrids.get(a).tileset.tileOffset;i=o.x,n=o.y}return new ds(.5*this._mapTileSize.width*(this._layerSize.height+t-e-1)+i,.5*this._mapTileSize.height*(this._layerSize.width-t+this._layerSize.height-e-2)-n)},e._positionForOrthoAt=function(t,e){var i=0,n=0,r=Math.floor(t)+Math.floor(e)*this._layerSize.width,s=this.tiles[r];if(s){var a=(268435455&s)>>>0,o=this.texGrids.get(a).tileset.tileOffset;i=o.x,n=o.y}return new ds(t*this._mapTileSize.width+i,(this._layerSize.height-e-1)*this._mapTileSize.height-n)},e._positionForHexAt=function(t,e){var i,n=this._mapTileSize.width,r=this._mapTileSize.height,s=this._layerSize.height,a=Math.floor(t)+Math.floor(e)*this._layerSize.width,o=(268435455&this.tiles[a])>>>0;i=this.texGrids.get(o)?this.texGrids.get(o).tileset.tileOffset:{x:0,y:0};var h=0===this._staggerIndex?1:-1,u=0,l=0,c=0,f=0;switch(this._staggerAxis){case 1:c=0,e%2==1&&(c=n/2*h),u=t*n+c+i.x,l=(s-e-1)*(r-(r-this._hexSideLength)/2)-i.y;break;case 0:f=0,t%2==1&&(f=r/2*-h),u=t*(n-(n-this._hexSideLength)/2)+i.x,l=(s-e-1)*r+f-i.y}return new ds(u,l)},e.setTilesGIDAt=function(t,e,i,n){if(t&&0!==t.length&&!(n<=0)){i<0&&(i=0),e<0&&(e=0);for(var r=0,s=e+n,a=i;;a++)for(var o=e;o=t.length)return;this._updateTileForGID(t[r],o,a),r++}}},e.setTileGIDAt=function(t,e,i,n){var r=(268435455&t)>>>0;if(e=Math.floor(e),i=Math.floor(i),this.isInvalidPosition(e,i))throw new Error("cc.TiledLayer.setTileGIDAt(): invalid position");this.tiles&&this._tilesets&&0!==this._tilesets.length?0!==r&&r>>0,e,i)):it(7238)},e._updateTileForGID=function(t,e,i){var n=0|e+i*this._layerSize.width;if(!(n>=this.tiles.length)&&t!==this.tiles[n]){var r=(268435455&t)>>>0;this.texGrids.get(r)?(this.tiles[n]=t,this._updateVertex(e,i)):this.tiles[n]=0,this._cullingDirty=!0}},e.getTileGIDAt=function(t,e){if(this.isInvalidPosition(t,e))throw new Error("cc.TiledLayer.getTileGIDAt(): invalid position");if(!this.tiles)return it(7237),null;var i=Math.floor(t)+Math.floor(e)*this._layerSize.width;return(268435455&this.tiles[i])>>>0},e.getTileFlagsAt=function(t,e){if(this.isInvalidPosition(t,e))throw new Error("TiledLayer.getTileFlagsAt: invalid position");if(!this.tiles)return it(7240),null;var i=Math.floor(t)+Math.floor(e)*this._layerSize.width;return(4026531840&this.tiles[i])>>>0},e.setCullingDirty=function(t){this._cullingDirty=t},e.isCullingDirty=function(){return this._cullingDirty},e.updateViewPort=function(t,e,i,n){if(this._viewPort.width!==i||this._viewPort.height!==n||this._viewPort.x!==t||this._viewPort.y!==e){this._viewPort.x=t,this._viewPort.y=e,this._viewPort.width=i,this._viewPort.height=n;var r=1;2===this._layerOrientation&&(r=2);var s=this._viewPort.x-this._offset.x+this._leftDownToCenterX,a=this._viewPort.y-this._offset.y+this._leftDownToCenterY,o=s-this._leftOffset,h=a-this._downOffset,u=s+i+this._rightOffset,l=a+n+this._topOffset,c=this._cullingRect.leftDown,f=this._cullingRect.rightTop;o<0&&(o=0),h<0&&(h=0),this._positionToRowCol(o,h,rjt),rjt.row-=r,rjt.col-=r,rjt.row=rjt.row>0?rjt.row:0,rjt.col=rjt.col>0?rjt.col:0,rjt.row===c.row&&rjt.col===c.col||(c.row=rjt.row,c.col=rjt.col,this._cullingDirty=!0),u<0||l<0?(rjt.row=-1,rjt.col=-1):(this._positionToRowCol(u,l,rjt),rjt.row++,rjt.col++),rjt.row===f.row&&rjt.col===f.col||(f.row=rjt.row,f.col=rjt.col,this._cullingDirty=!0),this._cullingDirty&&this._markForUpdateRenderData()}},e._positionToRowCol=function(t,e,i){var n=this._mapTileSize.width,r=this._mapTileSize.height,s=.5*n,a=.5*r,o=0,h=0,u=0,l=0,c=this._staggerAxis;switch(this._layerOrientation){case 0:h=Math.floor(t/n),o=Math.floor(e/r);break;case 2:h=Math.floor(t/s),o=Math.floor(e/a);break;case 1:1===c?(u=(o=Math.floor(e/(r-this._diffY1)))%2==1?s*this._odd_even:0,h=Math.floor((t-u)/n)):(l=(h=Math.floor(t/(n-this._diffX1)))%2==1?a*-this._odd_even:0,o=Math.floor((e-l)/r))}return i.row=o,i.col=h,i},e.updateCulling=function(){if(this._enableCulling){this.node.updateWorldTransform(),Qr.invert(tjt,this.node.getWorldMatrix());var t=this._reinstallCamera();t&&(ijt.x=0,ijt.y=0,ijt.z=0,njt.x=t.width,njt.y=t.height,njt.z=0,t.screenToWorld(ijt,ijt),t.screenToWorld(njt,njt),ir.transformMat4(ijt,ijt,tjt),ir.transformMat4(njt,njt,tjt),this.updateViewPort(ijt.x,ijt.y,njt.x-ijt.x,njt.y-ijt.y))}},e.getLayerOrientation=function(){return this._layerOrientation},e.getProperties=function(){return this._properties},e._updateVertex=function(t,e){var i=this.vertices,n=this._layerOrientation,r=this.tiles;if(r){var s,a,o,h,u=this._rightTop,l=this._mapTileSize.width,c=this._mapTileSize.height,f=.5*l,d=.5*c,_=this._layerSize.height,p=this._layerSize.width,m=this.texGrids,g=0,v=0;1===n&&(s=this._staggerAxis,a=this._diffX1,o=this._diffY1,h=this._odd_even);var y,b,S,x=0,w=0,T=0,C=0,A=e*p+t;y=(268435455&r[A])>>>0;var D=m.get(y);if(D){switch(this._animations.get(y)&&(this._hasAniGrid=this._hasAniGrid||!0),n){case 0:g=(x=t)*l,v=(w=_-e-1)*c;break;case 2:g=f*(x=_+t-e-1),v=d*(w=_+p-t-e-2);break;case 1:g=t*(l-a)+(1===s&&e%2==1?f*h:0),v=(_-e-1)*(c-o)+(0===s&&t%2==1?d*-h:0),x=t,w=_-e-1}var I=i[w]=i[w]||{minCol:0,maxCol:0},B=I[x]=I[x]||{left:0,bottom:0,index:0};I.minCol>x&&(I.minCol=x),I.maxCol=0&&this._textures.length>t?this._textures[t]:null},e.getTextures=function(){return this._textures},e.setTexture=function(t){this.setTextures([t])},e.setTextures=function(t){this._textures=t,this._markForUpdateRenderData()},e.getLayerSize=function(){return this._layerSize},e.getMapTileSize=function(){return this._mapTileSize},e.getTileSet=function(t){return t=t||0,this._tilesets&&t>=0&&this._tilesets.length>t?this._tilesets[t]:null},e.getTileSets=function(){return this._tilesets},e.setTileSet=function(t){this.setTileSets([t])},e.setTileSets=function(t){this._tilesets=t;var e=this._textures=[],i=this.texGrids;i.clear();for(var n=0;n0&&t[t.length-1].subNodes&&0===t[t.length-1].subNodes.length;)t.pop();if(t.length>0){var e=t[t.length-1];if(e.renderData&&0===e.renderData.vertexCount)return e}var i={renderData:null,texture:null};return this._tiledDataArray.push(i),i},e.requestSubNodesData=function(){var t=this._tiledDataArray;if(t.length>0){var e=t[t.length-1];if(sjt(e)&&0===e.subNodes.length)return e}var i={subNodes:[]};return this._tiledDataArray.push(i),i},e.destroyRenderData=function(){this._tiledDataArray.forEach((function(t){var e=t.renderData;e&&YF.remove(e)})),this._tiledDataArray.length=0,t.prototype.destroyRenderData.call(this)},e._flushAssembler=function(){var t=i.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t,this._assembler.createData(this)),0===this._tiledDataArray.length&&(this._markForUpdateRenderData(),this._updateColor())},e._render=function(t){for(var e=0;e>>0,B=i.get(I);if(!B)continue;var M=B.tileset,P="img"+g.id;_[P]=!0;var E=this.node.getChildByName(P);g.width=g.width||B.width,g.height=g.height||B.height,E&&1024&E._objFlags&&(E.removeFromParent(),E.hideFlags|=8,E.destroy(),E=null),E||(E=new tb),this._animations.get(I)&&(this.aniObjects.push({object:g,imgNode:E,gridGID:I}),this._hasAniObj=!0);var k=M.tileOffset.x,R=M.tileOffset.y;E.active=g.visible,E.setRotationFromEuler(0,0,-g.rotation),E.setPosition(g.x-c,g.y-f),E.name=P,E.parent=this.node,E.setSiblingIndex(p),E.layer=this.node.layer;var O=E.getComponent(FV);O||(O=E.addComponent(FV));var F=E._getUITransformComp();h?(F.anchorX=.5+k/g.width,F.anchorY=R/g.height):(F.anchorX=k/g.width,F.anchorY=R/g.height),this._tintColor?(o.set(this._tintColor),o.a*=this._opacity/255,O.color.set(o)):O.color.a*=this._opacity/255,O.sizeMode=0;var L=this._premultiplyAlpha?1:2;O.srcBlendFactor!==L&&(O.srcBlendFactor=L,O.material&&O._updateBlendFunc());var V=B.spriteFrame;V=V?V.clone():new KR,(2147483648&D)>>>0&&(V.flipUVX=!V.flipUVX),(1073741824&D)>>>0&&(V.flipUVY=!V.flipUVY),V.rotated=B._rotated,V.rect=B._rect,O.spriteFrame=V,F.setContentSize(g.width,g.height),O._markForUpdateRenderData()}}this._objects=d;for(var N=this.node.children,z=/^(?:img|text)\d+$/,U=0,G=N.length;U0&&(m[_[g]]=p[g].text);var v=new QWt(i.tmxXmlStr,m,a,o,c),y=v.getTilesets();y&&0!==y.length||it(7241),this._buildWithMapInfo(v)}else this._releaseMapInfo()},i._releaseMapInfo=function(){for(var t=this._layers,e=0,i=t.length;e0)for(var x=0,w=v.length;x=o.length&&(a.frameIdx=0),h=o[a.frameIdx]),n.set(s,h.grid)}for(var u=this.getLayers(),l=0,c=u.length;l>>0&&(i=Zjt,Zjt=$jt,$jt=i),(2147483648&e)>>>0&&(i=Kjt,Kjt=$jt,$jt=i,i=Zjt,Zjt=tqt,tqt=i),(1073741824&e)>>>0&&(i=Kjt,Kjt=Zjt,Zjt=i,i=$jt,$jt=tqt,tqt=i)}function lqt(){if(!(rqt<1)&&sqt){var t=4*rqt,e=6*rqt,i=qjt.requestTiledRenderData();i.renderData=YF.add(wF),i.texture=sqt;var n=i.renderData;n.resize(t,e),n.chunk.vb.set(jjt.subarray(0,9*t),0),rqt=0,sqt=null}}function cqt(t,e,i,n,r){if(!(e.row<0||e.col<0)){qjt=r;var s=r.node.worldMatrix;eqt=0;var a,o,h,u,l,c,f,d,_,p=r.tiledTiles,m=r.texGrids,g=r.tiles,v=18,y=27,b=r.vertices,S=0,x=0,w=0,T=0,C=0,A=0,D=!0;Xjt=uqt;var I=new Float32Array(4);I[0]=r.color.r/255,I[1]=r.color.g/255,I[2]=r.color.b/255,I[3]=r.color.a/255,-1===i?(u=e.row,l=t.row):(u=t.row,l=e.row);var B=Math.abs(t.row-e.row)+1,M=Math.abs(e.col-t.col)+1;jjt=new Float32Array(B*M*36),rqt=0;for(var P=jjt;(l-u)*i>=0;u+=i)for(a=b[u],A=r.getNodesCountByRow(u),D=a&&0===A,1===n?(o=D&&t.cola.maxCol?a.maxCol:e.col):(o=D&&e.col>a.maxCol?a.maxCol:e.col,h=D&&t.col=0;o+=n){if(c=a&&a[o],A>0){lqt();var E=r.requestSubNodesData(),k=r.getNodesByRowCol(u,o);k&&k.count>0&&(E.subNodes=k.list)}c&&(S=g[c.index],(d=m.get((268435455&S)>>>0))&&(sqt!==d.texture&&(lqt(),sqt=d.texture),f=d.tileset._tileSize,x=c.left-iqt,w=c.bottom-nqt,T=x+f.width,C=w+f.height,_=p[c.index],eqt=36*rqt,_?_.node.active&&fqt(_.node,I,P,x,T,C,w):(Hjt[0].x=x,Hjt[0].y=C,Hjt[1].x=x,Hjt[1].y=w,Hjt[2].x=T,Hjt[2].y=C,Hjt[3].x=T,Hjt[3].y=w,Hjt[0].transformMat4(s),P[eqt]=Hjt[0].x,P[eqt+1]=Hjt[0].y,P[eqt+2]=Hjt[0].z,Hjt[1].transformMat4(s),P[eqt+9]=Hjt[1].x,P[eqt+9+1]=Hjt[1].y,P[eqt+9+2]=Hjt[1].z,Hjt[2].transformMat4(s),P[eqt+v]=Hjt[2].x,P[eqt+v+1]=Hjt[2].y,P[eqt+v+2]=Hjt[2].z,Hjt[3].transformMat4(s),P[eqt+y]=Hjt[3].x,P[eqt+y+1]=Hjt[3].y,P[eqt+y+2]=Hjt[3].z,P.set(I,eqt+5),P.set(I,eqt+9+5),P.set(I,eqt+v+5),P.set(I,eqt+y+5)),Xjt(d,S),P[eqt+3]=Kjt.x,P[eqt+4]=Kjt.y,P[eqt+9+3]=Zjt.x,P[eqt+9+4]=Zjt.y,P[eqt+v+3]=$jt.x,P[eqt+v+4]=$jt.y,P[eqt+y+3]=tqt.x,P[eqt+y+4]=tqt.y,++rqt>=Gjt&&lqt()))}lqt()}}function fqt(t,e,i,n,r,s,a){t.updateWorldTransform(),Qr.fromRTS(Yjt,t.rotation,t.position,t.scale),ir.set(Qjt,-(n+iqt),-(a+nqt),0),Qr.transform(Yjt,Yjt,Qjt),Qr.multiply(Yjt,t.parent.worldMatrix,Yjt);var o=Yjt,h=o.m12,u=o.m13,l=o.m00,c=o.m01,f=o.m04,d=o.m05;1===l&&0===c&&0===f&&1===d?(i[eqt]=n+h,i[eqt+1]=s+u,i[eqt+9]=n+h,i[eqt+9+1]=a+u,i[eqt+18]=r+h,i[eqt+18+1]=s+u,i[eqt+27]=r+h,i[eqt+27+1]=a+u):(i[eqt]=n*l+s*f+h,i[eqt+1]=n*c+s*d+u,i[eqt+9]=n*l+a*f+h,i[eqt+9+1]=n*c+a*d+u,i[eqt+18]=r*l+s*f+h,i[eqt+18+1]=r*c+s*d+u,i[eqt+27]=r*l+a*f+h,i[eqt+27+1]=r*c+a*d+u),i.set(e,eqt+5),i.set(e,eqt+9+5),i.set(e,eqt+18+5),i.set(e,eqt+27+5)}var dqt=t("gM",{getAssembler:function(){return hqt}});Njt.Assembler=dqt;var _qt=new ir,pqt=new ir;function mqt(t,e){var i=null;return{value:e.length>0?e[e.length-1]:ir.ZERO,progress:function(t,e,n,r){return i.getPoint(r)},clone:function(t){return ir.clone(t)},add:function(t,e){return t.clone().add(e)},sub:function(t,e){return t.clone().subtract(e)},onStart:function(n){var r=n.start,s=n.end,a=n.relative,o=n.reversed;(i=wf.create(t)).addKnot(r);var h=null;a&&o&&(h=pqt,ir.subtract(h,r,e[e.length-1]));for(var u=0,l=e.length;u0&&i.addKnot(ir.copy(_qt,h).add(c)):i.addKnot(ir.copy(_qt,r).add(c)):i.addKnot(c)}a&&o&&i.addKnot(s)},onComplete:function(){i=null},onStop:function(){i=null},legacyProgress:!1}}var gqt=Object.freeze({__proto__:null,bezier:function(){for(var t=arguments.length,e=new Array(t),i=0;i=n&&i.actionIndex--;break}}},e._removeActionByTag=function(t,e,i){for(var n=0,r=e.actions.length;n=0;--n){var r=e.actions[n];if(r&&r.getTag()===t){if(i&&r.getOriginalTarget()!==i)continue;this._removeActionAtIndex(n,e)}}},e.removeActionByTag=function(t,e){var i=this;-1===t&&it(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeActionByTag(t,r,e)}else n.forEach((function(e){i._removeActionByTag(t,e)}))},e.removeAllActionsByTag=function(t,e){var i=this;-1===t&&it(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeAllActionsByTag(t,r,e)}else n.forEach((function(e){i._removeAllActionsByTag(t,e)}))},e.getActionByTag=function(t,e){-1===t&&it(1004);var i=this._hashTargets.get(e);if(i){if(null!=i.actions)for(var n=0;n=t&&e.actionIndex--,0===e.actions.length&&(e.target instanceof tb&&this._unregisterNodeEvent(e.target),this._deleteHashElement(e))},e._deleteHashElement=function(t){var e=!1;if(t&&!t.lock&&this._hashTargets.get(t.target)){this._hashTargets.delete(t.target);for(var i=this._arrayTargets,n=0,r=i.length;n"},e}(xqt),Tqt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.update=function(){var t=this._getWorkerTarget();if(t)for(var e=t.getComponentsInChildren(bL),i=0;i"},e}(xqt);!function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;i.update=function(){var t=this._getWorkerTarget();if(t)for(var e=t.getComponentsInChildren(bL),i=0;i"}}(xqt);var Cqt=function(t){function e(e){var i;return(i=t.call(this)||this)._isNeedCleanUp=!0,void 0!==e&&i.init(e),i}s(e,t);var i=e.prototype;return i.update=function(){var t=this._getWorkerTarget();t&&(t.removeFromParent(),this._isNeedCleanUp&&t.destroy())},i.init=function(t){return this._isNeedCleanUp=t,!0},i.reverse=function(){return new e(this._isNeedCleanUp)},i.clone=function(){var t=new e(this._isNeedCleanUp);return t._id=this._id,t},i.toString=function(){return""},e}(xqt);function Aqt(t){return new Cqt(t)}var Dqt=function(t){function e(e,i,n){var r;return(r=t.call(this)||this)._callbackThis=void 0,r._callback=void 0,r._data=void 0,r.initWithFunction(e,i,n),r}s(e,t);var i=e.prototype;return i.initWithFunction=function(t,e,i){return t&&(this._callback=t),e&&(this._callbackThis=e),void 0!==i&&(this._data=i),!0},i.execute=function(){if(this._callback){var t=this._getWorkerTarget();this._callback.call(this._callbackThis,t,this._data)}},i.update=function(){this.execute()},i.getTargetCallback=function(){return this._callbackThis},i.setTargetCallback=function(t){t!==this._callbackThis&&(this._callbackThis=t)},i.clone=function(){var t=new e;return t._id=this._id,this._callback&&t.initWithFunction(this._callback,this._callbackThis,this._data),t},i.toString=function(){return""},e}(xqt);function Iqt(t,e,i){return new Dqt(t,e,i)}var Bqt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.clone=function(){return new e},i.reverse=function(){return this.clone()},i.update=function(){},i.step=function(){},i.isUnknownDuration=function(){return!1},i.toString=function(){return"DummyAction"},e}(Sqt),Mqt=function(t){function e(e){var i;return(i=t.call(this)||this).MAX_VALUE=2,i._elapsed=0,i._startTime=0,i._firstTick=!1,i._speed=1,void 0===e||Number.isNaN(e)||i.initWithDuration(e),i}s(e,t);var i=e.prototype;return i.setStartTime=function(t){t=t<0?0:t>this._duration?this._duration:t,this._startTime=t},i.getElapsed=function(){return this._elapsed},i.initWithDuration=function(t){return this._duration=0===t?Ue.FLT_EPSILON:t,this._elapsed=0,this._firstTick=!0,!0},i.isDone=function(){return this._elapsed>=this._duration&&!this.isUnknownDuration()},i._cloneDecoration=function(t){t._speed=this._speed},i.step=function(t){if(!this._paused&&0!==this._speed){t*=this._speed,this._firstTick?this._elapsed=this._startTime:this._elapsed+=t;var e=this._elapsed/(this._duration>1.192092896e-7?this._duration:1.192092896e-7);e=e<1?e:1,this.update(e>0?e:0),this.isUnknownDuration()&&!this._firstTick&&(e<1?this._elapsed-=t:this._elapsed=this._startTime+this._duration),this._firstTick&&(this._firstTick=!1,this._startTime>0&&(this._startTime=0))}},i.startWithTarget=function(e){t.prototype.startWithTarget.call(this,e),this._elapsed=0,this._firstTick=!0},i.getSpeed=function(){return this._speed},i.setSpeed=function(t){this._speed=t},i.getDurationScaled=function(){return this._duration/this._speed},e}(Sqt);function Pqt(t,e){var i=new Eqt;return i.initWithTwoActions(t,e),i}var Eqt=function(t){function e(e){var i;if((i=t.call(this)||this)._actions=[],i._split=0,i._last=0,i._reversed=!1,!e||0===e.length)return f(i);1===e.length&&e.push(new Bqt);var n=e.length-1;if(n>=0&&null==e[n]&&it(1015),n>=0){for(var r=e[0],s=1;s1?i%1:i),this._last=n)}},i.reverse=function(){var t=Pqt(this._actions[1].reverse(),this._actions[0].reverse());return this._cloneDecoration(t),t._reversed=!0,t},i.updateOwner=function(t){if(!(this._actions.length<2)){var i=this._actions[0],n=this._actions[1];n._owner||(n._owner=t),i instanceof e||i instanceof Nqt?i.updateOwner(t):i._owner||(i._owner=t)}},i.findAction=function(t){for(var i=0,n=this._actions.length;i"},e}(Mqt);function kqt(t){return new Eqt(t)}var Rqt=function(t){function e(e,i){var n;return(n=t.call(this)||this)._times=0,n._total=0,n._nextDt=0,n._actionInstant=!1,n._innerAction=null,n.initWithAction(e,i),n}s(e,t);var i=e.prototype;return i.initWithAction=function(t,e){if(!t||void 0===e)return!1;var i=t.getDurationScaled()*e;return!!this.initWithDuration(i)&&(this._times=e,this._innerAction=t,t instanceof xqt&&(this._actionInstant=!0,this._times-=1),this._total=0,!0)},i.clone=function(){var t=new e;return t._id=this._id,t._speed=this._speed,this._cloneDecoration(t),this._innerAction&&t.initWithAction(this._innerAction.clone(),this._times),t},i.startWithTarget=function(e){this._total=0,this._nextDt=(this._innerAction?this._innerAction.getDurationScaled():0)/this._duration,t.prototype.startWithTarget.call(this,e),this._innerAction&&this._innerAction.startWithTarget(e)},i.stop=function(){this._innerAction&&this._innerAction.stop(),t.prototype.stop.call(this)},i.update=function(t){var e=this._innerAction,i=this._duration,n=this._times,r=this._nextDt;if(e)if(t>=r){for(;t>r&&this._total1?1:r}if(t>=1&&this._total"},e}(Mqt);function Oqt(t,e){return new Rqt(t,e)}var Fqt=function(t){function e(e){var i;return(i=t.call(this)||this)._innerAction=null,e&&i.initWithAction(e),i}s(e,t);var i=e.prototype;return i.initWithAction=function(t){return t?(this._innerAction=t,this._duration=1/0,!0):(ht(1026),!1)},i.clone=function(){var t=new e;return t._id=this._id,t._speed=this._speed,this._cloneDecoration(t),this._innerAction&&t.initWithAction(this._innerAction.clone()),t},i.startWithTarget=function(e){t.prototype.startWithTarget.call(this,e),this._innerAction&&this._innerAction.startWithTarget(e)},i.stop=function(){this._innerAction&&this._innerAction.stop(),t.prototype.stop.call(this)},i.step=function(t){if(!this._paused&&0!==this._speed){var e=this._innerAction;e&&(t*=this._speed,e.step(t),e.isDone()&&(e.startWithTarget(this.target),e.step(e.getElapsed()-e.getDurationScaled())))}},i.update=function(){it(1007)},i.isDone=function(){return!1},i.reverse=function(){if(this._innerAction){var t=new e(this._innerAction.reverse());return this._cloneDecoration(t),t}return this},i.setInnerAction=function(t){this._innerAction!==t&&(this._innerAction=t)},i.getInnerAction=function(){return this._innerAction},i.isUnknownDuration=function(){return!!this._innerAction&&this._innerAction.isUnknownDuration()},i.toString=function(){return""},e}(Mqt);function Lqt(t){return new Fqt(t)}function Vqt(t,e){var i=new Nqt;return i.initWithTwoActions(t,e),i}var Nqt=function(t){function e(e){var i;if((i=t.call(this)||this)._one=null,i._two=null,i._finished=!1,!e||0===e.length)return f(i);1===e.length&&e.push(new Bqt);var n=e.length-1;if(n>=0&&null==e[n]&&it(1015),n>=0){for(var r=e[0],s=1;sr?this._two=Pqt(e,Uqt(n-r)):n"},e}(Mqt),zqt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.update=function(){},i.reverse=function(){var t=new e(this._duration);return this._cloneDecoration(t),t},i.clone=function(){var t=new e;return t._id=this._id,t._speed=this._speed,this._cloneDecoration(t),t.initWithDuration(this._duration),t},i.isUnknownDuration=function(){return!1},i.toString=function(){return""},e}(Mqt);function Uqt(t){return new zqt(t)}var Gqt=function(t){function e(e){var i;return(i=t.call(this)||this)._other=null,e&&i.initWithAction(e),i}s(e,t);var i=e.prototype;return i.initWithAction=function(e){return e?e===this._other?(ht(1029),!1):!!t.prototype.initWithDuration.call(this,e.getDurationScaled())&&(this._other=e,!0):(ht(1028),!1)},i.clone=function(){var t=new e;return t._id=this._id,t._speed=this._speed,this._cloneDecoration(t),this._other&&t.initWithAction(this._other.clone()),t},i.startWithTarget=function(e){t.prototype.startWithTarget.call(this,e),this._other&&this._other.startWithTarget(e)},i.update=function(t){this._other&&this._other.update(1-t)},i.reverse=function(){return this._other?this._other.clone():this},i.stop=function(){this._other&&this._other.stop(),t.prototype.stop.call(this)},i.isUnknownDuration=function(){return!1},i.toString=function(){return""},e}(Mqt);function Hqt(t){return new Gqt(t)}var Wqt=function(t){function e(e,i,n){var r;return(r=t.call(this,e)||this)._cb=i,r._args=n,r}s(e,t);var i=e.prototype;return i.clone=function(){return new e(this._duration,this._cb,this._args)},i.update=function(t){this._cb.apply(this,[this.target,t].concat(this._args))},i.reverse=function(){return this.clone()},i.isUnknownDuration=function(){return!1},i.toString=function(){return""},e}(Mqt),jqt=function(t){function e(e,i){var n;return(n=t.call(this)||this)._finished=!1,n._cb=e,n._args=i,n}s(e,t);var i=e.prototype;return i.clone=function(){return new e(this._cb,this._args)},i.reverse=function(){return this.clone()},i.step=function(){throw new Error("should never go here")},i.update=function(){var t=C.game.deltaTime;this._finished=this._cb.apply(this,[this.target,t].concat(this._args))},i.isDone=function(){return this._finished},i.isUnknownDuration=function(){return!this.isDone()},i.toString=function(){return""},e}(Sqt);function qqt(t){var e=t.charAt(0);if(/[A-Z]/.test(e)){var i=(t=t.replace(e,e.toLowerCase())).split("-");if(2===i.length){var n=i[0];if("linear"===n)t="linear";else{var r=i[1];switch(n){case"quadratic":t="quad"+r;break;case"quartic":t="quart"+r;break;case"quintic":t="quint"+r;break;case"sinusoidal":t="sine"+r;break;case"exponential":t="expo"+r;break;case"circular":t="circ"+r;break;default:t=n+r}}}}return t}function Xqt(t){var e=" [Tween:] ",i=" option is not support in v + "+D,n=t;n.delay&&Y(e+"delay"+i),n.repeat&&Y(e+"repeat"+i),n.repeatDelay&&Y(e+"repeatDelay"+i),n.interpolation&&Y(e+"interpolation"+i),n.onStop&&Y(e+"onStop"+i)}var Yqt=t("gP",function(t){function e(e,i,n){var r;if((r=t.call(this)||this)._reversed=!1,null==n)n=Object.create(null);else if(Xqt(n),n.easing&&"string"==typeof n.easing&&(n.easing=qqt(n.easing)),n.progress||(n.progress=r.progress),n.easing&&"string"==typeof n.easing){var s=n.easing;n.easing=Gl[s],n.easing||at(1031,s)}for(var a in r._opts=n,r._props=Object.create(null),i){var o;if(i.hasOwnProperty(a)){var h=i[a];if("function"==typeof h)h=h();else if(null==h)continue;var u=void 0,l=void 0,c=void 0;void 0!==h.value?("function"==typeof(c=h.value)&&(c=c()),void 0!==h.easing&&("string"==typeof h.easing?(u=Gl[h.easing])||at(1031,h.easing):u=h.easing),void 0!==h.progress&&(l=h.progress)):c=h;var f=Object.create(null);f.start=f.current=f.end=null,f.keys=null,f.value=c,f.easing=u,f.progress=l,f.convert=h.convert,f.clone=h.clone,f.add=h.add,f.sub=h.sub,f.legacyProgress=null===(o=h.legacyProgress)||void 0===o||o,f.toFixed=h.toFixed,f.onStart=h.onStart,f.onStop=h.onStop,f.onComplete=h.onComplete,f.valid=!0,r._props[a]=f}}return r._originProps=i,r.initWithDuration(e),r}s(e,t);var i=e.prototype;return i.clone=function(){var t=new e(this._duration,this._originProps,this._opts);return t._reversed=this._reversed,t._owner=this._owner,t._id=this._id,this._cloneDecoration(t),t},i.reverse=function(){if(!this._opts.relative)return at(16382),new e(0,{});var t=new e(this._duration,this._originProps,this._opts);return this._cloneDecoration(t),t._reversed=!this._reversed,t._owner=this._owner,t},i.startWithTarget=function(e){t.prototype.startWithTarget.call(this,e);var i=this._getWorkerTarget();if(i){var n=!!this._opts.relative,r=this._props,s=this._reversed,a=function(){var t=i[o];if(void 0===t)return 0;var e=r[o],a=e.value;if("number"==typeof t)e.start=t,e.current=t,e.end=n?s?t-a:t+a:a;else if("object"==typeof t)if(e.legacyProgress){if(null==e.start){var h=t.constructor;e.start=new h,e.current=new h,e.end=new h}var u;u=a.getModifiableProperties?a.getModifiableProperties():Object.keys(a),e.keys=u;for(var l=0,c=u.length;l0&&this._actions[this._actions.length-1].setId(t),this})),e.then=function(t){var e=t._union(!0);return e&&(e.setSpeed(t._timeScale),this._actions.push(e)),this},e.reverse=function(e,i){if(null==e&&null==i)return this.reverseTween();var n,r;if(e instanceof t?(n=e,void 0!==i&&(r=i)):"number"==typeof e&&(n=this,r=e),n){var s=t.reverseAction(n,r);s&&this._actions.push(s)}return this},e.reverseTween=function(){if(0===this._actions.length)return at(16388),this.clone(this._target);var t=this._union(!1),e=CXt(this._target);return e._timeScale=this._timeScale,t&&e.insertAction(t.reverse()),e},t.reverseAction=function(t,e){var i=t._actions;if(0===i.length)return null;var n=null,r=null;return"number"==typeof e?n=t.findAction(e,i):t&&(n=t._union(!1)),n?(r=n.reverse())._owner=t:at(16391,""+e),r},e.findAction=function(t,e){for(var i=null,n=0,r=e.length;n1){var s=n.splice(r);1===s.length?n.push(s[0]):n.push(kqt(s))}return this},e.to=function(t,e,i){var n=i||Object.create(null);n.relative=!1;var r=new Yqt(t,e,n);return this._actions.push(r),this},e.by=function(t,e,i){var n=i||Object.create(null);n.relative=!0;var r=new Yqt(t,e,n);return this._actions.push(r),this},e.update=function(t,e){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r1?e-1:0),n=1;n0&&(i=this._time/this._duration),i>=1&&(i=1),1===this._transition){var n=e._uiProps.uiComp;cr.lerp(DXt,this._fromColor,this._toColor,i),n&&(n.color=DXt)}else 3===this.transition&&(e.getScale(this._targetScale),this._targetScale.x=en(this._fromScale.x,this._toScale.x,i),this._targetScale.y=en(this._fromScale.y,this._toScale.y,i),e.setScale(this._targetScale));1===i&&(this._transitionFinished=!0)}},i._resizeNodeToTargetNode=function(){this.target&&this.target._getUITransformComp()},i._resetState=function(){this._pressed=!1,this._hovered=!1;var t=this.target;if(t){var e=this._transition;if(1===e&&this._interactable){var i=t.getComponent(xL);i&&(i.color=this._normalColor)}else 3===e&&this._originalScale&&t.setScale(this._originalScale);this._transitionFinished=!0}},i._registerNodeEvent=function(){var t=this,e=t.node;e.on("touch-start",t._onTouchBegan,t),e.on("touch-move",t._onTouchMove,t),e.on("touch-end",t._onTouchEnded,t),e.on("touch-cancel",t._onTouchCancel,t),e.on("mouse-enter",t._onMouseMoveIn,t),e.on("mouse-leave",t._onMouseMoveOut,t)},i._registerTargetEvent=function(t){t.on("transform-changed",this._onTargetTransformChanged,this)},i._unregisterNodeEvent=function(){var t=this,e=t.node;e.off("touch-start",t._onTouchBegan,t),e.off("touch-move",t._onTouchMove,t),e.off("touch-end",t._onTouchEnded,t),e.off("touch-cancel",t._onTouchCancel,t),e.off("mouse-enter",t._onMouseMoveIn,t),e.off("mouse-leave",t._onMouseMoveOut,t)},i._unregisterTargetEvent=function(t){t.off("transform-changed")},i._getTargetSprite=function(t){var e=null;return t&&(e=t.getComponent(FV)),e},i._applyTarget=function(){this.target&&(this._sprite=this._getTargetSprite(this.target),this._originalScale||(this._originalScale=new ir),ir.copy(this._originalScale,this.target.scale),this._registerTargetEvent(this.target))},i._onTargetSpriteFrameChanged=function(t){2===this._transition&&this._setCurrentStateSpriteFrame(t.spriteFrame)},i._setCurrentStateSpriteFrame=function(t){if(t)switch(this._getButtonState()){case 0:this._normalSprite=t;break;case 1:this._hoverSprite=t;break;case 2:this._pressedSprite=t;break;case 3:this._disabledSprite=t}},i._onTargetColorChanged=function(t){1===this._transition&&this._setCurrentStateColor(t)},i._setCurrentStateColor=function(t){switch(this._getButtonState()){case 0:this._normalColor=t;break;case 1:this._hoverColor=t;break;case 2:this._pressedColor=t;break;case 3:this._disabledColor=t}},i._onTargetTransformChanged=function(t){4&t&&this._originalScale&&3===this._transition&&this._transitionFinished&&ir.copy(this._originalScale,this.target.scale)},i._onTouchBegan=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState(),t&&(t.propagationStopped=!0))},i._onTouchMove=function(t){if(this._interactable&&this.enabledInHierarchy&&this._pressed&&t){var e=t.touch;if(e){var i,n=this.node._getUITransformComp().hitTest(e.getLocation(),t.windowId);3===this._transition&&this.target&&this._originalScale?n?(ir.copy(this._fromScale,this._originalScale),ir.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._transitionFinished=!1):(this._time=0,this._transitionFinished=!0,this.target.setScale(this._originalScale)):(i=n?2:0,this._applyTransition(i)),t&&(t.propagationStopped=!0)}}},i._onTouchEnded=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(pg.emitEvents(this.clickEvents,t),this.node.emit("click",this)),this._pressed=!1,this._updateState(),t&&(t.propagationStopped=!0))},i._onTouchCancel=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed=!1,this._updateState())},i._onMouseMoveIn=function(){!this._pressed&&this.interactable&&this.enabledInHierarchy&&(2!==this._transition||this._hoverSprite)&&(this._hovered||(this._hovered=!0,this._updateState()))},i._onMouseMoveOut=function(){this._hovered&&(this._hovered=!1,this._updateState())},i._updateState=function(){var t=this._getButtonState();this._applyTransition(t)},i._getButtonState=function(){var t=0;return this._interactable?this._pressed?t=2:this._hovered&&(t=1):t=3,t},i._updateColorTransition=function(t){var e,i=this._getColorByState(t),n=null==(e=this.target)?void 0:e.getComponent(xL);n&&(3===t?(n.color=i,this._transitionFinished=!0):(this._fromColor=n.color.clone(),this._toColor=i,this._time=0,this._transitionFinished=!1))},i._updateSpriteTransition=function(t){var e=this._getSpriteFrameByState(t);this._sprite&&e&&(this._sprite.spriteFrame=e)},i._updateScaleTransition=function(t){this._interactable&&(2===t?this._zoomUp():this._zoomBack())},i._zoomUp=function(){this._originalScale&&(ir.copy(this._fromScale,this._originalScale),ir.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._time=0,this._transitionFinished=!1)},i._zoomBack=function(){this.target&&this._originalScale&&(ir.copy(this._fromScale,this.target.scale),ir.copy(this._toScale,this._originalScale),this._time=0,this._transitionFinished=!1)},i._applyTransition=function(t){var e=this._transition;1===e?this._updateColorTransition(t):2===e?this._updateSpriteTransition(t):3===e&&this._updateScaleTransition(t)},i._getSpriteFrameByState=function(t){switch(t){case 0:return this._normalSprite;case 3:return this._disabledSprite;case 1:return this.hoverSprite;case 2:return this._pressedSprite;default:return null}},i._getColorByState=function(t){switch(t){case 0:return this._normalColor;case 3:return this._disabledColor;case 1:return this._hoverColor;case 2:return this._pressedColor;default:return new cr}},i._xrHoverEnter=function(){},i._xrHoverExit=function(){},i._xrClick=function(){},i._xrUnClick=function(){},n(e,[{key:"target",get:function(){return this._target||this.node},set:function(t){this._target!==t&&(this._target&&this._unregisterTargetEvent(this._target),this._target=t,this._applyTarget())}},{key:"interactable",get:function(){return this._interactable},set:function(t){this._interactable!==t&&(this._interactable=t,this._updateState(),this._interactable||this._resetState())}},{key:"_resizeToTarget",set:function(t){t&&this._resizeNodeToTargetNode()}},{key:"transition",get:function(){return this._transition},set:function(t){this._transition!==t&&(1===this._transition?this._updateColorTransition(0):2===this._transition&&this._updateSpriteTransition(0),this._transition=t,this._updateState())}},{key:"normalColor",get:function(){return this._normalColor},set:function(t){this._normalColor!==t&&(this._normalColor.set(t),this._updateState())}},{key:"pressedColor",get:function(){return this._pressedColor},set:function(t){this._pressedColor!==t&&this._pressedColor.set(t)}},{key:"hoverColor",get:function(){return this._hoverColor},set:function(t){this._hoverColor!==t&&this._hoverColor.set(t)}},{key:"disabledColor",get:function(){return this._disabledColor},set:function(t){this._disabledColor!==t&&(this._disabledColor.set(t),this._updateState())}},{key:"duration",get:function(){return this._duration},set:function(t){this._duration!==t&&(this._duration=t)}},{key:"zoomScale",get:function(){return this._zoomScale},set:function(t){this._zoomScale!==t&&(this._zoomScale=t)}},{key:"normalSprite",get:function(){return this._normalSprite},set:function(t){if(this._normalSprite!==t){this._normalSprite=t;var e=this.node.getComponent(FV);e&&(e.spriteFrame=t),this._updateState()}}},{key:"pressedSprite",get:function(){return this._pressedSprite},set:function(t){this._pressedSprite!==t&&(this._pressedSprite=t,this._updateState())}},{key:"hoverSprite",get:function(){return this._hoverSprite},set:function(t){this._hoverSprite!==t&&(this._hoverSprite=t,this._updateState())}},{key:"disabledSprite",get:function(){return this._disabledSprite},set:function(t){this._disabledSprite!==t&&(this._disabledSprite=t,this._updateState())}}]),e}(gg),wXt.Transition=IXt,wXt.EventType=BXt,y((hXt=wXt).prototype,"target",[tXt],Object.getOwnPropertyDescriptor(hXt.prototype,"target"),hXt.prototype),y(hXt.prototype,"transition",[eXt],Object.getOwnPropertyDescriptor(hXt.prototype,"transition"),hXt.prototype),y(hXt.prototype,"normalSprite",[iXt],Object.getOwnPropertyDescriptor(hXt.prototype,"normalSprite"),hXt.prototype),y(hXt.prototype,"pressedSprite",[nXt],Object.getOwnPropertyDescriptor(hXt.prototype,"pressedSprite"),hXt.prototype),y(hXt.prototype,"hoverSprite",[rXt],Object.getOwnPropertyDescriptor(hXt.prototype,"hoverSprite"),hXt.prototype),y(hXt.prototype,"disabledSprite",[sXt],Object.getOwnPropertyDescriptor(hXt.prototype,"disabledSprite"),hXt.prototype),uXt=Nh(hXt.prototype,"clickEvents",[aXt,hu],(function(){return[]})),lXt=Nh(hXt.prototype,"_interactable",[hu],(function(){return!0})),cXt=Nh(hXt.prototype,"_transition",[hu],(function(){return 0})),fXt=Nh(hXt.prototype,"_normalColor",[hu],(function(){return cr.WHITE.clone()})),dXt=Nh(hXt.prototype,"_hoverColor",[hu],(function(){return new cr(211,211,211,255)})),_Xt=Nh(hXt.prototype,"_pressedColor",[hu],(function(){return cr.WHITE.clone()})),pXt=Nh(hXt.prototype,"_disabledColor",[hu],(function(){return new cr(124,124,124,255)})),mXt=Nh(hXt.prototype,"_normalSprite",[hu],(function(){return null})),gXt=Nh(hXt.prototype,"_hoverSprite",[hu],(function(){return null})),vXt=Nh(hXt.prototype,"_pressedSprite",[hu],(function(){return null})),yXt=Nh(hXt.prototype,"_disabledSprite",[hu],(function(){return null})),bXt=Nh(hXt.prototype,"_duration",[hu],(function(){return.1})),SXt=Nh(hXt.prototype,"_zoomScale",[hu],(function(){return 1.2})),xXt=Nh(hXt.prototype,"_target",[hu],(function(){return null})),oXt=hXt))||oXt)||oXt)||oXt));A.Button=MXt;var PXt=function(){function t(){}return t.add=function(t){var e=this._tabIndexList;-1===e.indexOf(t)&&e.push(t)},t.remove=function(t){var e=this._tabIndexList,i=e.indexOf(t);-1!==i&&e.splice(i,1)},t.resort=function(){this._tabIndexList.sort((function(t,e){return t._delegate.tabIndex-e._delegate.tabIndex}))},t.next=function(t){var e=this._tabIndexList,i=e.indexOf(t);if(t.setFocus(!1),-1!==i){var n=e[i+1];n&&n._delegate.tabIndex>=0&&n.setFocus(!0)}},t}();PXt._tabIndexList=[];var EXt=function(){function t(){this._editing=!1,this._delegate=null}var e=t.prototype;return e.init=function(){},e.onEnable=function(){},e.beforeDraw=function(){},e.onDisable=function(){this._editing&&this.endEditing()},e.clear=function(){this._delegate=null},e.setTabIndex=function(){},e.setSize=function(){},e.setFocus=function(t){t?this.beginEditing():this.endEditing()},e.isFocused=function(){return this._editing},e.beginEditing=function(){},e.endEditing=function(){},t}(),kXt=I.document,RXt=new Qr,OXt=new Qr,FXt=new ir,LXt=null,VXt=0,NXt=function(t){function e(){var e;return(e=t.call(this)||this)._delegate=null,e._inputMode=-1,e._inputFlag=-1,e._returnType=-1,e.__eventListeners={},e.__autoResize=!1,e.__orientationChanged=void 0,e._edTxt=null,e._isTextArea=!1,e._textLabelFont=null,e._textLabelFontSize=null,e._textLabelFontColor=null,e._textLabelAlign=null,e._placeholderLabelFont=null,e._placeholderLabelFontSize=null,e._placeholderLabelFontColor=null,e._placeholderLabelAlign=null,e._placeholderLineHeight=null,e._placeholderStyleSheet=null,e._domId="EditBoxId_"+ ++VXt,e._forceUpdate=!1,e}s(e,t);var i=e.prototype;return i.init=function(t){t&&(this._delegate=t,0===t.inputMode?this._createTextArea():this._createInput(),PXt.add(this),this.setTabIndex(t.tabIndex),this._initStyleSheet(),this._registerEventListeners(),this._addDomToGameContainer(),wk.instance.on("canvas-resize",this._resize,this),rh.on("window-resize",this._resize,this))},i.clear=function(){wk.instance.off("canvas-resize",this._resize,this),rh.off("window-resize",this._resize,this),this._removeEventListeners(),this._removeDomFromGameContainer(),PXt.remove(this),LXt===this&&(LXt=null),this._delegate=null},i._resize=function(){this._forceUpdate=!0},i.beforeDraw=function(){(this._delegate.node.hasChangedFlags||this._forceUpdate)&&(this._forceUpdate=!1,this._updateMatrix())},i.setTabIndex=function(t){this._edTxt.tabIndex=t,PXt.resort()},i.setSize=function(t,e){var i=this._edTxt;i&&(i.style.width=t+"px",i.style.height=e+"px")},i.beginEditing=function(){LXt&&LXt!==this&&LXt.setFocus(!1),this._editing=!0,LXt=this,this._delegate._editBoxEditingDidBegan(),this._showDom(),this._edTxt.focus()},i.endEditing=function(){this._edTxt.blur()},i._createInput=function(){this._isTextArea=!1,this._edTxt=kXt.createElement("input")},i._createTextArea=function(){this._isTextArea=!0,this._edTxt=kXt.createElement("textarea")},i._addDomToGameContainer=function(){Uk.container&&this._edTxt&&(Uk.container.appendChild(this._edTxt),kXt.head.appendChild(this._placeholderStyleSheet))},i._removeDomFromGameContainer=function(){Je(Uk.container,this._edTxt)&&this._edTxt&&Uk.container.removeChild(this._edTxt),Je(kXt.head,this._placeholderStyleSheet)&&kXt.head.removeChild(this._placeholderStyleSheet),this._edTxt=null,this._placeholderStyleSheet=null},i._showDom=function(){this._updateMaxLength(),this._updateInputType(),this._updateStyleSheet(),this._edTxt&&this._delegate&&(this._edTxt.style.display="",this._delegate._hideLabels()),oh.isMobile&&this._showDomOnMobile()},i._hideDom=function(){var t=this._edTxt;t&&this._delegate&&(t.style.display="none",this._delegate._showLabels()),oh.isMobile&&this._hideDomOnMobile()},i._showDomOnMobile=function(){oh.os!==Eo.ANDROID&&oh.os!==Eo.OHOS||(rh.handleResizeEvent=!1,this._adjustWindowScroll())},i._hideDomOnMobile=function(){oh.os!==Eo.ANDROID&&oh.os!==Eo.OHOS||(rh.handleResizeEvent=!0),this._scrollBackWindow()},i._isElementInViewport=function(){if(this._edTxt){var t=this._edTxt.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(I.innerHeight||kXt.documentElement.clientHeight)&&t.right<=(I.innerWidth||kXt.documentElement.clientWidth)}return!1},i._adjustWindowScroll=function(){var t=this;setTimeout((function(){I.scrollY<40&&!t._isElementInViewport()&&t._edTxt.scrollIntoView({block:"start",inline:"nearest",behavior:"smooth"})}),400)},i._scrollBackWindow=function(){setTimeout((function(){oh.browserType!==Bo.WECHAT||oh.os!==Eo.IOS?I.scrollTo(0,0):I.top&&I.top.scrollTo(0,0)}),400)},i._updateMatrix=function(){if(this._edTxt){var t=this._delegate.node,e=Rk.getScaleX(),i=Rk.getScaleY(),n=Rk.getViewportRect(),r=rh.devicePixelRatio;t.getWorldMatrix(RXt);var s=t._getUITransformComp();if(s&&(ir.set(FXt,-s.anchorX*s.width,-s.anchorY*s.height,FXt.z),Qr.transform(RXt,RXt,FXt)),t._getUITransformComp()){var a=GE.root.batcher2D.getFirstRenderCamera(t);if(a){a.node.getWorldRT(OXt);var o=OXt.m12,h=OXt.m13,u=hh.center;OXt.m12=u.x-(OXt.m00*o+OXt.m04*h),OXt.m13=u.y-(OXt.m01*o+OXt.m05*h),e/=r,i/=r,ir.set(FXt,e,i,1),Qr.scale(OXt,OXt,FXt);var l=Uk.container,c=parseInt(l&&l.style.paddingLeft||"0");c+=n.x/r;var f=parseInt(l&&l.style.paddingBottom||"0");f+=n.y/r,OXt.m12+=c,OXt.m13+=f,Qr.multiply(OXt,OXt,RXt);var d="matrix("+OXt.m00+","+-OXt.m01+","+-OXt.m04+","+OXt.m05+","+OXt.m12+","+-OXt.m13+")";this._edTxt.style.transform=d,this._edTxt.style["-webkit-transform"]=d,this._edTxt.style["transform-origin"]="0px 100% 0px",this._edTxt.style["-webkit-transform-origin"]="0px 100% 0px"}}}},i._updateInputType=function(){var t=this._delegate,e=t.inputMode,i=t.inputFlag,n=t.returnType,r=this._edTxt;if(this._inputMode!==e||this._inputFlag!==i||this._returnType!==n){if(this._inputMode=e,this._inputFlag=i,this._returnType=n,this._isTextArea){var s="none";return 4===i?s="uppercase":2===i&&(s="capitalize"),void(r.style.textTransform=s)}if(0===i)return r.type="password",void(r.style.textTransform="none");var a=r.type;1===e?a="email":2===e?a="number":5===e?a="digit":3===e?(a="tel",r.addEventListener("wheel",(function(){return!1}))):4===e?a="url":(a="text",3===n&&(a="search")),r.type=a;var o="none";4===i?o="uppercase":2===i&&(o="capitalize"),r.style.textTransform=o}},i._updateMaxLength=function(){var t=this._delegate.maxLength;t<0&&(t=65535),this._edTxt.maxLength=t},i._initStyleSheet=function(){if(this._edTxt){var t=this._edTxt;t.style.color="#000000",t.style.border="0px",t.style.background="transparent",t.style.width="100%",t.style.height="100%",t.style.outline="medium",t.style.padding="0",t.style.textTransform="none",t.style.display="none",t.style.position="absolute",t.style.bottom="0px",t.style.left="2px",t.className="cocosEditBox",t.style.fontFamily="Arial",t.id=this._domId,this._isTextArea?(t.style.resize="none",t.style.overflowY="scroll"):(t.type="text",t.style["-moz-appearance"]="textfield"),this._placeholderStyleSheet=kXt.createElement("style")}},i._updateStyleSheet=function(){var t=this._delegate,e=this._edTxt;e&&t&&(e.value=t.string,this._updateTextLabel(t.textLabel))},i._updateTextLabel=function(t){if(t){var e=t.font;e=!e||e instanceof sF?t.fontFamily:e._fontFamily;var i=t.fontSize*t.node.scale.y;if((this._textLabelFont!==e||this._textLabelFontSize!==i||this._textLabelFontColor!==t.fontColor||this._textLabelAlign!==t.horizontalAlign)&&(this._textLabelFont=e,this._textLabelFontSize=i,this._textLabelFontColor=t.fontColor,this._textLabelAlign=t.horizontalAlign,this._edTxt)){var n=this._edTxt;switch(n.style.fontSize=i+"px",n.style.color=t.color.toCSS(),n.style.fontFamily=e,t.horizontalAlign){case PV.HorizontalAlign.LEFT:n.style.textAlign="left";break;case PV.HorizontalAlign.CENTER:n.style.textAlign="center";break;case PV.HorizontalAlign.RIGHT:n.style.textAlign="right"}}}},i._updatePlaceholderLabel=function(t){if(t){var e=t.font;e=!e||e instanceof sF?t.fontFamily:t.font._fontFamily;var i=t.fontSize*t.node.scale.y;if(this._placeholderLabelFont!==e||this._placeholderLabelFontSize!==i||this._placeholderLabelFontColor!==t.fontColor||this._placeholderLabelAlign!==t.horizontalAlign||this._placeholderLineHeight!==t.fontSize){this._placeholderLabelFont=e,this._placeholderLabelFontSize=i,this._placeholderLabelFontColor=t.fontColor,this._placeholderLabelAlign=t.horizontalAlign,this._placeholderLineHeight=t.fontSize;var n=this._placeholderStyleSheet,r=t.color.toCSS(),s=t.fontSize,a="";switch(t.horizontalAlign){case PV.HorizontalAlign.LEFT:a="left";break;case PV.HorizontalAlign.CENTER:a="center";break;case PV.HorizontalAlign.RIGHT:a="right"}n.innerHTML="#"+this._domId+"::-webkit-input-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+a+";}#"+this._domId+"::-moz-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+a+";}#"+this._domId+"::-ms-input-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+a+";}",oh.browserType===Bo.EDGE&&(n.innerHTML+="#"+this._domId+"::-ms-clear{display: none;}")}}},i._registerEventListeners=function(){var t=this;if(this._edTxt){var e=this._edTxt,i=!1,n=this.__eventListeners;n.compositionStart=function(){i=!0},n.compositionEnd=function(){i=!1,t._delegate._editBoxTextChanged(e.value)},n.onInput=function(){if(!i){var n=t._delegate,r=n.maxLength;r>=0&&"number"!==e.type&&(e.value=e.value.slice(0,r)),n._editBoxTextChanged(e.value)}},n.onClick=function(){t._editing&&oh.isMobile&&t._adjustWindowScroll()},n.onKeydown=function(i){13===i.keyCode?(i.propagationStopped=!0,t._delegate._editBoxEditingReturn(),t._isTextArea||e.blur()):9===i.keyCode&&(i.propagationStopped=!0,i.preventDefault(),PXt.next(t))},n.onBlur=function(){oh.isMobile&&i&&n.compositionEnd(),t._editing=!1,LXt=null,t._hideDom(),t._delegate._editBoxEditingDidEnded()},e.addEventListener("compositionstart",n.compositionStart),e.addEventListener("compositionend",n.compositionEnd),e.addEventListener("input",n.onInput),e.addEventListener("keydown",n.onKeydown),e.addEventListener("blur",n.onBlur),e.addEventListener("touchstart",n.onClick)}},i._removeEventListeners=function(){if(this._edTxt){var t=this._edTxt,e=this.__eventListeners;t.removeEventListener("compositionstart",e.compositionStart),t.removeEventListener("compositionend",e.compositionEnd),t.removeEventListener("input",e.onInput),t.removeEventListener("keydown",e.onKeydown),t.removeEventListener("blur",e.onBlur),t.removeEventListener("touchstart",e.onClick),e.compositionStart=null,e.compositionEnd=null,e.onInput=null,e.onKeydown=null,e.onBlur=null,e.onClick=null}},e}(EXt),zXt={DEFAULT:0,DONE:1,SEND:2,SEARCH:3,GO:4,NEXT:5};Ee(zXt);var UXt={ANY:0,EMAIL_ADDR:1,NUMERIC:2,PHONE_NUMBER:3,URL:4,DECIMAL:5,SINGLE_LINE:6};Ee(UXt);var GXt,HXt,WXt,jXt,qXt,XXt,YXt,QXt,JXt,KXt,ZXt,$Xt,tYt,eYt,iYt,nYt,rYt,sYt,aYt,oYt,hYt,uYt,lYt,cYt,fYt,dYt,_Yt,pYt,mYt,gYt={PASSWORD:0,SENSITIVE:1,INITIAL_CAPS_WORD:2,INITIAL_CAPS_SENTENCE:3,INITIAL_CAPS_ALL_CHARACTERS:4,DEFAULT:5};Ee(gYt);var vYt,yYt,bYt,SYt,xYt,wYt,TYt,CYt,AYt,DYt,IYt,BYt,MYt,PYt,EYt,kYt,RYt,OYt,FYt,LYt,VYt,NYt,zYt,UYt,GYt,HYt,WYt,jYt,qYt=t("gU",(GXt=Qh("cc.EditBox"),HXt=Kh(110),WXt=Jh(rL),jXt=Eu(PV),qXt=Eu(PV),XXt=Eu(KR),YXt=Eu(gYt),QXt=Eu(UXt),JXt=Eu(zXt),KXt=Eu([pg]),ZXt=Eu([pg]),$Xt=Eu([pg]),tYt=Eu([pg]),GXt(eYt=HXt(eYt=WXt((mYt=function(t){function e(){var e;return(e=t.call(this)||this).editingDidBegan=nYt&&nYt(),e.textChanged=rYt&&rYt(),e.editingDidEnded=sYt&&sYt(),e.editingReturn=aYt&&aYt(),e._impl=null,e._background=null,e._textLabel=oYt&&oYt(),e._placeholderLabel=hYt&&hYt(),e._returnType=uYt&&uYt(),e._string=lYt&&lYt(),e._tabIndex=cYt&&cYt(),e._backgroundImage=fYt&&fYt(),e._inputFlag=dYt&&dYt(),e._inputMode=_Yt&&_Yt(),e._maxLength=pYt&&pYt(),e._isLabelVisible=!1,e}s(e,t);var i=e.prototype;return i.__preload=function(){this._init()},i.onEnable=function(){this._registerEvent(),this._ensureBackgroundSprite(),this._impl&&this._impl.onEnable()},i._beforeDraw=function(){this._impl&&this._impl.beforeDraw()},i.onDisable=function(){this._unregisterEvent(),this._unregisterBackgroundEvent(),this._impl&&this._impl.onDisable()},i.onDestroy=function(){GE.off("director_before_draw",this._beforeDraw,this),this._impl&&this._impl.clear()},i.setFocus=function(){this._impl&&this._impl.setFocus(!0)},i.focus=function(){this._impl&&this._impl.setFocus(!0)},i.blur=function(){this._impl&&this._impl.setFocus(!1)},i.isFocused=function(){return!!this._impl&&this._impl.isFocused()},i._editBoxEditingDidBegan=function(){pg.emitEvents(this.editingDidBegan,this),this.node.emit("editing-did-began",this)},i._editBoxEditingDidEnded=function(t){pg.emitEvents(this.editingDidEnded,this),this.node.emit("editing-did-ended",this,t)},i._editBoxTextChanged=function(t){t=this._updateLabelStringStyle(t,!0),this.string=t,pg.emitEvents(this.textChanged,t,this),this.node.emit("text-changed",this)},i._editBoxEditingReturn=function(t){pg.emitEvents(this.editingReturn,this),this.node.emit("editing-return",this,t)},i._showLabels=function(){this._isLabelVisible=!0,this._updateLabels()},i._hideLabels=function(){this._isLabelVisible=!1,this._textLabel&&(this._textLabel.node.active=!1),this._placeholderLabel&&(this._placeholderLabel.node.active=!1)},i._onTouchBegan=function(t){t.propagationStopped=!0},i._onTouchCancel=function(t){t.propagationStopped=!0},i._onTouchEnded=function(t){this._impl&&this._impl.beginEditing(),t.propagationStopped=!0},i._init=function(){this._updatePlaceholderLabel(),this._updateTextLabel(),this._isLabelVisible=!0,this.node.on("size-changed",this._resizeChildNodes,this),GE.on("director_before_draw",this._beforeDraw,this),(this._impl=new e._EditBoxImpl).init(this),this._updateString(this._string),this._syncSize()},i._ensureBackgroundSprite=function(){if(!this._background){var t=this.node.getComponent(FV);t||(t=this.node.addComponent(FV)),t!==this._background&&(t.type=FV.Type.SLICED,t.spriteFrame=this._backgroundImage,this._background=t,this._registerBackgroundEvent())}},i._updateTextLabel=function(){var t=this._textLabel;if(!t){var e=this.node.getChildByName("TEXT_LABEL");e||((e=new tb("TEXT_LABEL")).layer=this.node.layer),(t=e.getComponent(PV))||(t=e.addComponent(PV)),e.parent=this.node,this._textLabel=t}0===this._inputMode?(t.verticalAlign=0,t.enableWrapText=!0):t.enableWrapText=!1,t.string=this._updateLabelStringStyle(this._string)},i._updatePlaceholderLabel=function(){var t=this._placeholderLabel;if(!t){var e=this.node.getChildByName("PLACEHOLDER_LABEL");e||((e=new tb("PLACEHOLDER_LABEL")).layer=this.node.layer),(t=e.getComponent(PV))||(t=e.addComponent(PV)),e.parent=this.node,this._placeholderLabel=t}0===this._inputMode?t.enableWrapText=!0:t.enableWrapText=!1,t.string=this.placeholder},i._syncSize=function(){var t=this.node._getUITransformComp(),e=t.contentSize;if(this._background){var i=this._background.node._getUITransformComp();i.anchorPoint=t.anchorPoint,i.setContentSize(e)}this._updateLabelPosition(e),this._impl&&this._impl.setSize(e.width,e.height)},i._updateLabels=function(){if(this._isLabelVisible){var t=this._string;this._textLabel&&(this._textLabel.node.active=""!==t),this._placeholderLabel&&(this._placeholderLabel.node.active=""===t)}},i._updateString=function(t){var e=this._textLabel;if(e){var i=t;i&&(i=this._updateLabelStringStyle(i)),e.string=i,this._updateLabels()}},i._updateLabelStringStyle=function(t,e){void 0===e&&(e=!1);var i,n=this._inputFlag;if(e||0!==n)4===n?t=t.toUpperCase():2===n?t=t.replace(/(?:^|\s)\S/g,(function(t){return t.toUpperCase()})):3===n&&(t=(i=t).charAt(0).toUpperCase()+i.slice(1));else{for(var r="",s=t.length,a=0;a=0&&t.length>=this._maxLength&&(t=t.slice(0,this._maxLength)),this._string!==t&&(this._string=t,this._updateString(t))}},{key:"placeholder",get:function(){return this._placeholderLabel?this._placeholderLabel.string:""},set:function(t){this._placeholderLabel&&(this._placeholderLabel.string=t)}},{key:"textLabel",get:function(){return this._textLabel},set:function(t){this._textLabel!==t&&(this._textLabel=t,this._textLabel&&(this._updateTextLabel(),this._updateLabels()))}},{key:"placeholderLabel",get:function(){return this._placeholderLabel},set:function(t){this._placeholderLabel!==t&&(this._placeholderLabel=t,this._placeholderLabel&&(this._updatePlaceholderLabel(),this._updateLabels()))}},{key:"backgroundImage",get:function(){return this._backgroundImage},set:function(t){this._backgroundImage!==t&&(this._backgroundImage=t,this._ensureBackgroundSprite(),this._background.spriteFrame=t)}},{key:"inputFlag",get:function(){return this._inputFlag},set:function(t){this._inputFlag!==t&&(this._inputFlag=t,this._updateString(this._string))}},{key:"inputMode",get:function(){return this._inputMode},set:function(t){this._inputMode!==t&&(this._inputMode=t,this._updateTextLabel(),this._updatePlaceholderLabel())}},{key:"returnType",get:function(){return this._returnType},set:function(t){this._returnType=t}},{key:"maxLength",get:function(){return this._maxLength},set:function(t){this._maxLength=t}},{key:"tabIndex",get:function(){return this._tabIndex},set:function(t){this._tabIndex!==t&&(this._tabIndex=t,this._impl&&this._impl.setTabIndex(t))}}]),e}(gg),mYt._EditBoxImpl=EXt,mYt.KeyboardReturnType=zXt,mYt.InputFlag=gYt,mYt.InputMode=UXt,mYt.EventType={EDITING_DID_BEGAN:"editing-did-began",EDITING_DID_ENDED:"editing-did-ended",TEXT_CHANGED:"text-changed",EDITING_RETURN:"editing-return",XR_EDITING_DID_BEGAN:"xr-editing-did-began",XR_EDITING_DID_ENDED:"xr-editing-did-ended"},y((iYt=mYt).prototype,"textLabel",[jXt],Object.getOwnPropertyDescriptor(iYt.prototype,"textLabel"),iYt.prototype),y(iYt.prototype,"placeholderLabel",[qXt],Object.getOwnPropertyDescriptor(iYt.prototype,"placeholderLabel"),iYt.prototype),y(iYt.prototype,"backgroundImage",[XXt],Object.getOwnPropertyDescriptor(iYt.prototype,"backgroundImage"),iYt.prototype),y(iYt.prototype,"inputFlag",[YXt],Object.getOwnPropertyDescriptor(iYt.prototype,"inputFlag"),iYt.prototype),y(iYt.prototype,"inputMode",[QXt],Object.getOwnPropertyDescriptor(iYt.prototype,"inputMode"),iYt.prototype),y(iYt.prototype,"returnType",[JXt],Object.getOwnPropertyDescriptor(iYt.prototype,"returnType"),iYt.prototype),nYt=Nh(iYt.prototype,"editingDidBegan",[KXt,hu],(function(){return[]})),rYt=Nh(iYt.prototype,"textChanged",[ZXt,hu],(function(){return[]})),sYt=Nh(iYt.prototype,"editingDidEnded",[$Xt,hu],(function(){return[]})),aYt=Nh(iYt.prototype,"editingReturn",[tYt,hu],(function(){return[]})),oYt=Nh(iYt.prototype,"_textLabel",[hu],(function(){return null})),hYt=Nh(iYt.prototype,"_placeholderLabel",[hu],(function(){return null})),uYt=Nh(iYt.prototype,"_returnType",[hu],(function(){return 0})),lYt=Nh(iYt.prototype,"_string",[hu],(function(){return""})),cYt=Nh(iYt.prototype,"_tabIndex",[hu],(function(){return 0})),fYt=Nh(iYt.prototype,"_backgroundImage",[hu],(function(){return null})),dYt=Nh(iYt.prototype,"_inputFlag",[hu],(function(){return 5})),_Yt=Nh(iYt.prototype,"_inputMode",[hu],(function(){return 0})),pYt=Nh(iYt.prototype,"_maxLength",[hu],(function(){return 20})),eYt=iYt))||eYt)||eYt)||eYt));"object"==typeof window&&"object"==typeof document&&(qYt._EditBoxImpl=NXt),A.internal.EditBox=qYt;var XYt={NONE:0,HORIZONTAL:1,VERTICAL:2,GRID:3};Oe(XYt);var YYt={NONE:0,CONTAINER:1,CHILDREN:2};Oe(YYt);var QYt={HORIZONTAL:0,VERTICAL:1};Oe(QYt);var JYt={BOTTOM_TO_TOP:0,TOP_TO_BOTTOM:1};Oe(JYt);var KYt={LEFT_TO_RIGHT:0,RIGHT_TO_LEFT:1};Oe(KYt);var ZYt={NONE:0,FIXED_ROW:1,FIXED_COL:2};Oe(ZYt);var $Yt,tQt,eQt,iQt,nQt,rQt,sQt,aQt,oQt,hQt,uQt,lQt,cQt,fQt=new ir,dQt=t("gV",(vYt=Qh("cc.Layout"),yYt=Kh(110),bYt=Jh(rL),SYt=Eu(XYt),xYt=Eu(YYt),wYt=Eu(QYt),TYt=Eu(JYt),CYt=Eu(KYt),AYt=Eu(ZYt),vYt(DYt=yYt(DYt=bYt((jYt=function(t){function e(){var e;return(e=t.call(this)||this)._resizeMode=BYt&&BYt(),e._layoutType=MYt&&MYt(),e._cellSize=PYt&&PYt(),e._startAxis=EYt&&EYt(),e._paddingLeft=kYt&&kYt(),e._paddingRight=RYt&&RYt(),e._paddingTop=OYt&&OYt(),e._paddingBottom=FYt&&FYt(),e._spacingX=LYt&&LYt(),e._spacingY=VYt&&VYt(),e._verticalDirection=NYt&&NYt(),e._horizontalDirection=zYt&&zYt(),e._constraint=UYt&&UYt(),e._constraintNum=GYt&&GYt(),e._affectedByScale=HYt&&HYt(),e._isAlign=WYt&&WYt(),e._layoutSize=new ps(300,200),e._layoutDirty=!0,e._childrenDirty=!1,e._usefulLayoutObj=[],e._init=!1,e}s(e,t);var i=e.prototype;return i.updateLayout=function(t){void 0===t&&(t=!1),(this._layoutDirty||t)&&(this._doLayout(),this._layoutDirty=!1)},i.onEnable=function(){this._addEventListeners();var t=this.node._getUITransformComp();t.contentSize.equals(ps.ZERO)&&t.setContentSize(this._layoutSize),this._childrenChanged()},i.onDisable=function(){this._usefulLayoutObj.length=0,this._removeEventListeners()},i._checkUsefulObj=function(){this._usefulLayoutObj.length=0;for(var t=this.node.children,e=0;ef&&(d=Math.max(f,d),c=f||D,f=D),u+=a*(C*A+this._spacingX);var I=a*(1-C)*A;if(e){if(s>0)(_=y/s>0&&y%s==0)&&(c=f>D?f:c);else if(A>t-g)u>h+a*C*A&&(_=!0);else{var B=(1-this._horizontalDirection-r.x)*t,M=u+I+a*(a>0?this._paddingRight:this._paddingLeft);_=Math.abs(M)>Math.abs(B)}_&&(u=h+a*C*A,D!==f&&(c=f),l+=c+this._spacingY,c=f=D)}var P=i(S,b,l);n&&S.setPosition(u,P),u+=I}return c=Math.max(c,f),Math.max(d,l+c)+this._getPaddingV()},i._doLayoutVertically=function(t,e,i,n){var r=this.node._getUITransformComp().anchorPoint,s=this._getFixedBreakingNum(),a=1,o=this._paddingBottom;1===this._verticalDirection&&(a=-1,o=this._paddingTop);var h=(this._verticalDirection-r.y)*t+a*o,u=h-a*this._spacingY,l=0,c=0,f=0,d=0,_=!1,p=this._usefulLayoutObj.length,m=this._cellSize.height,g=this._getPaddingV();3!==this._layoutType&&2===this._resizeMode&&(m=(t-g-(p-1)*this._spacingY)/p);for(var v=this._usefulLayoutObj,y=0;yl&&(c=Math.max(l,c),f=l||A,l=A),u+=a*(C*D+this._spacingY);var I=a*(1-C)*D;if(e){if(s>0)(_=y/s>0&&y%s==0)&&(f=l>D?l:f);else if(D>t-g)u>h+a*C*D&&(_=!0);else{var B=(1-this._verticalDirection-r.y)*t,M=u+I+a*(a>0?this._paddingTop:this._paddingBottom);_=Math.abs(M)>Math.abs(B)}_&&(u=h+a*C*D,A!==l&&(f=l),d+=f+this._spacingX,f=l=A)}var P=i(S,b,d);n&&(S.getPosition(fQt),S.setPosition(P,u,fQt.z)),u+=I}return f=Math.max(f,l),Math.max(c,d+f)+this._getPaddingH()},i._doLayoutGridAxisHorizontal=function(t,e){var i=this,n=e.width,r=1,s=-t.y*e.height,a=this._paddingBottom;1===this._verticalDirection&&(r=-1,s=(1-t.y)*e.height,a=this._paddingTop);var o=function(t,e,n){return s+r*(n+(1-e.anchorY)*e.height*i._getUsedScaleValue(t.scale.y)+a)},h=0;1===this._resizeMode&&(h=this._doLayoutHorizontally(n,!0,o,!1),s=-t.y*h,1===this._verticalDirection&&(r=-1,s=(1-t.y)*h)),this._doLayoutHorizontally(n,!0,o,!0),1===this._resizeMode&&this.node._getUITransformComp().setContentSize(n,h)},i._doLayoutGridAxisVertical=function(t,e){var i=this,n=e.height,r=1,s=-t.x*e.width,a=this._paddingLeft;1===this._horizontalDirection&&(r=-1,s=(1-t.x)*e.width,a=this._paddingRight);var o=function(t,e,n){return s+r*(n+(1-e.anchorX)*e.width*i._getUsedScaleValue(t.scale.x)+a)},h=0;1===this._resizeMode&&(h=this._doLayoutVertically(n,!0,o,!1),s=-t.x*h,1===this._horizontalDirection&&(r=-1,s=(1-t.x)*h)),this._doLayoutVertically(n,!0,o,!0),1===this._resizeMode&&this.node._getUITransformComp().setContentSize(h,n)},i._doLayoutGrid=function(){var t=this.node._getUITransformComp(),e=t.anchorPoint,i=t.contentSize;0===this.startAxis?this._doLayoutGridAxisHorizontal(e,i):1===this.startAxis&&this._doLayoutGridAxisVertical(e,i)},i._getHorizontalBaseWidth=function(){var t=this._usefulLayoutObj,e=0,i=t.length;if(1===this._resizeMode){for(var n=0;n0?n:-n)),i*(e/r)},i._calculatePosition=function(t,e,i,n,r,s,a){var o=e-i;s&&(o+=Math.abs(s));var h=0;o&&(h=tn(h=r/o));var u=(n-a)*h;1===this._direction?t.set(0,u):t.set(u,0)},i._updateLength=function(t){if(this._handle){var e=this._handle.node._getUITransformComp(),i=e.contentSize,n=e.anchorPoint;n.x===EQt.x&&n.y===EQt.y||e.setAnchorPoint(EQt),0===this._direction?e.setContentSize(t,i.height):e.setContentSize(i.width,t)}},i._processAutoHide=function(t){if(this._enableAutoHide&&!(this._autoHideRemainingTime<=0)&&!this._touching&&(this._autoHideRemainingTime-=t,this._autoHideRemainingTime<=this._autoHideTime)){this._autoHideRemainingTime=Math.max(0,this._autoHideRemainingTime);var e=this._opacity*(this._autoHideRemainingTime/this._autoHideTime);this._setOpacity(e)}},n(e,[{key:"handle",get:function(){return this._handle},set:function(t){this._handle!==t&&(this._handle=t,this.onScroll(ds.ZERO))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this.onScroll(ds.ZERO))}},{key:"enableAutoHide",get:function(){return this._enableAutoHide},set:function(t){this._enableAutoHide!==t&&(this._enableAutoHide=t,this._enableAutoHide&&this._setOpacity(0))}},{key:"autoHideTime",get:function(){return this._autoHideTime},set:function(t){this._autoHideTime!==t&&(this._autoHideTime=t)}}]),e}(gg),DQt.Direction=OQt,y((SQt=DQt).prototype,"handle",[vQt],Object.getOwnPropertyDescriptor(SQt.prototype,"handle"),SQt.prototype),y(SQt.prototype,"direction",[yQt],Object.getOwnPropertyDescriptor(SQt.prototype,"direction"),SQt.prototype),xQt=Nh(SQt.prototype,"_scrollView",[hu],(function(){return null})),wQt=Nh(SQt.prototype,"_handle",[hu],(function(){return null})),TQt=Nh(SQt.prototype,"_direction",[hu],(function(){return 0})),CQt=Nh(SQt.prototype,"_enableAutoHide",[hu],(function(){return!1})),AQt=Nh(SQt.prototype,"_autoHideTime",[hu],(function(){return 1})),bQt=SQt))||bQt)||bQt)||bQt));A.ScrollBar=LQt;var VQt,NQt,zQt,UQt,GQt,HQt,WQt,jQt,qQt,XQt,YQt,QQt,JQt,KQt,ZQt,$Qt,tJt,eJt,iJt,nJt,rJt,sJt=t("h0",Qh("cc.ViewGroup")(FQt=Kh(110)(FQt=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(gg))||FQt)||FQt);A.ViewGroup=sJt;var aJt,oJt,hJt,uJt,lJt,cJt,fJt,dJt,_Jt,pJt,mJt,gJt,vJt,yJt=1e-4,bJt=nr(),SJt=nr(),xJt=_s(),wJt=_s(),TJt=function(){return(new Date).getMilliseconds()},CJt={"scroll-to-top":0,"scroll-to-bottom":1,"scroll-to-left":2,"scroll-to-right":3,scrolling:4,"bounce-bottom":6,"bounce-left":7,"bounce-right":8,"bounce-top":5,"scroll-ended":9,"touch-up":10,"scroll-ended-with-threshold":11,"scroll-began":12},AJt={anchor:_s(),applyToHorizontal:!1,applyToVertical:!1},DJt=function(t,e,i,n){AJt.anchor.set(t,e),AJt.applyToHorizontal=i,AJt.applyToVertical=n},IJt={NONE:"",SCROLL_TO_TOP:"scroll-to-top",SCROLL_TO_BOTTOM:"scroll-to-bottom",SCROLL_TO_LEFT:"scroll-to-left",SCROLL_TO_RIGHT:"scroll-to-right",SCROLL_BEGAN:"scroll-began",SCROLL_ENDED:"scroll-ended",BOUNCE_TOP:"bounce-top",BOUNCE_BOTTOM:"bounce-bottom",BOUNCE_LEFT:"bounce-left",BOUNCE_RIGHT:"bounce-right",SCROLLING:"scrolling",SCROLL_ENG_WITH_THRESHOLD:"scroll-ended-with-threshold",TOUCH_UP:"touch-up"},BJt=t("gY",(VQt=Qh("cc.ScrollView"),NQt=Kh(110),zQt=Jh(rL),UQt=Eu(tb),GQt=Eu(LQt),HQt=Eu(LQt),WQt=Eu([pg]),VQt(jQt=NQt(jQt=zQt((rJt=function(t){function e(){var e;return(e=t.call(this)||this).bounceDuration=XQt&&XQt(),e.brake=YQt&&YQt(),e.elastic=QQt&&QQt(),e.inertia=JQt&&JQt(),e.horizontal=KQt&&KQt(),e.vertical=ZQt&&ZQt(),e.cancelInnerEvents=$Qt&&$Qt(),e.scrollEvents=tJt&&tJt(),e._autoScrolling=!1,e._scrolling=!1,e._content=eJt&&eJt(),e._horizontalScrollBar=iJt&&iJt(),e._verticalScrollBar=nJt&&nJt(),e._topBoundary=0,e._bottomBoundary=0,e._leftBoundary=0,e._rightBoundary=0,e._touchMoveDisplacements=[],e._touchMoveTimeDeltas=[],e._touchMovePreviousTimestamp=0,e._touchMoved=!1,e._autoScrollAttenuate=!1,e._autoScrollStartPosition=new ir,e._autoScrollTargetDelta=new ir,e._autoScrollTotalTime=0,e._autoScrollAccumulatedTime=0,e._autoScrollCurrentlyOutOfBoundary=!1,e._autoScrollBraking=!1,e._autoScrollBrakingStartPosition=new ir,e._outOfBoundaryAmount=new ir,e._outOfBoundaryAmountDirty=!0,e._stopMouseWheel=!1,e._mouseWheelEventElapsedTime=0,e._isScrollEndedWithThresholdEventFired=!1,e._scrollEventEmitMask=0,e._isBouncing=!1,e._contentPos=new ir,e._deltaPos=new ir,e._deltaAmount=new ir,e._hoverIn=0,e}s(e,t);var i=e.prototype;return i.scrollToBottom=function(t,e){void 0===e&&(e=!0),this._doScroll(0,0,!1,!0,t,e)},i.scrollToTop=function(t,e){void 0===e&&(e=!0),this._doScroll(0,1,!1,!0,t,e)},i.scrollToLeft=function(t,e){void 0===e&&(e=!0),this._doScroll(0,0,!0,!1,t,e)},i.scrollToRight=function(t,e){void 0===e&&(e=!0),this._doScroll(1,0,!0,!1,t,e)},i.scrollToTopLeft=function(t,e){void 0===e&&(e=!0),this._doScroll(0,1,!0,!0,t,e)},i.scrollToTopRight=function(t,e){void 0===e&&(e=!0),this._doScroll(1,1,!0,!0,t,e)},i.scrollToBottomLeft=function(t,e){void 0===e&&(e=!0),this._doScroll(0,0,!0,!0,t,e)},i.scrollToBottomRight=function(t,e){void 0===e&&(e=!0),this._doScroll(1,0,!0,!0,t,e)},i.scrollToOffset=function(t,e,i){void 0===i&&(i=!0);var n=this.getMaxScrollOffset(),r=_s();0===n.x?r.x=0:r.x=t.x/n.x,0===n.y?r.y=1:r.y=(n.y-t.y)/n.y,this.scrollTo(r,e,i)},i.getScrollOffset=function(){var t=this._getContentTopBoundary()-this._topBoundary,e=this._getContentLeftBoundary()-this._leftBoundary;return new ds(e,t)},i.getMaxScrollOffset=function(){if(!this._content||!this.view)return ds.ZERO;var t=this._content._getUITransformComp().contentSize,e=t.width-this.view.width,i=t.height-this.view.height;return new ds(e=e>=0?e:0,i=i>=0?i:0)},i.scrollToPercentHorizontal=function(t,e,i){this._doScroll(t,0,!0,!1,e,i)},i.scrollTo=function(t,e,i){this._doScroll(t.x,t.y,!0,!0,e,i)},i.scrollToPercentVertical=function(t,e,i){this._doScroll(0,t,!1,!0,e,i)},i._doScroll=function(t,e,i,n,r,s){void 0===s&&(s=!0),DJt(t,e,i,n);var a=this._calculateMovePercentDelta(AJt);r?this._startAutoScroll(a,r,s):this._moveContent(a)},i.stopAutoScroll=function(){this._autoScrolling=!1,this._autoScrollAccumulatedTime=this._autoScrollTotalTime},i.setContentPosition=function(t){this._setContentPosition(t)},i._setContentPosition=function(t){if(this._content){var e=this._getContentPosition();Math.abs(t.x-e.x)7&&!i._touchMoved&&t.target!==i.node){var s=new Xv(t.getTouches(),t.bubbles,"touch-cancel");s.touch=t.touch,s.simulate=!0,t.target.dispatchEvent(s),i._touchMoved=!0}i._stopPropagationIfTargetIsMe(t)}}},i._onTouchEnded=function(t,e){var i=this;if(i.enabledInHierarchy&&i._content&&t&&!i._hasNestedViewGroup(t,e)){i._dispatchEvent("touch-up");var n=t.touch;i._handleReleaseLogic(n),i._touchMoved?t.propagationStopped=!0:i._stopPropagationIfTargetIsMe(t)}},i._onTouchCancelled=function(t,e){var i=this;i.enabledInHierarchy&&i._content&&(i._hasNestedViewGroup(t,e)||(t&&!t.simulate&&i._handleReleaseLogic(t.touch),i._stopPropagationIfTargetIsMe(t)))},i._calculateBoundary=function(){var t=this;if(t._content&&t.view){var e=t._content.getComponent(dQt);e&&e.enabledInHierarchy&&e.updateLayout();var i=t.view,n=i.width*i.anchorX,r=i.height*i.anchorY;t._leftBoundary=-n,t._bottomBoundary=-r,t._rightBoundary=t._leftBoundary+i.width,t._topBoundary=t._bottomBoundary+i.height,t._moveContentToTopLeft(i.contentSize)}},i._hasNestedViewGroup=function(t,e){if(!t||t.eventPhase!==Gv.CAPTURING_PHASE)return!1;if(e)for(var i=0;i0&&l>7?(l=Math.sqrt(l),i.set(t),i.multiplyScalar(l+1)):i.add(t);var c=this._calculateAutoScrollTimeByInitialSpeed(e.length());this.brake>0&&l>3&&(c*=l=3),0===this.brake&&l>1&&(c*=l),this._startAutoScroll(i,c,!0)},i._calculateAutoScrollTimeByInitialSpeed=function(t){return Math.sqrt(Math.sqrt(t/5))},i._startAutoScroll=function(t,e,i){void 0===i&&(i=!1);var n=this,r=n._flattenVectorByDirection(t);n._autoScrolling=!0,n._autoScrollTargetDelta=r,n._autoScrollAttenuate=i,ir.copy(n._autoScrollStartPosition,n._getContentPosition()),n._autoScrollTotalTime=e,n._autoScrollAccumulatedTime=0,n._autoScrollBraking=!1,n._isScrollEndedWithThresholdEventFired=!1,n._autoScrollBrakingStartPosition.set(0,0,0),n._getHowMuchOutOfBoundary().equals(ir.ZERO,yJt)||(this._autoScrollCurrentlyOutOfBoundary=!0)},i._calculateTouchMoveVelocity=function(){var t=new ir,e=0;if((e=this._touchMoveTimeDeltas.reduce((function(t,e){return t+e}),e))<=0||e>=.5)t.set(ir.ZERO);else{var i=bJt;i.set(0,0,0),i=this._touchMoveDisplacements.reduce((function(t,e){return t.add(e),t}),i),t.set(i.x*(1-this.brake)/e,i.y*(1-this.brake)/e,i.z)}return t},i._flattenVectorByDirection=function(t){return this.horizontal||(t.x=0),this.vertical||(t.y=0),t},i._moveContent=function(t,e){var i=this._flattenVectorByDirection(t);bJt.set(this._getContentPosition()),bJt.add(i),bJt.set(Math.round(1e4*bJt.x)*yJt,Math.round(1e4*bJt.y)*yJt,bJt.z),this._setContentPosition(bJt);var n=this._getHowMuchOutOfBoundary();xJt.set(n.x,n.y),this._updateScrollBar(xJt),this.elastic&&e&&this._startBounceBackIfNeeded()},i._getContentLeftBoundary=function(){if(!this._content)return-1;var t=this._getContentPosition(),e=this._content._getUITransformComp();return t.x-e.anchorX*e.width},i._getContentRightBoundary=function(){if(!this._content)return-1;var t=this._content._getUITransformComp();return this._getContentLeftBoundary()+t.width},i._getContentTopBoundary=function(){if(!this._content)return-1;var t=this._content._getUITransformComp();return this._getContentBottomBoundary()+t.height},i._getContentBottomBoundary=function(){if(!this._content)return-1;var t=this._getContentPosition(),e=this._content._getUITransformComp();return t.y-e.anchorY*e.height},i._getHowMuchOutOfBoundary=function(t){if(t||(t=ir.ZERO),t.equals(ir.ZERO,yJt)&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount;var e=new ir,i=this._getContentLeftBoundary(),n=this._getContentRightBoundary();i+t.x>this._leftBoundary?e.x=this._leftBoundary-(i+t.x):n+t.xthis._bottomBoundary&&(e.y=this._bottomBoundary-(s+t.y)),t.equals(ir.ZERO,yJt)&&(this._outOfBoundaryAmount=e,this._outOfBoundaryAmountDirty=!1),this._clampDelta(e),e},i._updateScrollBar=function(t){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.onScroll(t),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.onScroll(t)},i._onScrollBarTouchBegan=function(){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.onTouchBegan(),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.onTouchBegan()},i._onScrollBarTouchEnded=function(){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.onTouchEnded(),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.onTouchEnded()},i._dispatchEvent=function(t){if("scroll-ended"===t)this._scrollEventEmitMask=0;else if("scroll-to-top"===t||"scroll-to-bottom"===t||"scroll-to-left"===t||"scroll-to-right"===t){var e=1<0?c.y-h*l+n.y>=e._bottomBoundary&&(r="scroll-to-bottom"):n.y<0&&c.y-h*l+l+n.y<=e._topBoundary&&(r="scroll-to-top")),e.horizontal&&(n.x<0?c.x-o*u+u+n.x<=e._rightBoundary&&(s="scroll-to-right"):n.x>0&&c.x-o*u+n.x>=e._leftBoundary&&(s="scroll-to-left"))}e._moveContent(n,!1),(e.horizontal&&0!==n.x||e.vertical&&0!==n.y)&&(e._scrolling||(e._scrolling=!0,e._dispatchEvent("scroll-began")),e._dispatchEvent("scrolling")),""!==r&&e._dispatchEvent(r),""!==s&&e._dispatchEvent(s)},i._handlePressLogic=function(){var t=this;t._autoScrolling&&t._dispatchEvent("scroll-ended"),t._autoScrolling=!1,t._isBouncing=!1,t._touchMovePreviousTimestamp=TJt(),t._touchMoveDisplacements.length=0,t._touchMoveTimeDeltas.length=0,t._onScrollBarTouchBegan()},i._clampDelta=function(t){if(this._content&&this.view){var e=this.view.contentSize,i=this._content._getUITransformComp();i.width=5;)e._touchMoveDisplacements.shift(),e._touchMoveTimeDeltas.shift();e._touchMoveDisplacements.push(i);var n=TJt();e._touchMoveTimeDeltas.push((n-e._touchMovePreviousTimestamp)/1e3),e._touchMovePreviousTimestamp=n},i._startBounceBackIfNeeded=function(){var t=this;if(!t.elastic)return!1;var e=t._getHowMuchOutOfBoundary();if(t._clampDelta(e),e.equals(ir.ZERO,yJt))return!1;var i=Math.max(t.bounceDuration,0);return t._startAutoScroll(e,i,!0),t._isBouncing||(e.y>0&&t._dispatchEvent("bounce-top"),e.y<0&&t._dispatchEvent("bounce-bottom"),e.x>0&&t._dispatchEvent("bounce-right"),e.x<0&&t._dispatchEvent("bounce-left"),t._isBouncing=!0),!0},i._processInertiaScroll=function(){if(!this._startBounceBackIfNeeded()&&this.inertia){var t=this._calculateTouchMoveVelocity();!t.equals(ir.ZERO,yJt)&&this.brake<1&&this._startInertiaScroll(t)}this._onScrollBarTouchEnded()},i._isOutOfBoundary=function(){return!this._getHowMuchOutOfBoundary().equals(ir.ZERO,yJt)},i._isNecessaryAutoScrollBrake=function(){var t=this;if(t._autoScrollBraking)return!0;if(t._isOutOfBoundary()){if(!t._autoScrollCurrentlyOutOfBoundary)return t._autoScrollCurrentlyOutOfBoundary=!0,t._autoScrollBraking=!0,ir.copy(t._autoScrollBrakingStartPosition,t._getContentPosition()),!0}else t._autoScrollCurrentlyOutOfBoundary=!1;return!1},i._processAutoScrolling=function(t){var e=this,i=e._isNecessaryAutoScrollBrake(),n=i?.05:1;e._autoScrollAccumulatedTime+=t*(1/n);var r,s=Math.min(1,e._autoScrollAccumulatedTime/e._autoScrollTotalTime);e._autoScrollAttenuate&&(r=s,s=(r-=1)*r*r*r*r+1);var a=e._autoScrollTargetDelta.clone();a.multiplyScalar(s);var o=e._autoScrollStartPosition.clone();o.add(a);var h=Math.abs(s-1)<=yJt;if(Math.abs(s-1)<=e.getScrollEndedEventTiming()&&!e._isScrollEndedWithThresholdEventFired&&(e._dispatchEvent("scroll-ended-with-threshold"),e._isScrollEndedWithThresholdEventFired=!0),e.elastic){var u=o.clone();u.subtract(e._autoScrollBrakingStartPosition),i&&u.multiplyScalar(n),o.set(e._autoScrollBrakingStartPosition),o.add(u)}else{var l=o.clone();l.subtract(e.getContentPosition());var c=e._getHowMuchOutOfBoundary(l);c.equals(ir.ZERO,yJt)||(o.add(c),h=!0)}h&&(e._autoScrolling=!1);var f=o.clone();f.subtract(e._getContentPosition()),e._clampDelta(f),e._moveContent(f,h),e._dispatchEvent("scrolling"),e._autoScrolling||(e._isBouncing=!1,e._scrolling=!1,e._dispatchEvent("scroll-ended"))},i._checkMouseWheel=function(t){var e=this;if(!e._getHowMuchOutOfBoundary().equals(ir.ZERO,yJt))return e._processInertiaScroll(),e._scrolling&&(e._scrolling=!1,e._autoScrolling||e._dispatchEvent("scroll-ended")),e.unschedule(e._checkMouseWheel),void(e._stopMouseWheel=!1);e._mouseWheelEventElapsedTime+=t,e._mouseWheelEventElapsedTime>.1&&(e._onScrollBarTouchEnded(),e._scrolling&&(e._scrolling=!1,e._autoScrolling||e._dispatchEvent("scroll-ended")),e.unschedule(e._checkMouseWheel),e._stopMouseWheel=!1)},i._calculateMovePercentDelta=function(t){var e=t.anchor,i=t.applyToHorizontal,n=t.applyToVertical,r=this;r._calculateBoundary(),e.clampf(ds.ZERO,ds.ONE);var s=r._getContentBottomBoundary()-r._bottomBoundary;s=-s;var a=r._getContentLeftBoundary()-r._leftBoundary;a=-a;var o=new ir;if(r._content&&r.view){var h=0,u=r._content._getUITransformComp().contentSize,l=r.view.contentSize;i&&(h=u.width-l.width,o.x=a-h*e.x),n&&(h=u.height-l.height,o.y=s-h*e.y)}return o},i._moveContentToTopLeft=function(t){var e=this,i=e._getContentBottomBoundary()-e._bottomBoundary;i=-i;var n=new ir,r=0,s=e._getContentLeftBoundary()-e._leftBoundary;if(s=-s,e._content){var a=e._content._getUITransformComp().contentSize;a.height1)for(var n=i[0],r=0;r0){var i=this.node.parent&&this.node.parent._uiProps,n=i&&i.uiTransformComp,r=n?n.contentSize:hh;this.isAlignLeft&&8===t?this._left=e?this._left*r.width:this._left/r.width:this.isAlignRight&&32===t?this._right=e?this._right*r.width:this._right/r.width:this.isAlignHorizontalCenter&&16===t?this._horizontalCenter=e?this._horizontalCenter*r.width:this._horizontalCenter/r.width:this.isAlignTop&&1===t?this._top=e?this._top*r.height:this._top/r.height:this.isAlignBottom&&4===t?this._bottom=e?this._bottom*r.height:this._bottom/r.height:this.isAbsoluteVerticalCenter&&2===t&&(this._verticalCenter=this._verticalCenter/r.height),this._recursiveDirty()}},i._registerTargetEvents=function(){var t=this._target||this.node.parent;t&&t.getComponent(rL)&&(t.on("transform-changed",this._setDirtyByMode,this),t.on("size-changed",this._setDirtyByMode,this),t.on("anchor-changed",this._setDirtyByMode,this))},i._unregisterTargetEvents=function(){var t=this._target||this.node.parent;t&&(t.off("transform-changed",this._setDirtyByMode,this),t.off("size-changed",this._setDirtyByMode,this),t.off("anchor-changed",this._setDirtyByMode,this))},i._unregisterOldParentEvents=function(t){var e=this._target||t;e&&(e.off("transform-changed",this._setDirtyByMode,this),e.off("size-changed",this._setDirtyByMode,this))},i._setDirtyByMode=function(){1===this.alignMode&&this._recursiveDirty()},i._setAlign=function(t,e){if(e!==(this._alignFlags&t)>0){var i=(40&t)>0,n=this.node._getUITransformComp();e?(this._alignFlags|=t,i?(this.isAlignHorizontalCenter=!1,this.isStretchWidth&&(this._originalWidth=n.width)):(this.isAlignVerticalCenter=!1,this.isStretchHeight&&(this._originalHeight=n.height))):(i?this.isStretchWidth&&(n.width=this._originalWidth):this.isStretchHeight&&(n.height=this._originalHeight),this._alignFlags&=~t)}},i._recursiveDirty=function(){this._dirty||(this._dirty=!0)},n(e,[{key:"target",get:function(){return this._target},set:function(t){this._target!==t&&(this._unregisterTargetEvents(),this._target=t,this._registerTargetEvents(),this._validateTargetInDEV(),this._recursiveDirty())}},{key:"isAlignTop",get:function(){return(1&this._alignFlags)>0},set:function(t){this._setAlign(1,t),this._recursiveDirty()}},{key:"isAlignBottom",get:function(){return(4&this._alignFlags)>0},set:function(t){this._setAlign(4,t),this._recursiveDirty()}},{key:"isAlignLeft",get:function(){return(8&this._alignFlags)>0},set:function(t){this._setAlign(8,t),this._recursiveDirty()}},{key:"isAlignRight",get:function(){return(32&this._alignFlags)>0},set:function(t){this._setAlign(32,t),this._recursiveDirty()}},{key:"isAlignVerticalCenter",get:function(){return(2&this._alignFlags)>0},set:function(t){t?(this.isAlignTop=!1,this.isAlignBottom=!1,this._alignFlags|=2):this._alignFlags&=-3,this._recursiveDirty()}},{key:"isAlignHorizontalCenter",get:function(){return(16&this._alignFlags)>0},set:function(t){t?(this.isAlignLeft=!1,this.isAlignRight=!1,this._alignFlags|=16):this._alignFlags&=-17,this._recursiveDirty()}},{key:"isStretchWidth",get:function(){return!(40&~this._alignFlags)}},{key:"isStretchHeight",get:function(){return!(5&~this._alignFlags)}},{key:"top",get:function(){return this._top},set:function(t){this._top=t,this._recursiveDirty()}},{key:"editorTop",get:function(){return this._isAbsTop?this._top:100*this._top},set:function(t){this._top=this._isAbsTop?t:t/100,this._recursiveDirty()}},{key:"bottom",get:function(){return this._bottom},set:function(t){this._bottom=t,this._recursiveDirty()}},{key:"editorBottom",get:function(){return this._isAbsBottom?this._bottom:100*this._bottom},set:function(t){this._bottom=this._isAbsBottom?t:t/100,this._recursiveDirty()}},{key:"left",get:function(){return this._left},set:function(t){this._left=t,this._recursiveDirty()}},{key:"editorLeft",get:function(){return this._isAbsLeft?this._left:100*this._left},set:function(t){this._left=this._isAbsLeft?t:t/100,this._recursiveDirty()}},{key:"right",get:function(){return this._right},set:function(t){this._right=t,this._recursiveDirty()}},{key:"editorRight",get:function(){return this._isAbsRight?this._right:100*this._right},set:function(t){this._right=this._isAbsRight?t:t/100,this._recursiveDirty()}},{key:"horizontalCenter",get:function(){return this._horizontalCenter},set:function(t){this._horizontalCenter=t,this._recursiveDirty()}},{key:"editorHorizontalCenter",get:function(){return this._isAbsHorizontalCenter?this._horizontalCenter:100*this._horizontalCenter},set:function(t){this._horizontalCenter=this._isAbsHorizontalCenter?t:t/100,this._recursiveDirty()}},{key:"verticalCenter",get:function(){return this._verticalCenter},set:function(t){this._verticalCenter=t,this._recursiveDirty()}},{key:"editorVerticalCenter",get:function(){return this._isAbsVerticalCenter?this._verticalCenter:100*this._verticalCenter},set:function(t){this._verticalCenter=this._isAbsVerticalCenter?t:t/100,this._recursiveDirty()}},{key:"isAbsoluteTop",get:function(){return this._isAbsTop},set:function(t){this._isAbsTop!==t&&(this._isAbsTop=t,this._autoChangedValue(1,this._isAbsTop))}},{key:"isAbsoluteBottom",get:function(){return this._isAbsBottom},set:function(t){this._isAbsBottom!==t&&(this._isAbsBottom=t,this._autoChangedValue(4,this._isAbsBottom))}},{key:"isAbsoluteLeft",get:function(){return this._isAbsLeft},set:function(t){this._isAbsLeft!==t&&(this._isAbsLeft=t,this._autoChangedValue(8,this._isAbsLeft))}},{key:"isAbsoluteRight",get:function(){return this._isAbsRight},set:function(t){this._isAbsRight!==t&&(this._isAbsRight=t,this._autoChangedValue(32,this._isAbsRight))}},{key:"isAbsoluteHorizontalCenter",get:function(){return this._isAbsHorizontalCenter},set:function(t){this._isAbsHorizontalCenter!==t&&(this._isAbsHorizontalCenter=t,this._autoChangedValue(16,this._isAbsHorizontalCenter))}},{key:"isAbsoluteVerticalCenter",get:function(){return this._isAbsVerticalCenter},set:function(t){this._isAbsVerticalCenter!==t&&(this._isAbsVerticalCenter=t,this._autoChangedValue(2,this._isAbsVerticalCenter))}},{key:"alignMode",get:function(){return this._alignMode},set:function(t){this._alignMode=t,this._recursiveDirty()}},{key:"alignFlags",get:function(){return this._alignFlags},set:function(t){this._alignFlags!==t&&(this._alignFlags=t,this._recursiveDirty())}}]),e}(gg),TKt.AlignMode=BKt,y((sKt=TKt).prototype,"target",[iKt],Object.getOwnPropertyDescriptor(sKt.prototype,"target"),sKt.prototype),y(sKt.prototype,"alignMode",[nKt],Object.getOwnPropertyDescriptor(sKt.prototype,"alignMode"),sKt.prototype),aKt=Nh(sKt.prototype,"_alignFlags",[hu],(function(){return 0})),oKt=Nh(sKt.prototype,"_target",[hu],(function(){return null})),hKt=Nh(sKt.prototype,"_left",[hu],(function(){return 0})),uKt=Nh(sKt.prototype,"_right",[hu],(function(){return 0})),lKt=Nh(sKt.prototype,"_top",[hu],(function(){return 0})),cKt=Nh(sKt.prototype,"_bottom",[hu],(function(){return 0})),fKt=Nh(sKt.prototype,"_horizontalCenter",[hu],(function(){return 0})),dKt=Nh(sKt.prototype,"_verticalCenter",[hu],(function(){return 0})),_Kt=Nh(sKt.prototype,"_isAbsLeft",[hu],(function(){return!0})),pKt=Nh(sKt.prototype,"_isAbsRight",[hu],(function(){return!0})),mKt=Nh(sKt.prototype,"_isAbsTop",[hu],(function(){return!0})),gKt=Nh(sKt.prototype,"_isAbsBottom",[hu],(function(){return!0})),vKt=Nh(sKt.prototype,"_isAbsHorizontalCenter",[hu],(function(){return!0})),yKt=Nh(sKt.prototype,"_isAbsVerticalCenter",[hu],(function(){return!0})),bKt=Nh(sKt.prototype,"_originalWidth",[hu],(function(){return 0})),SKt=Nh(sKt.prototype,"_originalHeight",[hu],(function(){return 0})),xKt=Nh(sKt.prototype,"_alignMode",[hu],(function(){return 2})),wKt=Nh(sKt.prototype,"_lockFlags",[hu,lu],(function(){return 0})),rKt=sKt))||rKt)||rKt)||rKt));C.internal.computeInverseTransForTarget=IKt,C.internal.getReadonlyNodeSize=DKt,C.Widget=HKt;var WKt=new cr,jKt={HORIZONTAL:0,VERTICAL:1};Oe(jKt);var qKt,XKt,YKt,QKt,JKt,KKt,ZKt,$Kt,tZt,eZt,iZt,nZt,rZt,sZt,aZt,oZt,hZt,uZt,lZt,cZt,fZt,dZt,_Zt,pZt,mZt=t("h3",(MKt=Qh("cc.PageViewIndicator"),PKt=Kh(110),EKt=Eu(KR),kKt=Eu(jKt),RKt=Eu(ps),MKt(OKt=PKt((UKt=function(t){function e(){var e;return(e=t.call(this)||this).spacing=LKt&&LKt(),e._spriteFrame=VKt&&VKt(),e._direction=NKt&&NKt(),e._cellSize=zKt&&zKt(),e._layout=null,e._pageView=null,e._indicators=[],e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._updateLayout()},i.setPageView=function(t){this._pageView=t,this._refresh()},i._updateLayout=function(){this._layout=this.getComponent(dQt),this._layout||(this._layout=this.addComponent(dQt));var t=this._layout;0===this.direction?(t.type=1,t.spacingX=this.spacing):1===this.direction&&(t.type=2,t.spacingY=this.spacing),t.resizeMode=1},i._createIndicator=function(){var t=new tb;t.layer=this.node.layer;var e=t.addComponent(FV);return e.spriteFrame=this.spriteFrame,e.sizeMode=0,t.parent=this.node,t._getUITransformComp().setContentSize(this._cellSize),t},i._changedState=function(){var t=this._indicators;if(0!==t.length&&this._pageView){var e=this._pageView.curPageIdx;if(!(e>=t.length)){for(var i=0;it.length)for(i=0;i0;--i){var n=t[i-1];this.node.removeChild(n),t.splice(i-1,1)}this._layout&&this._layout.enabledInHierarchy&&this._layout.updateLayout(),this._changedState()}}},n(e,[{key:"spriteFrame",get:function(){return this._spriteFrame},set:function(t){this._spriteFrame!==t&&(this._spriteFrame=t)}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t)}},{key:"cellSize",get:function(){return this._cellSize},set:function(t){this._cellSize!==t&&(this._cellSize=t)}}]),e}(gg),UKt.Direction=jKt,y((FKt=UKt).prototype,"spriteFrame",[EKt],Object.getOwnPropertyDescriptor(FKt.prototype,"spriteFrame"),FKt.prototype),y(FKt.prototype,"direction",[kKt],Object.getOwnPropertyDescriptor(FKt.prototype,"direction"),FKt.prototype),y(FKt.prototype,"cellSize",[RKt],Object.getOwnPropertyDescriptor(FKt.prototype,"cellSize"),FKt.prototype),LKt=Nh(FKt.prototype,"spacing",[hu],(function(){return 0})),VKt=Nh(FKt.prototype,"_spriteFrame",[hu],(function(){return null})),NKt=Nh(FKt.prototype,"_direction",[hu],(function(){return 0})),zKt=Nh(FKt.prototype,"_cellSize",[hu],(function(){return new ps(20,20)})),OKt=FKt))||OKt)||OKt));A.PageViewIndicator=mZt;var gZt=new ds,vZt={Unified:0,Free:1};Oe(vZt);var yZt={HORIZONTAL:0,VERTICAL:1};Oe(yZt);var bZt=t("h2",(qKt=Qh("cc.PageView"),XKt=Kh(110),YKt=Eu(vZt),QKt=Eu(yZt),JKt=Eu(mZt),KKt=Eu(LQt),ZKt=Eu(LQt),$Kt=Eu([pg]),tZt=Eu([pg]),qKt(eZt=XKt((pZt=function(t){function e(){var e;return(e=t.call(this)||this).autoPageTurningThreshold=nZt&&nZt(),e.horizontal=rZt&&rZt(),e.vertical=sZt&&sZt(),e.cancelInnerEvents=aZt&&aZt(),e.scrollEvents=oZt&&oZt(),e.pageTurningSpeed=hZt&&hZt(),e.pageEvents=uZt&&uZt(),e._sizeMode=lZt&&lZt(),e._direction=cZt&&cZt(),e._scrollThreshold=fZt&&fZt(),e._pageTurningEventTiming=dZt&&dZt(),e._indicator=_Zt&&_Zt(),e._curPageIdx=0,e._lastPageIdx=0,e._pages=[],e._initContentPos=nr(),e._scrollCenterOffsetX=[],e._scrollCenterOffsetY=[],e._touchBeganPosition=_s(),e._touchEndPosition=_s(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this.node.on("size-changed",this._updateAllPagesSize,this),this.node.on(e.EventType.SCROLL_ENG_WITH_THRESHOLD,this._dispatchPageTurningEvent,this)},i.onDisable=function(){t.prototype.onDisable.call(this),this.node.off("size-changed",this._updateAllPagesSize,this),this.node.off(e.EventType.SCROLL_ENG_WITH_THRESHOLD,this._dispatchPageTurningEvent,this)},i.onLoad=function(){this._initPages(),this.indicator&&this.indicator.setPageView(this)},i.getCurrentPageIndex=function(){return this._curPageIdx},i.setCurrentPageIndex=function(t){this.scrollToPage(t,1)},i.getPages=function(){return this._pages},i.addPage=function(t){t&&-1===this._pages.indexOf(t)&&this.content&&(t._getUITransformComp()?(this.content.addChild(t),this._pages.push(t),this._updatePageView()):it(4301))},i.insertPage=function(t,e){if(!(e<0)&&t&&-1===this._pages.indexOf(t)&&this.content)if(e>=this._pages.length)this.addPage(t);else{if(!t._getUITransformComp())return void it(4301);this._pages.splice(e,0,t),this.content.insertChild(t,e),this._updatePageView()}},i.removePage=function(t){if(t&&this.content){var e=this._pages.indexOf(t);-1!==e?this.removePageAtIndex(e):at(4300,t.name)}},i.removePageAtIndex=function(t){var e=this._pages;if(!(t<0||t>=e.length)){var i=e[t];i&&this.content&&(this.content.removeChild(i),e.splice(t,1),this._updatePageView())}},i.removeAllPages=function(){if(this.content){for(var t=this._pages,e=0,i=t.length;e=this._pages.length||(this._curPageIdx=t,this.scrollToOffset(this._moveOffsetValue(t),e,!0),this.indicator&&this.indicator._changedState())},i.getScrollEndedEventTiming=function(){return this.pageTurningEventTiming},i._updatePageView=function(){if(this.content){var t=this.content.getComponent(dQt);t&&t.enabled&&t.updateLayout();var e=this._pages.length;this._curPageIdx>=e&&(this._curPageIdx=0===e?0:e-1,this._lastPageIdx=this._curPageIdx);for(var i=this._initContentPos,n=0;n0){var i=this._pages[0]._getUITransformComp(),n=this._pages[this._pages.length-1]._getUITransformComp();0===this.direction?(e.paddingLeft=(t.width-i.width)/2,e.paddingRight=(t.width-n.width)/2):1===this.direction&&(e.paddingTop=(t.height-i.height)/2,e.paddingBottom=(t.height-n.height)/2)}e.updateLayout()}}},i._initPages=function(){if(this.content){this._initContentPos=this.content.position;for(var t=this.content.children,e=0;e=0||this._pages.push(i)}this._syncScrollDirection(),this._syncSizeMode(),this._updatePageView()}},i._dispatchPageTurningEvent=function(){this._lastPageIdx!==this._curPageIdx&&(this._lastPageIdx=this._curPageIdx,pg.emitEvents(this.pageEvents,this,"page-turning"),this.node.emit("page-turning",this))},i._isQuicklyScrollable=function(t){if(0===this.direction){if(Math.abs(t.x)>this.autoPageTurningThreshold)return!0}else if(1===this.direction&&Math.abs(t.y)>this.autoPageTurningThreshold)return!0;return!1},i._moveOffsetValue=function(t){var e=new ds;if(1===this._sizeMode)0===this.direction?e.x=this._scrollCenterOffsetX[t]:1===this.direction&&(e.y=this._scrollCenterOffsetY[t]);else{var i=this.view;if(!i)return e;0===this.direction?e.x=t*i.width:1===this.direction&&(e.y=t*i.height)}return e},i._getDragDirection=function(t){return 0===this._direction?0===t.x?0:t.x>0?1:-1:0===t.y?0:t.y<0?1:-1},i._isScrollable=function(t,e,i){if(1===this._sizeMode){var n=0,r=0;if(0===this.direction)return n=this._scrollCenterOffsetX[e],r=this._scrollCenterOffsetX[i],Math.abs(t.x)>=Math.abs(n-r)*this.scrollThreshold;if(1===this.direction)return n=this._scrollCenterOffsetY[e],r=this._scrollCenterOffsetY[i],Math.abs(t.y)>=Math.abs(n-r)*this.scrollThreshold}else{var s=this.view;if(!s)return!1;if(0===this.direction)return Math.abs(t.x)>=s.width*this.scrollThreshold;if(1===this.direction)return Math.abs(t.y)>=s.height*this.scrollThreshold}return!1},i._autoScrollToPage=function(){if(this._startBounceBackIfNeeded()){var t=this._getHowMuchOutOfBoundary();this._clampDelta(t),(t.x>0||t.y<0)&&(this._curPageIdx=0===this._pages.length?0:this._pages.length-1),(t.x<0||t.y>0)&&(this._curPageIdx=0),this.indicator&&this.indicator._changedState()}else{var e=new ds;ds.subtract(e,this._touchBeganPosition,this._touchEndPosition);var i=this._curPageIdx,n=i+this._getDragDirection(e),r=this.pageTurningSpeed*Math.abs(i-n);if(n1e-10?e:t}var n=t.node,r=n.parent;if(r){var s=CZt;s.set(0,0);var a=AZt;if(a.set(1,1),t.target&&IKt(n,r=t.target,s,a),!e)return;var o=r._uiProps&&r._getUITransformComp(),h=o?o.anchorPoint:xZt,u=n._getUITransformComp(),l=DKt(r),c=u.anchorPoint,f=n.position,d=GKt,_=n.scale,p=0;if(e&d.LEFT){var m=-h.x*l.width;m+=s.x,m*=a.x,p=f.x-c.x*u.width*Math.abs(_.x)-m,t.isAbsoluteLeft||(p/=l.width),p/=a.x,t.left=i(t.left,p)}if(e&d.RIGHT){var g=(1-h.x)*l.width;g+=s.x,p=(g*=a.x)-(f.x+(1-c.x)*u.width*Math.abs(_.x)),t.isAbsoluteRight||(p/=l.width),p/=a.x,t.right=i(t.right,p)}if(e&d.TOP){var v=(1-h.y)*l.height;v+=s.y,p=(v*=a.y)-(f.y+(1-c.y)*u.height*Math.abs(_.y)),t.isAbsoluteTop||(p/=l.height),p/=a.y,t.top=i(t.top,p)}if(e&d.BOT){var y=-h.y*l.height;y+=s.y,y*=a.y,p=f.y-c.y*u.height*Math.abs(_.y)-y,t.isAbsoluteBottom||(p/=l.height),p/=a.y,t.bottom=i(t.bottom,p)}}},updateAlignment:function t(e){var i=e.parent;i&&tb.isNode(i)&&t(i);var n=e.getComponent(HKt);n&&i&&DZt(e,n)},AlignMode:BKt,AlignFlags:GKt});GE.on("director_init",(function(){RZt.init()}));var OZt,FZt,LZt,VZt,NZt,zZt,UZt,GZt,HZt,WZt,jZt,qZt,XZt=t("h4",Qh("cc.SafeArea")(MZt=Kh(110)(MZt=Jh(HKt)((PZt=function(t){function e(){var e;return(e=t.call(this)||this)._symmetric=EZt&&EZt(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){this.updateArea(),rh.on("window-resize",this.updateArea,this),rh.on("orientation-change",this.updateArea,this)},i.onDisable=function(){rh.off("window-resize",this.updateArea,this),rh.off("orientation-change",this.updateArea,this)},i.updateArea=function(){var t=this.node.getComponent(HKt),e=this.node.getComponent(rL);if(t&&e){t.updateAlignment();var i=this.node.position.clone(),n=e.anchorPoint.clone();t.isAlignTop=t.isAlignBottom=t.isAlignLeft=t.isAlignRight=!0;var r=Rk.getVisibleSize(),s=r.width,a=r.height,o=oh.getSafeAreaRect(this._symmetric);t.top=a-o.y-o.height,t.bottom=o.y,t.left=o.x,t.right=s-o.x-o.width,t.updateAlignment();var h=this.node.position.clone(),u=n.x-(h.x-i.x)/e.width,l=n.y-(h.y-i.y)/e.height;e.setAnchorPoint(u,l),RZt.add(t)}},n(e,[{key:"symmetric",get:function(){return this._symmetric},set:function(t){this._symmetric=t}}]),e}(gg),EZt=Nh(PZt.prototype,"_symmetric",[hu],(function(){return!0})),MZt=PZt))||MZt)||MZt)||MZt);A.SafeArea=XZt;var YZt,QZt=t("h5",(OZt=Qh("cc.UICoordinateTracker"),FZt=Kh(110),LZt=Eu(tb),VZt=Eu(Jz),NZt=Eu([pg]),OZt(zZt=FZt((UZt=function(t){function e(){var e;return(e=t.call(this)||this).syncEvents=GZt&&GZt(),e._target=HZt&&HZt(),e._camera=WZt&&WZt(),e._useScale=jZt&&jZt(),e._distance=qZt&&qZt(),e._transformPos=nr(),e._viewPos=nr(),e._canMove=!0,e._lastWPos=nr(),e._lastCameraPos=nr(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){this._checkCanMove()},i.update=function(){var t=this.node.worldPosition,e=this._camera;if(this._canMove&&e&&e.camera&&(!this._lastWPos.equals(t)||!this._lastCameraPos.equals(e.node.worldPosition))&&(this._lastWPos.set(t),this._lastCameraPos.set(e.node.worldPosition),e.camera.update(),e.convertToUINode(t,this._target,this._transformPos),this._useScale&&ir.transformMat4(this._viewPos,this.node.worldPosition,e.camera.matView),this.syncEvents.length>0)){var i=this._distance/Math.abs(this._viewPos.z);pg.emitEvents(this.syncEvents,this._transformPos,i)}},i._checkCanMove=function(){this._canMove=!(!this._camera||!this._target)},n(e,[{key:"target",get:function(){return this._target},set:function(t){this._target!==t&&(this._target=t,this._checkCanMove())}},{key:"camera",get:function(){return this._camera},set:function(t){this._camera!==t&&(this._camera=t,this._checkCanMove())}},{key:"useScale",get:function(){return this._useScale},set:function(t){this._useScale!==t&&(this._useScale=t)}},{key:"distance",get:function(){return this._distance},set:function(t){this._distance!==t&&(this._distance=t)}}]),e}(gg),y(UZt.prototype,"target",[LZt],Object.getOwnPropertyDescriptor(UZt.prototype,"target"),UZt.prototype),y(UZt.prototype,"camera",[VZt],Object.getOwnPropertyDescriptor(UZt.prototype,"camera"),UZt.prototype),GZt=Nh(UZt.prototype,"syncEvents",[NZt,hu],(function(){return[]})),HZt=Nh(UZt.prototype,"_target",[hu],(function(){return null})),WZt=Nh(UZt.prototype,"_camera",[hu],(function(){return null})),jZt=Nh(UZt.prototype,"_useScale",[hu],(function(){return!0})),qZt=Nh(UZt.prototype,"_distance",[hu],(function(){return 1})),zZt=UZt))||zZt)||zZt)),JZt=["touch-start","touch-end","touch-move","mouse-down","mouse-move","mouse-up","mouse-enter","mouse-leave","mouse-wheel"];function KZt(t){t.propagationStopped=!0}var ZZt,$Zt,t$t,e$t,i$t,n$t=t("h6",Qh("cc.BlockInputEvents")(YZt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){for(var t=0;tn?n:i;e.width*=r,e.height*=r;var s=Rk.getViewportRect(),a=e.getBoundingBoxToWorld(),o=Rk.getVisibleSize(),h=rh.devicePixelRatio,u=(s.width*(a.x/o.width)+s.x)/h,l=(s.height*(a.y/o.height)+s.y)/h,c=s.width*(a.width/o.width)/h,f=s.height*(a.height/o.height)/h;this._openDataContext.postMessage({fromEngine:!0,type:"engine",event:"viewport",x:u,y:l,width:c,height:f})}},i._updateSubContextTexture=function(){var t=this._imageAsset;if(t&&this._openDataContext&&!(t.width<=0||t.height<=0)){var e=this._openDataContext.canvas;t.reset(e),(e.width>t.width||e.height>t.height)&&this._texture.create(e.width,e.height),this._texture.uploadData(e)}},i._registerNodeEvent=function(){this.node.on("transform-changed",this._updateSubContextView,this),this.node.on("size-changed",this._updateSubContextView,this),this.node.on("layer-changed",this._updateContentLayer,this)},i._unregisterNodeEvent=function(){this.node.off("transform-changed",this._updateSubContextView,this),this.node.off("size-changed",this._updateSubContextView,this),this.node.off("layer-changed",this._updateContentLayer,this)},i._updateContentLayer=function(){this._content.layer=this.node.layer},i.update=function(t){void 0===t?this._updateSubContextTexture():performance.now()-this._updatedTime>=this._updateInterval&&(this._updatedTime+=this._updateInterval,this._updateSubContextTexture())},i.onDestroy=function(){this._content.destroy(),this._texture.destroy(),this._sprite&&this._sprite.destroy(),this._imageAsset.destroy(),this._openDataContext=null},n(e,[{key:"designResolutionSize",get:function(){return this._designResolutionSize},set:function(){}},{key:"fps",get:function(){return this._fps},set:function(t){this._fps!==t&&(this._fps=t,this._updateInterval=1e3/t)}}]),e}(gg),t$t=Nh($Zt.prototype,"_fps",[hu],(function(){return 60})),e$t=Nh($Zt.prototype,"_designResolutionSize",[hu],(function(){return new ps(640,960)})),ZZt=$Zt))||ZZt)||ZZt)||ZZt);A.SubContextView=r$t,Dt({ButtonComponent:{newName:"Button",since:"1.2.0",removed:!1},EditBoxComponent:{newName:"EditBox",since:"1.2.0",removed:!1},LayoutComponent:{newName:"Layout",since:"1.2.0",removed:!1},ProgressBarComponent:{newName:"ProgressBar",since:"1.2.0",removed:!1},ScrollViewComponent:{newName:"ScrollView",since:"1.2.0",removed:!1},ScrollBarComponent:{newName:"ScrollBar",since:"1.2.0",removed:!1},SliderComponent:{newName:"Slider",since:"1.2.0",removed:!1},ToggleComponent:{newName:"Toggle",since:"1.2.0",removed:!1},ToggleContainerComponent:{newName:"ToggleContainer",since:"1.2.0",removed:!1},WidgetComponent:{newName:"Widget",since:"1.2.0",removed:!1},PageViewComponent:{newName:"PageView",since:"1.2.0",removed:!1},PageViewIndicatorComponent:{newName:"PageViewIndicator",since:"1.2.0",removed:!1},SafeAreaComponent:{newName:"SafeArea",since:"1.2.0",removed:!1},UICoordinateTrackerComponent:{newName:"UICoordinateTracker",since:"1.2.0",removed:!1},BlockInputEventsComponent:{newName:"BlockInputEvents",since:"1.2.0",removed:!1}});var s$t,a$t,o$t,h$t,u$t,l$t,c$t,f$t=t("hc",Qh("cc.UIReorderComponent")(i$t=function(){at(1408,"UIReorderComponent")})||i$t);A.UIReorderComponent=f$t,A.ButtonComponent=MXt,le(MXt,"cc.ButtonComponent"),A.EditBoxComponent=qYt,le(qYt,"cc.EditBoxComponent"),A.LayoutComponent=dQt,le(dQt,"cc.LayoutComponent"),A.ProgressBarComponent=IQt,le(IQt,"cc.ProgressBarComponent"),A.ScrollViewComponent=BJt,le(BJt,"cc.ScrollViewComponent"),A.ScrollBarComponent=LQt,le(LQt,"cc.ScrollBarComponent"),A.SliderComponent=HJt,le(HJt,"cc.SliderComponent"),A.ToggleComponent=ZJt,le(ZJt,"cc.ToggleComponent"),A.ToggleContainerComponent=CKt,le(CKt,"cc.ToggleContainerComponent"),A.WidgetComponent=HKt,le(HKt,"cc.WidgetComponent"),A.PageViewComponent=bZt,le(bZt,"cc.PageViewComponent"),A.PageViewIndicatorComponent=mZt,le(mZt,"cc.PageViewIndicatorComponent"),A.SafeAreaComponent=XZt,le(XZt,"cc.SafeAreaComponent"),le(QZt,"cc.UICoordinateTrackerComponent"),A.BlockInputEventsComponent=n$t,le(n$t,"cc.BlockInputEventsComponent"),mt(wk.prototype,"View.prototype",[{name:"isAntiAliasEnabled",suggest:"The API of Texture2d have been largely modified, no alternative"},{name:"enableAntiAlias",suggest:"The API of Texture2d have been largely modified, no alternative"}]),gt(wk.prototype,"View.prototype",[{name:"adjustViewportMeta"},{name:"enableAutoFullScreen",suggest:"use screen.requestFullScreen() instead."},{name:"isAutoFullScreenEnabled"},{name:"setCanvasSize",suggest:"setting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"getCanvasSize",suggest:"please use screen.windowSize instead."},{name:"getFrameSize",suggest:"getting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"setFrameSize",suggest:"setting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"getDevicePixelRatio",suggest:"use screen.devicePixelRatio instead."},{name:"convertToLocationInView"},{name:"enableRetina"},{name:"isRetinaEnabled"},{name:"setRealPixelResolution"}]);var d$t,_$t,p$t,m$t=_s(),g$t=t("hd",(s$t=Qh("cc.UISkew"),a$t=Eu(fi),o$t=Eu(ds),s$t(h$t=Zh((u$t=function(t){function e(){var e;return(e=t.call(this)||this)._skew=l$t&&l$t(),e._rotational=c$t&&c$t(),e._skewEnabled=!1,e}s(e,t);var i=e.prototype;return i.isSkewEnabled=function(){return this._skewEnabled},i.__preload=function(){this.node._uiProps._uiSkewComp=this},i.onEnable=function(){this._skewEnabled=!0,tb._incSkewCompCount(),this._syncNative(!0),this._updateNodeTransformFlags()},i.onDisable=function(){this._skewEnabled=!1,tb._decSkewCompCount(),this._syncNative(!1),this._updateNodeTransformFlags()},i.onDestroy=function(){this._skewEnabled=!1,this._syncNative(!1),this.node._uiProps._uiSkewComp=null,this._updateNodeTransformFlags()},i._syncNative=function(){},i.setSkew=function(t,e){var i=this._skew;"number"==typeof t?m$t.set(t,e):ds.copy(m$t,t),ds.equals(i,m$t)||(i.set(m$t),this._skewEnabled&&this._updateNodeTransformFlags())},i.getSkew=function(t){return t||(t=new ds),t.set(this._skew)},i._updateNodeTransformFlags=function(){var t=this.node;t.invalidateChildren(8),1&t._eventMask&&t.emit("transform-changed",8)},n(e,[{key:"rotational",get:function(){return this._rotational},set:function(t){this._rotational=t,this._skewEnabled&&this._updateNodeTransformFlags()}},{key:"x",get:function(){return this._skew.x},set:function(t){this._skew.x=t,this._skewEnabled&&this._updateNodeTransformFlags()}},{key:"y",get:function(){return this._skew.y},set:function(t){this._skew.y=t,this._skewEnabled&&this._updateNodeTransformFlags()}},{key:"skew",get:function(){return this._skew},set:function(t){this.setSkew(t)}}]),e}(gg),l$t=Nh(u$t.prototype,"_skew",[hu],(function(){return _s()})),c$t=Nh(u$t.prototype,"_rotational",[hu],(function(){return!1})),y(u$t.prototype,"rotational",[a$t],Object.getOwnPropertyDescriptor(u$t.prototype,"rotational"),u$t.prototype),y(u$t.prototype,"skew",[o$t],Object.getOwnPropertyDescriptor(u$t.prototype,"skew"),u$t.prototype),h$t=u$t))||h$t)||h$t));C.UISkew=g$t;var v$t=t("he",Qh("cc.VideoClip")((_$t=function(t){function e(){var e;return(e=t.call(this)||this)._duration=p$t&&p$t(),e._video=null,e}return s(e,t),n(e,[{key:"_nativeAsset",get:function(){return this._video},set:function(t){this._video=t,this._duration=t?t.duration:0}}]),e}(Cm),p$t=Nh(_$t.prototype,"_duration",[hu],(function(){return 0})),d$t=_$t))||d$t),y$t=I.document;function b$t(t,e,i){var n=y$t.createElement("video"),r=y$t.createElement("source");n.appendChild(r);var s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType="blob",s.onload=function(){200===this.status||0===this.status?(r.src=URL.createObjectURL(this.response),i(null,n)):i(new Error(s.status+"(no response)"))},s.onerror=function(){var e="load video failure - "+t;X(e),i(new Error(e))},s.send()}function S$t(t,e,i,n){var r=new v$t;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}Iw.register({".mp4":b$t,".avi":b$t,".mov":b$t,".mpg":b$t,".mpeg":b$t,".rm":b$t,".rmvb":b$t}),Uw.register({".mp4":S$t,".avi":S$t,".mov":S$t,".mpg":S$t,".mpeg":S$t,".rm":S$t,".rmvb":S$t});var x$t=function(){function t(t){var e=this;this._componentEventList=new Map,this._state="none",this._video=null,this._onInterruptedBegin=void 0,this._onInterruptedEnd=void 0,this._interrupted=!1,this._loaded=!1,this._loadedMeta=!1,this._ignorePause=!1,this._fullScreenOnAwake=!1,this._visible=!0,this._playing=!1,this._cachedCurrentTime=-1,this._waitingFullscreen=!1,this._waitingPlay=!1,this._keepAspectRatio=!1,this._component=null,this._uiTrans=null,this._node=null,this._stayOnBottom=!1,this._dirty=!1,this._forceUpdate=!1,this._w=0,this._h=0,this._m00=0,this._m01=0,this._m04=0,this._m05=0,this._m12=0,this._m13=0,this._component=t,this._node=t.node,this._uiTrans=t.node.getComponent(rL),this._onInterruptedBegin=function(){e.video&&"playing"===e._state&&(e.video.pause(),e._interrupted=!0)},this._onInterruptedEnd=function(){e._interrupted&&e.video&&(e.video.play(),e._interrupted=!1)},A.game.on(A.Game.EVENT_PAUSE,this._onInterruptedBegin),A.game.on(A.Game.EVENT_RESUME,this._onInterruptedEnd)}var e=t.prototype;return e.onLoadedMetadata=function(t){this._loadedMeta=!0,this._forceUpdate=!0,this._visible?this.enable():this.disable(),this.dispatchEvent("meta-loaded");var e=t.target;this._keepAspectRatio&&e&&this.syncUITransform(e.videoWidth,e.videoHeight),this.delayedFullScreen(),this.delayedPlay()},e.onCanPlay=function(){this._loaded=!0,this.dispatchEvent("ready-to-play")},e.onPlay=function(){this._playing=!0,this.dispatchEvent("playing")},e.onPlaying=function(){this.dispatchEvent("playing")},e.onPause=function(){this._playing=!1,this._ignorePause?this._ignorePause=!1:this.dispatchEvent("paused")},e.onStoped=function(){this._playing=!1,this._ignorePause=!1,this.dispatchEvent("stopped")},e.onEnded=function(){this._playing=!1,this.dispatchEvent("completed")},e.onClick=function(){this.dispatchEvent("clicked")},e.onError=function(t){this.dispatchEvent("error");var e=t.target;e&&e.error&&Q("Error "+e.error.code+"; details: "+e.error.message)},e.play=function(){this._loadedMeta||this._loaded?this.canPlay():this._waitingPlay=!0},e.delayedPlay=function(){this._waitingPlay&&(this.canPlay(),this._waitingPlay=!1)},e.syncFullScreenOnAwake=function(t){this._fullScreenOnAwake=t,this._loadedMeta||this._loaded?this.canFullScreen(t):this._waitingFullscreen=!0},e.delayedFullScreen=function(){this._waitingFullscreen&&(this.canFullScreen(this._fullScreenOnAwake),this._waitingFullscreen=!1)},e.dispatchEvent=function(t){var e=this._componentEventList.get(t);e&&(this._state=t,e.call(this))},e.syncUITransform=function(t,e){var i=this._uiTrans;i&&(i.width=t,i.height=e)},e.syncCurrentTime=function(){this.video&&-1!==this._cachedCurrentTime&&this.video.currentTime!==this._cachedCurrentTime&&(this.seekTo(this._cachedCurrentTime),this._cachedCurrentTime=-1)},e.destroy=function(){this.removeVideoPlayer(),this._componentEventList.clear(),A.game.off(A.Game.EVENT_PAUSE,this._onInterruptedBegin),A.game.off(A.Game.EVENT_RESUME,this._onInterruptedEnd)},n(t,[{key:"fullScreenOnAwake",get:function(){return this._fullScreenOnAwake}},{key:"loaded",get:function(){return this._loaded}},{key:"componentEventList",get:function(){return this._componentEventList}},{key:"video",get:function(){return this._video}},{key:"state",get:function(){return this._state}},{key:"isPlaying",get:function(){return this._playing}},{key:"UICamera",get:function(){return GE.root.batcher2D.getFirstRenderCamera(this._node)}}]),t}();A.internal.VideoPlayerImpl=x$t;var w$t=I.document,T$t=-Math.pow(2,15),C$t=Zr(),A$t=function(t){function e(e){var i;return(i=t.call(this,e)||this)._eventList=new Map,i._clearColorA=-1,i._clearFlag=void 0,i}s(e,t);var i=e.prototype;return i.addListener=function(t,e){this._video&&(this._eventList.set(t,e),this._video.addEventListener(t,e))},i.removeAllListeners=function(){var t=this;this._eventList.forEach((function(e,i){t._video&&t._video.removeEventListener(i,e)})),this._eventList.clear()},i.canPlay=function(){var t=this;if(this.video){var e=this.video.play();I.Promise&&e instanceof Promise&&e.catch((function(){})).then((function(){t.syncCurrentTime()}))}},i.pause=function(){this.video&&(this.video.pause(),this._cachedCurrentTime=this.video.currentTime)},i.resume=function(){this.play()},i.stop=function(){var t=this;this.video&&(this._ignorePause=!0,this.video.currentTime=0,this.video.pause(),this._cachedCurrentTime=0,setTimeout((function(){t._ignorePause=!1,t.dispatchEvent("stopped")}),0))},i.syncClip=function(t){this.removeVideoPlayer(),t&&this.createVideoPlayer(t.nativeUrl)},i.syncURL=function(t){this.removeVideoPlayer(),t&&this.createVideoPlayer(t)},i.syncPlaybackRate=function(t){oh.browserType!==Bo.UC?this.video&&(this.video.playbackRate=t):Y("playbackRate is not supported by the uc mobile browser.")},i.syncVolume=function(t){this.video&&(this.video.volume=t)},i.syncMute=function(t){this.video&&(this.video.muted=t)},i.syncLoop=function(t){this.video&&(this.video.loop=t)},i.getDuration=function(){return this.video?this.video.duration:0},i.getCurrentTime=function(){return this.video?this.video.currentTime:-1},i.seekTo=function(t){this.video&&(this.video.currentTime=t,this._cachedCurrentTime=this.video.currentTime)},i.canFullScreen=function(t){var e=this,i=this._video;if(i&&4===i.readyState)return oh.os===Eo.IOS&&oh.isBrowser?(t?i.webkitEnterFullscreen&&i.webkitEnterFullscreen():i.webkitExitFullscreen&&i.webkitExitFullscreen(),void(this._fullScreenOnAwake=i.webkitDisplayingFullscreen)):ah.supportsFullScreen?void(t?(oh.browserType===Bo.IE&&(i.style.transform=""),i.setAttribute("x5-video-player-fullscreen","true"),ah.requestFullScreen(i,(function(t){var n=oh.browserType===Bo.IE?t.msFullscreenElement:t.fullscreenElement;e._fullScreenOnAwake=n===i}),(function(){e._fullScreenOnAwake=!1}))):(i.removeAttribute("x5-video-player-fullscreen"),ah.exitFullScreen())):(this._fullScreenOnAwake=t,this._forceUpdate=!0,void this.syncMatrix())},i.syncStayOnBottom=function(t){this._video&&(this._video.style["z-index"]=t?T$t:0,this._stayOnBottom=t),this._dirty=!0},i.syncKeepAspectRatio=function(t){this._keepAspectRatio=t,t&&this._loadedMeta&&this._video&&this.syncUITransform(this._video.videoWidth,this._video.videoHeight)},i.removeVideoPlayer=function(){var t=this._video;t&&Je(Uk.container,t)&&(Uk.container.removeChild(t),this.removeAllListeners()),this._cachedCurrentTime=0,this._playing=!1,this._loaded=!1,this._loadedMeta=!1,this._video=null},i.createVideoPlayer=function(t){var e=this._video=w$t.createElement("video");e.className="cocosVideo",e.style.visibility="hidden",e.style.position="absolute",e.style.bottom="0px",e.style.left="0px",e.style["transform-origin"]="0px 100% 0px",e.style["-webkit-transform-origin"]="0px 100% 0px",e.setAttribute("preload","auto"),e.setAttribute("webkit-playsinline",""),e.setAttribute("x5-playsinline",""),e.setAttribute("playsinline",""),this._bindDomEvent(),Uk.container.appendChild(e);var i=w$t.createElement("source");e.appendChild(i),i.src=t},i._bindDomEvent=function(){this._video,this.addListener("loadedmetadata",this.onLoadedMetadata.bind(this)),this.addListener("canplay",this.onCanPlay.bind(this)),this.addListener("canplaythrough",this.onCanPlay.bind(this)),this.addListener("play",this.onPlay.bind(this)),this.addListener("playing",this.onPlaying.bind(this)),this.addListener("pause",this.onPause.bind(this)),this.addListener("click",this.onClick.bind(this)),this.addListener("ended",this.onEnded.bind(this)),this.addListener("error",this.onError.bind(this))},i.onCanPlay=function(e){var i=e.target;if(!this._loaded||!i)switch(i.readyState){case 1:case 4:t.prototype.onCanPlay.call(this,e)}},i.enable=function(){if(this._video){if(this._visible=!0,"visible"===this._video.style.visibility)return;this._video.style.visibility="visible"}},i.disable=function(t){if(this._video){if(!t&&this._playing&&this._video.pause(),this._visible=!1,"hidden"===this._video.style.visibility)return;this._video.style.visibility="hidden"}},i.syncMatrix=function(){if(this._video&&this._visible&&this._component){var t=this.UICamera;if(t){this._dirty&&(this._dirty=!1,this._stayOnBottom?(this._clearColorA=t.clearColor.w,this._clearFlag=t.clearFlag,t.clearColor.w=0,t.clearFlag=7):this._clearFlag&&(t.clearColor.w=this._clearColorA,t.clearFlag=this._clearFlag,this._clearColorA=-1,this._clearFlag=null)),this._component.node.getWorldMatrix(C$t),t.update(!0),t.worldMatrixToScreen(C$t,C$t,Uk.canvas.width,Uk.canvas.height);var e=0,i=0;if(this._fullScreenOnAwake?(e=hh.width,i=hh.height):(e=this._uiTrans.contentSize.width,i=this._uiTrans.contentSize.height),this._forceUpdate||this._m00!==C$t.m00||this._m01!==C$t.m01||this._m04!==C$t.m04||this._m05!==C$t.m05||this._m12!==C$t.m12||this._m13!==C$t.m13||this._w!==e||this._h!==i){this._m00=C$t.m00,this._m01=C$t.m01,this._m04=C$t.m04,this._m05=C$t.m05,this._m12=C$t.m12,this._m13=C$t.m13,this._w=e,this._h=i;var n=rh.devicePixelRatio,r=1/n,s=1/n,a=Uk.container,o=C$t.m00*r,h=C$t.m01,u=C$t.m04,l=C$t.m05*s;this._video.style.width=this._w+"px",this._video.style.height=this._h+"px",oh.browserType!==Bo.MOBILE_QQ?this._video.style.objectFit=this._keepAspectRatio?"none":"fill":Y("keepAspectRatio is not supported by the qq mobile browser.");var c=this._w*r,f=this._h*s,d=this._uiTrans.anchorPoint,_=d.x,p=d.y,m=c*C$t.m00*_,g=f*C$t.m05*p,v=a&&a.style.paddingLeft?parseInt(a.style.paddingLeft):0,y=a&&a.style.paddingBottom?parseInt(a.style.paddingBottom):0,b="matrix("+o+","+-h+","+-u+","+l+","+(C$t.m12*r-m+v)+","+-(C$t.m13*s-g+y)+")";this._video.style.transform=b,this._video.style["-webkit-transform"]=b,oh.browserType!==Bo.IE&&(this._forceUpdate=!1)}}}},e}(x$t),D$t=function(){function t(){}return t.getImpl=function(t){return new A$t(t)},t}();A.internal.VideoPlayerImplManager=D$t;var I$t,B$t,M$t,P$t,E$t,k$t,R$t,O$t,F$t,L$t,V$t,N$t,z$t,U$t,G$t,H$t,W$t,j$t,q$t,X$t,Y$t,Q$t=Ee({REMOTE:0,LOCAL:1}),J$t=t("hf",(I$t=Qh("cc.VideoPlayer"),B$t=Jh(rL),M$t=Eu(v$t),P$t=Eu(Q$t),E$t=Eu(v$t),k$t=Eu([pg]),I$t(R$t=B$t((Y$t=function(t){function e(){var e;return(e=t.call(this)||this)._resourceType=F$t&&F$t(),e._remoteURL=L$t&&L$t(),e._clip=V$t&&V$t(),e._playOnAwake=N$t&&N$t(),e._volume=z$t&&z$t(),e._mute=U$t&&U$t(),e._playbackRate=G$t&&G$t(),e._loop=H$t&&H$t(),e._fullScreenOnAwake=W$t&&W$t(),e._stayOnBottom=j$t&&j$t(),e._keepAspectRatio=q$t&&q$t(),e._impl=null,e._cachedCurrentTime=0,e.videoPlayerEvent=X$t&&X$t(),e}s(e,t);var i=e.prototype;return i.syncSource=function(){var t=this._impl;t&&(this._resourceType===Q$t.REMOTE?t.syncURL(this._remoteURL):t.syncClip(this._clip),this._cachedCurrentTime=0,t.syncLoop(this._loop),t.syncVolume(this._volume),t.syncMute(this._mute),t.seekTo(this._cachedCurrentTime),t.syncPlaybackRate(this._playbackRate),t.syncStayOnBottom(this._stayOnBottom),t.syncKeepAspectRatio(this._keepAspectRatio),t.syncFullScreenOnAwake(this._fullScreenOnAwake))},i.__preload=function(){this._impl=D$t.getImpl(this),this.syncSource();var t=this._impl.componentEventList;t.set("meta-loaded",this.onMetaLoaded.bind(this)),t.set("ready-to-play",this.onReadyToPlay.bind(this)),t.set("playing",this.onPlaying.bind(this)),t.set("paused",this.onPaused.bind(this)),t.set("stopped",this.onStopped.bind(this)),t.set("completed",this.onCompleted.bind(this)),t.set("error",this.onError.bind(this)),t.set("clicked",this.onClicked.bind(this)),this._playOnAwake&&this._impl.loaded&&this.play()},i.onEnable=function(){this._impl&&this._impl.enable()},i.onDisable=function(){this._impl&&this._impl.disable()},i.onDestroy=function(){this._impl&&(this._impl.destroy(),this._impl=null)},i.update=function(){this._impl&&this._impl.syncMatrix()},i.onMetaLoaded=function(){pg.emitEvents(this.videoPlayerEvent,this,"meta-loaded"),this.node.emit("meta-loaded",this)},i.onReadyToPlay=function(){this._playOnAwake&&!this.isPlaying&&this.play(),pg.emitEvents(this.videoPlayerEvent,this,"ready-to-play"),this.node.emit("ready-to-play",this)},i.onPlaying=function(){pg.emitEvents(this.videoPlayerEvent,this,"playing"),this.node.emit("playing",this)},i.onPaused=function(){pg.emitEvents(this.videoPlayerEvent,this,"paused"),this.node.emit("paused",this)},i.onStopped=function(){pg.emitEvents(this.videoPlayerEvent,this,"stopped"),this.node.emit("stopped",this)},i.onCompleted=function(){pg.emitEvents(this.videoPlayerEvent,this,"completed"),this.node.emit("completed",this)},i.onError=function(){pg.emitEvents(this.videoPlayerEvent,this,"error"),this.node.emit("error",this)},i.onClicked=function(){pg.emitEvents(this.videoPlayerEvent,this,"clicked"),this.node.emit("clicked",this)},i.play=function(){this._impl&&this._impl.play()},i.resume=function(){this._impl&&this._impl.resume()},i.pause=function(){this._impl&&this._impl.pause()},i.stop=function(){this._impl&&this._impl.stop()},n(e,[{key:"resourceType",get:function(){return this._resourceType},set:function(t){this._resourceType!==t&&(this._resourceType=t,this.syncSource())}},{key:"remoteURL",get:function(){return this._remoteURL},set:function(t){this._remoteURL!==t&&(this._remoteURL=t,this.syncSource())}},{key:"clip",get:function(){return this._clip},set:function(t){this._clip!==t&&(this._clip=t,this.syncSource())}},{key:"playOnAwake",get:function(){return this._playOnAwake},set:function(t){this._playOnAwake=t}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(t){this._playbackRate=t,this._impl&&this._impl.syncPlaybackRate(t)}},{key:"volume",get:function(){return this._volume},set:function(t){this._volume=t,this._impl&&this._impl.syncVolume(t)}},{key:"mute",get:function(){return this._mute},set:function(t){this._mute=t,this._impl&&this._impl.syncMute(t)}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t,this._impl&&this._impl.syncLoop(t)}},{key:"keepAspectRatio",get:function(){return this._keepAspectRatio},set:function(t){this._keepAspectRatio!==t&&(this._keepAspectRatio=t,this._impl&&this._impl.syncKeepAspectRatio(t))}},{key:"fullScreenOnAwake",get:function(){return this._impl?(this._fullScreenOnAwake=this._impl.fullScreenOnAwake,this._fullScreenOnAwake):this._fullScreenOnAwake},set:function(t){this._fullScreenOnAwake!==t&&(this._fullScreenOnAwake=t,this._impl&&this._impl.syncFullScreenOnAwake(t))}},{key:"stayOnBottom",get:function(){return this._stayOnBottom},set:function(t){this._stayOnBottom!==t&&(this._stayOnBottom=t,this._impl&&this._impl.syncStayOnBottom(t))}},{key:"nativeVideo",get:function(){return this._impl&&this._impl.video||null}},{key:"currentTime",get:function(){return this._impl?this._impl.getCurrentTime():this._cachedCurrentTime},set:function(t){Number.isNaN(t)?Y("illegal video time! value:"+t):(t=$i(t,0,this.duration),this._cachedCurrentTime=t,this._impl&&this._impl.seekTo(t))}},{key:"duration",get:function(){return this._impl?this._impl.getDuration():0}},{key:"state",get:function(){return this._impl?this._impl.state:"none"}},{key:"isPlaying",get:function(){return!!this._impl&&this._impl.isPlaying}}]),e}(gg),Y$t.EventType={NONE:"none",PLAYING:"playing",PAUSED:"paused",STOPPED:"stopped",COMPLETED:"completed",META_LOADED:"meta-loaded",READY_TO_PLAY:"ready-to-play",ERROR:"error",CLICKED:"clicked"},Y$t.ResourceType=Q$t,F$t=Nh((O$t=Y$t).prototype,"_resourceType",[hu],(function(){return Q$t.LOCAL})),L$t=Nh(O$t.prototype,"_remoteURL",[hu],(function(){return""})),V$t=Nh(O$t.prototype,"_clip",[M$t,hu],(function(){return null})),N$t=Nh(O$t.prototype,"_playOnAwake",[hu],(function(){return!0})),z$t=Nh(O$t.prototype,"_volume",[hu],(function(){return 1})),U$t=Nh(O$t.prototype,"_mute",[hu],(function(){return!1})),G$t=Nh(O$t.prototype,"_playbackRate",[hu],(function(){return 1})),H$t=Nh(O$t.prototype,"_loop",[hu],(function(){return!1})),W$t=Nh(O$t.prototype,"_fullScreenOnAwake",[hu],(function(){return!1})),j$t=Nh(O$t.prototype,"_stayOnBottom",[hu],(function(){return!1})),q$t=Nh(O$t.prototype,"_keepAspectRatio",[hu],(function(){return!0})),y(O$t.prototype,"resourceType",[P$t],Object.getOwnPropertyDescriptor(O$t.prototype,"resourceType"),O$t.prototype),y(O$t.prototype,"clip",[E$t],Object.getOwnPropertyDescriptor(O$t.prototype,"clip"),O$t.prototype),X$t=Nh(O$t.prototype,"videoPlayerEvent",[hu,k$t],(function(){return[]})),R$t=O$t))||R$t)||R$t));A.internal.VideoPlayer=J$t,pt(J$t.prototype,"VideoPlayer.prototype",[{name:"onPasued",newName:"onPaused"}]);var K$t=function(){function t(t){this._componentEventList=new Map,this._state="none",this._wrapper=void 0,this._webview=null,this._loaded=!1,this._forceUpdate=!1,this._component=null,this._uiTrans=null,this._node=null,this._w=0,this._h=0,this._m00=0,this._m01=0,this._m04=0,this._m05=0,this._m12=0,this._m13=0,this._component=t,this._node=t.node,this._uiTrans=t.node.getComponent(rL),this.reset(),this.createWebView()}var e=t.prototype;return e.reset=function(){this._wrapper=null,this._webview=null,this._loaded=!1,this._w=0,this._h=0,this._m00=0,this._m01=0,this._m04=0,this._m05=0,this._m12=0,this._m13=0,this._state="none",this._forceUpdate=!1},e.dispatchEvent=function(t){var e=this._componentEventList.get(t);if(e){this._state=t;for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r0&&(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),U0t.gpuInputAssembler=null,n.glArrayBuffer!==e.glBuffer&&(i.bindBuffer(34962,e.glBuffer),n.glArrayBuffer=e.glBuffer),i.bufferData(34962,e.size,r),i.bindBuffer(34962,null),n.glArrayBuffer=null))}else if(4&e.usage){e.glTarget=34963;var a=i.createBuffer();a&&(e.glBuffer=a,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),U0t.gpuInputAssembler=null,n.glElementArrayBuffer!==e.glBuffer&&(i.bindBuffer(34963,e.glBuffer),n.glElementArrayBuffer=e.glBuffer),i.bufferData(34963,e.size,r),i.bindBuffer(34963,null),n.glElementArrayBuffer=null))}else if(16&e.usage){e.glTarget=35345;var o=i.createBuffer();o&&e.size>0&&(e.glBuffer=o,n.glUniformBuffer!==e.glBuffer&&(i.bindBuffer(35345,e.glBuffer),n.glUniformBuffer=e.glBuffer),i.bufferData(35345,e.size,r),i.bindBuffer(35345,null),n.glUniformBuffer=null)}else 64&e.usage||2&e.usage||1&e.usage||ht(16315),e.glTarget=0}function I0t(t,e){var i=t.gl,n=t.getStateCache(),r=t.extensions.useVAO;if(e.glBuffer){switch(e.glTarget){case 34962:r&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),U0t.gpuInputAssembler=null,i.bindBuffer(34962,null),n.glArrayBuffer=null;break;case 34963:r&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),U0t.gpuInputAssembler=null,i.bindBuffer(34963,null),n.glElementArrayBuffer=null;break;case 35345:i.bindBuffer(35345,null),n.glUniformBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}function B0t(t,e){var i=t.gl,n=t.getStateCache(),r=2&e.memUsage?35048:35044;8&e.usage?(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),U0t.gpuInputAssembler=null,n.glArrayBuffer!==e.glBuffer&&i.bindBuffer(34962,e.glBuffer),e.buffer?i.bufferData(34962,e.buffer,r):i.bufferData(34962,e.size,r),i.bindBuffer(34962,null),n.glArrayBuffer=null):4&e.usage?(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),U0t.gpuInputAssembler=null,n.glElementArrayBuffer!==e.glBuffer&&i.bindBuffer(34963,e.glBuffer),e.buffer?i.bufferData(34963,e.buffer,r):i.bufferData(34963,e.size,r),i.bindBuffer(34963,null),n.glElementArrayBuffer=null):16&e.usage?(n.glUniformBuffer!==e.glBuffer&&i.bindBuffer(35345,e.glBuffer),i.bufferData(35345,e.size,r),i.bindBuffer(35345,null),n.glUniformBuffer=null):(64&e.usage||2&e.usage||1&e.usage||ht(16315),e.glTarget=0)}function M0t(t,e,i,n,r){if(64&e.usage){e.indirects.clearDraws();for(var s=i.drawInfos,a=0;ar.maxTextureSize&&ht(9100,u,r.maxTextureSize),1===e.samples){if(e.glTexture=i.createTexture(),e.size>0){var l=n.glTexUnits[n.texUnit];if(l.glTexture!==e.glTexture&&(i.bindTexture(3553,e.glTexture),l.glTexture=e.glTexture),ep[e.format].isCompressed)for(var c=0;c>1),a=_0t(1,a>>1)}else 128&e.flags?i.texImage2D(3553,0,e.glInternalFmt,s,a,0,e.glFormat,e.glType,null):i.texStorage2D(3553,e.mipLevel,e.glInternalFmt,s,a)}}else e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(n.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(36161,e.glRenderbuffer),n.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorageMultisample(36161,e.samples,e.glInternalFmt,e.width,e.height));break;case 5:e.glTarget=35866;var _=_0t(s,a);if(_>r.maxTextureSize&&ht(9100,_,r.maxTextureSize),h>r.maxArrayTextureLayers&&ht(9100,h,r.maxArrayTextureLayers),e.glTexture=i.createTexture(),e.size>0){var p=n.glTexUnits[n.texUnit];if(p.glTexture!==e.glTexture&&(i.bindTexture(35866,e.glTexture),p.glTexture=e.glTexture),ep[e.format].isCompressed)for(var m=0;m>1),a=_0t(1,a>>1)}else i.texStorage3D(35866,e.mipLevel,e.glInternalFmt,s,a,h)}break;case 2:e.glTarget=32879;var y=_0t(_0t(s,a),o);if(y>r.max3DTextureSize&&ht(9100,y,r.max3DTextureSize),e.glTexture=i.createTexture(),e.size>0){var b=n.glTexUnits[n.texUnit];if(b.glTexture!==e.glTexture&&(i.bindTexture(32879,e.glTexture),b.glTexture=e.glTexture),ep[e.format].isCompressed)for(var S=0;S>1),a=_0t(1,a>>1)}else i.texStorage3D(32879,e.mipLevel,e.glInternalFmt,s,a,o)}break;case 3:e.glTarget=34067;var T=_0t(s,a);if(T>r.maxCubeMapTextureSize&&ht(9100,T,r.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var C=n.glTexUnits[n.texUnit];if(C.glTexture!==e.glTexture&&(i.bindTexture(34067,e.glTexture),C.glTexture=e.glTexture),ep[e.format].isCompressed)for(var A=0;A>1),a=_0t(1,a>>1)}else i.texStorage2D(34067,e.mipLevel,e.glInternalFmt,s,a)}break;default:ht(16317),e.type=1,e.glTarget=3553}}function E0t(t,e){var i=t.gl,n=t.getStateCache();if(e.glTexture){var r=n.glTexUnits,s=n.texUnit;i.deleteTexture(e.glTexture);for(var a=0;ar.maxTextureSize&&ht(9100,u,r.maxTextureSize),1===e.samples){var l=n.glTexUnits[n.texUnit];if(l.glTexture!==e.glTexture&&(i.bindTexture(3553,e.glTexture),l.glTexture=e.glTexture),ep[e.format].isCompressed)for(var c=0;c>1),a=_0t(1,a>>1)}else E0t(t,e),P0t(t,e)}else e.glRenderbuffer&&(n.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(36161,e.glRenderbuffer),n.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorageMultisample(36161,e.samples,e.glInternalFmt,e.width,e.height));break;case 5:e.glTarget=35866;var _=_0t(s,a);if(_>r.maxTextureSize&&ht(9100,_,r.maxTextureSize),h>r.maxArrayTextureLayers&&ht(9100,h,r.maxArrayTextureLayers),e.glTexture=i.createTexture(),e.size>0){var p=n.glTexUnits[n.texUnit];if(p.glTexture!==e.glTexture&&(i.bindTexture(35866,e.glTexture),p.glTexture=e.glTexture),ep[e.format].isCompressed)for(var m=0;m>1),a=_0t(1,a>>1)}else i.texStorage3D(35866,e.mipLevel,e.glInternalFmt,s,a,h)}break;case 2:e.glTarget=32879;var y=_0t(_0t(s,a),o);if(y>r.max3DTextureSize&&ht(9100,y,r.max3DTextureSize),e.glTexture=i.createTexture(),e.size>0){var b=n.glTexUnits[n.texUnit];if(b.glTexture!==e.glTexture&&(i.bindTexture(32879,e.glTexture),b.glTexture=e.glTexture),ep[e.format].isCompressed)for(var S=0;S>1),a=_0t(1,a>>1)}else i.texStorage3D(32879,e.mipLevel,e.glInternalFmt,s,a,o)}break;case 3:e.type=3,e.glTarget=34067;var T=_0t(s,a);T>r.maxCubeMapTextureSize&&ht(9100,T,r.maxTextureSize);var C=n.glTexUnits[n.texUnit];if(C.glTexture!==e.glTexture&&(i.bindTexture(34067,e.glTexture),C.glTexture=e.glTexture),ep[e.format].isCompressed)for(var A=0;A<6;++A){s=e.width,a=e.height;for(var D=0;D>1),a=_0t(1,a>>1)}}else E0t(t,e),P0t(t,e);break;default:ht(16317),e.type=1,e.glTarget=3553}}}function R0t(t,e){for(var i=t.gl,n=e.glSamplers.values().next();!n.done;){i.deleteSampler(n.value);for(var r=t.getStateCache().glSamplerUnits,s=0;s>h.baseLevel),e.height=p0t(e.height,u.height>>h.baseLevel))}var l=e.gpuDepthStencilView;if(l){var c=l.gpuTexture,f=ep[c.format].hasStencil?33306:36096;c.glTexture?r.framebufferTexture2D(36160,f,c.glTarget,c.glTexture,e.gpuDepthStencilView.baseLevel):r.framebufferRenderbuffer(36160,f,36161,c.glRenderbuffer),e.width=p0t(e.width,c.width>>l.baseLevel),e.height=p0t(e.height,c.height>>l.baseLevel)}r.drawBuffers(s);var d=r.checkFramebufferStatus(36160);if(36053!==d)switch(d){case 36054:ht(16318);break;case 36055:ht(16319);break;case 36057:ht(16320);break;case 36061:ht(16321)}i.glFramebuffer!==e.glFramebuffer&&r.bindFramebuffer(36160,i.glFramebuffer)}}function F0t(t,e){var i=t.gl,n=t.getStateCache();e.glFramebuffer&&(i.deleteFramebuffer(e.glFramebuffer),n.glFramebuffer===e.glFramebuffer&&(i.bindFramebuffer(36160,null),n.glFramebuffer=null),e.glFramebuffer=null)}function L0t(t,e){for(var i,n=t.gl,r=t.getStateCache(),s=t.capabilities,a=function(){var t=e.gpuStages[o],i=0,r="",s=1;switch(t.type){case 1:r="VertexShader",i=35633;break;case 16:r="FragmentShader",i=35632;break;default:return ht(16322),{v:void 0}}var a=n.createShader(i);if(a&&(t.glShader=a,n.shaderSource(t.glShader,"#version 300 es\n"+t.source),n.compileShader(t.glShader),!n.getShaderParameter(t.glShader,35713))){ht(16323,r,e.name),ht(16324,t.source.replace(/^|\n/g,(function(){return"\n"+s+++" "}))),Q(n.getShaderInfoLog(t.glShader));for(var h=0;h0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var R=0;R=0&&D.gpuDescriptors[I];if(B&&B.gpuBuffer){var M=T[A.set],P=M&&M[A.binding],E=B.gpuBuffer.glOffset;P>=0&&(E+=r[P]),h.glBindUBOs[A.glBinding]===B.gpuBuffer.glBuffer&&h.glBindUBOOffsets[A.glBinding]===E||(E?a.bindBufferRange(35345,A.glBinding,B.gpuBuffer.glBuffer,E,B.gpuBuffer.size):a.bindBufferBase(35345,A.glBinding,B.gpuBuffer.glBuffer),h.glUniformBuffer=h.glBindUBOs[A.glBinding]=B.gpuBuffer.glBuffer,h.glBindUBOOffsets[A.glBinding]=E)}}for(var k=d.glSamplerTextures.length,R=0;R=0&&F.gpuDescriptors[L],N=0;N0){U.glTexture!==H.glTexture&&(h.texUnit!==z&&(a.activeTexture(33984+z),h.texUnit=z),H.glTexture?a.bindTexture(H.glTarget,H.glTexture):a.bindTexture(H.glTarget,t.nullTex2D.gpuTexture.glTexture),U.glTexture=H.glTexture);var q=V.gpuSampler.getGLSampler(t,W,j);h.glSamplerUnits[z]!==q&&(a.bindSampler(z,q),h.glSamplerUnits[z]=q)}V=F.gpuDescriptors[++L]}}}if(i&&d&&(_||U0t.gpuInputAssembler!==i))if(U0t.gpuInputAssembler=i,t.extensions.useVAO){var X=i.glVAOs.get(d.glProgram);if(!X){var Y;X=a.createVertexArray(),i.glVAOs.set(d.glProgram,X),a.bindVertexArray(X),a.bindBuffer(34962,null),a.bindBuffer(34963,null),h.glArrayBuffer=null,h.glElementArrayBuffer=null;for(var Q=0;Q=0&&(a.enableVertexAttribArray(lt),h.glEnabledAttribLocs[lt]=!0),h.glCurrentAttribLocs[lt]=!0,a.vertexAttribPointer(lt,at.count,at.glType,at.isNormalized,at.stride,ct),a.vertexAttribDivisor(lt,at.isInstanced?1:0)}}}var ft=i.gpuIndexBuffer;ft&&h.glElementArrayBuffer!==ft.glBuffer&&(a.bindBuffer(34963,ft.glBuffer),h.glElementArrayBuffer=ft.glBuffer);for(var dt=0;dt0){var c=e.firstIndex*a.stride;i.drawElementsInstanced(r,e.indexCount,n.glIndexType,c,e.instanceCount)}}else e.vertexCount>0&&i.drawArraysInstanced(r,e.firstVertex,e.vertexCount,e.instanceCount);else if(a){if(e.indexCount>0){var f=e.firstIndex*a.stride;i.drawElements(r,e.indexCount,n.glIndexType,f)}}else e.vertexCount>0&&i.drawArrays(r,e.firstVertex,e.vertexCount)}}function j0t(t,e){if(t.length>1||e.length>1)return!1;if(t[0]instanceof HTMLVideoElement){var i=t[0];return 0===e[0].texOffset.x&&0===e[0].texOffset.y&&e[0].texExtent.width===i.videoWidth&&e[0].texExtent.height===i.videoHeight}return!1}function q0t(t,e,i,n){var r=t.gl,s=t.getStateCache(),a=s.glTexUnits[s.texUnit];a.glTexture!==i.glTexture&&(r.bindTexture(i.glTarget,i.glTexture),a.glTexture=i.glTexture);var o=0,h=0;switch(i.glTarget){case 3553:if(128&i.flags||j0t(e,n))r.texImage2D(3553,n[0].texSubres.mipLevel,i.glInternalFmt,n[0].texExtent.width,n[0].texExtent.height,0,i.glFormat,i.glType,e[0]);else for(var u=0;u0?C:d.width,p.height=g.buffTexHeight>0?g.buffTexHeight:d.height;var A=S+_.x===i.width>>v?S:d.width,D=x+_.y===i.height>>v?x:d.height,I=void 0,B=e[o++];if(p.width===d.width&&p.height===d.height){var M=ap(i.format,A,D,1)/l.BYTES_PER_ELEMENT;lt(Number.isInteger(M),9101),I=new l(B.buffer,B.byteOffset+g.buffOffset,M)}else I=Y0t(B,i.format,g.buffOffset,p,d);c?36196!==i.glInternalFmt?r.compressedTexSubImage2D(3553,v,_.x,_.y,A,D,i.glFormat,I):r.compressedTexImage2D(3553,v,i.glInternalFmt,A,D,0,I):r.texSubImage2D(3553,v,_.x,_.y,A,D,i.glFormat,i.glType,I)}break;case 35866:for(var P=0;P0?z:d.width,p.height=E.buffTexHeight>0?E.buffTexHeight:d.height;var G=F+_.x===i.width>>k?F:d.width,H=L+_.y===i.height>>k?L:d.height,W=U.baseArrayLayer+U.layerCount;for(h=U.baseArrayLayer;h0?nt:d.width,p.height=Q.buffTexHeight>0?Q.buffTexHeight:d.height;var rt=$+_.x===i.width>>J?$:d.width,st=tt+_.y===i.height>>J?tt:d.height,at=void 0,ot=e[o++];if(p.width===d.width&&p.height===d.height){var ut=ap(i.format,rt,st,d.depth)/l.BYTES_PER_ELEMENT;lt(Number.isInteger(ut),9101),at=new l(ot.buffer,ot.byteOffset+Q.buffOffset,ut)}else at=Y0t(ot,i.format,Q.buffOffset,p,d);c?36196!==i.glInternalFmt?r.compressedTexSubImage3D(35866,J,_.x,_.y,_.z,rt,st,d.depth,i.glFormat,at):r.compressedTexImage3D(35866,J,i.glInternalFmt,rt,st,d.depth,0,at):r.texSubImage3D(35866,J,_.x,_.y,_.z,rt,st,d.depth,i.glFormat,i.glType,at)}break;case 34067:for(var ct=0;ct0?bt:d.width,p.height=ft.buffTexHeight>0?ft.buffTexHeight:d.height;var xt=mt+_.x===i.width>>dt?mt:d.width,wt=gt+_.y===i.height>>dt?gt:d.height,Tt=St.baseArrayLayer+St.layerCount;for(h=St.baseArrayLayer;h0,this.instancedDraw=!!e.instanceCount,this.drawCount=Math.max(t+1,this.drawCount),this.drawByIndex?(this.counts[t]=e.indexCount,this.offsets[t]=e.firstIndex):(this.counts[t]=e.vertexCount,this.offsets[t]=e.firstVertex),this.instances[t]=Math.max(1,e.instanceCount)},e._ensureCapacity=function(t){if(!(this._capacity>t)){this._capacity=fn(t);var e=new Int32Array(this._capacity),i=new Int32Array(this._capacity),n=new Int32Array(this._capacity);this.byteOffsets=new Int32Array(this._capacity),e.set(this.counts),i.set(this.offsets),n.set(this.instances),this.counts=e,this.offsets=i,this.instances=n}},t}(),t1t=function(){function t(){this._srcFramebuffer=void 0,this._dstFramebuffer=void 0;var t=Z0t.instance.gl;this._srcFramebuffer=t.createFramebuffer(),this._dstFramebuffer=t.createFramebuffer()}return t.prototype.destroy=function(){var t=Z0t.instance.gl;t.deleteFramebuffer(this._srcFramebuffer),t.deleteFramebuffer(this._dstFramebuffer)},n(t,[{key:"srcFramebuffer",get:function(){return this._srcFramebuffer}},{key:"dstFramebuffer",get:function(){return this._dstFramebuffer}}]),t}(),e1t=function(t){function e(){var e;return(e=t.call(this)||this)._gpuBuffer=null,e}s(e,t);var i=e.prototype;return i.getGpuBuffer=function(){return this._gpuBuffer},i.initialize=function(t){if("buffer"in t){this._isBufferView=!0;var e=t.buffer;this._usage=e.usage,this._memUsage=e.memUsage,this._size=this._stride=t.range,this._count=1,this._flags=e.flags,this._gpuBuffer={usage:this._usage,memUsage:this._memUsage,size:this._size,stride:this._stride,buffer:null,indirects:e.getGpuBuffer().indirects,glTarget:e.getGpuBuffer().glTarget,glBuffer:e.getGpuBuffer().glBuffer,glOffset:t.offset}}else this._usage=t.usage,this._memUsage=t.memUsage,this._size=t.size,this._stride=Math.max(t.stride||this._size,1),this._count=this._size/this._stride,this._flags=t.flags,this._gpuBuffer={usage:this._usage,memUsage:this._memUsage,size:this._size,stride:this._stride,buffer:null,indirects:new $0t,glTarget:0,glBuffer:null,glOffset:0},D0t(Z0t.instance,this._gpuBuffer),Z0t.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(this._isBufferView||(I0t(Z0t.instance,this._gpuBuffer),Z0t.instance.memoryStatus.bufferSize-=this._size),this._gpuBuffer=null)},i.resize=function(t){if(this._isBufferView)at(16379);else{var e=this._size;e!==t&&(this._size=t,this._count=this._size/this._stride,this._gpuBuffer&&(this._gpuBuffer.size=t,t>0&&(B0t(Z0t.instance,this._gpuBuffer),Z0t.instance.memoryStatus.bufferSize-=e,Z0t.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?at(16380):(i=void 0!==e?e:64&this._usage?0:t.byteLength,M0t(Z0t.instance,this._gpuBuffer,t,0,i))},e}(_p),i1t=function(t){function e(){var e;return(e=t.call(this)||this)._isInRenderPass=!1,e._curGPUPipelineState=null,e._curGPUDescriptorSets=[],e._curGPUInputAssembler=null,e._curDynamicOffsets=Array(8).fill(0),e._curDynamicStates=new Q_,e._isStateInvalid=!1,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._type=t.type,this._queue=t.queue;for(var e=Z0t.instance.bindingMappings.blockOffsets.length,i=0;i0?this.gpuColorViews[0].gpuTexture.width:this.gpuDepthStencilView?this.gpuDepthStencilView.gpuTexture.width:o},set width(t){o=t},get height(){return this.gpuColorViews.length>0?this.gpuColorViews[0].gpuTexture.height:this.gpuDepthStencilView?this.gpuDepthStencilView.gpuTexture.height:h},set height(t){h=t}},O0t(Z0t.instance,this._gpuFramebuffer),this._gpuFramebuffer.gpuColorViews.forEach((function(t){return i._gpuColorViews.push(t.gpuTexture.glTexture)})),this._gpuDepthStencilView=null==(e=this._gpuFramebuffer.gpuDepthStencilView)?void 0:e.gpuTexture.glTexture,this._width=this._gpuFramebuffer.width,this._height=this._gpuFramebuffer.height},i.destroy=function(){this._gpuFramebuffer&&(F0t(Z0t.instance,this._gpuFramebuffer),this._gpuFramebuffer=null,this._gpuColorViews.length=0,this._gpuDepthStencilView=null)},n(e,[{key:"needRebuild",get:function(){var t=this.getGpuFramebuffer();if(t){for(var e,i=0;ii&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;o1&&(s.levelCount=Math.min(s.levelCount,e.getLevelCount(t,i)));var a=n._size;s.width=t,s.height=i,n._size=op(s.format,n.width,n.height,n.depth,s.levelCount)*s.layerCount;var o=n._gpuTexture;!n._isTextureView&&o&&(o.width=t,o.height=i,o.size=n._size,o.isSwapchainTexture||(k0t(r,o),r.memoryStatus.textureSize-=a,r.memoryStatus.textureSize+=n._size))}},i.initAsSwapchainTexture=function(t){var e=new d_;e.format=t.format,e.usage=ep[t.format].hasDepth?32:16,e.width=t.width,e.height=t.height,this.initialize(e,!0)},n(e,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"gpuTextureView",get:function(){return this._gpuTextureView}}]),e}(Rp),m1t="webglcontextlost";function g1t(t){t.activeTexture(33984),t.pixelStorei(3333,1),t.pixelStorei(3317,1),t.pixelStorei(37440,!1),t.bindFramebuffer(36160,null),t.enable(3089),t.enable(2884),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.enable(2929),t.depthMask(!0),t.depthFunc(513),t.stencilFuncSeparate(1028,519,1,65535),t.stencilOpSeparate(1028,7680,7680,7680),t.stencilMaskSeparate(1028,65535),t.stencilFuncSeparate(1029,519,1,65535),t.stencilOpSeparate(1029,7680,7680,7680),t.stencilMaskSeparate(1029,65535),t.disable(2960),t.disable(32926),t.disable(3042),t.blendEquationSeparate(32774,32774),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.blendColor(0,0,0,0)}function v1t(t,e){for(var i=["","WEBKIT_","MOZ_"],n=0;n