2 lines
2.9 MiB
2 lines
2.9 MiB
System.register([],(function(t,e){"use strict";return{execute:function(){function i(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,g(n.key),n)}}function n(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function r(){return r=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},r.apply(this,arguments)}function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,o(t,e)}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function u(t,e,i){return u=h()?Reflect.construct.bind():function(t,e,i){var n=[null];n.push.apply(n,e);var r=new(Function.bind.apply(t,n));return i&&o(r,i.prototype),r},u.apply(null,arguments)}function l(t){var e="function"==typeof Map?new Map:void 0;return l=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return u(t,arguments,a(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(n,t)},l(t)}function c(t,e){if(null==t)return{};var i,n,r={},s=Object.keys(t);for(n=0;n<s.length;n++)i=s[n],e.indexOf(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 _(t,e){if(t){if("string"==typeof t)return d(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)?d(t,e):void 0}}function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function p(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=_(t))||e){i&&(t=i);var n=0;return function(){return n>=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 y(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 v(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 TR.test(t)},J:pR,N:AR,P:CR,W:DR,X:BR,Y:IR,Z:MR,_:p,a0:function(t){return xR.test(t)},a1:kR,a2:RR,a3:FR,aA:F2,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:uY,aR:ps,aT:nr,aV:Nn,aX:Ur,a_:$r,az:R2,b0:gs,b2:Ss,b4:fr,b9:Qi,bB:Ie,bC:Ee,bD:Re,bI:function(t){t>0&&(St=t)},bM:Dt,bN:function(t){for(var e,i=p(t);!(e=i()).done;)Bt(e.value)},bO:function(t){return Tt||(Tt="undefined"==typeof Proxy?{}:new Proxy(t,{get:function(t,e,i){return Bt(e),Reflect.get(t,e,i)}})),Tt},bP:$o,bQ:th,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:_n,bp:dn,bq:pn,br:mn,bs:gn,bt:yn,bu:xn,bv:Tn,c3:function(t){return t[hu]},c6:Bo,c8:Q,c9:X,cH:qf,cI:Bc,cJ:jc,cU:lu,cW:Xf,cZ:Ti,c_:Ai,ca:J,cb:Y,cc:K,cd:rt,ce:it,cf:ht,cg:at,ch:lt,ci:_t,cj:dt,ck:ft,d1:vo,d2:bo,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:ly,dZ:J$,da:function(){},db:function(){},dc:Me,dd:Zf,dr:GP,fw:function(){return Promise.resolve()},g:CSt,g7:nVt,gQ:rGt,gR:sGt,hh:IZt}),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 w=!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 x=!1;var T="undefined"==typeof window?global:window,A=t("aO",{_global:T}),C=A;A.internal={};var D=t("aN","3.8.6");T.CocosEngine=C.ENGINE_VERSION=D,T.cc=C;var B=void 0!==globalThis.jsb&&void 0!==jsb.window?jsb.window:globalThis;T.ccwindow=B;var I=2147483647;function M(t){return(t>0)-(t<0)}function P(t,e){return t^(t^e)&-(t<e)}function E(t){var e,i;return e=(t>65535)<<4,e|=i=((t>>>=e)>255)<<3,e|=i=((t>>>=i)>15)<<2,(e|=i=((t>>>=i)>3)<<1)|(t>>>=i)>>1}function O(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24}function k(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 R(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<<r&255}}(F);var L=Object.freeze({__proto__:null,INT_BITS:32,INT_MAX:I,INT_MIN:-1<<31,abs:function(t){var e=t>>31;return(t^e)-e},countTrailingZeros:k,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<e)},nextCombination:function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>k(t)+1},nextPow2:R,parity:function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1},popCount:O,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=B.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;r<i;r++)n[r-2]=arguments[r];console.log("ASSERT: "+q.apply(void 0,[e].concat(n)))}},j=U;function q(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return C.js.formatStr.apply(null,e)}function X(){return U.apply(void 0,arguments)}function Y(){return G.apply(void 0,arguments)}function J(){return H.apply(void 0,arguments)}function K(t,e){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];return W.apply(void 0,[t,e].concat(n))}function Q(){return j.apply(void 0,arguments)}function Z(t){if(U=G=H=W=j=function(){},0!==t){if(t>4){var e=function(t){if(C.game.canvas){if(!z){var e=V.createElement("Div");e.setAttribute("id","logInfoDiv"),e.setAttribute("width","200");var i=C.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),C.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;s<n;s++)r[s-2]=arguments[s];e("ASSERT: "+q.apply(void 0,[i].concat(r)))}},7!==t&&(G=function(){e("WARN : "+q.apply(void 0,arguments))}),5===t&&(U=function(){e(q.apply(void 0,arguments))})}else console&&(console.error||(console.error=console.log),console.warn||(console.warn=console.log),H=console.error.bind?console.error.bind(console):function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return console.error.apply(console,e)},W=function(t,e){if(!t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];var s=q.apply(void 0,[e].concat(n));throw new Error(s)}});if(4!==t&&(G=console.warn.bind?console.warn.bind(console):function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return console.warn.apply(console,e)}),t<=2&&(U=console.log.bind?console.log.bind(console):function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return console.log.apply(console,e)}),t<=1&&"function"==typeof console.debug){var i=console.debug.bind(console);j=function(){return i.apply(void 0,arguments)}}}}function $(t){J(t.stack||t)}function tt(t){return function(e){for(var i=t+" "+e+", please go to "+N+"#"+e+" to see details.",n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return 0===r.length?i:i+" Arguments: "+r.join(", ")}}var et=tt("Log");function it(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];X(et.apply(void 0,[t].concat(i)))}var nt=tt("Debug");function rt(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];Q(nt.apply(void 0,[t].concat(i)))}var st=tt("Warning");function at(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];Y(st.apply(void 0,[t].concat(i)))}var ot=tt("Error");function ht(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];J(ot.apply(void 0,[t].concat(i)))}var ut=tt("Assert");function lt(t,e){if(!t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];K(!1,ut.apply(void 0,[e].concat(n)))}}var ct=t("cl",{NONE:0,VERBOSE:1,INFO:2,WARN:3,ERROR:4,INFO_FOR_WEB_PAGE:5,WARN_FOR_WEB_PAGE:6,ERROR_FOR_WEB_PAGE:7});function ft(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return ot.apply(void 0,[t].concat(i))}function _t(){return!!C.profiler&&C.profiler.isShowingStats()}function dt(t){C.profiler&&(t?C.profiler.showStats():C.profiler.hideStats())}var pt,mt,gt,yt,vt,bt=Object.freeze({__proto__:null,DebugMode:ct,_resetDebugSetting:Z,_throw:$,assert:K,assertID:lt,debug:Q,debugID:rt,error:J,errorID:ht,getError:ft,isDisplayStats:_t,log:X,logID:it,setDisplayStats:dt,warn:Y,warnID:at}),St=10;t("bJ",pt),t("bK",mt),t("bL",gt);var wt=0,xt=new Map;yt=function(t,e,i,n,r,s,a){var o=xt.get(s);o&&o.logTimes>o.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=wt++;xt.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 yt(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 yt(e,i.name,a,s,Y,n,h),i.customGetter.call(this)},set:function(t){yt(e,i.name,a,s,Y,n,h),i.customSetter.call(this,t)},enumerable:!1}):u?Object.defineProperty(t,i.name,{set:function(t){yt(e,i.name,a,s,Y,n,h),i.customSetter.call(this,t)},enumerable:!1}):l&&Object.defineProperty(t,i.name,{get:function(){return yt(e,i.name,a,s,Y,n,h),i.customGetter.call(this)},enumerable:!1})}else Object.defineProperty(t,i.name,{get:function(){return yt(e,i.name,a,s,Y,n,h),o?this[s]:r[s]},set:function(t){yt(e,i.name,a,s,Y,n,h),o?this[s]=t:r[s]=t},enumerable:!1})}))}),vt=function(t,e,i,n,r){var s=xt.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=wt++;xt.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 vt(e,i.name,J,n,r)},set:function(){vt(e,i.name,J,n,r)},enumerable:!1})}))}),t("bL",gt=function(){});var Tt,At,Ct={};function Dt(t){for(var e in t){var i=t[e];Ct[e]=i}}function Bt(t){var e=Ct[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 It=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}();At=It,It.global=new At("global");var Mt=new It("TmpCId."),Pt="undefined"==typeof Symbol?"__aliases__":Symbol("[[Aliases]]"),Et="__classname__",Ot="__cid__";function kt(t){return"number"==typeof t||t instanceof Number}function Rt(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;n<e;n++)i[n-1]=arguments[n];if(0===arguments.length)return"";if(0===i.length)return""+t;if("string"==typeof t&&qt.test(t))for(var r,s=p(i);!(r=s()).done;){var a=r.value,o="number"==typeof a?qt:Xt;if(o.test(t)){var h=""+a;t=t.replace(o,h)}else t+=" "+a}else for(var u,l=p(i);!(u=l()).done;)t+=" "+u.value;return t}function Jt(){for(var t=arguments.length-1,e=new Array(t),i=0;i<t;++i)e[i]=arguments[i+1];return e}function Kt(t,e){for(;t;){var i=Object.getOwnPropertyDescriptor(t,e);if(i)return i;t=Object.getPrototypeOf(t)}return null}function Qt(t,e,i){var n=Kt(e,t);n&&Object.defineProperty(i,t,n)}function Zt(t){t=t||{};for(var e=0;e<(arguments.length<=1?0:arguments.length-1);++e){var i=e+1<1||arguments.length<=e+1?void 0:arguments[e+1];if(i){if("object"!=typeof i){ht(5402,i);continue}for(var n in i)n in t||Qt(n,i,t)}}return t}function $t(t){t=t||{};for(var e=0;e<(arguments.length<=1?0:arguments.length-1);++e){var i=e+1<1||arguments.length<=e+1?void 0:arguments[e+1];if(i){if("object"!=typeof i){ht(5403,i);continue}for(var n in i)Qt(n,i,t)}}return t}function te(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t.prototype=Object.create(e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),t}function ee(t){var e=t.prototype,i=e&&Object.getPrototypeOf(e);return i&&i.constructor}function ie(t,e){if(t&&e){if("function"!=typeof t)return!1;if("function"!=typeof e)return!1;if(t===e)return!0;for(;;){if(!(t=ee(t)))return!1;if(t===e)return!0}}return!1}function ne(t){for(var e=0,i=Object.keys(t);e<i.length;e++)delete t[i[e]]}var re=Gt(!0),se=Gt(!0);function ae(t,e,i){return function(n,r){if(r.prototype.hasOwnProperty(t)&&delete e[r.prototype[t]],Vt(r.prototype,t,n),n){var s=e[n];!i&&s&&s!==r?ht(16334,t,n,""):e[n]=r}}}var oe=ae("__cid__",re,!1),he=ae("__classname__",se,!0);function ue(t,e){if(he(t,e),!e.prototype.hasOwnProperty(Ot)){var i=t||Mt.getNewId();i&&oe(i,e)}}function le(t,e){var i=se[e],n=re[e],r=!0;if(i&&i!==t&&(ht(16335,e),r=!1),n&&n!==t&&(ht(16336,e),r=!1),r){var s=t[Pt];s||(s=[],t[Pt]=s),s.push(e),se[e]=t,re[e]=t}}function ce(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var n=0,r=e;n<r.length;n++){var s=r[n].prototype,a=s[Ot];a&&delete re[a];var o=s[Et];o&&delete se[o];var h=s[Pt];if(h)for(var u=0;u<h.length;++u){var l=h[u];delete se[l],delete re[l]}}}function fe(t){return _e(t)}function _e(t){return re[t]}function de(t){return se[t]}function pe(t){return me(t)}function me(t){if("function"==typeof t&&t.prototype.hasOwnProperty(Ot))return t.prototype[Ot];if(t&&t.constructor){var e=t.constructor.prototype;if(e&&e.hasOwnProperty(Ot))return t[Ot]}return""}var ge=function(){var t=e.prototype;function e(t,e){this.count=0;var i=void 0===e?t:e,n=void 0===e?null:t;this._pool=new Array(i),this._cleanup=n}return t.get=function(){return this._get()},t._get=function(){if(this.count>0){--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<e.length){if(this._cleanup&&!1===this._cleanup(t))return;e[this.count]=t,++this.count}},t.resize=function(t){t>=0&&(this._pool.length=t,this.count>t&&(this.count=t))},e}(),ye=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 ve(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&&(ve(t,i),!0)}function we(t,e){var i=t.indexOf(e);i>=0&&(t[i]=t[t.length-1],--t.length)}function xe(t,e){var i=t.findIndex(e);if(i>=0){var n=t[i];return ve(t,i),n}}function Te(t,e){return t.indexOf(e)>=0}function Ae(t){for(var e=0,i=arguments.length<=1?0:arguments.length-1;e<i;++e)t[e]=e+1<1||arguments.length<=e+1?void 0:arguments[e+1]}var Ce=Object.freeze({__proto__:null,MutableForwardIterator:ye,appendObjectsAt:function(t,e,i){return t.splice.apply(t,[i,0].concat(e)),t},contains:Te,copy:function(t){for(var e=t.length,i=new Array(e),n=0;n<e;n+=1)i[n]=t[n];return i},fastRemove:we,fastRemoveAt:be,fillItems:Ae,remove:Se,removeArray:function(t,e){for(var i=0,n=e.length;i<n;i++)Se(t,e[i])},removeAt:ve,removeIf:xe,verifyType:function(t,e){if(t&&t.length>0)for(var i,n=p(t);!(i=n()).done;)if(!(i.value instanceof e))return it(1300),!1;return!0}}),De={IDGenerator:It,Pool:ge,array:Ce,isNumber:kt,isString:Rt,isEmptyObject:Ft,getPropertyDescriptor:Kt,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:de,getClassById:_e,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:Jt,createMap:Gt};C.js=De;var Be=Object.freeze({__proto__:null,IDGenerator:It,Pool:ge,_getClassById:fe,_getClassId:pe,_idToClass:re,_nameToClass:se,_setClassId:oe,addon:Zt,array:Ce,clear:ne,copyAllProperties:function(t,e,i){for(var n=Object.getOwnPropertyNames(t),r=0,s=n.length;r<s;++r){var a=n[r];-1===i.indexOf(a)&&Qt(a,t,e)}},createMap:Gt,extend:te,formatStr:Yt,get:zt,getClassById:_e,getClassByName:de,getClassId:me,getClassName:Ht,getPropertyDescriptor:Kt,getSuper:ee,getset:Nt,isChildClassOf:ie,isEmptyObject:Ft,isNumber:kt,isString:Rt,js:De,mixin:$t,obsolete:Wt,obsoletes:jt,set:Ut,setClassAlias:le,setClassName:ue,shiftArguments:Jt,unregisterClass:ce,value:Vt});function Ie(t){if("__bitmask__"in t)return t;Vt(t,"__bitmask__",null,!0);for(var e=-1,i=Object.keys(t),n=0;n<i.length;n++){var r=i[n],s=t[r];if(-1===s)s=++e,t[r]=s;else if("number"==typeof s)e=s;else if("string"==typeof s&&Number.isInteger(parseFloat(r)))continue;var a=""+s;r!==a&&Vt(t,a,r)}return t}function Me(t,e){e>=0&&t.length,t.length}t("bF",Be),Ie.isBitMask=function(t){return t&&Object.prototype.hasOwnProperty.call(t,"__bitmask__")},Ie.getList=function(t){return t.__bitmask__?t.__bitmask__:Ie.update(t)},Ie.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},C.BitMask=Ie;var Pe=Object.prototype.hasOwnProperty;function Ee(t){return"__enums__"in t?t:(Vt(t,"__enums__",null,!0),Ee.update(t))}function Oe(t){Pe.call(t,"__enums__")}function ke(t){Oe(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 Re(t){"__enums__"in t||Vt(t,"__enums__",null,!0)}Ee.update=function(t){for(var e=-1,i=Object.keys(t),n=0;n<i.length;n++){var r=i[n],s=t[r];if(-1===s)s=++e,t[r]=s;else if("number"==typeof s)e=s;else if("string"==typeof s&&Number.isInteger(parseFloat(r)))continue;var a=""+s;r!==a&&Vt(t,a,r)}return Array.isArray(t.__enums__)&&ke(t),t},Ee.isEnum=function(t){return t&&Pe.call(t,"__enums__")},Ee.getList=function(t){return Oe(t),t.__enums__?t.__enums__:ke(t)},Ee.sortList=function(t,e){Oe(t),Array.isArray(t.__enums__)&&t.__enums__.sort(e)},C.Enum=Ee;var Fe=t("bE",function(){function t(){}var e=t.prototype;return e.clone=function(){return ht(100,Ht(this)+".clone"),this},e.equals=function(){return!1},e.set=function(){ht(100,Ht(this)+".set")},e.toString=function(){return""},t}());ue("cc.ValueType",Fe),C.ValueType=Fe;var Le=t("cB",{PATH:"path",ENGINE:"engine",ASSETS:"assets",SCRIPTING:"scripting",PHYSICS:"physics",RENDERING:"rendering",LAUNCH:"launch",SCREEN:"screen",SPLASH_SCREEN:"splashScreen",ANIMATION:"animation",PROFILING:"profiling",PLUGINS:"plugins",XR:"xr"}),Ve=t("cC",function(){function t(){this._settings={},this._override={}}var e=t.prototype;return e.init=function(t,e){var i=this;for(var n in void 0===t&&(t=""),void 0===e&&(e={}),e){var r=e[n];if(r)for(var s in r)this.overrideSettings(n,s,r[s])}return t?new Promise((function(e,n){var r=new XMLHttpRequest;r.open("GET",t),r.responseType="text",r.onload=function(){i._settings=JSON.parse(r.response),e()},r.onerror=function(){n(new Error("request settings failed!"))},r.send(null)})):Promise.resolve()},e.overrideSettings=function(t,e,i){t in this._override||(this._override[t]={}),this._override[t][e]=i},e.querySettings=function(t,e){if(t in this._override){var i=this._override[t];if(i&&e in i)return i[e]}if(t in this._settings){var n=this._settings[t];if(n&&e in n)return n[e]}return null},t}());Ve.Category=Le;var Ne,ze=t("cD",new Ve);C.settings=ze,function(t){t[t.PORTRAIT=1]="PORTRAIT",t[t.PORTRAIT_UPSIDE_DOWN=2]="PORTRAIT_UPSIDE_DOWN",t[t.LANDSCAPE_LEFT=4]="LANDSCAPE_LEFT",t[t.LANDSCAPE_RIGHT=8]="LANDSCAPE_RIGHT",t[t.LANDSCAPE=12]="LANDSCAPE",t[t.AUTO=13]="AUTO"}(Ne||(Ne={}));var Ue=t("co",{SUPPORT_TEXTURE_FORMATS:[".astc",".pkm",".pvr",".webp",".jpg",".jpeg",".bmp",".png"],KEY:{none:0,back:6,menu:18,backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,pause:19,capslock:20,escape:27,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,select:41,insert:45,Delete:46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,num0:96,num1:97,num2:98,num3:99,num4:100,num5:101,num6:102,num7:103,num8:104,num9:105,"*":106,"+":107,"-":109,numdel:110,"/":111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,numlock:144,scrolllock:145,";":186,semicolon:186,equal:187,"=":187,",":188,comma:188,dash:189,".":190,period:190,forwardslash:191,grave:192,"[":219,openbracket:219,backslash:220,"]":221,closebracket:221,quote:222,dpadLeft:1e3,dpadRight:1001,dpadUp:1003,dpadDown:1004,dpadCenter:1005},RAD:Math.PI/180,DEG:180/Math.PI,REPEAT_FOREVER:Number.MAX_VALUE-1,FLT_EPSILON:1.192092896e-7,ORIENTATION_PORTRAIT:Ne.PORTRAIT,ORIENTATION_PORTRAIT_UPSIDE_DOWN:Ne.PORTRAIT_UPSIDE_DOWN,ORIENTATION_LANDSCAPE:Ne.LANDSCAPE,ORIENTATION_LANDSCAPE_LEFT:Ne.LANDSCAPE_LEFT,ORIENTATION_LANDSCAPE_RIGHT:Ne.LANDSCAPE_RIGHT,ORIENTATION_AUTO:Ne.AUTO,ENABLE_TILEDMAP_CULLING:!0,TOUCH_TIMEOUT:5e3,ENABLE_TRANSPARENT_CANVAS:!1,ENABLE_WEBGL_ANTIALIAS:!0,ENABLE_FLOAT_OUTPUT:!1,CLEANUP_IMAGE_CACHE:!1,ENABLE_MULTI_TOUCH:!0,MAX_LABEL_CANVAS_POOL_SIZE:20,ENABLE_WEBGL_HIGHP_STRUCT_VALUES:!1,BATCHER2D_MEM_INCREMENT:144,CUSTOM_PIPELINE_NAME:"Builtin",init:function(){var t=ze.querySettings("engine","macros");if(t)for(var e in t)Ue[e]=t[e]}});function Ge(t,e){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];var s=performance.now(),a=requestAnimationFrame||window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;return void 0===a?setTimeout.apply(void 0,[t,e].concat(n)):a((function i(){performance.now()-s<e?a(i):t.apply(void 0,n)}))}C.macro=Ue;for(var He=/^(?:cc|dragonBones|sp|ccsg)\..+/,We=new Array(123),je=0;je<123;++je)We[je]=64;for(var qe=0;qe<64;++qe)We["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(qe)]=qe;var Xe=We;function Ye(t,e,i){function n(t,e,i,n){var r=Object.getOwnPropertyDescriptor(t,e);if(r)r.get&&i&&(t[i]=r.get),r.set&&n&&(t[n]=r.set);else{var s=t[i];Nt(t,e,s,t[n])}}for(var r,s=t.prototype,a=0,o=e.length;a<o;++a){var h=(r=e[a])[0].toUpperCase()+r.slice(1);n(s,r,"get"+h,"set"+h)}for(r in i){var u=i[r];n(s,r,u[0],u[1])}}function Je(t,e,i,n){var r=t[e];r?Array.isArray(r)?n?(r.push(r[0]),r[0]=i):r.push(i):t[e]=n?[i,r]:[r,i]:t[e]=i}function Ke(t,e){if("function"==typeof t.contains)return t.contains(e);if("function"==typeof t.compareDocumentPosition)return!!(16&t.compareDocumentPosition(e));var i=e.parentNode;if(i)do{if(i===t)return!0;i=i.parentNode}while(null!==i);return!1}function Qe(t){return"object"==typeof window&&"function"==typeof Node?t instanceof Node:!!t&&"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName}function Ze(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];t&&Ge((function(){t.apply(void 0,i)}),0)}function $e(t){return!(!t||t.constructor!==Object)&&Ft(t)}function ti(t,e,i){if(e>i){var n=e;e=i,i=n}return t<e?e:t<i?t:i}function ei(t){return t*Ue.RAD}function ii(t){return t*Ue.DEG}C.misc={BUILTIN_CLASSID_RE:He,BASE64_VALUES:Xe,propertyDefine:Ye,pushToMap:Je,contains:Ke,isDomNode:Qe,callInNextTick:Ze,isPlainEmptyObj_DEV:$e,clampf:ti,degreesToRadians:ei,radiansToDegrees:ii},t("bG",Object.freeze({__proto__:null,BASE64_VALUES:Xe,BUILTIN_CLASSID_RE:He,callInNextTick:Ze,clampf:ti,contains:Ke,degreesToRadians:ei,isDomNode:Qe,isPlainEmptyObj_DEV:$e,propertyDefine:Ye,pushToMap:Je,radiansToDegrees:ii,tryCatchFunctor_EDITOR:function(t){return Function("target","try {\n target."+t+"();\n}\ncatch (e) {\n cc._throw(e);\n}")}}));var ni="$_$";function ri(t,e){var i=e?Object.create(e):{};return Vt(t,"__attrs__",i),i}function si(t){if("function"!=typeof t)return ri(t,oi(t.constructor));for(var e,i=C.Class.getInheritanceChain(t),n=i.length-1;n>=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));C.Integer=li,C.CCInteger=li;var ci=t("bY",new ui("Float",0));C.Float=ci,C.CCFloat=ci;var fi=t("bZ",new ui("Boolean",!1));C.Boolean=fi,C.CCBoolean=fi;var _i=t("b_",new ui("String",""));function di(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!==_i&&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===_i.default&&null==o?at(3607,r):at(3611,e,r,h)}delete s.type}}}else at(3604,r)}}C.String=_i,C.CCString=_i;var pi=Object.freeze({__proto__:null,CCBoolean:fi,CCFloat:ci,CCInteger:li,CCString:_i,DELIMETER:ni,PrimitiveType:ui,attr:ai,createAttrs:si,createAttrsSingle:ri,getClassAttrs:oi,getObjTypeChecker_ET:function(t){return function(e,i){di("Object","type")(e,i);var n=oi(e)[i+ni+"default"],r=C.Class.getDefault(n);if(!Array.isArray(r)&&ie(t,C.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:di,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 yi(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=C.String:e===Boolean?t.type=C.Boolean:e===Number&&(t.type=C.Float))}function vi(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 vi(e,[],t);if("function"==typeof t){var i=t;return vi(e,ie(i,C.ValueType)?new i:null,i)}return t instanceof ui?vi(e,void 0,t):vi(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&&yi(n,n.type,e,i)}}}var wi=[];function xi(){return wi[wi.length-1]}function Ti(t,e,i){Ai(oi(t),e,i)}function Ai(t,e,i){t[""+e+ni+"type"]="Enum",t[""+e+ni+"enumList"]=Ee.getList(i)}C._RF={push:function(t,e,i,n){void 0===i&&(i=e,e=""),wi.push({uuid:e,script:i,module:t,exports:t.exports,beh:null,importMeta:n})},pop:function(){var t=wi.pop(),e=t.module,i=e.exports;if(i===t.exports){for(var n in i)return;e.exports=i=t.cls}},peek:xi};var Ci=ni,Di="__ctors__",Bi=t("c$","Enum"),Ii=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 Oi(t,e,i,n){var r=n.get;n.set,r&&(Ui(t,n,e,i),hi(t,i,"serializable",!1))}function ki(t){return"function"==typeof t?t():t}function Ri(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=C.Component,r=xi();if(r&&ie(e,n)){if(ie(r.cls,n))return ht(3615),null;t=t||r.script}var s=Ri(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?Oi(t,e,r,s):Ei(t,e,r,s)}var a=oi(t);t.__values__=t.__props__.filter((function(t){return!1!==a[""+t+Ci+"serializable"]}))}function Vi(t){var e=t.name,i=t.extends,n=Fi(e,i,t);e||(e=C.js.getClassName(n)),n._sealed=!0,i&&(i._sealed=!1),Li(n,e,t.properties,i);var r=t.editor;return r&&ie(i,C.Component)&&C.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<n.length;s++){var a=n[s];r[a+Ci+"visible"]=!1,r[a+Ci+"default"]=i[a]}},Vi.Attr=pi,Vi.attr=ai,Vi.isCCClassOrFastDefined=Ni,Vi.getInheritanceChain=function(t){for(var e=[];t=ee(t);)t!==Object&&e.push(t);return e};var zi={Integer:"Number",Float:"Number",Boolean:"Boolean",String:"String"};function Ui(t,e,i,n){var r=null,s="";function a(){return s=n+Ci,r=oi(t)}"type"in e&&void 0===e.type&&at(3660,n,i);var o=e.type;o&&(zi[o]?(r||a())[s+"type"]=o:"Object"===o||("object"==typeof o?Ee.isEnum(o)?Ai(r||a(),n,o):Ie.isBitMask(o)&&((r||a())[s+"type"]=Ii,r[s+"bitmaskList"]=Ie.getList(o)):"function"==typeof o&&((r||a())[s+"type"]="Object",r[s+"ctor"]=o))),"default"in e&&((r||a())[s+"default"]=e.default);var h,u=function(t,i){if(t in e){var n=e[t];typeof n===i&&((r||a())[s+t]=n)}};e.editorOnly&&((r||a())[s+"editorOnly"]=!0),1&e.__internalFlags?h=!0===e.serializable||!!(4&e.__internalFlags):!1===e.serializable&&(h=!1),void 0!==h&&((r||a())[s+"serializable"]=h),u("formerlySerializedAs","string");var l=e.range;l&&Array.isArray(l)&&l.length>=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=ki(t),Array.isArray(t)},Vi.getDefault=ki,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;r<i.__props__.length;r++)n+=t[i.__props__[r]],r<i.__props__.length-1&&(n+=",");return n+")"},C.Class=Vi;var Gi=Math.abs,Hi=Math.floor,Wi=Math.PI,ji=Wi/180,qi=180/Wi,Xi=Math.random,Yi=t("b6",.5*Wi),Ji=t("b7",2*Wi),Ki=t("b8",1e-6);function Qi(t,e){return Gi(t-e)<=Ki*Math.max(1,Gi(t),Gi(e))}function Zi(t,e,i){return i=i||Ki,Gi(t-e)<=i}function $i(t,e,i){if(e>i){var n=e;e=i,i=n}return t<e?e:t>i?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 R(t)}function _n(t,e){return t-Hi(t/e)*e}function dn(t,e){return t=_n(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 yn(t,e){e.forEach((function(e){Object.defineProperty(t,e,{enumerable:!0})}))}var vn,bn,Sn=(vn=new Float32Array(1),bn=new Int32Array(vn.buffer),function(t){vn[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]}),wn=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 xn(t){return Sn(t)}function Tn(t){return wn(t)}var An=Math.abs,Cn=Math.max,Dn=Math.min,Bn=Math.PI,In=Math.sin,Mn=Math.cos,Pn=Math.atan2,En=Math.sqrt,On=Math.ceil,kn=Math.floor,Rn=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=On(e.x),t.y=On(e.y),t.z=On(e.z),t.w=On(e.w),t},e.floor=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.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=Cn(e.x,i.x),t.y=Cn(e.y,i.y),t.z=Cn(e.z,i.z),t.w=Cn(e.w,i.w),t},e.round=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.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 An(i)<Ki?t.x=0:t.x=1/i,An(n)<Ki?t.y=0:t.y=1/n,An(r)<Ki?t.z=0:t.z=1/r,An(s)<Ki?t.w=0:t.w=1/s,t},e.normalize=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,a=i*i+n*n+r*r+s*s;return a>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()*Bn,n=2*sn()-1,r=En(1-n*n);return t.x=r*Mn(i)*e,t.y=r*In(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,_=-a*n-o*r-h*s;return t.x=l*u+_*-a+c*-h-f*-o,t.y=c*u+_*-o+f*-a-l*-h,t.z=f*u+_*-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=Ki);var n=1/0;return!(An(t.x)===n||An(t.y)===n||An(t.z)===n||An(t.w)===n||An(e.x)===n||An(e.y)===n||An(e.z)===n||An(e.w)===n)&&An(t.x-e.x)<=i*Cn(1,An(t.x),An(e.x))&&An(t.y-e.y)<=i*Cn(1,An(t.y),An(e.y))&&An(t.z-e.z)<=i*Cn(1,An(t.z),An(e.z))&&An(t.w-e.w)<=i*Cn(1,An(t.w),An(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=Ki);var i=this;return An(i.x-t.x)<=e*Cn(1,An(i.x),An(t.x))&&An(i.y-t.y)<=e*Cn(1,An(i.y),An(t.y))&&An(i.z-t.z)<=e*Cn(1,An(i.z),An(t.z))&&An(i.w-t.w)<=e*Cn(1,An(i.w),An(t.w))},i.equals4f=function(t,e,i,n,r){void 0===r&&(r=Ki);var s=this;return An(s.x-t)<=r*Cn(1,An(s.x),An(t))&&An(s.y-e)<=r*Cn(1,An(s.y),An(e))&&An(s.z-i)<=r*Cn(1,An(s.z),An(i))&&An(s.w-n)<=r*Cn(1,An(s.w),An(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}),C.Vec4=Vn,C.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,Jn=Math.floor,Kn=Math.round;function Qn(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=Jn(e.x),t.y=Jn(e.y),t.z=Jn(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=Kn(e.x),t.y=Kn(e.y),t.z=Kn(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)<Ki?t.x=0:t.x=1/i,zn(n)<Ki?t.y=0:t.y=1/n,zn(r)<Ki?t.z=0:t.z=1/r,t},e.normalize=function(t,e){var i=e.x,n=e.y,r=e.z,s=i*i+n*n+r*r;return s>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),_=s*(h*h*(1-c)+c)+a*(h*u*(1-c)-l*f)+o*(h*l*(1-c)+u*f),d=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=_+i.x,t.y=d+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=Ki);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&&o<n*n)return t.x=i.x,t.y=i.y,t.z=i.z,t;var h=n/Xn(o);return t.x=e.x+r*h,t.y=e.y+s*h,t.z=e.z+a*h,t},e.generateOrthogonal=function(t,i){var n=i.x,r=i.y,s=i.z,a=zn(n),o=zn(r),h=zn(s);return a<o&&a<h?e.set(t,0,s,-r):o<h?e.set(t,s,0,-n):e.set(t,r,-n,0),e.normalize(t,t)};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z)},i.set=function(t,e,i){return"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z):(this.x=t||0,this.y=e||0,this.z=i||0),this},i.equals=function(t,e){return void 0===e&&(e=Ki),zn(this.x-t.x)<=e&&zn(this.y-t.y)<=e&&zn(this.z-t.z)<=e},i.equals3f=function(t,e,i,n){return void 0===n&&(n=Ki),zn(this.x-t)<=n&&zn(this.y-e)<=n&&zn(this.z-i)<=n},i.strictEquals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},i.strictEquals3f=function(t,e,i){return this.x===t&&this.y===e&&this.z===i},i.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},i.lerp=function(t,e){return this.x+=e*(t.x-this.x),this.y+=e*(t.y-this.y),this.z+=e*(t.z-this.z),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},i.add3f=function(t,e,i){return this.x+=t,this.y+=e,this.z+=i,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},i.subtract3f=function(t,e,i){return this.x-=t,this.y-=e,this.z-=i,this},i.multiplyScalar=function(t){return"object"==typeof t&&at(16357),this.x*=t,this.y*=t,this.z*=t,this},i.multiply=function(t){return"object"!=typeof t&&at(16358),this.x*=t.x,this.y*=t.y,this.z*=t.z,this},i.multiply3f=function(t,e,i){return this.x*=t,this.y*=e,this.z*=i,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},i.divide3f=function(t,e,i){return this.x/=t,this.y/=e,this.z/=i,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},i.clampf=function(t,e){return this.x=$i(this.x,t.x,e.x),this.y=$i(this.y,t.y,e.y),this.z=$i(this.z,t.z,e.z),this},i.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},i.cross=function(t){var e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,a=t.z;return this.x=i*a-n*s,this.y=n*r-e*a,this.z=e*s-i*r,this},i.length=function(){var t=this;return Xn(t.x*t.x+t.y*t.y+t.z*t.z)},i.lengthSqr=function(){var t=this;return t.x*t.x+t.y*t.y+t.z*t.z},i.normalize=function(){var t=this,e=t.x,i=t.y,n=t.z,r=e*e+i*i+n*n;return r>0&&(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 C.Vec2(this.x,this.y)},e}(Fe));function nr(t,e,i){return new ir(t,e,i)}Ln=ir,ir.UNIT_X=Qn(1,0,0),ir.UNIT_Y=Qn(0,1,0),ir.UNIT_Z=Qn(0,0,1),ir.RIGHT=Qn(1,0,0),ir.UP=Qn(0,1,0),ir.FORWARD=Qn(0,0,-1),ir.ZERO=Qn(0,0,0),ir.ONE=Qn(1,1,1),ir.NEG_ONE=Qn(-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<r||a<r)return Ln.lerp(t,e,i,n);var o=en(s,a,n),h=Ln.dot(e,i)/(s*a);if(h>.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,_=Ln.multiplyScalar(Zn,e,1/s),d=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,_,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}),C.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});C.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=Ki),!(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 _r(t,e,i){if(e>i){var n=e;e=i,i=n}return t<e?e:t>i?i:t}function dr(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}function pr(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=_r(t.multiplyScalar(n),new ir(0,0,0),new ir(1,1,1));r.multiplyScalar(255);var s,a,o=dr(r).add((s=r.subtract(dr(r)))<(a=new ir(.5,.5,.5))?a:s);return new Vn(o.x/255,o.y/255,o.z/255,i/255)}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}),C.Color=cr,C.color=fr;var mr=Math.abs,gr=Math.max,yr=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,_=-c*a+h*u,d=l*a-o*u,p=n*f+r*_+s*d;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=_*p,t.m04=(c*n-s*u)*p,t.m05=(-h*n+s*a)*p,t.m06=d*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,_=i.m01,d=i.m02,p=i.m03,m=i.m04,g=i.m05,y=i.m06,v=i.m07,b=i.m08;return t.m00=f*n+_*a+d*u,t.m01=f*r+_*o+d*l,t.m02=f*s+_*h+d*c,t.m03=p*n+m*a+g*u,t.m04=p*r+m*o+g*l,t.m05=p*s+m*h+g*c,t.m06=y*n+v*a+b*u,t.m07=y*r+v*o+b*l,t.m08=y*s+v*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,_=i.m01,d=i.m02,p=i.m04,m=i.m05,g=i.m06,y=i.m08,v=i.m09,b=i.m10;return t.m00=f*n+_*a+d*u,t.m01=f*r+_*o+d*l,t.m02=f*s+_*h+d*c,t.m03=p*n+m*a+g*u,t.m04=p*r+m*o+g*l,t.m05=p*s+m*h+g*c,t.m06=y*n+v*a+b*u,t.m07=y*r+v*o+b*l,t.m08=y*s+v*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,_=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+_*a+u,t.m07=f*r+_*o+l,t.m08=f*s+_*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),_=Math.cos(i);return t.m00=_*n+f*a,t.m01=_*r+f*o,t.m02=_*s+f*h,t.m03=_*a-f*n,t.m04=_*o-f*r,t.m05=_*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)<Ki*Ki?(e.identity(t),t):(n=n||ir.UNIT_Y,ir.normalize(br,ir.cross(br,n,i)),ir.lengthSqr(br)<Ki*Ki?(e.identity(t),t):(ir.cross(Sr,i,br),e.set(t,br.x,br.y,br.z,Sr.x,Sr.y,Sr.z,i.x,i.y,i.z),t))},e.fromTranslation=function(t,e){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=1,t.m05=0,t.m06=e.x,t.m07=e.y,t.m08=1,t},e.fromScaling=function(t,e){return t.m00=e.x,t.m01=0,t.m02=0,t.m03=0,t.m04=e.y,t.m05=0,t.m06=0,t.m07=0,t.m08=1,t},e.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t.m00=n,t.m01=i,t.m02=0,t.m03=-i,t.m04=n,t.m05=0,t.m06=0,t.m07=0,t.m08=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,_=r*o,d=r*h,p=s*a,m=s*o,g=s*h;return t.m00=1-c-d,t.m03=l-g,t.m06=f+m,t.m01=l+g,t.m04=1-u-d,t.m07=_-p,t.m02=f-m,t.m05=_+p,t.m08=1-u-c,t},e.inverseTransposeMat4=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,_=e.m11,d=e.m12,p=e.m13,m=e.m14,g=e.m15,y=i*o-n*a,v=i*h-r*a,b=i*u-s*a,S=n*h-r*o,w=n*u-s*o,x=r*u-s*h,T=l*p-c*d,A=l*m-f*d,C=l*g-_*d,D=c*m-f*p,B=c*g-_*p,I=f*g-_*m,M=y*I-v*B+b*D+S*C-w*A+x*T;return M?(M=1/M,t.m00=(o*I-h*B+u*D)*M,t.m01=(h*C-a*I-u*A)*M,t.m02=(a*B-o*C+u*T)*M,t.m03=(r*B-n*I-s*D)*M,t.m04=(i*I-r*C+s*A)*M,t.m05=(n*C-i*B-s*T)*M,t.m06=(p*x-m*w+g*S)*M,t.m07=(m*b-d*x-g*v)*M,t.m08=(d*w-p*b+g*y)*M,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},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},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},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},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},e.multiplyScalarAndAdd=function(t,e,i,n){return t.m00=i.m00*n+e.m00,t.m01=i.m01*n+e.m01,t.m02=i.m02*n+e.m02,t.m03=i.m03*n+e.m03,t.m04=i.m04*n+e.m04,t.m05=i.m05*n+e.m05,t.m06=i.m06*n+e.m06,t.m07=i.m07*n+e.m07,t.m08=i.m08*n+e.m08,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},e.equals=function(t,e,i){return void 0===i&&(i=Ki),mr(t.m00-e.m00)<=i*gr(1,mr(t.m00),mr(e.m00))&&mr(t.m01-e.m01)<=i*gr(1,mr(t.m01),mr(e.m01))&&mr(t.m02-e.m02)<=i*gr(1,mr(t.m02),mr(e.m02))&&mr(t.m03-e.m03)<=i*gr(1,mr(t.m03),mr(e.m03))&&mr(t.m04-e.m04)<=i*gr(1,mr(t.m04),mr(e.m04))&&mr(t.m05-e.m05)<=i*gr(1,mr(t.m05),mr(e.m05))&&mr(t.m06-e.m06)<=i*gr(1,mr(t.m06),mr(e.m06))&&mr(t.m07-e.m07)<=i*gr(1,mr(t.m07),mr(e.m07))&&mr(t.m08-e.m08)<=i*gr(1,mr(t.m08),mr(e.m08))},e.toEuler=function(t,e){var i=t.m00,n=t.m01;t.m02;var r=t.m03,s=t.m04;t.m05;var a=t.m06,o=t.m07,h=t.m08;return o<.999?o>-.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=Ki),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,_=n*o,d=r*s,p=r*a,m=r*o,g=this;return g.m00=1-l-_,g.m03=u-m,g.m06=c+p,g.m01=u+m,g.m04=1-h-_,g.m07=f-d,g.m02=c-p,g.m05=f+d,g.m08=1-h-l,g},e}(Fe));lr=yr,yr.IDENTITY=Object.freeze(new lr);var vr,br=new ir,Sr=new ir;Vi.fastDefine("cc.Mat3",yr,{m00:1,m01:0,m02:0,m03:0,m04:1,m05:0,m06:0,m07:0,m08:1}),C.Mat3=yr;var wr=Math.abs,Tr=Math.max,Ar=Math.min,Cr=Math.PI,Dr=Math.acos,Br=Math.sin,Ir=Math.cos,Mr=Math.sqrt,Pr=Math.atan2,Er=Math.asin,Or=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(Vr,ir.UNIT_X,i),Vr.length()<1e-6&&ir.cross(Vr,ir.UNIT_Y,i),ir.normalize(Vr,Vr),e.fromAxisAngle(t,Vr,Cr),t):r>.999999?(t.x=0,t.y=0,t.z=0,t.w=1,t):(ir.cross(Vr,i,n),t.x=Vr.x,t.y=Vr.y,t.z=Vr.z,t.w=1+r,e.normalize(t,t))},e.getAxisAngle=function(t,e){var i=2*Dr(e.w),n=Br(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=Br(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=Br(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=Br(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(Fr,i),ir.transformQuat(Vr,n,Fr),e.fromAxisAngle(Fr,Vr,r),e.multiply(t,i,Fr),t},e.rotateAroundLocal=function(t,i,n,r){return e.fromAxisAngle(Fr,n,r),e.multiply(t,i,Fr),t},e.calculateW=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=Mr(wr(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=Dr(l),f=Br(c);r=Br((1-n)*c)/f,s=Br(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(Fr,i,s,a),e.slerp(Lr,n,r,a),e.slerp(t,Fr,Lr,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 Mr(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/Mr(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 yr.set(Nr,i.x,i.y,i.z,n.x,n.y,n.z,r.x,r.y,r.z),e.normalize(t,e.fromMat3(t,Nr))},e.fromViewUp=function(t,i,n){return yr.fromViewUp(Nr,i,n),e.normalize(t,e.fromMat3(t,Nr))},e.fromAxisAngle=function(t,e,i){var n=Br(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,_=l-i-a,d=0,p=i+a+l;c>p&&(p=c,d=1),f>p&&(p=f,d=2),_>p&&(p=_,d=3);var m=.5*Mr(p+1),g=.25/m;switch(d){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*=zr,n*=zr;var r=Br(e*=zr),s=Ir(e),a=Br(i),o=Ir(i),h=Br(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*=zr,t.x=t.y=0,t.z=Br(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*Pr(n,a)),u=90;else if(l<-.499999)o=0,h=-rn(2*Pr(n,a)),u=-90;else{var c=r*r,f=s*s;o=rn(Pr(2*n*a-2*r*s,1-n*n*2-2*f)),h=rn(Pr(2*r*a-2*n*s,1-2*c-2*f)),u=rn(Er(2*l)),i&&(o=-180*Or(o+1e-6)+o,h=-180*Or(h+1e-6)+h,u=180*Or(u+1e-6)-u)}return t.x=o,t.y=h,t.z=u,t},e.toEulerInYXZOrder=function(t,e){yr.fromQuat(Nr,e),yr.toEuler(Nr,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=Ki),wr(t.x-e.x)<=i*Tr(1,wr(t.x),wr(e.x))&&wr(t.y-e.y)<=i*Tr(1,wr(t.y),wr(e.y))&&wr(t.z-e.z)<=i*Tr(1,wr(t.z),wr(e.z))&&wr(t.w-e.w)<=i*Tr(1,wr(t.w),wr(e.w))},e.angle=function(t,i){var n=Ar(wr(e.dot(t,i)),1);return 2*Dr(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=Ar(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=Ki),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 Mr(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,Fr=new kr,Lr=new kr,Vr=new ir,Nr=new yr,zr=.5*Cr/180;function Ur(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}),C.Quat=kr,C.quat=Ur;var Gr=Object.freeze,Hr=t("b5",Gr([Gr([1,0,0,1]),Gr([0,1,-1,0]),Gr([-1,0,0,-1]),Gr([0,-1,1,0])])),Wr=Math.abs,jr=Math.max,qr=Math.sqrt,Xr=Math.sin,Yr=Math.cos,Jr=Math.tan,Kr=t("aZ",function(t){function e(e,i,n,r,s,a,o,h,u,l,c,_,d,p,m,g){var y;void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=0),void 0===c&&(c=1),void 0===_&&(_=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=0),void 0===g&&(g=1);var v=f(y=t.call(this)||this);return"object"==typeof e?(v.m00=e.m00,y.m01=e.m01,y.m02=e.m02,y.m03=e.m03,v.m04=e.m04,y.m05=e.m05,y.m06=e.m06,y.m07=e.m07,v.m08=e.m08,y.m09=e.m09,y.m10=e.m10,y.m11=e.m11,v.m12=e.m12,y.m13=e.m13,y.m14=e.m14,y.m15=e.m15):(v.m00=e,y.m01=i,y.m02=n,y.m03=r,v.m04=s,y.m05=a,y.m06=o,y.m07=h,v.m08=u,y.m09=l,y.m10=c,y.m11=_,v.m12=d,y.m13=p,y.m14=m,y.m15=g),y}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=_,t.m13=d,t.m14=p,t.m15=m,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=1,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=1,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.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,_=i.m10,d=i.m11,p=i.m12,m=i.m13,g=i.m14,y=i.m15,v=n*h-r*o,b=n*u-s*o,S=n*l-a*o,w=r*u-s*h,x=r*l-a*h,T=s*l-a*u,A=c*m-f*p,C=c*g-_*p,D=c*y-d*p,B=f*g-_*m,I=f*y-d*m,M=_*y-d*g,P=v*M-b*I+S*B+w*D-x*C+T*A;return 0===P?e.zero(t):(P=1/P,t.m00=(h*M-u*I+l*B)*P,t.m01=(s*I-r*M-a*B)*P,t.m02=(m*T-g*x+y*w)*P,t.m03=(_*x-f*T-d*w)*P,t.m04=(u*D-o*M-l*C)*P,t.m05=(n*M-s*D+a*C)*P,t.m06=(g*S-p*T-y*b)*P,t.m07=(c*T-_*S+d*b)*P,t.m08=(o*I-h*D+l*A)*P,t.m09=(r*D-n*I-a*A)*P,t.m10=(p*x-m*S+y*v)*P,t.m11=(f*S-c*x-d*v)*P,t.m12=(h*C-o*B-u*A)*P,t.m13=(n*B-r*C+s*A)*P,t.m14=(m*b-p*w-g*v)*P,t.m15=(c*w-f*b+_*v)*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,_=t.m12,d=t.m13,p=t.m14,m=t.m15;return(e*a-i*s)*(c*m-f*p)-(e*o-n*s)*(l*m-f*d)+(e*h-r*s)*(l*p-c*d)+(i*o-n*a)*(u*m-f*_)-(i*h-r*a)*(u*p-c*_)+(n*h-r*o)*(u*d-l*_)},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,_=e.m10,d=e.m11,p=e.m12,m=e.m13,g=e.m14,y=e.m15,v=i.m00,b=i.m01,S=i.m02,w=i.m03;return t.m00=v*n+b*o+S*c+w*p,t.m01=v*r+b*h+S*f+w*m,t.m02=v*s+b*u+S*_+w*g,t.m03=v*a+b*l+S*d+w*y,v=i.m04,b=i.m05,S=i.m06,w=i.m07,t.m04=v*n+b*o+S*c+w*p,t.m05=v*r+b*h+S*f+w*m,t.m06=v*s+b*u+S*_+w*g,t.m07=v*a+b*l+S*d+w*y,v=i.m08,b=i.m09,S=i.m10,w=i.m11,t.m08=v*n+b*o+S*c+w*p,t.m09=v*r+b*h+S*f+w*m,t.m10=v*s+b*u+S*_+w*g,t.m11=v*a+b*l+S*d+w*y,v=i.m12,b=i.m13,S=i.m14,w=i.m15,t.m12=v*n+b*o+S*c+w*p,t.m13=v*r+b*h+S*f+w*m,t.m14=v*s+b*u+S*_+w*g,t.m15=v*a+b*l+S*d+w*y,t},e.transform=function(t,e,i){var n=i.x,r=i.y,s=i.z;if(e===t)t.m12=e.m00*n+e.m04*r+e.m08*s+e.m12,t.m13=e.m01*n+e.m05*r+e.m09*s+e.m13,t.m14=e.m02*n+e.m06*r+e.m10*s+e.m14,t.m15=e.m03*n+e.m07*r+e.m11*s+e.m15;else{var a=e.m00,o=e.m01,h=e.m02,u=e.m03,l=e.m04,c=e.m05,f=e.m06,_=e.m07,d=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=_,t.m08=d,t.m09=p,t.m10=m,t.m11=g,t.m12=a*n+l*r+d*s+e.m12,t.m13=o*n+c*r+p*s+e.m13,t.m14=h*n+f*r+m*s+e.m14,t.m15=u*n+_*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=qr(r*r+s*s+a*a);if(Wr(o)<Ki)return null;r*=o=1/o,s*=o,a*=o;var h=Xr(i),u=Yr(i),l=1-u,c=e.m00,f=e.m01,_=e.m02,d=e.m03,p=e.m04,m=e.m05,g=e.m06,y=e.m07,v=e.m08,b=e.m09,S=e.m10,w=e.m11,x=r*r*l+u,T=s*r*l+a*h,A=a*r*l-s*h,C=r*s*l-a*h,D=s*s*l+u,B=a*s*l+r*h,I=r*a*l+s*h,M=s*a*l-r*h,P=a*a*l+u;return t.m00=c*x+p*T+v*A,t.m01=f*x+m*T+b*A,t.m02=_*x+g*T+S*A,t.m03=d*x+y*T+w*A,t.m04=c*C+p*D+v*B,t.m05=f*C+m*D+b*B,t.m06=_*C+g*D+S*B,t.m07=d*C+y*D+w*B,t.m08=c*I+p*M+v*P,t.m09=f*I+m*M+b*P,t.m10=_*I+g*M+S*P,t.m11=d*I+y*M+w*P,e!==t&&(t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15),t},e.rotateX=function(t,e,i){var n=Xr(i),r=Yr(i),s=e.m04,a=e.m05,o=e.m06,h=e.m07,u=e.m08,l=e.m09,c=e.m10,f=e.m11;return e!==t&&(t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15),t.m04=s*r+u*n,t.m05=a*r+l*n,t.m06=o*r+c*n,t.m07=h*r+f*n,t.m08=u*r-s*n,t.m09=l*r-a*n,t.m10=c*r-o*n,t.m11=f*r-h*n,t},e.rotateY=function(t,e,i){var n=Xr(i),r=Yr(i),s=e.m00,a=e.m01,o=e.m02,h=e.m03,u=e.m08,l=e.m09,c=e.m10,f=e.m11;return e!==t&&(t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15),t.m00=s*r-u*n,t.m01=a*r-l*n,t.m02=o*r-c*n,t.m03=h*r-f*n,t.m08=s*n+u*r,t.m09=a*n+l*r,t.m10=o*n+c*r,t.m11=h*n+f*r,t},e.rotateZ=function(t,e,i){var n=Xr(i),r=Yr(i),s=e.m00,a=e.m01,o=e.m02,h=e.m03,u=e.m04,l=e.m05,c=e.m06,f=e.m07;return e!==t&&(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.m00=s*r+u*n,t.m01=a*r+l*n,t.m02=o*r+c*n,t.m03=h*r+f*n,t.m04=u*r-s*n,t.m05=l*r-a*n,t.m06=c*r-o*n,t.m07=f*r-h*n,t},e.fromTranslation=function(t,i){return e.identity(t),t.m12=i.x,t.m13=i.y,t.m14=i.z,t},e.fromScaling=function(t,i){return e.identity(t),t.m00=i.x,t.m05=i.y,t.m10=i.z,t},e.fromRotation=function(t,e,i){var n=i.x,r=i.y,s=i.z,a=qr(n*n+r*r+s*s);if(Wr(a)<Ki)return null;n*=a=1/a,r*=a,s*=a;var o=Xr(e),h=Yr(e),u=1-h;return t.m00=n*n*u+h,t.m01=r*n*u+s*o,t.m02=s*n*u-r*o,t.m03=0,t.m04=n*r*u-s*o,t.m05=r*r*u+h,t.m06=s*r*u+n*o,t.m07=0,t.m08=n*s*u+r*o,t.m09=r*s*u-n*o,t.m10=s*s*u+h,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.fromXRotation=function(t,i){var n=Xr(i),r=Yr(i);return e.identity(t),t.m05=r,t.m06=n,t.m09=-n,t.m10=r,t},e.fromYRotation=function(t,i){var n=Xr(i),r=Yr(i);return e.identity(t),t.m00=r,t.m02=-n,t.m08=n,t.m10=r,t},e.fromZRotation=function(t,i){var n=Xr(i),r=Yr(i);return e.identity(t),t.m00=r,t.m01=n,t.m04=-n,t.m05=r,t},e.fromRT=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w,o=n+n,h=r+r,u=s+s,l=n*o,c=n*h,f=n*u,_=r*h,d=r*u,p=s*u,m=a*o,g=a*h,y=a*u;return t.m00=1-(_+p),t.m01=c+y,t.m02=f-g,t.m03=0,t.m04=c-y,t.m05=1-(l+p),t.m06=d+m,t.m07=0,t.m08=f+g,t.m09=d-m,t.m10=1-(l+_),t.m11=0,t.m12=i.x,t.m13=i.y,t.m14=i.z,t.m15=1,t},e.getTranslation=function(t,e){return t.x=e.m12,t.y=e.m13,t.z=e.m14,t},e.getScaling=function(t,e){var i=Zr.m00=e.m00,n=Zr.m01=e.m01,r=Zr.m02=e.m02,s=Zr.m03=e.m04,a=Zr.m04=e.m05,o=Zr.m05=e.m06,h=Zr.m06=e.m08,u=Zr.m07=e.m09,l=Zr.m08=e.m10;return t.x=qr(i*i+n*n+r*r),t.y=qr(s*s+a*a+o*o),t.z=qr(h*h+u*u+l*l),yr.determinant(Zr)<0&&(t.x*=-1),t},e.getRotation=function(t,e){var i=e.m00+e.m05+e.m10,n=0;return i>0?(n=2*qr(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*qr(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*qr(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*qr(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(Qr,t.m00,t.m01,t.m02).length(),s=ir.set(Qr,t.m04,t.m05,t.m06).length(),a=ir.set(Qr,t.m08,t.m09,t.m10).length();if(n&&(n.x=r,n.y=s,n.z=a),0!==r&&0!==s&&0!==a){Zr.m00=t.m00/r,Zr.m01=t.m01/r,Zr.m02=t.m02/r,Zr.m03=t.m04/s,Zr.m04=t.m05/s,Zr.m05=t.m06/s,Zr.m06=t.m08/a,Zr.m07=t.m09/a,Zr.m08=t.m10/a;var o=yr.determinant(Zr);n&&o<0&&(n.x*=-1),e&&(o<0&&(Zr.m00*=-1,Zr.m01*=-1,Zr.m02*=-1),kr.fromMat3(e,Zr))}else e&&kr.identity(e)},e.toEuler=function(t,e){return yr.set(Zr,t.m00,t.m01,t.m02,t.m04,t.m05,t.m06,t.m08,t.m09,t.m10),yr.toEuler(Zr,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,_=r*l,d=s*u,p=s*l,m=a*l,g=o*h,y=o*u,v=o*l,b=n.x,S=n.y,w=n.z;return t.m00=(1-(d+m))*b,t.m01=(f+v)*b,t.m02=(_-y)*b,t.m03=0,t.m04=(f-v)*S,t.m05=(1-(c+m))*S,t.m06=(p+g)*S,t.m07=0,t.m08=(_+y)*w,t.m09=(p-g)*w,t.m10=(1-(c+d))*w,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,_=s*l,d=s*c,p=a*l,m=a*c,g=o*c,y=h*u,v=h*l,b=h*c,S=n.x,w=n.y,x=n.z,T=r.x,A=r.y,C=r.z;return t.m00=(1-(p+g))*S,t.m01=(_+b)*S,t.m02=(d-v)*S,t.m03=0,t.m04=(_-b)*w,t.m05=(1-(f+g))*w,t.m06=(m+y)*w,t.m07=0,t.m08=(d+v)*x,t.m09=(m-y)*x,t.m10=(1-(f+p))*x,t.m11=0,t.m12=i.x+T-(t.m00*T+t.m04*A+t.m08*C),t.m13=i.y+A-(t.m01*T+t.m05*A+t.m09*C),t.m14=i.z+C-(t.m02*T+t.m06*A+t.m10*C),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,_=r*o,d=r*h,p=s*a,m=s*o,g=s*h;return t.m00=1-c-d,t.m01=l+g,t.m02=f-m,t.m03=0,t.m04=l-g,t.m05=1-u-d,t.m06=_+p,t.m07=0,t.m08=f+m,t.m09=_-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/Jr(e/2),l=1/(n-r),c=s?u/i:u,f=(s?u:u*i)*o,_=Hr[h];return t.m00=c*_[0],t.m01=c*_[1],t.m02=0,t.m03=0,t.m04=f*_[2],t.m05=f*_[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=(r-a*n)*l,t.m11=-1,t.m12=0,t.m13=0,t.m14=r*n*l*(1-a),t.m15=0,t},e.ortho=function(t,e,i,n,r,s,a,o,h,u){void 0===o&&(o=-1),void 0===h&&(h=1),void 0===u&&(u=0);var l=1/(e-i),c=1/(n-r)*h,f=1/(s-a),_=-2*l,d=-2*c,p=(e+i)*l,m=(r+n)*c,g=Hr[u];return t.m00=_*g[0],t.m01=_*g[1],t.m02=0,t.m03=0,t.m04=d*g[2],t.m05=d*g[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=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,_=1/qr(l*l+c*c+f*f),d=h*(f*=_)-u*(c*=_),p=u*(l*=_)-o*f,m=o*c-h*l,g=c*(m*=_=1/qr(d*d+p*p+m*m))-f*(p*=_),y=f*(d*=_)-l*m,v=l*p-c*d;return t.m00=d,t.m01=g,t.m02=l,t.m03=0,t.m04=p,t.m05=y,t.m06=c,t.m07=0,t.m08=m,t.m09=v,t.m10=f,t.m11=0,t.m12=-(d*r+p*s+m*a),t.m13=-(g*r+y*s+v*a),t.m14=-(l*r+c*s+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,_=e.m11,d=e.m12,p=e.m13,m=e.m14,g=e.m15,y=i*o-n*a,v=i*h-r*a,b=i*u-s*a,S=n*h-r*o,w=n*u-s*o,x=r*u-s*h,T=l*p-c*d,A=l*m-f*d,C=l*g-_*d,D=c*m-f*p,B=c*g-_*p,I=f*g-_*m,M=y*I-v*B+b*D+S*C-w*A+x*T;return M?(M=1/M,t.m00=(o*I-h*B+u*D)*M,t.m01=(h*C-a*I-u*A)*M,t.m02=(a*B-o*C+u*T)*M,t.m03=0,t.m04=(r*B-n*I-s*D)*M,t.m05=(i*I-r*C+s*A)*M,t.m06=(n*C-i*B-s*T)*M,t.m07=0,t.m08=(p*x-m*w+g*S)*M,t.m09=(m*b-d*x-g*v)*M,t.m10=(d*w-p*b+g*y)*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=Ki),Wr(t.m00-e.m00)<=i*jr(1,Wr(t.m00),Wr(e.m00))&&Wr(t.m01-e.m01)<=i*jr(1,Wr(t.m01),Wr(e.m01))&&Wr(t.m02-e.m02)<=i*jr(1,Wr(t.m02),Wr(e.m02))&&Wr(t.m03-e.m03)<=i*jr(1,Wr(t.m03),Wr(e.m03))&&Wr(t.m04-e.m04)<=i*jr(1,Wr(t.m04),Wr(e.m04))&&Wr(t.m05-e.m05)<=i*jr(1,Wr(t.m05),Wr(e.m05))&&Wr(t.m06-e.m06)<=i*jr(1,Wr(t.m06),Wr(e.m06))&&Wr(t.m07-e.m07)<=i*jr(1,Wr(t.m07),Wr(e.m07))&&Wr(t.m08-e.m08)<=i*jr(1,Wr(t.m08),Wr(e.m08))&&Wr(t.m09-e.m09)<=i*jr(1,Wr(t.m09),Wr(e.m09))&&Wr(t.m10-e.m10)<=i*jr(1,Wr(t.m10),Wr(e.m10))&&Wr(t.m11-e.m11)<=i*jr(1,Wr(t.m11),Wr(e.m11))&&Wr(t.m12-e.m12)<=i*jr(1,Wr(t.m12),Wr(e.m12))&&Wr(t.m13-e.m13)<=i*jr(1,Wr(t.m13),Wr(e.m13))&&Wr(t.m14-e.m14)<=i*jr(1,Wr(t.m14),Wr(e.m14))&&Wr(t.m15-e.m15)<=i*jr(1,Wr(t.m15),Wr(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===_&&(_=0),void 0===d&&(d=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=_,m.m14=d,m.m15=p,m.m00=t),m},i.equals=function(t,e){void 0===e&&(e=Ki);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,_=n.m09,d=n.m10,p=n.m11,m=n.m12,g=n.m13,y=n.m14,v=n.m15;return!(Wr(r)===i||Wr(s)===i||Wr(a)===i||Wr(o)===i||Wr(h)===i||Wr(u)===i||Wr(l)===i||Wr(c)===i||Wr(f)===i||Wr(_)===i||Wr(d)===i||Wr(p)===i||Wr(m)===i||Wr(g)===i||Wr(y)===i||Wr(v)===i)&&Wr(r-t.m00)<=e*jr(1,Wr(r),Wr(t.m00))&&Wr(s-t.m01)<=e*jr(1,Wr(s),Wr(t.m01))&&Wr(a-t.m02)<=e*jr(1,Wr(a),Wr(t.m02))&&Wr(o-t.m03)<=e*jr(1,Wr(o),Wr(t.m03))&&Wr(h-t.m04)<=e*jr(1,Wr(h),Wr(t.m04))&&Wr(u-t.m05)<=e*jr(1,Wr(u),Wr(t.m05))&&Wr(l-t.m06)<=e*jr(1,Wr(l),Wr(t.m06))&&Wr(c-t.m07)<=e*jr(1,Wr(c),Wr(t.m07))&&Wr(f-t.m08)<=e*jr(1,Wr(f),Wr(t.m08))&&Wr(_-t.m09)<=e*jr(1,Wr(_),Wr(t.m09))&&Wr(d-t.m10)<=e*jr(1,Wr(d),Wr(t.m10))&&Wr(p-t.m11)<=e*jr(1,Wr(p),Wr(t.m11))&&Wr(m-t.m12)<=e*jr(1,Wr(m),Wr(t.m12))&&Wr(g-t.m13)<=e*jr(1,Wr(g),Wr(t.m13))&&Wr(y-t.m14)<=e*jr(1,Wr(y),Wr(t.m14))&&Wr(v-t.m15)<=e*jr(1,Wr(v),Wr(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,_=t.m12,d=t.m13,p=t.m14,m=t.m15,g=e*a-i*s,y=e*o-n*s,v=e*h-r*s,b=i*o-n*a,S=i*h-r*a,w=n*h-r*o,x=u*d-l*_,T=u*p-c*_,A=u*m-f*_,C=l*p-c*d,D=l*m-f*d,B=c*m-f*p,I=g*B-y*D+v*C+b*A-S*T+w*x;return 0===I?(t.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),t):(I=1/I,t.m00=(a*B-o*D+h*C)*I,t.m01=(n*D-i*B-r*C)*I,t.m02=(d*w-p*S+m*b)*I,t.m03=(c*S-l*w-f*b)*I,t.m04=(o*A-s*B-h*T)*I,t.m05=(e*B-n*A+r*T)*I,t.m06=(p*v-_*w-m*y)*I,t.m07=(u*w-c*v+f*y)*I,t.m08=(s*D-a*A+h*x)*I,t.m09=(i*A-e*D-r*x)*I,t.m10=(_*S-d*v+m*g)*I,t.m11=(l*v-u*S-f*g)*I,t.m12=(a*T-s*C-o*x)*I,t.m13=(e*C-i*T+n*x)*I,t.m14=(d*y-_*b-p*g)*I,t.m15=(u*b-l*y+c*g)*I,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,_=t.m12,d=t.m13,p=t.m14,m=t.m15;return(e*a-i*s)*(c*m-f*p)-(e*o-n*s)*(l*m-f*d)+(e*h-r*s)*(l*p-c*d)+(i*o-n*a)*(u*m-f*_)-(i*h-r*a)*(u*p-c*_)+(n*h-r*o)*(u*d-l*_)},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,_=r.m08,d=r.m09,p=r.m10,m=r.m11;return r.m12=s*e+u*i+_*n+r.m12,r.m13=a*e+l*i+d*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=qr(i*i+n*n+r*r);if(Wr(s)<Ki)return null;i*=s=1/s,n*=s,r*=s;var a=Xr(t),o=Yr(t),h=1-o,u=this,l=u.m00,c=u.m01,f=u.m02,_=u.m03,d=u.m04,p=u.m05,m=u.m06,g=u.m07,y=u.m08,v=u.m09,b=u.m10,S=u.m11,w=i*i*h+o,x=n*i*h+r*a,T=r*i*h-n*a,A=i*n*h-r*a,C=n*n*h+o,D=r*n*h+i*a,B=i*r*h+n*a,I=n*r*h-i*a,M=r*r*h+o;return u.m00=l*w+d*x+y*T,u.m01=c*w+p*x+v*T,u.m02=f*w+m*x+b*T,u.m03=_*w+g*x+S*T,u.m04=l*A+d*C+y*D,u.m05=c*A+p*C+v*D,u.m06=f*A+m*C+b*D,u.m07=_*A+g*C+S*D,u.m08=l*B+d*I+y*M,u.m09=c*B+p*I+v*M,u.m10=f*B+m*I+b*M,u.m11=_*B+g*I+S*M,u},i.getTranslation=function(t){return t.x=this.m12,t.y=this.m13,t.z=this.m14,t},i.getScale=function(t){var e=this,i=Zr.m00=e.m00,n=Zr.m01=e.m01,r=Zr.m02=e.m02,s=Zr.m03=e.m04,a=Zr.m04=e.m05,o=Zr.m05=e.m06,h=Zr.m06=e.m08,u=Zr.m07=e.m09,l=Zr.m08=e.m10;return t.x=qr(i*i+n*n+r*r),t.y=qr(s*s+a*a+o*o),t.z=qr(h*h+u*u+l*l),yr.determinant(Zr)<0&&(t.x*=-1),t},i.getRotation=function(t){var e=this,i=ir.set(Qr,e.m00,e.m01,e.m02).length(),n=ir.set(Qr,e.m04,e.m05,e.m06).length(),r=ir.set(Qr,e.m08,e.m09,e.m10).length();return Zr.m00=e.m00/i,Zr.m01=e.m01/i,Zr.m02=e.m02/i,Zr.m03=e.m04/n,Zr.m04=e.m05/n,Zr.m05=e.m06/n,Zr.m06=e.m08/r,Zr.m07=e.m09/r,Zr.m08=e.m10/r,yr.determinant(Zr)<0&&(Zr.m00*=-1,Zr.m01*=-1,Zr.m02*=-1),kr.fromMat3(t,Zr)},i.fromRTS=function(t,i,n){return e.fromSRT(this,t,i,n)},i.fromSRT=function(t,i,n){return e.fromSRT(this,t,i,n)},i.fromQuat=function(t){return e.fromQuat(this,t)},e}(Fe));Rr=Kr,Kr.IDENTITY=Object.freeze(new Rr);var Qr=new ir,Zr=new yr;function $r(t,e,i,n,r,s,a,o,h,u,l,c,f,_,d,p){return new Kr(t,e,i,n,r,s,a,o,h,u,l,c,f,_,d,p)}Vi.fastDefine("cc.Mat4",Kr,{m00:1,m01:0,m02:0,m03:0,m04:0,m05:1,m06:0,m07:0,m08:0,m09:0,m10:1,m11:0,m12:0,m13:0,m14:0,m15:1}),C.Mat4=Kr,C.mat4=$r;var ts=Math.abs,es=Math.max,is=Math.min,ns=Math.PI,rs=Math.acos,ss=Math.sin,as=Math.cos,os=Math.sqrt,hs=Math.atan2,us=Math.ceil,ls=Math.floor,cs=Math.round;function fs(t,e){return Object.freeze(new ds(t,e))}var _s,ds=t("aQ",function(t){function e(e,i){var n;return n=t.call(this)||this,"object"==typeof e?(n.x=e.x,n.y=e.y):(n.x=e||0,n.y=i||0),n}s(e,t),e.clone=function(t){return new e(t.x,t.y)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t},e.set=function(t,e,i){return t.x=e,t.y=i,t},e.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t},e.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t},e.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t},e.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t},e.ceil=function(t,e){return t.x=us(e.x),t.y=us(e.y),t},e.floor=function(t,e){return t.x=ls(e.x),t.y=ls(e.y),t},e.min=function(t,e,i){return t.x=is(e.x,i.x),t.y=is(e.y,i.y),t},e.max=function(t,e,i){return t.x=es(e.x,i.x),t.y=es(e.y,i.y),t},e.round=function(t,e){return t.x=cs(e.x),t.y=cs(e.y),t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t},e.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y;return os(i*i+n*n)},e.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n},e.len=function(t){var e=t.x,i=t.y;return os(e*e+i*i)},e.lengthSqr=function(t){var e=t.x,i=t.y;return e*e+i*i},e.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t},e.inverse=function(t,e){return t.x=1/e.x,t.y=1/e.y,t},e.inverseSafe=function(t,e){var i=e.x,n=e.y;return ts(i)<Ki?t.x=0:t.x=1/i,ts(n)<Ki?t.y=0:t.y=1/n,t},e.normalize=function(t,e){var i=e.x,n=e.y,r=i*i+n*n;return r>0?(r=1/os(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()*ns;return t.x=as(i)*e,t.y=ss(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=Ki),ts(t.x-e.x)<=i*es(1,ts(t.x),ts(e.x))&&ts(t.y-e.y)<=i*es(1,ts(t.y),ts(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)/os(i*n);return r=$i(r,-1,1),rs(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=Ki),e.equals(this,t,i)},i.equals2f=function(t,e,i){return void 0===i&&(i=Ki),ts(this.x-t)<=i*es(1,ts(this.x),ts(t))&&ts(this.y-e)<=i*es(1,ts(this.y),ts(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 os(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/os(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)/os(e*i);return n=$i(n,-1,1),rs(n)},i.signAngle=function(t){var e=this.cross(t),i=this.dot(t);return hs(e,i)},i.rotate=function(t){var e=this.x,i=this.y,n=ss(t),r=as(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 ps(t,e){return new ds(t,e)}ds.ZERO=fs(0,0),ds.ONE=fs(1,1),ds.NEG_ONE=fs(-1,-1),ds.UNIT_X=fs(1,0),ds.UNIT_Y=fs(0,1),Vi.fastDefine("cc.Vec2",ds,{x:0,y:0}),C.Vec2=ds,C.v2=ps,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;i++)e[i]=arguments[i];var n=e[1].toString(16);return C.Color.fromHEX(e[0],n)}}]),pt(yr,"Mat3",[{name:"sub",newName:"subtract",target:yr,targetName:"Mat3"},{name:"mul",newName:"multiply",target:yr,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:yr,targetName:"Mat3"},{name:"transfrom",newName:"transform",target:yr,targetName:"Mat3"}]),pt(yr.prototype,"Mat3",[{name:"sub",newName:"subtract",target:yr.prototype,targetName:"Mat3"},{name:"mul",newName:"multiply",target:yr.prototype,targetName:"Mat3"},{name:"mulScalar",newName:"multiplyScalar",target:yr.prototype,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:yr.prototype,targetName:"Mat3"}]),pt(Kr,"Mat4",[{name:"sub",newName:"subtract",target:Kr,targetName:"Mat4"},{name:"mul",newName:"multiply",target:Kr,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:Kr,targetName:"Mat4"}]),pt(Kr.prototype,"Mat4",[{name:"sub",newName:"subtract",target:Kr.prototype,targetName:"Mat4"},{name:"mul",newName:"multiply",target:Kr.prototype,targetName:"Mat4"},{name:"mulScalar",newName:"multiplyScalar",target:Kr.prototype,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:Kr.prototype,targetName:"Mat4"}]);var ms=t("a$",function(t){function e(e,i){var n;return n=t.call(this)||this,"object"==typeof e?(n.width=e.width,n.height=e.height):(n.width=e||0,n.height=i||0),n}s(e,t),e.lerp=function(t,e,i,n){return t.width=e.width+(i.width-e.width)*n,t.height=e.height+(i.height-e.height)*n,t},e.equals=function(t,e){return t.width===e.width&&t.height===e.height};var i=e.prototype;return i.clone=function(){return new e(this.width,this.height)},i.set=function(t,e){return"object"==typeof t?(this.height=t.height,this.width=t.width):(this.width=t||0,this.height=e||0),this},i.equals=function(t){return this.width===t.width&&this.height===t.height},i.lerp=function(t,e){return this.width+=(t.width-this.width)*e,this.height+=(t.height-this.height)*e,this},i.toString=function(){return"("+this.width+", "+this.height+")"},n(e,[{key:"x",get:function(){return this.width},set:function(t){this.width=t}},{key:"y",get:function(){return this.height},set:function(t){this.height=t}}]),e}(Fe));function gs(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),new ms(t,e)}_s=ms,ms.ZERO=Object.freeze(new _s(0,0)),ms.ONE=Object.freeze(new _s(1,1)),Vi.fastDefine("cc.Size",ms,{width:0,height:0}),C.size=gs,C.Size=ms;var ys=Math.max,vs=Math.min,bs=t("b1",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.width=e.width,s.height=e.height):(s.x=e||0,s.y=i||0,s.width=n||0,s.height=r||0),s}s(e,t),e.fromMinMax=function(t,e,i){var n=vs(e.x,i.x),r=vs(e.y,i.y),s=ys(e.x,i.x),a=ys(e.y,i.y);return t.x=n,t.y=r,t.width=s-n,t.height=a-r,t},e.lerp=function(t,e,i,n){var r=e.x,s=e.y,a=e.width,o=e.height;return t.x=r+(i.x-r)*n,t.y=s+(i.y-s)*n,t.width=a+(i.width-a)*n,t.height=o+(i.height-o)*n,t},e.intersection=function(t,e,i){var n=e.x,r=e.y,s=e.x+e.width,a=e.y+e.height,o=i.x,h=i.y,u=i.x+i.width,l=i.y+i.height;return t.x=ys(n,o),t.y=ys(r,h),t.width=vs(s,u)-t.x,t.height=vs(a,l)-t.y,t},e.union=function(t,e,i){var n=e.x,r=e.y,s=e.width,a=e.height,o=i.x,h=i.y,u=i.width,l=i.height;return t.x=vs(n,o),t.y=vs(r,h),t.width=ys(n+s,o+u)-t.x,t.height=ys(r+a,h+l)-t.y,t},e.equals=function(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.width,this.height)},i.set=function(t,e,i,n){var r=this;return"object"==typeof t?(r.x=t.x,r.y=t.y,r.width=t.width,r.height=t.height):(r.x=t||0,r.y=e||0,r.width=i||0,r.height=n||0),r},i.equals=function(t){var e=this;return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height},i.lerp=function(t,e){var i=this,n=i.x,r=i.y,s=i.width,a=i.height;return i.x=n+(t.x-n)*e,i.y=r+(t.y-r)*e,i.width=s+(t.width-s)*e,i.height=a+(t.height-a)*e,i},i.toString=function(){var t=this;return"("+t.x+", "+t.y+", "+t.width+", "+t.height+")"},i.intersects=function(t){var e=this,i=e.x+e.width,n=e.y+e.height,r=t.x+t.width,s=t.y+t.height;return!(i<t.x||r<e.x||n<t.y||s<e.y)},i.contains=function(t){var e=this;return e.x<=t.x&&e.x+e.width>=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,_=t.m01*r+t.m05*s+t.m13,d=vs(a,h,l,f),p=ys(a,h,l,f),m=vs(o,u,c,_),g=ys(o,u,c,_);return e.x=d,e.y=m,e.width=p-d,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 ms(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 Ss(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 bs(t,e,i,n)}Vi.fastDefine("cc.Rect",bs,{x:0,y:0,width:0,height:0}),C.Rect=bs,C.rect=Ss;var ws=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 ws(t)},n(e,[{key:"array",get:function(){return this._array}}]),e}(Fe)),Ts=Object.freeze({__proto__:null,Color:cr,EPSILON:Ki,HALF_PI:Yi,MATH_FLOAT_ARRAY:ws,Mat3:yr,Mat4:Kr,MathBase:xs,Quat:kr,Rect:bs,Size:ms,TWO_PI:Ji,Vec2:ds,Vec3:ir,Vec4:Vn,absMax:gn,absMaxComponent:mn,approx:Zi,bits:L,clamp:$i,clamp01:tn,color:fr,enumerableProps:yn,equals:Qi,floatToHalf:xn,halfToFloat:Tn,inverseLerp:pn,lerp:en,mat4:$r,nextPow2:fn,pingPong:dn,preTransforms:Hr,pseudoRandom:un,pseudoRandomRange:ln,pseudoRandomRangeInt:cn,quat:Ur,random:sn,randomRange:on,randomRangeInt:hn,rect:Ss,repeat:_n,setRandGenerator:an,size:gs,toDegree:rn,toRadian:nn,v2:ps,v3:nr,v4:Nn});t("aK",Ts);var As=new ir,Cs=new ir,Ds=new ir,Bs=new ir,Is=new ir,Ms=new ir,Ps=new Array(3),Es=new Array(3);function Os(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(Ms,i.center,i.halfExtents),t.x=t.x<Is.x?Is.x:t.x,t.y=t.y<Is.y?Is.y:t.y,t.z=t.z<Is.z?Is.z:t.z,t.x=t.x>Ms.x?Ms.x:t.x,t.y=t.y>Ms.y?Ms.y:t.y,t.z=t.z>Ms.z?Ms.z:t.z,t}function Rs(t,e,i){ir.set(As,i.orientation.m00,i.orientation.m01,i.orientation.m02),ir.set(Cs,i.orientation.m03,i.orientation.m04,i.orientation.m05),ir.set(Ds,i.orientation.m06,i.orientation.m07,i.orientation.m08),Ps[0]=As,Ps[1]=Cs,Ps[2]=Ds,Es[0]=i.halfExtents.x,Es[1]=i.halfExtents.y,Es[2]=i.halfExtents.z,ir.subtract(Bs,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(Bs,Ps[n]);r>Es[n]&&(r=Es[n]),r<-Es[n]&&(r=-Es[n]),t.x+=r*Ps[n].x,t.y+=r*Ps[n].y,t.z+=r*Ps[n].z}return t}var Fs=Object.freeze({__proto__:null,point_plane:Os,pt_point_aabb:ks,pt_point_line:function(t,e,i,n){ir.subtract(As,i,n);var r=As.clone(),s=ir.lengthSqr(r);if(0===s)ir.copy(t,i);else{ir.subtract(As,e,i);var a=ir.dot(As,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=Os(e,i);return ir.subtract(t,e,ir.multiplyScalar(t,i.n,n))}}),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.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}(),Vs=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}(),Ns=new ir,zs=new ir,Us=new ir,Gs=new ir;function Hs(t){return Math.max(Math.max(t.x,t.y),t.z)}var Ws,js,qs,Xs,Ys,Js=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(Ns,e,i),.5),t.radius=.5*ir.subtract(Ns,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*Hs(n)},e.translateAndRotate=function(t,e,i){ir.transformMat4(i.center,this.center,t)},e.setScale=function(t,e){e.radius=this.radius*Hs(t)},e.mergePoint=function(t){this.radius<0&&(this.center.set(t),this.radius=0),ir.subtract(zs,t,this.center);var e=zs.length();if(e>this.radius){var i=.5*(e-this.radius);this.radius+=i,ir.multiplyScalar(zs,zs,i/e),ir.add(this.center,this.center,zs)}},e.mergePoints=function(t){var e=t.length;if(!(e<1)){this.radius=-1;for(var i=0;i<e;i++)this.mergePoint(t[i])}},e.mergeAABB=function(t){t.getBoundary(Us,Gs),this.mergePoint(Us),this.mergePoint(Gs)},n(t,[{key:"center",get:function(){return this._center},set:function(t){this._center=t}},{key:"radius",get:function(){return this._radius},set:function(t){this._radius=t}},{key:"type",get:function(){return this._type}}]),t}(),Ks=ir.squaredDistance,Qs=ir.subtract,Zs=ir.dot,$s=ir.set,ta=ir.cross,ea=ir.multiplyScalar,ia=ir.copy,na=ir.add,ra=ir.scaleAndAdd,sa=Math.max,aa=Math.min,oa=Math.abs,ha=function(t,e){var i=Zs(t.d,e.n);if(oa(i)<Number.EPSILON)return 0;var n=-Os(t.o,e)/i;return n<0?0:n},ua=(Ws=nr(),js=nr(),qs=nr(),Xs=nr(),Ys=nr(),function(t,e,i){Qs(Ws,e.b,e.a),Qs(js,e.c,e.a),ta(qs,t.d,js);var n=Zs(Ws,qs);if(n<Number.EPSILON&&(!i||n>-Number.EPSILON))return 0;var r=1/n;Qs(Xs,t.o,e.a);var s=Zs(Xs,qs)*r;if(s<0||s>1)return 0;ta(Ys,Xs,Ws);var a=Zs(t.d,Ys)*r;if(a<0||s+a>1)return 0;var o=Zs(js,Ys)*r;return o<0?0:o}),la=function(){var t=nr();return function(e,i){var n=i.radius,r=i.center,s=e.o,a=e.d,o=n*n;Qs(t,r,s);var h=t.lengthSqr(),u=Zs(t,a),l=o-(h-u*u);if(l<0)return 0;var c=Math.sqrt(l),f=h<o?u+c:u-c;return f<0?0:f}}(),ca=function(){var t=nr(),e=nr();return function(i,n){return Qs(t,n.center,n.halfExtents),na(e,n.center,n.halfExtents),fa(i,t,e)}}();function fa(t,e,i){var n=t.o,r=t.d,s=1/r.x,a=1/r.y,o=1/r.z,h=(e.x-n.x)*s,u=(i.x-n.x)*s,l=(e.y-n.y)*a,c=(i.y-n.y)*a,f=(e.z-n.z)*o,_=(i.z-n.z)*o,d=sa(sa(aa(h,u),aa(l,c)),aa(f,_)),p=aa(aa(sa(h,u),sa(l,c)),sa(f,_));return p<0||d>p?0:d>0?d:p}var _a=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 _=f.halfExtents,d=f.orientation;o[0]=_.x,o[1]=_.y,o[2]=_.z,t=f.center,e=c.o,i=c.d,$s(n,d.m00,d.m01,d.m02),$s(r,d.m03,d.m04,d.m05),$s(s,d.m06,d.m07,d.m08),Qs(a,t,e),h[0]=Zs(n,i),h[1]=Zs(r,i),h[2]=Zs(s,i),u[0]=Zs(n,a),u[1]=Zs(r,a),u[2]=Zs(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=sa(sa(aa(l[0],l[1]),aa(l[2],l[3])),aa(l[4],l[5])),g=aa(aa(sa(l[0],l[1]),sa(l[2],l[3])),sa(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 Js;return function(h,u){var l=u.ellipseCenter0,c=u.ellipseCenter1,f=Qs(e,c,l);if(f.length()<Ki)return o.radius=u.radius,o.center.set(u.ellipseCenter0),Za.raySphere(h,o);var _=h.o,d=Qs(i,_,l),p=ir.normalize(t,h.d),m=ta(n,p,f),g=m.lengthSqr();if(0===g){o.radius=u.radius;var y=Qs(r,c,_);return d.lengthSqr()<y.lengthSqr()?o.center.set(l):o.center.set(c),Za.raySphere(h,o)}var v=ta(r,d,f),b=f.lengthSqr(),S=2*Zs(m,v),w=u.radius*u.radius,x=S*S-4*g*(v.lengthSqr()-w*b);if(x<0)return 0;var T=(-S-Math.sqrt(x))/(2*g);if(T<0){o.radius=u.radius;var A=Qs(s,c,_);return d.lengthSqr()<A.lengthSqr()?o.center.set(u.ellipseCenter0):o.center.set(u.ellipseCenter1),Za.raySphere(h,o)}var C=ra(s,h.o,p,T),D=Qs(a,C,l),B=Zs(D,f)/b;return B>=0&&B<=1?T:B<0?(o.radius=u.radius,o.center.set(u.ellipseCenter0),Za.raySphere(h,o)):B>1?(o.radius=u.radius,o.center.set(u.ellipseCenter1),Za.raySphere(h,o)):0}}(),pa=function(){var t=nr();return function(e,i){Qs(t,e.e,e.s);var n=-Os(e.s,i)/Zs(t,i.n);return n<0||n>1?0:n}}(),ma=function(){var t=nr(),e=nr(),i=nr(),n=nr(),r=nr(),s=nr();return function(a,o,h){Qs(t,o.b,o.a),Qs(e,o.c,o.a),Qs(i,a.s,a.e),ta(r,t,e);var u=Zs(i,r);if(u<=0)return 0;Qs(n,a.s,o.a);var l=Zs(n,r);if(l<0||l>u)return 0;ta(s,i,n);var c=Zs(e,s);if(c<0||c>u)return 0;var f=-Zs(t,s);if(f<0||c+f>u)return 0;if(h){var _=1/u,d=1-(c*=_)-(f*=_);$s(h,o.a.x*d+o.b.x*c+o.c.x*f,o.a.y*d+o.b.y*c+o.c.y*f,o.a.z*d+o.b.z*c+o.c.z*f)}return 1}}(),ga=new Vs;function ya(t,e){ga.o.set(t.s),Qs(ga.d,t.e,t.s),ga.d.normalize();var i=ca(ga,e);return i<=t.length()?i:0}function va(t,e){ga.o.set(t.s),Qs(ga.d,t.e,t.s),ga.d.normalize();var i=_a(ga,e);return i<=t.length()?i:0}function ba(t,e){ga.o.set(t.s),Qs(ga.d,t.e,t.s),ga.d.normalize();var i=la(ga,e);return i<=t.length()?i:0}var Sa,wa,xa,Ta,Aa=(Sa=nr(),wa=nr(),xa=nr(),Ta=nr(),function(t,e){return Qs(Sa,t.center,t.halfExtents),na(wa,t.center,t.halfExtents),Qs(xa,e.center,e.halfExtents),na(Ta,e.center,e.halfExtents),Sa.x<=Ta.x&&wa.x>=xa.x&&Sa.y<=Ta.y&&wa.y>=xa.y&&Sa.z<=Ta.z&&wa.z>=xa.z});function Ca(t,e,i){$s(i[0],t.x,e.y,e.z),$s(i[1],t.x,e.y,t.z),$s(i[2],t.x,t.y,e.z),$s(i[3],t.x,t.y,t.z),$s(i[4],e.x,e.y,e.z),$s(i[5],e.x,e.y,t.z),$s(i[6],e.x,t.y,e.z),$s(i[7],e.x,t.y,t.z)}function Da(t,e,i,n,r,s){$s(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),$s(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),$s(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),$s(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),$s(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),$s(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),$s(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),$s(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 Ba(t,e){for(var i=Zs(e,t[0]),n=i,r=1;r<8;++r){var s=Zs(e,t[r]);i=s<i?s:i,n=s>n?s:n}return[i,n]}var Ia,Ma,Pa,Ea,Oa,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;$s(t[0],1,0,0),$s(t[1],0,1,0),$s(t[2],0,0,1),$s(t[3],o.m00,o.m01,o.m02),$s(t[4],o.m03,o.m04,o.m05),$s(t[5],o.m06,o.m07,o.m08);for(var h=0;h<3;++h)ta(t[6+3*h],t[h],t[3]),ta(t[7+3*h],t[h],t[4]),ta(t[7+3*h],t[h],t[5]);Qs(s,e.center,e.halfExtents),na(a,e.center,e.halfExtents),Ca(s,a,i),Da(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var u=0;u<15;++u){var l=Ba(i,t[u]),c=Ba(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*oa(n.x)+i.y*oa(n.y)+i.z*oa(n.z),s=Zs(n,t.center);return s+r<e.d?-1:s-r>e.d?0:1},Fa=function(t,e){for(var i=e.planes,n=0;n<i.length;n++)if(-1===Ra(t,i[n]))return 0;return 1},La=function(){for(var t=new Array(8),e=0,i=0,n=0;n<t.length;n++)t[n]=nr();return function(n,r){for(var s=r.vertices,a=n.halfExtents,o=0,h=!1,u=0;u<r.planes.length;u++){if(-1===(o=Ra(n,r.planes[u])))return 0;1===o&&(h=!0)}if(!h)return 1;for(var l=0;l<s.length;l++)Qs(t[l],s[l],n.center);e=0,i=0;for(var c=0;c<s.length;c++)t[c].x>a.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;f<s.length;f++)t[f].y>a.y?e++:t[f].y<-a.y&&i++;if(e===s.length||i===s.length)return 0;e=0,i=0;for(var _=0;_<s.length;_++)t[_].z>a.z?e++:t[_].z<-a.z&&i++;return e===s.length||i===s.length?0:1}}(),Va=(Ia=nr(),Ma=new yr,function(t,e){return Qs(Ia,e,t.center),ir.transformMat3(Ia,Ia,yr.transpose(Ma,t.orientation)),i=Ia,n=t.halfExtents,oa(i.x)<n.x&&oa(i.y)<n.y&&oa(i.z)<n.z;var i,n}),Na=(Pa=function(t,e,i,n){return oa(t.x*e+t.y*i+t.z*n)},function(t,e){var i=t.orientation,n=t.halfExtents,r=e.n,s=e.d,a=n.x*Pa(r,i.m00,i.m01,i.m02)+n.y*Pa(r,i.m03,i.m04,i.m05)+n.z*Pa(r,i.m06,i.m07,i.m08),o=Zs(r,t.center);return o+a<s?-1:o-a>s?0:1}),za=function(t,e){for(var i=e.planes,n=0;n<i.length;n++)if(-1===Na(t,i[n]))return 0;return 1},Ua=function(){for(var t=new Array(8),e=0,i=0,n=0,r=0;r<t.length;r++)t[r]=nr();var s=function(t,e,i,n){return t.x*e+t.y*i+t.z*n};return function(r,a){for(var o=r.orientation,h=r.halfExtents,u=a.vertices,l=a.planes,c=0,f=!1,_=0;_<l.length;_++){if(-1===(c=Na(r,l[_])))return 0;1===c&&(f=!0)}if(!f)return 1;for(var d=0;d<u.length;d++)Qs(t[d],u[d],r.center);i=0,n=0;for(var p=0;p<u.length;p++)(e=s(t[p],o.m00,o.m01,o.m02))>h.x?i++:e<-h.x&&n++;if(i===u.length||n===u.length)return 0;i=0,n=0;for(var m=0;m<u.length;m++)(e=s(t[m],o.m03,o.m04,o.m05))>h.y?i++:e<-h.y&&n++;if(i===u.length||n===u.length)return 0;i=0,n=0;for(var g=0;g<u.length;g++)(e=s(t[g],o.m06,o.m07,o.m08))>h.z?i++:e<-h.z&&n++;return i===u.length||n===u.length?0:1}}(),Ga=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;$s(t[0],s.m00,s.m01,s.m02),$s(t[1],s.m03,s.m04,s.m05),$s(t[2],s.m06,s.m07,s.m08),$s(t[3],a.m00,a.m01,a.m02),$s(t[4],a.m03,a.m04,a.m05),$s(t[5],a.m06,a.m07,a.m08);for(var o=0;o<3;++o)ta(t[6+3*o],t[o],t[3]),ta(t[7+3*o],t[o],t[4]),ta(t[8+3*o],t[o],t[5]);Da(e.center,e.halfExtents,t[0],t[1],t[2],i),Da(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var h=0;h<15;++h){var u=Ba(i,t[h]),l=Ba(n,t[h]);if(l[0]>u[1]||u[0]>l[1])return 0}return 1}}(),Ha=function(){for(var t=new Js,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===Ks(h,u))return t.radius=o.radius,t.center.set(h),Za.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,Da(s.center,s.halfExtents,e,i,n,r);var f=a,_=ia(f[0],e),d=ia(f[1],i),p=ia(f[2],n);Qs(f[3],o.center,s.center).normalize();var m=Qs(f[4],h,u);m.normalize(),ta(f[5],_,m),ta(f[6],d,m),ta(f[7],p,m);for(var g=0;g<8;++g){var y=Ba(r,f[g]),v=Zs(f[g],h),b=Zs(f[g],u),S=sa(v,b)+l;if(aa(v,b)-l>y[1]||y[0]>S)return 0}return 1}}(),Wa=function(t,e){var i=Zs(e.n,t.center),n=t.radius*e.n.length();return i+n<e.d?-1:i-n>e.d?0:1},ja=function(t,e){for(var i=e.planes,n=0;n<i.length;n++)if(-1===Wa(t,i[n]))return 0;return 1},qa=(Ea=nr(),Oa=[1,-1,1,-1,1,-1],function(t,e){for(var i=0;i<6;i++){var n=e.planes[i],r=t.radius,s=t.center,a=n.n,o=n.d,h=Zs(a,s);if(h+r<o)return 0;if(!(h-r>o)){na(Ea,s,ea(Ea,a,r));for(var u=0;u<6;u++)if(u!==i&&u!==i+Oa[i]){var l=e.planes[u];if(Zs(l.n,Ea)<l.d)return 0}}}return 1}),Xa=function(t,e){var i=t.radius+e.radius;return Ks(t.center,e.center)<i*i},Ya=function(){var t=nr();return function(e,i){var n=e.radius;return ks(t,e.center,i),Ks(e.center,t)<n*n}}(),Ja=function(){var t=nr();return function(e,i){var n=e.radius;return Rs(t,e.center,i),Ks(e.center,t)<n*n}}(),Ka=function(){var t=nr(),e=nr();return function(i,n){var r=n.ellipseCenter0,s=n.ellipseCenter1,a=i.center,o=i.radius+n.radius,h=o*o,u=Ks(r,s);if(0===u)return Ks(a,n.center)<h;Qs(t,a,r),Qs(e,s,r);var l=Zs(t,e)/u;return l<0?Ks(a,r)<h:l>1?Ks(a,s)<h:(ra(t,r,e,l),Ks(a,t)<h)}}(),Qa=function(){var t=nr(),e=nr(),i=nr(),n=nr(),r=nr(),s=nr();return function(a,o){var h,u,l=a.ellipseCenter0,c=a.ellipseCenter1,f=o.ellipseCenter1,_=o.ellipseCenter0,d=Qs(t,c,l),p=Qs(e,f,_),m=Qs(i,l,_),g=Zs(d,d),y=Zs(d,p),v=Zs(p,p),b=Zs(d,m),S=Zs(p,m),w=g*v-y*y,x=w,T=w;w<Ki?(h=0,x=1,u=S,T=v):(u=g*S-y*b,(h=y*S-v*b)<0?(h=0,u=S,T=v):h>x&&(h=x,u=S+y,T=v)),u<0?(u=0,-b<0?h=0:-b>g?h=x:(h=-b,x=g)):u>T&&(u=T,-b+y<0?h=0:-b+y>g?h=x:(h=-b+y,x=g));var A=oa(h)<Ki?0:h/x,C=oa(u)<Ki?0:u/T,D=n;D.set(m),D.add(ea(r,d,A)),D.subtract(ea(s,p,C));var B=a.radius+o.radius;return D.lengthSqr()<B*B}}(),Za={raySphere:la,rayAABB:ca,rayOBB:_a,rayPlane:ha,rayTriangle:ua,rayCapsule:da,raySubMesh:null,rayMesh:null,rayModel:null,lineSphere:ba,lineAABB:ya,lineOBB:va,linePlane:pa,lineTriangle:ma,sphereWithSphere:Xa,sphereAABB:Ya,sphereOBB:Ja,spherePlane:Wa,sphereFrustum:ja,sphereFrustumAccurate:qa,sphereCapsule:Ka,aabbWithAABB:Aa,aabbWithOBB:ka,aabbPlane:Ra,aabbFrustum:Fa,aabbFrustumAccurate:La,obbWithOBB:Ga,obbPlane:Na,obbFrustum:za,obbFrustumAccurate:Ua,obbPoint:Va,obbCapsule:Ha,aabbFrustumCompletelyInside:function(t,e){for(var i=e.planes,n=0;n<i.length;n++)if(0!==Ra(t,i[n]))return 0;return 1},capsuleWithCapsule:Qa,resolve:function(t,e,i){void 0===i&&(i=null);var n=t._type,r=e._type,s=this[n|r];return n<r?s(t,e,i):s(e,t,i)}};Za[5]=la,Za[9]=ca,Za[17]=_a,Za[33]=ha,Za[65]=ua,Za[513]=da,Za[6]=ba,Za[10]=ya,Za[18]=va,Za[34]=pa,Za[66]=ma,Za[4]=Xa,Za[12]=Ya,Za[20]=Ja,Za[36]=Wa,Za[132]=ja,Za[260]=qa,Za[516]=Ka,Za[8]=Aa,Za[24]=ka,Za[40]=Ra,Za[136]=Fa,Za[264]=La,Za[16]=Ga,Za[48]=Na,Za[144]=za,Za[272]=Ua,Za[528]=Ha,Za[512]=Qa,pt(Ls.prototype,"line",[{name:"mag",newName:"len"},{name:"magnitude",newName:"len"}]),mt(Za,"intersect",[{name:"line_quad"}]);var $a=new ir(0,0,0),to=new ir(0,0,0),eo=$r(),io=Nn(),no=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),this._type=32,this.n=new ir(t,e,i),this.d=n}return t.create=function(e,i,n,r){return new t(e,i,n,r)},t.clone=function(e){return new t(e.n.x,e.n.y,e.n.z,e.d)},t.copy=function(t,e){return ir.copy(t.n,e.n),t.d=e.d,t},t.fromPoints=function(t,e,i,n){return ir.subtract($a,i,e),ir.subtract(to,n,e),ir.normalize(t.n,ir.cross(t.n,$a,to)),t.d=ir.dot(t.n,e),t},t.set=function(t,e,i,n,r){return t.n.x=e,t.n.y=i,t.n.z=n,t.d=r,t},t.fromNormalAndPoint=function(t,e,i){return ir.copy(t.n,e),t.d=ir.dot(e,i),t},t.normalize=function(t,e){var i=e.n.length();return ir.normalize(t.n,e.n),i>0&&(t.d=e.d/i),t},t.prototype.transform=function(t){Kr.invert(eo,t),Kr.transpose(eo,eo),Vn.set(io,this.n.x,this.n.y,this.n.z,-this.d),Vn.transformMat4(io,io,eo),ir.set(this.n,io.x,io.y,io.z),this.d=-io.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}(),ro=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 so=function(){function t(){this._poolHandle=-1,oo.addContainer(this)}return t.prototype.destroy=function(){oo.removeContainer(this)},t}(),ao=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;t<this._pools.length;t++)this._pools[t].tryShrink()},e.update=function(t){this._lastShrinkPassed+=t,this._lastShrinkPassed>this.shrinkTimeSpan&&(this.tryShrink(),this._lastShrinkPassed-=this.shrinkTimeSpan)},t}(),oo=new ao,ho=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<s._elementsPerBatch;++a)s._freePool.push(e());return s}s(e,t);var i=e.prototype;return i.alloc=function(){if(this._nextAvail<0){this._freePool.length=this._elementsPerBatch;for(var t=0;t<this._elementsPerBatch;t++)this._freePool[t]=this._ctor();this._nextAvail=this._elementsPerBatch-1}return this._freePool[this._nextAvail--]},i.free=function(t){this._freePool[++this._nextAvail]=t},i.freeArray=function(t){this._freePool.length=this._nextAvail+1,Array.prototype.push.apply(this._freePool,t),this._nextAvail+=t.length},i.tryShrink=function(){var t=this._nextAvail+1;if(!(t<=this._shrinkThreshold)){var e;if(e=t>>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}(so)),uo=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;s<i;++s)r._data[s]=e();return r}s(e,t);var i=e.prototype;return i.reset=function(){this._count=0},i.resize=function(t){if(t>this._data.length)for(var e=this._data.length;e<t;++e)this._data[e]=this._fn()},i.add=function(){return this._count>=this._data.length&&this.resize(this._data.length<<1),this._data[this._count++]},i.destroy=function(){if(this._dtor)for(var e=0;e<this._data.length;e++)this._dtor(this._data[e]);this._data.length=0,this._count=0,t.prototype.destroy.call(this)},i.tryShrink=function(){if(this._data.length>>2>this._count){var t=Math.max(this._initSize,this._data.length>>1);if(this._dtor)for(var e=t;e<this._data.length;e++)this._dtor(this._data[e]);this._data.length=t}},i.removeAt=function(t){if(!(t>=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}(so)),lo=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<t.length;++e)this.array[this.length++]=t[e]},i.fastRemove=function(t){if(!(t>=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<i;++e)if(this.array[e]===t)return e;return-1},e}(so));t("aL",Object.freeze({__proto__:null,CachedArray:lo,Pool:ho,RecyclePool:uo}));var co=t("c0","__editorExtras__"),fo=t("bW",{Destroyed:1,RealDestroyed:2,ToDestroy:4,DontSave:8,EditorOnly:16,Dirty:32,DontDestroy:64,Destroying:128,Deactivating:256,LockedInEditor:512,HideInHierarchy:1024,IsOnEnableCalled:2048,IsEditorOnEnableCalled:4096,IsPreloadStarted:8192,IsOnLoadCalled:16384,IsOnLoadStarted:32768,IsStartCalled:65536,IsRotationLocked:131072,IsScaleLocked:262144,IsAnchorLocked:524288,IsSizeLocked:1048576,IsPositionLocked:2097152,PersistentMask:-4192741,AllHideMasks:1560}),_o=[];function po(t,e){var i,n=t instanceof C.Node||t instanceof C.Component,r=n?"_id":null,s={};for(i in t)if(t.hasOwnProperty(i)){if(i===r)continue;switch(typeof t[i]){case"string":s[i]="";break;case"object":case"function":s[i]=null}}if(Vi._isCCClass(e))for(var a=C.Class.Attr.getClassAttrs(e),o=e.__props__,h=0;h<o.length;h++){var u=""+(i=o[h]);if(u in a){if(n&&"_id"===i)continue;switch(typeof a[u]){case"string":s[i]="";break;case"object":case"function":s[i]=null;break;case"undefined":s[i]=void 0}}}var l="";for(i in s){var c;c=Vi.IDENTIFIER_RE.test(i)?"o."+i+"=":"o["+Vi.escapeForJS(i)+"]=";var f=s[i];""===f&&(f='""'),l+=c+f+";\n"}return Function("o",l)}var mo=t("bV",function(){function t(t){void 0===t&&(t=""),this._objFlags=0,this._name=t}t._deferredDestroy=function(){for(var t=_o.length,e=0;e<t;++e){var i=_o[e];1&i._objFlags||i._destroyImmediate()}t===_o.length?_o.length=0:_o.splice(0,t)};var e=t.prototype;return e.destroy=function(){return 1&this._objFlags?(at(5e3),!1):!(4&this._objFlags||(this._objFlags|=4,_o.push(this),0))},e._destruct=function(){var t,e=this.constructor;Object.prototype.hasOwnProperty.call(e,"__destruct__")?t=e.__destruct__:(t=po(this,e),Vt(e,"__destruct__",t,!0)),t(this)},e._destroyImmediate=function(){var t;1&this._objFlags?ht(5e3):(null==(t=this._onPreDestroy)||t.call(this),this._destruct(),this._objFlags|=1)},n(t,[{key:"name",get:function(){return this._name},set:function(t){this._name=t}},{key:"hideFlags",get:function(){return 1560&this._objFlags},set:function(t){var e=1560&t;this._objFlags=-1561&this._objFlags|e}},{key:"isValid",get:function(){return!(1&this._objFlags)}}]),t}());mo.prototype._deserialize=null,Vi.fastDefine("cc.Object",mo,{_name:"",_objFlags:0});var go={};for(var yo in fo)"string"==typeof yo&&"number"==typeof fo[yo]&&(go[yo]=fo[yo]);function vo(t){return t instanceof mo}function bo(t,e){return"object"==typeof t?!(!t||t._objFlags&(e?5:1)):void 0!==t}Vt(mo,"Flags",go),C.isValid=bo,C.Object=mo;var So=be;function wo(){}var xo=function(){function t(){this.callback=wo,this.target=void 0,this.once=!1}var e=t.prototype;return e.set=function(t,e,i){this.callback=t||wo,this.target=e,this.once=!!i},e.reset=function(){this.target=void 0,this.callback=wo,this.once=!1},e.check=function(){return!(vo(this.target)&&!bo(this.target,!0))},t}(),To=new ho((function(){return new xo}),32),Ao=function(){function t(){this.callbackInfos=[],this.isInvoking=!1,this.containCanceled=!1}var e=t.prototype;return e.removeByCallback=function(t){for(var e=0;e<this.callbackInfos.length;++e){var i=this.callbackInfos[e];i&&i.callback===t&&(i.reset(),To.free(i),So(this.callbackInfos,e),--e)}},e.removeByTarget=function(t){for(var e=0;e<this.callbackInfos.length;++e){var i=this.callbackInfos[e];i&&i.target===t&&(i.reset(),To.free(i),So(this.callbackInfos,e),--e)}},e.cancel=function(t){var e=this.callbackInfos[t];e&&(e.reset(),this.isInvoking?this.callbackInfos[t]=null:So(this.callbackInfos,t),To.free(e)),this.containCanceled=!0},e.cancelAll=function(){for(var t=0;t<this.callbackInfos.length;t++){var e=this.callbackInfos[t];e&&(e.reset(),To.free(e),this.callbackInfos[t]=null)}this.containCanceled=!0},e.purgeCanceled=function(){for(var t=this.callbackInfos.length-1;t>=0;--t)this.callbackInfos[t]||So(this.callbackInfos,t);this.containCanceled=!1},e.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1},t}(),Co=new ho((function(){return new Ao}),16),Do=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=To.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;s<r.length;++s)if(r[s])return!0;return!1}return r.length>0}for(var a=0;a<r.length;++a){var o=r[a];if(o&&o.check()&&o.callback===e&&o.target===i)return!0}return!1},e.removeAll=function(t){var e=typeof t;if("string"===e||"number"===e){var i=this._callbackTable&&this._callbackTable[t];i&&(i.isInvoking?i.cancelAll():(i.clear(),Co.free(i),delete this._callbackTable[t]))}else if(t)for(var n in this._callbackTable){var r=this._callbackTable[n];if(r.isInvoking)for(var s=r.callbackInfos,a=0;a<s.length;++a){var o=s[a];o&&o.target===t&&r.cancel(a)}else r.removeByTarget(t)}},e.off=function(t,e,i){var n,r=this._callbackTable&&this._callbackTable[t];if(r){var s=r.callbackInfos;if(e)for(var a=0;a<s.length;++a){var o=s[a];if(o&&o.callback===e&&o.target===i){r.cancel(a);break}}else this.removeAll(t)}null==(n=this._offCallback)||n.call(this)},e.emit=function(t,e,i,n,r,s){var a=this._callbackTable&&this._callbackTable[t];if(a){var o=!a.isInvoking;a.isInvoking=!0;for(var h=a.callbackInfos,u=0,l=h.length;u<l;++u){var c=h[u];if(c){var f=c.callback,_=c.target;c.once&&this.off(t,f,_),c.check()?_?f.call(_,e,i,n,r,s):f(e,i,n,r,s):this.off(t,f,_)}}o&&(a.isInvoking=!1,a.containCanceled&&a.purgeCanceled())}},e.clear=function(){for(var t in this._callbackTable){var e=this._callbackTable[t];e&&(e.clear(),Co.free(e),delete this._callbackTable[t])}},e._registerOffCallback=function(t){this._offCallback=t},t}());function Bo(t){for(var e=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._callbackTable=Gt(!0),e}s(e,t);var i=e.prototype;return i.once=function(t,e,i){return this.on(t,e,i,!0)},i.targetOff=function(t){this.removeAll(t)},e}(t),i=Do.prototype,n=Object.getOwnPropertyNames(i).concat(Object.getOwnPropertySymbols(i)),r=0;r<n.length;++r){var a=n[r];if(!(a in e.prototype)){var o=Object.getOwnPropertyDescriptor(i,a);o&&Object.defineProperty(e.prototype,a,o)}}return e}var Io=t("c5",Bo((function(){})));C.EventTarget=Io;var Mo,Po,Eo,Oo,ko,Ro,Fo=t("c7",function(){function t(){this._delegates=[]}var e=t.prototype;return e.add=function(t){this._delegates.includes(t)||this._delegates.push(t)},e.hasListener=function(t){return this._delegates.includes(t)},e.remove=function(t){we(this._delegates,t)},e.dispatch=function(){for(var t=arguments,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return Promise.all(this._delegates.map((function(e){return e.apply(void 0,t)})).filter(Boolean))},t}());!function(t){t.UNKNOWN="unknown",t.WECHAT="wechat",t.ANDROID="androidbrowser",t.IE="ie",t.EDGE="edge",t.QQ="qqbrowser",t.MOBILE_QQ="mqqbrowser",t.UC="ucbrowser",t.UCBS="ucbs",t.BROWSER_360="360browser",t.BAIDU_APP="baiduboxapp",t.BAIDU="baidubrowser",t.MAXTHON="maxthon",t.OPERA="opera",t.OUPENG="oupeng",t.MIUI="miuibrowser",t.FIREFOX="firefox",t.SAFARI="safari",t.CHROME="chrome",t.LIEBAO="liebao",t.QZONE="qzone",t.SOUGOU="sogou",t.HUAWEI="huawei"}(Mo||(Mo={})),function(t){t.UNKNOWN="unknown",t.ENGLISH="en",t.CHINESE="zh",t.FRENCH="fr",t.ITALIAN="it",t.GERMAN="de",t.SPANISH="es",t.DUTCH="du",t.RUSSIAN="ru",t.KOREAN="ko",t.JAPANESE="ja",t.HUNGARIAN="hu",t.PORTUGUESE="pt",t.ARABIC="ar",t.NORWEGIAN="no",t.POLISH="pl",t.TURKISH="tr",t.UKRAINIAN="uk",t.ROMANIAN="ro",t.BULGARIAN="bg",t.HINDI="hi"}(Po||(Po={})),function(t){t[t.NONE=0]="NONE",t[t.LAN=1]="LAN",t[t.WWAN=2]="WWAN"}(Eo||(Eo={})),function(t){t.UNKNOWN="Unknown",t.IOS="iOS",t.ANDROID="Android",t.WINDOWS="Windows",t.LINUX="Linux",t.OSX="OS X",t.OHOS="OHOS",t.OPENHARMONY="OpenHarmony"}(Oo||(Oo={})),function(t){t.UNKNOWN="UNKNOWN",t.EDITOR_PAGE="EDITOR_PAGE",t.EDITOR_CORE="EDITOR_CORE",t.MOBILE_BROWSER="MOBILE_BROWSER",t.DESKTOP_BROWSER="DESKTOP_BROWSER",t.WIN32="WIN32",t.ANDROID="ANDROID",t.IOS="IOS",t.MACOS="MACOS",t.OHOS="OHOS",t.OPENHARMONY="OPENHARMONY",t.WECHAT_GAME="WECHAT_GAME",t.WECHAT_MINI_PROGRAM="WECHAT_MINI_PROGRAM",t.XIAOMI_QUICK_GAME="XIAOMI_QUICK_GAME",t.ALIPAY_MINI_GAME="ALIPAY_MINI_GAME",t.TAOBAO_CREATIVE_APP="TAOBAO_CREATIVE_APP",t.TAOBAO_MINI_GAME="TAOBAO_MINI_GAME",t.BYTEDANCE_MINI_GAME="BYTEDANCE_MINI_GAME",t.OPPO_MINI_GAME="OPPO_MINI_GAME",t.VIVO_MINI_GAME="VIVO_MINI_GAME",t.HUAWEI_QUICK_GAME="HUAWEI_QUICK_GAME",t.MIGU_MINI_GAME="MIGU_MINI_GAME",t.HONOR_MINI_GAME="HONOR_MINI_GAME"}(ko||(ko={})),function(t){t.WEBP="WEBP",t.IMAGE_BITMAP="IMAGE_BITMAP",t.WEB_VIEW="WEB_VIEW",t.VIDEO_PLAYER="VIDEO_PLAYER",t.SAFE_AREA="SAFE_AREA",t.HPE="HPE",t.INPUT_TOUCH="INPUT_TOUCH",t.EVENT_KEYBOARD="EVENT_KEYBOARD",t.EVENT_MOUSE="EVENT_MOUSE",t.EVENT_TOUCH="EVENT_TOUCH",t.EVENT_ACCELEROMETER="EVENT_ACCELEROMETER",t.EVENT_GAMEPAD="EVENT_GAMEPAD",t.EVENT_HANDLE="EVENT_HANDLE",t.EVENT_HMD="EVENT_HMD",t.EVENT_HANDHELD="EVENT_HANDHELD",t.WASM="WASM"}(Ro||(Ro={}));var Lo=function(t){function e(){var e,i;(i=t.call(this)||this)._battery=null,i._initPromise=[];var n,r=window.navigator,s=r.userAgent.toLowerCase();null==r.getBattery||r.getBattery().then((function(t){i._battery=t})),i.networkType=Eo.LAN,i.isNative=!1,i.isBrowser=!0,i.isMobile=/mobile|android|iphone|ipad/.test(s),i.platform=i.isMobile?ko.MOBILE_BROWSER:ko.DESKTOP_BROWSER,i.isLittleEndian=(n=new ArrayBuffer(2),new DataView(n).setInt16(0,256,!0),256===new Int16Array(n)[0]);var a=r.language;i.nativeLanguage=a.toLowerCase(),a=(a=a||r.browserLanguage)?a.split("-")[0]:Po.ENGLISH,i.language=a;var o=!1,h=!1,u="",l=0,c=/android\s*(\d+(?:\.\d+)*)/i.exec(s)||/android\s*(\d+(?:\.\d+)*)/i.exec(r.platform);c&&(o=!0,u=c[1]||"",l=parseInt(u)||0),(c=/(iPad|iPhone|iPod).*OS ((\d+_?){2,3})/i.exec(s))?(h=!0,u=c[2]||"",l=parseInt(u)||0):(/(iPhone|iPad|iPod)/.exec(r.platform)||"MacIntel"===r.platform&&r.maxTouchPoints&&r.maxTouchPoints>1)&&(h=!0,u="",l=0);var f=Oo.UNKNOWN;-1!==r.appVersion.indexOf("Win")?f=Oo.WINDOWS:h?f=Oo.IOS:-1!==r.appVersion.indexOf("Mac")?f=Oo.OSX:-1!==r.appVersion.indexOf("X11")&&-1===r.appVersion.indexOf("Linux")?f=Oo.LINUX:o?f=Oo.ANDROID:-1===r.appVersion.indexOf("Linux")&&-1===s.indexOf("ubuntu")||(f=Oo.LINUX),i.os=f,i.osVersion=u,i.osMainVersion=l,i.browserType=Mo.UNKNOWN;var _=/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=_?_[0].toLowerCase():Oo.UNKNOWN;("safari"===d&&o||"qq"===d&&/android.*applewebkit/i.test(s))&&(d=Mo.ANDROID);var p={micromessenger:Mo.WECHAT,wechat:Mo.WECHAT,weixin:Mo.WECHAT,trident:Mo.IE,edge:Mo.EDGE,"360 aphone":Mo.BROWSER_360,mxbrowser:Mo.MAXTHON,"opr/":Mo.OPERA,ubrowser:Mo.UC,huaweibrowser:Mo.HUAWEI};i.browserType=p[d]||d,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,y=document.createElement("canvas");y.getContext("2d");try{g=y.toDataURL("image/webp").startsWith("data:image/webp")}catch(t){g=!1}if(i.os===Oo.IOS){var v,b=null==(v=/ applewebkit\/(\d+)/.exec(s))?void 0:v[1];"string"==typeof b&&Number.parseInt(b)>=604&&(g=!0)}else if(i.browserType===Mo.SAFARI){var x,T=null==(x=/ version\/(\d+)/.exec(s))?void 0:x[1];"string"==typeof T&&Number.parseInt(T)>=14&&(g=!0)}var A=void 0!==document.documentElement.ontouchstart||void 0!==document.ontouchstart||S,C=void 0!==document.documentElement.onmouseup||S,D=void 0!==navigator.xr,B=function(){if((i.os===Oo.IOS||i.os===Oo.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]=A,e[Ro.EVENT_KEYBOARD]=void 0!==document.documentElement.onkeyup||S,e[Ro.EVENT_MOUSE]=C,e[Ro.EVENT_TOUCH]=A||C,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]=w,e[Ro.EVENT_HMD]=D,e[Ro.EVENT_HANDHELD]=D,e[Ro.WASM]=B,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<s.length;a++)document.addEventListener(s[a],(function(e){var i=document[t];(i=i||e.hidden)?n():r()}));else window.addEventListener("blur",n),window.addEventListener("focus",r);window.navigator.userAgent.indexOf("MicroMessenger")>-1&&(window.onfocus=r),"onpageshow"in window&&"onpagehide"in window&&(window.addEventListener("pagehide",n),window.addEventListener("pageshow",r),document.addEventListener("pagehide",n),document.addEventListener("pageshow",r))},i._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),Vo=new Lo,No=/(\.[^./?\\]*)(\?.*)?$/,zo=/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,Uo=/[^./]+\/\.\.\//;function Go(){for(var t="",e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return i.forEach((function(e){t=(t+(""===t?"":"/")+e).replace(/(\/|\\\\)$/,"")})),t}function Ho(t){var e=No.exec(t);return e?e[1]:""}function Wo(t){if(t){var e=t.lastIndexOf(".");if(-1!==e)return t.substring(0,e)}return t}function jo(t,e){var i=t.indexOf("?");i>0&&(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 qo(t){var e=zo.exec(t);return e?e[2]:""}function Xo(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 Yo(t,e,i){if(0===e.indexOf("."))return Xo(t,e);var n=t.indexOf("?"),r="",s=i?Ho(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 Jo(t){var e=t=String(t);do{e=t,t=t.replace(Uo,"")}while(e.length!==t.length);return t}function Ko(t){return t.replace(/[/\\]$/,"")}function Qo(){return Vo.os===Oo.WINDOWS?"\\":"/"}t("bH",Object.freeze({__proto__:null,_normalize:Jo,basename:jo,changeBasename:Yo,changeExtname:Xo,dirname:qo,extname:Ho,getSeperator:Qo,join:Go,mainFileName:Wo,stripSep:Ko}));var Zo=new ir;function $o(t,e,i,n){n||(n=new ir),t.convertToUINode(e,i,n);var r=i.position;return n.add(r),n}function th(t,e,i){return i||(i=new ir),t.worldToScreen(e,i),i.x/=C.view.getScaleX(),i.y/=C.view.getScaleY(),i}var eh=t("bR",{WorldNode3DToLocalNodeUI:$o,WorldNode3DToWorldNodeUI:th});C.pipelineUtils=eh,pt(C.pipelineUtils,"cc.pipelineUtils",[{name:"WorldNode3DToLocalNodeUI",newName:"convertToUINode",targetName:"cc.Camera.prototype",customFunction:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var n=e[0],r=e[3]||Zo;return n.convertToUINode(e[1],e[2],r),r.add(e[2].position),e[3]||r.clone()}}]);var ih,nh={auto:Ne.AUTO,landscape:Ne.LANDSCAPE,portrait:Ne.PORTRAIT};!function(t){t[t.Unknown=0]="Unknown",t[t.SubFrame=1]="SubFrame",t[t.BrowserWindow=2]="BrowserWindow",t[t.Fullscreen=3]="Fullscreen"}(ih||(ih={}));var rh=function(t){s(i,t);var e=i.prototype;function i(){var e,i,n,r,s,a;(e=t.call(this)||this).isFrameRotated=!1,e.handleResizeEvent=!0,e._gameFrame=void 0,e._gameContainer=void 0,e._gameCanvas=void 0,e._isProportionalToFrame=!1,e._cachedFrameStyle={width:"0px",height:"0px"},e._cachedContainerStyle={width:"0px",height:"0px"},e._cbToUpdateFrameBuffer=void 0,e._supportFullScreen=!1,e._touchEventName=void 0,e._onFullscreenChange=void 0,e._onFullscreenError=void 0,e._orientationChangeTimeoutId=-1,e._cachedFrameSize=new ms(0,0),e._exactFitScreen=!1,e._isHeadlessMode=!1,e._fn={},e._fnGroup=[["requestFullscreen","exitFullscreen","fullscreenchange","fullscreenEnabled","fullscreenElement","fullscreenerror"],["requestFullScreen","exitFullScreen","fullScreenchange","fullScreenEnabled","fullScreenElement","fullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitfullscreenchange","webkitIsFullScreen","webkitCurrentFullScreenElement","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange","mozFullScreen","mozFullScreenElement","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","MSFullscreenChange","msFullscreenEnabled","msFullscreenElement","msfullscreenerror"]],e._resolutionScale=1,e._orientation=Ne.AUTO,e._orientationDevice=Ne.AUTO,e._gameFrame=document.getElementById("GameDiv"),e._gameContainer=document.getElementById("Cocos3dGameContainer"),e._gameCanvas=document.getElementById("GameCanvas"),e._gameFrame||(e._gameFrame=document.createElement("div"),e._gameFrame.setAttribute("id","GameDiv"),null==(i=e._gameCanvas)||null==(n=i.parentNode)||n.insertBefore(e._gameFrame,e._gameCanvas),e._gameFrame.appendChild(e._gameCanvas)),e._gameContainer||(e._gameContainer=document.createElement("div"),e._gameContainer.setAttribute("id","Cocos3dGameContainer"),null==(r=e._gameCanvas)||null==(s=r.parentNode)||s.insertBefore(e._gameContainer,e._gameCanvas),e._gameContainer.appendChild(e._gameCanvas));for(var o=e._fnGroup,h=0;h<o.length;h++)if(a=o[h],void 0!==document[a[1]]){for(var u=0;u<a.length;u++)e._fn[o[0][u]]=a[u];break}return e._supportFullScreen=void 0!==e._fn.requestFullscreen,e._touchEventName="ontouchstart"in window?"touchend":"mousedown",e._registerEvent(),e}return e._updateFrame=function(){this._updateFrameState(),this._resizeFrame()},e.init=function(t,e){this._cbToUpdateFrameBuffer=e,this.orientation=nh[t.configOrientation],this._exactFitScreen=t.exactFitScreen,this._isHeadlessMode=t.isHeadlessMode,this._resizeFrame()},e.requestFullScreen=function(){var t=this;return new Promise((function(e,i){t.isFullScreen?e():(t._cachedFrameSize=t.windowSize,t._doRequestFullScreen().then((function(){e()})).catch((function(){var n=t._getFullscreenTarget();n?n.addEventListener(t._touchEventName,(function(){t._doRequestFullScreen().then((function(){e()})).catch(i)}),{once:!0,capture:!0}):i(new Error("Cannot access fullscreen target"))})))}))},e.exitFullScreen=function(){var t=this;return new Promise((function(e,i){var n=document[t._fn.exitFullscreen]();window.Promise&&n instanceof Promise?n.then((function(){t.windowSize=t._cachedFrameSize,e()})).catch(i):(t.windowSize=t._cachedFrameSize,e())}))},e._registerEvent=function(){var t=this;document.addEventListener(this._fn.fullscreenerror,(function(){null==t._onFullscreenError||t._onFullscreenError()})),window.addEventListener("resize",(function(){t._updateFrame()}));var e,i=function(e){e!==t._orientationDevice&&(t._orientationDevice=e,t._updateFrame(),t.emit("orientation-change",e))},n=function(){var e=Ne.PORTRAIT;switch(window.orientation){case 0:e=Ne.PORTRAIT;break;case 90:e=Ne.LANDSCAPE_RIGHT;break;case-90:e=Ne.LANDSCAPE_LEFT;break;case 180:e=Ne.PORTRAIT_UPSIDE_DOWN;break;default:e=t._orientationDevice}return e},r=function(){-1!==t._orientationChangeTimeoutId&&clearTimeout(t._orientationChangeTimeoutId),t._orientationChangeTimeoutId=setTimeout((function(){e()}),200)};if("function"==typeof window.matchMedia){!function e(){var i=window.devicePixelRatio,n=window.matchMedia("(resolution: "+i+"dppx)");n.addEventListener?n.addEventListener("change",(function(){t.emit("window-resize",t.windowSize.width,t.windowSize.height),e()}),{once:!0}):n.addListener&&n.addListener((function(){t.emit("window-resize",t.windowSize.width,t.windowSize.height)}))}();var s=window.matchMedia("(orientation: portrait)"),a=window.matchMedia("(orientation: landscape)"),o=screen.orientation;e=function(){var e=t._orientationDevice;s.matches?(e=Ne.PORTRAIT,o&&(e="portrait-primary"===screen.orientation.type?Ne.PORTRAIT:Ne.PORTRAIT_UPSIDE_DOWN)):a.matches&&(e=Ne.LANDSCAPE,o&&(e="landscape-primary"===screen.orientation.type?Ne.LANDSCAPE_LEFT:Ne.LANDSCAPE_RIGHT)),i(e)},s.addEventListener?(s.addEventListener("change",r),a.addEventListener("change",r)):s.addListener&&(s.addListener(r),a.addListener(r))}else e=function(){var t=n();i(t)},window.addEventListener("orientationchange",r);document.addEventListener(this._fn.fullscreenchange,(function(){null==t._onFullscreenChange||t._onFullscreenChange(),t.emit("fullscreen-change",t.windowSize.width,t.windowSize.height)}))},e._convertToSizeInCssPixels=function(t){var e=t.clone(),i=this.devicePixelRatio;return e.width/=i,e.height/=i,e},e._resizeFrame=function(t){if(this._gameFrame){if(this._gameFrame.style.display="flex",this._gameFrame.style["justify-content"]="center",this._gameFrame.style["align-items"]="center",this._windowType===ih.SubFrame){if(!t)return void this._updateContainer();this._gameFrame.style.width=t.width+"px",this._gameFrame.style.height=t.height+"px"}else{var e=window.innerWidth,i=window.innerHeight,n=document.body.scrollHeight-i;Vo.os===Oo.ANDROID&&i<n&&(i+=n),this.isFrameRotated?(this._gameFrame.style["-webkit-transform"]="rotate(90deg)",this._gameFrame.style.transform="rotate(90deg)",this._gameFrame.style["-webkit-transform-origin"]="0px 0px 0px",this._gameFrame.style.transformOrigin="0px 0px 0px",this._gameFrame.style.margin="0 0 0 "+e+"px",this._gameFrame.style.width=i+"px",this._gameFrame.style.height=e+"px"):(this._gameFrame.style["-webkit-transform"]="rotate(0deg)",this._gameFrame.style.transform="rotate(0deg)",this._gameFrame.style.margin="0px auto",this._gameFrame.style.width=e+"px",this._gameFrame.style.height=i+"px")}this._updateContainer()}},e._getFullscreenTarget=function(){var t=this._windowType;return t===ih.Fullscreen?document[this._fn.fullscreenElement]:t===ih.SubFrame?this._gameFrame:document.body},e._doRequestFullScreen=function(){var t=this;return new Promise((function(e,i){if(t._supportFullScreen){var n=t._getFullscreenTarget();if(n){t._onFullscreenChange=void 0,t._onFullscreenError=void 0;var r=n[t._fn.requestFullscreen]();window.Promise&&r instanceof Promise?r.then(e).catch(i):(t._onFullscreenChange=e,t._onFullscreenError=i)}else i(new Error("Cannot access fullscreen target"))}else i(new Error("fullscreen is not supported"))}))},e._updateFrameState=function(){var t=this.orientation,e=window.innerWidth>window.innerHeight;this.isFrameRotated=Vo.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=C.view.getDesignResolutionSize(),n=this._gameFrame,r=n.clientWidth,s=n.clientHeight,a=i.width,o=i.height,h=r/a,u=s/o,l=this._gameContainer.style;h<u?(t=r,e=o*h):(t=a*u,e=s),l.width=t+"px",l.height=e+"px"}else{var c=this._gameContainer.style;c.width="100%",c.height="100%"}!this._gameFrame||this._cachedFrameStyle.width===this._gameFrame.style.width&&this._cachedFrameStyle.height===this._gameFrame.style.height&&this._cachedContainerStyle.width===this._gameContainer.style.width&&this._cachedContainerStyle.height===this._gameContainer.style.height||(this.emit("window-resize",this.windowSize.width,this.windowSize.height),this._cachedFrameStyle.width=this._gameFrame.style.width,this._cachedFrameStyle.height=this._gameFrame.style.height,this._cachedContainerStyle.width=this._gameContainer.style.width,this._cachedContainerStyle.height=this._gameContainer.style.height)}else at(9201)},n(i,[{key:"supportFullScreen",get:function(){return this._supportFullScreen}},{key:"isFullScreen",get:function(){return!!this._supportFullScreen&&!!document[this._fn.fullscreenElement]}},{key:"devicePixelRatio",get:function(){var t;return Math.min(null!==(t=window.devicePixelRatio)&&void 0!==t?t:1,2)}},{key:"windowSize",get:function(){var t=this._windowSizeInCssPixels,e=this.devicePixelRatio;return t.width*=e,t.height*=e,t},set:function(t){this._windowType===ih.SubFrame?this._resizeFrame(this._convertToSizeInCssPixels(t)):at(9202)}},{key:"resolution",get:function(){var t=this.windowSize,e=this.resolutionScale;return new ms(t.width*e,t.height*e)}},{key:"resolutionScale",get:function(){return this._resolutionScale},set:function(t){var e;t!==this._resolutionScale&&(this._resolutionScale=t,null==(e=this._cbToUpdateFrameBuffer)||e.call(this))}},{key:"orientation",get:function(){return this._orientation},set:function(t){this._orientation!==t&&(this._orientation=t,this._updateFrame())}},{key:"safeAreaEdge",get:function(){var t=this.devicePixelRatio;return{top:parseInt(getComputedStyle(document.documentElement).getPropertyValue("--safe-top")||"0")*t,bottom:parseInt(getComputedStyle(document.documentElement).getPropertyValue("--safe-bottom")||"0")*t,left:parseInt(getComputedStyle(document.documentElement).getPropertyValue("--safe-left")||"0")*t,right:parseInt(getComputedStyle(document.documentElement).getPropertyValue("--safe-right")||"0")*t}}},{key:"isProportionalToFrame",get:function(){return this._isProportionalToFrame},set:function(t){this._isProportionalToFrame!==t&&(this._isProportionalToFrame=t,this._updateContainer())}},{key:"_windowSizeInCssPixels",get:function(){if(this.isProportionalToFrame)return this._gameContainer?new ms(this._gameContainer.clientWidth,this._gameContainer.clientHeight):(at(9201),new ms(0,0));var t,e,i;switch(this._windowType){case ih.SubFrame:return this._gameFrame?new ms(this._gameFrame.clientWidth,this._gameFrame.clientHeight):(at(9201),new ms(0,0));case ih.Fullscreen:return t=this._getFullscreenTarget(),e=this.isFrameRotated?t.clientHeight:t.clientWidth,i=this.isFrameRotated?t.clientWidth:t.clientHeight,new ms(e,i);case ih.BrowserWindow:return e=this.isFrameRotated?window.innerHeight:window.innerWidth,i=this.isFrameRotated?window.innerWidth:window.innerHeight,new ms(e,i);case ih.Unknown:default:return new ms(1,1)}}},{key:"_windowType",get:function(){return this._isHeadlessMode?ih.Unknown:this.isFullScreen?ih.Fullscreen:this._gameFrame?this._exactFitScreen?ih.BrowserWindow:ih.SubFrame:(at(9201),ih.Unknown)}}]),i}(Io),sh=new rh,ah=function(){function t(){}var e=t.prototype;return e.init=function(){var t,e,i=null===(t=ze.querySettings("screen","exactFitScreen"))||void 0===t||t,n=null!==(e=ze.querySettings("screen","orientation"))&&void 0!==e?e:"auto",r=3===ze.querySettings("rendering","renderMode");sh.init({exactFitScreen:i,configOrientation:n,isHeadlessMode:r},(function(){var t,e=C.director;null!=(t=e.root)&&t.pipeline?e.root.pipeline.shadingScale=sh.resolutionScale:at(1220)}))},e.fullScreen=function(){return sh.isFullScreen},e.requestFullScreen=function(t,e,i){return arguments.length>0&&at(1400,"screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)","screen.requestFullScreen(): Promise"),sh.requestFullScreen().then((function(){null==e||e.call(document)})).catch((function(t){J(t),null==i||i.call(document)}))},e.exitFullScreen=function(){return sh.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){sh.on(t,e,i)},e.once=function(t,e,i){sh.once(t,e,i)},e.off=function(t,e,i){sh.off(t,e,i)},n(t,[{key:"devicePixelRatio",get:function(){return sh.devicePixelRatio}},{key:"windowSize",get:function(){return sh.windowSize},set:function(t){sh.windowSize=t}},{key:"resolution",get:function(){return sh.resolution}},{key:"supportsFullScreen",get:function(){return sh.supportFullScreen}}]),t}(),oh=t("cm",new ah);C.screen=oh;var hh=t("cn",{Feature:Ro,hasFeature:function(t){return Vo.hasFeature(t)},NetworkType:Eo,Language:Po,OS:Oo,Platform:ko,BrowserType:Mo,isNative:Vo.isNative,isBrowser:Vo.isBrowser,isMobile:Vo.isMobile,isLittleEndian:Vo.isLittleEndian,platform:Vo.platform,language:Vo.language,languageCode:Vo.nativeLanguage,os:Vo.os,osVersion:Vo.osVersion,osMainVersion:Vo.osMainVersion,browserType:Vo.browserType,browserVersion:Vo.browserVersion,isXR:Vo.isXR,windowPixelResolution:oh.windowSize,capabilities:{canvas:!0,opengl:!0,webp:Vo.hasFeature(Ro.WEBP),imageBitmap:Vo.hasFeature(Ro.IMAGE_BITMAP),touches:Vo.hasFeature(Ro.INPUT_TOUCH),mouse:Vo.hasFeature(Ro.EVENT_MOUSE),keyboard:Vo.hasFeature(Ro.EVENT_KEYBOARD),accelerometer:Vo.hasFeature(Ro.EVENT_ACCELEROMETER)},localStorage:{},getNetworkType:function(){return Vo.networkType},getBatteryLevel:function(){return Vo.getBatteryLevel()},garbageCollect:function(){Vo.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: "+hh.hasFeature(Ro.WEBP)+"\r\n",t+="supports bitmap: "+hh.hasFeature(Ro.IMAGE_BITMAP)+"\r\n",t+="supports touches: "+hh.hasFeature(Ro.INPUT_TOUCH)+"\r\n",t+="supports mouse: "+hh.hasFeature(Ro.EVENT_MOUSE)+"\r\n",t+="supports keyboard: "+hh.hasFeature(Ro.EVENT_KEYBOARD)+"\r\n",t+="supports accelerometer: "+hh.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 "+(C.game.renderType===C.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n")},openURL:function(t){Vo.openURL(t)},init:function(){var t=this;return Promise.resolve().then((function(){return Vo.init()})).then((function(){try{var e=hh.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=(hh.os===Oo.IOS||hh.os===Oo.OSX)&&Vo.isBrowser&&/(OS 14)|(Version\/14)/.test(window.navigator.userAgent)}))},now:function(){return Vo.now()},restartVM:function(){Vo.restartJSVM()},getSafeAreaRect:function(t){void 0===t&&(t=!0);var e=C.view,i=sh.safeAreaEdge;t&&(sh.orientation===Ue.ORIENTATION_PORTRAIT?i.top<i.bottom?i.top=i.bottom:i.bottom=i.top:i.left<i.right?i.left=i.right:i.right=i.left);var n=sh.windowSize,r=new ds(i.left,i.bottom),s=new ds(n.width-i.right,n.height-i.top);e._convertToUISpace(r),e._convertToUISpace(s);var a=r.x,o=r.y,h=s.x-r.x,u=s.y-r.y;return new bs(a,o,h,u)}});C.sys=hh,gt(C,"cc",[{name:"winSize",suggest:"please use view.getVisibleSize() instead."}]),gt(hh,"sys",[{name:"capabilities",suggest:"please use sys.hasFeature() method instead."}]),pt(hh,"sys",["UNKNOWN","ENGLISH","CHINESE","FRENCH","ITALIAN","GERMAN","SPANISH","DUTCH","RUSSIAN","KOREAN","JAPANESE","HUNGARIAN","PORTUGUESE","ARABIC","NORWEGIAN","POLISH","TURKISH","UKRAINIAN","ROMANIAN","BULGARIAN"].map((function(t){return{name:"LANGUAGE_"+t,newName:t,target:hh.Language,targetName:"sys.Language"}}))),pt(hh,"sys",["UNKNOWN","IOS","ANDROID","WINDOWS","LINUX","OSX"].map((function(t){return{name:"OS_"+t,newName:t,target:hh.OS,targetName:"sys.OS"}}))),pt(hh,"sys",["UNKNOWN","WECHAT","ANDROID","IE","EDGE","QQ","MOBILE_QQ","UC","UCBS","BAIDU_APP","BAIDU","MAXTHON","OPERA","OUPENG","MIUI","FIREFOX","SAFARI","CHROME","LIEBAO","QZONE","SOUGOU","HUAWEI"].map((function(t){return{name:"BROWSER_TYPE_"+t,newName:t,target:hh.BrowserType,targetName:"sys.BrowserType"}}))),pt(hh,"sys",[{name:"BROWSER_TYPE_360",newName:"BROWSER_360",target:hh.BrowserType,targetName:"sys.BrowserType"}]),pt(hh,"sys",["UNKNOWN","EDITOR_PAGE","EDITOR_CORE","MOBILE_BROWSER","DESKTOP_BROWSER","WIN32","MACOS","IOS","ANDROID","OHOS","WECHAT_GAME","XIAOMI_QUICK_GAME","ALIPAY_MINI_GAME","BYTEDANCE_MINI_GAME","OPPO_MINI_GAME","VIVO_MINI_GAME","HUAWEI_QUICK_GAME"].map((function(t){return{name:t,target:hh.Platform,targetName:"sys.Platform"}}))),pt(hh,"sys",[{name:"IPHONE",newName:"IOS",target:hh.Platform,targetName:"sys.Platform"},{name:"IPAD",newName:"IOS",target:hh.Platform,targetName:"sys.Platform"}]),mt(hh,"sys",["LINUX","BLACKBERRY","NACL","EMSCRIPTEN","TIZEN","WINRT","WP8","QQ_PLAY","FB_PLAYABLE_ADS"].map((function(t){return{name:t}}))),pt(hh,"sys",[{name:"windowPixelResolution",target:oh,targetName:"screen",newName:"windowSize"}]),gt(oh,"screen",[{name:"autoFullScreen",suggest:"please use screen.requestFullScreen() instead."},{name:"disableAutoFullScreen"}]);var uh=t("cp",{topLeft:C.v2(0,0),topRight:C.v2(0,0),top:C.v2(0,0),bottomLeft:C.v2(0,0),bottomRight:C.v2(0,0),bottom:C.v2(0,0),center:C.v2(0,0),left:C.v2(0,0),right:C.v2(0,0),width:0,height:0,init:function(t){var e=this.width=t.width,i=this.height=t.height,n=t.x,r=t.y,s=r+i,a=n+e;this.topLeft.x=n,this.topLeft.y=s,this.topRight.x=a,this.topRight.y=s,this.top.x=n+e/2,this.top.y=s,this.bottomLeft.x=n,this.bottomLeft.y=r,this.bottomRight.x=a,this.bottomRight.y=r,this.bottom.x=n+e/2,this.bottom.y=r,this.center.x=n+e/2,this.center.y=r+i/2,this.left.x=n,this.left.y=r+i/2,this.right.x=a,this.right.y=r+i/2}});C.visibleRect=uh;var lh=new ir,ch=new ir,fh=new ir,_h=new ir,dh=new yr,ph=Math.abs,mh=function(t,e,i){dh.m00=ph(i.m00),dh.m01=ph(i.m01),dh.m02=ph(i.m02),dh.m03=ph(i.m04),dh.m04=ph(i.m05),dh.m05=ph(i.m06),dh.m06=ph(i.m08),dh.m07=ph(i.m09),dh.m08=ph(i.m10),ir.transformMat3(t,e,dh)},gh=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=1),void 0===s&&(s=1),this.center=void 0,this.halfExtents=void 0,this._type=void 0,this._type=8,this.center=new ir(t,e,i),this.halfExtents=new ir(n,r,s)}t.create=function(e,i,n,r,s,a){return new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.center.x,e.center.y,e.center.z,e.halfExtents.x,e.halfExtents.y,e.halfExtents.z)},t.copy=function(t,e){return ir.copy(t.center,e.center),ir.copy(t.halfExtents,e.halfExtents),t},t.fromPoints=function(t,e,i){return ir.add(lh,i,e),ir.subtract(ch,i,e),ir.multiplyScalar(t.center,lh,.5),ir.multiplyScalar(t.halfExtents,ch,.5),t},t.set=function(t,e,i,n,r,s,a){return t.center.set(e,i,n),t.halfExtents.set(r,s,a),t},t.merge=function(e,i,n){return ir.subtract(lh,i.center,i.halfExtents),ir.subtract(ch,n.center,n.halfExtents),ir.add(fh,i.center,i.halfExtents),ir.add(_h,n.center,n.halfExtents),ir.max(_h,fh,_h),ir.min(fh,lh,ch),t.fromPoints(e,fh,_h)},t.toBoundingSphere=function(t,e){return t.center.set(e.center),t.radius=e.halfExtents.length(),t},t.transform=function(t,e,i){return ir.transformMat4(t.center,e.center,i),mh(t.halfExtents,e.halfExtents,i),t};var e=t.prototype;return e.getBoundary=function(t,e){ir.subtract(t,this.center,this.halfExtents),ir.add(e,this.center,this.halfExtents)},e.transform=function(t,e,i,n,r){ir.transformMat4(r.center,this.center,t),mh(r.halfExtents,this.halfExtents,t)},e.clone=function(){var e=this.center,i=this.halfExtents;return new t(e.x,e.y,e.z,i.x,i.y,i.z)},e.copy=function(t){return ir.copy(this.center,t.center),ir.copy(this.halfExtents,t.halfExtents),this},e.mergePoint=function(t){this.getBoundary(lh,ch),t.x<lh.x&&(lh.x=t.x),t.y<lh.y&&(lh.y=t.y),t.z<lh.z&&(lh.z=t.z),t.x>ch.x&&(ch.x=t.x),t.y>ch.y&&(ch.y=t.y),t.z>ch.z&&(ch.z=t.z),ir.add(fh,lh,ch),this.center.set(ir.multiplyScalar(fh,fh,.5)),this.halfExtents.set(ch.x-fh.x,ch.y-fh.y,ch.z-fh.z)},e.mergePoints=function(t){if(!(t.length<1))for(var e=0;e<t.length;e++)this.mergePoint(t[e])},e.mergeFrustum=function(t){this.mergePoints(t.vertices)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),yh=function(){function t(t,e,i){void 0===t&&(t=.5),void 0===e&&(e=.5),void 0===i&&(i=1),this._type=void 0,this.radius=void 0,this.halfHeight=void 0,this.axis=void 0,this.center=void 0,this.rotation=void 0,this.ellipseCenter0=void 0,this.ellipseCenter1=void 0,this._type=512,this.radius=t,this.halfHeight=e,this.axis=i,this.center=new ir,this.rotation=new kr,this.ellipseCenter0=new ir(0,e,0),this.ellipseCenter1=new ir(0,-e,0),this.updateCache()}var e=t.prototype;return e.transform=function(t,e,i,n,r){var s=n,a=mn(s);r.radius=this.radius*Math.abs(a);var o=(this.halfHeight+this.radius)*Math.abs(s.y)-r.radius;o<0&&(o=0),r.halfHeight=o,ir.transformMat4(r.center,this.center,t),kr.multiply(r.rotation,this.rotation,i),r.updateCache()},e.updateCache=function(){this.updateLocalCenter(),ir.transformQuat(this.ellipseCenter0,this.ellipseCenter0,this.rotation),ir.transformQuat(this.ellipseCenter1,this.ellipseCenter1,this.rotation),this.ellipseCenter0.add(this.center),this.ellipseCenter1.add(this.center)},e.updateLocalCenter=function(){var t=this.halfHeight;switch(this.axis){case 0:this.ellipseCenter0.set(t,0,0),this.ellipseCenter1.set(-t,0,0);break;case 1:this.ellipseCenter0.set(0,t,0),this.ellipseCenter1.set(0,-t,0);break;case 2:this.ellipseCenter0.set(0,0,t),this.ellipseCenter1.set(0,0,-t)}},n(t,[{key:"type",get:function(){return this._type}}]),t}(),vh=new Array(8);vh[0]=nr(1,1,1),vh[1]=nr(-1,1,1),vh[2]=nr(-1,-1,1),vh[3]=nr(1,-1,1),vh[4]=nr(1,1,-1),vh[5]=nr(-1,1,-1),vh[6]=nr(-1,-1,-1),vh[7]=nr(1,-1,-1);var bh,Sh=nr(),wh=nr(),xh=nr(),Th=no.fromPoints,Ah=ir.set,Ch=ir.transformMat4,Dh=function(){e.createOrthographic=function(t,e,i,n,r,s){var a=e/2,o=i/2;Ah(xh,a,o,-n),Ch(t.vertices[0],xh,s),Ah(xh,-a,o,-n),Ch(t.vertices[1],xh,s),Ah(xh,-a,-o,-n),Ch(t.vertices[2],xh,s),Ah(xh,a,-o,-n),Ch(t.vertices[3],xh,s),Ah(xh,a,o,-r),Ch(t.vertices[4],xh,s),Ah(xh,-a,o,-r),Ch(t.vertices[5],xh,s),Ah(xh,-a,-o,-r),Ch(t.vertices[6],xh,s),Ah(xh,a,-o,-r),Ch(t.vertices[7],xh,s),t.updatePlanes()},e.createOrtho=function(t,i,n,r,s,a){return e.createOrthographic(t,i,n,r,s,a)},e.createPerspective=function(t,e,i,n,r,s){var a=Math.tan(.5*i),o=a*e;Sh.set(n*o,n*a,n),wh.set(r*o,r*a,r);var h=t.vertices;xh.set(Sh.x,Sh.y,-Sh.z),Ch(h[0],xh,s),xh.set(-Sh.x,Sh.y,-Sh.z),Ch(h[1],xh,s),xh.set(-Sh.x,-Sh.y,-Sh.z),Ch(h[2],xh,s),xh.set(Sh.x,-Sh.y,-Sh.z),Ch(h[3],xh,s),xh.set(wh.x,wh.y,-wh.z),Ch(h[4],xh,s),xh.set(-wh.x,wh.y,-wh.z),Ch(h[5],xh,s),xh.set(-wh.x,-wh.y,-wh.z),Ch(h[6],xh,s),xh.set(wh.x,-wh.y,-wh.z),Ch(h[7],xh,s),t.updatePlanes()},e.createFromAABB=function(t,e){var i=new ir,n=new ir;ir.subtract(i,e.center,e.halfExtents),ir.add(n,e.center,e.halfExtents);var r=t.vertices;return r[0].set(n.x,n.y,-i.z),r[1].set(i.x,n.y,-i.z),r[2].set(i.x,i.y,-i.z),r[3].set(n.x,i.y,-i.z),r[4].set(n.x,n.y,-n.z),r[5].set(i.x,n.y,-n.z),r[6].set(i.x,i.y,-n.z),r[7].set(n.x,i.y,-n.z),t.updatePlanes(),t};var t=e.prototype;function e(){this.planes=void 0,this.vertices=void 0,this._type=void 0,this._type=128,this.planes=new Array(6);for(var t=0;t<6;++t)this.planes[t]=no.create(0,0,0,0);this.vertices=new Array(8);for(var e=0;e<8;++e)this.vertices[e]=new ir}return t.split=function(t,i,n,r,s){return e.createPerspective(this,n,r,t,i,s)},e.create=function(){return new e},e.clone=function(t){return e.copy(new e,t)},e.copy=function(t,e){t._type=e.type;for(var i=0;i<6;++i)no.copy(t.planes[i],e.planes[i]);for(var n=0;n<8;++n)ir.copy(t.vertices[n],e.vertices[n]);return t},t.update=function(t,e){var i=this.planes;Ah(i[0].n,t.m03+t.m00,t.m07+t.m04,t.m11+t.m08),i[0].d=-(t.m15+t.m12),Ah(i[1].n,t.m03-t.m00,t.m07-t.m04,t.m11-t.m08),i[1].d=-(t.m15-t.m12),Ah(i[2].n,t.m03+t.m01,t.m07+t.m05,t.m11+t.m09),i[2].d=-(t.m15+t.m13),Ah(i[3].n,t.m03-t.m01,t.m07-t.m05,t.m11-t.m09),i[3].d=-(t.m15-t.m13),Ah(i[4].n,t.m03+t.m02,t.m07+t.m06,t.m11+t.m10),i[4].d=-(t.m15+t.m14),Ah(i[5].n,t.m03-t.m02,t.m07-t.m06,t.m11-t.m10),i[5].d=-(t.m15-t.m14);for(var n=0;n<6;n++){var r=i[n],s=1/r.n.length();ir.multiplyScalar(r.n,r.n,s),r.d*=s}for(var a=0;a<8;a++)Ch(this.vertices[a],vh[a],e)},t.transform=function(t){for(var e=0;e<8;e++)Ch(this.vertices[e],this.vertices[e],t);this.updatePlanes()},t.zero=function(){for(var t=0;t<8;t++)this.vertices[t].set(0,0,0);for(var e=0;e<6;e++)no.set(this.planes[e],0,0,0,0)},t.updatePlanes=function(){var t=this.planes,e=this.vertices;Th(t[0],e[1],e[6],e[5]),Th(t[1],e[3],e[4],e[7]),Th(t[2],e[6],e[3],e[7]),Th(t[3],e[0],e[5],e[4]),Th(t[4],e[2],e[0],e[3]),Th(t[5],e[7],e[5],e[6])},n(e,[{key:"accurate",set:function(t){this._type=t?256:128}},{key:"type",get:function(){return this._type}}]),e}(),Bh=new ir,Ih=new ir,Mh=new yr,Ph=Math.abs,Eh=function(t,e,i){Mh.m00=Ph(i.m00),Mh.m01=Ph(i.m01),Mh.m02=Ph(i.m02),Mh.m03=Ph(i.m03),Mh.m04=Ph(i.m04),Mh.m05=Ph(i.m05),Mh.m06=Ph(i.m06),Mh.m07=Ph(i.m07),Mh.m08=Ph(i.m08),ir.transformMat3(t,e,Mh)},Oh=function(){function t(t,e,i,n,r,s,a,o,h,u,l,c,f,_,d){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=1),void 0===s&&(s=1),void 0===a&&(a=1),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===_&&(_=0),void 0===d&&(d=1),this.center=void 0,this.halfExtents=void 0,this.orientation=void 0,this._type=void 0,this._type=16,this.center=new ir(t,e,i),this.halfExtents=new ir(n,r,s),this.orientation=new yr(a,o,h,u,l,c,f,_,d)}t.create=function(e,i,n,r,s,a,o,h,u,l,c,f,_,d,p){return new t(e,i,n,r,s,a,o,h,u,l,c,f,_,d,p)},t.clone=function(e){return new t(e.center.x,e.center.y,e.center.z,e.halfExtents.x,e.halfExtents.y,e.halfExtents.z,e.orientation.m00,e.orientation.m01,e.orientation.m02,e.orientation.m03,e.orientation.m04,e.orientation.m05,e.orientation.m06,e.orientation.m07,e.orientation.m08)},t.copy=function(t,e){return ir.copy(t.center,e.center),ir.copy(t.halfExtents,e.halfExtents),yr.copy(t.orientation,e.orientation),t},t.fromPoints=function(t,e,i){return ir.multiplyScalar(t.center,ir.add(Bh,e,i),.5),ir.multiplyScalar(t.halfExtents,ir.subtract(Ih,i,e),.5),yr.identity(t.orientation),t},t.set=function(t,e,i,n,r,s,a,o,h,u,l,c,f,_,d,p){return ir.set(t.center,e,i,n),ir.set(t.halfExtents,r,s,a),yr.set(t.orientation,o,h,u,l,c,f,_,d,p),t};var e=t.prototype;return e.getBoundary=function(t,e){Eh(Bh,this.halfExtents,this.orientation),ir.subtract(t,this.center,Bh),ir.add(e,this.center,Bh)},e.transform=function(t,e,i,n,r){ir.transformMat4(r.center,this.center,t),yr.fromQuat(r.orientation,i),ir.multiply(r.halfExtents,this.halfExtents,n)},e.translateAndRotate=function(t,e,i){ir.transformMat4(i.center,this.center,t),yr.fromQuat(i.orientation,e)},e.setScale=function(t,e){ir.multiply(e.halfExtents,this.halfExtents,t)},n(t,[{key:"type",get:function(){return this._type}}]),t}();function kh(t,e,i){void 0===i&&(i=1e-6);for(var n=0,r=t.length-1,s=r>>>1;n<=r;s=n+r>>>1){var a=t[s];if(a>e+i)r=s-1;else{if(!(a<e-i))return s;n=s+1}}return~n}bh=Symbol.iterator;var Rh=function(){function t(){this._times=[],this._values=[]}var e=t.prototype;return e[bh]=function(){var t=this,e=0;return{next:function(){if(e>=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,Fh(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 Fh(t){return t.every((function(t,e,i){return 0===e||t>i[e-1]||Zi(t,i[e-1],1e-6)}))}function Lh(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(Nh(c)){if(Nh(u))return r[0]=0,1;var _=Math.cbrt(-u);return r[0]=2*_,r[1]=-_,2}if(c<0){var d=1/3*Math.acos(-u/Math.sqrt(-l)),p=2*Math.sqrt(-h);r[0]=p*Math.cos(d),r[1]=-p*Math.cos(d+Math.PI/3),r[2]=-p*Math.cos(d-Math.PI/3),f=3}else{var m=Math.sqrt(c),g=Math.cbrt(m-u),y=-Math.cbrt(m+u);r[0]=g+y,f=1}for(var v=1/3*s,b=0;b<f;++b)r[b]-=v;return f}Vi.fastDefine("cc.KeyframeCurve",Rh,{_times:[],_values:[]}),t("cs",{LINEAR:0,CONSTANT:1,CUBIC:2}),t("ct",{LINEAR:0,CLAMP:1,LOOP:2,PING_PONG:3}),t("cu",{NONE:0,LEFT:1,RIGHT:2,BOTH:3});var Vh=1e-9;function Nh(t){return t>-1e-9&&t<Vh}function zh(t,e,i,n){return i.slice().reverse().reduce((function(i,n){return n(t,e,i)||i}),n)}var Uh=function(){},Gh=function(){return Uh},Hh=Wh((function(){}));function Wh(t){return function(e){return"function"==typeof e?t(e):function(i){return t(i,e)}}}function jh(t,e,i){var n=Yh(t);if(n){var r=Jh(n,"proto");Jh(r,"editor")[e]=i}}function qh(t){return function(e){return function(i){jh(i,t,e)}}}var Xh="__ccclassCache__";function Yh(t){return Jh(t,Xh)}function Jh(t,e){return t[e]||(t[e]={})}var Kh=Wh((function(t,e){var i=ee(t);i===Object&&(i=null);var n={name:e,extends:i,ctor:t},r=t[Xh];if(r){var s=r.proto;s&&$t(n,s),t[Xh]=void 0}return Vi(n)})),Qh=qh("requireComponent"),Zh=qh("executionOrder"),$h=Hh;function tu(t,e,i){var n=null;function r(t,e,i){au(nu(t),ru(t,e),t.constructor,e,n,i)}return void 0===t?tu({type:void 0}):void 0===e?(n=t,r):void r(t,e,i)}function eu(t){var e;try{e=t()}catch(e){return t}return"object"!=typeof e||null===e?e:t}function iu(t){var e;try{e=new t}catch(t){return{}}return e}function nu(t){return Yh(t.constructor)}function ru(t,e){var i,n,r=Jh(Yh(t.constructor),"proto"),s=Jh(r,"properties");return null!==(n=s[i=e])&&void 0!==n?n:s[i]={}}function su(t,e,i){var n,r,s=Yh(t.constructor),a=Jh(s,"proto"),o=Jh(a,"properties"),h=null!==(r=o[n=e])&&void 0!==r?r:o[n]={};return h.__internalFlags|=1,i&&"function"!=typeof i&&(i.get||i.set)?(i.get&&(h.get=i.get),i.set&&(h.set=i.set)):ou(s,h,t.constructor,e,i),h}function au(t,e,i,n,r,s){var a,o=s&&"function"!=typeof s&&(s.get||s.set);r&&(a=bi(r,o));var h=$t(e,a||r||{});o?(s.get&&(h.get=s.get),s.set&&(h.set=s.set)):ou(t,h,i,n,s)}function ou(t,e,i,n,r){if(void 0!==r)"function"==typeof r?e.default=eu(r):null===r||r.initializer&&(e.default=eu(r.initializer));else{var s=t.default||(t.default=iu(i));s.hasOwnProperty(n)&&(e.default=s[n])}}var hu=Symbol("cc:SerializationMetadata"),uu=t("cV",(function(t,e,i){fu(su(t,e,i))}));function lu(t){return function(e,i,n){var r=su(e,i,n);r.formerlySerializedAs=t,fu(r)}}var cu=function(t,e,i){var n=su(t,e,i);n.editorOnly=!0,fu(n)};function fu(t){t.__internalFlags|=4}var _u=Uh,du=Hh,pu=Gh,mu=Hh,gu=Gh,yu=Gh,vu=Gh,bu=t("cK",Uh),Su=t("cM",Gh),wu=t("cN",Gh),xu=t("cL",Gh),Tu=t("cP",Gh),Au=t("cQ",Gh),Cu=t("cR",Uh),Du=t("cO",Gh),Bu=t("cS",Uh),Iu=Ou(li),Mu=Ou(ci),Pu=Ou(fi),Eu=Ou(_i);function Ou(t){return tu({type:t})}var ku,Ru,Fu,Lu,Vu,Nu,zu,Uu,Gu=t("cT",(function(t,e,i){su(t,e,i).override=!0})),Hu=t("c4",(function(){})),Wu=Object.freeze({__proto__:null,boolean:Pu,ccclass:Kh,disallowAnimation:Bu,disallowMultiple:$h,displayName:wu,displayOrder:Du,editable:bu,executeInEditMode:du,executionOrder:Zh,float:Mu,formerlySerializedAs:lu,help:vu,icon:yu,inspector:gu,integer:Iu,menu:pu,override:Gu,playOnFocus:mu,property:tu,range:Tu,rangeStep:Au,requireComponent:Qh,serializable:uu,slide:Cu,string:Eu,tooltip:xu,type:Ou,uniquelyReferenced:_u,visible:Su});function ju(t,e){return(e<<3)+t}function qu(t){return Yu[t]}function Xu(t){switch(t){case 0:return Uint8Array;case 1:return Uint16Array;case 2:return Uint32Array;case 3:return Int8Array;case 4:return Int16Array;case 5:return Int32Array;case 6:return Float32Array;case 7:return Float64Array}}t("bS",Wu),t("b$",Kh("cc.CompactValueTypeArray")((zu=function(){function t(){this._byteOffset=Fu&&Fu(),this._unitCount=Lu&&Lu(),this._unitElement=Vu&&Vu(),this._length=Nu&&Nu()}return t.lengthFor=function(t,e,i){return qu(e).requiredUnits*t.length*Xu(i).BYTES_PER_ELEMENT},t.compress=function(e,i,n,r,s,a){for(var o=qu(i),h=Xu(n),u=o.requiredUnits*e.length,l=new h(r,s,u),c=0;c<e.length;++c)o.compress(l,c,e[c]);var f=new t;return f._unitElement=ju(n,i),f._byteOffset=a,f._unitCount=u,f._length=e.length,f},t.prototype.decompress=function(t){for(var e,i={storageUnit:7&(e=this._unitElement),elementType:e>>3},n=i.storageUnit,r=qu(i.elementType),s=new(Xu(n))(t,this._byteOffset,this._unitCount),a=new Array(this._length),o=0;o<this._length;++o)a[o]=r.decompress(s,o);return a},t}(),zu.StorageUnit={Uint8:0,Uint16:1,Uint32:2,Int8:3,Int16:4,Int32:5,Float32:6,Float64:7},zu.ElementType={Scalar:0,Vec2:1,Vec3:2,Vec4:3,Quat:4,Mat4:5},Fu=zh((Ru=zu).prototype,"_byteOffset",[uu],(function(){return 0})),Lu=zh(Ru.prototype,"_unitCount",[uu],(function(){return 0})),Vu=zh(Ru.prototype,"_unitElement",[uu],(function(){return ju(0,0)})),Nu=zh(Ru.prototype,"_length",[uu],(function(){return 0})),ku=Ru))||ku);var Yu=((Uu={})[0]={requiredUnits:1,compress:function(t,e,i){t[e]=i},decompress:function(t,e){return t[e]}},Uu[1]={requiredUnits:2,compress:function(t,e,i){t[2*e]=i.x,t[2*e+1]=i.y},decompress:function(t,e){return new ir(t[2*e],t[2*e+1])}},Uu[2]={requiredUnits:3,compress:function(t,e,i){t[3*e]=i.x,t[3*e+1]=i.y,t[3*e+2]=i.z},decompress:function(t,e){return new ir(t[3*e],t[3*e+1],t[3*e+2])}},Uu[3]={requiredUnits:4,compress:function(t,e,i){t[4*e]=i.x,t[4*e+1]=i.y,t[4*e+2]=i.z,t[4*e+3]=i.w},decompress:function(t,e){return new Vn(t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}},Uu[4]={requiredUnits:4,compress:function(t,e,i){t[4*e]=i.x,t[4*e+1]=i.y,t[4*e+2]=i.z,t[4*e+3]=i.w},decompress:function(t,e){return new kr(t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}},Uu[5]={requiredUnits:16,compress:function(t,e,i){Kr.toArray(t,i,16*e)},decompress:function(t,e){return Kr.fromArray(new Kr,t,16*e)}},Uu),Ju=t("c2",Symbol("[[Serialize]]")),Ku=t("c1",Symbol("[[Deserialize]]"));function Qu(){return 0}function Zu(t){return t}function $u(t){return t*t}function tl(t){return t*(2-t)}function el(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}function il(t){return t*t*t}function nl(t){return--t*t*t+1}function rl(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}function sl(t){return t*t*t*t}function al(t){return 1- --t*t*t*t}function ol(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}function hl(t){return t*t*t*t*t}function ul(t){return--t*t*t*t*t+1}function ll(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}function cl(t){return 1===t?1:1-Math.cos(t*Math.PI/2)}function fl(t){return Math.sin(t*Math.PI/2)}function _l(t){return.5*(1-Math.cos(Math.PI*t))}function dl(t){return 0===t?0:Math.pow(1024,t-1)}function pl(t){return 1===t?1:1-Math.pow(2,-10*t)}function ml(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}function gl(t){return 1-Math.sqrt(1-t*t)}function yl(t){return Math.sqrt(1- --t*t)}function vl(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}function bl(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),-i*Math.pow(2,10*(t-=1))*Math.sin(2*(t-e)*Math.PI/.4))}function Sl(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),i*Math.pow(2,-10*t)*Math.sin(2*(t-e)*Math.PI/.4)+1)}function wl(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),(t*=2)<1?i*Math.pow(2,10*(t-=1))*Math.sin(2*(t-e)*Math.PI/.4)*-.5:i*Math.pow(2,-10*(t-=1))*Math.sin(2*(t-e)*Math.PI/.4)*.5+1)}function xl(t){if(1===t)return 1;var e=1.70158;return t*t*((e+1)*t-e)}function Tl(t){if(0===t)return 0;var e=1.70158;return--t*t*((e+1)*t+e)+1}function Al(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}function Cl(t){return 1-Dl(1-t)}function Dl(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function Bl(t){return t<.5?.5*Cl(2*t):.5*Dl(2*t-1)+.5}function Il(t){return t<=0?0:t>=1?1:t*t*(3-2*t)}function Ml(t){return t<=0?0:t>=1?1:t*t*t*(t*(6*t-15)+10)}C._decorator=Wu;var Pl=Ul($u,tl),El=Ul(il,nl),Ol=Ul(sl,al),kl=Ul(hl,ul),Rl=Ul(cl,fl),Fl=Ul(dl,pl),Ll=Ul(gl,yl),Vl=Ul(bl,Sl),Nl=Ul(xl,Tl),zl=Ul(Cl,Dl);function Ul(t,e){return function(i){return i<.5?e(2*i)/2:t(2*i-1)/2+.5}}var Gl,Hl=Object.freeze({__proto__:null,backIn:xl,backInOut:Al,backOut:Tl,backOutIn:Nl,bounceIn:Cl,bounceInOut:Bl,bounceOut:Dl,bounceOutIn:zl,circIn:gl,circInOut:vl,circOut:yl,circOutIn:Ll,constant:Qu,cubicIn:il,cubicInOut:rl,cubicOut:nl,cubicOutIn:El,elasticIn:bl,elasticInOut:wl,elasticOut:Sl,elasticOutIn:Vl,expoIn:dl,expoInOut:ml,expoOut:pl,expoOutIn:Fl,fade:Ml,linear:Zu,quadIn:$u,quadInOut:el,quadOut:tl,quadOutIn:Pl,quartIn:sl,quartInOut:ol,quartOut:al,quartOutIn:Ol,quintIn:hl,quintInOut:ll,quintOut:ul,quintOutIn:kl,sineIn:cl,sineInOut:_l,sineOut:fl,sineOutIn:Rl,smooth:Il});t("cG",Hl),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 Wl,jl=((Gl={})[1]=Qu,Gl[0]=Zu,Gl[2]=$u,Gl[3]=tl,Gl[4]=el,Gl[5]=Pl,Gl[6]=il,Gl[7]=nl,Gl[8]=rl,Gl[9]=El,Gl[10]=sl,Gl[11]=al,Gl[12]=ol,Gl[13]=Ol,Gl[14]=hl,Gl[15]=ul,Gl[16]=ll,Gl[17]=kl,Gl[18]=cl,Gl[19]=fl,Gl[20]=_l,Gl[21]=Rl,Gl[22]=dl,Gl[23]=pl,Gl[24]=ml,Gl[25]=Fl,Gl[26]=gl,Gl[27]=yl,Gl[28]=vl,Gl[29]=Ll,Gl[30]=bl,Gl[31]=Sl,Gl[32]=wl,Gl[33]=Vl,Gl[34]=xl,Gl[35]=Tl,Gl[36]=Al,Gl[37]=Nl,Gl[38]=Cl,Gl[39]=Dl,Gl[40]=Bl,Gl[41]=zl,Gl[42]=Il,Gl[43]=Ml,Gl);function ql(t){return jl[t]}O(255),O(65280);var Xl,Yl,Jl,Kl=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}(Hu);function Ql(t){var e=new Kl;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[co];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[co]=l)}return e}Vi.fastDefine("cc.RealKeyframeValue",Kl,((Wl={interpolationMode:0,tangentWeightMode:0,value:0,rightTangent:0,rightTangentWeight:0,leftTangent:0,leftTangentWeight:0,easingMethod:0})[co]=void 0,Wl)),Vi.Attr.setClassAttr(Kl,co,"editorOnly",!0),(Xl=Kl,null!==(Jl=(Yl=Xl)[hu])&&void 0!==Jl?Jl:Yl[hu]={}).uniquelyReferenced=!0;var Zl=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(t<r){var a=this.preExtrapolation,o=i[0];if(1===a||n<2)return o.value;switch(a){case 0:return Tc(r,i[0].value,e[1],i[1].value,t);case 2:t=wc(t,r,s);break;case 3:t=xc(t,r,s);break;default:return o.value}}else if(t>s){var h=this.postExtrapolation,u=i[n-1];if(1===h||n<2)return u.value;switch(h){case 0:return Tc(s,u.value,e[n-2],i[n-2].value,t);case 2:t=wc(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,_=e[f],d=i[f],p=e[c];return Ac(_,d,p,i[c],(t-_)/(p-_))},i.addKeyFrame=function(e,i){return t.prototype.addKeyFrame.call(this,e,Ql(i))},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return Ql(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return Ql(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[Ju]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=i.length,s=new DataView(new ArrayBuffer(0+ec+ec+ic+nc*r+vc*r)),a=0;s.setUint8(a,this.preExtrapolation),a+=ec,s.setUint8(a,this.postExtrapolation),a+=ec,s.setUint32(a,r,!0),a+=ic,i.forEach((function(t,e){return s.setFloat32(a+nc*e,t,!0)})),a+=nc*r;for(var o,h=p(n);!(o=h()).done;){var u=o.value;a=bc(s,u,a)}var l=new Uint8Array(s.buffer,0,a);t.writeProperty("bytes",l);var c=n.map((function(t){return t[co]}));c.some((function(t){return void 0!==t}))&&t.writeProperty("keyframeValueEditorExtras",c)}else t.writeThis()},i[Ku]=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+=ec,this.postExtrapolation=n.getUint8(r),r+=ec;var s=n.getUint32(r,!0);r+=ic;var a=Array.from({length:s},(function(t,e){return n.getFloat32(r+nc*e,!0)}));r+=nc*s;for(var o=new Array(s),h=0;h<s;++h){var u=Ql({});r=Sc(n,u,r),o[h]=u}i.byteLength;var l=t.readProperty("keyframeValueEditorExtras");l&&(l.length,l.forEach((function(t,e){return o[e][co]=t}))),this._times=a,this._values=o}else t.readThis()},e}(Rh));Vi.fastDefine("cc.RealCurve",Zl,{_times:[],_values:[],preExtrapolation:1,postExtrapolation:1});var $l=8,tc=255<<$l,ec=1,ic=4,nc=4,rc=4,sc=4,ac=1,oc=1,hc=4,uc=4,lc=4,cc=4,fc=Ql({}),_c=fc.interpolationMode,dc=fc.tangentWeightMode,pc=fc.leftTangent,mc=fc.leftTangentWeight,gc=fc.rightTangent,yc=fc.rightTangentWeight,vc=rc+sc+ac+oc+hc+uc+lc+cc+0;function bc(t,e,i){var n=0,r=i,s=r;r+=rc;var a=e.value,o=e.interpolationMode,h=e.tangentWeightMode,u=e.rightTangent,l=e.rightTangentWeight,c=e.leftTangent,f=e.leftTangentWeight,_=e.easingMethod;return t.setFloat32(r,a,!0),r+=sc,o!==_c&&(n|=2,t.setUint8(r,o),r+=ac),h!==dc&&(n|=4,t.setUint8(r,h),r+=oc),c!==pc&&(n|=8,t.setFloat32(r,c,!0),r+=hc),f!==mc&&(n|=16,t.setFloat32(r,f,!0),r+=uc),u!==gc&&(n|=32,t.setFloat32(r,u,!0),r+=lc),l!==yc&&(n|=64,t.setFloat32(r,l,!0),r+=cc),n|=_<<$l,t.setUint32(s,n,!0),r}function Sc(t,e,i){var n=i,r=t.getUint32(n,!0);n+=rc,e.value=t.getFloat32(n,!0),n+=sc,2&r&&(e.interpolationMode=t.getUint8(n),n+=ac),4&r&&(e.tangentWeightMode=t.getUint8(n),n+=oc),8&r&&(e.leftTangent=t.getFloat32(n,!0),n+=hc),16&r&&(e.leftTangentWeight=t.getFloat32(n,!0),n+=uc),32&r&&(e.rightTangent=t.getFloat32(n,!0),n+=lc),64&r&&(e.rightTangentWeight=t.getFloat32(n,!0),n+=cc);var s=(r&tc)>>$l;return e.easingMethod=s,n}function wc(t,e,i){return e+_n(t-e,i-e)}function xc(t,e,i){return e+dn(t-e,i-e)}function Tc(t,e,i,n,r){return e+(n-e)/(i-t)*(r-t)}function Ac(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:ql(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,_=!!(1&n.tangentWeightMode);if(l||_){var d=0;if(l)d=u;else{var p=s,m=s*h;d=Math.sqrt(p*p+m*m)*o}var g=Math.atan(h),y=Math.cos(g)*d+t,v=Math.sin(g)*d+e.value,b=0;if(_)b=f;else{var S=s,w=s*c;b=Math.sqrt(S*S+w*w)*o}var x=Math.atan(c),T=(y-t)/s,A=(-Math.cos(x)*b+i-t)/s,C=v,D=-Math.sin(x)*b+n.value,B=[0,0,0],I=Dc(B,Lh(0-r,3*T,3*A-6*T,3*(T-A)+1,B),r);return Cc(e.value,C,D,n.value,I)}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 Dc(t,e,i){var n=i;if(1===e)n=t[0];else{n=-1/0;for(var r=0;r<e;++r){var s=t[r];s>=0&&s<=1&&s>n&&(n=s)}n===-1/0&&(n=0)}return n}function Bc(t,e,i,n,r){var s=1-r;return s*(s*(t+(3*e-t)*r)+3*i*r*r)+n*r*r*r}C.bezier=Bc;var Ic,Mc,Pc,Ec,Oc,kc,Rc,Fc,Lc,Vc=Math.cos,Nc=Math.acos,zc=Math.max,Uc=2*Math.PI,Gc=Math.sqrt;function Hc(t){return t<0?-Math.pow(-t,1/3):Math.pow(t,1/3)}function Wc(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,_=(h-6*o+l)*c,d=_*f,p=(-h+u)*c,m=(3*p-_*_)*f,g=m*f,y=(2*_*_*_-9*_*p+a*c*27)/27,v=y/2,b=v*v+g*g*g;if(b<0){var S=-m*f,w=Gc(S*S*S),x=-y/(2*w),T=Nc(x<-1?-1:x>1?1:x),A=2*Hc(w);return n=A*Vc(T*f)-d,r=A*Vc((T+Uc)*f)-d,s=A*Vc((T+2*Uc)*f)-d,n>=0&&n<=1?r>=0&&r<=1?s>=0&&s<=1?zc(n,r,s):zc(n,r):s>=0&&s<=1?zc(n,s):n:r>=0&&r<=1?s>=0&&s<=1?zc(r,s):r:s}if(0===b)return r=-(i=v<0?Hc(-v):-Hc(v))-d,(n=2*i-d)>=0&&n<=1?r>=0&&r<=1?zc(n,r):n:r;var C=Gc(b);return(i=Hc(-v+C))-Hc(v+C)-d}function jc(t,e){var i=Wc(t,e),n=t[1];return((1-i)*(n+(t[3]-n)*i)*3+i*i)*i}C.bezierByTime=jc,t("cw",{SLERP:0,CONSTANT:1});var qc=Kh("cc.QuatKeyframeValue")(Ic=_u((Mc=function(t){var e=void 0===t?{}:t,i=e.value,n=e.interpolationMode,r=e.easingMethod;this.interpolationMode=Pc&&Pc(),this.value=Ec&&Ec(),this.easingMethod=Oc&&Oc(),this.value=i?kr.clone(i):this.value,this.interpolationMode=null!=n?n:this.interpolationMode,this.easingMethod=null!=r?r:this.easingMethod},Pc=zh(Mc.prototype,"interpolationMode",[uu],(function(){return 0})),Ec=zh(Mc.prototype,"value",[uu],(function(){return kr.clone(kr.IDENTITY)})),Oc=zh(Mc.prototype,"easingMethod",[uu],(function(){return 0})),Ic=Mc))||Ic)||Ic;function Xc(t){return new qc(t)}var Yc,Jc=t("cv",Kh("cc.QuatCurve")((Rc=function(t){function e(){var e;return(e=t.call(this)||this).preExtrapolation=Fc&&Fc(),e.postExtrapolation=Lc&&Lc(),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(t<h){var l=r[0];switch(a){case 2:t=h+_n(t-h,u-h);break;case 3:t=h+dn(t-h,u-h);break;default:return kr.copy(e,l.value)}}else if(t>u){var c=r[o-1];switch(s){case 2:t=h+_n(t-h,u-h);break;case 3:t=h+dn(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 _=~f,d=_-1,p=n[d],m=r[d],g=n[_],y=r[_],v=(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?v:Array.isArray(b)?jc(b,v):ql(b)(v);return kr.slerp(e,m.value,y.value,S)}},i.addKeyFrame=function(e,i){var n=new qc(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 Xc(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return Xc(t[1])})))}},i[Ju]=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=tf*(r?1:s),o=n.reduce((function(t,e){var i=e.easingMethod;return t+(Array.isArray(i)?ef+4*rf:ef)}),0),h=0,u=new DataView(new ArrayBuffer(h+=Kc+Qc+Zc*s+4*$c*s+o+a+0)),l=0,c=0;r&&(c|=1),u.setUint32(l,c,!0),l+=Kc,u.setUint32(l,s,!0),l+=Qc,i.forEach((function(t,e){return u.setFloat32(l+Zc*e,t,!0)})),l+=Zc*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*$c*e;u.setFloat32(o+0*$c,n,!0),u.setFloat32(o+1*$c,r,!0),u.setFloat32(o+2*$c,s,!0),u.setFloat32(o+3*$c,a,!0)})),l+=4*$c*s,n.forEach((function(t){var e=t.easingMethod;Array.isArray(e)?(u.setUint8(l,nf),++l,u.setFloat32(l+0*rf,e[0],!0),u.setFloat32(l+1*rf,e[1],!0),u.setFloat32(l+2*rf,e[2],!0),u.setFloat32(l+3*rf,e[3],!0),l+=4*rf):(u.setUint8(l,e),++l)}));var f=l;l+=a;var _=f;n.forEach((function(t){var e=t.interpolationMode;u.setUint8(_,e),r||(_+=tf)}));var d=new Uint8Array(u.buffer);t.writeProperty("bytes",d)}else t.writeThis()},i[Ku]=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+=Kc;var a=1&s,o=n.getUint32(r,!0);r+=Qc;var h=Array.from({length:o},(function(t,e){return n.getFloat32(r+Zc*e,!0)})),u=r+=Zc*o;r+=4*$c*o;var l=Array.from({length:o},(function(t,e){var i=u+4*$c*e,s=n.getFloat32(i+0*$c,!0),a=n.getFloat32(i+1*$c,!0),o=n.getFloat32(i+2*$c,!0),h=n.getFloat32(i+3*$c,!0),l=n.getUint8(r);++r;var c=Xc({value:{x:s,y:a,z:o,w:h}});return l!==nf?c.easingMethod=l:(c.easingMethod=[n.getFloat32(r+0*rf,!0),n.getFloat32(r+1*rf,!0),n.getFloat32(r+2*rf,!0),n.getFloat32(r+3*rf,!0)],r+=4*rf),c}));if(a){var c=n.getUint8(r);++r;for(var f=0;f<o;++f)l[f].interpolationMode=c}else{for(var _=0;_<o;++_){var d=n.getUint8(r+_);l[_].interpolationMode=d}r+=o}this._times=h,this._values=l}else t.readThis()},e}(Rh),Fc=zh(Rc.prototype,"preExtrapolation",[uu],(function(){return 1})),Lc=zh(Rc.prototype,"postExtrapolation",[uu],(function(){return 1})),kc=Rc))||kc),Kc=1,Qc=4,Zc=4,$c=4,tf=1,ef=1,nf=255,rf=4,sf=t("cx",Kh("cc.ObjectCurve")(Yc=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.evaluate=function(t){var e=this.searchKeyframe(t);if(e>=0)return this._values[e];var i=$i(~e-1,0,this._values.length-1);return this._values[i]},e}(Rh))||Yc),af={Blend:0,Fixed:1};Ee(af);var of=t("cy",(function(){this.color=cr.WHITE.clone(),this.time=0}));Vi.fastDefine("cc.ColorKey",of,{color:cr.WHITE.clone(),time:0}),Vi.Attr.setClassAttr(of,"color","visible",!0),Vi.Attr.setClassAttr(of,"time","visible",!0);var hf=t("cz",(function(){this.alpha=1,this.time=0}));Vi.fastDefine("cc.AlphaKey",hf,{alpha:1,time:0}),Vi.Attr.setClassAttr(hf,"alpha","visible",!0),Vi.Attr.setClassAttr(hf,"time","visible",!0);var uf=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=_n(e,1+Ki);for(var r=1;r<n;++r){var s=i[r-1].time,a=i[r].time;if(e>=s&&e<a){if(1===this.mode)return cr.copy(t,i[r].color),t;var o=(e-s)/(a-s);return cr.lerp(t,i[r-1].color,i[r].color,o),t}}var h=n-1;Zi(e,i[h].time,Ki)?cr.copy(t,i[h].color):e<i[0].time?cr.lerp(t,cr.BLACK,i[0].color,e/i[0].time):e>i[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=_n(t,1+Ki);for(var n=1;n<i;++n){var r=e[n-1].time,s=e[n].time;if(t>=r&&t<s){if(1===this.mode)return e[n].alpha;var a=(t-r)/(s-r);return en(e[n-1].alpha,e[n].alpha,a)}}var o=i-1;return Zi(t,e[o].time,Ki)?e[o].alpha:t<e[0].time?en(0,e[0].alpha,t/e[0].time):t>e[o].time?en(e[o].alpha,0,(t-e[o].time)/(1-e[o].time)):255}return 1===i?e[0].alpha:255},t}());uf.Mode=af,Vi.fastDefine("cc.Gradient",uf,{colorKeys:[],alphaKeys:[],mode:0}),Vi.Attr.setClassAttr(uf,"colorKeys","visible",!0),Vi.Attr.setClassAttr(uf,"alphaKeys","visible",!0),Vi.Attr.setClassAttr(uf,"mode","visible",!0);var lf=function(){this.time=0,this.value=0,this.inTangent=0,this.outTangent=0};Vi.fastDefine("cc.Keyframe",lf,{time:0,value:0,inTangent:0,outTangent:0});var cf=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 ff(t-this.time,this.coefficient)},t}();function ff(t,e){return t*(t*(t*e[0]+e[1])+e[2])+e[3]}var _f=function(){function t(t){if(void 0===t&&(t=null),this._curve=void 0,this.cachedKey=void 0,t instanceof Zl)this._curve=t;else{var e=new Zl;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 cf}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=_n(t-a,o-a)+a;break;case 3:r=dn(t-a,o-a)+a;break;default:r=$i(t,a,o)}if(r>=e.time&&r<e.endTime)return e.evaluate(r);var h=this.findIndex(e,r),u=Math.min(h+1,n);return this.calcOptimizedKey(e,h,u),e.evaluate(r)},e.calcOptimizedKey=function(t,e,i){var n=this._curve.getKeyframeTime(e),r=this._curve.getKeyframeTime(i),s=this._curve.getKeyframeValue(e),a=s.value,o=s.leftTangent,h=this._curve.getKeyframeValue(i),u=h.value,l=h.rightTangent;t.index=e,t.time=n,t.endTime=r;var c=r-n,f=u-a,_=1/(c*c),d=o*c,p=l*c;t.coefficient[0]=(d+p-f-f)*_/c,t.coefficient[1]=(f+f+f-d-d-p)*_,t.coefficient[2]=o,t.coefficient[3]=a},e.findIndex=function(t,e){var i=this._curve,n=i.keyFramesCount,r=t.index;if(-1!==r)if(e>i.getKeyframeTime(r))for(var s=0;s<3;s++){var a=r+s;if(a+1<n&&i.getKeyframeTime(a+1)>e)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 lf;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 pf(this._curve.preExtrapolation)},set:function(t){this._curve.preExtrapolation=df(t)}},{key:"postWrapMode",get:function(){return pf(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 pf(t){switch(t){default:case 0:case 1:return 8;case 3:return 22;case 2:return 2}}function mf(){var t=new Zl;return t.assignSorted([[0,{interpolationMode:2,value:1}],[1,{interpolationMode:2,value:1}]]),t}_f.defaultKF=[{time:0,value:1,inTangent:0,outTangent:0},{time:1,value:1,inTangent:0,outTangent:0}],Vi.fastDefine("cc.AnimationCurve",_f,{_curve:null});var gf=ir.multiplyScalar,yf=ir.add,vf=4294967295,bf=nr(),Sf=nr(),wf=nr(),xf=nr(),Tf=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<e.length;i++)this._knots[i]=nr(e[i])}t.create=function(e,i){return void 0===i&&(i=[]),new t(e,i)},t.clone=function(e){return new t(e.mode,e.knots)},t.copy=function(t,e){t._mode=e.mode,t._knots.length=0;for(var i=e.knots,n=i.length,r=0;r<n;r++)t._knots[r]=nr(i[r]);return t};var e=t.prototype;return e.setModeAndKnots=function(t,e){this._mode=t,this._knots.length=0;for(var i=0;i<e.length;i++)this._knots[i]=nr(e[i])},e.clearKnots=function(){this._knots.length=0},e.getKnotCount=function(){return this._knots.length},e.addKnot=function(t){this._knots.push(nr(t))},e.insertKnot=function(t,e){var i=nr(e);t>=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+2<s.length?s[i+2]:s[i+1];return t.calcCatmullRom(o,s[i],s[i+1],h,e);default:return nr()}},e.getPoints=function(t,e){if(void 0===e&&(e=vf),0===t)return[];if(1===t)return[this.getPoint(0,e)];for(var i=[],n=1/(t-1),r=0;r<t;r++){var s=r*n,a=this.getPoint(s,e);i.push(a)}return i},e.getSegments=function(){var t=this._knots.length;switch(this._mode){case 0:case 2:return t<2?(at(14300),0):t-1;case 1:return t<4||t%4!=0?(at(14301),0):t/4;default:return lt(!1,16407),0}},t.calcLinear=function(t,e,i){var n=new ir;return gf(bf,t,1-i),gf(Sf,e,i),yf(n,bf,Sf),n},t.calcBezier=function(t,e,i,n,r){var s=new ir,a=1-r;return gf(bf,t,a*a*a),gf(Sf,e,3*r*a*a),gf(wf,i,3*r*r*a),gf(xf,n,r*r*r),yf(bf,bf,Sf),yf(wf,wf,xf),yf(s,bf,wf),s},t.calcCatmullRom=function(t,e,i,n,r){var s=new ir,a=r*r,o=a*r;return gf(bf,t,-.5*o+a-.5*r),gf(Sf,e,1.5*o-2.5*a+1),gf(wf,i,-1.5*o+2*a+.5*r),gf(xf,n,.5*o-.5*a),yf(bf,bf,Sf),yf(wf,wf,xf),yf(s,bf,wf),s},n(t,[{key:"type",get:function(){return this._type}},{key:"mode",get:function(){return this._mode}},{key:"knots",get:function(){return this._knots}}]),t}();function Af(t,e){Y(t+" is deprecated, please use "+e+" instead.")}pt(Za,"intersect",[{name:"ray_aabb",newName:"rayAABB"},{name:"ray_plane",newName:"rayPlane"},{name:"ray_triangle",newName:"rayTriangle"},{name:"ray_sphere",newName:"raySphere"},{name:"ray_obb",newName:"rayOBB"},{name:"ray_capsule",newName:"rayCapsule"},{name:"ray_subMesh",newName:"raySubMesh"},{name:"ray_mesh",newName:"rayMesh"},{name:"ray_model",newName:"rayModel"},{name:"line_plane",newName:"linePlane"},{name:"line_triangle",newName:"lineTriangle"},{name:"line_aabb",newName:"lineAABB"},{name:"line_obb",newName:"lineOBB"},{name:"line_sphere",newName:"lineSphere"},{name:"aabb_aabb",newName:"aabbWithAABB"},{name:"aabb_obb",newName:"aabbWithOBB"},{name:"aabb_plane",newName:"aabbPlane"},{name:"aabb_frustum",newName:"aabbFrustum"},{name:"aabbFrustum_accurate",newName:"aabbFrustumAccurate"},{name:"obb_point",newName:"obbPoint"},{name:"obb_plane",newName:"obbPlane"},{name:"obb_frustum",newName:"obbFrustum"},{name:"obbFrustum_accurate",newName:"obbFrustumAccurate"},{name:"obb_obb",newName:"obbWithOBB"},{name:"obb_capsule",newName:"obbCapsule"},{name:"sphere_plane",newName:"spherePlane"},{name:"sphere_frustum",newName:"sphereFrustum"},{name:"sphereFrustum_accurate",newName:"sphereFrustumAccurate"},{name:"sphere_sphere",newName:"sphereWithSphere"},{name:"sphere_aabb",newName:"sphereAABB"},{name:"sphere_obb",newName:"sphereOBB"},{name:"sphere_capsule",newName:"sphereCapsule"},{name:"capsule_capsule",newName:"capsuleWithCapsule"}]);var Cf=function(t){function e(){var e;return e=t.call(this)||this,Af("line","Line"),e}return s(e,t),e}(Ls),Df=function(t){function e(){var e;return e=t.call(this)||this,Af("plane","Plane"),e}return s(e,t),e}(no),Bf=function(t){function e(){var e;return e=t.call(this)||this,Af("ray","Ray"),e}return s(e,t),e}(Vs),If=function(t){function e(){var e;return e=t.call(this)||this,Af("triangle","Triangle"),e}return s(e,t),e}(ro),Mf=function(t){function e(){var e;return e=t.call(this)||this,Af("sphere","Sphere"),e}return s(e,t),e}(Js),Pf=function(t){function e(){var e;return e=t.call(this)||this,Af("aabb","AABB"),e}return s(e,t),e}(gh),Ef=function(t){function e(){var e;return e=t.call(this)||this,Af("obb","OBB"),e}return s(e,t),e}(Oh),Of=function(t){function e(){var e;return e=t.call(this)||this,Af("capsule","Capsule"),e}return s(e,t),e}(yh),kf=function(t){function e(){var e;return e=t.call(this)||this,Af("frustum","Frustum"),e}return s(e,t),e}(Dh),Rf=Object.freeze({__proto__:null,AABB:gh,AnimationCurve:_f,Capsule:yh,ERaycastMode:{ALL:0,CLOSEST:1,ANY:2},Frustum:Dh,Keyframe:lf,Line:Ls,OBB:Oh,OptimizedKey:cf,Plane:no,Ray:Vs,Sphere:Js,Spline:Tf,SplineMode:{LINEAR:0,BEZIER:1,CATMULL_ROM:2},Triangle:ro,WrapModeMask:{Default:0,Normal:1,Loop:2,ShouldWrap:4,Clamp:8,PingPong:22,Reverse:36},aabb:Pf,capsule:Of,constructLegacyCurveAndConvert:mf,distance:Fs,enums:{SHAPE_RAY:1,SHAPE_LINE:2,SHAPE_SPHERE:4,SHAPE_AABB:8,SHAPE_OBB:16,SHAPE_PLANE:32,SHAPE_TRIANGLE:64,SHAPE_FRUSTUM:128,SHAPE_FRUSTUM_ACCURATE:256,SHAPE_CAPSULE:512,SHAPE_SPLINE:1024},evalOptCurve:ff,frustum:kf,intersect:Za,line:Cf,obb:Ef,plane:Df,ray:Bf,sphere:Mf,triangle:If});t("aM",Rf),t("cE",{LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:2147483648});var Ff=t("cF",function(){function t(){this._id="",this._priority=0,this._executeInEditMode=!1}t.sortByPriority=function(t,e){return t._priority<e._priority?1:t._priority>e.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}());Ff.Priority=Ee({LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:2147483648});var Lf=new It("Scheduler"),Vf=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}();Vf._listEntries=[];var Nf=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}();Nf._hashUpdateEntries=[];var zf=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}();zf._hashTimerEntries=[];var Uf=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===C.macro.REPEAT_FOREVER,!0},e.getInterval=function(){return this._interval},e.setInterval=function(t){this._interval=t},e.update=function(t){-1===this._elapsed?(this._elapsed=0,this._timesExecuted=0):(this._elapsed+=t,this._runForever&&!this._useDelay?this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0):(this._useDelay?this._elapsed>=this._delay&&(this.trigger(),this._elapsed-=this._delay,this._timesExecuted+=1,this._useDelay=!1):this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0,this._timesExecuted+=1),this._callback&&!this._runForever&&this._timesExecuted>this._repeat&&this.cancel()))},e.getCallback=function(){return this._callback},e.trigger=function(){this._target&&this._callback&&(this._lock=!0,this._callback.call(this._target,this._elapsed),this._lock=!1)},e.cancel=function(){this._scheduler&&this._callback&&this._target&&this._scheduler.unscheduleForTimer(this,this._target)},t}();Uf._timers=[];var Gf=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=Lf.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<n;e++)(r=i[e]).paused||r.markedForDeletion||!r.target||null==r.target.update||r.target.update(t);for(e=0,n=(i=this._updates0List).length;e<n;e++)(r=i[e]).paused||r.markedForDeletion||!r.target||null==r.target.update||r.target.update(t);for(e=0,n=(i=this._updatesPosList).length;e<n;e++)(r=i[e]).paused||r.markedForDeletion||!r.target||null==r.target.update||r.target.update(t);var a=this._arrayForTimers;for(e=0;e<a.length;e++){var o;if(s=a[e],this._currentTarget=s,this._currentTargetSalvaged=!1,!s.paused&&s.timers)for(s.timerIndex=0;s.timerIndex<s.timers.length;++s.timerIndex)s.currentTimer=s.timers[s.timerIndex],s.currentTimerSalvaged=!1,s.currentTimer.update(t),s.currentTimer=null;this._currentTargetSalvaged&&0===(null==(o=this._currentTarget.timers)?void 0:o.length)&&(this._removeHashElement(this._currentTarget),--e)}for(e=0,i=this._updatesNegList;e<i.length;)(r=i[e]).markedForDeletion?this._removeUpdateFromHash(r):e++;for(e=0,i=this._updates0List;e<i.length;)(r=i[e]).markedForDeletion?this._removeUpdateFromHash(r):e++;for(e=0,i=this._updatesPosList;e<i.length;)(r=i[e]).markedForDeletion?this._removeUpdateFromHash(r):e++;this._updateHashLocked=!1,this._currentTarget=null},i.schedule=function(t,e,i,n,r,s){var a,o,h,u;"function"!=typeof t?(at(1514),h=e,u=t):(h=t,u=e),3!==arguments.length&&4!==arguments.length&&5!==arguments.length||(s=!!n,n=C.macro.REPEAT_FOREVER,r=0),lt(Boolean(u),1502);var l=u.uuid||u.id;if(l){var c,f,_=this._hashForTimers[l];if(_?_.paused!==s&&at(1511):(_=zf.get(null,u,0,null,!1,Boolean(s)),this._arrayForTimers.push(_),this._hashForTimers[l]=_),null==_.timers)_.timers=[];else for(f=0;f<_.timers.length;++f)if((c=_.timers[f])&&h===c.getCallback())return it(1507,c.getInterval(),i),void c.setInterval(i);(c=Uf.get()).initWithCallback(this,h,u,i,null!==(a=n)&&void 0!==a?a:0,null!==(o=r)&&void 0!==o?o:0),_.timers.push(c),this._currentTarget===_&&this._currentTargetSalvaged&&(this._currentTargetSalvaged=!1)}else ht(1510)},i.scheduleUpdate=function(t,e,i){var n=t.uuid||t.id;if(n){var r=this._hashForUpdates[n];if(r&&r.entry){if(r.entry.priority===e)return r.entry.markedForDeletion=!1,void(r.entry.paused=i);if(this._updateHashLocked)return it(1506),r.entry.markedForDeletion=!1,void(r.entry.paused=i);this.unscheduleUpdate(t)}var s,a=Vf.get(t,e,i,!1);0===e?(s=this._updates0List,this._appendIn(s,a)):(s=e<0?this._updatesNegList:this._updatesPosList,this._priorityIn(s,a,e)),this._hashForUpdates[n]=Nf.get(s,a,t,null)}else ht(1510)},i.unschedule=function(t,e){if(e&&t){var i=e.uuid||e.id;if(i){var n=this._hashForTimers[i];if(n){var r=n.timers;if(!r)return;for(var s=0,a=r.length;s<a;s++){var o=r[s];if(t===o.getCallback())return o!==n.currentTimer||n.currentTimerSalvaged||(n.currentTimerSalvaged=!0),r.splice(s,1),Uf.put(o),n.timerIndex>=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),Uf.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<s;r++)Uf.put(n[r]);n.length=0,this._currentTarget===i?this._currentTargetSalvaged=!0:this._removeHashElement(i)}this.unscheduleUpdate(t)}else ht(1510)}},i.unscheduleAll=function(){this.unscheduleAllWithMinPriority(2147483648)},i.unscheduleAllWithMinPriority=function(t){var e,i,n,r=this._arrayForTimers;for(e=r.length-1;e>=0;e--)(i=r[e]).target&&this.unscheduleAllForTarget(i.target);var s=0;if(t<0)for(e=0;e<this._updatesNegList.length;){var a;s=this._updatesNegList.length,null!=(a=n=this._updatesNegList[e])&&a.target&&n.priority>=t&&this.unscheduleUpdate(n.target),s===this._updatesNegList.length&&e++}if(t<=0)for(e=0;e<this._updates0List.length;){var o;s=this._updates0List.length,null!=(o=n=this._updates0List[e])&&o.target&&this.unscheduleUpdate(n.target),s===this._updates0List.length&&e++}for(e=0;e<this._updatesPosList.length;){var h;s=this._updatesPosList.length,null!=(h=n=this._updatesPosList[e])&&h.target&&n.priority>=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<r.length;++s)if(t===r[s].getCallback())return!0;return!1},i.pauseAllTargets=function(){return this.pauseAllTargetsWithMinPriority(2147483648)},i.pauseAllTargetsWithMinPriority=function(t){var e,i,n,r,s=[],a=this._arrayForTimers;for(i=0,n=a.length;i<n;i++){var o;null!=(o=e=a[i])&&o.target&&(e.paused=!0,s.push(e.target))}if(t<0)for(i=0;i<this._updatesNegList.length;i++){var h;null!=(h=r=this._updatesNegList[i])&&h.target&&r.priority>=t&&(r.paused=!0,s.push(r.target))}if(t<=0)for(i=0;i<this._updates0List.length;i++){var u;null!=(u=r=this._updates0List[i])&&u.target&&(r.paused=!0,s.push(r.target))}for(i=0;i<this._updatesPosList.length;i++){var l;null!=(l=r=this._updatesPosList[i])&&l.target&&r.priority>=t&&(r.paused=!0,s.push(r.target))}return s},i.resumeTargets=function(t){if(t)for(var e=0;e<t.length;e++)this.resumeTarget(t[e])},i.pauseTarget=function(t){lt(Boolean(t),1503);var e=t.uuid||t.id;if(e){var i=this._hashForTimers[e];i&&(i.paused=!0);var n=this._hashForUpdates[e];null!=n&&n.entry&&(n.entry.paused=!0)}else ht(1510)},i.resumeTarget=function(t){lt(Boolean(t),1504);var e=t.uuid||t.id;if(e){var i=this._hashForTimers[e];i&&(i.paused=!1);var n=this._hashForUpdates[e];null!=n&&n.entry&&(n.entry.paused=!1)}else ht(1510)},i.isTargetPaused=function(t){lt(Boolean(t),1505);var e=t.uuid||t.id;if(!e)return ht(1510),!1;var i=this._hashForTimers[e];if(i)return i.paused;var n=this._hashForUpdates[e];return!(null==n||!n.entry)&&n.entry.paused},i._removeHashElement=function(t){if(t.target){var e=t.target.uuid||t.target.id;if(void 0!==e){delete this._hashForTimers[e];for(var i=this._arrayForTimers,n=0,r=i.length;n<r;n++)if(i[n]===t){i.splice(n,1);break}zf.put(t)}}},i._removeUpdateFromHash=function(t){if(t.target){var e=t.target.uuid||t.target.id;if(void 0!==e){var i=this._hashForUpdates[e];if(i){var n=i.list,r=i.entry;if(n)for(var s=0,a=n.length;s<a;s++)if(n[s]===r){n.splice(s,1);break}delete this._hashForUpdates[e],r&&Vf.put(r),Nf.put(i)}}}},i._priorityIn=function(t,e,i){for(var n=0;n<t.length;n++)if(i<t[n].priority)return void t.splice(n,0,e);t.push(e)},i._appendIn=function(t,e){t.push(e)},e}(Ff));Gf.ID="scheduler",C.Scheduler=Gf;var Hf={};pt(Hf,"vmath",[{name:"vec2",newName:"Vec2",target:Ts,targetName:"math"},{name:"vec3",newName:"Vec3",target:Ts,targetName:"math"},{name:"vec4",newName:"Vec4",target:Ts,targetName:"math"},{name:"quat",newName:"Quat",target:Ts,targetName:"math"},{name:"mat3",newName:"Mat3",target:Ts,targetName:"math"},{name:"mat4",newName:"Mat4",target:Ts,targetName:"math"},{name:"color4",newName:"Color",target:Ts,targetName:"math"},{name:"rect",newName:"Rect",target:Ts,targetName:"math"},{name:"approx",newName:"approx",target:Ts,targetName:"math"},{name:"EPSILON",newName:"EPSILON",target:Ts,targetName:"math"},{name:"equals",newName:"equals",target:Ts,targetName:"math"},{name:"clamp",newName:"clamp",target:Ts,targetName:"math"},{name:"clamp01",newName:"clamp01",target:Ts,targetName:"math"},{name:"lerp",newName:"lerp",target:Ts,targetName:"math"},{name:"toRadian",newName:"toRadian",target:Ts,targetName:"math"},{name:"toDegree",newName:"toDegree",target:Ts,targetName:"math"},{name:"random",newName:"random",target:Ts,targetName:"math"},{name:"randomRange",newName:"randomRange",target:Ts,targetName:"math"},{name:"randomRangeInt",newName:"randomRangeInt",target:Ts,targetName:"math"},{name:"pseudoRandom",newName:"pseudoRandom",target:Ts,targetName:"math"},{name:"pseudoRandomRangeInt",newName:"pseudoRandomRangeInt",target:Ts,targetName:"math"},{name:"nextPow2",newName:"nextPow2",target:Ts,targetName:"math"},{name:"repeat",newName:"repeat",target:Ts,targetName:"math"},{name:"pingPong",newName:"pingPong",target:Ts,targetName:"math"},{name:"inverseLerp",newName:"inverseLerp",target:Ts,targetName:"math"}]),C.vmath=Hf,pt(Gf.prototype,"Scheduler.prototype",[{name:"enableForTarget",newName:"enableForTarget",target:Gf,targetName:"Scheduler"}]),pt(Gf,"Scheduler",[{name:"PRIORITY_SYSTEM",newName:"System.Priority.SCHEDULER",customGetter:function(){return 2147483648}}]),mt(Gf,"Scheduler",[{name:"PRIORITY_NON_SYSTEM",suggest:"Use enum` System.Priority` instead"}]),gt(Be,"js",[{name:"js",suggest:"'js.js' is deprecated since v3.7.0, please access 'js' directly instead."}]);var Wf=String.prototype.charCodeAt;function jf(t){return this[t]}function qf(t,e){for(var i=t.length,n=e^i,r=0,s="string"==typeof t?Wf:jf;i>=4;){var a=255&s.call(t,r)|(255&s.call(t,++r))<<8|(255&s.call(t,++r))<<16|(255&s.call(t,++r))<<24;a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),i-=4,++r}switch(i){case 3:n^=(255&s.call(t,r+2))<<16;case 2:n^=(255&s.call(t,r+1))<<8;case 1:n=1540483477*(65535&(n^=255&s.call(t,r)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}function Xf(t,e,i){if(Me(t,e),Me(t,i),e===i)return t;var n=t[e];if(e<i)for(var r=e+1;r<=i;++r)t[r-1]=t[r];else for(var s=e;s!==i;--s)t[s]=t[s-1];return t[i]=n,t}C.easing=Hl;var Yf=function(){function t(){this._finalizationRegistry=null,this._gcObjects=new WeakMap}var e=t.prototype;return e.registerGCObject=function(t){return t},e.init=function(){},e.finalizationRegistryCallback=function(){},e.destroy=function(){},t}(),Jf=t("cX",new Yf),Kf=t("cY",function(){function t(){return Jf.registerGCObject(this)}return t.prototype.destroy=function(){},t}());function Qf(t,e){for(var i,n=p(e);!(i=n()).done;){var r=i.value;Array.isArray(r)?Qf(t,r):t.push(r)}}function Zf(t){var e=[];return Qf(e,t),e.join("")}C.math=Ts,C.geometry=Rf;var $f=function(t,e,i){for(var n=0;n<e.length;++n)t.length<=n&&t.push(new i),t[n].copy(e[n]);t.length=e.length},t_={UNKNOWN:0,SWAPCHAIN:1,BUFFER:2,TEXTURE:3,RENDER_PASS:4,FRAMEBUFFER:5,SAMPLER:6,SHADER:7,DESCRIPTOR_SET_LAYOUT:8,PIPELINE_LAYOUT:9,PIPELINE_STATE:10,DESCRIPTOR_SET:11,INPUT_ASSEMBLER:12,COMMAND_BUFFER:13,QUEUE:14,QUERY_POOL:15,GLOBAL_BARRIER:16,TEXTURE_BARRIER:17,BUFFER_BARRIER:18,COUNT:19},e_={UNREADY:0,FAILED:1,SUCCESS:2},i_={UNKNOWN:0,GLES2:1,GLES3:2,METAL:3,VULKAN:4,NVN:5,WEBGL:6,WEBGL2:7,WEBGPU:8},n_={IDENTITY:0,ROTATE_90:1,ROTATE_180:2,ROTATE_270:3},r_={ELEMENT_INDEX_UINT:0,INSTANCED_ARRAYS:1,MULTIPLE_RENDER_TARGETS:2,BLEND_MINMAX:3,COMPUTE_SHADER:4,INPUT_ATTACHMENT_BENEFIT:5,SUBPASS_COLOR_INPUT:6,SUBPASS_DEPTH_STENCIL_INPUT:7,RASTERIZATION_ORDER_NOCOHERENT:8,MULTI_SAMPLE_RESOLVE_DEPTH_STENCIL:9,COUNT:10},s_={UNKNOWN:0,A8:1,L8:2,LA8:3,R8:4,R8SN:5,R8UI:6,R8I:7,R16F:8,R16UI:9,R16I:10,R32F:11,R32UI:12,R32I:13,RG8:14,RG8SN:15,RG8UI:16,RG8I:17,RG16F:18,RG16UI:19,RG16I:20,RG32F:21,RG32UI:22,RG32I:23,RGB8:24,SRGB8:25,RGB8SN:26,RGB8UI:27,RGB8I:28,RGB16F:29,RGB16UI:30,RGB16I:31,RGB32F:32,RGB32UI:33,RGB32I:34,RGBA8:35,BGRA8:36,SRGB8_A8:37,RGBA8SN:38,RGBA8UI:39,RGBA8I:40,RGBA16F:41,RGBA16UI:42,RGBA16I:43,RGBA32F:44,RGBA32UI:45,RGBA32I:46,R5G6B5:47,R11G11B10F:48,RGB5A1:49,RGBA4:50,RGB10A2:51,RGB10A2UI:52,RGB9E5:53,DEPTH:54,DEPTH_STENCIL:55,BC1:56,BC1_ALPHA:57,BC1_SRGB:58,BC1_SRGB_ALPHA:59,BC2:60,BC2_SRGB:61,BC3:62,BC3_SRGB:63,BC4:64,BC4_SNORM:65,BC5:66,BC5_SNORM:67,BC6H_UF16:68,BC6H_SF16:69,BC7:70,BC7_SRGB:71,ETC_RGB8:72,ETC2_RGB8:73,ETC2_SRGB8:74,ETC2_RGB8_A1:75,ETC2_SRGB8_A1:76,ETC2_RGBA8:77,ETC2_SRGB8_A8:78,EAC_R11:79,EAC_R11SN:80,EAC_RG11:81,EAC_RG11SN:82,PVRTC_RGB2:83,PVRTC_RGBA2:84,PVRTC_RGB4:85,PVRTC_RGBA4:86,PVRTC2_2BPP:87,PVRTC2_4BPP:88,ASTC_RGBA_4X4:89,ASTC_RGBA_5X4:90,ASTC_RGBA_5X5:91,ASTC_RGBA_6X5:92,ASTC_RGBA_6X6:93,ASTC_RGBA_8X5:94,ASTC_RGBA_8X6:95,ASTC_RGBA_8X8:96,ASTC_RGBA_10X5:97,ASTC_RGBA_10X6:98,ASTC_RGBA_10X8:99,ASTC_RGBA_10X10:100,ASTC_RGBA_12X10:101,ASTC_RGBA_12X12:102,ASTC_SRGBA_4X4:103,ASTC_SRGBA_5X4:104,ASTC_SRGBA_5X5:105,ASTC_SRGBA_6X5:106,ASTC_SRGBA_6X6:107,ASTC_SRGBA_8X5:108,ASTC_SRGBA_8X6:109,ASTC_SRGBA_8X8:110,ASTC_SRGBA_10X5:111,ASTC_SRGBA_10X6:112,ASTC_SRGBA_10X8:113,ASTC_SRGBA_10X10:114,ASTC_SRGBA_12X10:115,ASTC_SRGBA_12X12:116,COUNT:117},a_={NONE:0,UNORM:1,SNORM:2,UINT:3,INT:4,UFLOAT:5,FLOAT:6},o_={FLOAT:0,UNFILTERABLE_FLOAT:1,SINT:2,UINT:3},h_={UNKNOWN:0,BOOL:1,BOOL2:2,BOOL3:3,BOOL4:4,INT:5,INT2:6,INT3:7,INT4:8,UINT:9,UINT2:10,UINT3:11,UINT4:12,FLOAT:13,FLOAT2:14,FLOAT3:15,FLOAT4:16,MAT2:17,MAT2X3:18,MAT2X4:19,MAT3X2:20,MAT3:21,MAT3X4:22,MAT4X2:23,MAT4X3:24,MAT4:25,SAMPLER1D:26,SAMPLER1D_ARRAY:27,SAMPLER2D:28,SAMPLER2D_ARRAY:29,SAMPLER3D:30,SAMPLER_CUBE:31,SAMPLER:32,TEXTURE1D:33,TEXTURE1D_ARRAY:34,TEXTURE2D:35,TEXTURE2D_ARRAY:36,TEXTURE3D:37,TEXTURE_CUBE:38,IMAGE1D:39,IMAGE1D_ARRAY:40,IMAGE2D:41,IMAGE2D_ARRAY:42,IMAGE3D:43,IMAGE_CUBE:44,SUBPASS_INPUT:45,COUNT:46},u_={NONE:0,TRANSFER_SRC:1,TRANSFER_DST:2,INDEX:4,VERTEX:8,UNIFORM:16,STORAGE:32,INDIRECT:64},l_={NONE:0,ENABLE_STAGING_WRITE:1},c_={NONE:0,READ_ONLY:1,WRITE_ONLY:2,READ_WRITE:3},f_={NONE:0,DEVICE:1,HOST:2},__={TEX1D:0,TEX2D:1,TEX3D:2,CUBE:3,TEX1D_ARRAY:4,TEX2D_ARRAY:5},d_={UNKNOWN:0,BUFFER:1,TEX1D:2,TEX1D_ARRAY:3,TEX2D:4,TEX2D_ARRAY:5,TEX2DMS:6,TEX2DMS_ARRAY:7,TEX3D:8,TEXCUBE:9,TEXCUBE_ARRAY:10,RAYTRACING_ACCELERATION_STRUCTURE:11},p_={NONE:0,TRANSFER_SRC:1,TRANSFER_DST:2,SAMPLED:4,STORAGE:8,COLOR_ATTACHMENT:16,DEPTH_STENCIL_ATTACHMENT:32,INPUT_ATTACHMENT:64,SHADING_RATE:128},m_={NONE:0,GEN_MIPMAP:1,GENERAL_LAYOUT:2,EXTERNAL_OES:4,EXTERNAL_NORMAL:8,LAZILY_ALLOCATED:16,MUTABLE_VIEW_FORMAT:64,MUTABLE_STORAGE:128},g_={NONE:0,RENDER_TARGET:1,SAMPLED_TEXTURE:2,LINEAR_FILTER:4,STORAGE_TEXTURE:8,VERTEX_ATTRIBUTE:16,SHADING_RATE:32},y_={X1:1,X2:2,X4:4,X8:8,X16:16,X32:32,X64:64},v_={OFF:0,ON:1,RELAXED:2,MAILBOX:3,HALF:4},b_={NONE:0,POINT:1,LINEAR:2,ANISOTROPIC:3},S_={WRAP:0,MIRROR:1,CLAMP:2,BORDER:3},w_={NEVER:0,LESS:1,EQUAL:2,LESS_EQUAL:3,GREATER:4,NOT_EQUAL:5,GREATER_EQUAL:6,ALWAYS:7},x_={ZERO:0,KEEP:1,REPLACE:2,INCR:3,DECR:4,INVERT:5,INCR_WRAP:6,DECR_WRAP:7},T_={ZERO:0,ONE:1,SRC_ALPHA:2,DST_ALPHA:3,ONE_MINUS_SRC_ALPHA:4,ONE_MINUS_DST_ALPHA:5,SRC_COLOR:6,DST_COLOR:7,ONE_MINUS_SRC_COLOR:8,ONE_MINUS_DST_COLOR:9,SRC_ALPHA_SATURATE:10,CONSTANT_COLOR:11,ONE_MINUS_CONSTANT_COLOR:12,CONSTANT_ALPHA:13,ONE_MINUS_CONSTANT_ALPHA:14},A_={ADD:0,SUB:1,REV_SUB:2,MIN:3,MAX:4},C_={NONE:0,R:1,G:2,B:4,A:8,ALL:15},D_={NONE:0,VERTEX:1,CONTROL:2,EVALUATION:4,GEOMETRY:8,FRAGMENT:16,COMPUTE:32,ALL:63},B_={LOAD:0,CLEAR:1,DISCARD:2},I_={STORE:0,DISCARD:1},M_={NONE:0,INDIRECT_BUFFER:1,INDEX_BUFFER:2,VERTEX_BUFFER:4,VERTEX_SHADER_READ_UNIFORM_BUFFER:8,VERTEX_SHADER_READ_TEXTURE:16,VERTEX_SHADER_READ_OTHER:32,FRAGMENT_SHADER_READ_UNIFORM_BUFFER:64,FRAGMENT_SHADER_READ_TEXTURE:128,FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT:256,FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT:512,FRAGMENT_SHADER_READ_OTHER:1024,COLOR_ATTACHMENT_READ:2048,DEPTH_STENCIL_ATTACHMENT_READ:4096,COMPUTE_SHADER_READ_UNIFORM_BUFFER:8192,COMPUTE_SHADER_READ_TEXTURE:16384,COMPUTE_SHADER_READ_OTHER:32768,TRANSFER_READ:65536,HOST_READ:131072,PRESENT:262144,VERTEX_SHADER_WRITE:524288,FRAGMENT_SHADER_WRITE:1048576,COLOR_ATTACHMENT_WRITE:2097152,DEPTH_STENCIL_ATTACHMENT_WRITE:4194304,COMPUTE_SHADER_WRITE:8388608,TRANSFER_WRITE:16777216,HOST_PREINITIALIZED:33554432,HOST_WRITE:67108864,SHADING_RATE:134217728},P_={NONE:0,SAMPLE_ZERO:1,AVERAGE:2,MIN:3,MAX:4},E_={GRAPHICS:0,COMPUTE:1,RAY_TRACING:2},O_={POINT_LIST:0,LINE_LIST:1,LINE_STRIP:2,LINE_LOOP:3,LINE_LIST_ADJACENCY:4,LINE_STRIP_ADJACENCY:5,ISO_LINE_LIST:6,TRIANGLE_LIST:7,TRIANGLE_STRIP:8,TRIANGLE_FAN:9,TRIANGLE_LIST_ADJACENCY:10,TRIANGLE_STRIP_ADJACENCY:11,TRIANGLE_PATCH_ADJACENCY:12,QUAD_PATCH_LIST:13},k_={FILL:0,POINT:1,LINE:2},R_={GOURAND:0,FLAT:1},F_={NONE:0,FRONT:1,BACK:2},L_={NONE:0,LINE_WIDTH:1,DEPTH_BIAS:2,BLEND_CONSTANTS:4,DEPTH_BOUNDS:8,STENCIL_WRITE_MASK:16,STENCIL_COMPARE_MASK:32},V_={FRONT:1,BACK:2,ALL:3},N_={UNKNOWN:0,UNIFORM_BUFFER:1,DYNAMIC_UNIFORM_BUFFER:2,STORAGE_BUFFER:4,DYNAMIC_STORAGE_BUFFER:8,SAMPLER_TEXTURE:16,SAMPLER:32,TEXTURE:64,STORAGE_IMAGE:128,INPUT_ATTACHMENT:256},z_={GRAPHICS:0,COMPUTE:1,TRANSFER:2},U_={OCCLUSION:0,PIPELINE_STATISTICS:1,TIMESTAMP:2},G_={PRIMARY:0,SECONDARY:1},H_={NONE:0,COLOR:1,DEPTH:2,STENCIL:4,DEPTH_STENCIL:6,ALL:7},W_={FULL:0,SPLIT_BEGIN:1,SPLIT_END:2},j_={RASTER:0,COMPUTE:1,COPY:2,MOVE:3,RAYTRACE:4,PRESENT:5},q_=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=i}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},t}(),X_=function(){function t(t,e,i,n,r,s,a,o,h,u,l,c,f,_,d,p,m,g,y,v,b,S,w,x,T,A){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=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=0),void 0===c&&(c=0),void 0===f&&(f=0),void 0===_&&(_=0),void 0===d&&(d=0),void 0===p&&(p=1),void 0===m&&(m=0),void 0===g&&(g=0),void 0===y&&(y=new q_),void 0===v&&(v=new q_),void 0===b&&(b=!1),void 0===S&&(S=!1),void 0===w&&(w=!1),void 0===x&&(x=-1),void 0===T&&(T=1),void 0===A&&(A=1),this.maxVertexAttributes=t,this.maxVertexUniformVectors=e,this.maxFragmentUniformVectors=i,this.maxTextureUnits=n,this.maxImageUnits=r,this.maxVertexTextureUnits=s,this.maxColorRenderTargets=a,this.maxShaderStorageBufferBindings=o,this.maxShaderStorageBlockSize=h,this.maxUniformBufferBindings=u,this.maxUniformBlockSize=l,this.maxTextureSize=c,this.maxCubeMapTextureSize=f,this.maxArrayTextureLayers=_,this.max3DTextureSize=d,this.uboOffsetAlignment=p,this.maxComputeSharedMemorySize=m,this.maxComputeWorkGroupInvocations=g,this.maxComputeWorkGroupSize=y,this.maxComputeWorkGroupCount=v,this.supportQuery=b,this.supportVariableRateShading=S,this.supportSubPassShading=w,this.clipSpaceMinZ=x,this.screenSpaceSignY=T,this.clipSpaceSignY=A}return t.prototype.copy=function(t){return this.maxVertexAttributes=t.maxVertexAttributes,this.maxVertexUniformVectors=t.maxVertexUniformVectors,this.maxFragmentUniformVectors=t.maxFragmentUniformVectors,this.maxTextureUnits=t.maxTextureUnits,this.maxImageUnits=t.maxImageUnits,this.maxVertexTextureUnits=t.maxVertexTextureUnits,this.maxColorRenderTargets=t.maxColorRenderTargets,this.maxShaderStorageBufferBindings=t.maxShaderStorageBufferBindings,this.maxShaderStorageBlockSize=t.maxShaderStorageBlockSize,this.maxUniformBufferBindings=t.maxUniformBufferBindings,this.maxUniformBlockSize=t.maxUniformBlockSize,this.maxTextureSize=t.maxTextureSize,this.maxCubeMapTextureSize=t.maxCubeMapTextureSize,this.maxArrayTextureLayers=t.maxArrayTextureLayers,this.max3DTextureSize=t.max3DTextureSize,this.uboOffsetAlignment=t.uboOffsetAlignment,this.maxComputeSharedMemorySize=t.maxComputeSharedMemorySize,this.maxComputeWorkGroupInvocations=t.maxComputeWorkGroupInvocations,this.maxComputeWorkGroupSize.copy(t.maxComputeWorkGroupSize),this.maxComputeWorkGroupCount.copy(t.maxComputeWorkGroupCount),this.supportQuery=t.supportQuery,this.supportVariableRateShading=t.supportVariableRateShading,this.supportSubPassShading=t.supportSubPassShading,this.clipSpaceMinZ=t.clipSpaceMinZ,this.screenSpaceSignY=t.screenSpaceSignY,this.clipSpaceSignY=t.clipSpaceSignY,this},t}(),Y_=function(){function t(t){void 0===t&&(t=!0),this.enableBarrierDeduce=t}return t.prototype.copy=function(t){return this.enableBarrierDeduce=t.enableBarrierDeduce,this},t}(),J_=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=i}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},t}(),K_=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.copy=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},t}(),Q_=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=1),this.width=t,this.height=e,this.depth=i}return t.prototype.copy=function(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this},t}(),Z_=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=1),this.mipLevel=t,this.baseArrayLayer=e,this.layerCount=i}return t.prototype.copy=function(t){return this.mipLevel=t.mipLevel,this.baseArrayLayer=t.baseArrayLayer,this.layerCount=t.layerCount,this},t}(),$_=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=1),this.baseMipLevel=t,this.levelCount=e,this.baseArrayLayer=i,this.layerCount=n}return t.prototype.copy=function(t){return this.baseMipLevel=t.baseMipLevel,this.levelCount=t.levelCount,this.baseArrayLayer=t.baseArrayLayer,this.layerCount=t.layerCount,this},t}(),td=function(){function t(t,e,i,n,r){void 0===t&&(t=new Z_),void 0===e&&(e=new J_),void 0===i&&(i=new Z_),void 0===n&&(n=new J_),void 0===r&&(r=new Q_),this.srcSubres=t,this.srcOffset=e,this.dstSubres=i,this.dstOffset=n,this.extent=r}return t.prototype.copy=function(t){return this.srcSubres.copy(t.srcSubres),this.srcOffset.copy(t.srcOffset),this.dstSubres.copy(t.dstSubres),this.dstOffset.copy(t.dstOffset),this.extent.copy(t.extent),this},t}(),ed=function(){function t(t,e,i,n,r,s){void 0===t&&(t=new Z_),void 0===e&&(e=new J_),void 0===i&&(i=new Q_),void 0===n&&(n=new Z_),void 0===r&&(r=new J_),void 0===s&&(s=new Q_),this.srcSubres=t,this.srcOffset=e,this.srcExtent=i,this.dstSubres=n,this.dstOffset=r,this.dstExtent=s}return t.prototype.copy=function(t){return this.srcSubres.copy(t.srcSubres),this.srcOffset.copy(t.srcOffset),this.srcExtent.copy(t.srcExtent),this.dstSubres.copy(t.dstSubres),this.dstOffset.copy(t.dstOffset),this.dstExtent.copy(t.dstExtent),this},t}(),id=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=new J_),void 0===r&&(r=new Q_),void 0===s&&(s=new Z_),this.buffOffset=t,this.buffStride=e,this.buffTexHeight=i,this.texOffset=n,this.texExtent=r,this.texSubres=s}return t.prototype.copy=function(t){return this.buffOffset=t.buffOffset,this.buffStride=t.buffStride,this.buffTexHeight=t.buffTexHeight,this.texOffset.copy(t.texOffset),this.texExtent.copy(t.texExtent),this.texSubres.copy(t.texSubres),this},t}(),nd=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.left=t,this.top=e,this.width=i,this.height=n,this.minDepth=r,this.maxDepth=s}var e=t.prototype;return e.copy=function(t){return this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height,this.minDepth=t.minDepth,this.maxDepth=t.maxDepth,this},e.reset=function(){this.left=0,this.top=0,this.width=0,this.height=0,this.minDepth=0,this.maxDepth=1},t}(),rd=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}var e=t.prototype;return e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.set=function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},e.reset=function(){this.x=0,this.y=0,this.z=0,this.w=0},t}(),sd=function(){function t(t,e){void 0===t&&(t=""),void 0===e&&(e=new rd),this.name=t,this.color=e}return t.prototype.copy=function(t){return this.name=t.name,this.color.copy(t.color),this},t}(),ad=function(){function t(t,e,i,n,r,s,a,o){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=[0]),void 0===a&&(a=[0]),void 0===o&&(o=[0]),this.maxBlockCounts=t,this.maxSamplerTextureCounts=e,this.maxSamplerCounts=i,this.maxTextureCounts=n,this.maxBufferCounts=r,this.maxImageCounts=s,this.maxSubpassInputCounts=a,this.setIndices=o}return t.prototype.copy=function(t){return this.maxBlockCounts=t.maxBlockCounts.slice(),this.maxSamplerTextureCounts=t.maxSamplerTextureCounts.slice(),this.maxSamplerCounts=t.maxSamplerCounts.slice(),this.maxTextureCounts=t.maxTextureCounts.slice(),this.maxBufferCounts=t.maxBufferCounts.slice(),this.maxImageCounts=t.maxImageCounts.slice(),this.maxSubpassInputCounts=t.maxSubpassInputCounts.slice(),this.setIndices=t.setIndices.slice(),this},t}(),od=function(){function t(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=null),void 0===i&&(i=1),void 0===n&&(n=0),void 0===r&&(r=0),this.windowId=t,this.windowHandle=e,this.vsyncMode=i,this.width=n,this.height=r}return t.prototype.copy=function(t){return this.windowId=t.windowId,this.windowHandle=t.windowHandle,this.vsyncMode=t.vsyncMode,this.width=t.width,this.height=t.height,this},t}(),hd=function(){function t(t){void 0===t&&(t=new ad),this.bindingMappingInfo=t}return t.prototype.copy=function(t){return this.bindingMappingInfo.copy(t.bindingMappingInfo),this},t}(),ud=function(){function t(t,e,i,n,r){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),this.usage=t,this.memUsage=e,this.size=i,this.stride=n,this.flags=r}return t.prototype.copy=function(t){return this.usage=t.usage,this.memUsage=t.memUsage,this.size=t.size,this.stride=t.stride,this.flags=t.flags,this},t}(),ld=function(){function t(t,e,i){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),this.buffer=t,this.offset=e,this.range=i}return t.prototype.copy=function(t){return this.buffer=t.buffer,this.offset=t.offset,this.range=t.range,this},t}(),cd=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=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),this.vertexCount=t,this.firstVertex=e,this.indexCount=i,this.firstIndex=n,this.vertexOffset=r,this.instanceCount=s,this.firstInstance=a}return t.prototype.copy=function(t){return this.vertexCount=t.vertexCount,this.firstVertex=t.firstVertex,this.indexCount=t.indexCount,this.firstIndex=t.firstIndex,this.vertexOffset=t.vertexOffset,this.instanceCount=t.instanceCount,this.firstInstance=t.firstInstance,this},t}(),fd=function(){function t(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=null),void 0===r&&(r=0),this.groupCountX=t,this.groupCountY=e,this.groupCountZ=i,this.indirectBuffer=n,this.indirectOffset=r}return t.prototype.copy=function(t){return this.groupCountX=t.groupCountX,this.groupCountY=t.groupCountY,this.groupCountZ=t.groupCountZ,this.indirectBuffer=t.indirectBuffer,this.indirectOffset=t.indirectOffset,this},t}(),_d=function(){function t(t){void 0===t&&(t=[]),this.drawInfos=t}return t.prototype.copy=function(t){return $f(this.drawInfos,t.drawInfos,cd),this},t}(),dd=function(){function t(t,e,i,n,r,s,a,o,h,u,l){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=0),void 0===a&&(a=1),void 0===o&&(o=1),void 0===h&&(h=1),void 0===u&&(u=1),void 0===l&&(l=0),this.type=t,this.usage=e,this.format=i,this.width=n,this.height=r,this.flags=s,this.layerCount=a,this.levelCount=o,this.samples=h,this.depth=u,this.externalRes=l}return t.prototype.copy=function(t){return this.type=t.type,this.usage=t.usage,this.format=t.format,this.width=t.width,this.height=t.height,this.flags=t.flags,this.layerCount=t.layerCount,this.levelCount=t.levelCount,this.samples=t.samples,this.depth=t.depth,this.externalRes=t.externalRes,this},t}(),pd=function(){function t(t,e,i,n,r,s,a,o,h){void 0===t&&(t=null),void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===a&&(a=1),void 0===o&&(o=0),void 0===h&&(h=1),this.texture=t,this.type=e,this.format=i,this.baseLevel=n,this.levelCount=r,this.baseLayer=s,this.layerCount=a,this.basePlane=o,this.planeCount=h}return t.prototype.copy=function(t){return this.texture=t.texture,this.type=t.type,this.format=t.format,this.baseLevel=t.baseLevel,this.levelCount=t.levelCount,this.baseLayer=t.baseLayer,this.layerCount=t.layerCount,this.basePlane=t.basePlane,this.planeCount=t.planeCount,this},t}(),md=function(){function t(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),this.minFilter=t,this.magFilter=e,this.mipFilter=i,this.addressU=n,this.addressV=r,this.addressW=s,this.maxAnisotropy=a,this.cmpFunc=o}return t.prototype.copy=function(t){return this.minFilter=t.minFilter,this.magFilter=t.magFilter,this.mipFilter=t.mipFilter,this.addressU=t.addressU,this.addressV=t.addressV,this.addressW=t.addressW,this.maxAnisotropy=t.maxAnisotropy,this.cmpFunc=t.cmpFunc,this},t}(),gd=function(){function t(t,e,i){void 0===t&&(t=""),void 0===e&&(e=0),void 0===i&&(i=0),this.name=t,this.type=e,this.count=i}return t.prototype.copy=function(t){return this.name=t.name,this.type=t.type,this.count=t.count,this},t}(),yd=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=[]),void 0===r&&(r=0),void 0===s&&(s=0),this.set=t,this.binding=e,this.name=i,this.members=n,this.count=r,this.flattened=s}return t.prototype.copy=function(t){return this.set=t.set,this.binding=t.binding,this.name=t.name,$f(this.members,t.members,gd),this.count=t.count,this.flattened=t.flattened,this},t}(),vd=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),this.set=t,this.binding=e,this.name=i,this.type=n,this.count=r,this.flattened=s}return t.prototype.copy=function(t){return this.set=t.set,this.binding=t.binding,this.name=t.name,this.type=t.type,this.count=t.count,this.flattened=t.flattened,this},t}(),bd=function(){function t(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=0),void 0===r&&(r=0),this.set=t,this.binding=e,this.name=i,this.count=n,this.flattened=r}return t.prototype.copy=function(t){return this.set=t.set,this.binding=t.binding,this.name=t.name,this.count=t.count,this.flattened=t.flattened,this},t}(),Sd=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),this.set=t,this.binding=e,this.name=i,this.type=n,this.count=r,this.flattened=s}return t.prototype.copy=function(t){return this.set=t.set,this.binding=t.binding,this.name=t.name,this.type=t.type,this.count=t.count,this.flattened=t.flattened,this},t}(),wd=function(){function t(t,e,i,n,r,s,a){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=3),void 0===a&&(a=0),this.set=t,this.binding=e,this.name=i,this.type=n,this.count=r,this.memoryAccess=s,this.flattened=a}return t.prototype.copy=function(t){return this.set=t.set,this.binding=t.binding,this.name=t.name,this.type=t.type,this.count=t.count,this.memoryAccess=t.memoryAccess,this.flattened=t.flattened,this},t}(),xd=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=0),void 0===r&&(r=3),void 0===s&&(s=0),this.set=t,this.binding=e,this.name=i,this.count=n,this.memoryAccess=r,this.flattened=s}return t.prototype.copy=function(t){return this.set=t.set,this.binding=t.binding,this.name=t.name,this.count=t.count,this.memoryAccess=t.memoryAccess,this.flattened=t.flattened,this},t}(),Td=function(){function t(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=0),void 0===r&&(r=0),this.set=t,this.binding=e,this.name=i,this.count=n,this.flattened=r}return t.prototype.copy=function(t){return this.set=t.set,this.binding=t.binding,this.name=t.name,this.count=t.count,this.flattened=t.flattened,this},t}(),Ad=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=""),this.stage=t,this.source=e}return t.prototype.copy=function(t){return this.stage=t.stage,this.source=t.source,this},t}(),Cd=function(){function t(t,e,i,n,r,s){void 0===t&&(t=""),void 0===e&&(e=0),void 0===i&&(i=!1),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=0),this.name=t,this.format=e,this.isNormalized=i,this.stream=n,this.isInstanced=r,this.location=s}return t.prototype.copy=function(t){return this.name=t.name,this.format=t.format,this.isNormalized=t.isNormalized,this.stream=t.stream,this.isInstanced=t.isInstanced,this.location=t.location,this},t}(),Dd=function(){function t(t,e,i,n,r,s,a,o,h,u,l){void 0===t&&(t=""),void 0===e&&(e=[]),void 0===i&&(i=[]),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===s&&(s=[]),void 0===a&&(a=[]),void 0===o&&(o=[]),void 0===h&&(h=[]),void 0===u&&(u=[]),void 0===l&&(l=4294967295),this.name=t,this.stages=e,this.attributes=i,this.blocks=n,this.buffers=r,this.samplerTextures=s,this.samplers=a,this.textures=o,this.images=h,this.subpassInputs=u,this.hash=l}return t.prototype.copy=function(t){return this.name=t.name,$f(this.stages,t.stages,Ad),$f(this.attributes,t.attributes,Cd),$f(this.blocks,t.blocks,yd),$f(this.buffers,t.buffers,xd),$f(this.samplerTextures,t.samplerTextures,vd),$f(this.samplers,t.samplers,bd),$f(this.textures,t.textures,Sd),$f(this.images,t.images,wd),$f(this.subpassInputs,t.subpassInputs,Td),this.hash=t.hash,this},t}(),Bd=function(){function t(t,e,i,n){void 0===t&&(t=[]),void 0===e&&(e=[]),void 0===i&&(i=null),void 0===n&&(n=null),this.attributes=t,this.vertexBuffers=e,this.indexBuffer=i,this.indirectBuffer=n}return t.prototype.copy=function(t){return $f(this.attributes,t.attributes,Cd),this.vertexBuffers=t.vertexBuffers.slice(),this.indexBuffer=t.indexBuffer,this.indirectBuffer=t.indirectBuffer,this},t}(),Id=function(){function t(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=0),void 0===r&&(r=null),this.format=t,this.sampleCount=e,this.loadOp=i,this.storeOp=n,this.barrier=r}return t.prototype.copy=function(t){return this.format=t.format,this.sampleCount=t.sampleCount,this.loadOp=t.loadOp,this.storeOp=t.storeOp,this.barrier=t.barrier,this},t}(),Md=function(){function t(t,e,i,n,r,s,a){void 0===t&&(t=0),void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===a&&(a=null),this.format=t,this.sampleCount=e,this.depthLoadOp=i,this.depthStoreOp=n,this.stencilLoadOp=r,this.stencilStoreOp=s,this.barrier=a}return t.prototype.copy=function(t){return this.format=t.format,this.sampleCount=t.sampleCount,this.depthLoadOp=t.depthLoadOp,this.depthStoreOp=t.depthStoreOp,this.stencilLoadOp=t.stencilLoadOp,this.stencilStoreOp=t.stencilStoreOp,this.barrier=t.barrier,this},t}(),Pd=function(){function t(t,e,i,n,r,s,a,o,h){void 0===t&&(t=[]),void 0===e&&(e=[]),void 0===i&&(i=[]),void 0===n&&(n=[]),void 0===r&&(r=-1),void 0===s&&(s=-1),void 0===a&&(a=-1),void 0===o&&(o=0),void 0===h&&(h=0),this.inputs=t,this.colors=e,this.resolves=i,this.preserves=n,this.depthStencil=r,this.depthStencilResolve=s,this.shadingRate=a,this.depthResolveMode=o,this.stencilResolveMode=h}return t.prototype.copy=function(t){return this.inputs=t.inputs.slice(),this.colors=t.colors.slice(),this.resolves=t.resolves.slice(),this.preserves=t.preserves.slice(),this.depthStencil=t.depthStencil,this.depthStencilResolve=t.depthStencilResolve,this.shadingRate=t.shadingRate,this.depthResolveMode=t.depthResolveMode,this.stencilResolveMode=t.stencilResolveMode,this},t}(),Ed=function(){function t(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=null),void 0===n&&(n=0),void 0===r&&(r=0),this.srcSubpass=t,this.dstSubpass=e,this.generalBarrier=i,this.prevAccesses=n,this.nextAccesses=r}return t.prototype.copy=function(t){return this.srcSubpass=t.srcSubpass,this.dstSubpass=t.dstSubpass,this.generalBarrier=t.generalBarrier,this.prevAccesses=t.prevAccesses,this.nextAccesses=t.nextAccesses,this},t}(),Od=function(){function t(t,e,i,n,r){void 0===t&&(t=[]),void 0===e&&(e=new Md),void 0===i&&(i=new Md),void 0===n&&(n=[]),void 0===r&&(r=[]),this.colorAttachments=t,this.depthStencilAttachment=e,this.depthStencilResolveAttachment=i,this.subpasses=n,this.dependencies=r}return t.prototype.copy=function(t){return $f(this.colorAttachments,t.colorAttachments,Id),this.depthStencilAttachment.copy(t.depthStencilAttachment),this.depthStencilResolveAttachment.copy(t.depthStencilResolveAttachment),$f(this.subpasses,t.subpasses,Pd),$f(this.dependencies,t.dependencies,Ed),this},t}(),kd=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=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),this.width=t,this.height=e,this.depthOrArraySize=i,this.firstSlice=n,this.numSlices=r,this.mipLevel=s,this.levelCount=a,this.basePlane=o,this.planeCount=h}return t.prototype.copy=function(t){return this.width=t.width,this.height=t.height,this.depthOrArraySize=t.depthOrArraySize,this.firstSlice=t.firstSlice,this.numSlices=t.numSlices,this.mipLevel=t.mipLevel,this.levelCount=t.levelCount,this.basePlane=t.basePlane,this.planeCount=t.planeCount,this},t}(),Rd=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.prevAccesses=t,this.nextAccesses=e,this.type=i}return t.prototype.copy=function(t){return this.prevAccesses=t.prevAccesses,this.nextAccesses=t.nextAccesses,this.type=t.type,this},t}(),Fd=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=new kd),void 0===r&&(r=!1),void 0===s&&(s=null),void 0===a&&(a=null),this.prevAccesses=t,this.nextAccesses=e,this.type=i,this.range=n,this.discardContents=r,this.srcQueue=s,this.dstQueue=a}return t.prototype.copy=function(t){return this.prevAccesses=t.prevAccesses,this.nextAccesses=t.nextAccesses,this.type=t.type,this.range.copy(t.range),this.discardContents=t.discardContents,this.srcQueue=t.srcQueue,this.dstQueue=t.dstQueue,this},t}(),Ld=function(){function t(t,e,i,n,r,s,a,o){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),void 0===a&&(a=null),void 0===o&&(o=null),this.prevAccesses=t,this.nextAccesses=e,this.type=i,this.offset=n,this.size=r,this.discardContents=s,this.srcQueue=a,this.dstQueue=o}return t.prototype.copy=function(t){return this.prevAccesses=t.prevAccesses,this.nextAccesses=t.nextAccesses,this.type=t.type,this.offset=t.offset,this.size=t.size,this.discardContents=t.discardContents,this.srcQueue=t.srcQueue,this.dstQueue=t.dstQueue,this},t}(),Vd=function(){function t(t,e,i,n){void 0===t&&(t=null),void 0===e&&(e=[]),void 0===i&&(i=null),void 0===n&&(n=null),this.renderPass=t,this.colorTextures=e,this.depthStencilTexture=i,this.depthStencilResolveTexture=n}return t.prototype.copy=function(t){return this.renderPass=t.renderPass,this.colorTextures=t.colorTextures.slice(),this.depthStencilTexture=t.depthStencilTexture,this.depthStencilResolveTexture=t.depthStencilResolveTexture,this},t}(),Nd=function(){function t(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=[]),this.binding=t,this.descriptorType=e,this.count=i,this.stageFlags=n,this.access=r,this.viewDimension=s,this.sampleType=a,this.format=o,this.immutableSamplers=h}return t.prototype.copy=function(t){return this.binding=t.binding,this.descriptorType=t.descriptorType,this.count=t.count,this.stageFlags=t.stageFlags,this.access=t.access,this.viewDimension=t.viewDimension,this.sampleType=t.sampleType,this.format=t.format,this.immutableSamplers=t.immutableSamplers.slice(),this},t}(),zd=function(){function t(t){void 0===t&&(t=[]),this.bindings=t}return t.prototype.copy=function(t){return $f(this.bindings,t.bindings,Nd),this},t}(),Ud=function(){function t(t){void 0===t&&(t=null),this.layout=t}return t.prototype.copy=function(t){return this.layout=t.layout,this},t}(),Gd=function(){function t(t){void 0===t&&(t=[]),this.setLayouts=t}return t.prototype.copy=function(t){return this.setLayouts=t.setLayouts.slice(),this},t}(),Hd=function(){function t(t){void 0===t&&(t=[]),this.attributes=t}return t.prototype.copy=function(t){return $f(this.attributes,t.attributes,Cd),this},t}(),Wd=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=0),this.queue=t,this.type=e}return t.prototype.copy=function(t){return this.queue=t.queue,this.type=t.type,this},t}(),jd=function(){function t(t){void 0===t&&(t=0),this.type=t}return t.prototype.copy=function(t){return this.type=t.type,this},t}(),qd=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=32767),void 0===i&&(i=!0),this.type=t,this.maxQueryObjects=e,this.forceWait=i}return t.prototype.copy=function(t){return this.type=t.type,this.maxQueryObjects=t.maxQueryObjects,this.forceWait=t.forceWait,this},t}(),Xd=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=""),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),void 0===a&&(a=!1),void 0===o&&(o=!1),this.name=t,this.size=e,this.count=i,this.type=n,this.hasAlpha=r,this.hasDepth=s,this.hasStencil=a,this.isCompressed=o}return t.prototype.copy=function(t){return this.name=t.name,this.size=t.size,this.count=t.count,this.type=t.type,this.hasAlpha=t.hasAlpha,this.hasDepth=t.hasDepth,this.hasStencil=t.hasStencil,this.isCompressed=t.isCompressed,this},t}(),Yd=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.bufferSize=t,this.textureSize=e}return t.prototype.copy=function(t){return this.bufferSize=t.bufferSize,this.textureSize=t.textureSize,this},t}(),Jd=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.writeMask=t,this.compareMask=e,this.reference=i}return t.prototype.copy=function(t){return this.writeMask=t.writeMask,this.compareMask=t.compareMask,this.reference=t.reference,this},t}(),Kd=function(){function t(t,e,i,n,r,s,a,o,h,u,l){void 0===t&&(t=new nd),void 0===e&&(e=new K_),void 0===i&&(i=new rd),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=new Jd),void 0===l&&(l=new Jd),this.viewport=t,this.scissor=e,this.blendConstant=i,this.lineWidth=n,this.depthBiasConstant=r,this.depthBiasClamp=s,this.depthBiasSlope=a,this.depthMinBounds=o,this.depthMaxBounds=h,this.stencilStatesFront=u,this.stencilStatesBack=l}return t.prototype.copy=function(t){return this.viewport.copy(t.viewport),this.scissor.copy(t.scissor),this.blendConstant.copy(t.blendConstant),this.lineWidth=t.lineWidth,this.depthBiasConstant=t.depthBiasConstant,this.depthBiasClamp=t.depthBiasClamp,this.depthBiasSlope=t.depthBiasSlope,this.depthMinBounds=t.depthMinBounds,this.depthMaxBounds=t.depthMaxBounds,this.stencilStatesFront.copy(t.stencilStatesFront),this.stencilStatesBack.copy(t.stencilStatesBack),this},t}(),Qd=function(t){function e(i){var n;return(n=t.call(this)||this)._objectType=0,n._objectID=0,n._typedID=0,n._objectType=i,n._objectID=e._idTable[0]++,n._typedID=e._idTable[i]++,n}return s(e,t),n(e,[{key:"objectType",get:function(){return this._objectType}},{key:"objectID",get:function(){return this._objectID}},{key:"typedID",get:function(){return this._typedID}}]),e}(Kf);Qd._idTable=Array(19).fill(65536);var Zd={ATTR_POSITION:"a_position",ATTR_NORMAL:"a_normal",ATTR_TANGENT:"a_tangent",ATTR_BITANGENT:"a_bitangent",ATTR_WEIGHTS:"a_weights",ATTR_JOINTS:"a_joints",ATTR_COLOR:"a_color",ATTR_COLOR1:"a_color1",ATTR_COLOR2:"a_color2",ATTR_TEX_COORD:"a_texCoord",ATTR_TEX_COORD1:"a_texCoord1",ATTR_TEX_COORD2:"a_texCoord2",ATTR_TEX_COORD3:"a_texCoord3",ATTR_TEX_COORD4:"a_texCoord4",ATTR_TEX_COORD5:"a_texCoord5",ATTR_TEX_COORD6:"a_texCoord6",ATTR_TEX_COORD7:"a_texCoord7",ATTR_TEX_COORD8:"a_texCoord8",ATTR_BATCH_ID:"a_batch_id",ATTR_BATCH_UV:"a_batch_uv"};function $d(t,e,i,n,r,s,a,o){return new Xd(t,e,i,n,r,s,a,o)}function tp(t){return new Xd("ASTC_SRGBA_"+t,1,4,1,!0,!1,!1,!0)}function ep(t){return new Xd("ASTC_RGBA_"+t,1,4,1,!0,!1,!1,!0)}var ip=Object.freeze([$d("UNKNOWN"),$d("A8",1,1,1,!0),$d("L8",1,1,1),$d("LA8",1,2,1,!0),$d("R8",1,1,1),$d("R8SN",1,1,2),$d("R8UI",1,1,3),$d("R8I",1,1,4),$d("R16F",2,1,6),$d("R16UI",2,1,3),$d("R16I",2,1,4),$d("R32F",4,1,6),$d("R32UI",4,1,3),$d("R32I",4,1,4),$d("RG8",2,2,1),$d("RG8SN",2,2,2),$d("RG8UI",2,2,3),$d("RG8I",2,2,4),$d("RG16F",4,2,6),$d("RG16UI",4,2,3),$d("RG16I",4,2,4),$d("RG32F",8,2,6),$d("RG32UI",8,2,3),$d("RG32I",8,2,4),$d("RGB8",3,3,1),$d("SRGB8",3,3,1),$d("RGB8SN",3,3,2),$d("RGB8UI",3,3,3),$d("RGB8I",3,3,4),$d("RGB16F",6,3,6),$d("RGB16UI",6,3,3),$d("RGB16I",6,3,4),$d("RGB32F",12,3,6),$d("RGB32UI",12,3,3),$d("RGB32I",12,3,4),$d("RGBA8",4,4,1,!0),$d("BGRA8",4,4,1,!0),$d("SRGB8_A8",4,4,1,!0),$d("RGBA8SN",4,4,2,!0),$d("RGBA8UI",4,4,3,!0),$d("RGBA8I",4,4,4,!0),$d("RGBA16F",8,4,6,!0),$d("RGBA16UI",8,4,3,!0),$d("RGBA16I",8,4,4,!0),$d("RGBA32F",16,4,6,!0),$d("RGBA32UI",16,4,3,!0),$d("RGBA32I",16,4,4,!0),$d("R5G6B5",2,3,1),$d("R11G11B10F",4,3,6),$d("RGB5A1",2,4,1,!0),$d("RGBA4",2,4,1,!0),$d("RGB10A2",2,4,1,!0),$d("RGB10A2UI",2,4,3,!0),$d("RGB9E5",2,4,6,!0),$d("DEPTH",4,1,6,!1,!0),$d("DEPTH_STENCIL",5,2,6,!1,!0,!0),$d("BC1",1,3,1,!1,!1,!1,!0),$d("BC1_ALPHA",1,4,1,!0,!1,!1,!0),$d("BC1_SRGB",1,3,1,!1,!1,!1,!0),$d("BC1_SRGB_ALPHA",1,4,1,!0,!1,!1,!0),$d("BC2",1,4,1,!0,!1,!1,!0),$d("BC2_SRGB",1,4,1,!0,!1,!1,!0),$d("BC3",1,4,1,!0,!1,!1,!0),$d("BC3_SRGB",1,4,1,!0,!1,!1,!0),$d("BC4",1,1,1,!1,!1,!1,!0),$d("BC4_SNORM",1,1,2,!1,!1,!1,!0),$d("BC5",1,2,1,!1,!1,!1,!0),$d("BC5_SNORM",1,2,2,!1,!1,!1,!0),$d("BC6H_UF16",1,3,5,!1,!1,!1,!0),$d("BC6H_SF16",1,3,6,!1,!1,!1,!0),$d("BC7",1,4,1,!0,!1,!1,!0),$d("BC7_SRGB",1,4,1,!0,!1,!1,!0),$d("ETC_RGB8",1,3,1,!1,!1,!1,!0),$d("ETC2_RGB8",1,3,1,!1,!1,!1,!0),$d("ETC2_SRGB8",1,3,1,!1,!1,!1,!0),$d("ETC2_RGB8_A1",1,4,1,!0,!1,!1,!0),$d("ETC2_SRGB8_A1",1,4,1,!0,!1,!1,!0),$d("ETC2_RGBA8",2,4,1,!0,!1,!1,!0),$d("ETC2_SRGB8_A8",2,4,1,!0,!1,!1,!0),$d("EAC_R11",1,1,1,!1,!1,!1,!0),$d("EAC_R11SN",1,1,2,!1,!1,!1,!0),$d("EAC_RG11",2,2,1,!1,!1,!1,!0),$d("EAC_RG11SN",2,2,2,!1,!1,!1,!0),$d("PVRTC_RGB2",2,3,1,!1,!1,!1,!0),$d("PVRTC_RGBA2",2,4,1,!0,!1,!1,!0),$d("PVRTC_RGB4",2,3,1,!1,!1,!1,!0),$d("PVRTC_RGBA4",2,4,1,!0,!1,!1,!0),$d("PVRTC2_2BPP",2,4,1,!0,!1,!1,!0),$d("PVRTC2_4BPP",2,4,1,!0,!1,!1,!0),ep("4x4"),ep("5x4"),ep("5x5"),ep("6x5"),ep("6x6"),ep("8x5"),ep("8x6"),ep("8x8"),ep("10x5"),ep("10x6"),ep("10x8"),ep("10x10"),ep("12x10"),ep("12x12"),tp("4x4"),tp("5x4"),tp("5x5"),tp("6x5"),tp("6x6"),tp("8x5"),tp("8x6"),tp("8x8"),tp("10x5"),tp("10x6"),tp("10x8"),tp("10x10"),tp("12x10"),tp("12x12")]),np=15,rp=496;function sp(t){return t>0&&!(t&t-1)}var ap=Math.ceil;function op(t,e,i,n){if(!ip[t].isCompressed)return e*i*n*ip[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 ap(e/4)*ap(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 ap(e/4)*ap(i/4)*16*n;case 66:case 67:return ap(e/4)*ap(i/4)*32*n;case 83:case 84:case 87:return ap(e/8)*ap(i/4)*8*n;case 90:case 104:return ap(e/5)*ap(i/4)*16*n;case 91:case 105:return ap(e/5)*ap(i/5)*16*n;case 92:case 106:return ap(e/6)*ap(i/5)*16*n;case 93:case 107:return ap(e/6)*ap(i/6)*16*n;case 94:case 108:return ap(e/8)*ap(i/5)*16*n;case 95:case 109:return ap(e/8)*ap(i/6)*16*n;case 96:case 110:return ap(e/8)*ap(i/8)*16*n;case 97:case 111:return ap(e/10)*ap(i/5)*16*n;case 98:case 112:return ap(e/10)*ap(i/6)*16*n;case 99:case 113:return ap(e/10)*ap(i/8)*16*n;case 100:case 114:return ap(e/10)*ap(i/10)*16*n;case 101:case 115:return ap(e/12)*ap(i/10)*16*n;case 102:case 116:return ap(e/12)*ap(i/12)*16*n;default:return 0}}function hp(t,e,i,n,r){for(var s=0,a=0;a<r;++a)s+=op(t,e,i,n),e=Math.max(e>>1,1),i=Math.max(i>>1,1);return s}var up=[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 lp(t){return up[t]||0}function cp(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 fp(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 _p(t,e){return ap(t/e)*e}var dp=Object.freeze({__proto__:null,API:i_,AccessFlagBit:M_,Address:S_,Attribute:Cd,AttributeName:Zd,BarrierType:W_,BindingMappingInfo:ad,BlendFactor:T_,BlendOp:A_,BufferBarrierInfo:Ld,BufferFlagBit:l_,BufferInfo:ud,BufferTextureCopy:id,BufferUsageBit:u_,BufferViewInfo:ld,ClearFlagBit:H_,Color:rd,ColorAttachment:Id,ColorMask:C_,CommandBufferInfo:Wd,CommandBufferType:G_,ComparisonFunc:w_,CullMode:F_,DESCRIPTOR_BUFFER_TYPE:np,DESCRIPTOR_DYNAMIC_TYPE:10,DESCRIPTOR_SAMPLER_TYPE:rp,DESCRIPTOR_STORAGE_BUFFER_TYPE:12,DRAW_INFO_SIZE:28,DepthStencilAttachment:Md,DescriptorSetInfo:Ud,DescriptorSetLayoutBinding:Nd,DescriptorSetLayoutInfo:zd,DescriptorType:N_,DeviceCaps:X_,DeviceInfo:hd,DeviceOptions:Y_,DispatchInfo:fd,DrawInfo:cd,DynamicStateFlagBit:L_,DynamicStates:Kd,DynamicStencilStates:Jd,Extent:Q_,Feature:r_,Filter:b_,Format:s_,FormatFeatureBit:g_,FormatInfo:Xd,FormatInfos:ip,FormatSize:op,FormatSurfaceSize:hp,FormatType:a_,FramebufferInfo:Vd,GFXObject:Qd,GeneralBarrierInfo:Rd,GetTypeSize:lp,IndirectBuffer:_d,InputAssemblerInfo:Bd,InputState:Hd,IsPowerOf2:sp,LoadOp:B_,MarkerInfo:sd,MemoryAccessBit:c_,MemoryStatus:Yd,MemoryUsageBit:f_,ObjectType:t_,Offset:J_,PassType:j_,PipelineBindPoint:E_,PipelineLayoutInfo:Gd,PolygonMode:k_,PrimitiveMode:O_,QueryPoolInfo:qd,QueryType:U_,QueueInfo:jd,QueueType:z_,Rect:K_,RenderPassInfo:Od,ResolveMode:P_,ResourceRange:kd,SampleCount:y_,SampleType:o_,SamplerInfo:md,ShadeModel:R_,ShaderInfo:Dd,ShaderStage:Ad,ShaderStageFlagBit:D_,Size:q_,Status:e_,StencilFace:V_,StencilOp:x_,StoreOp:I_,SubpassDependency:Ed,SubpassInfo:Pd,SurfaceTransform:n_,SwapchainInfo:od,TextureBarrierInfo:Fd,TextureBlit:ed,TextureCopy:td,TextureFlagBit:m_,TextureInfo:dd,TextureSubresLayers:Z_,TextureSubresRange:$_,TextureType:__,TextureUsageBit:p_,TextureViewInfo:pd,Type:h_,Uniform:gd,UniformBlock:yd,UniformInputAttachment:Td,UniformSampler:bd,UniformSamplerTexture:vd,UniformStorageBuffer:xd,UniformStorageImage:wd,UniformTexture:Sd,ViewDimension:d_,Viewport:nd,VsyncMode:v_,alignTo:_p,formatAlignment:fp,getTypedArrayConstructor:cp}),pp=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}(Qd),mp=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}(Qd),gp=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 Yd,this._caps=new X_,this._bindingMappingInfo=new ad,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}();gp.canvas=void 0;var yp=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 dd(1,12,35,2,2,0));var n=new id(0,0,0,new J_(0,0,0),new Q_(2,2,1));t.copyBuffersToTexture([i],this._texture2D,[n])}if(e.maxTextureSize>=2){this._textureCube=t.createTexture(new dd(3,12,35,2,2,0,6));var r=new id(0,0,0,new J_(0,0,0),new Q_(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 dd(2,12,35,2,2,0,1,1,1,2));var s=new id(0,0,0,new J_(0,0,0),new Q_(2,2,2),new Z_(0,0,1));t.copyBuffersToTexture([i],this._texture3D,[s])}if(e.maxArrayTextureLayers>=2){this._texture2DArray=t.createTexture(new dd(5,12,35,2,2,0,2));var a=new id(0,0,0,new J_(0,0,0),new Q_(2,2,1),new Z_(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}(Qd),bp=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}(Qd),Sp=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 cd,e}s(e,t);var i=e.prototype;return i.getVertexBuffer=function(t){return void 0===t&&(t=0),t<this._vertexBuffers.length?this._vertexBuffers[t]:null},i.computeAttributesHash=function(){for(var t="attrs",e=0;e<this.attributes.length;++e){var i=this.attributes[e];t+=","+i.name+","+i.format+","+i.isNormalized+","+i.stream+","+i.isInstanced+","+i.location}return qf(t,666)},n(e,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexBuffers",get:function(){return this._vertexBuffers}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"indirectBuffer",get:function(){return this._indirectBuffer}},{key:"attributesHash",get:function(){return this._attributesHash}},{key:"vertexCount",get:function(){return this._drawInfo.vertexCount},set:function(t){this._drawInfo.vertexCount=t}},{key:"firstVertex",get:function(){return this._drawInfo.firstVertex},set:function(t){this._drawInfo.firstVertex=t}},{key:"indexCount",get:function(){return this._drawInfo.indexCount},set:function(t){this._drawInfo.indexCount=t}},{key:"firstIndex",get:function(){return this._drawInfo.firstIndex},set:function(t){this._drawInfo.firstIndex=t}},{key:"vertexOffset",get:function(){return this._drawInfo.vertexOffset},set:function(t){this._drawInfo.vertexOffset=t}},{key:"instanceCount",get:function(){return this._drawInfo.instanceCount},set:function(t){this._drawInfo.instanceCount=t}},{key:"firstInstance",get:function(){return this._drawInfo.firstInstance},set:function(t){this._drawInfo.firstInstance=t}},{key:"drawInfo",get:function(){return this._drawInfo},set:function(t){this._drawInfo=t}}]),e}(Qd),wp=function(t){function e(){var e;return(e=t.call(this,11)||this)._layout=null,e._buffers=[],e._textures=[],e._samplers=[],e._isDirty=!1,e}s(e,t);var i=e.prototype;return i.bindBuffer=function(t,e,i){void 0===i&&(i=0);var n=this._layout.bindingIndices[t],r=this._layout.bindings[n];if(r&&r.descriptorType&np){var s=this._layout.descriptorIndices[t];this._buffers[s+i]!==e&&(this._buffers[s+i]=e,this._isDirty=!0)}},i.bindSampler=function(t,e,i){void 0===i&&(i=0);var n=this._layout.bindingIndices[t],r=this._layout.bindings[n];if(r&&r.descriptorType&rp){var s=this._layout.descriptorIndices[t];this._samplers[s+i]!==e&&(this._samplers[s+i]=e,this._isDirty=!0)}},i.bindTexture=function(t,e,i){void 0===i&&(i=0);var n=this._layout.bindingIndices[t],r=this._layout.bindings[n];if(r&&r.descriptorType&rp){var s=this._layout.descriptorIndices[t];this._textures[s+i]!==e&&(this._textures[s+i]=e,this._isDirty=!0)}},i.getBuffer=function(t,e){void 0===e&&(e=0);var i=this._layout.descriptorIndices[t];return this._buffers[i+e]},i.getSampler=function(t,e){void 0===e&&(e=0);var i=this._layout.descriptorIndices[t];return this._samplers[i+e]},i.getTexture=function(t,e){void 0===e&&(e=0);var i=this._layout.descriptorIndices[t];return this._textures[i+e]},n(e,[{key:"layout",get:function(){return this._layout}}]),e}(Qd),xp=function(t){function e(){var e;return(e=t.call(this,8)||this)._bindings=[],e._bindingIndices=[],e._descriptorIndices=[],e}return s(e,t),n(e,[{key:"bindings",get:function(){return this._bindings}},{key:"bindingIndices",get:function(){return this._bindingIndices}},{key:"descriptorIndices",get:function(){return this._descriptorIndices}}]),e}(Qd),Tp=function(t){function e(){var e;return(e=t.call(this,9)||this)._setLayouts=[],e}return s(e,t),n(e,[{key:"setLayouts",get:function(){return this._setLayouts}}]),e}(Qd),Ap=function(){function t(t,e,i,n,r,s,a,o,h,u,l,c){void 0===t&&(t=!1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=2),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=1),this.isDiscard=t,this.polygonMode=e,this.shadeModel=i,this.cullMode=n,this.isFrontFaceCCW=r,this.depthBiasEnabled=s,this.depthBias=a,this.depthBiasClamp=o,this.depthBiasSlop=h,this.isDepthClip=u,this.isMultisample=l,this.lineWidth=c}var e=t.prototype;return e.reset=function(){this.isDiscard=!1,this.polygonMode=0,this.shadeModel=0,this.cullMode=2,this.isFrontFaceCCW=!0,this.depthBiasEnabled=!1,this.depthBias=0,this.depthBiasClamp=0,this.depthBiasSlop=0,this.isDepthClip=!0,this.isMultisample=!1,this.lineWidth=1},e.assign=function(t){Object.assign(this,t)},e.destroy=function(){},n(t,[{key:"native",get:function(){return this}}]),t}(),Cp=function(){function t(t,e,i,n,r,s,a,o,h,u,l,c,f,_,d,p,m,g,y){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=1),void 0===n&&(n=!1),void 0===r&&(r=7),void 0===s&&(s=65535),void 0===a&&(a=65535),void 0===o&&(o=1),void 0===h&&(h=1),void 0===u&&(u=1),void 0===l&&(l=1),void 0===c&&(c=!1),void 0===f&&(f=7),void 0===_&&(_=65535),void 0===d&&(d=65535),void 0===p&&(p=1),void 0===m&&(m=1),void 0===g&&(g=1),void 0===y&&(y=1),this.depthTest=t,this.depthWrite=e,this.depthFunc=i,this.stencilTestFront=n,this.stencilFuncFront=r,this.stencilReadMaskFront=s,this.stencilWriteMaskFront=a,this.stencilFailOpFront=o,this.stencilZFailOpFront=h,this.stencilPassOpFront=u,this.stencilRefFront=l,this.stencilTestBack=c,this.stencilFuncBack=f,this.stencilReadMaskBack=_,this.stencilWriteMaskBack=d,this.stencilFailOpBack=p,this.stencilZFailOpBack=m,this.stencilPassOpBack=g,this.stencilRefBack=y}var e=t.prototype;return e.reset=function(){this.depthTest=!0,this.depthWrite=!0,this.depthFunc=1,this.stencilTestFront=!1,this.stencilFuncFront=7,this.stencilReadMaskFront=65535,this.stencilWriteMaskFront=65535,this.stencilFailOpFront=1,this.stencilZFailOpFront=1,this.stencilPassOpFront=1,this.stencilRefFront=1,this.stencilTestBack=!1,this.stencilFuncBack=7,this.stencilReadMaskBack=65535,this.stencilWriteMaskBack=65535,this.stencilFailOpBack=1,this.stencilZFailOpBack=1,this.stencilPassOpBack=1,this.stencilRefBack=1},e.assign=function(t){Object.assign(this,t)},e.destroy=function(){},n(t,[{key:"native",get:function(){return this}}]),t}(),Dp=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=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=15),this.blend=t,this.blendSrc=e,this.blendDst=i,this.blendEq=n,this.blendSrcAlpha=r,this.blendDstAlpha=s,this.blendAlphaEq=a,this.blendColorMask=o}var e=t.prototype;return e.reset=function(){this.blend=!1,this.blendSrc=1,this.blendDst=0,this.blendEq=0,this.blendSrcAlpha=1,this.blendDstAlpha=0,this.blendAlphaEq=0,this.blendColorMask=15},e.assign=function(t){Object.assign(this,t)},e.destroy=function(){},t}(),Bp=function(){function t(t,e,i,n){void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===i&&(i=new rd),void 0===n&&(n=[new Dp]),this.isA2C=t,this.isIndepend=e,this.blendColor=i,this.targets=n}var e=t.prototype;return e.setTarget=function(t,e){var i=this.targets[t];i||(i=this.targets[t]=new Dp),Object.assign(i,e)},e.reset=function(){this.isA2C=!1,this.isIndepend=!1,this.blendColor.x=0,this.blendColor.y=0,this.blendColor.z=0,this.blendColor.w=0,this.targets.length=1,this.targets[0].reset()},e.destroy=function(){},n(t,[{key:"native",get:function(){return this}}]),t}(),Ip=function(t,e,i,n,r,s,a,o,h,u){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=new Hd),void 0===r&&(r=new Ap),void 0===s&&(s=new Cp),void 0===a&&(a=new Bp),void 0===o&&(o=7),void 0===h&&(h=0),void 0===u&&(u=0),this.shader=t,this.pipelineLayout=e,this.renderPass=i,this.inputState=n,this.rasterizerState=r,this.depthStencilState=s,this.blendState=a,this.primitive=o,this.dynamicStates=h,this.bindPoint=u},Mp=function(t){function e(){var e;return(e=t.call(this,10)||this)._shader=null,e._pipelineLayout=null,e._primitive=7,e._is=null,e._rs=new Ap,e._dss=new Cp,e._bs=new Bp,e._dynamicStates=0,e._renderPass=null,e}return s(e,t),n(e,[{key:"shader",get:function(){return this._shader}},{key:"pipelineLayout",get:function(){return this._pipelineLayout}},{key:"primitive",get:function(){return this._primitive}},{key:"rasterizerState",get:function(){return this._rs}},{key:"depthStencilState",get:function(){return this._dss}},{key:"blendState",get:function(){return this._bs}},{key:"inputState",get:function(){return this._is}},{key:"dynamicStates",get:function(){return this._dynamicStates}},{key:"renderPass",get:function(){return this._renderPass}}]),e}(Qd),Pp=function(t){function e(){var e;return(e=t.call(this,14)||this)._type=0,e}return s(e,t),n(e,[{key:"type",get:function(){return this._type}}]),e}(Qd),Ep=function(t){function e(){var e;return(e=t.call(this,4)||this)._colorInfos=[],e._depthStencilInfo=null,e._subpasses=[],e._hash=0,e}return s(e,t),e.prototype.computeHash=function(){var t="";if(this._subpasses.length)for(var e=0;e<this._subpasses.length;++e){var i=this._subpasses[e];if(i.inputs.length){t+="ia";for(var n=0;n<i.inputs.length;++n){var r=this._colorInfos[i.inputs[n]];t+=","+r.format+","+r.sampleCount}}if(i.colors.length){t+="ca";for(var s=0;s<i.colors.length;++s){var a=this._colorInfos[i.colors[s]];t+=","+a.format+","+a.sampleCount}}if(i.depthStencil>=0){var o=this._colorInfos[i.depthStencil];t+="ds,"+o.format+","+o.sampleCount}}else{t+="ca";for(var h=0;h<this._colorInfos.length;++h){var u=this._colorInfos[h];t+=","+u.format+","+u.sampleCount}var l=this._depthStencilInfo;l&&(t+="ds,"+l.format+","+l.sampleCount)}return qf(t,666)},n(e,[{key:"colorAttachments",get:function(){return this._colorInfos}},{key:"depthStencilAttachment",get:function(){return this._depthStencilInfo}},{key:"subPasses",get:function(){return this._subpasses}},{key:"hash",get:function(){return this._hash}}]),e}(Qd),Op=function(t){function e(e,i){var n;return(n=t.call(this,6)||this)._info=new md,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){var e=t.minFilter;return e|=t.magFilter<<2,e|=t.mipFilter<<4,e|=t.addressU<<6,e|=t.addressV<<8,e|=t.addressW<<10,(e|=Math.min(t.maxAnisotropy,16)<<12)|t.cmpFunc<<17},e.unpackFromHash=function(t){var e=new md;return e.minFilter=3&t,e.magFilter=t>>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}(Qd),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}(Qd),Rp=function(t){function e(){var e;return(e=t.call(this,3)||this)._info=new dd,e._viewInfo=new pd,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}(Qd),Fp=function(t){function e(e,i){var n;return(n=t.call(this,16)||this)._info=new Rd,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){return qf(t.prevAccesses+" "+t.nextAccesses+" "+t.type,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(Qd),Lp=function(t){function e(e,i){var n;return(n=t.call(this,17)||this)._info=new Fd,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,qf(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}(Qd),Vp=function(t){function e(e,i){var n;return(n=t.call(this,18)||this)._info=new Ld,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,qf(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}(Qd),Np={Device:gp,Swapchain:vp,Buffer:pp,Texture:Rp,Sampler:Op,Shader:kp,InputAssembler:Sp,RenderPass:Ep,Framebuffer:bp,DescriptorSet:wp,DescriptorSetLayout:xp,PipelineLayout:Tp,PipelineState:Mp,CommandBuffer:mp,Queue:Pp,GeneralBarrier:Fp,TextureBarrier:Lp,BufferBarrier:Vp,RasterizerState:Ap,BlendState:Bp,BlendTarget:Dp,DepthStencilState:Cp,PipelineStateInfo:Ip};Object.assign(Np,dp),A.gfx=Np;var zp={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 Up in zp){var Gp=zp[Up];!0===Gp?Gp=Up.slice(3):!1===Gp&&(Gp=Up),pt(A,"cc",[{name:Up,newName:Gp,target:A.gfx,targetName:"cc.gfx"}])}mt(A,"cc",[{name:"GFX_MAX_VERTEX_ATTRIBUTES"},{name:"GFX_MAX_TEXTURE_UNITS"},{name:"GFX_MAX_ATTACHMENTS"},{name:"GFX_MAX_BUFFER_BINDINGS"},{name:"GFXTextureLayout"}]),mt(r_,"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(Id.prototype,"ColorAttachment",[{name:"beginAccesses",suggest:"Please assign to ColorAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to ColorAttachment.barrier instead"}]),mt(Md.prototype,"DepthStencilAttachment",[{name:"beginAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"}]),pt(gp.prototype,"Device",[{name:"getGlobalBarrier",newName:"getGeneralBarrier"}]);var Hp=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 hd(e);if(1===this._renderType||2===this._renderType){var s=!!globalThis.WebGL2RenderingContext;if(globalThis.navigator.userAgent.toLowerCase(),hh.browserType===Mo.UC&&(s=!1),gp.canvas=t,2===this._renderType&&A.WebGPUDevice)return new Promise((function(t,e){i._tryInitializeWebGPUDevice(A.WebGPUDevice,r).then((function(e){i._initSwapchain(),t(e)})).catch((function(t){e(t)}))}));s&&A.WebGL2Device&&this._tryInitializeDeviceSync(A.WebGL2Device,r),A.WebGLDevice&&this._tryInitializeDeviceSync(A.WebGLDevice,r),A.EmptyDevice&&this._tryInitializeDeviceSync(A.EmptyDevice,r),this._initSwapchain()}else 4===this._renderType&&A.EmptyDevice&&(this._tryInitializeDeviceSync(A.EmptyDevice,r),this._initSwapchain());return!!this._gfxDevice||(ht(16337),this._renderType=-1,!1)},e._initSwapchain=function(){var t=new od(1,this._canvas),e=oh.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}(),Wp=new Hp;t("aH",Object.freeze({__proto__:null,API:i_,AccessFlagBit:M_,Address:S_,Attribute:Cd,AttributeName:Zd,BarrierType:W_,BindingMappingInfo:ad,BlendFactor:T_,BlendOp:A_,BlendState:Bp,BlendTarget:Dp,Buffer:pp,BufferBarrierInfo:Ld,BufferFlagBit:l_,BufferInfo:ud,BufferTextureCopy:id,BufferUsageBit:u_,BufferViewInfo:ld,ClearFlagBit:H_,Color:rd,ColorAttachment:Id,ColorMask:C_,CommandBuffer:mp,CommandBufferInfo:Wd,CommandBufferType:G_,ComparisonFunc:w_,CullMode:F_,DESCRIPTOR_BUFFER_TYPE:np,DESCRIPTOR_DYNAMIC_TYPE:10,DESCRIPTOR_SAMPLER_TYPE:rp,DESCRIPTOR_STORAGE_BUFFER_TYPE:12,DRAW_INFO_SIZE:28,DefaultResource:yp,DepthStencilAttachment:Md,DepthStencilState:Cp,DescriptorSet:wp,DescriptorSetInfo:Ud,DescriptorSetLayout:xp,DescriptorSetLayoutBinding:Nd,DescriptorSetLayoutInfo:zd,DescriptorType:N_,Device:gp,DeviceCaps:X_,DeviceInfo:hd,DeviceManager:Hp,DeviceOptions:Y_,DispatchInfo:fd,DrawInfo:cd,DynamicStateFlagBit:L_,DynamicStates:Kd,DynamicStencilStates:Jd,Extent:Q_,Feature:r_,Filter:b_,Format:s_,FormatFeatureBit:g_,FormatInfo:Xd,FormatInfos:ip,FormatSize:op,FormatSurfaceSize:hp,FormatType:a_,Framebuffer:bp,FramebufferInfo:Vd,GFXObject:Qd,GeneralBarrier:Fp,GeneralBarrierInfo:Rd,GetTypeSize:lp,IndirectBuffer:_d,InputAssembler:Sp,InputAssemblerInfo:Bd,InputState:Hd,IsPowerOf2:sp,LegacyRenderMode:{AUTO:0,CANVAS:1,WEBGL:2,HEADLESS:3,WEBGPU:4},LoadOp:B_,MarkerInfo:sd,MemoryAccessBit:c_,MemoryStatus:Yd,MemoryUsageBit:f_,ObjectType:t_,Offset:J_,PassType:j_,PipelineBindPoint:E_,PipelineLayout:Tp,PipelineLayoutInfo:Gd,PipelineState:Mp,PipelineStateInfo:Ip,PolygonMode:k_,PrimitiveMode:O_,QueryPoolInfo:qd,QueryType:U_,Queue:Pp,QueueInfo:jd,QueueType:z_,RasterizerState:Ap,Rect:K_,RenderPass:Ep,RenderPassInfo:Od,RenderType:{UNKNOWN:-1,CANVAS:0,WEBGL:1,WEBGPU:2,OPENGL:3,HEADLESS:4},ResolveMode:P_,ResourceRange:kd,SampleCount:y_,SampleType:o_,Sampler:Op,SamplerInfo:md,ShadeModel:R_,Shader:kp,ShaderInfo:Dd,ShaderStage:Ad,ShaderStageFlagBit:D_,Size:q_,Status:e_,StencilFace:V_,StencilOp:x_,StoreOp:I_,SubpassDependency:Ed,SubpassInfo:Pd,SurfaceTransform:n_,Swapchain:vp,SwapchainInfo:od,Texture:Rp,TextureBarrier:Lp,TextureBarrierInfo:Fd,TextureBlit:ed,TextureCopy:td,TextureFlagBit:m_,TextureInfo:dd,TextureSubresLayers:Z_,TextureSubresRange:$_,TextureType:__,TextureUsageBit:p_,TextureViewInfo:pd,Type:h_,Uniform:gd,UniformBlock:yd,UniformInputAttachment:Td,UniformSampler:bd,UniformSamplerTexture:vd,UniformStorageBuffer:xd,UniformStorageImage:wd,UniformTexture:Sd,ViewDimension:d_,Viewport:nd,VsyncMode:v_,alignTo:_p,deviceManager:Wp,formatAlignment:fp,getTypedArrayConstructor:cp}));var jp=new Vn;function qp(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,_=h.m04,d=h.m05,p=h.m06,m=h.m07,g=h.m12,y=h.m13,v=h.m14,b=h.m15;jp.set(n.r/255,n.g/255,n.b/255,n.a/255);for(var S=0,w=0;w<o;++w){var x=s[w],T=x.x,A=x.y,C=f*T+m*A+b;C=C?1/C:1,a[S+0]=(u*T+_*A+g)*C,a[S+1]=(l*T+d*A+y)*C,a[S+2]=(c*T+p*A+v)*C,Vn.toArray(a,jp,S+5),S+=i.floatStride}r.bufferId;for(var D=r.vertexOffset,B=r.meshBuffer,I=r.meshBuffer.iData,M=B.indexOffset,P=0,E=o/4;P<E;P++){var O=D+4*P;I[M++]=O,I[M++]=O+1,I[M++]=O+2,I[M++]=O+1,I[M++]=O+3,I[M++]=O+2}B.indexOffset+=i.indexCount,B.setDirty()}function Xp(t,e){for(var i,n,r,s=t.vertexFormat,a=t.chunk.vb,o=0,h=0;h<s.length;++h){if(i=s[h],(n=ip[i.format]).hasAlpha)if(r=t.floatStride,n.size/n.count==1)for(var u=~~$i(Math.round(255*e),0,255),l=o;l<a.length;l+=r)a[l]=(4294967040&a[l]|u)>>>0;else if(n.size/n.count==4)for(var c=o+3;c<a.length;c+=r)a[c]=e;o+=n.size>>2}}var Yp=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}(),Jp=function(){function t(e,i){this.id=t._pipelineId++,this.name="",this.pipes=[],this.name=e;for(var n=0,r=i.length;n<r;n++)this.pipes.push(i[n])}var e=t.prototype;return e.insert=function(t,e){return e>this.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<n;){var r=(0,e[i])(t);if(r)return t.isFinished=!0,r;++i!==n&&(t.input=t.output,t.output=null)}return t.isFinished=!0,t.output},e.async=function(t){0!==this.pipes.length&&(t.isFinished=!1,this._flow(0,t))},e._flow=function(t,e){var i=this;(0,this.pipes[t])(e,(function(n){n?(e.isFinished=!0,e.dispatch("complete",n)):++t<i.pipes.length?(e.input=e.output,e.output=null,i._flow(t,e)):(e.isFinished=!0,e.dispatch("complete",n,e.output))}))},t}();Jp._pipelineId=0;var Kp=new Yp,Qp=new Yp,Zp=new Yp,$p=new Yp,tm=new Jp("normal load",[]),em=new Jp("fetch",[]),im=new Jp("transform url",[]),nm=new Map,rm={default:{priority:0},preload:{maxConcurrency:6,maxRequestsPerFrame:2,priority:-1},scene:{maxConcurrency:20,maxRequestsPerFrame:20,priority:1},bundle:{maxConcurrency:20,maxRequestsPerFrame:20,priority:2},remote:{maxRetryCount:4}},sm=function(){function t(e){this.id=t._taskId++,this.onComplete=null,this.onProgress=null,this.onError=null,this.source=null,this.output=null,this.input=null,this.progress=null,this.options=null,this.isFinished=!0,this.set(e)}t.create=function(e){var i;return 0!==t._deadPool.length?(i=t._deadPool.pop()).set(e):i=new t(e),i};var e=t.prototype;return e.set=function(t){void 0===t&&(t=Object.create(null)),this.onComplete=t.onComplete||null,this.onProgress=t.onProgress||null,this.onError=t.onError||null,this.source=this.input=t.input,this.output=null,this.progress=t.progress,this.options=t.options||Object.create(null)},e.dispatch=function(t,e,i,n,r){switch(t){case"complete":this.onComplete&&this.onComplete(e,i);break;case"progress":this.onProgress&&this.onProgress(e,i,n,r);break;case"error":this.onError&&this.onError(e,i,n,r);break;default:var s="on"+t[0].toUpperCase()+t.substring(1);"function"==typeof this[s]&&this[s](e,i,n,r)}},e.recycle=function(){t._deadPool.length!==t.MAX_DEAD_NUM&&(this.onComplete=null,this.onProgress=null,this.onError=null,this.source=this.output=this.input=null,this.progress=null,this.options=null,t._deadPool.push(this))},n(t,[{key:"isFinish",get:function(){return this.isFinished},set:function(t){this.isFinished=t}}]),t}();sm.MAX_DEAD_NUM=500,sm._taskId=0,sm._deadPool=[];var am="0123456789abcdef".split(""),om=["","","",""],hm=om.concat(om,"-",om,"-",om,"-",om,"-",om,om,om),um=hm.map((function(t,e){return"-"===t?NaN:e})).filter(Number.isFinite);function lm(t){var e=t.split("@")[0];if(22!==e.length)return t;hm[0]=t[0],hm[1]=t[1];for(var i=2,n=2;i<22;i+=2){var r=Xe[t.charCodeAt(i)],s=Xe[t.charCodeAt(i+1)];hm[um[n++]]=am[r>>2],hm[um[n++]]=am[(3&r)<<2|s>>4],hm[um[n++]]=am[15&s]}return t.replace(e,hm.join(""))}var cm=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;function fm(t){var e=cm.exec(t);return e?e[1]:""}function _m(t,e){(e=e||Object.create(null)).__isNative__=e.isNative,e.nativeExt&&(e.ext=e.nativeExt);var i=$p.find((function(e){return!!e.getAssetInfo(t)}));return i&&(e.bundle=i.name),mm(t,e)}function dm(t){return!!t&&(t instanceof A.SceneAsset||t instanceof A.Scene)}function pm(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 mm(t,e){var i=sm.create({input:t,options:e}),n=[];try{for(var r,s=p(im.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();J(t.message,t.stack)}return i.recycle(),n.length>1?n:n[0]}var gm,ym,vm,bm,Sm,wm,xm=Object.freeze({__proto__:null,decodeUuid:lm,getUrlWithUuid:_m,getUuidFromURL:fm,isScene:dm,normalize:pm,transform:mm}),Tm=uu,Am=tu,Cm=t("d_",Kh("cc.Asset")((ym=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 A.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&&A.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 Q(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=_m(this._uuid,{nativeExt:t,isNative:!0}):this._nativeUrl=_m(this._uuid,{__nativeName__:t,nativeExt:Ho(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}(Bo(mo)),vm=zh(ym.prototype,"_native",[Tm],(function(){return""})),v(ym.prototype,"_nativeAsset",[Am],Object.getOwnPropertyDescriptor(ym.prototype,"_nativeAsset"),ym.prototype),gm=ym))||gm);Cm.prototype.createNode=null,A.Asset=Cm;var Dm=1346981187,Bm=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 Mm(t,e){return t[e]<<8|t[e+1]}function Pm(t){return!!(hh.hasFeature(hh.Feature.IMAGE_BITMAP)&&t instanceof ImageBitmap)}var Em,Om,km,Rm,Fm,Lm,Vm,Nm,zm,Um,Gm,Hm=t("e4",Kh("cc.ImageAsset")((wm=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,Dm,!0),a.setUint32(4,t.length,!0);for(var o=n,h=0;h<t.length;h++){var u=t[h];if(a.setUint32(8+4*h,u.byteLength,!0),u instanceof ArrayBuffer){var l=new Uint8Array(u);e.set(l,o)}else{var c=new Uint8Array(u.buffer,u.byteOffset,u.byteLength);e.set(c,o)}o+=u.byteLength}}catch(t){Y(t)}return e},i.parseCompressedTextures=function(t,e){var n={_data:new Uint8Array(0),_compressed:!0,width:0,height:0,format:0,mipmapLevelDataSize:[]},r=t instanceof ArrayBuffer?t:t.buffer,s=new DataView(r);if(s.getUint32(0,!0)===Dm){var a=s.getUint32(4,!0),o=s.getUint32(8,!0),h=8+4*a;i.parseCompressedTexture(t,0,h,o,e,n);for(var u=h+o,l=1;l<a;l++){var c=s.getUint32(8+4*l,!0);i.parseCompressedTexture(t,l,u,c,e,n),u+=c}}else i.parseCompressedTexture(t,0,0,0,e,n);return n},i.parseCompressedTexture=function(t,e,n,r,s,a){switch(s){case Bm.PVR:i.parsePVRTexture(t,e,n,r,a);break;case Bm.PKM:i.parsePKMTexture(t,e,n,r,a);break;case Bm.ASTC:i.parseASTCTexture(t,e,n,r,a)}},i.parsePVRTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,a=new Int32Array(s,i,13);if(55727696===a[0]){var o=i+a[12]+52,h=n-a.byteLength;if(n>0){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 _=new Uint8Array(s,c,f),d=new Uint8Array(r._data.byteLength+_.byteLength);d.set(r._data),d.set(_,r._data.byteLength),r._data=d,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=Mm(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:Mm(a,12),r.height=e>0?r.height:Mm(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 _=new Uint8Array(s,c,f),d=new Uint8Array(r._data.byteLength+_.byteLength);d.set(r._data),d.set(_,r._data.byteLength),r._data=d,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){Pm(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(Pm(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=Wp.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),_=i.extnames[f]||c[0],d=u.indexOf(_);if(-1!==d&&d<a){var m=c[1]?parseInt(c[1]):this._format;if(!(".astc"!==_||r&&2&r.getFormatFeatures(89)))continue;if(!(".pvr"!==_||r&&2&r.getFormatFeatures(86)))continue;if(!(72!==m&&1026!==m||r&&2&r.getFormatFeatures(72)))continue;if(!(73!==m&&77!==m||r&&2&r.getFormatFeatures(73)))continue;if(".webp"===_&&!hh.hasFeature(hh.Feature.WEBP))continue;a=d,h=_,o=m}}h?(this._setRawAsset(h),this._format=o):at(3121)},e.initDefault=function(e){if(t.prototype.initDefault.call(this,e),i._sharedPlaceHolderCanvas)this.reset(i._sharedPlaceHolderCanvas);else{var n=B.document.createElement("canvas"),r=n.getContext("2d"),s=n.width=n.height=2;r.fillStyle="#ff00ff",r.fillRect(0,0,s,s),this.reset(n),i._sharedPlaceHolderCanvas=n}},e.validate=function(){return!!this.data},n(i,[{key:"_nativeAsset",get:function(){return this._nativeData},set:function(t){t instanceof HTMLElement||Pm(t)||(t.format=t.format||this._format),this.reset(t)}},{key:"data",get:function(){return(t=this._nativeData)instanceof HTMLImageElement||t instanceof HTMLCanvasElement||Pm(t)?this._nativeData:this._nativeData&&this._nativeData._data;var t}},{key:"width",get:function(){return this._nativeData.width||this._width}},{key:"height",get:function(){return this._nativeData.height||this._height}},{key:"format",get:function(){return this._format}},{key:"isCompressed",get:function(){return this._format>=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),wm.extnames=[".png",".jpg",".jpeg",".bmp",".webp",".pvr",".pkm",".astc"],wm._sharedPlaceHolderCanvas=null,v((Sm=wm).prototype,"_nativeAsset",[Gu],Object.getOwnPropertyDescriptor(Sm.prototype,"_nativeAsset"),Sm.prototype),bm=Sm))||bm);A.ImageAsset=Hm,Re(s_);var Wm,jm,qm,Xm=new It("Tex"),Ym=Kh("cc.TextureBase")((Gm=function(t){function e(e){var i;return(i=t.call(this,e)||this)._format=km&&km(),i._minFilter=Rm&&Rm(),i._magFilter=Fm&&Fm(),i._mipFilter=Lm&&Lm(),i._wrapS=Vm&&Vm(),i._wrapT=Nm&&Nm(),i._wrapR=zm&&zm(),i._anisotropy=Um&&Um(),i._width=1,i._height=1,i._samplerInfo=new md,i._gfxSampler=null,i._gfxDevice=null,i._textureHash=0,i._id=Xm.getNewId(),i._gfxDevice=i._getGFXDevice(),i._textureHash=qf(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=A.director.root)&&e.batcher2D&&A.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 Wp.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),Gm.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},Gm.WrapMode={REPEAT:0,CLAMP_TO_EDGE:2,MIRRORED_REPEAT:1,CLAMP_TO_BORDER:3},Gm.Filter={NONE:0,LINEAR:2,NEAREST:1},km=zh((Om=Gm).prototype,"_format",[uu],(function(){return 35})),Rm=zh(Om.prototype,"_minFilter",[uu],(function(){return 2})),Fm=zh(Om.prototype,"_magFilter",[uu],(function(){return 2})),Lm=zh(Om.prototype,"_mipFilter",[uu],(function(){return 0})),Vm=zh(Om.prototype,"_wrapS",[uu],(function(){return 0})),Nm=zh(Om.prototype,"_wrapT",[uu],(function(){return 0})),zm=zh(Om.prototype,"_wrapR",[uu],(function(){return 0})),Um=zh(Om.prototype,"_anisotropy",[uu],(function(){return 0})),Em=Om))||Em;A.TextureBase=Ym;var Jm=t("ea",Kh("cc.Script")(Wm=function(t){function e(e){return t.call(this,e)||this}return s(e,t),e}(Cm))||Wm);A._Script=Jm;var Km=t("eb",Kh("cc.JavaScript")(jm=function(t){function e(e){return t.call(this,e)||this}return s(e,t),e}(Jm))||jm);A._JavaScript=Km;var Qm,Zm,$m,tg,eg,ig,ng,rg=t("ec",Kh("cc.TypeScript")(qm=function(t){function e(e){return t.call(this,e)||this}return s(e,t),e}(Jm))||qm);A._TypeScript=rg;var sg,ag,og,hg,ug,lg,cg,fg,_g,dg,pg,mg=t("ds",Kh("cc.ClickEvent")((Zm=function(){function t(){this.target=$m&&$m(),this.component=tg&&tg(),this._componentId=eg&&eg(),this.handler=ig&&ig(),this.customEventData=ng&&ng()}t.emitEvents=function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];for(var s=0,a=e.length;s<a;s++){var o=e[s];o instanceof t&&o.emit(n)}};var e=t.prototype;return e.emit=function(t){var e=this.target;if(C.isValid(e)){this._genCompIdIfNeeded();var i=C.js.getClassById(this._componentId),n=e.getComponent(i);if(C.isValid(n)){var r=n[this.handler];"function"==typeof r&&(null!=this.customEventData&&""!==this.customEventData&&(t=t.slice()).push(this.customEventData),r.apply(n,t))}}},e._compName2Id=function(t){var e=C.js.getClassByName(t);return C.js.getClassId(e)},e._compId2Name=function(t){var e=C.js.getClassById(t);return C.js.getClassName(e)},e._genCompIdIfNeeded=function(){this._componentId||(this._componentName=this.component,this.component="")},n(t,[{key:"_componentName",get:function(){return this._genCompIdIfNeeded(),this._compId2Name(this._componentId)},set:function(t){this._componentId=this._compName2Id(t)}}]),t}(),$m=zh(Zm.prototype,"target",[uu],(function(){return null})),tg=zh(Zm.prototype,"component",[uu],(function(){return""})),eg=zh(Zm.prototype,"_componentId",[uu],(function(){return""})),ig=zh(Zm.prototype,"handler",[uu],(function(){return""})),ng=zh(Zm.prototype,"customEventData",[uu],(function(){return""})),Qm=Zm))||Qm),gg=new It("Comp"),yg=t("dt",(sg=Kh("cc.Component"),ag=Ou(Jm),sg((fg=function(t){function e(){var e;return(e=t.call(this)||this).node=ug&&ug(),e._enabled=lg&&lg(),e.__prefab=cg&&cg(),e._sceneGetter=null,e._id=gg.getNewId(),e}s(e,t);var i=e.prototype;return i._getRenderScene=function(){return this._sceneGetter?this._sceneGetter():this.node.scene.renderScene},i.addComponent=function(t){return this.node.addComponent(t)},i.getComponent=function(t){return this.node.getComponent(t)},i.getComponents=function(t){return this.node.getComponents(t)},i.getComponentInChildren=function(t){return this.node.getComponentInChildren(t)},i.getComponentsInChildren=function(t){return this.node.getComponentsInChildren(t)},i.destroy=function(){return!!t.prototype.destroy.call(this)&&(this._enabled&&this.node.activeInHierarchy&&C.director._compScheduler.disableComp(this),!0)},i._onPreDestroy=function(){this.unscheduleAllCallbacks(),C.director._nodeActivator.destroyComp(this),this.node._removeComponent(this)},i._instantiate=function(t){return t||(t=C.instantiate._clone(this,this)),t&&(t.node=null),t},i.schedule=function(t,e,i,n){void 0===e&&(e=0),void 0===i&&(i=C.macro.REPEAT_FOREVER),void 0===n&&(n=0),lt(Boolean(t),1619),lt((e=e||0)>=0,1620),i=Number.isNaN(i)?C.macro.REPEAT_FOREVER:i,n=n||0;var r=C.director.getScheduler(),s=r.isTargetPaused(this);r.schedule(t,this,e,i,n,s)},i.scheduleOnce=function(t,e){void 0===e&&(e=0),this.schedule(t,0,0,e)},i.unschedule=function(t){t&&C.director.getScheduler().unschedule(t,this)},i.unscheduleAllCallbacks=function(){C.director.getScheduler().unscheduleAllForTarget(this)},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=C.director._compScheduler;t?e.enableComp(this):e.disableComp(this)}}},{key:"enabledInHierarchy",get:function(){return this._enabled&&this.node&&this.node.activeInHierarchy}},{key:"_isOnLoadCalled",get:function(){return 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}(mo),fg.EventHandler=mg,fg._executionOrder=0,fg._requireComponent=null,fg.system=null,v((hg=fg).prototype,"__scriptAsset",[ag],Object.getOwnPropertyDescriptor(hg.prototype,"__scriptAsset"),hg.prototype),ug=zh(hg.prototype,"node",[uu],(function(){return null})),lg=zh(hg.prototype,"_enabled",[uu],(function(){return!0})),cg=zh(hg.prototype,"__prefab",[uu],(function(){return null})),og=hg))||og));Vt(yg,"_registerEditorProps",(function(t,e){var i=e.requireComponent;i&&(Array.isArray(i)&&(i=i.filter(Boolean)),t._requireComponent=i);var n=e.executionOrder;n&&"number"==typeof n&&(t._executionOrder=n)})),C.Component=yg;var vg=t("dQ",Kh("cc.MissingScript")((dg=function(t){function e(){var e;return(e=t.call(this)||this)._$erialized=pg&&pg(),e}return s(e,t),e.safeFindClass=function(t){var e=_e(t);if(e)return e;A.deserialize.reportMissingClass(t)},e.prototype.onLoad=function(){at(4600,this.node.name)},e}(yg),pg=zh(dg.prototype,"_$erialized",[uu,cu],(function(){return null})),_g=dg))||_g);A._MissingScript=vg;try{var bg=vg.__values__;0!==bg.length&&"_$erialized"===bg[bg.length-1]||(ht(16338),ht(16339,bg.join(", ")))}catch(Es){ht(16340,""+Es)}var Sg=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 wg(t){var e=t;return{chunks:e.chunks,document:e.document}}function xg(t){if(t.length<16)throw new Ag(ft(13102));var e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(1313817411!==e.getUint32(0,!0))throw new Ag(ft(13100));var i=e.getUint32(4,!0);if(1!==i)throw new Ag(ft(13101,i));if(e.getUint32(8,!0)!==e.byteLength)throw new Ag(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=Tg(s);try{a=JSON.parse(o)}catch(t){throw new Ag(t)}for(var h=[];n<e.byteLength;){n%8!=0&&(n+=8-n%8);var u=e.getUint32(n,!0);n+=4,h.push(new Uint8Array(e.buffer,n+e.byteOffset,u)),n+=u}if(n!==e.byteLength)throw new Ag(ft(13102));return new Sg(a,h)}function Tg(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);if("Buffer"in globalThis)return globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString();throw new Error(ft(13104))}var Ag=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(l(Error));function Cg(t,e,i,n,r){if(e instanceof A.ValueType){r||t.push("if(prop){");var s=Ht(e);t.push("s._deserializeFastDefinedObject(o"+i+",prop,"+s+");"),r||t.push("}else o"+i+"=null;")}else t.push("\nif (prop) {\n s._deserializeAndAssignField(o, prop, "+n+");\n} else {\n o"+i+"=null;\n}\n")}!function(){function t(){this._viewOrPaddings=[],this._length=0}var e=t.prototype;e.alignAs=function(t){if(0!==t){var e=this._length%t;if(0!==e){var i=t-e;return this._viewOrPaddings.push(i),this._length+=i,i}}return 0},e.append=function(t){var e=this._length;return this._viewOrPaddings.push(t),this._length+=t.byteLength,e},e.get=function(){var t=new Uint8Array(this._length),e=0;return this._viewOrPaddings.forEach((function(i){"number"==typeof i?e+=i:(t.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),e),e+=i.byteLength)})),t},n(t,[{key:"byteLength",get:function(){return this._length}}])}(),A.internal.parseCCONJson=wg,A.internal.decodeCCONBinary=xg,A.internal.CCON=Sg;var Dg=function(t,e){for(var i=Vi.Attr.getClassAttrs(e),n=e.__values__,r=["var prop;"],s=Eg(e),a=0;a<n.length;a++){var o=n[a],h=void 0,u=void 0;Vi.IDENTIFIER_RE.test(o)?(u='"'+o+'"',h="."+o):h="["+(u=Vi.escapeForJS(o))+"]";var l=h;if(i[o+Pg]){var c=i[o+Pg];l=Vi.IDENTIFIER_RE.test(c)?"."+c:"["+Vi.escapeForJS(c)+"]"}r.push("prop=d"+l+";"),r.push('if(typeof prop!=="undefined"){');var f=Vi.getDefault(i[o+Mg]),_=i[o+Ig];s&&(void 0!==f||_)?Og(f,_)?r.push("o"+h+"=prop;"):Cg(r,f,h,u,!0):(r.push('if(typeof prop!=="object"){o'+h+"=prop;}else{"),Cg(r,f,h,u,!1),r.push("}")),r.push("}")}return(ie(e,A.Node)||ie(e,A.Component))&&r.push("d._id&&(o._id=d._id);"),"_$erialized"===n[n.length-1]&&(r.push("o._$erialized=JSON.parse(JSON.stringify(d));"),r.push("s._fillPlainObject(o._$erialized,d);")),Function("s","o","d","k",r.join(""))},Bg=Vi.Attr.DELIMETER,Ig=Bg+"type",Mg=Bg+"default",Pg=Bg+"formerlySerializedAs";function Eg(t){return He.test(me(t))}function Og(t,e){if(void 0===t)return e instanceof Vi.Attr.PrimitiveType||e===Bi||e===Ii;var i=typeof t;return"string"===i||"number"===i||"boolean"===i}var kg=function(t){function e(){return t.call(this,(function(t){t.clear()}),1)||this}return s(e,t),e}(ge);kg.prototype.get=function(t,e,i,n,r){var s=this._get();return s?(s.reset(t,e,i,n,r),s):new Rg(t,e,i,n,r)};var Rg=function(){function t(t,e,i,n){this.deserializedList=[],this.deserializedData=null,this.result=t,this.customEnv=n,this._classFinder=e,this._reportMissingClass=i,this._onDereferenced=null==e?void 0:e.onDereferenced}var e=t.prototype;return e.reset=function(t,e,i,n){this.result=t,this.customEnv=n,this._classFinder=e,this._reportMissingClass=i,this._onDereferenced=null==e?void 0:e.onDereferenced},e.clear=function(){this.result=null,this.customEnv=null,this.deserializedList.length=0,this.deserializedData=null,this._classFinder=null,this._reportMissingClass=null,this._onDereferenced=null},e.deserialize=function(t){var e,i=!1;t instanceof Sg?(i=!0,e=t.document,t.chunks.length>0&&(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<t.length;n++)"object"==typeof(e=t[n])&&e?this._deserializeAndAssignField(i,e,""+n)&&(i[n]=null):i[n]=e;return i},e._deserializePlainObject=function(t){var e={};return this._fillPlainObject(e,t),e},e._deserializeTypeTaggedObject=function(t,e,i,n){var r=this,s=t.__type__,a=this._classFinder(s,t,i,n);if(!a)return this._classFinder===_e&&this._reportMissingClass(s),null;var o=function(t){var i=new t;return e>=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[Ku]?e._deserialize?e._deserialize(t.content,this):A.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[Ku](r,this._context)},e._deserializeFireClass=function(t,e,i){var n;if(i.hasOwnProperty("__deserialize__"))n=i.__deserialize__;else{n=Dg(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===A.Vec2)return t.x=e.x||0,void(t.y=e.y||0);if(i===A.Vec3)return t.x=e.x||0,t.y=e.y||0,void(t.z=e.z||0);if(i!==A.Color){if(i===A.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<r.length;s++){var a=r[s],o=e[a];void 0!==o||e.hasOwnProperty(a)||(o=Vi.getDefault(n[a+Mg])),"object"!=typeof o?t[a]=o:o?this._deserializeAndAssignField(t,o,a):t[a]=null}}else{t.r=e.r||0,t.g=e.g||0,t.b=e.b||0;var h=e.a;t.a=void 0===h?255:h}},n(t,[{key:"ignoreEditorOnly",get:function(){return this._ignoreEditorOnly}}]),t}();function Fg(t,e,i){var n,r=(i=i||{}).classFinder||_e,s=i.createAssetRefs||hh.platform===ko.EDITOR_CORE,a=i.customEnv,o=i.ignoreEditorOnly,h=null!==(n=i.reportMissingClass)&&void 0!==n?n:A.deserialize.reportMissingClass;e.init();var u=Rg.pool.get(e,r,h,a,o);A.game._isCloning=!0;var l=u.deserialize(t);return A.game._isCloning=!1,Rg.pool.put(u),s&&e.assignAssetsBy((function(t,e){return EditorExtends.serialize.asAsset(t,e.type)})),l}Rg.pool=new kg;var Lg=[ds,ir,Vn,kr,cr,ms,bs,Kr];function Vg(t,e){t.x=e[1],t.y=e[2],t.z=e[3],t.w=e[4]}var Ng=[function(t,e){t.x=e[1],t.y=e[2]},function(t,e){t.x=e[1],t.y=e[2],t.z=e[3]},Vg,Vg,function(t,e){cr.fromUint32(t,e[1])},function(t,e){t.width=e[1],t.height=e[2]},function(t,e){t.x=e[1],t.y=e[2],t.width=e[3],t.height=e[4]},function(t,e){Kr.fromArray(t,e,1)}],zg=1,Ug=0,Gg=0,Hg=1,Wg=2,jg=0,qg=0,Xg=t("dY",function(){function t(){this.uuidObjList=null,this.uuidPropList=null,this.uuidList=null,this.uuidTypeList=[]}var e=t.prototype;return e.init=function(t){t?(this.uuidObjList=t[8],this.uuidPropList=t[9],this.uuidList=t[10]):this.uuidList||(this.uuidList=[],this.uuidObjList=[],this.uuidPropList=[],this.uuidTypeList=[])},e.reset=function(){this.uuidList&&(this.uuidList.length=0,this.uuidObjList.length=0,this.uuidPropList.length=0,this.uuidTypeList.length=0)},e.push=function(t,e,i,n){this.uuidObjList.push(t),this.uuidPropList.push(e),this.uuidList.push(i),this.uuidTypeList.push(n||"")},t}());function Yg(t,e,i){for(var n=t.length-1,r=0,s=3*t[n];r<s;r+=3){var a=t[r],o=e[t[r+2]],h=t[r+1];h>=0?a[i[h]]=o:a[~h]=o}for(;r<n;r+=3){var u=e[t[r]],l=e[t[r+2]],c=t[r+1];c>=0?u[i[c]]=l:u[~c]=l}}function Jg(t,e){for(var i=t[4][e[qg]],n=i[jg],r=new(0,n[Gg]),s=n[Hg],a=n[Wg],o=i[i.length-1],h=jg+1;h<o;++h)r[s[i[h]]]=e[h];for(;h<e.length;++h){var u=s[i[h]],l=n[i[h]+a];(0,ey[l])(t,r,u,e[h])}return r}function Kg(t,e,i){var n=new e;return n._deserialize?n._deserialize(i,t[0]):ht(5303,Ht(e)),n}function Qg(t,e,i,n){n>=0?e[i]=t[5][n]:t[7][3*~n]=e}function Zg(t){return function(e,i,n,r){for(var s=0;s<r.length;++s)t(e,r,s,r[s]);i[n]=r}}function $g(t,e,i,n){e[i]=null,t[8][n]=e}function ty(t,e,i,n){e[i]=Jg(t,n)}Xg.pool=new ge((function(t){t.reset()}),5),Xg.pool.get=function(){return this._get()||new Xg};var ey=new Array(13);function iy(t){var e=t[5],i=t[6],n=i===Ug?0:i.length,r=e[e.length-1],s=e.length-n;"number"!=typeof r?r=0:(r<0&&(r=~r),--s);for(var a=0;a<s;++a)e[a]=Jg(t,e[a]);for(var o=t[3],h=0;h<n;++h,++a){var u=i[h],l=e[a];if(u>=0){var c=o[u];e[a]=Kg(t,c,l)}else(0,ey[u=~u])(t,e,a,l)}return r}function ny(t,e,i){return t||i(e),Object}function ry(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)||ny(s,n,a);return e[i]=r,new r}}(i,n,e));o=ny(s,e,a)}i[n]=o}function sy(t,e,i,n){for(var r=i||_e,s=t[3],a=0;a<s.length;++a){var o=s[a];"string"!=typeof o?ry(r,o[Gg],o,Gg,e,i,n):ry(r,o,s,a,e,i,n)}}function ay(t){var e=t[4];if(e)for(var i=t[3],n=0;n<e.length;++n){var r=e[n];r[jg]=i[r[jg]]}}function oy(t){for(var e=t[5],i=t[2],n=t[1],r=t[8],s=t[9],a=t[10],o=0;o<r.length;++o){var h=r[o];"number"==typeof h&&(r[o]=e[h]);var u=s[o];"number"==typeof u&&(u=u>=0?i[u]:~u,s[o]=u);var l=a[o];"number"==typeof l&&(a[o]=n[l])}}function hy(t){if(Array.isArray(t)){var e=t[0];return"number"==typeof e||e instanceof cy}return!1}function uy(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<zg)throw new Error(ft(5304,r));var a,o=i;o._version=r,o.result=e,t[0]=o,s||(sy(t,!1,i.classFinder,null!==(a=i.reportMissingClass)&&void 0!==a?a:ly.reportMissingClass),ay(t))}function ly(t,e,i){"string"==typeof t&&(t=JSON.parse(t));var n,r=!1;if(e||(e=Xg.pool.get(),r=!0),hy(t)){uy(t,e,i);var s=t;A.game._isCloning=!0;var a=s[5],o=iy(s);A.game._isCloning=!1,s[7]&&Yg(s[7],a,s[2]),oy(s),n=a[o]}else n=Fg(t,e,i);return r&&Xg.pool.put(e),n}ey[0]=function(t,e,i,n){e[i]=n},ey[1]=Qg,ey[2]=Zg(Qg),ey[3]=Zg($g),ey[4]=ty,ey[5]=function(t,e,i,n){var r=n[0],s=e[i];(0,Ng[r])(s,n)},ey[6]=$g,ey[7]=function(t,e,i,n){e[i].set(n)},ey[8]=function(t,e,i,n){var r=n[0],s=new Lg[r];(0,Ng[r])(s,n),e[i]=s},ey[9]=Zg(ty),ey[10]=function(t,e,i,n){var r=t[3][n[0]];e[i]=Kg(t,r,n[1])},ey[11]=function(t,e,i,n){var r=n[0];e[i]=r;for(var s=1;s<n.length;s+=3){var a=n[s],o=n[s+1],h=n[s+2];(0,ey[o])(t,r,a,h)}},ey[12]=function(t,e,i,n){for(var r=n[0],s=0;s<r.length;++s){var a=r[s],o=n[s+1];0!==o&&(0,ey[o])(t,r,s,a)}e[i]=r},ly.Details=Xg,ly.reportMissingClass=function(t){ht(5302,t)};var cy=function(t){this.preprocessed=!0,this.version=t};function fy(t,e){if(t[0]<zg)throw new Error(ft(5304,t[0]));sy(t,!0,e,ly.reportMissingClass),ay(t);for(var i=new cy(t[0]),n=t[1],r=t[2],s=t[3],a=t[4],o=t[5],h=0;h<o.length;++h)o[h].unshift(i,n,r,s,a);return o}function _y(t,e,i){return[zg,Ug,Ug,[t],Ug,i?[e,-1]:[e],[0],Ug,[],[],[]]}function dy(t){return i=(e=t)[1],e[10].map((function(t){return i[t]}));var e,i}A.deserialize=ly;var py=new WeakMap,my=new WeakSet,gy=new WeakSet;function yy(t,e){var i;i=vg.safeFindClass;var n,r=Xg.pool.get();try{n=ly(t,r,{classFinder:i,customEnv:e})}catch(t){throw J(t),Xg.pool.put(r),t}n._uuid=e.__uuid__||"";for(var s=r.uuidList,a=r.uuidObjList,o=r.uuidPropList,h=r.uuidTypeList||[],u=[],l=0;l<s.length;l++){var c=s[l];u[l]={uuid:lm(c),owner:a[l],prop:o[l],type:_e(h[l])}}return py.set(n,u),n._native&&my.add(n),Xg.pool.put(r),n}var vy=function(){function t(){this._depends=new Yp}var e=t.prototype;return e.init=function(){this._depends.clear()},e.getNativeDep=function(t){var e=this._depends.get(t);return e&&e.nativeDep?r({},e.nativeDep):null},e.getDeps=function(t){return this._depends.has(t)?this._depends.get(t).deps:[]},e.getDepsRecursively=function(t){var e=Object.create(null),i=[];return this._descend(t,e,i),i},e.remove=function(t){this._depends.remove(t)},e.parse=function(t,e){var i,n,r=null;if(Array.isArray(e)||e.__type__||e instanceof Sg){if(this._depends.has(t))return this._depends.get(t);if(!Array.isArray(e)||"number"==typeof(n=(i=e[5])[i.length-1])&&n<0)try{var s=yy(e,{__uuid__:t});(r=this._parseDepsFromAsset(s)).nativeDep&&(r.nativeDep.uuid=t),Zp.add(t+"@import",s)}catch(e){Qp.remove(t+"@import"),r={deps:[]}}else r={deps:this._parseDepsFromJson(e)}}else{if(this._depends.has(t)&&(r=this._depends.get(t)).parsedFromExistAsset)return r;r=this._parseDepsFromAsset(e)}return this._depends.add(t,r),r},e._parseDepsFromAsset=function(t){for(var e={deps:[],parsedFromExistAsset:!0},i=py.get(t),n=0,r=i.length;n<r;n++)e.deps.push(i[n].uuid);return my.has(t)&&(e.nativeDep=t._nativeDep),e},e._parseDepsFromJson=function(t){var e=dy(t);return e.forEach((function(t,i){return e[i]=lm(t)})),e},e._descend=function(t,e,i){for(var n=this.getDeps(t),r=0;r<n.length;r++){var s=n[r];e[s]||(e[s]=!0,i.push(s),this._descend(s,e,i))}},n(t,null,[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}();vy._instance=void 0;var by,Sy=vy.instance,wy=[new id];function xy(t,e){for(var i=Math.max(t,e),n=0;i;)i>>=1,n++;return n}function Ty(t){return t&&!(t&t-1)}function Ay(t,e,i){return!(6===t.gfxAPI)||Ty(e)&&Ty(i)}var Cy,Dy,By,Iy,My,Py=Kh("cc.SimpleTexture")(by=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=wy[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,wy):n.copyTexImagesToTexture([t],this._gfxTexture,wy)}}},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=Sy.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&&Ay(t,this._width,this._height)&&(this._mipmapLevel=xy(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._maxLevel<this._mipmapLevel?this._maxLevel:this._mipmapLevel-1,i=this._getGfxTextureViewCreateInfo({texture:this._gfxTexture,format:this._getGFXFormat(),baseLevel:this._baseLevel,levelCount:e-this._baseLevel+1});return i?t.createTexture(i):null},i._tryDestroyTexture=function(){this._gfxTexture&&(this._gfxTexture.destroy(),this._gfxTexture=null)},i._tryDestroyTextureView=function(){this._gfxTextureView&&(this._gfxTextureView.destroy(),this._gfxTextureView=null)},n(e,[{key:"mipmapLevel",get:function(){return this._mipmapLevel}}]),e}(Ym))||by;A.SimpleTexture=Py;var Ey=t("e5",(Cy=Kh("cc.Texture2D"),Dy=Ou([Hm]),Cy((Iy=function(t){function e(e){var i;return(i=t.call(this,e)||this)._mipmaps=My&&My(),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];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;++n){var r=t+n;this._assignImage(this._generatedMipmaps[r],r)}},i.getHtmlElementObj=function(){return this._mipmaps[0]&&this._mipmaps[0].data instanceof HTMLElement?this._mipmaps[0].data:null},i.destroy=function(){return this._mipmaps=[],this._generatedMipmaps=[],t.prototype.destroy.call(this)},i.description=function(){return"<cc.Texture2D | Name = "+(this._mipmaps[0]?this._mipmaps[0].url:"")+" | Dimension = "+this.width+" x "+this.height+">"},i.releaseTexture=function(){this.destroy()},i._serialize=function(){return null},i._deserialize=function(e,i){var n=e;t.prototype._deserialize.call(this,n.base,i),this._mipmaps=new Array(n.mipmaps.length);for(var r=0;r<n.mipmaps.length;++r)if(this._mipmaps[r]=new Hm,n.mipmaps[r]){var s=n.mipmaps[r];i.result.push(this._mipmaps,""+r,s,me(Hm))}},i._getGfxTextureCreateInfo=function(t){var e=new dd(1);return e.width=this._width,e.height=this._height,Object.assign(e,t),e},i._getGfxTextureViewCreateInfo=function(t){var e=new pd;return e.type=1,Object.assign(e,t),e},i.initDefault=function(e){t.prototype.initDefault.call(this,e);var i=new Hm;i.initDefault(),this.image=i},i.validate=function(){return this.mipmaps&&0!==this.mipmaps.length},n(e,[{key:"mipmaps",get:function(){return this._mipmaps},set:function(t){this._mipmaps=t;var e=[];if(1===t.length){var i=t[0];e.push.apply(e,i.extractMipmaps())}else if(t.length>1)for(var n=0;n<t.length;++n){var r=t[n];e.push(r.extractMipmap0())}this._setMipmapParams(e)}},{key:"image",get:function(){return 0===this._mipmaps.length?null:this._mipmaps[0]},set:function(t){this.mipmaps=t?[t]:[]}}]),e}(Py),My=zh(Iy.prototype,"_mipmaps",[Dy],(function(){return[]})),By=Iy))||By));function Oy(t,e,i,n){t.drawTextureAt(e,i,n)}A.Texture2D=Ey;var ky=t("A",function(){function t(t,e){this._innerTextureInfos={},this._innerSpriteFrames=[],this._count=0;var i=new Ry;i.initWithSize(t,e),this._texture=i,this._width=t,this._height=e,this._x=2,this._y=2,this._nextY=2}var e=t.prototype;return e.insertSpriteFrame=function(t){var e=t.rect,i=t.texture,n=this._innerTextureInfos[i.getId()],r=e.x,s=e.y;if(n)r+=n.x,s+=n.y;else{var a=i.width,o=i.height;if(this._x+a+2>this._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;A.internal.dynamicAtlasManager.textureBleeding&&((a<=8||o<=8)&&(Oy(h,u,this._x-1,this._y-1),Oy(h,u,this._x-1,this._y+1),Oy(h,u,this._x+1,this._y-1),Oy(h,u,this._x+1,this._y+1)),Oy(h,u,this._x-1,this._y),Oy(h,u,this._x+1,this._y),Oy(h,u,this._x,this._y-1),Oy(h,u,this._x,this._y+1)),Oy(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){we(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;e<i;e++){var n=t[e];n.isValid&&n._resetDynamicAtlasFrame()}this._innerSpriteFrames.length=0,this._innerTextureInfos={}},e.destroy=function(){this.reset(),this._texture.destroy()},t}()),Ry=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 id;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}(Ey),Fy={NONE:0,IGNORE_RAYCAST:1<<20,GIZMOS:1<<21,EDITOR:1<<22,UI_3D:1<<23,SCENE_GIZMO:1<<24,UI_2D:1<<25,PROFILER:1<<28,DEFAULT:1<<30,ALL:4294967295},Ly=t("dq",function(){function t(){}return t.init=function(){var e=ze.querySettings("engine","customLayers");if(e)for(var i=0;i<e.length;i++){var n=e[i];t.addLayer(n.name,n.bit)}},t.makeMaskInclude=function(t){return t.reduce((function(t,e){return t|e}),0)},t.makeMaskExclude=function(e){return~t.makeMaskInclude(e)},t.addLayer=function(e,i){if(void 0!==i)if(i>19||i<0)at(16365);else{var n=1<<i;t.Enum[e],ft(2104,e),t.Enum[e]=n,Vt(t.Enum,String(n),e),t.BitMask[e]=n,Vt(t.BitMask,String(n),e),Ie.update(t.BitMask),Ee.update(t.Enum)}else at(16364)},t.deleteLayer=function(e){if(e>19||e<0)at(16366);else{var i=1<<e;delete t.Enum[t.Enum[i]],delete t.Enum[i],delete t.BitMask[t.BitMask[i]],delete t.BitMask[i],Ie.update(t.BitMask),Ee.update(t.Enum)}},t.nameToLayer=function(e){return void 0===e?(at(16367),-1):E(t.Enum[e])},t.layerToName=function(e){return e>31||e<0?(at(16368),""):t.Enum[1<<e]},t}());Ly.Enum=Ee(Fy),Ly.BitMask=Ie(r({},Fy)),C.Layers=Ly;var Vy=function(){var t=e.prototype;function e(t){this._uiComp=null,this._opacity=1,this._localOpacity=1,this.colorDirty=!0,this._uiTransformComp=null,this._uiSkewComp=null,this._node=t}return t.setOpacity=function(t){this._opacity=t},t.applyOpacity=function(t){this._opacity=this._localOpacity*t},e.markOpacityTree=function(){},n(e,[{key:"uiTransformComp",get:function(){return this._uiTransformComp||(this._uiTransformComp=this._node.getComponent("cc.UITransform")),this._uiTransformComp},set:function(t){this._uiTransformComp=t}},{key:"uiComp",get:function(){return this._uiComp},set:function(t){this._uiComp&&t?at(12002):this._uiComp=t}},{key:"opacity",get:function(){return this._opacity}},{key:"localOpacity",get:function(){return this._localOpacity},set:function(t){this._localOpacity=t,this.colorDirty=!0}}]),e}();C.GAME_VIEW;var Ny=t("dw",{LOCAL:0,WORLD:1}),zy=t("dx",{NONE:0,POSITION:1,ROTATION:2,SCALE:4,SKEW:8,RS:6,RSS:14,TRS:7,TRS_MASK:-8});C.internal.TransformBit=zy;var Uy=t("dy",Ee({Static:0,Stationary:1,Movable:2})),Gy=t("dz",{TOUCH_START:"touch-start",TOUCH_MOVE:"touch-move",TOUCH_END:"touch-end",TOUCH_CANCEL:"touch-cancel",MOUSE_DOWN:"mouse-down",MOUSE_MOVE:"mouse-move",MOUSE_UP:"mouse-up",MOUSE_WHEEL:"mouse-wheel",MOUSE_ENTER:"mouse-enter",MOUSE_LEAVE:"mouse-leave",KEY_DOWN:"keydown",KEY_UP:"keyup",DEVICEMOTION:"devicemotion",TRANSFORM_CHANGED:"transform-changed",MOBILITY_CHANGED:"mobility-changed",SCENE_CHANGED_FOR_PERSISTS:"scene-changed-for-persists",SIZE_CHANGED:"size-changed",ANCHOR_CHANGED:"anchor-changed",COLOR_CHANGED:"color-changed",CHILD_ADDED:"child-added",CHILD_REMOVED:"child-removed",PARENT_CHANGED:"parent-changed",NODE_DESTROYED:"node-destroyed",LAYER_CHANGED:"layer-changed",SIBLING_ORDER_CHANGED:"sibling-order-changed",CHILDREN_ORDER_CHANGED:"sibling-order-changed",ACTIVE_IN_HIERARCHY_CHANGED:"active-in-hierarchy-changed",COMPONENT_ADDED:"component-added",COMPONENT_REMOVED:"component-removed",LIGHT_PROBE_CHANGED:"light-probe-changed",LIGHT_PROBE_BAKING_CHANGED:"light-probe-baking-changed",ACTIVE_CHANGED:"active-changed"}),Hy=t("eo",function(){function t(t,e){this.target=null,this.currentTarget=null,this.eventPhase=0,this.propagationStopped=!1,this.propagationImmediateStopped=!1,this.type=t,this.bubbles=!!e}var e=t.prototype;return e.unuse=function(){this.type=t.NO_TYPE,this.target=null,this.currentTarget=null,this.eventPhase=t.NONE,this.propagationStopped=!1,this.propagationImmediateStopped=!1},e.reuse=function(t,e){this.type=t,this.bubbles=e||!1},e.isStopped=function(){return this.propagationStopped||this.propagationImmediateStopped},e.getCurrentTarget=function(){return this.currentTarget},e.getType=function(){return this.type},t}());Hy.NO_TYPE="no_type",Hy.TOUCH="touch",Hy.MOUSE="mouse",Hy.KEYBOARD="keyboard",Hy.ACCELERATION="acceleration",Hy.NONE=0,Hy.CAPTURING_PHASE=1,Hy.AT_TARGET=2,Hy.BUBBLING_PHASE=3,A.Event=Hy;var Wy=t("ep",function(t){function e(e,i){var n;return(n=t.call(this,"devicemotion",i)||this).acc=e,n}return s(e,t),e}(Hy));Hy.EventAcceleration=Wy;var jy=t("eq",function(t){function e(e,i,n){var r;return"boolean"==typeof i&&(i=i?"keydown":"keyup"),(r=t.call(this,i,n)||this).rawEvent=void 0,r._isPressed="keyup"!==i,"number"==typeof e?r.keyCode=e:(r.keyCode=e.keyCode,r.rawEvent=e),r.windowId=0,r}return s(e,t),n(e,[{key:"isPressed",get:function(){return this._isPressed}}]),e}(Hy));Hy.EventKeyboard=jy;var qy=t("er",function(t){function e(i,n,r,s){var a;return(a=t.call(this,i,n)||this).movementX=0,a.movementY=0,a.windowId=0,a.preventSwallow=!1,a._button=e.BUTTON_MISSING,a._x=0,a._y=0,a._prevX=0,a._prevY=0,a._scrollX=0,a._scrollY=0,a._eventType=i,r&&(a._prevX=r.x,a._prevY=r.y),a.windowId=null!=s?s:a.windowId,a}s(e,t);var i=e.prototype;return i.setScrollData=function(t,e){this._scrollX=t,this._scrollY=e},i.getScrollX=function(){return this._scrollX},i.getScrollY=function(){return this._scrollY},i.setLocation=function(t,e){this._x=t,this._y=e},i.getLocation=function(t){return t||(t=new ds),ds.set(t,this._x,this._y),t},i.getLocationInView=function(t){return t||(t=new ds),ds.set(t,this._x,A.view._designResolutionSize.height-this._y),t},i.getUILocation=function(t){return t||(t=new ds),ds.set(t,this._x,this._y),A.view._convertToUISpace(t),t},i.getPreviousLocation=function(t){return t||(t=new ds),ds.set(t,this._prevX,this._prevY),t},i.getUIPreviousLocation=function(t){return t||(t=new ds),ds.set(t,this._prevX,this._prevY),A.view._convertToUISpace(t),t},i.getDelta=function(t){return t||(t=new ds),ds.set(t,this._x-this._prevX,this._y-this._prevY),t},i.getDeltaX=function(){return this._x-this._prevX},i.getDeltaY=function(){return this._y-this._prevY},i.getUIDelta=function(t){t||(t=new ds);var e=A.view;return ds.set(t,(this._x-this._prevX)/e.getScaleX(),(this._y-this._prevY)/e.getScaleY()),t},i.getUIDeltaX=function(){return(this._x-this._prevX)/A.view.getScaleX()},i.getUIDeltaY=function(){return(this._y-this._prevY)/A.view.getScaleY()},i.setButton=function(t){this._button=t},i.getButton=function(){return this._button},i.getLocationX=function(){return this._x},i.getLocationY=function(){return this._y},i.getUILocationX=function(){var t=A.view,e=t.getViewportRect();return(this._x-e.x)/t.getScaleX()},i.getUILocationY=function(){var t=A.view,e=t.getViewportRect();return(this._y-e.y)/t.getScaleY()},n(e,[{key:"eventType",get:function(){return this._eventType}}]),e}(Hy));qy.BUTTON_MISSING=-1,qy.BUTTON_LEFT=0,qy.BUTTON_RIGHT=2,qy.BUTTON_MIDDLE=1,qy.BUTTON_4=3,qy.BUTTON_5=4,qy.BUTTON_6=5,qy.BUTTON_7=6,qy.BUTTON_8=7,Hy.EventMouse=qy;var Xy=new ds,Yy=t("es",function(t){function e(e,i,n,r){var s;return void 0===r&&(r=[]),(s=t.call(this,n,i)||this).touch=null,s.simulate=!1,s.windowId=0,s.preventSwallow=!1,s._eventCode=n,s._touches=e||[],s._allTouches=r,s}s(e,t);var i=e.prototype;return i.getEventCode=function(){return this._eventCode},i.getTouches=function(){return this._touches},i.getAllTouches=function(){return this._allTouches},i.setLocation=function(t,e){this.touch&&this.touch.setTouchInfo(this.touch.getID(),t,e)},i.getLocation=function(t){return this.touch?this.touch.getLocation(t):new ds},i.getUILocation=function(t){return this.touch?this.touch.getUILocation(t):new ds},i.getLocationInView=function(t){return this.touch?this.touch.getLocationInView(t):new ds},i.getPreviousLocation=function(t){return this.touch?this.touch.getPreviousLocation(t):new ds},i.getStartLocation=function(t){return this.touch?this.touch.getStartLocation(t):new ds},i.getUIStartLocation=function(t){return this.touch?this.touch.getUIStartLocation(t):new ds},i.getID=function(){return this.touch?this.touch.getID():null},i.getDelta=function(t){return this.touch?this.touch.getDelta(t):new ds},i.getUIDelta=function(t){return this.touch?this.touch.getUIDelta(t):new ds},i.getDeltaX=function(){return this.touch?this.touch.getDelta(Xy).x:0},i.getDeltaY=function(){return this.touch?this.touch.getDelta(Xy).y:0},i.getLocationX=function(){return this.touch?this.touch.getLocationX():0},i.getLocationY=function(){return this.touch?this.touch.getLocationY():0},e}(Hy));Yy.MAX_TOUCHES=5,Hy.EventTouch=Yy;var Jy=t("et",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).gamepad=i,n}return s(e,t),e}(Hy)),Ky=t("eu",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).handleInputDevice=i,n}return s(e,t),e}(Hy)),Qy=t("ev",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).hmdInputDevice=i,n}return s(e,t),e}(Hy)),Zy=(t("ew",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).handheldInputDevice=i,n}return s(e,t),e}(Hy)),t("ex",(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),this.x=t,this.y=e,this.z=i,this.timestamp=n}))),$y=t("en",{TOUCH_START:"touch-start",TOUCH_MOVE:"touch-move",TOUCH_END:"touch-end",TOUCH_CANCEL:"touch-cancel",MOUSE_DOWN:"mouse-down",MOUSE_MOVE:"mouse-move",MOUSE_UP:"mouse-up",MOUSE_WHEEL:"mouse-wheel",MOUSE_ENTER:"mouse-enter",MOUSE_LEAVE:"mouse-leave",KEY_DOWN:"keydown",KEY_UP:"keyup",DEVICEMOTION:"devicemotion",TRANSFORM_CHANGED:"transform-changed",SCENE_CHANGED_FOR_PERSISTS:"scene-changed-for-persists",SIZE_CHANGED:"size-changed",ANCHOR_CHANGED:"anchor-changed",COLOR_CHANGED:"color-changed",CHILD_ADDED:"child-added",CHILD_REMOVED:"child-removed",PARENT_CHANGED:"parent-changed",NODE_DESTROYED:"node-destroyed",LAYER_CHANGED:"layer-changed",SIBLING_ORDER_CHANGED:"sibling-order-changed"});A.SystemEventType=$y,t("ey",{NONE:0,MOBILE_BACK:6,BACKSPACE:8,TAB:9,ENTER:13,SHIFT_LEFT:16,CTRL_LEFT:17,ALT_LEFT:18,PAUSE:19,CAPS_LOCK:20,ESCAPE:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40,INSERT:45,DELETE:46,DIGIT_0:48,DIGIT_1:49,DIGIT_2:50,DIGIT_3:51,DIGIT_4:52,DIGIT_5:53,DIGIT_6:54,DIGIT_7:55,DIGIT_8:56,DIGIT_9:57,KEY_A:65,KEY_B:66,KEY_C:67,KEY_D:68,KEY_E:69,KEY_F:70,KEY_G:71,KEY_H:72,KEY_I:73,KEY_J:74,KEY_K:75,KEY_L:76,KEY_M:77,KEY_N:78,KEY_O:79,KEY_P:80,KEY_Q:81,KEY_R:82,KEY_S:83,KEY_T:84,KEY_U:85,KEY_V:86,KEY_W:87,KEY_X:88,KEY_Y:89,KEY_Z:90,NUM_0:96,NUM_1:97,NUM_2:98,NUM_3:99,NUM_4:100,NUM_5:101,NUM_6:102,NUM_7:103,NUM_8:104,NUM_9:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_SUBTRACT:109,NUM_DECIMAL:110,NUM_DIVIDE:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUM_LOCK:144,SCROLL_LOCK:145,SEMICOLON:186,EQUAL:187,COMMA:188,DASH:189,PERIOD:190,SLASH:191,BACK_QUOTE:192,BRACKET_LEFT:219,BACKSLASH:220,BRACKET_RIGHT:221,QUOTE:222,SHIFT_RIGHT:2e3,CTRL_RIGHT:2001,ALT_RIGHT:2002,NUM_ENTER:2003});var tv=new ds,ev=t("ez",function(){function t(t,e,i){void 0===i&&(i=0),this._point=new ds,this._prevPoint=new ds,this._lastModified=0,this._id=0,this._startPoint=new ds,this._startPointCaptured=!1,this.setTouchInfo(i,t,e)}var e=t.prototype;return e.getLocation=function(t){return t||(t=new ds),t.set(this._point.x,this._point.y),t},e.getLocationX=function(){return this._point.x},e.getLocationY=function(){return this._point.y},e.getUILocation=function(t){return t||(t=new ds),t.set(this._point.x,this._point.y),A.view._convertToUISpace(t),t},e.getUILocationX=function(){var t=A.view,e=t.getViewportRect();return(this._point.x-e.x)/t.getScaleX()},e.getUILocationY=function(){var t=A.view,e=t.getViewportRect();return(this._point.y-e.y)/t.getScaleY()},e.getPreviousLocation=function(t){return t||(t=new ds),t.set(this._prevPoint.x,this._prevPoint.y),t},e.getUIPreviousLocation=function(t){return t||(t=new ds),t.set(this._prevPoint.x,this._prevPoint.y),A.view._convertToUISpace(t),t},e.getStartLocation=function(t){return t||(t=new ds),t.set(this._startPoint.x,this._startPoint.y),t},e.getUIStartLocation=function(t){return t||(t=new ds),t.set(this._startPoint.x,this._startPoint.y),A.view._convertToUISpace(t),t},e.getDelta=function(t){return t||(t=new ds),t.set(this._point),t.subtract(this._prevPoint),t},e.getUIDelta=function(t){t||(t=new ds),tv.set(this._point),tv.subtract(this._prevPoint);var e=A.view;return t.set(e.getScaleX(),e.getScaleY()),ds.divide(t,tv,t),t},e.getLocationInView=function(t){return t||(t=new ds),t.set(this._point.x,A.view._designResolutionSize.height-this._point.y),t},e.getPreviousLocationInView=function(t){return t||(t=new ds),t.set(this._prevPoint.x,A.view._designResolutionSize.height-this._prevPoint.y),t},e.getStartLocationInView=function(t){return t||(t=new ds),t.set(this._startPoint.x,A.view._designResolutionSize.height-this._startPoint.y),t},e.getID=function(){return this._id},e.setTouchInfo=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this._prevPoint=this._point,this._point=new ds(e||0,i||0),this._id=t,this._startPointCaptured||(this._startPoint=new ds(this._point),this._startPointCaptured=!0)},e.setPoint=function(t,e){"object"==typeof t?(this._point.x=t.x,this._point.y=t.y):(this._point.x=t||0,this._point.y=e||0),this._lastModified=A.game.frameStartTime},e.setPrevPoint=function(t,e){this._prevPoint="object"==typeof t?new ds(t.x,t.y):new ds(t||0,e||0),this._lastModified=A.game.frameStartTime},e.clone=function(){var e=this.getID();this.getStartLocation(tv);var i=new t(tv.x,tv.y,e);return this.getLocation(tv),i.setPoint(tv.x,tv.y),this.getPreviousLocation(tv),i.setPrevPoint(tv),i},n(t,[{key:"lastModified",get:function(){return this._lastModified}}]),t}());A.Touch=ev;var iv=new ho((function(){return new Array(16)}),3),nv=null,rv=new ds,sv=["touch-start","touch-move","touch-end","touch-cancel"],av=["mouse-down","mouse-enter","mouse-move","mouse-leave","mouse-up","mouse-wheel"],ov=new Do,hv=function(){function t(t){this.claimedTouchIdList=[],this.maskList=null,this.cachedCameraPriority=0,this.previousMouseIn=!1,this.bubblingTarget=null,this.capturingTarget=null,this.shouldHandleEventMouse=!1,this.shouldHandleEventTouch=!1,this._dispatchingTouch=null,this._isEnabled=!1,this._isMouseLeaveWindow=!1,this._node=t}var e=t.prototype;return e.setEnabled=function(t,e){if(void 0===e&&(e=!1),this._isEnabled!==t){this._isEnabled=t;var i=this.node.children;if(t&&this._attachMask(),ov.emit(2),e&&i.length>0)for(var n=0;n<i.length;++n)i[n].eventProcessor.setEnabled(t,!0)}},e.reattach=function(){this.node.walk((function(e){var i=e.eventProcessor,n=i._searchComponentsInParent(t._maskComp);i.maskList=n}))},e.destroy=function(){if(nv===this._node&&(nv=null),this.capturingTarget&&this.capturingTarget.clear(),this.bubblingTarget&&this.bubblingTarget.clear(),ov.emit(1,this),this._dispatchingTouch){var t=new Yy([this._dispatchingTouch],!0,"touch-cancel");t.touch=this._dispatchingTouch,this.dispatchEvent(t),this._dispatchingTouch=null}},e.on=function(t,e,i,n){var r,s;return this._tryEmittingAddEvent(t),((n=!!n)?null!==(r=this.capturingTarget)&&void 0!==r?r:this.capturingTarget=this._newCallbacksInvoker():null!==(s=this.bubblingTarget)&&void 0!==s?s:this.bubblingTarget=this._newCallbacksInvoker()).on(t,e,i),e},e.once=function(t,e,i,n){var r,s;return this._tryEmittingAddEvent(t),((n=!!n)?null!==(r=this.capturingTarget)&&void 0!==r?r:this.capturingTarget=this._newCallbacksInvoker():null!==(s=this.bubblingTarget)&&void 0!==s?s:this.bubblingTarget=this._newCallbacksInvoker()).on(t,e,i,!0),e},e.off=function(t,e,i,n){var r;null==(r=(n=!!n)?this.capturingTarget:this.bubblingTarget)||r.off(t,e,i)},e.targetOff=function(t){var e,i;null==(e=this.capturingTarget)||e.removeAll(t),null==(i=this.bubblingTarget)||i.removeAll(t),this.shouldHandleEventTouch&&!this._hasTouchListeners()&&(this.shouldHandleEventTouch=!1),this.shouldHandleEventMouse&&!this._hasMouseListeners()&&(this.shouldHandleEventMouse=!1),this._hasPointerListeners()||ov.emit(1,this)},e.emit=function(t,e,i,n,r,s){var a;null==(a=this.bubblingTarget)||a.emit(t,e,i,n,r,s)},e.dispatchEvent=function(t){var e,i=this.node,n=0;t.target=i;var r=iv.alloc();for(r.length=0,this.getCapturingTargets(t.type,r),t.eventPhase=1,n=r.length-1;n>=0;--n)if((e=r[n]).eventProcessor.capturingTarget&&(t.currentTarget=e,e.eventProcessor.capturingTarget.emit(t.type,t,r),t.propagationStopped))return void iv.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;n<r.length;++n)if((e=r[n]).eventProcessor.bubblingTarget&&(t.currentTarget=e,e.eventProcessor.bubblingTarget.emit(t.type,t),t.propagationStopped))return void iv.free(r);iv.free(r)},e.hasEventListener=function(t,e,i){var n=!1;return this.bubblingTarget&&(n=this.bubblingTarget.hasEventListener(t,e,i)),!n&&this.capturingTarget&&(n=this.capturingTarget.hasEventListener(t,e,i)),n},e.getCapturingTargets=function(t,e){for(var i=this._node.parent;i;){var n;null!=(n=i.eventProcessor.capturingTarget)&&n.hasEventListener(t)&&e.push(i),i=i.parent}},e.getBubblingTargets=function(t,e){for(var i=this._node.parent;i;){var n;null!=(n=i.eventProcessor.bubblingTarget)&&n.hasEventListener(t)&&e.push(i),i=i.parent}},e.onUpdatingSiblingIndex=function(){ov.emit(2)},e._searchComponentsInParent=function(t){var e=this.node;if(t){for(var i=0,n=[],r=e;r&&A.Node.isNode(r);r=r.parent,++i){var s=r.getComponent(t);if(s){var a={index:i,comp:s};n?n.push(a):n=[a]}}return n.length>0?n:null}return null},e._attachMask=function(){this.maskList=this._searchComponentsInParent(t._maskComp)},e._isTouchEvent=function(t){return-1!==sv.indexOf(t)},e._isMouseEvent=function(t){return-1!==av.indexOf(t)},e._hasTouchListeners=function(){for(var t=0;t<sv.length;++t){var e=sv[t];if(this.hasEventListener(e))return!0}return!1},e._hasMouseListeners=function(){for(var t=0;t<av.length;++t){var e=av[t];if(this.hasEventListener(e))return!0}return!1},e._hasPointerListeners=function(){return!!this._hasTouchListeners()||this._hasMouseListeners()},e._tryEmittingAddEvent=function(t){var e=this._isTouchEvent(t),i=this._isMouseEvent(t);e?this.shouldHandleEventTouch=!0:i&&(this.shouldHandleEventMouse=!0),!e&&!i||this._hasPointerListeners()||ov.emit(0,this)},e._newCallbacksInvoker=function(){var t=this,e=new Do;return e._registerOffCallback((function(){t.shouldHandleEventTouch&&!t._hasTouchListeners()&&(t.shouldHandleEventTouch=!1),t.shouldHandleEventMouse&&!t._hasMouseListeners()&&(t.shouldHandleEventMouse=!1),t._hasPointerListeners()||ov.emit(1,t)})),e},e._handleEventMouse=function(t){switch(t.type){case"mouse-down":return this._handleMouseDown(t);case"mouse-move":return this._handleMouseMove(t);case"mouse-up":return this._handleMouseUp(t);case"mouse-wheel":return this._handleMouseWheel(t);case"mouse-leave-window":return this._handleMouseLeave(t);case"mouse-enter-window":return this._handleMouseEnter(t);default:return!1}},e._handleMouseDown=function(t){var e=this._node,i=e._getUITransformComp();return!(!e||!i||(t.getLocation(rv),!i.hitTest(rv,t.windowId)||(t.type="mouse-down",t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0)))},e._handleMouseMove=function(t){var e=this._node,i=e._getUITransformComp();return!(!e||!i||this._isMouseLeaveWindow||(t.getLocation(rv),i.hitTest(rv,t.windowId)?(this.previousMouseIn||(nv&&nv!==e&&(t.type="mouse-leave",nv.dispatchEvent(t),nv.eventProcessor.previousMouseIn=!1),nv=e,t.type="mouse-enter",e.dispatchEvent(t),this.previousMouseIn=!0),t.type="mouse-move",t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0):(this.previousMouseIn&&(t.type="mouse-leave",e.dispatchEvent(t),this.previousMouseIn=!1,nv=null),1)))},e._handleMouseUp=function(t){var e=this._node,i=e._getUITransformComp();return!(!e||!i||(t.getLocation(rv),!i.hitTest(rv,t.windowId)||(t.type="mouse-up",t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0)))},e._handleMouseWheel=function(t){var e=this._node,i=e._getUITransformComp();return!(!e||!i||(t.getLocation(rv),!i.hitTest(rv,t.windowId)||(t.type="mouse-wheel",t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0)))},e._handleMouseLeave=function(t){return this._isMouseLeaveWindow=!0,this.previousMouseIn&&(t.type="mouse-leave",this._node.dispatchEvent(t),this.previousMouseIn=!1,nv=null),!1},e._handleMouseEnter=function(){return this._isMouseLeaveWindow=!1,!1},e._handleEventTouch=function(t){try{switch(t.type){case"touch-start":return this._handleTouchStart(t);case"touch-move":return this._handleTouchMove(t);case"touch-end":return this._handleTouchEnd(t);case"touch-cancel":return this._handleTouchCancel(t);default:return!1}}catch(t){throw this.claimedTouchIdList.length=0,t}},e._handleTouchStart=function(t){var e=this.node,i=e._getUITransformComp();return!(!e||!i||(t.getLocation(rv),!i.hitTest(rv,t.windowId)||(t.type="touch-start",t.bubbles=!0,this._dispatchingTouch=t.touch,e.dispatchEvent(t),0)))},e._handleTouchMove=function(t){var e=this.node;return!(!e||!e._getUITransformComp()||(t.type="touch-move",t.bubbles=!0,this._dispatchingTouch=t.touch,e.dispatchEvent(t),0))},e._handleTouchEnd=function(t){var e=this.node,i=e._getUITransformComp();e&&i&&(t.getLocation(rv),i.hitTest(rv,t.windowId)?t.type="touch-end":t.type="touch-cancel",t.bubbles=!0,e.dispatchEvent(t),this._dispatchingTouch=null)},e._handleTouchCancel=function(t){var e=this.node;e&&e._getUITransformComp()&&(t.type="touch-cancel",t.bubbles=!0,e.dispatchEvent(t),this._dispatchingTouch=null)},n(t,[{key:"isEnabled",get:function(){return this._isEnabled}},{key:"node",get:function(){return this._node}}]),t}();hv._maskComp=null,hv.callbacksInvoker=ov,A.NodeEventProcessor=hv;var uv,lv,cv,fv,_v,dv,pv,mv,gv,yv,vv,bv,Sv,wv,xv,Tv,Av,Cv=$r(),Dv=[],Bv=Math.PI/180;function Iv(t,e){if(!t)return!1;Dv.length=0;for(var i=Dv,n=null,r=t;r;r=r.parent)i.push(r),r._uiProps._uiSkewComp&&(n=r);var s=!1;if(n){e.set(n.parent._mat);for(var a=i.indexOf(n);a>=0;--a){var o=i[a];Kr.fromSRT(Cv,o.rotation,o.position,o.scale),Kr.multiply(e,e,Cv)}s=!0}else e.set(t._mat);return Dv.length=0,s}function Mv(t,e){if(t.isSkewEnabled()&&(0!==t.x||0!==t.y))if(t.rotational){var i=-t.x*Bv,n=t.y*Bv,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*Bv),_=Math.tan(t.y*Bv),d=e.m00,p=e.m01,m=e.m04,g=e.m05;e.m00=d+m*_,e.m01=p+g*_,e.m04=m+d*f,e.m05=g+p*f}}var Pv=128,Ev="transform-changed",Ov="active-changed",kv=new It("Node");function Rv(t){return t?"string"==typeof t?de(t):t:(ht(3804),null)}var Fv,Lv,Vv,Nv,zv,Uv,Gv,Hv=nr(),Wv=nr(),jv=Ur(),qv=Ur(),Xv=Ur(),Yv=new yr,Jv=$r(),Kv=$r(),Qv=[],Zv=Symbol("ReserveContentsForAllSyncablePrefab"),$v=0,tb=0,eb=t("dn",(uv=Kh("cc.Node"),lv=Ou(ir),cv=Ou(Uy),uv((Av=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=dv&&dv(),i._children=pv&&pv(),i._active=mv&&mv(),i._components=gv&&gv(),i._prefab=yv&&yv(),i._scene=null,i._activeInHierarchy=!1,i._id=kv.getNewId(),i._eventProcessor=new hv(f(i)),i._eventMask=0,i._siblingIndex=0,i._originalSceneId="",i._uiProps=new Vy(f(i)),i._static=!1,i._lpos=vv&&vv(),i._lrot=bv&&bv(),i._lscale=Sv&&Sv(),i._mobility=wv&&wv(),i._layer=xv&&xv(),i._euler=Tv&&Tv(),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 Kr,i}return e._setActiveInHierarchy=function(t){this._activeInHierarchy=t},i._setScene=function(t){t._updateScene()},i._incSkewCompCount=function(){++tb},i._decSkewCompCount=function(){--tb},i._findComponent=function(t,e){var i=e,n=t._components;if(i._sealed)for(var r=0;r<n.length;++r){var s=n[r];if(s.constructor===e)return s}else for(var a=0;a<n.length;++a){var o=n[a];if(o instanceof e)return o}return null},i._findComponents=function(t,e,i){var n=e,r=t._components;if(n._sealed)for(var s=0;s<r.length;++s){var a=r[s];a.constructor===e&&i.push(a)}else for(var o=0;o<r.length;++o){var h=r[o];h instanceof e&&i.push(h)}},i._findChildComponent=function(t,e){for(var n=0;n<t.length;++n){var r=t[n],s=i._findComponent(r,e);if(s)return s;if(r._children.length>0&&(s=i._findChildComponent(r._children,e)))return s}return null},i._findChildComponents=function(t,e,n){for(var r=0;r<t.length;++r){var s=t[r];i._findComponents(s,e,n),s._children.length>0&&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&Pv)){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<n;i++)if(e[i]._id===t)return e[i];return null},e.getChildByName=function(t){if(!t)return X("Invalid name"),null;for(var e=this._children,i=0,n=e.length;i<n;i++)if(e[i]._name===t)return e[i];return null},e.getChildByPath=function(t){for(var e,i=t.split("/"),n=this,r=function(){var t=i[s];if(0===t.length)return 0;var e=n.children.find((function(e){return e.name===t}));if(!e)return{v:null};n=e},s=0;s<i.length;++s)if(0!==(e=r())&&e)return e.v;return n},e.addChild=function(t){t.setParent(this)},e.insertChild=function(t,e){t.setParent(this),t.setSiblingIndex(e)},e.getSiblingIndex=function(){return this._siblingIndex},e.setSiblingIndex=function(t){if(this._parent)if(256&this._parent._objFlags)ht(3821);else{var e=this._parent._children;t=t>=0?t:e.length+t;var i=e.indexOf(this);t!==i&&(e.splice(i,1),t<e.length?e.splice(t,0,this):e.push(this),this._parent._updateSiblingIndex(),this._onSiblingIndexChanged&&this._onSiblingIndexChanged(t),this._eventProcessor.onUpdatingSiblingIndex())}},e.walk=function(t,e){var n=1,r=null,s=null,a=0,o=i._stacks[i._stackId];o||(o=[],i._stacks.push(o)),i._stackId++,o.length=0,o[0]=this;for(var h=null,u=!1;n;)if(s=o[--n])if(!u&&t?t(s):u&&e&&e(s),o[n]=null,u){if(h===this._parent)break;if(u=!1,r)if(r[++a])o[n]=r[a],n++;else if(h&&(o[n]=h,n++,u=!0,h._parent?(a=(r=h._parent._children).indexOf(h),h=h._parent):(h=null,r=null),a<0))break}else s._children.length>0?(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=Rv(t);return e?i._findComponent(this,e):null},e.getComponents=function(t){var e=Rv(t),n=[];return e&&i._findComponents(this,e,n),n},e.getComponentInChildren=function(t){var e=Rv(t);return e?i._findChildComponent(this._children,e):null},e.getComponentsInChildren=function(t){var e=Rv(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=de(t)))throw A._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,A.Component))throw TypeError(ft(3810));var i=e._requireComponent;if(i)if(Array.isArray(i))for(var n=0;n<i.length;n++){var r=i[n];this.getComponent(r)||this.addComponent(r)}else{var s=i;this.getComponent(s)||this.addComponent(s)}var a=new e;return a.node=this,this._components.push(a),this.emit("component-added",a),this._activeInHierarchy&&A.director._nodeActivator.activateComp(a),a},e.removeComponent=function(t){if(t){var e=null;(e=t instanceof yg?t:this.getComponent(t))&&e.destroy()}else ht(3813)},e.on=function(t,e,i,n){switch(void 0===n&&(n=!1),t){case Ev:this._eventMask|=1;break;case Ov:this._eventMask|=2}this._eventProcessor.on(t,e,i,n)},e.off=function(t,e,i,n){if(void 0===n&&(n=!1),this._eventProcessor.off(t,e,i,n),!this._eventProcessor.hasEventListener(t))switch(t){case Ev:this._eventMask&=-2;break;case Ov:this._eventMask&=-3}},e.once=function(t,e,i,n){this._eventProcessor.once(t,e,i,n)},e.emit=function(t,e,i,n,r,s){this._eventProcessor.emit(t,e,i,n,r,s)},e.dispatchEvent=function(t){this._eventProcessor.dispatchEvent(t)},e.hasEventListener=function(t,e,i){return this._eventProcessor.hasEventListener(t,e,i)},e.targetOff=function(t){this._eventProcessor.targetOff(t),1&this._eventMask&&!this._eventProcessor.hasEventListener(Ev)&&(this._eventMask&=-2),2&this._eventMask&&!this._eventProcessor.hasEventListener(Ov)&&(this._eventMask&=-3)},e.destroy=function(){return!!t.prototype.destroy.call(this)&&(this.active=!1,!0)},e.destroyAllChildren=function(){for(var t=this._children,e=0;e<t.length;++e)t[e].destroy()},e._removeComponent=function(t){if(t){if(!(this._objFlags&Pv)){var e=this._components.indexOf(t);-1!==e?(this._components.splice(e,1),this.emit("component-removed",t)):t.node!==this&&ht(3815)}}else ht(3814)},e._updateSiblingIndex=function(){for(var t=0;t<this._children.length;++t)this._children[t]._siblingIndex=t;this.emit("sibling-order-changed")},e._instantiate=function(t,e){return void 0===e&&(e=!1),t||(t=A.instantiate._clone(this,this)),t._prefab,t._parent=null,t._onBatchCreated(e),t},e._onHierarchyChangedBase=function(){var t=this._parent;!this._persistNode||t instanceof A.Scene||A.game.removePersistRootNode(this);var e=this._active&&!(!t||!t._activeInHierarchy);this._activeInHierarchy!==e&&A.director._nodeActivator.activateNode(this,e)},e._onPreDestroyBase=function(){this._objFlags|=Pv;var t=this._parent,e=!!t&&!!(t._objFlags&Pv);if(this._persistNode&&A.game.removePersistRootNode(this),!e&&t){this.emit("parent-changed",this);var i=t._children.indexOf(this);t._children.splice(i,1),this._siblingIndex=0,t._updateSiblingIndex(),t.emit&&t.emit("child-removed",this)}this.emit("node-destroyed",this),this._eventProcessor.destroy();for(var n=this._children,r=0;r<n.length;++r)n[r]._destroyImmediate();for(var s=this._components,a=0;a<s.length;++a)s[a]._destroyImmediate();return e},i.isNode=function(t){return t instanceof i&&(t.constructor===i||!(t instanceof A.Scene))},e._onPreDestroy=function(){return this._onPreDestroyBase()},e[Ju]=function(t){t.writeThis()},e._onSetParent=function(t,e){void 0===e&&(e=!1);var n=this,r=n._parent;if(r&&(null!=t&&t._scene===r._scene||null==r._scene||n.walk(i._setScene)),e){if(r)if(r.updateWorldTransform(),Zi(Kr.determinant(r._mat),0,Ki))at(14300),n._transformFlags|=7,n.updateWorldTransform();else{var s=r._mat;if(tb>0){if(t){var a=Iv(t,Kv);Kr.fromSRT(Jv,n._lrot,n._lpos,n._lscale);var o=a?Kv:t._mat;Kr.multiply(n._mat,o,Jv)}Iv(r,Kv)&&(s=Kv)}Kr.multiply(Jv,Kr.invert(Jv,s),n._mat),Kr.toSRT(Jv,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(Ov,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(Ov,e,t);var i=this._eventProcessor;if(i.isEnabled===t&&hv.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(Hv,t,this._lrot),this._lpos.x+=Hv.x,this._lpos.y+=Hv.y,this._lpos.z+=Hv.z;else if(1===i)if(this._parent){kr.invert(jv,this._parent.worldRotation),ir.transformQuat(Hv,t,jv);var n=this.worldScale;this._lpos.x+=Hv.x/n.x,this._lpos.y+=Hv.y/n.y,this._lpos.z+=Hv.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(Ev,1)},e.rotate=function(t,e){var i=e||0;if(kr.normalize(jv,t),0===i)kr.multiply(this._lrot,this._lrot,jv);else if(1===i){var n=this.worldRotation;kr.multiply(qv,jv,n),kr.invert(jv,n),kr.multiply(qv,jv,qv),kr.multiply(this._lrot,this._lrot,qv)}this._eulerDirty=!0,this.invalidateChildren(2),1&this._eventMask&&this.emit(Ev,2)},e.lookAt=function(t,e){this.getWorldPosition(Hv),ir.subtract(Hv,Hv,t),ir.normalize(Hv,Hv),kr.fromViewUp(jv,Hv,e),this.setWorldRotation(jv)},e.invalidateChildren=function(t){var e,i,n=0,r=0,s=0,a=0,o=1|t;for(Qv[0]=this;n>=0;){if(a=(e=Qv[n--]).hasChangedFlags,e.isValid&&(e._transformFlags&a&t)!==t)for(e._transformFlags|=t,e.hasChangedFlags=a|t,s=(i=e._children).length,r=0;r<s;r++)Qv[++n]=i[r];t=o}},e.updateWorldTransform=function(){if(this._transformFlags){for(var t,e,i,n=this,r=0;n&&n._transformFlags;)Qv[r++]=n,n=n._parent;for(var s=0,a=0,o=0,h=null,u=!1;r;){if(e=(t=Qv[--r])._mat,i=t._pos,a=1&(s|=t._transformFlags),o=14&s,n){if(a&&!o&&(ir.transformMat4(i,t._lpos,n._mat),e.m12=i.x,e.m13=i.y,e.m14=i.z),o){var l=e;Kr.fromSRT(Jv,t._lrot,t._lpos,t._lscale),tb>0&&(u=Iv(n,Kv),((h=t._uiProps._uiSkewComp)||u)&&(Kr.multiply(Kv,Kv,Jv),h&&Mv(h,Jv),l=Kv)),Kr.multiply(e,n._mat,Jv);var c=2&s?t._rot:null;Kr.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),Kr.fromSRT(e,t._rot,t._pos,t._scale),tb>0&&(h=t._uiProps._uiSkewComp)&&Mv(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(Ev,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(Ev,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(Ev,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(Ev,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;)Qv[n++]=i,i=i._parent;for(;n>=0;)ir.transformInverseRTS(t,t,i._lrot,i._lpos,i._lscale),i=Qv[--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,Kr.invert(Jv,r._mat))):ir.copy(s,n),this.invalidateChildren(1),1&this._eventMask&&this.emit(Ev,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(Ev,2)},e.setWorldRotationFromEuler=function(t,e,i){kr.fromEuler(jv,t,e,i),this.setWorldRotation(jv)},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&&(Kr.fromSRT(Jv,n._lrot,n._lpos,n._lscale),Kr.multiply(o,r._mat,Jv));var h=ir.set(Wv,o.m00,o.m01,o.m02).length(),u=ir.set(Wv,o.m04,o.m05,o.m06).length(),l=ir.set(Wv,o.m08,o.m09,o.m10).length();0===h?(Hv.x=s.x,o.m00=1,a=2):Hv.x=s.x/h,0===u?(Hv.y=s.y,o.m05=1,a=2):Hv.y=s.y/u,0===l?(Hv.z=s.z,o.m10=1,a=2):Hv.z=s.z/l,Kr.scale(Jv,o,Hv),Kr.multiply(Kv,Kr.invert(Kv,r._mat),Jv),yr.fromQuat(Yv,kr.conjugate(Xv,n._lrot)),yr.multiplyMat4(Yv,Yv,Kv);var c=n._lscale;c.x=ir.set(Hv,Yv.m00,Yv.m01,Yv.m02).length(),c.y=ir.set(Hv,Yv.m03,Yv.m04,Yv.m05).length(),c.z=ir.set(Hv,Yv.m06,Yv.m07,Yv.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(Ev,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 Kr;return Kr.copy(e,this._mat)},e.getWorldRS=function(t){this.updateWorldTransform();var e=t||new Kr;return Kr.copy(e,this._mat),e.m12=0,e.m13=0,e.m14=0,e},e.getWorldRT=function(t){this.updateWorldTransform();var e=t||new Kr;return Kr.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(Ev,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(){$v+=1},i.clearNodeArray=function(){i.ClearFrame<i.ClearRound?i.ClearFrame++:(i.ClearFrame=0,Qv.length=0)},e.getPathInHierarchy=function(){for(var t=this.name,e=this.parent;e&&!(e instanceof A.Scene);)t=e.name+"/"+t,e=e.parent;return t},e._getUITransformComp=function(){return this._uiProps.uiTransformComp},n(i,[{key:"components",get:function(){return this._components}},{key:"_persistNode",get:function(){return(64&this._objFlags)>0},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&&A.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(Ev,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){Kr.toSRT(t,this._lrot,this._lpos,this._lscale),this.invalidateChildren(7),this._eulerDirty=!0,1&this._eventMask&&this.emit(Ev,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(Hv,t,-1/e),kr.fromViewUp(jv,Hv),this.setWorldRotation(jv)}},{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===$v?this._hasChangedFlags:0},set:function(t){this._flagChangeVersion=$v,this._hasChangedFlags=t}}]),i}(mo),Av.idGenerator=kv,Av._stacks=[[]],Av._stackId=0,Av.EventType=Gy,Av.NodeSpace=Ny,Av.TransformDirtyBit=zy,Av.TransformBit=zy,Av.reserveContentsForAllSyncablePrefabTag=Zv,Av.ClearFrame=0,Av.ClearRound=1e3,v((_v=Av).prototype,"_persistNode",[tu],Object.getOwnPropertyDescriptor(_v.prototype,"_persistNode"),_v.prototype),dv=zh(_v.prototype,"_parent",[uu],(function(){return null})),pv=zh(_v.prototype,"_children",[uu],(function(){return[]})),mv=zh(_v.prototype,"_active",[uu],(function(){return!0})),gv=zh(_v.prototype,"_components",[uu],(function(){return[]})),yv=zh(_v.prototype,"_prefab",[uu],(function(){return null})),vv=zh(_v.prototype,"_lpos",[uu],(function(){return new ir})),bv=zh(_v.prototype,"_lrot",[uu],(function(){return new kr})),Sv=zh(_v.prototype,"_lscale",[uu],(function(){return new ir(1,1,1)})),wv=zh(_v.prototype,"_mobility",[uu],(function(){return Uy.Static})),xv=zh(_v.prototype,"_layer",[uu],(function(){return Ly.Enum.DEFAULT})),Tv=zh(_v.prototype,"_euler",[uu],(function(){return new ir})),v(_v.prototype,"eulerAngles",[lv],Object.getOwnPropertyDescriptor(_v.prototype,"eulerAngles"),_v.prototype),v(_v.prototype,"mobility",[cv],Object.getOwnPropertyDescriptor(_v.prototype,"mobility"),_v.prototype),fv=_v))||fv));A.Node=eb;var ib=t("e6",Kh("cc.TextureCube")((Gv=function(t){function e(e){var i;return(i=t.call(this,e)||this).isRGBE=Vv&&Vv(),i._mipmapAtlas=Nv&&Nv(),i._mipmapMode=zv&&zv(),i._mipmaps=Uv&&Uv(),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){nb(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<r;s++){var a=6*s;n.push({front:t[a+4].image,back:t[a+5].image,left:t[a+1].image,right:t[a+0].image,top:t[a+2].image,bottom:t[a+3].image})}return(i=i||new e).mipmaps=n,i},i.onLoaded=function(){2===this._mipmapMode?this.mipmapAtlas=this._mipmapAtlas:this.mipmaps=this._mipmaps},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.updateMipmaps=function(t,e){var i=this;if(void 0===t&&(t=0),void 0===e&&(e=void 0),!(t>=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;nb(i._generatedMipmaps[e],(function(t,n){i._assignImage(t,e,n)}))},s=0;s<n;++s)r()},i.destroy=function(){return this._mipmaps=[],this._generatedMipmaps=[],this._mipmapAtlas=null,t.prototype.destroy.call(this)},i.releaseTexture=function(){this.destroy()},i._serialize=function(){return null},i._deserialize=function(e,i){var n=e;if(t.prototype._deserialize.call(this,n.base,i),this.isRGBE=n.rgbe,this._mipmapMode=n.mipmapMode,2===this._mipmapMode){var r=n.mipmapAtlas,s=n.mipmapLayout;this._mipmapAtlas={atlas:{},layout:s},this._mipmapAtlas.atlas={front:new Hm,back:new Hm,left:new Hm,right:new Hm,top:new Hm,bottom:new Hm};var a=me(Hm);i.result.push(this._mipmapAtlas.atlas,"front",r.front,a),i.result.push(this._mipmapAtlas.atlas,"back",r.back,a),i.result.push(this._mipmapAtlas.atlas,"left",r.left,a),i.result.push(this._mipmapAtlas.atlas,"right",r.right,a),i.result.push(this._mipmapAtlas.atlas,"top",r.top,a),i.result.push(this._mipmapAtlas.atlas,"bottom",r.bottom,a)}else{this._mipmaps=new Array(n.mipmaps.length);for(var o=0;o<n.mipmaps.length;++o){this._mipmaps[o]={front:new Hm,back:new Hm,left:new Hm,right:new Hm,top:new Hm,bottom:new Hm};var h=n.mipmaps[o],u=me(Hm);i.result.push(this._mipmaps[o],"front",h.front,u),i.result.push(this._mipmaps[o],"back",h.back,u),i.result.push(this._mipmaps[o],"left",h.left,u),i.result.push(this._mipmaps[o],"right",h.right,u),i.result.push(this._mipmaps[o],"top",h.top,u),i.result.push(this._mipmaps[o],"bottom",h.bottom,u)}}},i._getGfxTextureCreateInfo=function(t){var e=new dd(3);return e.width=this._width,e.height=this._height,e.layerCount=6,Object.assign(e,t),e},i._getGfxTextureViewCreateInfo=function(t){var e=new pd;return e.type=3,e.baseLayer=0,e.layerCount=6,Object.assign(e,t),e},i._uploadAtlas=function(){var t=this,e=this._mipmapAtlas.layout,i=e[0];this.reset({width:i.width,height:i.height,format:this._mipmapAtlas.atlas.front.format,mipmapLevel:e.length}),nb(this._mipmapAtlas.atlas,(function(i,n){var r=new Ey;r.image=i,r.reset({width:i.width,height:i.height,format:i.format}),r.uploadData(i.data);for(var s=0;s<e.length;s++){var a=e[s],o=r.getGFXTexture().size,h=new Uint8Array(o),u=new id;u.texOffset.x=a.left,u.texOffset.y=a.top,u.texExtent.width=a.width,u.texExtent.height=a.height,t._getGFXDevice().copyTextureToBuffers(r.getGFXTexture(),[h],[u]);var l=new Hm({_data:h,_compressed:i.isCompressed,width:a.width,height:a.height,format:i.format});t._assignImage(l,a.level,n)}}))},i.initDefault=function(e){t.prototype.initDefault.call(this,e);var i=new Hm;i.initDefault(),this.mipmaps=[{front:i,back:i,top:i,bottom:i,left:i,right:i}]},i.validate=function(){if(2===this._mipmapMode){if(null===this.mipmapAtlas||0===this.mipmapAtlas.layout.length)return!1;var t=this.mipmapAtlas.atlas;return!!(t.top&&t.bottom&&t.front&&t.back&&t.left&&t.right)}return 0!==this._mipmaps.length&&!this._mipmaps.find((function(t){return!(t.top&&t.bottom&&t.front&&t.back&&t.left&&t.right)}))},n(e,[{key:"mipmaps",get:function(){return this._mipmaps},set:function(t){this._mipmaps=t;var e=[];if(1===t.length){var i=t[0],n=i.front.extractMipmaps(),r=i.back.extractMipmaps(),s=i.left.extractMipmaps(),a=i.right.extractMipmaps(),o=i.top.extractMipmaps(),h=i.bottom.extractMipmaps();if(n.length!==r.length||n.length!==s.length||n.length!==a.length||n.length!==o.length||n.length!==h.length)return ht(16347),void this._setMipmapParams([]);for(var u=n.length,l=0;l<u;++l){var c={front:n[l],back:r[l],left:s[l],right:a[l],top:o[l],bottom:h[l]};e.push(c)}}else t.length>1&&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(B.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];nb(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 Hm({_data:o.data,_compressed:n.isCompressed,width:o.width,height:o.height,format:n.format});e._assignImage(h,t.level,r)}))},h=0;h<r.length;h++)o()}}else this.reset({width:0,height:0,mipmapLevel:0})}},{key:"image",get:function(){return 0===this._mipmaps.length?null:this._mipmaps[0]},set:function(t){this.mipmaps=t?[t]:[]}}]),e}(Py),Gv.FaceIndex={right:0,left:1,top:2,bottom:3,front:4,back:5},Vv=zh((Lv=Gv).prototype,"isRGBE",[uu],(function(){return!1})),Nv=zh(Lv.prototype,"_mipmapAtlas",[uu],(function(){return null})),zv=zh(Lv.prototype,"_mipmapMode",[uu],(function(){return 0})),Uv=zh(Lv.prototype,"_mipmaps",[uu],(function(){return[]})),Fv=Lv))||Fv);function nb(t,e){e(t.front,4),e(t.back,5),e(t.left,1),e(t.right,0),e(t.top,2),e(t.bottom,3)}function rb(){return A.director.root.pipeline.pipelineSceneData}C.TextureCube=ib;var sb,ab,ob,hb,ub,lb,cb,fb,_b,db,pb,mb,gb,yb,vb=function(){function t(){this._groundAlbedoHDR=new Vn(.2,.2,.2,1),this._skyColorHDR=new Vn(.2,.5,.8,1),this._skyIllumHDR=0,this._groundAlbedoLDR=new Vn(.2,.2,.2,1),this._skyColorLDR=new Vn(.2,.5,.8,1),this._skyIllumLDR=0,this._mipmapCount=1,this._enabled=!1}return t.prototype.initialize=function(t){this._skyColorHDR=t.skyColorHDR,this._groundAlbedoHDR.set(t.groundAlbedoHDR),this._skyIllumHDR=t.skyIllumHDR,this._skyColorLDR=t.skyColorLDR,this._groundAlbedoLDR.set(t.groundAlbedoLDR),this._skyIllumLDR=t.skyIllumLDR},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"skyColor",get:function(){return rb().isHDR?this._skyColorHDR:this._skyColorLDR},set:function(t){rb().isHDR?this._skyColorHDR.set(t):this._skyColorLDR.set(t)}},{key:"skyIllum",get:function(){return rb().isHDR?this._skyIllumHDR:this._skyIllumLDR},set:function(t){rb().isHDR?this._skyIllumHDR=t:this._skyIllumLDR=t}},{key:"groundAlbedo",get:function(){return rb().isHDR?this._groundAlbedoHDR:this._groundAlbedoLDR},set:function(t){rb().isHDR?this._groundAlbedoHDR.set(t):this._groundAlbedoLDR.set(t)}}]),t}();vb.SUN_ILLUM=65e3,vb.SKY_ILLUM=2e4,A.Ambient=vb;var bb="MainFlow",Sb="ForwardFlow",wb="ShadowFlow",xb={DEFAULT:100,UI:200};A.RenderPassStage=xb;var Tb={bindings:[],layouts:{}},Ab={bindings:[],layouts:{}},Cb=new ad([4,0,7,0],[4,0,9,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,2,1,3]),Db=function(){};sb=Db,Db.TIME_OFFSET=0,Db.SCREEN_SIZE_OFFSET=4,Db.NATIVE_SIZE_OFFSET=8,Db.PROBE_INFO_OFFSET=12,Db.DEBUG_VIEW_MODE_OFFSET=16,Db.COUNT=20,Db.SIZE=80,Db.NAME="CCGlobal",Db.BINDING=0,Db.DESCRIPTOR=new Nd(sb.BINDING,1,1,63),Db.LAYOUT=new yd(0,sb.BINDING,sb.NAME,[new gd("cc_time",16,1),new gd("cc_screenSize",16,1),new gd("cc_nativeSize",16,1),new gd("cc_probeInfo",16,1),new gd("cc_debug_view_mode",16,1)],1),Tb.layouts[Db.NAME]=Db.LAYOUT,Tb.bindings[Db.BINDING]=Db.DESCRIPTOR;var Bb=function(){};ab=Bb,Bb.MAT_VIEW_OFFSET=0,Bb.MAT_VIEW_INV_OFFSET=16,Bb.MAT_PROJ_OFFSET=32,Bb.MAT_PROJ_INV_OFFSET=48,Bb.MAT_VIEW_PROJ_OFFSET=64,Bb.MAT_VIEW_PROJ_INV_OFFSET=80,Bb.CAMERA_POS_OFFSET=96,Bb.SURFACE_TRANSFORM_OFFSET=100,Bb.SCREEN_SCALE_OFFSET=104,Bb.EXPOSURE_OFFSET=108,Bb.MAIN_LIT_DIR_OFFSET=112,Bb.MAIN_LIT_COLOR_OFFSET=116,Bb.AMBIENT_SKY_OFFSET=120,Bb.AMBIENT_GROUND_OFFSET=124,Bb.GLOBAL_FOG_COLOR_OFFSET=128,Bb.GLOBAL_FOG_BASE_OFFSET=132,Bb.GLOBAL_FOG_ADD_OFFSET=136,Bb.NEAR_FAR_OFFSET=140,Bb.VIEW_PORT_OFFSET=144,Bb.COUNT=148,Bb.SIZE=592,Bb.NAME="CCCamera",Bb.BINDING=1,Bb.DESCRIPTOR=new Nd(ab.BINDING,1,1,63),Bb.LAYOUT=new yd(0,ab.BINDING,ab.NAME,[new gd("cc_matView",25,1),new gd("cc_matViewInv",25,1),new gd("cc_matProj",25,1),new gd("cc_matProjInv",25,1),new gd("cc_matViewProj",25,1),new gd("cc_matViewProjInv",25,1),new gd("cc_cameraPos",16,1),new gd("cc_surfaceTransform",16,1),new gd("cc_screenScale",16,1),new gd("cc_exposure",16,1),new gd("cc_mainLitDir",16,1),new gd("cc_mainLitColor",16,1),new gd("cc_ambientSky",16,1),new gd("cc_ambientGround",16,1),new gd("cc_fogColor",16,1),new gd("cc_fogBase",16,1),new gd("cc_fogAdd",16,1),new gd("cc_nearFar",16,1),new gd("cc_viewPort",16,1)],1),Tb.layouts[Bb.NAME]=Bb.LAYOUT,Tb.bindings[Bb.BINDING]=Bb.DESCRIPTOR;var Ib=function(){};ob=Ib,Ib.MAT_LIGHT_VIEW_OFFSET=0,Ib.MAT_LIGHT_VIEW_PROJ_OFFSET=16,Ib.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET=32,Ib.SHADOW_PROJ_DEPTH_INFO_OFFSET=36,Ib.SHADOW_PROJ_INFO_OFFSET=40,Ib.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET=44,Ib.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET=48,Ib.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET=52,Ib.SHADOW_COLOR_OFFSET=56,Ib.PLANAR_NORMAL_DISTANCE_INFO_OFFSET=60,Ib.COUNT=64,Ib.SIZE=256,Ib.NAME="CCShadow",Ib.BINDING=2,Ib.DESCRIPTOR=new Nd(ob.BINDING,1,1,63),Ib.LAYOUT=new yd(0,ob.BINDING,ob.NAME,[new gd("cc_matLightView",25,1),new gd("cc_matLightViewProj",25,1),new gd("cc_shadowInvProjDepthInfo",16,1),new gd("cc_shadowProjDepthInfo",16,1),new gd("cc_shadowProjInfo",16,1),new gd("cc_shadowNFLSInfo",16,1),new gd("cc_shadowWHPBInfo",16,1),new gd("cc_shadowLPNNInfo",16,1),new gd("cc_shadowColor",16,1),new gd("cc_planarNDInfo",16,1)],1),Tb.layouts[Ib.NAME]=Ib.LAYOUT,Tb.bindings[Ib.BINDING]=Ib.DESCRIPTOR;var Mb=function(){};hb=Mb,Mb.CSM_LEVEL_COUNT=4,Mb.CSM_VIEW_DIR_0_OFFSET=0,Mb.CSM_VIEW_DIR_1_OFFSET=16,Mb.CSM_VIEW_DIR_2_OFFSET=32,Mb.CSM_ATLAS_OFFSET=48,Mb.MAT_CSM_VIEW_PROJ_OFFSET=64,Mb.CSM_PROJ_DEPTH_INFO_OFFSET=128,Mb.CSM_PROJ_INFO_OFFSET=144,Mb.CSM_SPLITS_INFO_OFFSET=160,Mb.COUNT=164,Mb.SIZE=656,Mb.NAME="CCCSM",Mb.BINDING=3,Mb.DESCRIPTOR=new Nd(hb.BINDING,1,1,16),Mb.LAYOUT=new yd(0,hb.BINDING,hb.NAME,[new gd("cc_csmViewDir0",16,hb.CSM_LEVEL_COUNT),new gd("cc_csmViewDir1",16,hb.CSM_LEVEL_COUNT),new gd("cc_csmViewDir2",16,hb.CSM_LEVEL_COUNT),new gd("cc_csmAtlas",16,hb.CSM_LEVEL_COUNT),new gd("cc_matCSMViewProj",25,hb.CSM_LEVEL_COUNT),new gd("cc_csmProjDepthInfo",16,hb.CSM_LEVEL_COUNT),new gd("cc_csmProjInfo",16,hb.CSM_LEVEL_COUNT),new gd("cc_csmSplitsInfo",16,1)],1),Tb.layouts[Mb.NAME]=Mb.LAYOUT,Tb.bindings[Mb.BINDING]=Mb.DESCRIPTOR;var Pb="cc_shadowMap",Eb=new Nd(4,16,1,16),Ob=new vd(0,4,Pb,28,1);Tb.layouts[Pb]=Ob,Tb.bindings[4]=Eb;var kb="cc_environment",Rb=new Nd(5,16,1,16),Fb=new vd(0,5,kb,31,1);Tb.layouts[kb]=Fb,Tb.bindings[5]=Rb;var Lb="cc_diffuseMap",Vb=new Nd(7,16,1,16),Nb=new vd(0,7,Lb,31,1);Tb.layouts[Lb]=Nb,Tb.bindings[7]=Vb;var zb="cc_spotShadowMap",Ub=new Nd(6,16,1,16),Gb=new vd(0,6,zb,28,1);Tb.layouts[zb]=Gb,Tb.bindings[6]=Ub;var Hb=function(){};ub=Hb,Hb.MAT_WORLD_OFFSET=0,Hb.MAT_WORLD_IT_OFFSET=16,Hb.LIGHTINGMAP_UVPARAM=32,Hb.LOCAL_SHADOW_BIAS=36,Hb.REFLECTION_PROBE_DATA1=40,Hb.REFLECTION_PROBE_DATA2=44,Hb.REFLECTION_PROBE_BLEND_DATA1=48,Hb.REFLECTION_PROBE_BLEND_DATA2=52,Hb.COUNT=56,Hb.SIZE=224,Hb.NAME="CCLocal",Hb.BINDING=0,Hb.DESCRIPTOR=new Nd(0,1,1,49,1,1),Hb.LAYOUT=new yd(2,0,ub.NAME,[new gd("cc_matWorld",25,1),new gd("cc_matWorldIT",25,1),new gd("cc_lightingMapUVParam",16,1),new gd("cc_localShadowBias",16,1),new gd("cc_reflectionProbeData1",16,1),new gd("cc_reflectionProbeData2",16,1),new gd("cc_reflectionProbeBlendData1",16,1),new gd("cc_reflectionProbeBlendData2",16,1)],1),Ab.layouts[Hb.NAME]=Hb.LAYOUT,Ab.bindings[0]=Hb.DESCRIPTOR;var Wb=function(){};lb=Wb,Wb.WORLD_BOUND_CENTER=0,Wb.WORLD_BOUND_HALF_EXTENTS=lb.WORLD_BOUND_CENTER+4,Wb.COUNT=lb.WORLD_BOUND_HALF_EXTENTS+4,Wb.SIZE=4*lb.COUNT,Wb.NAME="CCWorldBound",Wb.BINDING=0,Wb.DESCRIPTOR=new Nd(lb.BINDING,1,1,33,1,1),Wb.LAYOUT=new yd(2,lb.BINDING,lb.NAME,[new gd("cc_worldBoundCenter",16,1),new gd("cc_worldBoundHalfExtents",16,1)],1),Ab.layouts[Wb.NAME]=Wb.LAYOUT,Ab.bindings[Wb.BINDING]=Wb.DESCRIPTOR;var jb="a_matWorld0",qb="a_sh_linear_const_r",Xb=function(){};cb=Xb,Xb.BATCHING_COUNT=10,Xb.MAT_WORLDS_OFFSET=0,Xb.COUNT=16*cb.BATCHING_COUNT,Xb.SIZE=4*cb.COUNT,Xb.NAME="CCLocalBatched",Xb.BINDING=0,Xb.DESCRIPTOR=new Nd(cb.BINDING,1,1,33,1,1),Xb.LAYOUT=new yd(2,cb.BINDING,cb.NAME,[new gd("cc_matWorlds",25,cb.BATCHING_COUNT)],1),Ab.layouts[Xb.NAME]=Xb.LAYOUT,Ab.bindings[Xb.BINDING]=Xb.DESCRIPTOR;var Yb=function(){};fb=Yb,Yb.LIGHTS_PER_PASS=1,Yb.LIGHT_POS_OFFSET=0,Yb.LIGHT_COLOR_OFFSET=4,Yb.LIGHT_SIZE_RANGE_ANGLE_OFFSET=8,Yb.LIGHT_DIR_OFFSET=12,Yb.LIGHT_BOUNDING_SIZE_VS_OFFSET=16,Yb.COUNT=20,Yb.SIZE=80,Yb.NAME="CCForwardLight",Yb.BINDING=1,Yb.DESCRIPTOR=new Nd(fb.BINDING,2,1,16,1,1),Yb.LAYOUT=new yd(2,fb.BINDING,fb.NAME,[new gd("cc_lightPos",16,1),new gd("cc_lightColor",16,1),new gd("cc_lightSizeRangeAngle",16,1),new gd("cc_lightDir",16,1),new gd("cc_lightBoundingSizeVS",16,1)],1),Ab.layouts[Yb.NAME]=Yb.LAYOUT,Ab.bindings[Yb.BINDING]=Yb.DESCRIPTOR;var Jb=function(){};Jb.LIGHTS_PER_PASS=10;var Kb=function(){};_b=Kb,Kb.JOINTS_TEXTURE_INFO_OFFSET=0,Kb.COUNT=_b.JOINTS_TEXTURE_INFO_OFFSET+4,Kb.SIZE=4*_b.COUNT,Kb.NAME="CCSkinningTexture",Kb.BINDING=3,Kb.DESCRIPTOR=new Nd(_b.BINDING,1,1,1,1,1),Kb.LAYOUT=new yd(2,_b.BINDING,_b.NAME,[new gd("cc_jointTextureInfo",16,1)],1),Ab.layouts[Kb.NAME]=Kb.LAYOUT,Ab.bindings[Kb.BINDING]=Kb.DESCRIPTOR;var Qb=function(){};db=Qb,Qb.JOINTS_ANIM_INFO_OFFSET=0,Qb.COUNT=db.JOINTS_ANIM_INFO_OFFSET+4,Qb.SIZE=4*db.COUNT,Qb.NAME="CCSkinningAnimation",Qb.BINDING=2,Qb.DESCRIPTOR=new Nd(db.BINDING,1,1,1,1,1),Qb.LAYOUT=new yd(2,db.BINDING,db.NAME,[new gd("cc_jointAnimInfo",16,1)],1),Ab.layouts[Qb.NAME]=Qb.LAYOUT,Ab.bindings[Qb.BINDING]=Qb.DESCRIPTOR;var Zb="a_jointAnimInfo",$b=function(){function t(){}return t.initLayout=function(e){t._jointUniformCapacity=e,t._count=12*e,t._size=4*t._count,t.LAYOUT.members[0].count=3*e},n(t,null,[{key:"JOINT_UNIFORM_CAPACITY",get:function(){return t._jointUniformCapacity}},{key:"COUNT",get:function(){return t._count}},{key:"SIZE",get:function(){return t._size}}]),t}();function tS(t){$b.initLayout(t),Ab.layouts[$b.NAME]=$b.LAYOUT,Ab.bindings[$b.BINDING]=$b.DESCRIPTOR}pb=$b,$b._jointUniformCapacity=0,$b._count=0,$b._size=0,$b.NAME="CCSkinning",$b.BINDING=3,$b.DESCRIPTOR=new Nd(pb.BINDING,1,1,1,1,1),$b.LAYOUT=new yd(2,pb.BINDING,pb.NAME,[new gd("cc_joints",16,1)],1);var eS=function(){};mb=eS,eS.MAX_MORPH_TARGET_COUNT=60,eS.OFFSET_OF_WEIGHTS=0,eS.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH=240,eS.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT=244,eS.OFFSET_OF_VERTICES_COUNT=248,eS.COUNT_BASE_4_BYTES=64,eS.SIZE=256,eS.NAME="CCMorph",eS.BINDING=4,eS.DESCRIPTOR=new Nd(mb.BINDING,1,1,1,1,1),eS.LAYOUT=new yd(2,mb.BINDING,mb.NAME,[new gd("cc_displacementWeights",16,15),new gd("cc_displacementTextureInfo",16,1)],1),Ab.layouts[eS.NAME]=eS.LAYOUT,Ab.bindings[eS.BINDING]=eS.DESCRIPTOR;var iS=function(){};gb=iS,iS.NAME="CCUILocal",iS.BINDING=5,iS.DESCRIPTOR=new Nd(gb.BINDING,2,1,1,1,1),iS.LAYOUT=new yd(2,gb.BINDING,gb.NAME,[new gd("cc_local_data",16,1)],1),Ab.layouts[iS.NAME]=iS.LAYOUT,Ab.bindings[iS.BINDING]=iS.DESCRIPTOR;var nS=function(){};yb=nS,nS.SH_LINEAR_CONST_R_OFFSET=0,nS.SH_LINEAR_CONST_G_OFFSET=4,nS.SH_LINEAR_CONST_B_OFFSET=8,nS.SH_QUADRATIC_R_OFFSET=12,nS.SH_QUADRATIC_G_OFFSET=16,nS.SH_QUADRATIC_B_OFFSET=20,nS.SH_QUADRATIC_A_OFFSET=24,nS.COUNT=28,nS.SIZE=112,nS.NAME="CCSH",nS.BINDING=6,nS.DESCRIPTOR=new Nd(6,1,1,16,1,1),nS.LAYOUT=new yd(2,6,yb.NAME,[new gd("cc_sh_linear_const_r",16,1),new gd("cc_sh_linear_const_g",16,1),new gd("cc_sh_linear_const_b",16,1),new gd("cc_sh_quadratic_r",16,1),new gd("cc_sh_quadratic_g",16,1),new gd("cc_sh_quadratic_b",16,1),new gd("cc_sh_quadratic_a",16,1)],1),Ab.layouts[nS.NAME]=nS.LAYOUT,Ab.bindings[6]=nS.DESCRIPTOR;var rS="cc_jointTexture",sS=new Nd(7,16,1,1,1,4),aS=new vd(2,7,rS,28,1);Ab.layouts[rS]=aS,Ab.bindings[7]=sS;var oS="cc_realtimeJoint",hS=new Nd(7,16,1,1,1,4),uS=new vd(2,7,oS,28,1);Ab.layouts[oS]=uS,Ab.bindings[7]=hS;var lS="cc_PositionDisplacements",cS=new Nd(8,16,1,1,1,4),fS=new vd(2,8,lS,28,1);Ab.layouts[lS]=fS,Ab.bindings[8]=cS;var _S="cc_NormalDisplacements",dS=new Nd(9,16,1,1,1,4),pS=new vd(2,9,_S,28,1);Ab.layouts[_S]=pS,Ab.bindings[9]=dS;var mS="cc_TangentDisplacements",gS=new Nd(10,16,1,1,1,4),yS=new vd(2,10,mS,28,1);Ab.layouts[mS]=yS,Ab.bindings[10]=gS;var vS="cc_lightingMap",bS=11,SS=new Nd(bS,16,1,16,1,4),wS=new vd(2,bS,vS,28,1);Ab.layouts[vS]=wS,Ab.bindings[11]=SS;var xS="cc_spriteTexture",TS=new Nd(12,16,1,16,1,4),AS=new vd(2,12,xS,28,1);Ab.layouts[xS]=AS,Ab.bindings[12]=TS;var CS="cc_reflectionProbeCubemap",DS=13,BS=new Nd(DS,16,1,16,1,9),IS=new vd(2,DS,CS,31,1);Ab.layouts[CS]=IS,Ab.bindings[13]=BS;var MS="cc_reflectionProbePlanarMap",PS=14,ES=new Nd(PS,16,1,16,1,4),OS=new vd(2,PS,MS,28,1);Ab.layouts[MS]=OS,Ab.bindings[14]=ES;var kS="cc_reflectionProbeDataMap",RS=new Nd(15,16,1,16,1,4),FS=new vd(2,15,kS,28,1);Ab.layouts[kS]=FS,Ab.bindings[15]=RS,new Nd(16,16,1,16,1,9),new vd(2,16,"cc_reflectionProbeBlendCubemap",31,1);var LS,VS,NS,zS,US=Ly.makeMaskExclude([Ly.BitMask.UI_2D,Ly.BitMask.GIZMOS,Ly.BitMask.EDITOR,Ly.BitMask.SCENE_GIZMO,Ly.BitMask.PROFILER]),GS=Ly.makeMaskExclude([Ly.BitMask.UI_2D,Ly.BitMask.PROFILER]),HS=Ly.Enum.ALL;function WS(t){if(LS)return LS;var e=new dd(1,0,jS(t)?11:35,16,16,0,1,1,1,1);return LS=t.createTexture(e)}function jS(t){return!(3&~t.getFormatFeatures(11)||6===t.gfxAPI)}function qS(){return!(!A.rendering||!A.rendering.enableEffectImport)}t("de",Object.freeze({__proto__:null,CAMERA_DEFAULT_MASK:US,CAMERA_EDITOR_MASK:GS,ENABLE_PROBE_BLEND:!1,INST_JOINT_ANIM_INFO:Zb,INST_MAT_WORLD:jb,INST_SH:qb,JOINT_UNIFORM_CAPACITY:30,MODEL_ALWAYS_MASK:HS,ModelLocalBindings:{UBO_LOCAL:0,UBO_FORWARD_LIGHTS:1,UBO_SKINNING_ANIMATION:2,UBO_SKINNING_TEXTURE:3,UBO_MORPH:4,UBO_UI_LOCAL:5,UBO_SH:6,SAMPLER_JOINTS:7,SAMPLER_MORPH_POSITION:8,SAMPLER_MORPH_NORMAL:9,SAMPLER_MORPH_TANGENT:10,SAMPLER_LIGHTMAP:11,SAMPLER_SPRITE:12,SAMPLER_REFLECTION_PROBE_CUBE:13,SAMPLER_REFLECTION_PROBE_PLANAR:14,SAMPLER_REFLECTION_PROBE_DATA_MAP:15,COUNT:16},PIPELINE_FLOW_FORWARD:Sb,PIPELINE_FLOW_MAIN:bb,PIPELINE_FLOW_SHADOW:wb,PIPELINE_FLOW_SMAA:"SMAAFlow",PIPELINE_FLOW_TONEMAP:"ToneMapFlow",PipelineGlobalBindings:{UBO_GLOBAL:0,UBO_CAMERA:1,UBO_SHADOW:2,UBO_CSM:3,SAMPLER_SHADOWMAP:4,SAMPLER_ENVIRONMENT:5,SAMPLER_SPOT_SHADOW_MAP:6,SAMPLER_DIFFUSEMAP:7,COUNT:8},RenderPassStage:xb,RenderPriority:{MIN:0,MAX:255,DEFAULT:128},SetIndex:{GLOBAL:0,MATERIAL:1,LOCAL:2,COUNT:3},UBOCSM:Mb,UBOCSMEnum:{CSM_LEVEL_COUNT:4,CSM_VIEW_DIR_0_OFFSET:0,CSM_VIEW_DIR_1_OFFSET:16,CSM_VIEW_DIR_2_OFFSET:32,CSM_ATLAS_OFFSET:48,MAT_CSM_VIEW_PROJ_OFFSET:64,CSM_PROJ_DEPTH_INFO_OFFSET:128,CSM_PROJ_INFO_OFFSET:144,CSM_SPLITS_INFO_OFFSET:160,COUNT:164,SIZE:656},UBOCamera:Bb,UBOCameraEnum:{MAT_VIEW_OFFSET:0,MAT_VIEW_INV_OFFSET:16,MAT_PROJ_OFFSET:32,MAT_PROJ_INV_OFFSET:48,MAT_VIEW_PROJ_OFFSET:64,MAT_VIEW_PROJ_INV_OFFSET:80,CAMERA_POS_OFFSET:96,SURFACE_TRANSFORM_OFFSET:100,SCREEN_SCALE_OFFSET:104,EXPOSURE_OFFSET:108,MAIN_LIT_DIR_OFFSET:112,MAIN_LIT_COLOR_OFFSET:116,AMBIENT_SKY_OFFSET:120,AMBIENT_GROUND_OFFSET:124,GLOBAL_FOG_COLOR_OFFSET:128,GLOBAL_FOG_BASE_OFFSET:132,GLOBAL_FOG_ADD_OFFSET:136,NEAR_FAR_OFFSET:140,VIEW_PORT_OFFSET:144,COUNT:148,SIZE:592},UBODeferredLight:Jb,UBOForwardLight:Yb,UBOForwardLightEnum:{LIGHTS_PER_PASS:1,LIGHT_POS_OFFSET:0,LIGHT_COLOR_OFFSET:4,LIGHT_SIZE_RANGE_ANGLE_OFFSET:8,LIGHT_DIR_OFFSET:12,LIGHT_BOUNDING_SIZE_VS_OFFSET:16,COUNT:20,SIZE:80},UBOGlobal:Db,UBOGlobalEnum:{TIME_OFFSET:0,SCREEN_SIZE_OFFSET:4,NATIVE_SIZE_OFFSET:8,PROBE_INFO_OFFSET:12,DEBUG_VIEW_MODE_OFFSET:16,COUNT:20,SIZE:80},UBOLocal:Hb,UBOLocalBatched:Xb,UBOLocalEnum:{MAT_WORLD_OFFSET:0,MAT_WORLD_IT_OFFSET:16,LIGHTINGMAP_UVPARAM:32,LOCAL_SHADOW_BIAS:36,REFLECTION_PROBE_DATA1:40,REFLECTION_PROBE_DATA2:44,REFLECTION_PROBE_BLEND_DATA1:48,REFLECTION_PROBE_BLEND_DATA2:52,COUNT:56,SIZE:224,BINDING:0},UBOMorph:eS,UBOMorphEnum:{MAX_MORPH_TARGET_COUNT:60,OFFSET_OF_WEIGHTS:0,OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH:240,OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT:244,OFFSET_OF_VERTICES_COUNT:248,COUNT_BASE_4_BYTES:64,SIZE:256},UBOSH:nS,UBOSHEnum:{SH_LINEAR_CONST_R_OFFSET:0,SH_LINEAR_CONST_G_OFFSET:4,SH_LINEAR_CONST_B_OFFSET:8,SH_QUADRATIC_R_OFFSET:12,SH_QUADRATIC_G_OFFSET:16,SH_QUADRATIC_B_OFFSET:20,SH_QUADRATIC_A_OFFSET:24,COUNT:28,SIZE:112,BINDING:6},UBOShadow:Ib,UBOShadowEnum:{MAT_LIGHT_VIEW_OFFSET:0,MAT_LIGHT_VIEW_PROJ_OFFSET:16,SHADOW_INV_PROJ_DEPTH_INFO_OFFSET:32,SHADOW_PROJ_DEPTH_INFO_OFFSET:36,SHADOW_PROJ_INFO_OFFSET:40,SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET:44,SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET:48,SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET:52,SHADOW_COLOR_OFFSET:56,PLANAR_NORMAL_DISTANCE_INFO_OFFSET:60,COUNT:64,SIZE:256},UBOSkinning:$b,UBOSkinningAnimation:Qb,UBOSkinningTexture:Kb,UBOUILocal:iS,UBOWorldBound:Wb,UNIFORM_DIFFUSEMAP_BINDING:7,UNIFORM_ENVIRONMENT_BINDING:5,UNIFORM_JOINT_TEXTURE_BINDING:7,UNIFORM_LIGHTMAP_TEXTURE_BINDING:bS,UNIFORM_NORMAL_MORPH_TEXTURE_BINDING:9,UNIFORM_POSITION_MORPH_TEXTURE_BINDING:8,UNIFORM_REALTIME_JOINT_TEXTURE_BINDING:7,UNIFORM_REFLECTION_PROBE_BLEND_CUBEMAP_BINDING:16,UNIFORM_REFLECTION_PROBE_CUBEMAP_BINDING:DS,UNIFORM_REFLECTION_PROBE_DATA_MAP_BINDING:15,UNIFORM_REFLECTION_PROBE_TEXTURE_BINDING:PS,UNIFORM_SHADOWMAP_BINDING:4,UNIFORM_SPOT_SHADOW_MAP_TEXTURE_BINDING:6,UNIFORM_SPRITE_TEXTURE_BINDING:12,UNIFORM_TANGENT_MORPH_TEXTURE_BINDING:10,bindingMappingInfo:Cb,getDefaultShadowTexture:WS,globalDescriptorSetLayout:Tb,isEnableEffect:qS,localDescriptorSetLayout:Ab,localDescriptorSetLayout_ResizeMaxJoints:tS,supportsR16HalfFloatTexture:function(t){return!(3&~t.getFormatFeatures(8))},supportsR32FloatTexture:jS,supportsRGBA16HalfFloatTexture:function(t){return!(3&~t.getFormatFeatures(41))},supportsRGBA32FloatTexture:function(t){return!(3&~t.getFormatFeatures(44))}}));var XS=4227858432,YS=66060288,JS=1044480,KS=function(t,e,i,n){return void 0===n&&(n=0),e<<26&XS|t<<20&YS|i<<12&JS|4095&n},QS=function(t){return(t&XS)>>>26},ZS=function(t){return(t&YS)>>>20},$S=function(t){return(t&JS)>>>12},tw=function(t){return 4095&t},ew=function(t,e){return 67108863&t|e<<26&XS},iw=((VS={})[0]=function(t,e,i){return void 0===i&&(i=0),at(12010,i)},VS[5]=function(t,e,i){return void 0===i&&(i=0),t[i]},VS[6]=function(t,e,i){return void 0===i&&(i=0),ds.fromArray(e,t,i)},VS[7]=function(t,e,i){return void 0===i&&(i=0),ir.fromArray(e,t,i)},VS[8]=function(t,e,i){return void 0===i&&(i=0),Vn.fromArray(e,t,i)},VS[13]=function(t,e,i){return void 0===i&&(i=0),t[i]},VS[14]=function(t,e,i){return void 0===i&&(i=0),ds.fromArray(e,t,i)},VS[15]=function(t,e,i){return void 0===i&&(i=0),ir.fromArray(e,t,i)},VS[16]=function(t,e,i){return void 0===i&&(i=0),Vn.fromArray(e,t,i)},VS[21]=function(t,e,i){return void 0===i&&(i=0),yr.fromArray(e,t,i)},VS[25]=function(t,e,i){return void 0===i&&(i=0),Kr.fromArray(e,t,i)},VS),nw=((NS={})[0]=function(t,e,i){return void 0===i&&(i=0),at(12010,i)},NS[5]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},NS[6]=function(t,e,i){return void 0===i&&(i=0),ds.toArray(t,e,i)},NS[7]=function(t,e,i){return void 0===i&&(i=0),ir.toArray(t,e,i)},NS[8]=function(t,e,i){return void 0===i&&(i=0),Vn.toArray(t,e,i)},NS[13]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},NS[14]=function(t,e,i){return void 0===i&&(i=0),ds.toArray(t,e,i)},NS[15]=function(t,e,i){return void 0===i&&(i=0),ir.toArray(t,e,i)},NS[16]=function(t,e,i){return void 0===i&&(i=0),Vn.toArray(t,e,i)},NS[21]=function(t,e,i){return void 0===i&&(i=0),yr.toArray(t,e,i)},NS[25]=function(t,e,i){return void 0===i&&(i=0),Kr.toArray(t,e,i)},NS),rw=((zS={})[5]=function(t){return"number"==typeof t},zS[13]=function(t){return"number"==typeof t},zS[6]=function(t){return!!(t instanceof ds)},zS[14]=function(t){return!!(t instanceof ds)},zS[7]=function(t){return!!(t instanceof ir)},zS[15]=function(t){return!!(t instanceof ir)},zS[8]=function(t){return!!(t instanceof Vn)},zS[16]=function(t){return!!(t instanceof Vn||t instanceof cr||t instanceof kr)},zS[21]=function(t){return!!(t instanceof yr)},zS[25]=function(t){return!!(t instanceof Kr)},zS),sw=[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 aw(t){switch(t){case 1:case 5:case 9:case 13:return sw[0];case 2:case 6:case 10:case 14:return sw[1];case 4:case 8:case 12:case 16:return sw[2];case 25:return sw[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 sw[0]}function ow(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 hw(t,e){for(var i=Object.entries(e),n=!1,r=0;r<i.length;r++)t[i[r][0]]!==i[r][1]&&(t[i[r][0]]=i[r][1],n=!0);return n}function uw(t,e){switch(t.type){case"boolean":return"number"==typeof e?e.toString():e?"1":"0";case"string":return void 0!==e?e:t.options[0];case"number":return void 0!==e?e.toString():t.range[0].toString();default:return at(16369),"-1"}}function lw(t,e){for(var i=[],n=0;n<e.length;n++){var r=e[n],s=r.name,a=t[s],o=uw(r,a),h=!a||"0"===a;i.push({name:s,value:o,isDefault:h})}return i}function cw(t,e){return t+e.reduce((function(t,e){return e.isDefault?t:t+"|"+e.name+e.value}),"")}function fw(t,e){for(var i=0;i<t.length;i++){var n=t[i];if("!"===n[0]){if(e[n.slice(1)])return!1}else if(!e[n])return!1}return!0}function _w(t,e,i){for(var n=[],r=t.attributes,s=0;s<r.length;s++)fw(r[s].defines,i)&&n.push(e[s]);return n}function dw(t,e){var i=t.defines;if(t.uber){for(var n="",r=0;r<i.length;r++){var s=i[r],a=e[s.name];if(a&&s._map){var o=s._map(a);n+=""+s._offset+o+"|"}}return""+n+t.hash}for(var h=0,u=0;u<i.length;u++){var l=i[u],c=e[l.name];c&&l._map&&(h|=l._map(c)<<l._offset)}return h.toString(16)+"|"+t.hash}var pw=new Map;function mw(t,e){if(e.count)return t+lp(e.type)*e.count;var i=pw.get(e.name);return void 0!==i?t+lp(e.type)*i:(ht(16345,e.name),t)}function gw(t){for(var e={},i=0;i<t.blocks.length;i++)for(var n=t.blocks[i],r=n.members,s=0,a=0;a<r.length;a++){var o=r[a];e[o.name]=KS(n.binding,o.type,o.count,s),s+=(lp(o.type)>>2)*o.count}for(var h=0;h<t.samplerTextures.length;h++){var u=t.samplerTextures[h];e[u.name]=KS(u.binding,u.type,u.count)}return e}function yw(t){return Math.ceil(Math.log2(Math.max(t,2)))}function vw(t){for(var e=0,i=function(){var i=t.defines[n],r=1;if("number"===i.type){var s=i.range;r=yw(s[1]-s[0]+1),i._map=function(t){return t-s[0]}}else"string"===i.type?(r=yw(i.options.length),i._map=function(t){return Math.max(0,i.options.findIndex((function(e){return e===t})))}):"boolean"===i.type&&(i._map=function(t){return t?1:0});i._offset=e,e+=r},n=0;n<t.defines.length;n++)i();for(var r in e>31&&(t.uber=!0),t.constantMacros="",t.builtins.statistics)t.constantMacros+="#define "+r+" "+t.builtins.statistics[r]+"\n"}function bw(t){var e=Object.keys(t).reduce((function(e,i){return e.reduce((function(e,n){for(var s=t[i],a=0;a<s.length;++a){var o=r({},n);o[i]=s[a],e.push(o)}return e}),[])}),[{}]);return e}function Sw(t){for(var e=0;e<t.techniques.length;e++)for(var i=t.techniques[e],n=0;n<i.passes.length;n++){var r=i.passes[n];void 0!==r.propertyIndex&&void 0===r.properties&&(r.properties=i.passes[r.propertyIndex].properties)}}pw.set("cc_joints",$b.LAYOUT.members[0].count),pw.set("cc_lightPos",1),pw.set("cc_lightColor",1),pw.set("cc_lightSizeRangeAngle",1),pw.set("cc_lightDir",1),pw.set("cc_lightBoundingSizeVS",1);var ww=new zd;function xw(t,e,i,n){for(var r=t.builtins[n],s=[],a=function(){var t=r.blocks[o],e=i.layouts[t.name],n=e&&i.bindings.find((function(t){return t.binding===e.binding}));if(!(e&&n&&n.descriptorType&np))return at(16348,t.name),1;s.push(e)},o=0;o<r.blocks.length;o++)a();Array.prototype.unshift.apply(e.shaderInfo.blocks,s);for(var h=[],u=function(){var t=r.samplerTextures[l],e=i.layouts[t.name],n=e&&i.bindings.find((function(t){return t.binding===e.binding}));if(!(e&&n&&n.descriptorType&rp))return at(16349,t.name),1;h.push(e)},l=0;l<r.samplerTextures.length;l++)u();Array.prototype.unshift.apply(e.shaderInfo.samplerTextures,h)}var Tw=function(){function t(){this._templates={},this._cache={},this._templateInfos={}}var e=t.prototype;return e.register=function(t){for(var e=0;e<t.shaders.length;e++)this.define(t.shaders[e]).effectName=t.name;for(var i=0;i<t.techniques.length;i++)for(var n=t.techniques[i],r=0;r<n.passes.length;r++){var s=n.passes[r];void 0!==s.propertyIndex&&void 0===s.properties&&(s.properties=n.passes[s.propertyIndex].properties)}},e.define=function(t){var e=this._templates[t.name];if(e&&e.hash===t.hash)return e;var i=r({},t);if(vw(i),this._templates[t.name]=i,!this._templateInfos[i.hash]){var n={};n.samplerStartBinding=i.blocks.length,n.shaderInfo=new Dd,n.blockSizes=[],n.bindings=[];for(var s=0;s<i.blocks.length;s++){var a=i.blocks[s];n.blockSizes.push(a.members.reduce(mw,0)),n.bindings.push(new Nd(a.binding,1,1,a.stageFlags)),n.shaderInfo.blocks.push(new yd(1,a.binding,a.name,a.members.map((function(t){return new gd(t.name,t.type,t.count)})),1))}for(var o=0;o<i.samplerTextures.length;o++){var h=i.samplerTextures[o];n.bindings.push(new Nd(h.binding,16,h.count,h.stageFlags)),n.shaderInfo.samplerTextures.push(new vd(1,h.binding,h.name,h.type,h.count))}for(var u=0;u<i.samplers.length;u++){var l=i.samplers[u];n.bindings.push(new Nd(l.binding,32,l.count,l.stageFlags)),n.shaderInfo.samplers.push(new bd(1,l.binding,l.name,l.count))}for(var c=0;c<i.textures.length;c++){var f=i.textures[c];n.bindings.push(new Nd(f.binding,64,f.count,f.stageFlags)),n.shaderInfo.textures.push(new Sd(1,f.binding,f.name,f.type,f.count))}for(var _=0;_<i.buffers.length;_++){var d=i.buffers[_];n.bindings.push(new Nd(d.binding,4,1,d.stageFlags)),n.shaderInfo.buffers.push(new xd(1,d.binding,d.name,1,d.memoryAccess))}for(var p=0;p<i.images.length;p++){var m=i.images[p];n.bindings.push(new Nd(m.binding,128,m.count,m.stageFlags)),n.shaderInfo.images.push(new wd(1,m.binding,m.name,m.type,m.count,m.memoryAccess))}for(var g=0;g<i.subpassInputs.length;g++){var y=i.subpassInputs[g];n.bindings.push(new Nd(y.binding,256,y.count,y.stageFlags)),n.shaderInfo.subpassInputs.push(new Td(1,y.binding,y.name,y.count))}n.gfxAttributes=[];for(var v=0;v<i.attributes.length;v++){var b=i.attributes[v];n.gfxAttributes.push(new Cd(b.name,b.format,b.isNormalized,0,b.isInstanced,b.location))}xw(i,n,Ab,"locals"),n.shaderInfo.stages.push(new Ad(1,"")),n.shaderInfo.stages.push(new Ad(16,"")),n.handleMap=gw(i),n.setLayouts=[],this._templateInfos[i.hash]=n}return i},e.getTemplate=function(t){return this._templates[t]},e.getTemplateInfo=function(t){var e=this._templates[t].hash;return this._templateInfos[e]},e.getDescriptorSetLayout=function(t,e,i){void 0===i&&(i=!1);var n=this._templates[e],r=this._templateInfos[n.hash];return r.setLayouts.length||(ww.bindings=r.bindings,r.setLayouts[1]=t.createDescriptorSetLayout(ww),ww.bindings=Ab.bindings,r.setLayouts[2]=t.createDescriptorSetLayout(ww)),r.setLayouts[i?2:1]},e.hasProgram=function(t){return void 0!==this._templates[t]},e.getKey=function(t,e){return dw(this._templates[t],e)},e.destroyShaderByDefines=function(t){var e=this,i=Object.keys(t);if(i.length)for(var n=i.map((function(e){var i=t[e];return"boolean"==typeof i&&(i=i?"1":"0"),new RegExp(""+e+i)})),r=Object.keys(this._cache).filter((function(t){return n.every((function(i){return i.test(e._cache[t].name)}))})),s=0;s<r.length;s++){var a=r[s],o=this._cache[a];Q("destroyed shader "+o.name),o.destroy(),delete this._cache[a]}},e.getGFXShader=function(t,e,i,n,r){Object.assign(i,n.macros),r||(r=this.getKey(e,i));var s=this._cache[r];if(s)return s;var a=this._templates[e],o=this._templateInfos[a.hash];o.pipelineLayout||(this.getDescriptorSetLayout(t,e),xw(a,o,Tb,"globals"),o.setLayouts[0]=n.descriptorSetLayout,o.pipelineLayout=t.createPipelineLayout(new Gd(o.setLayouts)));var h=lw(i,a.defines),u=n.constantMacros+a.constantMacros+h.reduce((function(t,e){return t+"#define "+e.name+" "+e.value+"\n"}),""),l=a.glsl3,c=Aw(t);c?l=a[c]:ht(16346),o.shaderInfo.stages[0].source=u+l.vert,o.shaderInfo.stages[1].source=u+l.frag,o.shaderInfo.attributes=_w(a,o.gfxAttributes,i),o.shaderInfo.name=cw(e,h);var f=o.shaderInfo;return this._cache[r]=t.createShader(f)},t}();function Aw(t){switch(t.gfxAPI){case 1:case 6:return"glsl1";case 2:case 7:return"glsl3";default:return"glsl4"}}var Cw,Dw,Bw,Iw,Mw,Pw,Ew,Ow=new Tw;A.programLib=Ow;var kw=["planar-shadow","skybox","deferred-lighting","bloom","hbao","copy-pass","post-process","profiler","splash-screen","unlit","sprite","particle","particle-gpu","particle-trail","billboard","terrain","graphics","clear-stencil","spine","occlusion-query","geometry-renderer","debug-renderer","ssss-blur","float-output-process"],Rw=t("e7",Kh("cc.EffectAsset")((Ew=function(t){function e(e){var i;return(i=t.call(this,e)||this).techniques=Bw&&Bw(),i.shaders=Iw&&Iw(),i.combinations=Mw&&Mw(),i.hideInEditor=Pw&&Pw(),i}s(e,t),e.register=function(t){e._effects[t.name]=t,e._layoutValid=!1},e.remove=function(t){if("string"!=typeof t)e._effects[t.name]&&e._effects[t.name]===t&&delete e._effects[t.name];else{if(e._effects[t])return void delete e._effects[t];for(var i in e._effects)if(e._effects[i]._uuid===t)return void delete e._effects[i]}},e.get=function(t){if(e._effects[t])return e._effects[t];for(var i in e._effects)if(e._effects[i]._uuid===t)return e._effects[i];return kw.includes(t)&&at(16101,t),null},e.getAll=function(){return e._effects},e.isLayoutValid=function(){return e._layoutValid},e.setLayoutValid=function(){e._layoutValid=!0};var i=e.prototype;return i.onLoaded=function(){if(A.rendering&&A.rendering.enableEffectImport){Sw(this);var t=A.rendering.programLib;t.addEffect(this),t.init(Wp.gfxDevice)}else Ow.register(this);e.register(this),A.game.once(A.Game.EVENT_RENDERER_INITED,this._precompile,this)},i._precompile=function(){var t=this;if(A.rendering&&A.rendering.enableEffectImport)A.rendering.programLib.precompileEffect(Wp.gfxDevice,this);else for(var e=A.director.root,i=function(){var i=t.shaders[n],r=t.combinations[n];if(!r)return 1;bw(r).forEach((function(t){return Ow.getGFXShader(Wp.gfxDevice,i.name,t,e.pipeline)}))},n=0;n<this.shaders.length;n++)i()},i.destroy=function(){return e.remove(this),t.prototype.destroy.call(this)},i.initDefault=function(i){t.prototype.initDefault.call(this,i);var n=e.get("builtin-unlit");this.name="builtin-unlit",this.shaders=n.shaders,this.combinations=n.combinations,this.techniques=n.techniques},i.validate=function(){return this.techniques.length>0&&this.shaders.length>0},e}(Cm),Ew._effects={},Ew._layoutValid=!0,Bw=zh((Dw=Ew).prototype,"techniques",[uu],(function(){return[]})),Iw=zh(Dw.prototype,"shaders",[uu],(function(){return[]})),Mw=zh(Dw.prototype,"combinations",[uu],(function(){return[]})),Pw=zh(Dw.prototype,"hideInEditor",[uu,cu],(function(){return!1})),Cw=Dw))||Cw);A.EffectAsset=Rw;var Fw=function(t,e){return!(t.length>e.length)||47===t.charCodeAt(e.length)},Lw=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;a<o;a++)e[a]=lm(e[a]);for(var h in i){var u=i[h],l=u[1];u[1]=n[l]}}else{for(var c=Object.create(null),f=0,_=e.length;f<_;f++){var d=e[f];e[f]=c[d]=lm(d)}e=c}for(var p in i){var m=i[p];s[e[p]]=m}var g=t.scenes;for(var y in g){var v=g[y];g[y]=e[v]}var b=t.packs;for(var S in b)for(var w=b[S],x=0;x<w.length;++x)w[x]=e[w[x]];var T=t.versions;if(T)for(var A in T)for(var C=T[A],D=0;D<C.length;D+=2){var B=C[D];C[D]=e[B]||B}var I=t.redirect;if(I)for(var M=0;M<I.length;M+=2)I[M]=e[I[M]],I[M+1]=r[I[M+1]];if(t.extensionMap){var P=function(i){if(!Object.prototype.hasOwnProperty.call(t.extensionMap,i))return 1;t.extensionMap[i].forEach((function(n,r){t.extensionMap[i][r]=e[n]||n}))};for(var E in t.extensionMap)P(E)}},Vw=function(){function t(){this.name="",this.base="",this.importBase="",this.nativeBase="",this.deps=null,this.assetInfos=new Yp,this.scenes=new Yp,this.paths=new Yp}var e=t.prototype;return e.init=function(t){var e=this;Lw(t),this.importBase=t.importBase||"",this.nativeBase=t.nativeBase||"",this.base=t.base||"",this.name=t.name||"",this.deps=t.deps||[],this._initUuid(t.uuids),this._initPath(t.paths),this._initScene(t.scenes),this._initPackage(t.packs),this._initVersion(t.versions),this._initRedirect(t.redirect);var i=function(i){if(!Object.prototype.hasOwnProperty.call(t.extensionMap,i))return 1;t.extensionMap[i].forEach((function(t){var n=e.assetInfos.get(t);n&&(n.extension=i)}))};for(var n in t.extensionMap)i(n)},e.getInfoWithPath=function(t,e){if(!t)return null;t=pm(t);var i=this.paths.get(t);if(i){if(!e)return i[0];for(var n=0,r=i.length;n<r;n++){var s=i[n];if(ie(s.ctor,e))return s}}return null},e.getDirWithPath=function(t,e,i){"/"===(t=pm(t))[t.length-1]&&(t=t.slice(0,-1));var n=i||[];return this.paths.forEach((function(i,r){if(r.startsWith(t)&&Fw(r,t)||!t)for(var s=0,a=i.length;s<a;s++){var o=i[s];e&&!ie(o.ctor,e)||n.push(o)}})),n},e.getAssetInfo=function(t){return this.assetInfos.get(t)||null},e.getSceneInfo=function(t){t.endsWith(".scene")||(t+=".scene"),"/"===t[0]||t.startsWith("db://")||(t="/"+t);var e=this.scenes.find((function(e,i){return i.endsWith(t)}));return e},e.destroy=function(){this.paths.destroy(),this.scenes.destroy(),this.assetInfos.destroy()},e._initUuid=function(t){if(t){this.assetInfos.clear();for(var e=0,i=t.length;e<i;e++){var n=t[e];this.assetInfos.add(n,{uuid:n})}}},e._initPath=function(t){if(t){var e=this.paths;for(var i in e.clear(),t){var n=t[i],r=n[0],s=n[1],a=3===n.length,o=this.assetInfos.get(i);o.path=r,o.ctor=_e(s),e.has(r)?a?e.get(r).push(o):e.get(r).unshift(o):e.add(r,[o])}}},e._initScene=function(t){if(t){var e=this.scenes;e.clear();var i=this.assetInfos;for(var n in t){var r=t[n],s=i.get(r);s.url=n,e.add(n,s)}}},e._initPackage=function(t){if(t){var e=this.assetInfos;for(var i in t){var n=t[i],r={uuid:i,packedUuids:n,ext:".json"};e.add(i,r);for(var s=0,a=n.length;s<a;s++){var o=n[s],h=e.get(o),u=h.packs;u?1===a?u.unshift(r):u.push(r):h.packs=[r]}}}},e._initVersion=function(t){if(t){var e=this.assetInfos,i=t.import;if(i)for(var n=0,r=i.length;n<r;n+=2){var s=i[n];e.get(s).ver=i[n+1]}if(i=t.native)for(var a=0,o=i.length;a<o;a+=2){var h=i[a];e.get(h).nativeVer=i[a+1]}}},e._initRedirect=function(t){if(t)for(var e=this.assetInfos,i=0,n=t.length;i<n;i+=2){var r=t[i];e.get(r).redirect=t[i+1]}},t}();function Nw(t,e){t._uuid&&e.push(t._uuid)}function zw(t,e){for(var i=Object.getOwnPropertyNames(t),n=0;n<i.length;n++){var r=i[n];if("node"!==r&&"__eventTargets"!==r){var s=t[r];if("object"==typeof s&&s)if(Array.isArray(s))for(var a=0;a<s.length;a++){var o=s[a];o instanceof Cm&&Nw(o,e)}else if(s.constructor&&s.constructor!==Object)s instanceof Cm&&Nw(s,e);else for(var h=Object.getOwnPropertyNames(s),u=0;u<h.length;u++){var l=s[h[u]];l instanceof Cm&&Nw(l,e)}}}}function Uw(t,e){for(var i=0;i<t._components.length;i++)zw(t._components[i],e);for(var n=0;n<t._children.length;n++)Uw(t._children[n],e)}function Gw(t,e,i,n){i.push(t._uuid);for(var r=Sy.getDeps(t._uuid),s=0,a=r.length;s<a;s++){var o=Kp.get(r[s]);if(o){var h=o._uuid;h in e?e[h]+=n:e[h]=o.refCount+n,i.includes(h)||Gw(o,e,i,n)}}}var Hw=[];function Ww(t){var e=Object.create(null);if(e[t._uuid]=t.refCount,Gw(t,e,Hw,-1),Hw.length=0,0!==e[t._uuid])return e[t._uuid];for(var i in e)0!==e[i]&&Gw(Kp.get(i),e,Hw,1);return Hw.length=0,e[t._uuid]}var jw=function(){function t(){this._persistNodeDeps=new Yp,this._toDelete=new Yp,this._eventListener=!1,this._dontDestroyAssets=[]}var e=t.prototype;return e.addIgnoredAsset=function(t){this._dontDestroyAssets.push(t._uuid)},e.init=function(){this._persistNodeDeps.clear(),this._toDelete.clear()},e._addPersistNodeRef=function(t){var e=[];Uw(t,e);for(var i=0,n=e.length;i<n;i++){var r=Kp.get(e[i]);r&&r.addRef()}this._persistNodeDeps.add(t.uuid,e)},e._removePersistNodeRef=function(t){if(this._persistNodeDeps.has(t.uuid)){for(var e=this._persistNodeDeps.get(t.uuid),i=0,n=e.length;i<n;i++){var r=Kp.get(e[i]);r&&r.decRef()}this._persistNodeDeps.remove(t.uuid)}},e._autoRelease=function(t,e,i){if(t){for(var n=Sy.getDeps(t.uuid),r=0,s=n.length;r<s;r++){var a=Kp.get(n[r]);a&&a.decRef(t.autoReleaseAssets)}var o=Sy._depends.get(t.uuid);if(o&&o.persistDeps)for(var h=o.persistDeps,u=0,l=h.length;u<l;u++){var c=Kp.get(h[u]);c&&c.decRef(t.autoReleaseAssets)}t.uuid!==e.uuid&&Sy.remove(t.uuid)}var f=Sy._depends.get(e.uuid);for(var _ in f&&(f.persistDeps=[]),i){for(var d,m,g=i[_],y=this._persistNodeDeps.get(g.uuid),v=p(y);!(m=v()).done;){var b=m.value,S=Kp.get(b);S&&S.addRef()}f&&(d=f.persistDeps).push.apply(d,y)}},e.tryRelease=function(t,e){void 0===e&&(e=!1),t instanceof Cm&&(e?this._free(t,e):(this._toDelete.add(t._uuid,t),this._eventListener||(this._eventListener=!0,Ze(this._freeAssets.bind(this)))))},e._freeAssets=function(){var t=this;this._eventListener=!1,this._toDelete.forEach((function(e){t._free(e)})),this._toDelete.clear()},e._free=function(t,e){void 0===e&&(e=!1);var i=t._uuid;if(this._toDelete.remove(i),bo(t,!0)&&-1===this._dontDestroyAssets.indexOf(i)&&!(!e&&t.refCount>0&&Ww(t)>0)){Kp.remove(i);for(var n=Sy.getDeps(i),r=0,s=n.length;r<s;r++){var a=Kp.get(n[r]);a&&(a.decRef(!1),this._free(a,!1))}t.destroy(),Sy.remove(i)}},t}(),qw=new jw,Xw=null;function Yw(t){for(var e=0,i=t.input.length;e<i;e++){var n=t.input[e];!n.isNative&&n.content instanceof Cm&&n.content.decRef(!1),n.recycle()}t.input=null}function Jw(t,e){return e?/\?/.test(t)?t+"&_t="+Date.now():t+"?_t="+Date.now():t}function Kw(t,e,i,n,r){void 0===r&&(r=0),t(r,(function(s,a){r++,!s||r>e?n&&n(s,a):setTimeout((function(){Kw(t,e,i,n,r)}),i)}))}function Qw(t,e,i,n,s){try{for(var a=Sy.parse(t,e),o=0,h=a.deps.length;o<h;o++){var u=a.deps[o];u in i||(i[u]=!0,n.push({uuid:u,bundle:s&&s.name}))}a.nativeDep&&(s&&(a.nativeDep.bundle=s.name),n.push(r({},a.nativeDep)))}catch(t){J(t.message,t.stack)}}function Zw(t,e,i){e&&(i=void 0!==i?i:A.assetManager.cacheAsset,dm(e)||!i||e.isDefault||Kp.add(t,e))}function $w(t,e,i){var n=!1,r=py.get(e);if(r){for(var s=0,a=r.length;s<a;s++){var o=r[s],h=i[o.uuid+"@import"];if(h)o.owner[o.prop]=h.addRef();else{if(ht(16350,o.uuid),A.assetManager.dispatchAssetMissing(e,o.owner,o.prop,o.uuid),o.type&&o.type!==Cm){var u=new o.type;u.initDefault(o.uuid),o.owner[o.prop]=u}n=!0}}py.delete(e)}return my.has(e)&&(i[t+"@native"]?e._nativeAsset=i[t+"@native"]:(n=!0,ht(16351,t)),my.delete(e)),n}function tx(t){var e=t.source;if(t.options.__outputAsArray__||1!==e.length)for(var i=t.output=[],n=0,r=e.length;n<r;n++)i.push(e[n].content);else t.output=e[0].content}function ex(t,e,i){var n=0,r=[],s=t.length;0===s&&i&&i(r);for(var a=function(t){t&&r.push(t),++n===s&&i&&i(r)},o=0;o<s;o++)e(t[o],a)}function ix(t,e,i){var n=t,r=e,s=i;if(void 0===i){var a="function"==typeof t;e?(s=e,a||(r=null)):void 0===e&&a&&(s=t,n=null,r=null),void 0!==e&&a&&(r=t,n=null)}return{options:n||Object.create(null),onProgress:r,onComplete:s}}function nx(t,e,i){var n=t,r=e,s=i;if(void 0===i){var a=ie(t,Cm);e?(s=e,a&&(r=null)):void 0!==e||a||(s=t,r=null,n=null),void 0===e||a||(r=t,n=null)}return{type:n,onProgress:r||Xw,onComplete:s}}function rx(t,e,i,n){if(void 0===n&&(n={}),!i[e]||n[e])return!1;n[e]=!0;var r=!1,s=Sy.getDeps(e);if(s)for(var a=0,o=s.length;a<o;a++){var h=s[a];if(h===t||rx(t,h,i,n)){r=!0;break}}return r}function sx(t){return function(e,i){if(t){var n=[];Array.isArray(i)?i.forEach((function(t){return t instanceof Cm&&n.push(t.addRef())})):i instanceof Cm&&n.push(i.addRef()),Ze((function(){n.forEach((function(t){return t.decRef(!1)})),t(e,i)}))}}}var ax=function(){function t(){this._config=new Vw}var e=t.prototype;return e.getInfoWithPath=function(t,e){return this._config.getInfoWithPath(t,e)},e.getDirWithPath=function(t,e,i){return this._config.getDirWithPath(t,e,i)},e.getAssetInfo=function(t){return this._config.getAssetInfo(t)},e.getSceneInfo=function(t){return this._config.getSceneInfo(t)},e.init=function(t){this._config.init(t),$p.add(t.name,this)},e.load=function(t,e,i,n){var r=nx(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete,h={__requestType__:"path",type:s,bundle:this.name,__outputAsArray__:Array.isArray(t)};A.assetManager.loadAny(t,h,a,o)},e.preload=function(t,e,i,n){var r=nx(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;A.assetManager.preloadAny(t,{__requestType__:"path",type:s,bundle:this.name},a,o)},e.loadDir=function(t,e,i,n){var r=nx(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;A.assetManager.loadAny(t,{__requestType__:"dir",type:s,bundle:this.name,__outputAsArray__:!0},a,o)},e.preloadDir=function(t,e,i,n){var r=nx(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;A.assetManager.preloadAny(t,{__requestType__:"dir",type:s,bundle:this.name},a,o)},e.loadScene=function(t,e,i,n){var r=ix(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"scene",s.bundle=this.name,A.assetManager.loadAny({scene:t},s,a,(function(t,e){if(t)J(t.message,t.stack);else if(e.scene){var i=e.scene;i.id=e._uuid,i.name=e.name}else t=new Error("The asset "+e._uuid+" is not a scene");o&&o(t,e)}))},e.preloadScene=function(t,e,i,n){var r=ix(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.bundle=this.name,A.assetManager.preloadAny({scene:t},s,a,(function(e){e&&ht(1210,t,e.message),o&&o(e)}))},e.get=function(t,e){var i=this.getInfoWithPath(t,e);return i&&Kp.get(i.uuid)||null},e.release=function(t,e){var i=this.get(t,e);i&&qw.tryRelease(i,!0)},e.releaseUnusedAssets=function(){var t=this;Kp.forEach((function(e){var i=t.getAssetInfo(e._uuid);i&&!i.redirect&&qw.tryRelease(e)}))},e.releaseAll=function(){var t=this;Kp.forEach((function(e){var i=t.getAssetInfo(e._uuid);i&&!i.redirect&&qw.tryRelease(e,!0)}))},e._destroy=function(){this._config.destroy()},n(t,[{key:"config",get:function(){return this._config}},{key:"name",get:function(){return this._config.name}},{key:"deps",get:function(){return this._config.deps}},{key:"base",get:function(){return this._config.base}}]),t}(),ox=t("ef",new ax);function hx(t,e,i){var n=new B.Image;function r(){n.removeEventListener("load",r),n.removeEventListener("error",s),i&&i(null,n)}function s(){n.removeEventListener("load",r),n.removeEventListener("error",s),i&&i(new Error(ft(4930,t)))}return"file:"!==B.location.protocol&&(n.crossOrigin="anonymous"),n.addEventListener("load",r),n.addEventListener("error",s),n.src=t,n}function ux(t,e,i,n){var r=new XMLHttpRequest,s="download failed: "+t+", status: ";if(r.open("GET",t,!0),void 0!==e.xhrResponseType&&(r.responseType=e.xhrResponseType),void 0!==e.xhrWithCredentials&&(r.withCredentials=e.xhrWithCredentials),void 0!==e.xhrMimeType&&r.overrideMimeType&&r.overrideMimeType(e.xhrMimeType),void 0!==e.xhrTimeout&&(r.timeout=e.xhrTimeout),e.xhrHeader)for(var a in e.xhrHeader)r.setRequestHeader(a,e.xhrHeader[a]);return r.onload=function(){200===r.status||0===r.status?n&&n(null,r.response):n&&n(new Error(""+s+r.status+"(no response)"))},i&&(r.onprogress=function(t){t.lengthComputable&&i(t.loaded,t.total)}),r.onerror=function(){n&&n(new Error(""+s+r.status+"(error)"))},r.ontimeout=function(){n&&n(new Error(""+s+r.status+"(time out)"))},r.onabort=function(){n&&n(new Error(""+s+r.status+"(abort)"))},r.send(null),r}A.resources=ox;var lx=B.document,cx={};function fx(t,e,i){if(cx[t])return i&&i(null),null;var n=lx.createElement("script");function r(){n.parentNode.removeChild(n),n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1),cx[t]=!0,i&&i(null)}function s(){n.parentNode.removeChild(n),n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1),i&&i(new Error(ft(4928,t)))}return"file:"!==B.location.protocol&&(n.crossOrigin="anonymous"),n.async=e.scriptAsyncLoading||!1,n.src=t,n.addEventListener("load",r,!1),n.addEventListener("error",s,!1),lx.body.appendChild(n),n}var _x=/^(?:\w+:\/\/|\.+\/).+/,dx=function(t,e,i){(hh.hasFeature(hh.Feature.IMAGE_BITMAP)&&A.assetManager.allowImageBitmap?px:hx)(t,e,i)},px=function(t,e,i){e.xhrResponseType="blob",ux(t,e,e.onFileProgress,i)},mx=function(t,e,i){e.xhrResponseType="json",ux(t,e,e.onFileProgress,i)},gx=function(t,e,i){e.xhrResponseType="arraybuffer",ux(t,e,e.onFileProgress,i)},yx=function(t,e,i){Ix._downloadJson(t,e,(function(e,n){if(e)i(e);else{var r=wg(n);Promise.all(r.chunks.map((function(i){return new Promise((function(n,r){Ix._downloadArrayBuffer(""+Wo(t)+i,{},(function(t,i){e?r(e):n(new Uint8Array(i))}))}))}))).then((function(t){var e=new Sg(r.document,t);i(null,e)})).catch((function(t){i(t)}))}}))},vx=function(t,e,i){Ix._downloadArrayBuffer(t,e,(function(t,e){if(t)i(t);else try{var n=xg(new Uint8Array(e));i(null,n)}catch(t){i(t)}}))},bx=function(t,e,i){e.xhrResponseType="text",ux(t,e,e.onFileProgress,i)},Sx=function(t,e,i){var n=jo(t),r=t;_x.test(r)||(r=-1!==Ix.remoteBundles.indexOf(n)?Ix.remoteServerAddress+"remote/"+n:"assets/"+n);var s=e.version||Ix.bundleVers[n],a=0,o=null,h=null;mx(r+"/config."+(s?s+".":"")+"json",e,(function(t,e){h=t||h,(o=e)&&(o.base=r+"/"),2==++a&&i(h,o)})),fx(r+"/index."+(s?s+".":"")+"js",e,(function(t){h=t||h,2==++a&&i(h,o)}))},wx=function(){var t=e.prototype;function e(){this.maxConcurrency=15,this.maxRequestsPerFrame=15,this.maxRetryCount=3,this.appendTimeStamp=!1,this.limited=!0,this.retryInterval=2e3,this.bundleVers={},this.remoteBundles=[],this.downloadDomImage=hx,this.downloadDomAudio=null,this.downloadFile=ux,this.downloadScript=fx,this._downloadArrayBuffer=gx,this._downloadJson=mx,this._downloaders={".png":dx,".jpg":dx,".bmp":dx,".jpeg":dx,".gif":dx,".ico":dx,".tiff":dx,".webp":dx,".image":dx,".pvr":gx,".pkm":gx,".astc":gx,".txt":bx,".xml":bx,".vsh":bx,".fsh":bx,".atlas":bx,".tmx":bx,".tsx":bx,".json":mx,".ExportJson":mx,".plist":bx,".ccon":yx,".cconb":vx,".fnt":bx,".binary":gx,".bin":gx,".dbbin":gx,".skel":gx,".js":fx,bundle:Sx,default:bx},this._downloading=new Yp,this._queue=[],this._queueDirty=!1,this._totalNum=0,this._totalNumThisPeriod=0,this._lastDate=-1,this._checkNextPeriod=!1,this._remoteServerAddress="",this._maxInterval=1/30}return t.init=function(t,e,i){void 0===t&&(t=""),void 0===e&&(e={}),void 0===i&&(i=[]),this._downloading.clear(),this._queue.length=0,this._remoteServerAddress=t,this.bundleVers=e,this.remoteBundles=i},t.register=function(t,e){"object"==typeof t?$t(this._downloaders,t):this._downloaders[t]=e},t.download=function(t,e,i,n,r){var s=this,a=Qp.get(t);if(a)r(null,a);else{var o=this._downloading.get(t);if(o){o.push(r);var h=this._queue.find((function(e){return e.id===t}));if(!h)return;var u=n.priority||0;h.priority<u&&(h.priority=u,this._queueDirty=!0)}else{var l=void 0!==n.maxRetryCount?n.maxRetryCount:this.maxRetryCount,c=void 0!==n.maxConcurrency?n.maxConcurrency:this.maxConcurrency,f=void 0!==n.maxRequestsPerFrame?n.maxRequestsPerFrame:this.maxRequestsPerFrame,_=this._downloaders[i]||this._downloaders.default;Kw((function(i,a){if(0===i&&s._downloading.add(t,[r]),s.limited){s._updateTime();var o=function(t,e){s._totalNum--,s._handleQueueInNextFrame(c,f),a(t,e)};s._totalNum<c&&s._totalNumThisPeriod<f?(_(Jw(e,s.appendTimeStamp),n,o),s._totalNum++,s._totalNumThisPeriod++):(s._queue.push({id:t,priority:n.priority||0,url:e,options:n,done:o,handler:_}),s._queueDirty=!0,s._totalNum<c&&s._handleQueueInNextFrame(c,f))}else _(Jw(e,s.appendTimeStamp),n,a)}),l,this.retryInterval,(function(e,i){e||Qp.add(t,i);for(var n=s._downloading.remove(t),r=0,a=n.length;r<a;r++)n[r](e,i)}))}}},t.loadSubpackage=function(t,e){A.assetManager.loadBundle(t,null,e)},t._updateTime=function(){var t=performance.now(),e=A.game.deltaTime,i=e>this._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._totalNum<t&&this._totalNumThisPeriod<e;){this._queueDirty&&(this._queue.sort((function(t,e){return t.priority-e.priority})),this._queueDirty=!1);var i=this._queue.pop();if(!i)break;this._totalNum++,this._totalNumThisPeriod++,i.handler(Jw(i.url,this.appendTimeStamp),i.options,i.done)}this._handleQueueInNextFrame(t,e)},t._handleQueueInNextFrame=function(t,e){!this._checkNextPeriod&&this._queue.length>0&&(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}();wx._instance=void 0;var xx,Tx,Ax,Cx,Dx,Bx,Ix=wx.instance,Mx=wx.instance,Px=t("e3",Kh("cc.JsonAsset")((Tx=function(t){function e(e){var i;return(i=t.call(this,e)||this).json=Ax&&Ax(),i}return s(e,t),e}(Cm),Ax=zh(Tx.prototype,"json",[uu],(function(){return null})),xx=Tx))||xx);A.JsonAsset=Px;var Ex,Ox,kx=t("e2",Kh("cc.TextAsset")((Dx=function(t){function e(e){var i;return(i=t.call(this,e)||this).text=Bx&&Bx(),i}return s(e,t),e.prototype.toString=function(){return this.text},e}(Cm),Bx=zh(Dx.prototype,"text",[uu],(function(){return""})),Cx=Dx))||Cx);A.TextAsset=kx;var Rx=t("d$",Kh("cc.BufferAsset")((Ox=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),v(Ox.prototype,"_nativeAsset",[Gu],Object.getOwnPropertyDescriptor(Ox.prototype,"_nativeAsset"),Ox.prototype),Ex=Ox))||Ex);function Fx(t,e,i,n){var r=null,s=null;try{(r=new Hm)._nativeUrl=t,r._nativeAsset=e}catch(t){s=t}n(s,r)}function Lx(t,e,i,n){var r=new Px;r.json=e,n(null,r)}function Vx(t,e,i,n){var r=new kx;r.text=e,n(null,r)}function Nx(t,e,i,n){var r=new Rx;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function zx(t,e,i,n){var r=new Cm;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function Ux(t,i,n,r){var s=$p.get(i.name);s||(s="resources"===i.name?ox:new ax,i.base=i.base||t+"/",s.init(i)),e.import("virtual:///prerequisite-imports/"+s.name).then((function(){r(null,s)})).catch(r)}A.BufferAsset=Rx;var Gx=function(){function t(){this._creating=new Yp,this._producers={".png":Fx,".jpg":Fx,".bmp":Fx,".jpeg":Fx,".gif":Fx,".ico":Fx,".tiff":Fx,".webp":Fx,".image":Fx,".pvr":Fx,".pkm":Fx,".astc":Fx,".txt":Vx,".xml":Vx,".vsh":Vx,".fsh":Vx,".atlas":Vx,".tmx":Vx,".tsx":Vx,".fnt":Vx,".json":Lx,".ExportJson":Lx,".binary":Nx,".bin":Nx,".dbbin":Nx,".skel":Nx,bundle:Ux,default:zx}}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=Kp.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,Zw(t,i,n.cacheAsset));for(var r=s._creating.remove(t),a=0,o=r.length;a<o;a++)r[a](e,i)})))}else r(null,o)},t}(),Hx=new Gx,Wx=function(){function t(){this._loading=new Yp,this._unpackers={".json":this.unpackJson}}var e=t.prototype;return e.unpackJson=function(t,e,i,n){var r=Gt(!0),s=null;if(Array.isArray(e)){(e=fy(e)).length!==t.length&&ht(4915);for(var a=0;a<t.length;a++)r[t[a]+"@import"]=e[a]}else{var o=me(Ey),h=me(Hm);if(e.type===o&&e.data){var u=e.data;u.length!==t.length&&ht(4915);for(var l=0;l<t.length;l++)r[t[l]+"@import"]=_y(o,{base:u[l][0],mipmaps:u[l][1]})}else{if(e.type!==h||!e.data)return void n(s=new Error("unmatched type pack!"),null);var c=e.data;c.length!==t.length&&ht(4915);for(var f=0;f<t.length;f++)r[t[f]+"@import"]=c[f]}}n(s,r)},e.init=function(){this._loading.clear()},e.register=function(t,e){"object"==typeof t?$t(this._unpackers,t):this._unpackers[t]=e},e.unpack=function(t,e,i,n,r){e?(0,this._unpackers[i])(t,e,n,r):r(new Error("package data is wrong!"))},e.load=function(t,e,i){var n=this;if(!t.isNative&&t.info&&t.info.packs)if(Qp.has(t.id))i(null,Qp.get(t.id));else{var r=t.info.packs,s=r.find((function(t){return n._loading.has(t.uuid)}));if(s)this._loading.get(s.uuid).push({onComplete:i,id:t.id});else{var a=r[0];this._loading.add(a.uuid,[{onComplete:i,id:t.id}]),t.config;var o=mm(a.uuid,{ext:a.ext,bundle:t.config.name});Mx.download(a.uuid,o,a.ext,t.options,(function(e,i){Qp.remove(a.uuid),e&&J(e.message,e.stack),n.unpack(a.packedUuids,i,a.ext,t.options,(function(t,i){if(!t)for(var r in i)Qp.add(r,i[r]);for(var s=n._loading.remove(a.uuid),o=0,h=s.length;o<h;o++){var u=s[o];if(e||t)u.onComplete(e||t);else{var l=i[u.id];l?u.onComplete(null,l):u.onComplete(new Error("can not retrieve data from package"))}}}))}))}}else Mx.download(t.id,t.url,t.ext,t.options,i)},t}(),jx=new Wx;function qx(t,e){var i=!1;t.progress||(t.progress={finish:0,total:t.input.length,canInvoke:!0},i=!0);var n=t.options,r=t.progress,s=[],a=r.total,o=n.__exclude__=n.__exclude__||Object.create(null);t.output=[],ex(t.input,(function(n,h){if(!n.isNative&&Kp.has(n.uuid)){var u=Kp.get(n.uuid);return n.content=u.addRef(),t.output.push(n),r.canInvoke&&t.dispatch("progress",++r.finish,r.total,n),void h()}jx.load(n,t.options,(function(u,l){u?t.isFinished||(!A.assetManager.force||i?(J(u.message,u.stack),r.canInvoke=!1,e(u)):(t.output.push(n),r.canInvoke&&t.dispatch("progress",++r.finish,r.total,n))):t.isFinished||(n.file=l,t.output.push(n),n.isNative||(o[n.uuid]=!0,Qw(n.uuid,l,o,s,n.config),r.total=a+s.length),r.canInvoke&&t.dispatch("progress",++r.finish,r.total,n)),h()}))}),(function(){if(t.isFinished)return Yw(t),void t.dispatch("error");if(s.length>0){var a=sm.create({input:s,progress:r,options:n,onProgress:t.onProgress,onError:sm.prototype.recycle,onComplete:function(n){var r;n||((r=t.output).push.apply(r,a.output),a.recycle()),i&&Xx(t),e(n)}});em.async(a)}else i&&Xx(t),e()}))}function Xx(t){for(var e=t.output,i=0,n=e.length;i<n;i++)e[i].content&&e[i].content.decRef(!1)}var Yx=function(){function t(){this._parser=null,globalThis.DOMParser&&(this._parser=new DOMParser)}var e=t.prototype;return e.parse=function(t){return this._parseXML(t)},e._parseXML=function(t){if(this._parser)return this._parser.parseFromString(t,"text/xml");throw new Error("Dom parser is not supported in this platform!")},t}(),Jx=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.parse=function(t){var e=this._parseXML(t).documentElement;if("plist"!==e.tagName)return at(5100),{};for(var i=null,n=0,r=e.childNodes.length;n<r&&1!==(i=e.childNodes[n]).nodeType;n++);return this._parseNode(i)},i._parseNode=function(t){var e=null,i=t.tagName;if("dict"===i)e=this._parseDict(t);else if("array"===i)e=this._parseArray(t);else if("string"===i)if(1===t.childNodes.length)e=t.firstChild.nodeValue;else{e="";for(var n=0;n<t.childNodes.length;n++)e+=t.childNodes[n].nodeValue}else"false"===i?e=!1:"true"===i?e=!0:"real"===i?e=parseFloat(t.firstChild.nodeValue):"integer"===i&&(e=parseInt(t.firstChild.nodeValue,10));return e},i._parseArray=function(t){for(var e=[],i=0,n=t.childNodes.length;i<n;i++){var r=t.childNodes[i];1===r.nodeType&&e.push(this._parseNode(r))}return e},i._parseDict=function(t){for(var e={},i="",n=0,r=t.childNodes.length;n<r;n++){var s=t.childNodes[n];1===s.nodeType&&("key"===s.tagName?i=s.firstChild.nodeValue:e[i]=this._parseNode(s))}return e},e}(Yx),Kx=new Jx,Qx=function(){function t(){this._parsing=new Yp,this._parsers={".png":this.parseImage,".jpg":this.parseImage,".bmp":this.parseImage,".jpeg":this.parseImage,".gif":this.parseImage,".ico":this.parseImage,".tiff":this.parseImage,".webp":this.parseImage,".image":this.parseImage,".pvr":this.parsePVRTex,".pkm":this.parsePKMTex,".astc":this.parseASTCTex,".plist":this.parsePlist,import:this.parseImport,".ccon":this.parseImport,".cconb":this.parseImport}}var e=t.prototype;return e.parseImage=function(t,e,i){t instanceof HTMLImageElement?i(null,t):createImageBitmap(t,{premultiplyAlpha:"none"}).then((function(t){i(null,t)}),(function(t){i(t,null)}))},e.parsePVRTex=function(t,e,i){var n=null,r=null;try{r=Hm.parseCompressedTextures(t,0)}catch(t){Y(n=t)}i(n,r)},e.parsePKMTex=function(t,e,i){var n=null,r=null;try{r=Hm.parseCompressedTextures(t,1)}catch(t){Y(n=t)}i(n,r)},e.parseASTCTex=function(t,e,i){var n=null,r=null;try{r=Hm.parseCompressedTextures(t,2)}catch(t){Y(n=t)}i(n,r)},e.parsePlist=function(t,e,i){var n=null,r=Kx.parse(t);r||(n=new Error("parse failed")),i(n,r)},e.parseImport=function(t,e,i){if(t){var n=null,r=null;try{n=yy(t,e)}catch(t){r=t}i(r,n)}else i(new Error(ft(3702,e.__uuid__)))},e.init=function(){this._parsing.clear()},e.register=function(t,e){"object"==typeof t?$t(this._parsers,t):this._parsers[t]=e},e.parse=function(t,e,i,n,r){var s=this,a=Zp.get(t);if(a)r(null,a);else{var o=this._parsing.get(t);if(o)o.push(r);else{var h=this._parsers[i];h?(this._parsing.add(t,[r]),h(e,n,(function(e,i){e?Qp.remove(t):dm(i)||Zp.add(t,i);for(var n=s._parsing.remove(t),r=0,a=n.length;r<a;r++)n[r](e,i)}))):r(null,e)}}},n(t,null,[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}();Qx._instance=void 0;var Zx=Qx.instance;function $x(t,e){var i=!1;t.progress||(t.progress={finish:0,total:t.input.length,canInvoke:!0},i=!0);var n=t.options,r=t.progress;n.__exclude__=n.__exclude__||Object.create(null),t.output=[],ex(t.input,(function(s,a){var o=sm.create({input:s,onProgress:t.onProgress,options:n,progress:r,onComplete:function(n,h){n&&!t.isFinished&&(!A.assetManager.force||i?(J(n.message,n.stack),r.canInvoke=!1,e(n)):r.canInvoke&&t.dispatch("progress",++r.finish,r.total,s)),t.output.push(h),o.recycle(),a(null)}});tT.async(o)}),(function(){if(n.__exclude__=null,t.isFinished)return Yw(t),void t.dispatch("error");tx(t),Yw(t),e()}))}var tT=new Jp("loadOneAsset",[function(t,e){var i=t.output=t.input,n=i.options,r=i.isNative,s=i.uuid,a=i.file,o=n.reloadAsset;a||!o&&!r&&Kp.has(s)?e():jx.load(i,t.options,(function(t,n){i.file=n,e(t)}))},function(t,e){var i=t.output=t.input,n=t.progress,r=t.options.__exclude__,s=i.id,a=i.file,o=i.options;if(i.isNative)Zx.parse(s,a,i.ext,o,(function(r,a){r?e(r):(i.content=a,n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),Qp.remove(s),Zp.remove(s),e())}));else{var h=i.uuid;if(h in r){var u=r[h],l=u.finish,c=u.content,f=u.err,_=u.callbacks;n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),l||rx(h,h,r)?(c&&c.addRef(),i.content=c,e(f)):_.push({done:e,item:i})}else if(!o.reloadAsset&&Kp.has(h)){var d=Kp.get(h);i.content=d.addRef(),n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),e()}else o.__uuid__=h,Zx.parse(s,a,"import",o,(function(i,n){i?e(i):eT(t,n,e)}))}}]);function eT(t,e,i){var n=t.input,r=t.progress,s=n,a=s.uuid,o=s.id,h=s.options,u=s.config,l=h.cacheAsset,c=[];e.addRef&&e.addRef(),Qw(a,e,Object.create(null),c,u),r.canInvoke&&t.dispatch("progress",++r.finish,r.total+=c.length,n);var f=t.options.__exclude__[a]={content:e,finish:!1,callbacks:[{done:i,item:n}]},_=sm.create({input:c,options:t.options,onProgress:t.onProgress,onError:sm.prototype.recycle,progress:r,onComplete:function(t){if(e.decRef&&e.decRef(!1),f.finish=!0,f.err=t,!t){for(var i,n=Array.isArray(_.output)?_.output:[_.output],r=Object.create(null),s=p(n);!(i=s()).done;){var h=i.value;h&&(r[h instanceof Cm?h._uuid+"@import":a+"@native"]=h)}$w(a,e,r);try{"function"!=typeof e.onLoaded||gy.has(e)||my.has(e)||(e.onLoaded(),gy.add(e))}catch(t){ht(16352,a,t.message,t.stack)}Qp.remove(o),Zp.remove(o),Zw(a,e,l),_.recycle()}for(var u=f.callbacks,c=0,d=u.length;c<d;c++){var m=u[c];e.addRef&&e.addRef(),m.item.content=e,m.done(t)}u.length=0}});tm.async(_)}function iT(t,e){var i=t.options,n=Object.create(null),r=Object.create(null);for(var s in i)switch(s){case"path":case"uuid":case"dir":case"scene":case"url":break;case"__requestType__":case"__isNative__":case"ext":case"type":case"__nativeName__":case"audioLoadMode":case"bundle":n[s]=i[s];break;case"__exclude__":case"__outputAsArray__":r[s]=i[s];break;default:n[s]=i[s],r[s]=i[s]}t.options=r;var a=sm.create({input:t.input,options:n}),o=null;try{t.output=t.source=im.sync(a)}catch(t){o=t;for(var h=0,u=a.output.length;h<u;h++)a.output[h].recycle()}a.recycle(),e(o)}var nT=function(){function t(){this.uuid="",this.overrideUuid="",this.url="",this.ext=".json",this.content=null,this.file=null,this.info=null,this.config=null,this.isNative=!1,this.options=Object.create(null),this._id=""}return t.create=function(){return 0!==t._deadPool.length?t._deadPool.pop():new t},t.prototype.recycle=function(){t._deadPool.length!==t.MAX_DEAD_NUM&&(this._id="",this.uuid="",this.overrideUuid="",this.url="",this.ext=".json",this.content=null,this.file=null,this.info=null,this.config=null,this.isNative=!1,this.options=Object.create(null),t._deadPool.push(this))},n(t,[{key:"id",get:function(){return this._id||(this._id=(this.overrideUuid||this.uuid)+"@"+(this.isNative?"native":"import")),this._id}}]),t}();nT.MAX_DEAD_NUM=500,nT._deadPool=[];var rT=[];function sT(t){var e=t.options,i=Array.isArray(t.input)?t.input:[t.input];t.output=[];for(var n=function(){var n=i[r],s=nT.create(),a=null,o=null;if("string"==typeof n&&((n=Object.create(null))[e.__requestType__||"uuid"]=i[r]),"object"==typeof n){Zt(n,e),n.preset&&Zt(n,rm[n.preset]);var h=function(){var t;switch(u){case"uuid":var e,r=s.uuid=lm(n.uuid);if(!n.bundle){var h=$p.find((function(t){return!!t.getAssetInfo(r)}));n.bundle=h&&h.name}if($p.has(n.bundle)){if(a=$p.get(n.bundle).config,(o=a.getAssetInfo(r))&&o.redirect){if(!$p.has(o.redirect))throw new Error("Please load bundle "+o.redirect+" first");a=$p.get(o.redirect).config,o=a.getAssetInfo(r)}s.config=a,s.info=o}s.ext=n.ext||(null==(e=o)?void 0:e.extension)||".json";break;case"__requestType__":case"ext":case"bundle":case"preset":case"type":break;case"dir":if($p.has(n.bundle)){$p.get(n.bundle).config.getDirWithPath(n.dir,n.type,rT);for(var l,c=p(rT);!(l=c()).done;){var f=l.value;i.push({uuid:f.uuid,__isNative__:!1,ext:f.extension||".json",bundle:n.bundle})}rT.length=0}s.recycle(),s=null;break;case"path":if($p.has(n.bundle)){if(a=$p.get(n.bundle).config,(o=a.getInfoWithPath(n.path,n.type))&&o.redirect){if(!$p.has(o.redirect))throw new Error("you need to load bundle "+o.redirect+" first");a=$p.get(o.redirect).config,o=a.getAssetInfo(o.uuid)}if(!o)throw s.recycle(),new Error("Bundle "+n.bundle+" doesn't contain "+n.path);s.config=a,s.uuid=o.uuid,s.info=o}s.ext=n.ext||(null==(t=o)?void 0:t.extension)||".json";break;case"scene":if(!n.bundle){var _=$p.find((function(t){return!!t.getSceneInfo(n.scene)}));n.bundle=_&&_.name}if($p.has(n.bundle)){if(a=$p.get(n.bundle).config,(o=a.getSceneInfo(n.scene))&&o.redirect){if(!$p.has(o.redirect))throw new Error("you need to load bundle "+o.redirect+" first");a=$p.get(o.redirect).config,o=a.getAssetInfo(o.uuid)}if(!o)throw s.recycle(),new Error("Bundle "+a.name+" doesn't contain scene "+n.scene);s.config=a,s.uuid=o.uuid,s.info=o}break;case"__isNative__":s.isNative=n.__isNative__;break;case"url":s.url=n.url,s.uuid=n.uuid||n.url,s.ext=n.ext||Ho(n.url),s.isNative=void 0===n.__isNative__||n.__isNative__;break;default:s.options[u]=n[u]}if(!s)return 1};for(var u in n)if(h())break}if(!s)return 1;if(t.output.push(s),!s.uuid&&!s.url)throw new Error("Can not parse this input:"+JSON.stringify(n))},r=0;r<i.length;r++)n();return null}function aT(t){for(var e=t.output=t.input,i=function(){var t=e[n];if(nm.has(t.uuid)){var i=nm.get(t.uuid),r=$p.find((function(t){return!!t.getAssetInfo(i)}));if(r){var s;t.overrideUuid=i;var a=r.config,o=a.getAssetInfo(i);if(o&&o.redirect){if(!$p.has(o.redirect))throw new Error("Please load bundle "+o.redirect+" first");o=(a=$p.get(o.redirect).config).getAssetInfo(i)}t.config=a,t.info=o,t.ext=t.isNative?t.ext:(null==(s=o)?void 0:s.extension)||".json"}else at(16201,i,t.uuid)}},n=0;n<e.length;n++)i()}function oT(t){for(var e=t.output=t.input,i=0;i<e.length;i++){var n=e[i];if(!n.url){var r,s,a=n.config;s=n.isNative?a&&a.nativeBase?a.base+a.nativeBase:A.assetManager.generalNativeBase:a&&a.importBase?a.base+a.importBase:A.assetManager.generalImportBase;var o=n.overrideUuid||n.uuid,h="";n.info&&(h=n.isNative?n.info.nativeVer?"."+n.info.nativeVer:"":n.info.ver?"."+n.info.ver:""),r=".ttf"===n.ext?s+"/"+o.slice(0,2)+"/"+o+h+"/"+n.options.__nativeName__:s+"/"+o.slice(0,2)+"/"+o+h+n.ext,n.url=r}}return null}var hT=ze.querySettings.bind(ze),uT="assets",lT="asset-missing",cT=t("ee",function(){function t(){this.pipeline=tm.append(iT).append($x),this.fetchPipeline=em.append(iT).append(qx),this.transformPipeline=im.append(sT).append(aT).append(oT),this.bundles=$p,this.assets=Kp,this.assetsOverrideMap=nm,this.generalImportBase="",this.generalNativeBase="",this.dependUtil=Sy,this.force=w,this.allowImageBitmap=!1,this.utils=xm,this.downloader=Mx,this.parser=Zx,this.packManager=jx,this.cacheAsset=!0,this.cacheManager=null,this.presets=rm,this.factory=Hx,this.preprocessPipe=iT,this.fetchPipe=qx,this.loadPipe=$x,this.references=null,this._releaseManager=qw,this._files=Qp,this._parsed=Zp,this._parsePipeline=null,this._projectBundles=[],this._eventTarget=new Io}var e=t.prototype;return e.getReleaseManager=function(){return this._releaseManager},e.onAssetMissing=function(t,e){this._eventTarget.on(lT,t,e)},e.offAssetMissing=function(t,e){this._eventTarget.off(lT,t,e)},e.dispatchAssetMissing=function(t,e,i,n){this._eventTarget.emit(lT,t,e,i,n)},e.init=function(t){void 0===t&&(t={});var e=t.server||hT(uT,"server")||"",i=t.bundleVers||hT(uT,"bundleVers")||{},n=t.remoteBundles||hT(uT,"remoteBundles")||[],r=t.downloadMaxConcurrency||hT(uT,"downloadMaxConcurrency");r&&r>0&&(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||hT(uT,"importBase")||"";s&&s.endsWith("/")&&(s=s.substring(0,s.length-1));var a=t.nativeBase||hT(uT,"nativeBase")||"";a&&a.endsWith("/")&&(a=a.substring(0,a.length-1)),this.generalImportBase=s,this.generalNativeBase=a,this._projectBundles=hT(uT,"projectBundles")||[];var o=hT(uT,"assetsOverrides")||{};for(var h in o)this.assetsOverrideMap.set(h,o[h])},e.getBundle=function(t){return $p.get(t)||null},e.removeBundle=function(t){t._destroy(),$p.remove(t.name)},e.loadAny=function(t,e,i,n){var r=ix(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=sm.create({input:t,onProgress:a,onComplete:sx(o),options:s});tm.async(h)},e.preloadAny=function(t,e,i,n){var r=ix(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=sm.create({input:t,onProgress:a,onComplete:sx(o),options:s});em.async(h)},e.loadRemote=function(t,e,i){var n=ix(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?(J(e.message,e.stack),s&&s(e,i)):Hx.create(t,i,r.ext||Ho(t),r,(function(t,e){s&&s(t,e)}))}))):sx(s)(null,this.assets.get(t))},e.loadBundle=function(t,e,i){var n=ix(e,void 0,i),r=n.options,s=n.onComplete,a=jo(t);this.bundles.has(a)?sx(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?(J(e.message,e.stack),s&&s(e,i)):Hx.create(t,i,"bundle",r,(function(t,e){s&&s(t,e)}))})))},e.releaseAsset=function(t){qw.tryRelease(t,!0)},e.releaseUnusedAssets=function(){Kp.forEach((function(t){qw.tryRelease(t)}))},e.releaseAll=function(){Kp.forEach((function(t){qw.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 $p.get("main")||null}},{key:"resources",get:function(){return $p.get("resources")||null}}],[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}());cT._instance=void 0,cT.Pipeline=Jp,cT.Task=sm,cT.Cache=Yp,cT.RequestItem=nT,cT.Bundle=ax,cT.BuiltinBundleName={INTERNAL:"internal",RESOURCES:"resources",MAIN:"main",START_SCENE:"start-scene"},cT.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},cT.Downloader=wx,cT.Parser=Qx,cT.DependUtil=vy;var fT=t("ed",A.assetManager=cT.instance);A.AssetManager=cT;var _T,dT,pT=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 _=0;_<8;_++)h[a]=85,h[a+1]=85,h[a+2]=85,h[a+3]=255,a+=4;a+=32}var d={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},y={width:2,height:2,_data:s,_compressed:!1,format:35},v={width:16,height:16,_data:h,_compressed:!1,format:35},b=new Hm(d),S=new Ey;S._uuid="black-texture",S.image=b,t[S._uuid]=S;var w=new Hm(p),x=new Ey;x._uuid="empty-texture",x.image=w,t[x._uuid]=x;var T=new ib;T._uuid="black-cube-texture",T.setMipFilter(1),T.image={front:new Hm(d),back:new Hm(d),left:new Hm(d),right:new Hm(d),top:new Hm(d),bottom:new Hm(d)},t[T._uuid]=T;var C=new Hm(m),D=new Ey;D._uuid="grey-texture",D.image=C,t[D._uuid]=D;var B=new ib;B._uuid="grey-cube-texture",B.setMipFilter(1),B.image={front:new Hm(m),back:new Hm(m),left:new Hm(m),right:new Hm(m),top:new Hm(m),bottom:new Hm(m)},t[B._uuid]=B;var I=new Hm(g),M=new Ey;M._uuid="white-texture",M.image=I,t[M._uuid]=M;var P=new ib;P._uuid="white-cube-texture",P.setMipFilter(1),P.image={front:new Hm(g),back:new Hm(g),left:new Hm(g),right:new Hm(g),top:new Hm(g),bottom:new Hm(g)},t[P._uuid]=P;var E=new Hm(y),O=new Ey;O._uuid="normal-texture",O.image=E,t[O._uuid]=O;var k=new Hm(v),R=new Ey;R._uuid="default-texture",R.image=k,t[R._uuid]=R;var F=new ib;if(F.setMipFilter(1),F._uuid="default-cube-texture",F.image={front:new Hm(v),back:new Hm(v),left:new Hm(v),right:new Hm(v),top:new Hm(v),bottom:new Hm(v)},t[F._uuid]=F,A.SpriteFrame){var L=new A.SpriteFrame,V=b,N=new Ey;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){fT.loadBundle("internal",(function(s){s?r(s):fT.loadAny(e,(function(e,s){e?r(e):(s.forEach((function(e){i[e.name]=e,qw.addIgnoredAsset(e),e instanceof A.Material&&t._materialsToBeCompiled.push(e)})),n())}))}))}))},e.compileBuiltinMaterial=function(){for(var t=0;t<this._materialsToBeCompiled.length;++t)for(var e=this._materialsToBeCompiled[t],i=0;i<e.passes.length;++i)e.passes[i].tryCompile();this._materialsToBeCompiled.length=0},t}()),mT=t("el",A.builtinResMgr=new pT),gT=t("dl",(_T=new Map,dT=0,function(t){return"number"==typeof t?t:(_T.has(t)||(_T.set(t,1<<dT),dT++),_T.get(t))})),yT=t("dg",function(){function t(t){this.instances=[],this.hasPendingModels=!1,this.dynamicOffsets=[],this._device=t.device,this.pass=t}var e=t.prototype;return e.destroy=function(){this.instances.forEach((function(t){t.vb.destroy(),t.ia.destroy()})),this.instances.length=0},e.merge=function(t,e,i){void 0===i&&(i=null);var n=t.instancedAttributeBlock,r=n.buffer.length;if(r){var s=t.inputAssembler,a=t.descriptorSet,o=a.getTexture(bS),h=a.getTexture(DS),u=a.getTexture(PS),l=t.useReflectionProbeType,c=i;c||(c=t.shaders[e]);for(var f=t.descriptorSet,_=0;_<this.instances.length;++_){var d,p,m=this.instances[_];if(!((null==(d=m.ia.indexBuffer)?void 0:d.objectID)!==(null==(p=s.indexBuffer)?void 0:p.objectID)||m.count>=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,y=m.data;m.data=new Uint8Array(g),m.data.set(y),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 v=this._device.createBuffer(new ud(10,3,32*r,r)),b=new Uint8Array(32*r),S=s.vertexBuffers.slice(),w=s.attributes.slice(),x=s.indexBuffer,T=0;T<n.attributes.length;T++){var A=n.attributes[T],C=new Cd(A.name,A.format,A.isNormalized,S.length,!0);w.push(C)}b.set(n.buffer),S.push(v);var D=new Bd(w,S,x),B=this._device.createInputAssembler(D);this.instances.push({count:1,capacity:32,vb:v,data:b,ia:B,stride:r,shader:c,descriptorSet:f,lightingMap:o,reflectionProbeCubemap:h,reflectionProbePlanarMap:u,useReflectionProbeType:l,reflectionProbeBlendCubemap:null}),this.hasPendingModels=!0}},e.uploadBuffers=function(t){for(var e=0;e<this.instances.length;++e){var i=this.instances[e];i.count&&(i.ia.instanceCount=i.count,t.updateBuffer(i.vb,i.data))}},e.clear=function(){this.instances.forEach((function(t){t.count=0})),this.hasPendingModels=!1},t}()),vT=new ud(18,1),bT=new ld(null),ST=new Ud(null),wT=function(){function t(t){this._rootBuffer=null,this._buffers=[],this._descriptorSet=null,this._pipelineLayout=null,this._passIndex=0,this._propertyIndex=0,this._programName="",this._dynamics={},this._propertyHandleMap={},this._rootBlock=null,this._blocksInt=[],this._blocks=[],this._shaderInfo=null,this._defines={},this._properties={},this._shader=null,this._bs=new Bp,this._dss=new Cp,this._rs=new Ap,this._priority=128,this._stage=100,this._phase=gT("default"),this._passID=4294967295,this._subpassID=4294967295,this._phaseID=4294967295,this._primitive=7,this._batchingScheme=0,this._dynamicStates=0,this._instancedBuffers={},this._hash=0,this._rootBufferDirty=!1,this._root=t,this._device=Wp.gfxDevice}t.fillPipelineInfo=function(t,e){void 0!==e.priority&&(t._priority=e.priority),void 0!==e.primitive&&(t._primitive=e.primitive),void 0!==e.stage&&(t._stage=e.stage),void 0!==e.dynamicStates&&(t._dynamicStates=e.dynamicStates),void 0!==e.phase&&(t._phase=gT(e.phase));var i=t._bs;if(e.blendState){var n=e.blendState,r=n.targets;r&&r.forEach((function(t,e){i.setTarget(e,t)})),void 0!==n.isA2C&&(i.isA2C=n.isA2C),void 0!==n.isIndepend&&(i.isIndepend=n.isIndepend),void 0!==n.blendColor&&(i.blendColor=n.blendColor)}t._rs.assign(e.rasterizerState),t._dss.assign(e.depthStencilState)},t.getPassHash=function(t){var e="";if(A.rendering&&A.rendering.enableEffectImport){var i=A.rendering.programLib.getKey(t._phaseID,t.program,t.defines);e=t._phaseID.toString()+","+i}else e=Ow.getKey(t.program,t.defines);var n,r=e+","+t._primitive+","+t._dynamicStates;return r+=xT(t._bs),r+=TT(t._dss),qf(r+=",rs,"+(n=t._rs).cullMode+","+n.depthBias+","+n.isFrontFaceCCW,666)};var e=t.prototype;return e.initialize=function(t){this._doInit(t),this.resetUBOs(),this.resetTextures(),this.tryCompile()},e.getHandle=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0);var n=this._propertyHandleMap[t];return n?(i?n=ew(n,i):e&&(n=ew(n,QS(n)-e)),n+e):0},e.getBinding=function(t){var e=this.getHandle(t);return e?ZS(e):-1},e.setUniform=function(t,e){var i=ZS(t),n=QS(t),r=tw(t),s=this._getBlockView(n,i);nw[n](s,e,r),this._rootBufferDirty=!0},e.getUniform=function(t,e){var i=ZS(t),n=QS(t),r=tw(t),s=this._getBlockView(n,i);return iw[n](s,e,r)},e.setUniformArray=function(t,e){for(var i=ZS(t),n=QS(t),r=lp(n)>>2,s=this._getBlockView(n,i),a=tw(t),o=0;o<e.length;o++,a+=r)null!==e[o]&&nw[n](s,e[o],a);this._rootBufferDirty=!0},e.bindTexture=function(t,e,i){this._descriptorSet.bindTexture(t,e,i||0)},e.bindSampler=function(t,e,i){this._descriptorSet.bindSampler(t,e,i||0)},e.setDynamicState=function(t,e){var i=this._dynamics[t];i&&i.value===e||(i.value=e,i.dirty=!0)},e.overridePipelineStates=function(){at(12102)},e.update=function(){this._descriptorSet?(this._rootBuffer&&this._rootBufferDirty&&(this._rootBuffer.update(this._rootBlock),this._rootBufferDirty=!1),this._descriptorSet.update()):ht(12006)},e.getInstancedBuffer=function(t){return void 0===t&&(t=0),this._instancedBuffers[t]||(this._instancedBuffers[t]=new yT(this))},e.destroy=function(){for(var t=0;t<this._shaderInfo.blocks.length;t++){var e=this._shaderInfo.blocks[t];this._buffers[e.binding].destroy()}for(var i in this._buffers=[],this._rootBuffer&&(this._rootBuffer.destroy(),this._rootBuffer=null),this._instancedBuffers)this._instancedBuffers[i].destroy();this._descriptorSet.destroy(),this._rs.destroy(),this._dss.destroy(),this._bs.destroy()},e.resetUniform=function(t){var e=this.getHandle(t);if(e){for(var i=QS(e),n=ZS(e),r=tw(e),s=$S(e),a=this._getBlockView(i,n),o=this._properties[t],h=o&&o.value||aw(i),u=(lp(i)>>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=QS(i),s=ZS(i),a=this._properties[t],o=a&&a.value,h=(n="string"==typeof o?mT.get(""+o+ow(r)):o||mT.get(aw(r)))&&n.getGFXTexture(),u=a&&void 0!==a.samplerHash?Op.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<this._shaderInfo.blocks.length;t++)for(var e=this._shaderInfo.blocks[t],i=0,n=0;n<e.members.length;n++){for(var r=e.members[n],s=this._getBlockView(r.type,e.binding),a=this._properties[r.name],o=a&&a.value||aw(r.type),h=(lp(r.type)>>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(A.rendering)this._shaderInfo.descriptors[1].samplerTextures.forEach((function(e){for(var i=0;i<e.count;++i)t.resetTexture(e.name,i)}));else for(var e=0;e<this._shaderInfo.samplerTextures.length;e++)for(var i=this._shaderInfo.samplerTextures[e],n=0;n<i.count;n++)this.resetTexture(i.name,n)},e.tryCompile=function(){var e=this._root.pipeline;if(!e)return!1;if(this._syncBatchingScheme(),A.rendering&&A.rendering.enableEffectImport){var i=A.rendering.programLib,n=i.getProgramVariant(this._device,this._phaseID,this._programName,this._defines);if(!n)return at(12103,this._programName),!1;this._shader=n.shader,this._pipelineLayout=i.getPipelineLayout(this.device,this._phaseID,this._programName)}else{var r=Ow.getGFXShader(this._device,this._programName,this._defines,e);if(!r)return at(12104,this._programName),!1;this._shader=r,this._pipelineLayout=Ow.getTemplateInfo(this._programName).pipelineLayout}return this._hash=t.getPassHash(this),!0},e.getShaderVariant=function(t){if(void 0===t&&(t=null),!this._shader&&!this.tryCompile())return at(12105),null;if(!t)return this._shader;for(var e=this._root.pipeline,i=0;i<t.length;i++){var n=t[i];this._defines[n.name]=n.value}this._isBlend&&(this._defines.CC_IS_TRANSPARENCY_PASS=1);var r=null;if(A.rendering&&A.rendering.enableEffectImport){var s=A.rendering.programLib.getProgramVariant(this._device,this._phaseID,this._programName,this._defines);s&&(r=s.shader)}else r=Ow.getGFXShader(this._device,this._programName,this._defines,e);for(var a=0;a<t.length;a++){var o=t[a];delete this._defines[o.name]}return r},e.beginChangeStatesSilently=function(){},e.endChangeStatesSilently=function(){},e._doInit=function(e,i){var n;void 0===i&&(i=!1),this._priority=128,this._stage=100;var s=null==(n=A.rendering)?void 0:n.enableEffectImport;if(s){var a=A.rendering;if("number"==typeof e.phase?(this._passID=e._passID,this._subpassID=e._subpassID,this._phaseID=e._phaseID):(this._passID=a.getPassID(e.pass),this._passID!==a.INVALID_ID&&(e.subpass?(this._subpassID=a.getSubpassID(this._passID,e.subpass),this._phaseID=a.getPhaseID(this._subpassID,e.phase)):this._phaseID=a.getPhaseID(this._passID,e.phase))),this._passID===a.INVALID_ID)return void ht(12107,e.program);if(this._phaseID===a.INVALID_ID)return void ht(12108,e.program)}else"number"==typeof e.phase?this._passID=e._passID:e.pass&&"default"!==e.pass&&(lt(4294967295===this._passID,12110),this._passID=0);this._phase=gT("default"),this._primitive=7,this._passIndex=e.passIndex,this._propertyIndex=void 0!==e.propertyIndex?e.propertyIndex:e.passIndex,this._programName=e.program,this._defines=i?r({},e.defines):e.defines,this._shaderInfo=s?A.rendering.programLib.getProgramInfo(this._phaseID,this._programName):Ow.getTemplate(e.program),this._properties=e.properties||this._properties;var o=this._device;t.fillPipelineInfo(this,e),e.stateOverrides&&t.fillPipelineInfo(this,e.stateOverrides),ST.layout=s?A.rendering.programLib.getMaterialDescriptorSetLayout(this._device,this._phaseID,e.program):Ow.getDescriptorSetLayout(this._device,e.program),this._descriptorSet=this._device.createDescriptorSet(ST);var h,u,l=this._shaderInfo.blocks;if(s){var c=A.rendering.programLib;h=c.getBlockSizes(this._phaseID,this._programName),u=c.getHandleMap(this._phaseID,this._programName)}else{var f=Ow.getTemplateInfo(e.program);h=f.blockSizes,u=f.handleMap}if(s){var _=A.rendering.programLib.getShaderInfo(this._phaseID,this.program);this._buildMaterialUniformBlocks(o,_.blocks,h)}else this._buildUniformBlocks(o,l,h);var d=this._propertyHandleMap=u,p={};for(var m in this._properties){var g=this._properties[m];g.handleInfo&&(p[m]=this.getHandle.apply(this,g.handleInfo))}Object.assign(d,p)},e._buildUniformBlocks=function(t,e,i){for(var n=t.capabilities.uboOffsetAlignment,r=[],s=0,a=0,o=0;o<e.length;o++){var h=i[o];r.push(a),a+=Math.ceil(h/n)*n,s=h}var u=r[r.length-1]+16*Math.ceil(s/16);u&&(vT.size=16*Math.ceil(u/16),this._rootBuffer=t.createBuffer(vT),this._rootBlock=new ArrayBuffer(u));for(var l=0,c=0;l<e.length;l++){var f=e[l].binding,_=i[l];bT.buffer=this._rootBuffer,bT.offset=r[c++],bT.range=16*Math.ceil(_/16);var d=this._buffers[f]=t.createBuffer(bT);this._blocks[f]=new Float32Array(this._rootBlock,bT.offset,_/4),this._blocksInt[f]=new Int32Array(this._blocks[f].buffer,this._blocks[f].byteOffset,this._blocks[f].length),this._descriptorSet.bindBuffer(f,d)}},e._buildMaterialUniformBlocks=function(t,e,i){for(var n=t.capabilities.uboOffsetAlignment,r=[],s=0,a=0,o=0;o<e.length;o++)if(1===e[o].set){var h=i[o];r.push(a),a+=Math.ceil(h/n)*n,s=h}if(0!==s){var u=r[r.length-1]+s;u&&(vT.size=16*Math.ceil(u/16),this._rootBuffer=t.createBuffer(vT),this._rootBlock=new ArrayBuffer(u))}for(var l=0,c=0;l<e.length;l++)if(1===e[l].set){var f=e[l].binding,_=i[l];bT.buffer=this._rootBuffer,bT.offset=r[c++],bT.range=16*Math.ceil(_/16);var d=this._buffers[f]=t.createBuffer(bT);this._blocks[f]=new Float32Array(this._rootBlock,bT.offset,_/4),this._blocksInt[f]=new Int32Array(this._blocks[f].buffer,this._blocks[f].byteOffset,this._blocks[f].length),this._descriptorSet.bindBuffer(f,d)}},e._syncBatchingScheme=function(){this._defines.USE_INSTANCING?this._device.hasFeature(1)?this._batchingScheme=1:(this._defines.USE_INSTANCING=!1,this._batchingScheme=0):this._batchingScheme=0},e._getBlockView=function(t,e){return t<13?this._blocksInt[e]:this._blocks[e]},e._initPassFromTarget=function(t,e,i){this._priority=t.priority,this._stage=t.stage,this._phase=t.phase,this._phaseID=t._phaseID,this._passID=t._passID,this._batchingScheme=t.batchingScheme,this._primitive=t.primitive,this._dynamicStates=t.dynamicStates,this._bs=t.blendState,this._dss=e,this._descriptorSet=t.descriptorSet,this._rs=t.rasterizerState,this._passIndex=t.passIndex,this._propertyIndex=t.propertyIndex,this._programName=t.program,this._defines=t.defines,this._shaderInfo=t._shaderInfo,this._properties=t._properties,this._blocks=t._blocks,this._blocksInt=t._blocksInt,this._dynamics=t._dynamics,this._shader=t._shader,A.rendering&&A.rendering.enableEffectImport?this._pipelineLayout=A.rendering.programLib.getPipelineLayout(this.device,this._phaseID,this._programName):this._pipelineLayout=Ow.getTemplateInfo(this._programName).pipelineLayout,this._hash=t._hash^i},e._updatePassHash=function(){this._hash=t.getPassHash(this)},e.setRootBufferDirty=function(t){this._rootBufferDirty=t},e.setPriority=function(t){this._priority=t},n(t,[{key:"_isBlend",get:function(){return this.blendState.targets.some((function(t){return t.blend}))}},{key:"root",get:function(){return this._root}},{key:"device",get:function(){return this._device}},{key:"shaderInfo",get:function(){return this._shaderInfo}},{key:"localSetLayout",get:function(){return A.rendering&&A.rendering.enableEffectImport?A.rendering.programLib.getLocalDescriptorSetLayout(this._device,this._phaseID,this._programName):Ow.getDescriptorSetLayout(this._device,this._programName,!0)}},{key:"program",get:function(){return this._programName}},{key:"properties",get:function(){return this._properties}},{key:"defines",get:function(){return this._defines}},{key:"passIndex",get:function(){return this._passIndex}},{key:"propertyIndex",get:function(){return this._propertyIndex}},{key:"dynamics",get:function(){return this._dynamics}},{key:"blocks",get:function(){return this._blocks}},{key:"blocksInt",get:function(){return this._blocksInt}},{key:"rootBufferDirty",get:function(){return this._rootBufferDirty}},{key:"priority",get:function(){return this._priority}},{key:"primitive",get:function(){return this._primitive}},{key:"stage",get:function(){return this._stage}},{key:"phase",get:function(){return this._phase}},{key:"passID",get:function(){return this._passID}},{key:"phaseID",get:function(){return this._phaseID}},{key:"rasterizerState",get:function(){return this._rs}},{key:"depthStencilState",get:function(){return this._dss}},{key:"blendState",get:function(){return this._bs}},{key:"dynamicStates",get:function(){return this._dynamicStates}},{key:"batchingScheme",get:function(){return this._batchingScheme}},{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"hash",get:function(){return this._hash}},{key:"pipelineLayout",get:function(){return this._pipelineLayout}}]),t}();function xT(t){var e=",bs,"+t.isA2C;return t.targets.forEach((function(t){e+=",bt,"+t.blend+","+t.blendEq+","+t.blendAlphaEq+","+t.blendColorMask,e+=","+t.blendSrc+","+t.blendDst+","+t.blendSrcAlpha+","+t.blendDstAlpha})),e}function TT(t){var e=",dss,"+t.depthTest+","+t.depthWrite+","+t.depthFunc;return e+=","+t.stencilTestFront+","+t.stencilFuncFront+","+t.stencilRefFront+","+t.stencilReadMaskFront,e+=","+t.stencilFailOpFront+","+t.stencilZFailOpFront+","+t.stencilPassOpFront+","+t.stencilWriteMaskFront,(e+=","+t.stencilTestBack+","+t.stencilFuncBack+","+t.stencilRefBack+","+t.stencilReadMaskBack)+","+t.stencilFailOpBack+","+t.stencilZFailOpBack+","+t.stencilPassOpBack+","+t.stencilWriteMaskBack}wT.getTypeFromHandle=QS,wT.getBindingFromHandle=ZS,wT.getCountFromHandle=$S,wT.getOffsetFromHandle=tw;var AT=t("dh",function(){function t(){}return t.getOrCreatePipelineState=function(t,e,i,n,r){var s=e.hash^n.hash^r.attributesHash^i.typedID,a=this._PSOHashMap.get(s);if(!a){var o=e.pipelineLayout,h=new Hd(r.attributes),u=new Ip(i,o,n,h,e.rasterizerState,e.depthStencilState,e.blendState,e.primitive,e.dynamicStates);a=t.createPipelineState(u),this._PSOHashMap.set(s,a)}return a},t}());AT._PSOHashMap=new Map;var CT=new nd,DT=new K_;function BT(t,e){t.x=e.x*e.x,t.y=e.y*e.y,t.z=e.z*e.z}var IT,MT,PT,ET,OT,kT,RT,FT,LT,VT=null;function NT(t){for(var e=t.length-1;e>=0;--e){var i=t[e];if(i.window.swapchain)return void(VT=i)}VT=null}function zT(t,e,i,n,r){if(!qS()&&n&&n.enabled&&r===VT){var s=n.subModels[0],a=s.inputAssembler,o=s.passes,h=s.shaders,u=s.descriptorSet;CT.width=DT.width=r.window.width,CT.height=DT.height=r.window.height;var l=AT.getOrCreatePipelineState(t,o[0],h[0],e,a);i.setViewport(CT),i.setScissor(DT),i.bindPipelineState(l),i.bindDescriptorSet(1,o[0].descriptorSet),i.bindDescriptorSet(2,u),i.bindInputAssembler(a),i.draw(a)}}var UT=new Vn,GT=t("e8",(IT=Kh("cc.Material"),MT=Ou(Rw),IT((ET=function(t){function e(e){var i;return(i=t.call(this,e)||this)._effectAsset=OT&&OT(),i._techIdx=kT&&kT(),i._defines=RT&&RT(),i._states=FT&&FT(),i._props=LT&<(),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._props.length;e++)this._props[e]={};if(t)for(var i,n=p(this._passes);!(i=n()).done;){var r=i.value;r.resetUBOs(),r.resetTextures()}},i.setProperty=function(t,e,i){var n=!1;if(void 0===i)for(var r=this._passes,s=r.length,a=0;a<s;a++){var o=r[a];this._uploadProperty(o,t,e)&&(this._props[o.propertyIndex][t]=e,n=!0)}else{i>=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<n;r++){var s=i[r];if(t in s)return s[t]}else{if(e>=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;i<t._props.length;i++)this._props[i]=r({},t._props[i]);this._defines.length=t._defines.length;for(var n=0;n<t._defines.length;n++)this._defines[n]=r({},t._defines[n]);this._states.length=t._states.length;for(var s=0;s<t._states.length;s++)this._states[s]=r({},t._states[s]);this._effectAsset=t._effectAsset,e&&this._fillInfo(e),this._update()},i._fillInfo=function(t){void 0!==t.technique&&(this._techIdx=t.technique),t.effectAsset?this._effectAsset=t.effectAsset:t.effectName&&(this._effectAsset=Rw.get(t.effectName)),t.defines&&this._prepareInfo(t.defines,this._defines),t.states&&this._prepareInfo(t.states,this._states)},i._prepareInfo=function(t,e){var i=t;if(!Array.isArray(i)){var n=this._effectAsset?this._effectAsset.techniques[this._techIdx].passes.length:1;i=Array(n).fill(i)}for(var r=0;r<i.length;++r)Object.assign(e[r]||(e[r]={}),i[r])},i._createPasses=function(){var t=this._effectAsset.techniques[this._techIdx||0];if(!t)return[];for(var e=t.passes.length,i=[],n=0;n<e;++n){var r=t.passes[n],s=r.passIndex=n,a=r.defines=this._defines[s]||(this._defines[s]={});if(r.stateOverrides=this._states[s]||(this._states[s]={}),void 0!==r.propertyIndex&&Object.assign(a,this._defines[r.propertyIndex]),void 0!==r.embeddedMacros&&Object.assign(a,r.embeddedMacros),!r.switch||a[r.switch]){var o=new wT(A.director.root);o.initialize(r),i.push(o)}}return i},i._update=function(t){var i=this;if(void 0===t&&(t=!0),this._effectAsset){this._passes=this._createPasses();var n=this._effectAsset.techniques[this._techIdx].passes.length;if(this._props.length=n,t)this._passes.forEach((function(t,e){var n=i._props[e];for(var r in n||(n=i._props[e]={}),void 0!==t.propertyIndex&&Object.assign(n,i._props[t.propertyIndex]),n)i._uploadProperty(t,r,n[r])}));else for(var r=0;r<this._props.length;r++)this._props[r]={}}this._hash=e.getHash(this)},i._uploadProperty=function(t,e,i){var n=this,r=t.getHandle(e);if(!r)return!1;if(QS(r)<26)if(Array.isArray(i))t.setUniformArray(r,i);else if(null!==i){var s;if(null!=(s=t.properties[e])&&s.linear){var a=i;BT(UT,a),UT.w=a.w,i=UT}t.setUniform(r,i)}else t.resetUniform(e);else Array.isArray(i)?i.forEach((function(e,i){n._bindTexture(t,r,e,i)})):i?this._bindTexture(t,r,i):t.resetTexture(e);return!0},i._bindTexture=function(t,e,i,n){var r=wT.getBindingFromHandle(e);if(i instanceof Rp)t.bindTexture(r,i,n);else if(i instanceof Ym){var s=i.getGFXTexture();if(!s||!s.width||!s.height)return;t.bindTexture(r,s,n),t.bindSampler(r,i.getGFXSampler(),n)}},i._doDestroy=function(){if(this._passes&&this._passes.length)for(var t,e=p(this._passes);!(t=e()).done;)t.value.destroy();this._passes.length=0},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.initialize({effectName:"builtin-unlit",defines:{USE_COLOR:!0},technique:0}),this.setProperty("mainColor",new cr("#ff00ff"))},i.validate=function(){return!!this._effectAsset&&!this._effectAsset.isDefault&&this.passes.length>0},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),OT=zh(ET.prototype,"_effectAsset",[MT],(function(){return null})),kT=zh(ET.prototype,"_techIdx",[uu],(function(){return 0})),RT=zh(ET.prototype,"_defines",[uu],(function(){return[]})),FT=zh(ET.prototype,"_states",[uu],(function(){return[]})),LT=zh(ET.prototype,"_props",[uu],(function(){return[]})),PT=ET))||PT));A.Material=GT;var HT=Ee({Low_256x256:256,Medium_512x512:512,High_1024x1024:1024,Ultra_2048x2048:2048}),WT=Ee({Planar:0,ShadowMap:1}),jT=Ee({HARD:0,SOFT:1,SOFT_2X:2,SOFT_4X:3}),qT=Ee({LEVEL_1:1,LEVEL_2:2,LEVEL_3:3,LEVEL_4:4}),XT=Ee({NONE:1,RemoveDuplicates:2,DisableRotationFix:3}),YT=WT.ShadowMap+1,JT=function(){function t(){this.fixedSphere=new Js(0,0,0,.01),this.maxReceived=4,this._matLight=new Kr,this._material=null,this._instancingMaterial=null,this._enabled=!1,this._type=YT,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 GT,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:YT,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===WT.Planar)this._updatePlanarInfo();else{var t=A.director.root;t.pipeline.macros.CC_SHADOW_TYPE=2,t.onGlobalPipelineStateChanged()}else{var e=A.director.root;e.pipeline.macros.CC_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()}},e._updatePlanarInfo=function(){this._material||(this._material=new GT,this._material.initialize({effectName:"pipeline/planar-shadow"}));var t=A.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:YT,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}();JT.MAX_FAR=2e3,JT.COEFFICIENT_OF_EXPANSION=2*Math.sqrt(3),A.Shadows=JT;var KT=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;e<t.count;e++){var i=r._descriptorSet,n=t.binding,a=i.getSampler(n,e),o=i.getTexture(n,e);s.bindSampler(n,a,e),s.bindTexture(n,o,e)}})),t.prototype.tryCompile.call(f(n)),n}s(e,t);var i=e.prototype;return i.overridePipelineStates=function(t,e){this._bs.reset(),this._rs.reset(),this._dss.reset(),wT.fillPipelineInfo(this,t),wT.fillPipelineInfo(this,e),this._onStateChange()},i.tryCompile=function(e){if(e&&!hw(this._defines,e))return!1;var i=t.prototype.tryCompile.call(this);return this._onStateChange(),i},i.beginChangeStatesSilently=function(){this._dontNotify=!0},i.endChangeStatesSilently=function(){this._dontNotify=!1},i._syncBatchingScheme=function(){this._defines.USE_INSTANCING=!1,this._batchingScheme=0},i._onStateChange=function(){this._hash=wT.getPassHash(this),this._owner.onPassStateChange(this._dontNotify)},n(e,[{key:"parent",get:function(){return this._parent}}]),e}(wT),QT=function(t){function e(e){var i;return(i=t.call(this)||this)._passes=[],i._subModelIdx=0,i._parent=e.parent,i._owner=e.owner||null,i._subModelIdx=e.subModelIdx||0,i.copy(i._parent),i}s(e,t);var i=e.prototype;return i.recompileShaders=function(t,e){this._passes&&this.effectAsset&&(void 0===e?this._passes.forEach((function(e){e.tryCompile(t)})):this._passes[e].tryCompile(t))},i.overridePipelineStates=function(t,e){if(this._passes&&this.effectAsset){var i=this.effectAsset.techniques[this.technique].passes;if(void 0===e)for(var n=0;n<this._passes.length;n++){var r=this._passes[n],s=this._states[n]||(this._states[n]={});for(var a in t)s[a]=t[a];r.overridePipelineStates(i[r.passIndex],s)}else{var o=this._states[e]||(this._states[e]={});for(var h in t)o[h]=t[h];this._passes[e].overridePipelineStates(i[e],o)}}},i.destroy=function(){return this._doDestroy(),!0},i.onPassStateChange=function(t){this._hash=GT.getHash(this),!t&&this._owner&&this._owner._onRebuildPSO(this._subModelIdx,this)},i._createPasses=function(){var t=[],e=this._parent.passes;if(!e)return t;for(var i=0;i<e.length;++i)t.push(new KT(e[i],this));return t},n(e,[{key:"parent",get:function(){return this._parent}},{key:"owner",get:function(){return this._owner}}]),e}(GT),ZT=null,$T=null,tA={HEMISPHERE_DIFFUSE:0,AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION:1,DIFFUSEMAP_WITH_REFLECTION:2};Ee(tA);var eA=function(){function t(){this._envmapLDR=null,this._envmapHDR=null,this._diffuseMapLDR=null,this._diffuseMapHDR=null,this._globalDSManager=null,this._model=null,this._default=null,this._enabled=!1,this._useIBL=!1,this._useHDR=!0,this._useDiffuseMap=!1,this._editableMaterial=null,this._activated=!1,this._reflectionHDR=null,this._reflectionLDR=null,this._rotationAngle=0}var e=t.prototype;return e.initialize=function(t){this._activated=!1,this._enabled=t.enabled,this._useIBL=t.useIBL,this._useDiffuseMap=t.applyDiffuseMap,this._useHDR=t.useHDR},e.setEnvMaps=function(t,e){this._envmapHDR=t,this._envmapLDR=e,this._updateGlobalBinding(),this._updatePipeline()},e.setDiffuseMaps=function(t,e){this._diffuseMapHDR=t,this._diffuseMapLDR=e,this._updateGlobalBinding(),this._updatePipeline()},e.setSkyboxMaterial=function(t){t?(this._editableMaterial=new QT({parent:t}),this._editableMaterial.recompileShaders({USE_RGBE_CUBEMAP:this.isRGBE})):this._editableMaterial=null,this._updatePipeline()},e.setReflectionMaps=function(t,e){this._reflectionHDR=t,this._reflectionLDR=e,this._updateGlobalBinding(),this._updatePipeline()},e.setRotationAngle=function(t){this._rotationAngle=t},e.getRotationAngle=function(){return this._rotationAngle},e.updateMaterialRenderInfo=function(){this._updateGlobalBinding(),this._updatePipeline()},e.activate=function(){var t=A.director.root.pipeline;this._globalDSManager=t.globalDSManager,this._default=mT.get("default-cube-texture"),this._model||(this._model=A.director.root.createModel(A.renderer.scene.Model));var e=this._default.isRGBE;if(this._default.isUsingOfflineMipmaps(),this.envmap&&(e=this.envmap.isRGBE,this.envmap.isUsingOfflineMipmaps()),!$T){var i=new GT;i.initialize({effectName:"pipeline/skybox",defines:{USE_RGBE_CUBEMAP:e}}),$T=new QT({parent:i})}this.enabled&&(ZT||(ZT=A.utils.createMesh(A.primitives.box({width:2,height:2,length:2}))),this._editableMaterial?this._model.initSubModel(0,ZT.renderingSubMeshes[0],this._editableMaterial):this._model.initSubModel(0,ZT.renderingSubMeshes[0],$T)),this.envmap||(this.envmap=this._default),this.diffuseMap||(this.diffuseMap=this._default),this._updateGlobalBinding(),this._updatePipeline(),this._activated=!0},e._updatePipeline=function(){var t=A.director.root,e=t.pipeline,i=this.useIBL?this.isRGBE?2:1:0,n=this.useIBL&&this.useDiffuseMap&&this.diffuseMap&&this.diffuseMap!==this._default?this.isRGBE?2:1:0,r=this.useHDR,s=this.useConvolutionMap;if(e.macros.CC_USE_IBL===i&&e.macros.CC_USE_DIFFUSEMAP===n&&e.macros.CC_USE_HDR===r&&e.macros.CC_IBL_CONVOLUTED===s||(e.macros.CC_USE_IBL=i,e.macros.CC_USE_DIFFUSEMAP=n,e.macros.CC_USE_HDR=r,e.macros.CC_IBL_CONVOLUTED=s,this._activated&&t.onGlobalPipelineStateChanged()),this.enabled){var a=this.envmap?this.envmap:this._default,o=this._editableMaterial?this._editableMaterial:$T;o&&(o.setProperty("environmentMap",a),o.recompileShaders({USE_RGBE_CUBEMAP:this.isRGBE})),this._model&&(this._model.setSubModelMaterial(0,o),this._updateSubModes())}},e._updateGlobalBinding=function(){if(!A.rendering&&this._globalDSManager){var t=Wp.gfxDevice;if(this.reflectionMap){var e=this.reflectionMap.getGFXTexture(),i=t.getSampler(this.reflectionMap.getSamplerInfo());this._globalDSManager.bindSampler(5,i),this._globalDSManager.bindTexture(5,e)}else{var n=this.envmap?this.envmap:this._default;if(n){var r=n.getGFXTexture(),s=t.getSampler(n.getSamplerInfo());this._globalDSManager.bindSampler(5,s),this._globalDSManager.bindTexture(5,r)}}var a=this.diffuseMap?this.diffuseMap:this._default;if(a){var o=a.getGFXTexture(),h=t.getSampler(a.getSamplerInfo());this._globalDSManager.bindSampler(7,h),this._globalDSManager.bindTexture(7,o)}this._globalDSManager.update()}},e._updateSubModes=function(){if(this._model)for(var t=this._model.subModels,e=0;e<t.length;e++)t[e].update()},n(t,[{key:"model",get:function(){return this._model}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,t?this.activate():this._updatePipeline()}},{key:"useHDR",get:function(){return this._useHDR},set:function(t){this._useHDR=t,this.setEnvMaps(this._envmapHDR,this._envmapLDR)}},{key:"useIBL",get:function(){return this._useIBL},set:function(t){this._useIBL=t,this._updatePipeline()}},{key:"useDiffuseMap",get:function(){return this._useDiffuseMap},set:function(t){this._useDiffuseMap=t,this._updatePipeline()}},{key:"isRGBE",get:function(){return!!this.envmap&&this.envmap.isRGBE}},{key:"useConvolutionMap",get:function(){return this.reflectionMap?this.reflectionMap.isUsingOfflineMipmaps():!!this.envmap&&this.envmap.isUsingOfflineMipmaps()}},{key:"envmap",get:function(){return rb().isHDR?this._envmapHDR:this._envmapLDR},set:function(t){rb().isHDR?this.setEnvMaps(t,this._envmapLDR):this.setEnvMaps(this._envmapHDR,t)}},{key:"diffuseMap",get:function(){return rb().isHDR?this._diffuseMapHDR:this._diffuseMapLDR},set:function(t){rb().isHDR?this.setDiffuseMaps(t,this._diffuseMapLDR):this.setDiffuseMaps(this._diffuseMapHDR,t)}},{key:"reflectionMap",get:function(){return rb().isHDR?this._reflectionHDR:this._reflectionLDR}},{key:"editableMaterial",get:function(){return this._editableMaterial}}]),t}();A.Skybox=eA;var iA=new Vn,nA=Ee({LINEAR:0,EXP:1,EXP_SQUARED:2,LAYERED:3}),rA=nA.LAYERED+1,sA=function(){function t(){this._fogColor=new cr("#C8C8C8"),this._colorArray=new Vn(.2,.2,.2,1),this._enabled=!1,this._accurate=!1,this._type=0,this._fogDensity=.3,this._fogStart=.5,this._fogEnd=300,this._fogAtten=5,this._fogTop=1.5,this._fogRange=1.2,this._activated=!1}var e=t.prototype;return e.initialize=function(t){this._activated=!1,this.fogColor=t.fogColor,this._enabled=t.enabled,this._type=this.enabled?t.type:rA,this._accurate=t.accurate,this.fogDensity=t.fogDensity,this.fogStart=t.fogStart,this.fogEnd=t.fogEnd,this.fogAtten=t.fogAtten,this.fogTop=t.fogTop,this.fogRange=t.fogRange},e.activate=function(){this._updatePipeline(),this._activated=!0},e._updatePipeline=function(){var t=A.director.root,e=this.enabled?this.type:rA,i=this.accurate?1:0,n=t.pipeline;n.macros.CC_USE_FOG===e&&n.macros.CC_USE_ACCURATE_FOG===i||(n.macros.CC_USE_FOG=e,n.macros.CC_USE_ACCURATE_FOG=i,this._activated&&t.onGlobalPipelineStateChanged())},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,t?this.activate():(this._type=rA,this._updatePipeline())}},{key:"accurate",get:function(){return this._accurate},set:function(t){this._accurate=t,this._updatePipeline()}},{key:"fogColor",get:function(){return this._fogColor},set:function(t){this._fogColor.set(t),iA.set(t.x,t.y,t.z,t.w),BT(this._colorArray,iA)}},{key:"type",get:function(){return this._type},set:function(t){this._type=this.enabled?t:rA,this.enabled&&this._updatePipeline()}},{key:"fogDensity",get:function(){return this._fogDensity},set:function(t){this._fogDensity=t}},{key:"fogStart",get:function(){return this._fogStart},set:function(t){this._fogStart=t}},{key:"fogEnd",get:function(){return this._fogEnd},set:function(t){this._fogEnd=t}},{key:"fogAtten",get:function(){return this._fogAtten},set:function(t){this._fogAtten=t}},{key:"fogTop",get:function(){return this._fogTop},set:function(t){this._fogTop=t}},{key:"fogRange",get:function(){return this._fogRange},set:function(t){this._fogRange=t}},{key:"colorArray",get:function(){return this._colorArray}}]),t}();A.Fog=sA;var aA,oA,hA,uA,lA,cA,fA,_A,dA,pA,mA,gA,yA,vA,bA,SA,wA,xA,TA,AA,CA,DA,BA,IA,MA,PA,EA,OA,kA,RA,FA,LA,VA,NA,zA,UA,GA,HA,WA,jA,qA,XA,YA,JA,KA,QA,ZA,$A,tC,eC,iC,nC,rC,sC,aC,oC,hC,uC,lC,cC,fC,_C,dC,pC,mC,gC,yC,vC,bC,SC,wC,xC,TC,AC,CC,DC,BC,IC,MC,PC,EC,OC,kC,RC,FC,LC,VC,NC,zC,UC,GC,HC,WC,jC,qC,XC,YC,JC,KC,QC,ZC,$C,tD,eD,iD,nD,rD,sD,aD,oD,hD,uD,lD,cD,fD,_D,dD,pD,mD,gD,yD,vD,bD,SD,wD,xD,TD,AD,CD,DD,BD=Ee({DEFAULT:0,LINEAR:1}),ID=function(){function t(){this._toneMappingType=BD.DEFAULT,this._activated=!1}var e=t.prototype;return e.initialize=function(t){this._toneMappingType=t.toneMappingType},e.activate=function(){this._updatePipeline(),this._activated=!0},e._updatePipeline=function(){var t=A.director.root;t.pipeline.macros.CC_TONE_MAPPING_TYPE=this._toneMappingType,this._activated&&t.onGlobalPipelineStateChanged()},n(t,[{key:"toneMappingType",get:function(){return this._toneMappingType},set:function(t){this._toneMappingType=t,this._updatePipeline()}}]),t}(),MD=new ir(0,1,0),PD=new ir,ED=new Vn,OD=new cr,kD=new kr,RD=function(t){var e=1/Math.max(Math.max(Math.max(t.x,t.y),t.z),1e-4);e<1&&(t.x*=e,t.y*=e,t.z*=e)},FD=t("dA",(aA=Kh("cc.AmbientInfo"),oA=Ou(ci),hA=lu("_skyColor"),uA=lu("_skyIllum"),lA=lu("_groundAlbedo"),aA((fA=function(){function t(){this._skyColorHDR=_A&&_A(),this._skyIllumHDR=dA&&dA(),this._groundAlbedoHDR=pA&&pA(),this._skyColorLDR=mA&&mA(),this._skyIllumLDR=gA&&gA(),this._groundAlbedoLDR=yA&&yA(),this._resource=null}return t.prototype.activate=function(t){this._resource=t,t.initialize(this)},n(t,[{key:"skyColorHDR",get:function(){return this._skyColorHDR}},{key:"groundAlbedoHDR",get:function(){return this._groundAlbedoHDR}},{key:"skyIllumHDR",get:function(){return this._skyIllumHDR}},{key:"skyColorLDR",get:function(){return this._skyColorLDR}},{key:"groundAlbedoLDR",get:function(){return this._groundAlbedoLDR}},{key:"skyIllumLDR",get:function(){return this._skyIllumLDR}},{key:"skyLightingColor",get:function(){var t=rb().isHDR;return ED.set(t?this._skyColorHDR:this._skyColorLDR),RD(ED),OD.set(255*ED.x,255*ED.y,255*ED.z,255)},set:function(t){ED.set(t.x,t.y,t.z,t.w),rb().isHDR?this._skyColorHDR.set(ED):this._skyColorLDR.set(ED),this._resource&&this._resource.skyColor.set(ED)}},{key:"skyColor",set:function(t){rb().isHDR?this._skyColorHDR.set(t):this._skyColorLDR.set(t),this._resource&&this._resource.skyColor.set(t)}},{key:"skyIllum",get:function(){return rb().isHDR?this._skyIllumHDR:this._skyIllumLDR},set:function(t){rb().isHDR?this._skyIllumHDR=t:this._skyIllumLDR=t,this._resource&&(this._resource.skyIllum=t)}},{key:"groundLightingColor",get:function(){var t=rb().isHDR;return ED.set(t?this._groundAlbedoHDR:this._groundAlbedoLDR),RD(ED),OD.set(255*ED.x,255*ED.y,255*ED.z,255)},set:function(t){ED.set(t.x,t.y,t.z,t.w),rb().isHDR?this._groundAlbedoHDR.set(ED):this._groundAlbedoLDR.set(ED),this._resource&&this._resource.groundAlbedo.set(ED)}},{key:"groundAlbedo",set:function(t){rb().isHDR?this._groundAlbedoHDR.set(t):this._groundAlbedoLDR.set(t),this._resource&&this._resource.groundAlbedo.set(t)}}]),t}(),v(fA.prototype,"skyIllum",[oA],Object.getOwnPropertyDescriptor(fA.prototype,"skyIllum"),fA.prototype),_A=zh(fA.prototype,"_skyColorHDR",[uu,hA],(function(){return new Vn(.2,.5,.8,1)})),dA=zh(fA.prototype,"_skyIllumHDR",[uu,uA],(function(){return vb.SKY_ILLUM})),pA=zh(fA.prototype,"_groundAlbedoHDR",[uu,lA],(function(){return new Vn(.2,.2,.2,1)})),mA=zh(fA.prototype,"_skyColorLDR",[uu],(function(){return new Vn(.2,.5,.8,1)})),gA=zh(fA.prototype,"_skyIllumLDR",[uu],(function(){return vb.SKY_ILLUM})),yA=zh(fA.prototype,"_groundAlbedoLDR",[uu],(function(){return new Vn(.2,.2,.2,1)})),cA=fA))||cA));C.AmbientInfo=FD;var LD=t("dB",(vA=Kh("cc.SkyboxInfo"),bA=Ou(tA),SA=Ou(ib),wA=Ou(ci),xA=Ou(ib),TA=Ou(ib),AA=Ou(GT),CA=Ou(ib),DA=lu("_envmap"),BA=Ou(ib),IA=Ou(ib),MA=Ou(ib),PA=Ou(GT),EA=Ou(ib),OA=Ou(ib),vA((RA=function(){function t(){this._envLightingType=FA&&FA(),this._envmapHDR=LA&&LA(),this._envmapLDR=VA&&VA(),this._diffuseMapHDR=NA&&NA(),this._diffuseMapLDR=zA&&zA(),this._enabled=UA&&UA(),this._useHDR=GA&&GA(),this._editableMaterial=HA&&HA(),this._reflectionHDR=WA&&WA(),this._reflectionLDR=jA&&jA(),this._rotationAngle=qA&&qA(),this._resource=null}var e=t.prototype;return e.activate=function(t){this.envLightingType=this._envLightingType,this._resource=t,t.initialize(this),t.setEnvMaps(this._envmapHDR,this._envmapLDR),t.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR),t.setSkyboxMaterial(this._editableMaterial),t.setReflectionMaps(this._reflectionHDR,this._reflectionLDR),t.setRotationAngle(this._rotationAngle),t.activate()},e.updateEnvMap=function(t){t||(this.applyDiffuseMap=!1,this.useIBL=!1,this.envLightingType=0,at(15001));var e=this._resource;e&&(e.setEnvMaps(this._envmapHDR,this._envmapLDR),e.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR),e.setReflectionMaps(this._reflectionHDR,this._reflectionLDR),e.useDiffuseMap=this.applyDiffuseMap,e.envmap=t)},e.setMaterialProperty=function(t,e,i){var n=this._resource;if(n){var r=n.editableMaterial;n.enabled&&r&&(r.setProperty(t,e,i),r.passes.forEach((function(t){t.update()})))}},n(t,[{key:"applyDiffuseMap",get:function(){return 2===this._envLightingType},set:function(t){this._resource&&(this._resource.useDiffuseMap=t)}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(this._enabled=t,this._resource&&(this._resource.enabled=this._enabled))}},{key:"envLightingType",get:function(){return this._envLightingType},set:function(t){this.envmap||0===t?(0===t?(this.useIBL=!1,this.applyDiffuseMap=!1):1===t?(this.useIBL=!0,this.applyDiffuseMap=!1):2===t&&(this.useIBL=!0,this.applyDiffuseMap=!0),this._envLightingType=t):(this.useIBL=!1,this.applyDiffuseMap=!1,this._envLightingType=0,at(15001))}},{key:"useIBL",get:function(){return 0!==this._envLightingType},set:function(t){this._resource&&(this._resource.useIBL=t)}},{key:"useHDR",get:function(){return rb().isHDR=this._useHDR,this._useHDR},set:function(t){rb().isHDR=t,this._useHDR=t;var e=this._resource;e&&2===this.envLightingType&&(null===this.diffuseMap?(this.envLightingType=1,at(15e3)):this.diffuseMap.isDefault&&at(15002)),e&&(e.useHDR=this._useHDR,e.updateMaterialRenderInfo())}},{key:"envmap",get:function(){return rb().isHDR?this._envmapHDR:this._envmapLDR},set:function(t){var e=rb().isHDR;e?(this._envmapHDR=t,this._reflectionHDR=null):(this._envmapLDR=t,this._reflectionLDR=null),t||(e?this._diffuseMapHDR=null:this._diffuseMapLDR=null,this.applyDiffuseMap=!1,this.useIBL=!1,this.envLightingType=0,at(15001));var i=this._resource;i&&(i.setEnvMaps(this._envmapHDR,this._envmapLDR),i.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR),i.setReflectionMaps(this._reflectionHDR,this._reflectionLDR),i.useDiffuseMap=this.applyDiffuseMap,i.envmap=t)}},{key:"rotationAngle",get:function(){return this._rotationAngle},set:function(t){this._rotationAngle=t,this._resource&&this._resource.setRotationAngle(this._rotationAngle)}},{key:"diffuseMap",get:function(){return rb().isHDR?this._diffuseMapHDR:this._diffuseMapLDR},set:function(t){rb().isHDR?this._diffuseMapHDR=t:this._diffuseMapLDR=t,this._resource&&this._resource.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR)}},{key:"reflectionMap",get:function(){return rb().isHDR?this._reflectionHDR:this._reflectionLDR},set:function(t){rb().isHDR?this._reflectionHDR=t:this._reflectionLDR=t,this._resource&&this._resource.setReflectionMaps(this._reflectionHDR,this._reflectionLDR)}},{key:"skyboxMaterial",get:function(){return this._editableMaterial},set:function(t){this._editableMaterial=t,this._resource&&this._resource.setSkyboxMaterial(this._editableMaterial)}}]),t}(),v(RA.prototype,"envLightingType",[bA],Object.getOwnPropertyDescriptor(RA.prototype,"envLightingType"),RA.prototype),v(RA.prototype,"envmap",[SA],Object.getOwnPropertyDescriptor(RA.prototype,"envmap"),RA.prototype),v(RA.prototype,"rotationAngle",[wA],Object.getOwnPropertyDescriptor(RA.prototype,"rotationAngle"),RA.prototype),v(RA.prototype,"diffuseMap",[xA],Object.getOwnPropertyDescriptor(RA.prototype,"diffuseMap"),RA.prototype),v(RA.prototype,"reflectionMap",[TA],Object.getOwnPropertyDescriptor(RA.prototype,"reflectionMap"),RA.prototype),v(RA.prototype,"skyboxMaterial",[AA],Object.getOwnPropertyDescriptor(RA.prototype,"skyboxMaterial"),RA.prototype),FA=zh(RA.prototype,"_envLightingType",[uu],(function(){return 0})),LA=zh(RA.prototype,"_envmapHDR",[uu,CA,DA],(function(){return null})),VA=zh(RA.prototype,"_envmapLDR",[uu,BA],(function(){return null})),NA=zh(RA.prototype,"_diffuseMapHDR",[uu,IA],(function(){return null})),zA=zh(RA.prototype,"_diffuseMapLDR",[uu,MA],(function(){return null})),UA=zh(RA.prototype,"_enabled",[uu],(function(){return!1})),GA=zh(RA.prototype,"_useHDR",[uu],(function(){return!0})),HA=zh(RA.prototype,"_editableMaterial",[uu,PA],(function(){return null})),WA=zh(RA.prototype,"_reflectionHDR",[uu,EA],(function(){return null})),jA=zh(RA.prototype,"_reflectionLDR",[uu,OA],(function(){return null})),qA=zh(RA.prototype,"_rotationAngle",[uu],(function(){return 0})),kA=RA))||kA));C.SkyboxInfo=LD;var VD=t("dC",(XA=Kh("cc.FogInfo"),YA=Ou(nA),JA=Ou(ci),KA=Ou(ci),QA=Ou(ci),ZA=Ou(ci),$A=Ou(ci),tC=Ou(ci),XA((_C=function(){function t(){this._type=nC&&nC(),this._fogColor=rC&&rC(),this._enabled=sC&&sC(),this._fogDensity=aC&&aC(),this._fogStart=oC&&oC(),this._fogEnd=hC&&hC(),this._fogAtten=uC&&uC(),this._fogTop=lC&&lC(),this._fogRange=cC&&cC(),this._accurate=fC&&fC(),this._resource=null}return t.prototype.activate=function(t){this._resource=t,t.initialize(this),t.activate()},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){if(this._enabled!==t){this._enabled=t;var e=this._resource;e&&(e.enabled=t,t&&(e.type=this._type))}}},{key:"accurate",get:function(){return this._accurate},set:function(t){if(this._accurate!==t){this._accurate=t;var e=this._resource;e&&(e.accurate=t,t&&(e.type=this._type))}}},{key:"fogColor",get:function(){return this._fogColor},set:function(t){this._fogColor.set(t),this._resource&&(this._resource.fogColor=this._fogColor)}},{key:"type",get:function(){return this._type},set:function(t){this._type=t,this._resource&&(this._resource.type=t)}},{key:"fogDensity",get:function(){return this._fogDensity},set:function(t){this._fogDensity=t,this._resource&&(this._resource.fogDensity=t)}},{key:"fogStart",get:function(){return this._fogStart},set:function(t){this._fogStart=t,this._resource&&(this._resource.fogStart=t)}},{key:"fogEnd",get:function(){return this._fogEnd},set:function(t){this._fogEnd=t,this._resource&&(this._resource.fogEnd=t)}},{key:"fogAtten",get:function(){return this._fogAtten},set:function(t){this._fogAtten=t,this._resource&&(this._resource.fogAtten=t)}},{key:"fogTop",get:function(){return this._fogTop},set:function(t){this._fogTop=t,this._resource&&(this._resource.fogTop=t)}},{key:"fogRange",get:function(){return this._fogRange},set:function(t){this._fogRange=t,this._resource&&(this._resource.fogRange=t)}}]),t}(),_C.FogType=nA,v((iC=_C).prototype,"type",[YA],Object.getOwnPropertyDescriptor(iC.prototype,"type"),iC.prototype),v(iC.prototype,"fogDensity",[JA],Object.getOwnPropertyDescriptor(iC.prototype,"fogDensity"),iC.prototype),v(iC.prototype,"fogStart",[KA],Object.getOwnPropertyDescriptor(iC.prototype,"fogStart"),iC.prototype),v(iC.prototype,"fogEnd",[QA],Object.getOwnPropertyDescriptor(iC.prototype,"fogEnd"),iC.prototype),v(iC.prototype,"fogAtten",[ZA],Object.getOwnPropertyDescriptor(iC.prototype,"fogAtten"),iC.prototype),v(iC.prototype,"fogTop",[$A],Object.getOwnPropertyDescriptor(iC.prototype,"fogTop"),iC.prototype),v(iC.prototype,"fogRange",[tC],Object.getOwnPropertyDescriptor(iC.prototype,"fogRange"),iC.prototype),nC=zh(iC.prototype,"_type",[uu],(function(){return nA.LINEAR})),rC=zh(iC.prototype,"_fogColor",[uu],(function(){return new cr("#C8C8C8")})),sC=zh(iC.prototype,"_enabled",[uu],(function(){return!1})),aC=zh(iC.prototype,"_fogDensity",[uu],(function(){return.3})),oC=zh(iC.prototype,"_fogStart",[uu],(function(){return.5})),hC=zh(iC.prototype,"_fogEnd",[uu],(function(){return 300})),uC=zh(iC.prototype,"_fogAtten",[uu],(function(){return 5})),lC=zh(iC.prototype,"_fogTop",[uu],(function(){return 1.5})),cC=zh(iC.prototype,"_fogRange",[uu],(function(){return 1.2})),fC=zh(iC.prototype,"_accurate",[uu],(function(){return!1})),eC=iC))||eC)),ND=t("dD",(dC=Kh("cc.ShadowsInfo"),pC=Ou(WT),mC=Ou(ci),gC=Ou(ci),yC=Ou(li),vC=Ou(HT),dC((SC=function(){function t(){this._enabled=wC&&wC(),this._type=xC&&xC(),this._normal=TC&&TC(),this._distance=AC&&AC(),this._planeBias=CC&&CC(),this._shadowColor=DC&&DC(),this._maxReceived=BC&&BC(),this._size=IC&&IC(),this._resource=null}var e=t.prototype;return e.setPlaneFromNode=function(t){t.getWorldRotation(kD),this.planeDirection=ir.transformQuat(PD,MD,kD),t.getWorldPosition(PD),this.planeHeight=ir.dot(this._normal,PD)},e.activate=function(t){this._resource=t,t.initialize(this),t.activate()},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){if(this._enabled!==t){this._enabled=t;var e=this._resource;e&&(e.enabled=t,t&&(e.type=this._type))}}},{key:"type",get:function(){return this._type},set:function(t){this._type=t,this._resource&&(this._resource.type=t)}},{key:"shadowColor",get:function(){return this._shadowColor},set:function(t){this._shadowColor.set(t),this._resource&&(this._resource.shadowColor=t)}},{key:"planeDirection",get:function(){return this._normal},set:function(t){ir.copy(this._normal,t),this._resource&&(this._resource.normal=t)}},{key:"planeHeight",get:function(){return this._distance},set:function(t){this._distance=t,this._resource&&(this._resource.distance=t)}},{key:"planeBias",get:function(){return this._planeBias},set:function(t){this._planeBias=t,this._resource&&(this._resource.planeBias=t)}},{key:"maxReceived",get:function(){return this._maxReceived},set:function(t){this._maxReceived=t,this._resource&&(this._resource.maxReceived=t)}},{key:"shadowMapSize",get:function(){return this._size.x},set:function(t){var e=this._resource;this._size.set(t,t),e&&(e.size.set(t,t),e.shadowMapDirty=!0)}}]),t}(),v(SC.prototype,"type",[pC],Object.getOwnPropertyDescriptor(SC.prototype,"type"),SC.prototype),v(SC.prototype,"planeHeight",[mC],Object.getOwnPropertyDescriptor(SC.prototype,"planeHeight"),SC.prototype),v(SC.prototype,"planeBias",[gC],Object.getOwnPropertyDescriptor(SC.prototype,"planeBias"),SC.prototype),v(SC.prototype,"maxReceived",[yC],Object.getOwnPropertyDescriptor(SC.prototype,"maxReceived"),SC.prototype),v(SC.prototype,"shadowMapSize",[vC],Object.getOwnPropertyDescriptor(SC.prototype,"shadowMapSize"),SC.prototype),wC=zh(SC.prototype,"_enabled",[uu],(function(){return!1})),xC=zh(SC.prototype,"_type",[uu],(function(){return WT.Planar})),TC=zh(SC.prototype,"_normal",[uu],(function(){return new ir(0,1,0)})),AC=zh(SC.prototype,"_distance",[uu],(function(){return 0})),CC=zh(SC.prototype,"_planeBias",[uu],(function(){return 1})),DC=zh(SC.prototype,"_shadowColor",[uu],(function(){return new cr(0,0,0,76)})),BC=zh(SC.prototype,"_maxReceived",[uu],(function(){return 4})),IC=zh(SC.prototype,"_size",[uu],(function(){return new ds(1024,1024)})),bC=SC))||bC));C.ShadowsInfo=ND;var zD=t("dE",new ir(-1024,-1024,-1024)),UD=t("dF",new ir(1024,1024,1024)),GD=t("dG",8),HD=t("dH",(MC=Kh("cc.OctreeInfo"),PC=Ou(li),MC((OC=function(){function t(){this._enabled=kC&&kC(),this._minPos=RC&&RC(),this._maxPos=FC&&FC(),this._depth=LC&&LC(),this._resource=null}return t.prototype.activate=function(t){this._resource=t,t.initialize(this)},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(this._enabled=t,this._resource&&(this._resource.enabled=t))}},{key:"minPos",get:function(){return this._minPos},set:function(t){this._minPos=t,this._resource&&(this._resource.minPos=t)}},{key:"maxPos",get:function(){return this._maxPos},set:function(t){this._maxPos=t,this._resource&&(this._resource.maxPos=t)}},{key:"depth",get:function(){return this._depth},set:function(t){this._depth=t,this._resource&&(this._resource.depth=t)}}]),t}(),v(OC.prototype,"depth",[PC],Object.getOwnPropertyDescriptor(OC.prototype,"depth"),OC.prototype),kC=zh(OC.prototype,"_enabled",[uu],(function(){return!1})),RC=zh(OC.prototype,"_minPos",[uu],(function(){return new ir(zD)})),FC=zh(OC.prototype,"_maxPos",[uu],(function(){return new ir(UD)})),LC=zh(OC.prototype,"_depth",[uu],(function(){return GD})),EC=OC))||EC));C.OctreeInfo=HD;var WD=t("dI",(VC=Kh("cc.SkinInfo"),NC=Ou(ci),zC=Ou(ci),VC((GC=function(){function t(){this._enabled=HC&&HC(),this._blurRadius=WC&&WC(),this._sssIntensity=jC&&jC(),this._resource=null}return t.prototype.activate=function(t){this._resource=t,t.initialize(this)},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(this._enabled=t,this._resource&&(this._resource.enabled=t))}},{key:"blurRadius",get:function(){return this._blurRadius},set:function(t){this._blurRadius=t,this._resource&&(this._resource.blurRadius=t)}},{key:"sssIntensity",get:function(){return this._sssIntensity},set:function(t){this._sssIntensity=t,this._resource&&(this._resource.sssIntensity=t)}}]),t}(),v(GC.prototype,"blurRadius",[NC],Object.getOwnPropertyDescriptor(GC.prototype,"blurRadius"),GC.prototype),v(GC.prototype,"sssIntensity",[zC],Object.getOwnPropertyDescriptor(GC.prototype,"sssIntensity"),GC.prototype),HC=zh(GC.prototype,"_enabled",[uu],(function(){return!0})),WC=zh(GC.prototype,"_blurRadius",[uu],(function(){return.01})),jC=zh(GC.prototype,"_sssIntensity",[uu],(function(){return 3})),UC=GC))||UC));C.SkinInfo=WD;var jD=t("dJ",(qC=Kh("cc.PostSettingsInfo"),XC=Ou(BD),qC((JC=function(){function t(){this._toneMappingType=KC&&KC(),this._resource=null}return t.prototype.activate=function(t){this._resource=t,t.initialize(this),t.activate()},n(t,[{key:"toneMappingType",get:function(){return this._toneMappingType},set:function(t){this._toneMappingType=t,this._resource&&(this._resource.toneMappingType=t)}}]),t}(),v(JC.prototype,"toneMappingType",[XC],Object.getOwnPropertyDescriptor(JC.prototype,"toneMappingType"),JC.prototype),KC=zh(JC.prototype,"_toneMappingType",[uu],(function(){return BD.DEFAULT})),YC=JC))||YC));C.PostSettingsInfo=jD;var qD,XD,YD,JD,KD,QD,ZD,$D,tB,eB,iB,nB,rB,sB,aB,oB,hB,uB,lB,cB,fB,_B,dB,pB,mB,gB,yB,vB,bB,SB,wB,xB,TB,AB,CB,DB,BB,IB,MB,PB,EB,OB,kB,RB,FB,LB,VB,NB,zB,UB,GB,HB,WB,jB,qB,XB,YB,JB,KB,QB,ZB,$B,tI,eI,iI,nI,rI,sI,aI,oI=t("dK",(QC=Kh("cc.LightProbeInfo"),ZC=Ou(ci),$C=Ou(li),tD=Ou(li),eD=Ou(ci),iD=Ou(ci),QC((rD=function(){function t(){this._giScale=sD&&sD(),this._giSamples=aD&&aD(),this._bounces=oD&&oD(),this._reduceRinging=hD&&hD(),this._showProbe=uD&&uD(),this._showWireframe=lD&&lD(),this._showConvex=cD&&cD(),this._data=fD&&fD(),this._lightProbeSphereVolume=_D&&_D(),this._nodes=[],this._scene=null,this._resource=null}var e=t.prototype;return e.activate=function(t,e){this._scene=t,this._resource=e,e.initialize(this)},e.onProbeBakeFinished=function(){this.onProbeBakingChanged(this._scene)},e.onProbeBakeCleared=function(){this.clearSHCoefficients(),this.onProbeBakingChanged(this._scene)},e.onProbeBakingChanged=function(t){var e=this;t&&(t.emit("light-probe-baking-changed"),t.children.forEach((function(t){e.onProbeBakingChanged(t)})))},e.clearSHCoefficients=function(){this._data&&(this._data.probes.forEach((function(t){t.coefficients.length=0})),this.clearAllSHUBOs())},e.isUniqueNode=function(){return 1===this._nodes.length},e.addNode=function(t){if(!t)return!1;for(var e=0;e<this._nodes.length;e++)if(this._nodes[e].node===t)return!1;return this._nodes.push({node:t,probes:null}),!0},e.removeNode=function(t){if(!t)return!1;var e=this._nodes.findIndex((function(e){return e.node===t}));return-1!==e&&(this._nodes.splice(e,1),!0)},e.syncData=function(t,e){for(var i=0;i<this._nodes.length;i++)if(this._nodes[i].node===t)return void(this._nodes[i].probes=e)},e.update=function(t){if(void 0===t&&(t=!0),A.internal.LightProbesData){this._data||(this._data=new A.internal.LightProbesData,this._resource&&(this._resource.data=this._data));for(var e=[],i=0;i<this._nodes.length;i++){var n=this._nodes[i],r=n.node,s=n.probes,a=r.worldPosition;if(s)for(var o=0;o<s.length;o++){var h=nr();ir.add(h,s[o],a),e.push(h)}}if(e.length<4)return this.resetAllTetraIndices(),void this._data.reset();this._data.updateProbes(e),t&&(this.resetAllTetraIndices(),this._data.updateTetrahedrons())}},e.clearAllSHUBOs=function(){if(this._scene){var t=this._scene.renderScene;t&&t.models.forEach((function(t){t.clearSHUBOs()}))}},e.resetAllTetraIndices=function(){if(this._scene){var t=this._scene.renderScene;t&&t.models.forEach((function(t){t.tetrahedronIndex=-1}))}},n(t,[{key:"giScale",get:function(){return this._giScale},set:function(t){this._giScale!==t&&(this._giScale=t,this._resource&&(this._resource.giScale=t))}},{key:"giSamples",get:function(){return this._giSamples},set:function(t){this._giSamples!==t&&(this._giSamples=t,this._resource&&(this._resource.giSamples=t))}},{key:"bounces",get:function(){return this._bounces},set:function(t){this._bounces!==t&&(this._bounces=t,this._resource&&(this._resource.bounces=t))}},{key:"reduceRinging",get:function(){return this._reduceRinging},set:function(t){this._reduceRinging!==t&&(this._reduceRinging=t,this._resource&&(this._resource.reduceRinging=t))}},{key:"showProbe",get:function(){return this._showProbe},set:function(t){this._showProbe!==t&&(this._showProbe=t,this._resource&&(this._resource.showProbe=t))}},{key:"showWireframe",get:function(){return this._showWireframe},set:function(t){this._showWireframe!==t&&(this._showWireframe=t,this._resource&&(this._resource.showWireframe=t))}},{key:"showConvex",get:function(){return this._showConvex},set:function(t){this._showConvex!==t&&(this._showConvex=t,this._resource&&(this._resource.showConvex=t))}},{key:"data",get:function(){return this._data},set:function(t){this._data!==t&&(this._data=t,this._resource&&(this._resource.data=t))}},{key:"lightProbeSphereVolume",get:function(){return this._lightProbeSphereVolume},set:function(t){this._lightProbeSphereVolume!==t&&(this._lightProbeSphereVolume=t,this._resource&&(this._resource.lightProbeSphereVolume=t))}}]),t}(),v(rD.prototype,"giScale",[ZC],Object.getOwnPropertyDescriptor(rD.prototype,"giScale"),rD.prototype),v(rD.prototype,"giSamples",[$C],Object.getOwnPropertyDescriptor(rD.prototype,"giSamples"),rD.prototype),v(rD.prototype,"bounces",[tD],Object.getOwnPropertyDescriptor(rD.prototype,"bounces"),rD.prototype),v(rD.prototype,"reduceRinging",[eD],Object.getOwnPropertyDescriptor(rD.prototype,"reduceRinging"),rD.prototype),v(rD.prototype,"lightProbeSphereVolume",[iD],Object.getOwnPropertyDescriptor(rD.prototype,"lightProbeSphereVolume"),rD.prototype),sD=zh(rD.prototype,"_giScale",[uu],(function(){return 1})),aD=zh(rD.prototype,"_giSamples",[uu],(function(){return 1024})),oD=zh(rD.prototype,"_bounces",[uu],(function(){return 2})),hD=zh(rD.prototype,"_reduceRinging",[uu],(function(){return 0})),uD=zh(rD.prototype,"_showProbe",[uu],(function(){return!0})),lD=zh(rD.prototype,"_showWireframe",[uu],(function(){return!0})),cD=zh(rD.prototype,"_showConvex",[uu],(function(){return!1})),fD=zh(rD.prototype,"_data",[uu],(function(){return null})),_D=zh(rD.prototype,"_lightProbeSphereVolume",[uu],(function(){return 1})),nD=rD))||nD)),hI=t("dL",(dD=Kh("cc.SceneGlobals"),pD=Ou(LD),dD((gD=function(){function t(){this.ambient=yD&&yD(),this.shadows=vD&&vD(),this._skybox=bD&&bD(),this.fog=SD&&SD(),this.octree=wD&&wD(),this.skin=xD&&xD(),this.lightProbeInfo=TD&&TD(),this.postSettings=AD&&AD(),this.bakedWithStationaryMainLight=CD&&CD(),this.bakedWithHighpLightmap=DD&&DD(),this.disableLightmap=!1}return t.prototype.activate=function(t){var e=C.director.root.pipeline.pipelineSceneData;this.skybox.activate(e.skybox),this.ambient.activate(e.ambient),this.shadows.activate(e.shadows),this.fog.activate(e.fog),this.octree.activate(e.octree),this.skin.activate(e.skin),this.postSettings.activate(e.postSettings),this.lightProbeInfo&&e.lightProbes&&this.lightProbeInfo.activate(t,e.lightProbes),C.director.root.onGlobalPipelineStateChanged()},n(t,[{key:"skybox",get:function(){return this._skybox},set:function(t){this._skybox=t}}]),t}(),yD=zh(gD.prototype,"ambient",[uu],(function(){return new FD})),vD=zh(gD.prototype,"shadows",[uu],(function(){return new ND})),bD=zh(gD.prototype,"_skybox",[uu],(function(){return new LD})),SD=zh(gD.prototype,"fog",[uu],(function(){return new VD})),v(gD.prototype,"skybox",[pD],Object.getOwnPropertyDescriptor(gD.prototype,"skybox"),gD.prototype),wD=zh(gD.prototype,"octree",[uu],(function(){return new HD})),xD=zh(gD.prototype,"skin",[uu],(function(){return new WD})),TD=zh(gD.prototype,"lightProbeInfo",[uu],(function(){return new oI})),AD=zh(gD.prototype,"postSettings",[uu],(function(){return new jD})),CD=zh(gD.prototype,"bakedWithStationaryMainLight",[uu],(function(){return!1})),DD=zh(gD.prototype,"bakedWithHighpLightmap",[uu],(function(){return!1})),mD=gD))||mD));C.SceneGlobals=hI;var uI=(qD=Kh("cc.TargetInfo"),XD=Ou([_i]),qD((JD=function(){this.localID=KD&&KD()},KD=zh(JD.prototype,"localID",[uu,XD],(function(){return[]})),YD=JD))||YD),lI=(QD=Kh("cc.TargetOverrideInfo"),ZD=Ou(mo),$D=Ou(uI),tB=Ou([_i]),eB=Ou(eb),iB=Ou(uI),QD((rB=function(){this.source=sB&&sB(),this.sourceInfo=aB&&aB(),this.propertyPath=oB&&oB(),this.target=hB&&hB(),this.targetInfo=uB&&uB()},sB=zh(rB.prototype,"source",[uu,ZD],(function(){return null})),aB=zh(rB.prototype,"sourceInfo",[uu,$D],(function(){return null})),oB=zh(rB.prototype,"propertyPath",[uu,tB],(function(){return[]})),hB=zh(rB.prototype,"target",[uu,eB],(function(){return null})),uB=zh(rB.prototype,"targetInfo",[uu,iB],(function(){return null})),nB=rB))||nB),cI=Kh("cc.CompPrefabInfo")((cB=function(){this.fileId=fB&&fB()},fB=zh(cB.prototype,"fileId",[uu],(function(){return""})),lB=cB))||lB,fI=(_B=Kh("CCPropertyOverrideInfo"),dB=Ou(uI),pB=Ou([_i]),_B((gB=function(){function t(){this.targetInfo=yB&&yB(),this.propertyPath=vB&&vB(),this.value=bB&&bB()}return t.prototype.isTarget=function(){},t}(),yB=zh(gB.prototype,"targetInfo",[uu,dB],(function(){return null})),vB=zh(gB.prototype,"propertyPath",[uu,pB],(function(){return[]})),bB=zh(gB.prototype,"value",[uu],null),mB=gB))||mB),_I=(SB=Kh("cc.MountedChildrenInfo"),wB=Ou(uI),xB=Ou([eb]),SB((AB=function(){function t(){this.targetInfo=CB&&CB(),this.nodes=DB&&DB()}return t.prototype.isTarget=function(){},t}(),CB=zh(AB.prototype,"targetInfo",[uu,wB],(function(){return null})),DB=zh(AB.prototype,"nodes",[uu,xB],(function(){return[]})),TB=AB))||TB),dI=(BB=Kh("cc.MountedComponentsInfo"),IB=Ou(uI),MB=Ou([yg]),BB((EB=function(){function t(){this.targetInfo=OB&&OB(),this.components=kB&&kB()}return t.prototype.isTarget=function(){},t}(),OB=zh(EB.prototype,"targetInfo",[uu,IB],(function(){return null})),kB=zh(EB.prototype,"components",[uu,MB],(function(){return[]})),PB=EB))||PB),pI=(RB=Kh("cc.PrefabInstance"),FB=Ou(eb),LB=Ou([_I]),VB=Ou([dI]),NB=Ou([fI]),zB=Ou([uI]),RB((GB=function(){function t(){this.fileId=HB&&HB(),this.prefabRootNode=WB&&WB(),this.mountedChildren=jB&&jB(),this.mountedComponents=qB&&qB(),this.propertyOverrides=XB&&XB(),this.removedComponents=YB&&YB(),this.targetMap={},this.expanded=!1}var e=t.prototype;return e.findPropertyOverride=function(){},e.removePropertyOverride=function(){},t}(),HB=zh(GB.prototype,"fileId",[uu],(function(){return""})),WB=zh(GB.prototype,"prefabRootNode",[uu,FB],null),jB=zh(GB.prototype,"mountedChildren",[uu,LB],(function(){return[]})),qB=zh(GB.prototype,"mountedComponents",[uu,VB],(function(){return[]})),XB=zh(GB.prototype,"propertyOverrides",[uu,NB],(function(){return[]})),YB=zh(GB.prototype,"removedComponents",[uu,zB],(function(){return[]})),UB=GB))||UB),mI=(JB=Kh("cc.PrefabInfo"),KB=Ou(eb),QB=Ou(pI),ZB=Ou([lI]),JB((tI=function(){this.root=eI&&eI(),this.asset=iI&&iI(),this.fileId=nI&&nI(),this.instance=rI&&rI(),this.targetOverrides=sI&&sI(),this.nestedPrefabInstanceRoots=aI&&aI()},eI=zh(tI.prototype,"root",[uu,KB],null),iI=zh(tI.prototype,"asset",[uu],null),nI=zh(tI.prototype,"fileId",[uu],(function(){return""})),rI=zh(tI.prototype,"instance",[uu,QB],null),sI=zh(tI.prototype,"targetOverrides",[uu,ZB],null),aI=zh(tI.prototype,"nestedPrefabInstanceRoots",[uu],null),$B=tI))||$B);function gI(t){var e=null==t?void 0:t.prefab;if(e&&e.instance){if(!e.asset)return ht(3701,t.name),void(e.instance=void 0);var i=t._objFlags,n=t.getParent(),r=t.uuid;t[co],A.game._isCloning=!0,e.asset._doInstantiate(t),A.game._isCloning=!1,t._objFlags=i,t.modifyParent(n),t.id=r,t.prefab&&(t.prefab.instance=e.instance)}}function yI(t,e,i){var n;if(e&&t){var r=e,s=null==(n=t.prefab)?void 0:n.instance;!i&&s&&(e[s.fileId]={},r=e[s.fileId]);var a=t.prefab;a&&(r[a.fileId]=t),t.components.forEach((function(t){t.__prefab&&(r[t.__prefab.fileId]=t)})),t.children.forEach((function(t){yI(t,r,!1)}))}}function vI(t,e){if(!t)return null;for(var i=e,n=0;n<t.length;n++){if(!i)return null;i=i[t[n]]}return i}function bI(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r&&r.targetInfo){var s=vI(r.targetInfo.localID,i);if(!s)continue;var a=i,o=r.targetInfo.localID;if(o.length>0)for(var h=0;h<o.length-1;h++)a=a[o[h]];if(r.nodes)for(var u=0;u<r.nodes.length;u++){var l=r.nodes[u];l&&!s.children.includes(l)&&(s.children.push(l),l.modifyParent(s),yI(l,a,!1),l.siblingIndex=s.children.length-1,AI(l,!0))}}}}function SI(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r&&r.targetInfo){var s=vI(r.targetInfo.localID,i);if(!s)continue;if(r.components)for(var a=0;a<r.components.length;a++){var o=r.components[a];o&&(o.node=s,s.getWritableComponents().push(o))}}}}function wI(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r){var s=vI(r.localID,i);if(!s||!s.node)continue;var a=s.node.components.indexOf(s);a>=0&&s.node.getWritableComponents().splice(a,1)}}}function xI(t,e,i){if(!(e.length<=0))for(var n=null,r=0;r<e.length;r++){var s=e[r];if(s&&s.targetInfo){if(!(n=vI(s.targetInfo.localID,i)))continue;var a=n,o=s.propertyPath.slice();if(o.length>0){var h=o.pop();if(!h)continue;for(var u=0;u<o.length&&(a=a[o[u]]);u++);if(!a)continue;if(Array.isArray(a))if("length"===h)a[h]=s.value;else{var l=Number.parseInt(h);Number.isInteger(l)&&l<a.length&&(a[h]=s.value)}else a[h]instanceof Fe?a[h].set(s.value):a[h]=s.value}}}}function TI(t){var e,i=null==(e=t.prefab)?void 0:e.targetOverrides;if(i)for(var n=0;n<i.length;n++){var r,s=i[n],a=s.source,o=s.sourceInfo;if(o){var h,u=s.source,l=null==u||null==(h=u.prefab)?void 0:h.instance;l&&l.targetMap&&(a=vI(o.localID,l.targetMap))}if(a){var c,f=s.targetInfo;if(f){var _=s.target,d=null==_||null==(r=_.prefab)?void 0:r.instance;if(d&&d.targetMap&&(c=vI(f.localID,d.targetMap))){var p=s.propertyPath.slice(),m=a;if(p.length>0){var g=p.pop();if(!g)return;for(var y=0;y<p.length&&(m=m[p[y]]);y++);if(!m)continue;m[g]=c}}}}}}function AI(t,e){var i;void 0===e&&(e=!1);var n=null==t||null==(i=t.prefab)?void 0:i.instance;if(n&&!n.expanded){gI(t),e&&t&&t.children&&t.children.forEach((function(t){AI(t,!0)}));var r={};n.targetMap=r,yI(t,r,!0),bI(0,n.mountedChildren,r),wI(0,n.removedComponents,r),SI(0,n.mountedComponents,r),xI(0,n.propertyOverrides,r),n.expanded=!0}else e&&t&&t.children&&t.children.forEach((function(t){AI(t,!0)}))}function CI(t){var e=t.prefab;e&&e.nestedPrefabInstanceRoots&&e.nestedPrefabInstanceRoots.forEach((function(t){AI(t)}))}A._PrefabInfo=mI;var DI,BI,II,MI,PI,EI,OI,kI=Object.freeze({__proto__:null,CompPrefabInfo:cI,MountedChildrenInfo:_I,MountedComponentsInfo:dI,PrefabInfo:mI,PrefabInstance:pI,PropertyOverrideInfo:fI,TargetInfo:uI,TargetOverrideInfo:lI,applyMountedChildren:bI,applyMountedComponents:SI,applyNodeAndComponentId:function t(e,i){for(var n=e.components,r=e.children,s=0;s<n.length;s++){var a,o,h=n[s],u=null!==(a=null==(o=h.__prefab)?void 0:o.fileId)&&void 0!==a?a:"";h._id=""+i+u}for(var l=0;l<r.length;l++){var c=r[l],f=c.prefab,_=null!=f&&f.instance?f.instance.fileId:null==f?void 0:f.fileId;_&&(c.id=""+i+_,null!=f&&f.instance||t(c,i))}},applyPropertyOverrides:xI,applyRemovedComponents:wI,applyTargetOverrides:TI,createNodeWithPrefab:gI,expandNestedPrefabInstanceNode:CI,expandPrefabInstanceNode:AI,generateTargetMap:yI,getTarget:vI}),RI=t("dp",Kh("cc.Scene")((BI=function(t){s(i,t);var e=i.prototype;function i(e){var i;return(i=t.call(this,e)||this).autoReleaseAssets=II&&II(),i._globals=MI&&MI(),i.dependAssets=null,i._renderScene=null,i._prefabSyncedInLiveReload=!1,i._activeInHierarchy=!1,C.director&&C.director.root&&(i._renderScene=C.director.root.createScene({})),i._inited=!C.game||!C.game._isCloning,i}return e._updateScene=function(){this._scene=this},e.destroy=function(){var t=mo.prototype.destroy.call(this);if(t)for(var e=this._children,i=0;i<e.length;++i)e[i].active=!1;return this._renderScene&&C.director.root.destroyScene(this._renderScene),this._active=!1,this._activeInHierarchy=!1,t},e.addComponent=function(){throw new Error(ft(3822))},e._onHierarchyChanged=function(){},e._onPostActivated=function(){},e._onBatchCreated=function(t){for(var e=this._children.length,i=0;i<e;++i)this._children[i]._siblingIndex=i,this._children[i]._onBatchCreated(t)},e.updateWorldTransform=function(){},e._instantiate=function(){return null},e._load=function(){this._inited||(CI(this),TI(this),this._onBatchCreated(S),this._inited=!0),this.walk(eb._setScene)},e._activate=function(t){void 0===t&&(t=!0),C.director._nodeActivator.activateNode(this,t),this._globals.activate(this)},n(i,[{key:"renderScene",get:function(){return this._renderScene}},{key:"globals",get:function(){return this._globals}}]),i}(eb),II=zh(BI.prototype,"autoReleaseAssets",[uu],(function(){return!1})),MI=zh(BI.prototype,"_globals",[uu],(function(){return new hI})),DI=BI))||DI);C.Scene=RI;var FI=t("e1",Kh("cc.SceneAsset")((EI=function(t){function e(e){var i;return(i=t.call(this,e)||this).scene=OI&&OI(),i}s(e,t);var i=e.prototype;return i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.scene=new RI("New Scene")},i.validate=function(){return!!this.scene},e}(Cm),OI=zh(EI.prototype,"scene",[uu],(function(){return null})),PI=EI))||PI);A.SceneAsset=FI,Dt({SystemEventType:{newName:"Input.EventType",since:"3.3.0",removed:!1}}),Dt({SystemEvent:{newName:"Input",since:"3.4.0",removed:!1},systemEvent:{newName:"input",since:"3.4.0",removed:!1}});var LI=function(){function t(){this._intervalInMileSeconds=200,this._accelTimer=0,this._eventTarget=new Io,this._globalEventClass=window.DeviceMotionEvent||window.DeviceOrientationEvent,Vo.browserType===Mo.MOBILE_QQ&&(this._globalEventClass=window.DeviceOrientationEvent),this._deviceEventName=this._globalEventClass===window.DeviceMotionEvent?"devicemotion":"deviceorientation",this._didAccelerateFunc=this._didAccelerate.bind(this)}var e=t.prototype;return e._registerEvent=function(){this._accelTimer=performance.now(),window.addEventListener(this._deviceEventName,this._didAccelerateFunc,!1)},e._unregisterEvent=function(){this._accelTimer=0,window.removeEventListener(this._deviceEventName,this._didAccelerateFunc,!1)},e._didAccelerate=function(t){var e=performance.now();if(!(e-this._accelTimer<this._intervalInMileSeconds)){this._accelTimer=e;var i=0,n=0,r=0;if(this._globalEventClass===window.DeviceMotionEvent){var s=t.accelerationIncludingGravity;i=.1*((null==s?void 0:s.x)||0),n=.1*((null==s?void 0:s.y)||0),r=.1*((null==s?void 0:s.z)||0)}else{var a=t;i=(a.gamma||0)/90*.981,n=-(a.beta||0)/90*.981,r=(a.alpha||0)/90*.981}if(sh.isFrameRotated){var o=i;i=-n,n=o}var h=i;90===window.orientation?(i=-n,n=h):-90===window.orientation?(i=n,n=-h):180===window.orientation&&(i=-i,n=-n),Vo.os===Oo.ANDROID&&Vo.browserType!==Mo.MOBILE_QQ&&(i=-i,n=-n);var u=performance.now(),l=new Zy(i,n,r,u),c=new Wy(l);this._eventTarget.emit("devicemotion",c)}},e.start=function(){var t=this;window.DeviceMotionEvent&&"function"==typeof DeviceMotionEvent.requestPermission?DeviceMotionEvent.requestPermission().then((function(e){"granted"===e&&t._registerEvent()})).catch((function(t){Y(t)})):this._registerEvent()},e.stop=function(){this._unregisterEvent()},e.setInterval=function(t){this._intervalInMileSeconds=t},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}(),VI=function(){},NI=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){throw new Error("Method not implemented.")},e}(VI),zI=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){throw new Error("Method not implemented.")},e}(VI),UI=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){throw new Error("Method not implemented.")},e}(VI),GI=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){throw new Error("Method not implemented.")},e}(VI),HI=function(t){function e(e){var i;return(i=t.call(this)||this).positive=e.positive,i.negative=e.negative,i}return s(e,t),e.prototype.getValue=function(){var t=this.positive.getValue(),e=this.negative.getValue();return Math.abs(t)>Math.abs(e)?t:-e},e}(NI),WI=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 HI({positive:i.right,negative:i.left}),i.yAxis=new HI({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}(zI);!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 HI({positive:i.right,negative:i.left}),i.yAxis=new HI({positive:i.up,negative:i.down}),i.zAxis=new HI({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())}}(UI);var jI,qI=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}(NI),XI=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(WI),YI=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(WI),JI=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}(GI),KI=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}(UI),QI=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}(NI),ZI="left",$I="right",tM=[];!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"}(jI||(jI={}));var eM,iM,nM,rM,sM,aM=function(){function t(t){var e;this._deviceId=-1,this._connected=!1,this._webPoseState=((e={})[jI.HAND_LEFT]={position:ir.ZERO,orientation:kr.IDENTITY},e[jI.HAND_RIGHT]={position:ir.ZERO,orientation:kr.IDENTITY},e[jI.AIM_LEFT]={position:ir.ZERO,orientation:kr.IDENTITY},e[jI.AIM_RIGHT]={position:ir.ZERO,orientation:kr.IDENTITY},e),this._deviceId=t,this._initInputSource()}t._init=function(){Vo.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(){C.director&&C.Director&&(clearInterval(t._intervalId),t._intervalId=-1,e())}),50)},t._updateGamepadCnt=function(){for(var e=0,i=0,n=t._cachedWebGamepads.length;i<n;i++)t._cachedWebGamepads[i]&&e++;t._totalGamepadCnt=e},t._registerEvent=function(){t._ensureDirectorDefined((function(){t._cachedWebGamepads=t._getWebGamePads(),t._updateGamepadCnt(),C.director.on(C.Director.EVENT_BEGIN_FRAME,t._scanGamepads)})),window.addEventListener("gamepadconnected",(function(e){t._cachedWebGamepads[e.gamepad.index]=e.gamepad,t._updateGamepadCnt();var i=t._getOrCreateInputDevice(e.gamepad.index,!0);t._eventTarget.emit("gamepad-change",new Jy("gamepad-change",i))})),window.addEventListener("gamepaddisconnected",(function(e){t._cachedWebGamepads[e.gamepad.index]=null,t._updateGamepadCnt();var i=t._getOrCreateInputDevice(e.gamepad.index,!1);t._removeInputDevice(e.gamepad.index),t._eventTarget.emit("gamepad-change",new Jy("gamepad-change",i))}))},t._scanWebGamepads=function(e){if(0!==t._totalGamepadCnt){var i=t._getWebGamePads();if(i){for(var n=0;n<i.length;++n){var r=i[n];if(r){var s=t._cachedWebGamepads[r.index];if(s){for(var a=void 0,o=s.buttons,h=0;h<o.length;++h){var u=o[h],l=r.buttons[h];if(Math.abs(u.value-l.value)>.01){a=t._getOrCreateInputDevice(r.index,!0);break}}if(a){e.push(a);continue}for(var c=s.axes,f=0;f<c.length;++f){var _=c[f],d=r.axes[f];if(Math.abs(_-d)>.01){a=t._getOrCreateInputDevice(r.index,!0);break}}if(a){e.push(a);continue}}}}t._cachedWebGamepads=i}}},t._scanGamepads=function(){tM.length=0,t._scanWebGamepads(tM),t._scanWebXRGamepads(tM);for(var e=0;e<tM.length;++e){var i=tM[e];t._eventTarget.emit("gamepad-input",new Jy("gamepad-input",i))}t._scanWebXRGamepadsPose()},t._scanWebXRGamepads=function(){},t.checkGamepadChanged=function(t,e){if(!t&&!e)return!1;if(!t||!e)return!0;for(var i=e.buttons,n=0;n<i.length;++n){var r=i[n];if(0!==t.buttons[n].value||0!==r)return!0}for(var s=e.axes,a=0;a<s.length;++a){var o=s[a];if(0!==t.axes[a]||0!==o)return!0}return!1},t._copyCacheGamepadValue=function(t){if(t){for(var e={buttons:new Array(t.buttons.length),axes:new Array(t.axes.length)},i=0;i<t.buttons.length;++i)e.buttons[i]=t.buttons[i].value;for(var n=0;n<t.axes.length;++n)e.axes[n]=t.axes[n];return e}},t._scanWebXRGamepadsPose=function(){},t._getWebXRGamepadMap=function(){var t;return null==(t=globalThis.__globalXR)?void 0:t.webxrGamepadMap},t._getWebGamePads=function(){return"function"==typeof navigator.getGamepads?navigator.getGamepads():"function"==typeof navigator.webkitGetGamepads?navigator.webkitGetGamepads():[]},t._getWebGamepad=function(e){for(var i=t._getWebGamePads(),n=0;n<i.length;++n){var r=i[n];if(r&&r.index===e)return r}};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._updateWebPoseState=function(t){t.code!==jI.HAND_LEFT&&t.code!==jI.AIM_LEFT&&t.code!==jI.HAND_RIGHT&&t.code!==jI.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 qI,this._buttonNorth.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get(ZI);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 qI,this._buttonEast.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get($I);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 qI,this._buttonWest.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get(ZI);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 qI,this._buttonSouth.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get($I);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 qI,this._buttonL1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[4].value:0},this._buttonL2=new qI,this._buttonL2.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get(ZI);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 qI,this._buttonL3.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get(ZI);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 qI,this._buttonR1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[5].value:0},this._buttonR2=new qI,this._buttonR2.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get($I);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 qI,this._buttonR3.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get($I);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 qI,this._buttonShare.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[8].value:0},this._buttonOptions=new qI,this._buttonOptions.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[9].value:0};var i=new qI;i.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[12].value:0};var n=new qI;n.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[13].value:0};var r=new qI;r.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[14].value:0};var s=new qI;s.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[15].value:0},this._dpad=new XI({up:i,down:n,left:r,right:s});var a=new qI;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 qI;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 qI;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 qI;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 YI({up:a,down:o,left:h,right:u});var l=new qI;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 qI;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 qI;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 _=new qI;_.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 YI({up:l,down:c,left:f,right:_}),this._buttonStart=new qI,this._buttonStart.getValue=function(){return 0},this._gripLeft=new qI,this._gripLeft.getValue=function(){return e.deviceId,0},this._gripRight=new qI,this._gripRight.getValue=function(){if(-1===e.deviceId){var i,n=null==(i=t._getWebXRGamepadMap())?void 0:i.get($I);if(n&&n.buttons.length>1)return n.buttons[1].value}return 0},this._handLeftPosition=new KI,this._handLeftPosition.getValue=function(){return e._webPoseState[jI.HAND_LEFT].position},this._handLeftOrientation=new JI,this._handLeftOrientation.getValue=function(){return e._webPoseState[jI.HAND_LEFT].orientation},this._handRightPosition=new KI,this._handRightPosition.getValue=function(){return e._webPoseState[jI.HAND_RIGHT].position},this._handRightOrientation=new JI,this._handRightOrientation.getValue=function(){return e._webPoseState[jI.HAND_RIGHT].orientation},this._aimLeftPosition=new KI,this._aimLeftPosition.getValue=function(){return e._webPoseState[jI.AIM_LEFT].position},this._aimLeftOrientation=new JI,this._aimLeftOrientation.getValue=function(){return e._webPoseState[jI.AIM_LEFT].orientation},this._aimRightPosition=new KI,this._aimRightPosition.getValue=function(){return e._webPoseState[jI.AIM_RIGHT].position},this._aimRightOrientation=new JI,this._aimRightOrientation.getValue=function(){return e._webPoseState[jI.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}();aM.all=[],aM.xr=null,aM._eventTarget=new Io,aM._cachedWebGamepads=[],aM._cachedWebXRGamepadMap=null,aM._intervalId=-1,aM._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"}(eM||(eM={})),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"}(iM||(iM={})),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"}(nM||(nM={})),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"}(rM||(rM={})),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"}(sM||(sM={}));var oM,hM={1:eM.BUTTON_EAST,2:eM.BUTTON_SOUTH,3:eM.BUTTON_NORTH,4:eM.BUTTON_WEST,9:eM.BUTTON_LEFT_STICK,10:eM.BUTTON_RIGHT_STICK,11:eM.ROKID_MENU,12:eM.ROKID_START,13:eM.BUTTON_TRIGGER_LEFT,14:eM.BUTTON_TRIGGER_RIGHT},uM=function(){function t(){var t,e,i=this;this._eventTarget=new Io,this._nativeButtonState=((t={})[eM.BUTTON_SOUTH]=0,t[eM.BUTTON_EAST]=0,t[eM.BUTTON_WEST]=0,t[eM.BUTTON_NORTH]=0,t[eM.BUTTON_TRIGGER_LEFT]=0,t[eM.BUTTON_TRIGGER_RIGHT]=0,t[eM.TRIGGER_LEFT]=0,t[eM.TRIGGER_RIGHT]=0,t[eM.GRIP_LEFT]=0,t[eM.GRIP_RIGHT]=0,t[eM.LEFT_STICK_UP]=0,t[eM.LEFT_STICK_DOWN]=0,t[eM.LEFT_STICK_LEFT]=0,t[eM.LEFT_STICK_RIGHT]=0,t[eM.RIGHT_STICK_UP]=0,t[eM.RIGHT_STICK_DOWN]=0,t[eM.RIGHT_STICK_LEFT]=0,t[eM.RIGHT_STICK_RIGHT]=0,t[eM.BUTTON_LEFT_STICK]=0,t[eM.BUTTON_RIGHT_STICK]=0,t[eM.ROKID_MENU]=0,t[eM.ROKID_START]=0,t),this._nativeTouchState=((e={})[sM.UNDEFINE]=0,e[sM.A]=0,e[sM.B]=0,e[sM.X]=0,e[sM.Y]=0,e[sM.LEFT_TRIGGER]=0,e[sM.RIGHT_TRIGGER]=0,e[sM.LEFT_THUMBSTICK]=0,e[sM.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===iM.KET_CLICK){var l=hM[a];i._nativeButtonState[l]=o?1:0}else if(n===iM.KET_STICK||n===iM.KET_GRAB){var c,f,_;switch(r){case rM.LEFT_STICK_X:c=eM.LEFT_STICK_LEFT,f=eM.LEFT_STICK_RIGHT,_=i._axisToButtons(s);break;case rM.LEFT_STICK_Y:c=eM.LEFT_STICK_DOWN,f=eM.LEFT_STICK_UP,_=i._axisToButtons(s);break;case rM.RIGHT_STICK_X:c=eM.RIGHT_STICK_LEFT,f=eM.RIGHT_STICK_RIGHT,_=i._axisToButtons(s);break;case rM.RIGHT_STICK_Y:c=eM.RIGHT_STICK_DOWN,f=eM.RIGHT_STICK_UP,_=i._axisToButtons(s);break;case rM.L2:i._nativeButtonState[eM.TRIGGER_LEFT]=s;break;case rM.R2:i._nativeButtonState[eM.TRIGGER_RIGHT]=s;break;case rM.LEFT_GRIP:i._nativeButtonState[eM.GRIP_LEFT]=s;break;case rM.RIGHT_GRIP:i._nativeButtonState[eM.GRIP_RIGHT]=s}c&&f&&_&&(i._nativeButtonState[c]=_.negative,i._nativeButtonState[f]=_.positive)}else if(n===iM.KET_TOUCH)switch(h){case sM.A:case sM.B:case sM.X:case sM.Y:case sM.LEFT_TRIGGER:case sM.RIGHT_TRIGGER:case sM.LEFT_THUMBSTICK:case sM.RIGHT_THUMBSTICK:i._nativeTouchState[h]=u}i._eventTarget.emit("handle-input",new Ky("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 qI,this._buttonNorth.getValue=function(){return t._nativeButtonState[eM.BUTTON_NORTH]},this._buttonEast=new qI,this._buttonEast.getValue=function(){return t._nativeButtonState[eM.BUTTON_EAST]},this._buttonWest=new qI,this._buttonWest.getValue=function(){return t._nativeButtonState[eM.BUTTON_WEST]},this._buttonSouth=new qI,this._buttonSouth.getValue=function(){return t._nativeButtonState[eM.BUTTON_SOUTH]},this._buttonTriggerLeft=new qI,this._buttonTriggerLeft.getValue=function(){return t._nativeButtonState[eM.BUTTON_TRIGGER_LEFT]},this._buttonTriggerRight=new qI,this._buttonTriggerRight.getValue=function(){return t._nativeButtonState[eM.BUTTON_TRIGGER_RIGHT]},this._triggerLeft=new qI,this._triggerLeft.getValue=function(){return t._nativeButtonState[eM.TRIGGER_LEFT]},this._triggerRight=new qI,this._triggerRight.getValue=function(){return t._nativeButtonState[eM.TRIGGER_RIGHT]},this._gripLeft=new qI,this._gripLeft.getValue=function(){return t._nativeButtonState[eM.GRIP_LEFT]},this._gripRight=new qI,this._gripRight.getValue=function(){return t._nativeButtonState[eM.GRIP_RIGHT]},this._buttonLeftStick=new qI,this._buttonLeftStick.getValue=function(){return t._nativeButtonState[eM.BUTTON_LEFT_STICK]};var e=new qI;e.getValue=function(){return t._nativeButtonState[eM.LEFT_STICK_UP]};var i=new qI;i.getValue=function(){return t._nativeButtonState[eM.LEFT_STICK_DOWN]};var n=new qI;n.getValue=function(){return t._nativeButtonState[eM.LEFT_STICK_LEFT]};var r=new qI;r.getValue=function(){return t._nativeButtonState[eM.LEFT_STICK_RIGHT]},this._leftStick=new YI({up:e,down:i,left:n,right:r}),this._buttonRightStick=new qI,this._buttonRightStick.getValue=function(){return t._nativeButtonState[eM.BUTTON_RIGHT_STICK]};var s=new qI;s.getValue=function(){return t._nativeButtonState[eM.RIGHT_STICK_UP]};var a=new qI;a.getValue=function(){return t._nativeButtonState[eM.RIGHT_STICK_DOWN]};var o=new qI;o.getValue=function(){return t._nativeButtonState[eM.RIGHT_STICK_LEFT]};var h=new qI;h.getValue=function(){return t._nativeButtonState[eM.RIGHT_STICK_RIGHT]},this._rightStick=new YI({up:s,down:a,left:o,right:h}),this._buttonOptions=new qI,this._buttonOptions.getValue=function(){return t._nativeButtonState[eM.ROKID_MENU]},this._buttonStart=new qI,this._buttonStart.getValue=function(){return t._nativeButtonState[eM.ROKID_START]},this._handLeftPosition=new KI,this._handLeftPosition.getValue=function(){return ir.ZERO},this._handLeftOrientation=new JI,this._handLeftOrientation.getValue=function(){return kr.IDENTITY},this._handRightPosition=new KI,this._handRightPosition.getValue=function(){return ir.ZERO},this._handRightOrientation=new JI,this._handRightOrientation.getValue=function(){return kr.IDENTITY},this._aimLeftPosition=new KI,this._aimLeftPosition.getValue=function(){return ir.ZERO},this._aimLeftOrientation=new JI,this._aimLeftOrientation.getValue=function(){return kr.IDENTITY},this._aimRightPosition=new KI,this._aimRightPosition.getValue=function(){return ir.ZERO},this._aimRightOrientation=new JI,this._aimRightOrientation.getValue=function(){return kr.IDENTITY},this._touchButtonA=new QI,this._touchButtonA.getValue=function(){return t._nativeTouchState[sM.A]},this._touchButtonB=new QI,this._touchButtonB.getValue=function(){return t._nativeTouchState[sM.B]},this._touchButtonX=new QI,this._touchButtonX.getValue=function(){return t._nativeTouchState[sM.X]},this._touchButtonY=new QI,this._touchButtonY.getValue=function(){return t._nativeTouchState[sM.Y]},this._touchButtonTriggerLeft=new QI,this._touchButtonTriggerLeft.getValue=function(){return t._nativeTouchState[sM.LEFT_TRIGGER]},this._touchButtonTriggerRight=new QI,this._touchButtonTriggerRight.getValue=function(){return t._nativeTouchState[sM.RIGHT_TRIGGER]},this._touchButtonThumbStickLeft=new QI,this._touchButtonThumbStickLeft.getValue=function(){return t._nativeTouchState[sM.LEFT_THUMBSTICK]},this._touchButtonThumbStickRight=new QI,this._touchButtonThumbStickRight.getValue=function(){return t._nativeTouchState[sM.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"}(oM||(oM={}));var lM,cM=function(){function t(){var t;this._eventTarget=new Io,this._intervalId=-1,this._webPoseState=((t={})[oM.VIEW_LEFT]={position:ir.ZERO,orientation:kr.IDENTITY},t[oM.VIEW_RIGHT]={position:ir.ZERO,orientation:kr.IDENTITY},t[oM.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(){C.director&&C.Director&&(clearInterval(t._intervalId),t._intervalId=-1,e())}),50)}))},e._registerEvent=function(){var t=this;this._ensureDirectorDefined().then((function(){C.director.on(C.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;i<e.length;++i){var n=e[i];this._updateWebPoseState(n)}this._eventTarget.emit("hmd-pose-input",new Qy("hmd-pose-input",this))}},e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._updateWebPoseState=function(t){t.code!==oM.VIEW_LEFT&&t.code!==oM.VIEW_RIGHT&&t.code!==oM.HEAD_MIDDLE||(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 t=this;this._viewLeftPosition=new KI,this._viewLeftPosition.getValue=function(){return t._webPoseState[oM.VIEW_LEFT].position},this._viewLeftOrientation=new JI,this._viewLeftOrientation.getValue=function(){return t._webPoseState[oM.VIEW_LEFT].orientation},this._viewRightPosition=new KI,this._viewRightPosition.getValue=function(){return t._webPoseState[oM.VIEW_RIGHT].position},this._viewRightOrientation=new JI,this._viewRightOrientation.getValue=function(){return t._webPoseState[oM.VIEW_RIGHT].orientation},this._headMiddlePosition=new KI,this._headMiddlePosition.getValue=function(){return t._webPoseState[oM.HEAD_MIDDLE].position},this._headMiddleOrientation=new JI,this._headMiddleOrientation.getValue=function(){return t._webPoseState[oM.HEAD_MIDDLE].orientation}},n(t,[{key:"viewLeftPosition",get:function(){return this._viewLeftPosition}},{key:"viewLeftOrientation",get:function(){return this._viewLeftOrientation}},{key:"viewRightPosition",get:function(){return this._viewRightPosition}},{key:"viewRightOrientation",get:function(){return this._viewRightOrientation}},{key:"headMiddlePosition",get:function(){return this._headMiddlePosition}},{key:"headMiddleOrientation",get:function(){return this._headMiddleOrientation}}]),t}(),fM=function(){function t(){this._eventTarget=new Io,this._initInputSource()}var e=t.prototype;return e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._initInputSource=function(){this._handheldPosition=new KI,this._handheldPosition.getValue=function(){return ir.ZERO},this._handheldOrientation=new JI,this._handheldOrientation.getValue=function(){return kr.IDENTITY}},n(t,[{key:"handheldPosition",get:function(){return this._handheldPosition}},{key:"handheldOrientation",get:function(){return this._handheldOrientation}}]),t}(),_M={Backspace:8,Tab:9,Enter:13,ShiftLeft:16,ControlLeft:17,AltLeft:18,ShiftRight:2e3,ControlRight:2001,AltRight:2002,Pause:19,CapsLock:20,Escape:27,Space:32,PageUp:33,PageDown:34,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Insert:45,Delete:46,Digit0:48,Digit1:49,Digit2:50,Digit3:51,Digit4:52,Digit5:53,Digit6:54,Digit7:55,Digit8:56,Digit9:57,KeyA:65,KeyB:66,KeyC:67,KeyD:68,KeyE:69,KeyF:70,KeyG:71,KeyH:72,KeyI:73,KeyJ:74,KeyK:75,KeyL:76,KeyM:77,KeyN:78,KeyO:79,KeyP:80,KeyQ:81,KeyR:82,KeyS:83,KeyT:84,KeyU:85,KeyV:86,KeyW:87,KeyX:88,KeyY:89,KeyZ:90,Numpad0:96,Numpad1:97,Numpad2:98,Numpad3:99,Numpad4:100,Numpad5:101,Numpad6:102,Numpad7:103,Numpad8:104,Numpad9:105,NumpadMultiply:106,NumpadAdd:107,NumpadSubtract:109,NumpadDecimal:110,NumpadDivide:111,NumpadEnter:2003,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NumLock:144,ScrollLock:145,Semicolon:186,Equal:187,Comma:188,Minus:189,Period:190,Slash:191,Backquote:192,BracketLeft:219,Backslash:220,BracketRight:221,Quote:222},dM=function(){function t(){this._eventTarget=new Io,this._registerEvent()}var e=t.prototype;return e.dispatchKeyboardDownEvent=function(t){this._handleKeyboardDown(t)},e.dispatchKeyboardUpEvent=function(t){this._handleKeyboardUp(t)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},e._registerEvent=function(){var t=document.getElementById("GameCanvas");null==t||t.addEventListener("keydown",this._handleKeyboardDown.bind(this)),null==t||t.addEventListener("keyup",this._handleKeyboardUp.bind(this))},e._getInputEvent=function(t,e){var i,n=(i=t.code,_M[i]||0);return new jy(n,e)},e._handleKeyboardDown=function(t){if(t.stopPropagation(),t.preventDefault(),t.repeat){var e=this._getInputEvent(t,"key-pressing");this._eventTarget.emit("key-pressing",e)}else{var i=this._getInputEvent(t,"keydown");this._eventTarget.emit("keydown",i)}},e._handleKeyboardUp=function(t){var e=this._getInputEvent(t,"keyup");t.stopPropagation(),t.preventDefault(),this._eventTarget.emit("keyup",e)},t}(),pM=function(){function t(){this._canvas=void 0,this._eventTarget=new Io,this._pointLocked=!1,this._isPressed=!1,this._preMousePos=new ds,this._handleMouseDown=void 0,this._handleMouseMove=void 0,this._handleMouseUp=void 0,Vo.hasFeature(Ro.EVENT_MOUSE)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||Y("failed to access canvas"),this._handleMouseDown=this._createCallback("mouse-down"),this._handleMouseMove=this._createCallback("mouse-move"),this._handleMouseUp=this._createCallback("mouse-up"),this._registerEvent())}var e=t.prototype;return e.dispatchMouseDownEvent=function(t){this._handleMouseDown(t)},e.dispatchMouseMoveEvent=function(t){this._handleMouseMove(t)},e.dispatchMouseUpEvent=function(t){this._handleMouseUp(t)},e.dispatchScrollEvent=function(t){this._handleMouseWheel(t)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},e._getCanvasRect=function(){var t=this._canvas,e=null==t?void 0:t.getBoundingClientRect();return e?new bs(e.x,e.y,e.width,e.height):new bs(0,0,0,0)},e._getLocation=function(t){var e=this._getCanvasRect(),i=sh.devicePixelRatio,n=this._pointLocked?this._preMousePos.x/i+t.movementX:t.clientX-e.x,r=this._pointLocked?this._preMousePos.y/i-t.movementY:e.y+e.height-t.clientY;return new ds(n*=i,r*=i)},e._registerEvent=function(){var t,e,i,n,r,s,a=this;window.addEventListener("mousedown",(function(){a._isPressed=!0})),null==(t=this._canvas)||t.addEventListener("mousedown",this._handleMouseDown),null==(e=this._canvas)||e.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp),null==(i=this._canvas)||i.addEventListener("mouseup",this._handleMouseUp),null==(n=this._canvas)||n.addEventListener("wheel",this._handleMouseWheel.bind(this)),this._registerPointerLockEvent(),null==(r=this._canvas)||r.addEventListener("mouseleave",this._handleMouseLeave.bind(this)),null==(s=this._canvas)||s.addEventListener("mouseenter",this._handleMouseEnter.bind(this))},e._registerPointerLockEvent=function(){var t=this,e=function(){var e=t._canvas;document.pointerLockElement===e||document.mozPointerLockElement===e?t._pointLocked=!0:t._pointLocked=!1};"onpointerlockchange"in document?document.addEventListener("pointerlockchange",e,!1):"onmozpointerlockchange"in document&&document.addEventListener("mozpointerlockchange",e,!1)},e._createCallback=function(t){var e=this;return function(i){var n,r=e._getLocation(i),s=i.button,a=i.buttons,o=s;switch(t){case"mouse-down":null==(n=e._canvas)||n.focus(),e._isPressed=!0;break;case"mouse-up":e._isPressed=!1;break;case"mouse-move":o=1&a?qy.BUTTON_LEFT:2&a?qy.BUTTON_RIGHT:4&a?qy.BUTTON_MIDDLE:qy.BUTTON_MISSING}var h=new qy(t,!1,e._preMousePos);h.setLocation(r.x,r.y),h.setButton(o),h.movementX=i.movementX,h.movementY=i.movementY,e._preMousePos.set(r.x,r.y),i.stopPropagation(),i.target===e._canvas&&i.preventDefault(),e._eventTarget.emit(t,h)}},e._handleMouseWheel=function(t){var e="mouse-wheel",i=this._getLocation(t),n=t.button,r=new qy(e,!1,this._preMousePos);r.setLocation(i.x,i.y),r.setButton(n),r.movementX=t.movementX,r.movementY=t.movementY,r.setScrollData(5*t.deltaX,5*-t.deltaY),this._preMousePos.set(i.x,i.y),t.stopPropagation(),t.target===this._canvas&&t.preventDefault(),this._eventTarget.emit(e,r)},e._handleMouseLeave=function(){var t="mouse-leave-window",e=new qy(t,!1);this._eventTarget.emit(t,e)},e._handleMouseEnter=function(){var t="mouse-enter-window",e=new qy(t,!1);this._eventTarget.emit(t,e)},e.dispatchEventsInCache=function(){},t}(),mM=new ds,gM=new(function(){function t(){this._touchMap=new Map,this._maxTouches=8}var e=t.prototype;return e._createTouch=function(t,e,i){if(this._touchMap.has(t))it(2301);else{if(!this._checkTouchMapSizeMoreThanMax(t)){var n=new ev(e,i,t);return this._touchMap.set(t,n),this._updateTouch(n,e,i),n}it(2300)}},e.releaseTouch=function(t){this._touchMap.has(t)&&this._touchMap.delete(t)},e.getTouch=function(t){return this._touchMap.get(t)},e.getOrCreateTouch=function(t,e,i){var n=this.getTouch(t);return n?this._updateTouch(n,e,i):n=this._createTouch(t,e,i),n},e.getAllTouches=function(){var t=[];return this._touchMap.forEach((function(e){e&&t.push(e)})),t},e.getTouchCount=function(){return this._touchMap.size},e._updateTouch=function(t,e,i){t.getLocation(mM),t.setPrevPoint(mM),t.setPoint(e,i)},e._checkTouchMapSizeMoreThanMax=function(t){var e=this;if(this._touchMap.has(t))return!1;var i=Ue.ENABLE_MULTI_TOUCH?this._maxTouches:1;if(this._touchMap.size<i)return!1;var n=performance.now();return this._touchMap.forEach((function(t){n-t.lastModified>Ue.TOUCH_TIMEOUT&&(it(2302,t.getID()),e.releaseTouch(t.getID()))})),i>=this._touchMap.size},t}()),yM=function(){function t(){this._canvas=void 0,this._eventTarget=new Io,Vo.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;o<a;++o){var h=i.changedTouches[o],u=h.identifier;if(null!==u){var l=e._getLocation(h,r),c=gM.getOrCreateTouch(u,l.x,l.y);c&&("touch-end"!==t&&"touch-cancel"!==t||gM.releaseTouch(u),s.push(c))}}if(i.stopPropagation(),i.target===e._canvas&&i.preventDefault(),"touch-start"===t&&(null==(n=e._canvas)||n.focus()),s.length>0){var f=new Yy(s,!1,t,gM.getAllTouches());e._eventTarget.emit(t,f)}}},e._getCanvasRect=function(){var t=this._canvas,e=null==t?void 0:t.getBoundingClientRect();return e?new bs(e.x,e.y,e.width,e.height):new bs(0,0,0,0)},e._getLocation=function(t,e){var i=t.clientX-e.x,n=e.y+e.height-t.clientY;if(sh.isFrameRotated){var r=i;i=e.height-n,n=r}var s=sh.devicePixelRatio;return new ds(i*=s,n*=s)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},e.dispatchEventsInCache=function(){},t}(),vM=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}(),bM=((lM={})["mouse-down"]="touch-start",lM["mouse-move"]="touch-move",lM["mouse-up"]="touch-end",lM),SM=t("eB",function(){function t(){this._eventTarget=new Io,this._touchInput=new yM,this._mouseInput=new pM,this._keyboardInput=new dM,this._accelerometerInput=new LI,this._eventKeyboardList=[],this._eventAccelerationList=[],this._eventGamepadList=[],this._eventHandleList=[],this._eventHMDList=[],this._eventHandheldList=[],this._needSimulateTouchMoveEvent=!1,this._eventDispatcherList=[],this._handleInput=new uM,this._hmdInput=new cM,this._handheldInput=new fM,this._registerEvent(),this._inputEventDispatcher=new vM(this._eventTarget),this._registerEventDispatcher(this._inputEventDispatcher),aM._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 gM.getTouch(t)},e.getAllTouches=function(){return gM.getAllTouches()},e.getTouchCount=function(){return gM.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=bM[t.type],i=gM.getOrCreateTouch(0,t.getLocationX(),t.getLocationY());if(i){var n=[i],r=new Yy(n,!1,e,"touch-end"===e?[]:n);r.windowId=t.windowId,"touch-end"===e&&gM.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;i<e;++i){var n=this._eventDispatcherList[i];try{if(!n.dispatchEvent(t))break}catch(t){throw this._clearEvents(),n.onThrowException(),t}}},e._registerEvent=function(){var t=this,e=t._touchInput,i=t._mouseInput,n=t._keyboardInput,r=t._handleInput;if(hh.hasFeature(hh.Feature.INPUT_TOUCH)&&(e.on("touch-start",(function(e){t._dispatchEventTouch(e)})),e.on("touch-move",(function(e){t._dispatchEventTouch(e)})),e.on("touch-end",(function(e){t._dispatchEventTouch(e)})),e.on("touch-cancel",(function(e){t._dispatchEventTouch(e)}))),hh.hasFeature(hh.Feature.EVENT_MOUSE)&&(i.on("mouse-down",(function(e){t._needSimulateTouchMoveEvent=!0,t._simulateEventTouch(e),t._dispatchEventMouse(e)})),i.on("mouse-move",(function(e){t._needSimulateTouchMoveEvent&&t._simulateEventTouch(e),t._dispatchEventMouse(e)})),i.on("mouse-up",(function(e){t._needSimulateTouchMoveEvent=!1,t._simulateEventTouch(e),t._dispatchEventMouse(e)})),i.on("mouse-wheel",(function(e){t._dispatchEventMouse(e)})),i.on("mouse-leave-window",(function(e){t._dispatchEventMouse(e)})),i.on("mouse-enter-window",(function(e){t._dispatchEventMouse(e)}))),hh.hasFeature(hh.Feature.EVENT_KEYBOARD)){var s=t._eventKeyboardList;n.on("keydown",(function(e){t._dispatchOrPushEvent(e,s)})),n.on("key-pressing",(function(e){t._dispatchOrPushEvent(e,s)})),n.on("keyup",(function(e){t._dispatchOrPushEvent(e,s)}))}if(hh.hasFeature(hh.Feature.EVENT_ACCELEROMETER)){var a=t._eventAccelerationList;t._accelerometerInput.on("devicemotion",(function(e){t._dispatchOrPushEvent(e,a)}))}if(hh.hasFeature(hh.Feature.EVENT_GAMEPAD)){var o=t._eventGamepadList;aM._on("gamepad-change",(function(e){t._dispatchOrPushEvent(e,o)})),aM._on("gamepad-input",(function(e){t._dispatchOrPushEvent(e,o)})),aM._on("handle-pose-input",(function(e){t._dispatchOrPushEvent(e,o)}))}if(hh.hasFeature(hh.Feature.EVENT_HANDLE)){var h=t._eventHandleList;r._on("handle-input",(function(e){t._dispatchOrPushEvent(e,h)})),r._on("handle-pose-input",(function(e){t._dispatchOrPushEvent(e,h)}))}if(hh.hasFeature(hh.Feature.EVENT_HMD)){var u=t._eventHMDList;t._hmdInput._on("hmd-pose-input",(function(e){t._dispatchOrPushEvent(e,u)}))}if(hh.hasFeature(hh.Feature.EVENT_HANDHELD)){var l=t._eventHandheldList;t._handheldInput._on("handheld-pose-input",(function(e){t._dispatchOrPushEvent(e,l)}))}},e._clearEvents=function(){this._eventKeyboardList.length=0,this._eventAccelerationList.length=0,this._eventGamepadList.length=0,this._eventHandleList.length=0,this._eventHMDList.length=0},e._dispatchOrPushEvent=function(t){this._emitEvent(t)},e._dispatchEventMouse=function(t){this._emitEvent(t)},e._dispatchEventTouch=function(t){for(var e=t.getTouches(),i=e.length,n=0;n<i;++n)t.touch=e[n],t.propagationStopped=t.propagationImmediateStopped=!1,this._emitEvent(t)},e._frameDispatchEvents=function(){},t}());SM.EventType={TOUCH_START:"touch-start",TOUCH_MOVE:"touch-move",TOUCH_END:"touch-end",TOUCH_CANCEL:"touch-cancel",MOUSE_DOWN:"mouse-down",MOUSE_MOVE:"mouse-move",MOUSE_UP:"mouse-up",MOUSE_LEAVE:"mouse-leave-window",MOUSE_ENTER:"mouse-enter-window",MOUSE_WHEEL:"mouse-wheel",KEY_DOWN:"keydown",KEY_PRESSING:"key-pressing",KEY_UP:"keyup",DEVICEMOTION:"devicemotion",GAMEPAD_INPUT:"gamepad-input",GAMEPAD_CHANGE:"gamepad-change",HANDLE_INPUT:"handle-input",HANDLE_POSE_INPUT:"handle-pose-input",HMD_POSE_INPUT:"hmd-pose-input",HANDHELD_POSE_INPUT:"handheld-pose-input"};var wM=t("eA",new SM),xM=t("eD",function(t){function e(){var e;return e=t.call(this)||this,wM.on("mouse-down",(function(t){e.emit("mouse-down",t)})),wM.on("mouse-move",(function(t){e.emit("mouse-move",t)})),wM.on("mouse-up",(function(t){e.emit("mouse-up",t)})),wM.on("mouse-wheel",(function(t){e.emit("mouse-wheel",t)})),wM.on("touch-start",(function(t){e.emit("touch-start",t.touch,t)})),wM.on("touch-move",(function(t){e.emit("touch-move",t.touch,t)})),wM.on("touch-end",(function(t){e.emit("touch-end",t.touch,t)})),wM.on("touch-cancel",(function(t){e.emit("touch-cancel",t.touch,t)})),wM.on("keydown",(function(t){e.emit("keydown",t)})),wM.on("key-pressing",(function(t){e.emit("keydown",t)})),wM.on("keyup",(function(t){e.emit("keyup",t)})),wM.on("devicemotion",(function(t){e.emit("devicemotion",t)})),e}s(e,t);var i=e.prototype;return i.setAccelerometerEnabled=function(t){wM.setAccelerometerEnabled(t)},i.setAccelerometerInterval=function(t){wM.setAccelerometerInterval(t)},i.on=function(e,i,n,r){return t.prototype.on.call(this,e,i,n,r),i},i.off=function(e,i,n){t.prototype.off.call(this,e,i,n)},e}(Io));xM.EventType=$y,A.SystemEvent=xM;var TM=t("eC",new xM);A.systemEvent=TM,pt($y,"Node.EventType",[{name:"POSITION_PART",newName:"TRANSFORM_CHANGED"},{name:"ROTATION_PART",newName:"TRANSFORM_CHANGED"},{name:"SCALE_PART",newName:"TRANSFORM_CHANGED"}]),pt(Hy,"Event",[{name:"ACCELERATION",newName:"DEVICEMOTION",target:xM.EventType,targetName:"SystemEvent.EventType"}]),gt(Hy,"Event",[{name:"TOUCH",suggest:"please use SystemEvent.EventType.TOUCH_START, SystemEvent.EventType.TOUCH_MOVE, SystemEvent.EventType.TOUCH_END and SystemEvent.EventType.TOUCH_CANCEL instead"},{name:"MOUSE",suggest:"please use SystemEvent.EventType.MOUSE_DOWN, SystemEvent.EventType.MOUSE_MOVE, SystemEvent.EventType.MOUSE_UP, SystemEvent.EventType.MOUSE_WHEEL, Node.EventType.MOUSE_ENTER and Node.EventType.MOUSE_LEAVE instead"},{name:"KEYBOARD",suggest:"please use SystemEvent.EventType.KEY_DOWN and SystemEvent.EventType.KEY_UP instead"}]),pt(qy,"EventMouse",["DOWN","UP","MOVE"].map((function(t){return{name:t,newName:"MOUSE_"+t,target:xM.EventType,targetName:"SystemEvent.EventType"}}))),pt(qy,"EventMouse",[{name:"SCROLL",newName:"MOUSE_WHEEL",target:xM.EventType,targetName:"SystemEvent.EventType"}]),gt(qy.prototype,"EventMouse.prototype",[{name:"eventType",suggest:"please use EventMouse.prototype.type instead"}]),pt(Yy,"EventTouch",[{name:"BEGAN",newName:"TOUCH_START",target:xM.EventType,targetName:"SystemEvent.EventType"}]),pt(Yy,"EventTouch",[{name:"MOVED",newName:"TOUCH_MOVE",target:xM.EventType,targetName:"SystemEvent.EventType"}]),pt(Yy,"EventTouch",[{name:"ENDED",newName:"TOUCH_END",target:xM.EventType,targetName:"SystemEvent.EventType"}]),pt(Yy,"EventTouch",[{name:"CANCELLED",newName:"TOUCH_CANCEL",target:xM.EventType,targetName:"SystemEvent.EventType"}]),gt(Yy.prototype,"EventTouch.prototype",[{name:"getEventCode",suggest:"please use EventTouch.prototype.type instead"}]),pt(Yy.prototype,"EventTouch.prototype",[{name:"getUILocationInView",newName:"getLocationInView",target:Yy,targetName:"EventTouch"}]),gt(Ue.KEY,"macro.KEY",["back","menu","0","1","2","3","4","5","6","7","8","9","0","*","+","-","/",";","=",",",".","[","]","dpadLeft","dpadRight","dpadUp","dpadDown","dpadCenter"].map((function(t){return{name:t}}))),gt(Ue.KEY,"macro.KEY",[{name:"shift",suggest:"please use KeyCode.SHIFT_LEFT instead"}]),gt(Ue.KEY,"macro.KEY",[{name:"ctrl",suggest:"please use KeyCode.CTRL_LEFT instead"}]),gt(Ue.KEY,"macro.KEY",[{name:"alt",suggest:"please use KeyCode.ALT_LEFT instead"}]),gt(Ue,"macro",[{name:"KEY",suggest:"please use KeyCode instead"}]);var AM=t("dk",function(){function t(){this._singleMode=0,this._compositeModeValue=0,this._lightingWithAlbedo=!0,this._csmLayerColoration=!1,this._activate()}var e=t.prototype;return e.isCompositeModeEnabled=function(t){return!!(this._compositeModeValue&1<<t)},e.enableCompositeMode=function(t,e){this._enableCompositeMode(t,e),this._updatePipeline()},e.enableAllCompositeMode=function(t){this._enableAllCompositeMode(t),this._updatePipeline()},e.isEnabled=function(){return 0!==this._getType()},e.reset=function(){this._activate(),this._updatePipeline()},e._activate=function(){this._singleMode=0,this._enableAllCompositeMode(!0),this._lightingWithAlbedo=!0,this._csmLayerColoration=!1},e._updatePipeline=function(){var t=A.director.root,e=t.pipeline,i=this._getType();e.macros.CC_USE_DEBUG_VIEW!==i&&(e.macros.CC_USE_DEBUG_VIEW=i,t.onGlobalPipelineStateChanged())},e._enableCompositeMode=function(t,e){e?this._compositeModeValue|=1<<t:this._compositeModeValue&=~(1<<t)},e._enableAllCompositeMode=function(t){for(var e=0;e<17;e++)t?this._compositeModeValue|=1<<e:this._compositeModeValue&=~(1<<e)},e._getType=function(){if(0!==this._singleMode)return 1;if(!0!==this._lightingWithAlbedo||!1!==this._csmLayerColoration)return 2;for(var t=0;t<17;t++)if(!this.isCompositeModeEnabled(t))return 2;return 0},n(t,[{key:"singleMode",get:function(){return this._singleMode},set:function(t){this._singleMode=t,this._updatePipeline()}},{key:"lightingWithAlbedo",get:function(){return this._lightingWithAlbedo},set:function(t){this._lightingWithAlbedo=t,this._updatePipeline()}},{key:"csmLayerColoration",get:function(){return this._csmLayerColoration},set:function(t){this._csmLayerColoration=t,this._updatePipeline()}},{key:"debugViewType",get:function(){return this._getType()}}]),t}()),CM={VERTICAL:0,HORIZONTAL:1},DM={ORTHO:0,PERSPECTIVE:1},BM={F1_8:0,F2_0:1,F2_2:2,F2_5:3,F2_8:4,F3_2:5,F3_5:6,F4_0:7,F4_5:8,F5_0:9,F5_6:10,F6_3:11,F7_1:12,F8_0:13,F9_0:14,F10_0:15,F11_0:16,F13_0:17,F14_0:18,F16_0:19,F18_0:20,F20_0:21,F22_0:22},IM={ISO100:0,ISO200:1,ISO400:2,ISO800:3},MM={D1:0,D2:1,D4:2,D8:3,D15:4,D30:5,D60:6,D125:7,D250:8,D500:9,D1000:10,D2000:11,D4000:12},PM=[1.8,2,2.2,2.5,2.8,3.2,3.5,4,4.5,5,5.6,6.3,7.1,8,9,10,11,13,14,16,18,20,22],EM=[1,.5,1/4,1/8,1/15,1/30,1/60,.008,.004,.002,.001,5e-4,1/4e3],OM=[100,200,400,800],kM=nr(),RM=nr(),FM=$r(),LM=[],VM=0,NM=function(){function t(t){if(this.isWindowSize=!0,this.screenScale=1,this.postProcess=null,this.usePostProcess=!1,this.pipeline="",this.pipelineSettings=null,this._scene=null,this._node=null,this._name=null,this._enabled=!1,this._proj=-1,this._aspect=1,this._orthoHeight=10,this._fovAxis=0,this._fov=nn(45),this._nearClip=1,this._farClip=1e3,this._clearColor=new rd(.2,.2,.2,1),this._viewport=Ss(0,0,1,1),this._orientedViewport=Ss(0,0,1,1),this._curTransform=0,this._isProjDirty=!0,this._matView=$r(),this._matProj=$r(),this._matProjInv=$r(),this._matViewProj=$r(),this._matViewProjInv=$r(),this._frustum=new Dh,this._forward=nr(),this._position=nr(),this._priority=0,this._aperture=19,this._shutter=7,this._shutterValue=0,this._iso=0,this._isoValue=0,this._window=null,this._width=1,this._height=1,this._clearFlag=0,this._clearDepth=1,this._visibility=US,this._exposure=0,this._clearStencil=0,this._geometryRenderer=null,this._windowId=0,this._cameraType=-1,this._trackingType=0,this._usage=100,this._cameraId=VM++,this._device=t,this._apertureValue=PM[this._aperture],this._shutterValue=EM[this._shutter],this._isoValue=OM[this._iso],this._frustum.accurate=!0,!LM.length){var e=t.capabilities.clipSpaceSignY;LM[0]=new Kr(1,0,0,0,0,e),LM[1]=new Kr(0,1,0,0,-e,0),LM[2]=new Kr(-1,0,0,0,0,-e),LM[3]=new Kr(0,-1,0,0,e,0)}}var e=t.prototype;return e._updateAspect=function(t){if(void 0===t&&(t=!0),this._aspect=this.window.width*this._viewport.width/(this.window.height*this._viewport.height),t){var e=this.window.swapchain;(e&&e.surfaceTransform||0)%2&&(this._aspect=1/this._aspect)}this._isProjDirty=!0},e.initialize=function(t){void 0!==t.usage?this._usage=t.usage:this.setDefaultUsage(),void 0!==t.trackingType&&(this._trackingType=t.trackingType),void 0!==t.cameraType&&(this._cameraType=t.cameraType),this.node=t.node,this._width=1,this._height=1,this.clearFlag=0,this.clearDepth=1,this.visibility=US,this._name=t.name,this._proj=t.projection,this._priority=t.priority||0,this._aspect=this.screenScale=1,this.updateExposure(),this.changeTargetWindow(t.window)},e.destroy=function(){var t;this._node=null,this.detachFromScene(),this._window&&(this._window.detachCamera(this),this.window=null),this._name=null,null==(t=this._geometryRenderer)||t.destroy()},e.attachToScene=function(t){this._enabled=!0,this._scene=t},e.detachFromScene=function(){this._enabled=!1,this._scene=null},e.resize=function(t,e){this._window&&(this._width=t,this._height=e,this._aspect=t*this._viewport.width/(e*this._viewport.height),this._isProjDirty=!0)},e.setFixedSize=function(t,e){this._width=t,this._height=e,this._updateAspect(),this.isWindowSize=!1},e.syncCameraEditor=function(){},e.update=function(t){var e;if(void 0===t&&(t=!1),this._node){var i=!1,n=this._forward,r=this._matView,s=this._matProj;(this._node.hasChangedFlags||t)&&(Kr.invert(r,this._node.worldMatrix),n.x=-r.m02,n.y=-r.m06,n.z=-r.m10,Kr.multiply(r,(new Kr).scale(this._node.worldScale),r),this._node.getWorldPosition(this._position),i=!0);var a=null==(e=this.window)?void 0:e.swapchain,o=a&&a.surfaceTransform||0;if(this._isProjDirty||this._curTransform!==o){this._curTransform=o;var h=this._device.capabilities.clipSpaceSignY;if(1===this._proj)Kr.perspective(s,this._fov,this._aspect,this._nearClip,this._farClip,0===this._fovAxis,this._device.capabilities.clipSpaceMinZ,h,o);else{var u=this._orthoHeight*this._aspect,l=this._orthoHeight;Kr.ortho(s,-u,u,-l,l,this._nearClip,this._farClip,this._device.capabilities.clipSpaceMinZ,h,o)}Kr.invert(this._matProjInv,s),i=!0,this._isProjDirty=!1}i&&(Kr.multiply(this._matViewProj,s,r),Kr.invert(this._matViewProjInv,this._matViewProj),this._frustum.update(this._matViewProj,this._matViewProjInv))}},e.setViewportInOrientedSpace=function(t){var e,i=t.x,n=t.width,r=t.height,s=this._device.capabilities.screenSpaceSignY<0?1-t.y-r:t.y,a=null==(e=this.window)?void 0:e.swapchain;switch(a&&a.surfaceTransform||0){case 1:this._viewport.x=1-s-r,this._viewport.y=i,this._viewport.width=r,this._viewport.height=n;break;case 2:this._viewport.x=1-i-n,this._viewport.y=1-s-r,this._viewport.width=n,this._viewport.height=r;break;case 3:this._viewport.x=s,this._viewport.y=1-i-n,this._viewport.width=r,this._viewport.height=n;break;case 0:this._viewport.x=i,this._viewport.y=s,this._viewport.width=n,this._viewport.height=r}this._orientedViewport.x=i,this._orientedViewport.y=s,this._orientedViewport.width=n,this._orientedViewport.height=r,this.resize(this.width,this.height)},e.initGeometryRenderer=function(){if(!this._geometryRenderer){var t,e=A.internal.GeometryRenderer;this._geometryRenderer=e?new e:null,null==(t=this._geometryRenderer)||t.activate(this._device)}},e.changeTargetWindow=function(t){void 0===t&&(t=null),this._window&&this._window.detachCamera(this);var e=t||A.director.root.mainWindow;if(e){e.attachCamera(this),this.window=e;var i=e.swapchain;(i&&i.surfaceTransform||0)%2?this.resize(e.height,e.width):this.resize(e.width,e.height)}},e.detachCamera=function(){this._window&&this._window.detachCamera(this)},e.screenPointToRay=function(t,e,i){if(!this._node)return null;var n=this.width,r=this.height,s=this._orientedViewport.x*n,a=this._orientedViewport.y*r,o=this._orientedViewport.width*n,h=this._orientedViewport.height*r,u=1===this._proj,l=this._device.capabilities.clipSpaceSignY,c=Hr[this._curTransform];ir.set(kM,(e-s)/o*2-1,(i-a)/h*2-1,u?1:-1);var f=kM.x,_=kM.y;return kM.x=f*c[0]+_*c[2]*l,kM.y=f*c[1]+_*c[3]*l,ir.transformMat4(u?kM:t.o,kM,this._matViewProjInv),u?(this._node.getWorldPosition(RM),Vs.fromPoints(t,RM,kM)):ir.transformQuat(t.d,ir.FORWARD,this._node.worldRotation),t},e.screenToWorld=function(t,e){var i=this.width,n=this.height,r=this._orientedViewport.x*i,s=this._orientedViewport.y*n,a=this._orientedViewport.width*i,o=this._orientedViewport.height*n,h=this._device.capabilities.clipSpaceSignY,u=Hr[this._curTransform];if(1===this._proj){ir.set(t,(e.x-r)/a*2-1,(e.y-s)/o*2-1,1);var l=t.x,c=t.y;t.x=l*u[0]+c*u[2]*h,t.y=l*u[1]+c*u[3]*h,ir.transformMat4(t,t,this._matViewProjInv),this._node&&this._node.getWorldPosition(kM),ir.lerp(t,kM,t,en(this._nearClip/this._farClip,1,e.z))}else{ir.set(t,(e.x-r)/a*2-1,(e.y-s)/o*2-1,2*e.z-1);var f=t.x,_=t.y;t.x=f*u[0]+_*u[2]*h,t.y=f*u[1]+_*u[3]*h,ir.transformMat4(t,t,this._matViewProjInv)}return t},e.worldToScreen=function(t,e){var i=this._device.capabilities.clipSpaceSignY,n=Hr[this._curTransform];ir.transformMat4(t,e,this._matViewProj);var r=t.x,s=t.y;t.x=r*n[0]+s*n[2]*i,t.y=r*n[1]+s*n[3]*i;var a=this.width,o=this.height,h=this._orientedViewport.x*a,u=this._orientedViewport.y*o,l=this._orientedViewport.width*a,c=this._orientedViewport.height*o;return t.x=h+.5*(t.x+1)*l,t.y=u+.5*(t.y+1)*c,t.z=.5*t.z+.5,t},e.worldMatrixToScreen=function(t,e,i,n){Kr.multiply(t,this._matViewProj,e),Kr.multiply(t,LM[this._curTransform],t);var r=i/2,s=n/2;return Kr.identity(FM),Kr.transform(FM,FM,ir.set(kM,r,s,0)),Kr.scale(FM,FM,ir.set(kM,r,s,1)),Kr.multiply(t,FM,t),t},e.calculateObliqueMat=function(t){var e=new Vn(Math.sign(t.x),Math.sign(t.y),1,1).transformMat4(this._matProjInv),i=new Vn(this._matProj.m03,this._matProj.m07,this._matProj.m11,this._matProj.m15),n=2/Vn.dot(t,e),r=t.multiplyScalar(n).subtract(i);this._matProj.m02=r.x,this._matProj.m06=r.y,this._matProj.m10=r.z,this._matProj.m14=r.w},e.getClipSpaceMinz=function(){return this._device.capabilities.clipSpaceMinZ},e.setExposure=function(t){this._exposure=.833333/Math.pow(2,t)},e.updateExposure=function(){var t=Math.log2(this._apertureValue*this._apertureValue/this._shutterValue*100/this._isoValue);this.setExposure(t)},e.setDefaultUsage=function(){this._usage=100},n(t,[{key:"name",get:function(){return this._name}},{key:"scene",get:function(){return this._scene}},{key:"node",get:function(){return this._node},set:function(t){this._node=t}},{key:"systemWindowId",get:function(){return this._windowId}},{key:"window",get:function(){return this._window},set:function(t){this._window=t}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"visibility",get:function(){return this._visibility},set:function(t){this._visibility=t}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"position",get:function(){return this._position},set:function(t){this._position=t}},{key:"forward",get:function(){return this._forward},set:function(t){this._forward=t}},{key:"aperture",get:function(){return this._aperture},set:function(t){this._aperture=t,this._apertureValue=PM[this._aperture],this.updateExposure()}},{key:"apertureValue",get:function(){return this._apertureValue}},{key:"shutter",get:function(){return this._shutter},set:function(t){this._shutter=t,this._shutterValue=EM[this._shutter],this.updateExposure()}},{key:"shutterValue",get:function(){return this._shutterValue}},{key:"iso",get:function(){return this._iso},set:function(t){this._iso=t,this._isoValue=OM[this._iso],this.updateExposure()}},{key:"isoValue",get:function(){return this._isoValue}},{key:"exposure",get:function(){return this._exposure}},{key:"clearFlag",get:function(){return this._clearFlag},set:function(t){this._clearFlag=t}},{key:"clearColor",get:function(){return this._clearColor},set:function(t){this._clearColor.x=t.x,this._clearColor.y=t.y,this._clearColor.z=t.z,this._clearColor.w=t.w}},{key:"clearDepth",get:function(){return this._clearDepth},set:function(t){this._clearDepth=t}},{key:"clearStencil",get:function(){return this._clearStencil},set:function(t){this._clearStencil=t}},{key:"projectionType",get:function(){return this._proj},set:function(t){this._proj=t,this._isProjDirty=!0}},{key:"aspect",get:function(){return this._aspect}},{key:"orthoHeight",get:function(){return this._orthoHeight},set:function(t){this._orthoHeight=t,this._isProjDirty=!0}},{key:"fovAxis",get:function(){return this._fovAxis},set:function(t){this._fovAxis=t,this._isProjDirty=!0}},{key:"fov",get:function(){return this._fov},set:function(t){this._fov=t,this._isProjDirty=!0}},{key:"nearClip",get:function(){return this._nearClip},set:function(t){this._nearClip=t,this._isProjDirty=!0}},{key:"farClip",get:function(){return this._farClip},set:function(t){this._farClip=t,this._isProjDirty=!0}},{key:"viewport",get:function(){return this._viewport},set:function(t){at(8302),this.setViewportInOrientedSpace(t)}},{key:"frustum",get:function(){return this._frustum},set:function(t){this._frustum=t}},{key:"matView",get:function(){return this._matView}},{key:"matProj",get:function(){return this._matProj}},{key:"matProjInv",get:function(){return this._matProjInv}},{key:"matViewProj",get:function(){return this._matViewProj}},{key:"matViewProjInv",get:function(){return this._matViewProjInv}},{key:"cameraId",get:function(){return this._cameraId}},{key:"surfaceTransform",get:function(){return this._curTransform}},{key:"geometryRenderer",get:function(){return this._geometryRenderer}},{key:"cameraType",get:function(){return this._cameraType},set:function(t){this._cameraType=t}},{key:"trackingType",get:function(){return this._trackingType},set:function(t){this._trackingType=t}},{key:"cameraUsage",get:function(){return this._usage},set:function(t){this._usage=t}}],[{key:"standardExposureValue",get:function(){return 1/38400}},{key:"standardLightMeterScale",get:function(){return 1e4}}]),t}(),zM=new Ud(null),UM=function(){function t(){this._device=null,this._passes=null,this._shaders=null,this._subMesh=null,this._patches=null,this._priority=128,this._inputAssembler=null,this._descriptorSet=null,this._worldBoundDescriptorSet=null,this._instancedAttributeBlock={buffer:null,views:[],attributes:[]},this._instancedWorldMatrixIndex=-1,this._instancedSHIndex=-1,this._useReflectionProbeType=0}var e=t.prototype;return e.initialize=function(t,e,i){void 0===i&&(i=null),A.director.root,this._device=Wp.gfxDevice,zM.layout=e[0].localSetLayout,this._inputAssembler=this._device.createInputAssembler(t.iaInfo),this._descriptorSet=this._device.createDescriptorSet(zM);var n=A.director.root.pipeline.pipelineSceneData.getOcclusionQueryPass();if(n){var r=new Ud(null);r.layout=n.localSetLayout,this._worldBoundDescriptorSet=this._device.createDescriptorSet(r)}this._subMesh=t,this._patches=i?i.sort():null,this._passes=e,this._flushPassInfo(),this.priority=128},e.destroy=function(){this._descriptorSet.destroy(),this._descriptorSet=null,this._inputAssembler.destroy(),this._inputAssembler=null,this._worldBoundDescriptorSet&&this._worldBoundDescriptorSet.destroy(),this._worldBoundDescriptorSet=null,this.priority=128,this._patches=null,this._subMesh=null,this._passes=null,this._shaders=null},e.update=function(){for(var t=0;t<this._passes.length;++t)this._passes[t].update();this._descriptorSet.update(),this._worldBoundDescriptorSet&&this._worldBoundDescriptorSet.update()},e._updatePasses=function(){var t=this._passes;t&&(t.forEach((function(t){t.beginChangeStatesSilently(),t.tryCompile(),t.endChangeStatesSilently()})),this._flushPassInfo())},e.onPipelineStateChanged=function(){this._updatePasses()},e.onMacroPatchesStateChanged=function(t){(t||this._patches)&&(t&&(t=t.sort(),this._patches&&t.length===this._patches.length&&JSON.stringify(t)===JSON.stringify(this._patches))||(this._patches=t,this._updatePasses()))},e.onGeometryChanged=function(){if(this._subMesh){var t=this._subMesh.drawInfo;if(this._inputAssembler&&t){var e=this._inputAssembler.drawInfo;Object.keys(t).forEach((function(i){e[i]=t[i]})),this._inputAssembler.drawInfo=e}}},e.getInstancedAttributeIndex=function(t){for(var e=this.instancedAttributeBlock.attributes,i=0;i<e.length;i++)if(e[i].name===t)return i;return-1},e.updateInstancedWorldMatrix=function(t,e){var i=this.instancedAttributeBlock.views,n=i[e],r=i[e+1],s=i[e+2];n[0]=t.m00,n[1]=t.m01,n[2]=t.m02,n[3]=t.m12,r[0]=t.m04,r[1]=t.m05,r[2]=t.m06,r[3]=t.m13,s[0]=t.m08,s[1]=t.m09,s[2]=t.m10,s[3]=t.m14},e.updateInstancedSH=function(t,e){for(var i=this.instancedAttributeBlock.views,n=0,r=e;r<e+3;r++)for(var s=0;s<4;s++)i[r][s]=t[n++]},e.UpdateInstancedAttributes=function(t){this.instancedWorldMatrixIndex=-1,this.instancedSHIndex=-1;var e=this.passes[0];if(e.device.hasFeature(1)){for(var i=0,n=0;n<t.length;n++){var r=t[n];r.isInstanced&&(i+=ip[r.format].size)}var s=this.instancedAttributeBlock;s.buffer=new Uint8Array(i),s.views.length=s.attributes.length=0;for(var a=0,o=0;o<t.length;o++){var h=t[o];if(h.isInstanced){var u=new Cd;u.format=h.format,u.name=h.name,u.isNormalized=h.isNormalized,u.location=h.location,s.attributes.push(u);var l=ip[h.format],c=new(cp(l))(s.buffer.buffer,a,l.count);s.views.push(c),a+=l.size}}1===e.batchingScheme&&e.getInstancedBuffer().destroy(),this.instancedWorldMatrixIndex=this.getInstancedAttributeIndex(jb),this.instancedSHIndex=this.getInstancedAttributeIndex(qb)}},e._flushPassInfo=function(){var t=this._passes;if(t){this._shaders||(this._shaders=[]),this._shaders.length=t.length;for(var e=0,i=t.length;e<i;e++)this._shaders[e]=t[e].getShaderVariant(this.patches)}},n(t,[{key:"passes",get:function(){return this._passes},set:function(t){t.length>8?ht(12004,8):(this._passes=t,this._flushPassInfo(),this._descriptorSet&&(this._descriptorSet.destroy(),zM.layout=t[0].localSetLayout,this._descriptorSet=this._device.createDescriptorSet(zM)))}},{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}(),GM=new Kr,HM=[{name:"CC_RECEIVE_SHADOW",value:!0}],WM=[{name:"CC_USE_LIGHTMAP",value:1}],jM=[{name:"CC_USE_LIGHTMAP",value:2}],qM=[{name:"CC_LIGHT_MAP_VERSION",value:2}],XM=[{name:"CC_USE_LIGHT_PROBE",value:!0}],YM=new md(2,2,0,2,2,2),JM=new md(2,2,2,2,2,2),KM=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=Ly.Enum.NONE,this._priority=0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=0,this._device=Wp.gfxDevice}var e=t.prototype;return e.initialize=function(){this._inited||(this._receiveShadow=!0,this.castShadow=!1,this.enabled=!0,this.visFlags=Ly.Enum.NONE,this._inited=!0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=0)},e.destroy=function(){for(var t=this._subModels,e=0;e<t.length;e++)this._subModels[e].destroy();this._localBuffer&&(this._localBuffer.destroy(),this._localBuffer=null),this._localSHBuffer&&(this._localSHBuffer.destroy(),this._localSHBuffer=null),this._worldBoundBuffer&&(this._worldBoundBuffer.destroy(),this._worldBoundBuffer=null),this._worldBounds=null,this._modelBounds=null,this._subModels.length=0,this._inited=!1,this._localDataUpdated=!0,this._transform=null,this._node=null,this.isDynamicBatching=!1},e.attachToScene=function(t){this.scene=t,this._localDataUpdated=!0},e.detachFromScene=function(){this.scene=null},e.updateTransform=function(){var t=this.transform;if(t.hasChangedFlags||t.isTransformDirty()){t.updateWorldTransform(),this._localDataUpdated=!0;var e=this._worldBounds;this._modelBounds&&e&&this._modelBounds.transform(t._mat,t._pos,t._rot,t._scale,e)}},e.updateWorldBound=function(){var t=this.transform;if(null!==t){t.updateWorldTransform(),this._localDataUpdated=!0;var e=this._worldBounds;this._modelBounds&&e&&this._modelBounds.transform(t._mat,t._pos,t._rot,t._scale,e)}},e.updateUBOs=function(t){for(var e=this._subModels,i=0;i<e.length;i++)e[i].update();this._updateStamp=t,this.updateSHUBOs();var n=this.node.scene.globals.shadows,r=n.enabled&&n.type===WT.Planar;if(this._localDataUpdated){this._localDataUpdated=!1;for(var s=this.transform._mat,a=!1,o=0;o<e.length;o++){var h=e[o],u=h.instancedWorldMatrixIndex;u>=0?h.updateInstancedWorldMatrix(s,u):a=!0}(a||r)&&this._localBuffer&&(Kr.toArray(this._localData,s,0),Kr.invert(GM,s),Kr.transpose(GM,GM),Kr.toArray(this._localData,GM,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=rb().lightProbes;return!(!t||t.empty()||!this._worldBounds)},e.updateSHBuffer=function(){if(this._localSHData){for(var t=this._subModels,e=!1,i=0;i<t.length;i++){var n=t[i],r=n.instancedSHIndex;r>=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,Ki)){var e=[],i=new Vn,n=A.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=A.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=gh.create()),this._worldBounds||(this._worldBounds=gh.create()),gh.fromPoints(this._modelBounds,t,e),this._worldBounds.copy(this._modelBounds))},e._createSubModel=function(){return new UM},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;e<t.length;e++)t[e].onPipelineStateChanged()},e.onMacroPatchesStateChanged=function(){for(var t=this._subModels,e=0;e<t.length;e++)t[e].onMacroPatchesStateChanged(this.getMacroPatches(e))},e.onGeometryChanged=function(){for(var t=this._subModels,e=0;e<t.length;e++)t[e].onGeometryChanged()},e.initLightingmap=function(t,e){this._lightmap=t,this._lightmapUVParam=e},e.updateLightingmap=function(t,e){Vn.toArray(this._localData,e,32),this._localDataUpdated=!0,this._lightmap=t,this._lightmapUVParam=e,this.onMacroPatchesStateChanged(),t||(t=mT.get("empty-texture"));var i=t.getGFXTexture();if(i)for(var n=this._device.getSampler(t.mipmaps.length>1?JM:YM),r=this._subModels,s=0;s<r.length;s++){var a=r[s].descriptorSet;a.bindTexture(bS,i),a.bindSampler(bS,n),a.update()}},e.updateReflectionProbeCubemap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),t||(t=mT.get("default-cube-texture"));var e=t.getGFXTexture();if(e)for(var i=this._device.getSampler(t.getSamplerInfo()),n=this._subModels,r=0;r<n.length;r++){var s=n[r].descriptorSet;s&&(s.bindSampler(DS,i),s.bindTexture(DS,e),s.update())}},e.updateReflectionProbeBlendCubemap=function(){},e.updateReflectionProbePlanarMap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged();var e=this._device.getSampler(new md(2,2,0,2,2,2));if(t||(t=mT.get("empty-texture").getGFXTexture()),t)for(var i=this._subModels,n=0;n<i.length;n++){var r=i[n].descriptorSet;r&&(r.bindTexture(PS,t),r.bindSampler(PS,e),r.update())}},e.updateReflectionProbeDataMap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),t||(t=mT.get("empty-texture"));var e=t.getGFXTexture();if(e)for(var i=this._subModels,n=0;n<i.length;n++){var r=i[n].descriptorSet;r&&(r.bindTexture(15,e),r.bindSampler(15,t.getGFXSampler()),r.update())}},e.updateLocalShadowBias=function(){var t=this._localData;t[36]=this._shadowBias,t[37]=this._shadowNormalBias,this._localDataUpdated=!0},e.updateReflectionProbeId=function(){var t=this._localData;t[38]=this._reflectionProbeId,t[39]=this._reflectionProbeBlendId;var e=null,i=null;if(A.internal.reflectionProbeManager&&(e=A.internal.reflectionProbeManager.getProbeById(this._reflectionProbeId),i=A.internal.reflectionProbeManager.getProbeById(this._reflectionProbeBlendId)),e){if(1===e.probeType)t[40]=e.node.up.x,t[41]=e.node.up.y,t[42]=e.node.up.z,t[43]=1,t[44]=1,t[45]=0,t[46]=0,t[47]=1;else{t[40]=e.node.worldPosition.x,t[41]=e.node.worldPosition.y,t[42]=e.node.worldPosition.z,t[43]=0,t[44]=e.size.x,t[45]=e.size.y,t[46]=e.size.z;var n=e.isRGBE()?1e3:0;t[47]=e.cubemap?e.cubemap.mipmapLevel+n:1+n}if(3===this._reflectionProbeType||4===this._reflectionProbeType)if(i){t[48]=i.node.worldPosition.x,t[49]=i.node.worldPosition.y,t[50]=i.node.worldPosition.z,t[51]=this.reflectionProbeBlendWeight,t[52]=i.size.x,t[53]=i.size.y,t[54]=i.size.z;var r=i.isRGBE()?1e3:0;t[55]=i.cubemap?i.cubemap.mipmapLevel+r:1+r}else 4===this._reflectionProbeType&&(t[51]=this.reflectionProbeBlendWeight)}this._localDataUpdated=!0},e.getMacroPatches=function(){var t=this.receiveShadow?HM:null;if(null!=this._lightmap&&this.node&&this.node.scene){var e=this.node.scene.globals;if(!e.disableLightmap){var i=e.bakedWithStationaryMainLight?jM:WM;t=t?t.concat(i):i,e.bakedWithHighpLightmap&&(t=t.concat(qM))}}this._useLightProbe&&(t=t?t.concat(XM):XM);var n=[{name:"CC_USE_REFLECTION_PROBE",value:this._reflectionProbeType}];t=t?t.concat(n):n;var r=[{name:"CC_DISABLE_DIRECTIONAL_LIGHT",value:!this._receiveDirLight}];return t?t.concat(r):r},e._updateAttributesAndBinding=function(t){var e=this._subModels[t];if(e){this._initLocalDescriptors(t),this._updateLocalDescriptors(t,e.descriptorSet),this._initLocalSHDescriptors(t),this._updateLocalSHDescriptors(t,e.descriptorSet),this._initWorldBoundDescriptors(t),e.worldBoundDescriptorSet&&this._updateWorldBoundDescriptors(t,e.worldBoundDescriptorSet);var i=[],n=new Set;e.passes.forEach((function(t){t.getShaderVariant(e.patches).attributes.forEach((function(t){n.has(t.name)||(i.push(t),n.add(t.name))}))})),this._updateInstancedAttributes(i,e)}},e._updateInstancedAttributes=function(t,e){e.UpdateInstancedAttributes(t),this._localDataUpdated=!0},e._initLocalDescriptors=function(){this._localBuffer||(this._localBuffer=this._device.createBuffer(new ud(18,1,224,224)))},e._initLocalSHDescriptors=function(){this._useLightProbe&&(this._localSHData||(this._localSHData=new Float32Array(28)),this._localSHBuffer||(this._localSHBuffer=this._device.createBuffer(new ud(18,1,112,112))))},e._initWorldBoundDescriptors=function(){this._worldBoundBuffer||(this._worldBoundBuffer=this._device.createBuffer(new ud(18,1,Wb.SIZE,Wb.SIZE)))},e._updateLocalDescriptors=function(t,e){this._localBuffer&&e.bindBuffer(0,this._localBuffer)},e._updateLocalSHDescriptors=function(t,e){this._localSHBuffer&&e.bindBuffer(6,this._localSHBuffer)},e._updateWorldBoundDescriptors=function(t,e){this._worldBoundBuffer&&e.bindBuffer(Wb.BINDING,this._worldBoundBuffer)},n(t,[{key:"subModels",get:function(){return this._subModels}},{key:"inited",get:function(){return this._inited}},{key:"worldBounds",get:function(){return this._worldBounds}},{key:"modelBounds",get:function(){return this._modelBounds}},{key:"localBuffer",get:function(){return this._localBuffer}},{key:"localSHBuffer",get:function(){return this._localSHBuffer}},{key:"worldBoundBuffer",get:function(){return this._worldBoundBuffer}},{key:"updateStamp",get:function(){return this._updateStamp}},{key:"useLightProbe",get:function(){return this._useLightProbe},set:function(t){this._useLightProbe=t,this.onMacroPatchesStateChanged()}},{key:"tetrahedronIndex",get:function(){return this._tetrahedronIndex},set:function(t){this._tetrahedronIndex=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}},{key:"receiveShadow",get:function(){return this._receiveShadow},set:function(t){this._receiveShadow=t,this.onMacroPatchesStateChanged()}},{key:"castShadow",get:function(){return this._castShadow},set:function(t){this._castShadow=t}},{key:"receiveDirLight",get:function(){return this._receiveDirLight},set:function(t){this._receiveDirLight=t,this.onMacroPatchesStateChanged()}},{key:"node",get:function(){return this._node},set:function(t){this._node=t}},{key:"transform",get:function(){return this._transform},set:function(t){this._transform=t}},{key:"visFlags",get:function(){return this._visFlags},set:function(t){this._visFlags=t}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"bakeToReflectionProbe",get:function(){return this._bakeToReflectionProbe},set:function(t){this._bakeToReflectionProbe=t}},{key:"reflectionProbeType",get:function(){return this._reflectionProbeType},set:function(t){this._reflectionProbeType=t;for(var e=this._subModels,i=0;i<e.length;i++)e[i].useReflectionProbeType=t;this.onMacroPatchesStateChanged()}},{key:"reflectionProbeId",get:function(){return this._reflectionProbeId},set:function(t){this._reflectionProbeId=t}},{key:"reflectionProbeBlendId",get:function(){return this._reflectionProbeBlendId},set:function(t){this._reflectionProbeBlendId=t}},{key:"reflectionProbeBlendWeight",get:function(){return this._reflectionProbeBlendWeight},set:function(t){this._reflectionProbeBlendWeight=t}}]),t}(),QM=function(){function t(){this._enabled=!1,this._minPos=new ir(0,0,0),this._maxPos=new ir(0,0,0),this._depth=0}return t.prototype.initialize=function(t){this._enabled=t.enabled,this._minPos=t.minPos,this._maxPos=t.maxPos,this._depth=t.depth},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"minPos",get:function(){return this._minPos},set:function(t){this._minPos=t}},{key:"maxPos",get:function(){return this._maxPos},set:function(t){this._maxPos=t}},{key:"depth",get:function(){return this._depth},set:function(t){this._depth=t}}]),t}(),ZM=function(){function t(){this._enabled=!0,this._blurRadius=.01,this._sssIntensity=3}return t.prototype.initialize=function(t){this._enabled=t.enabled,this._blurRadius=t.blurRadius,this._sssIntensity=t.sssIntensity},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"blurRadius",get:function(){return this._blurRadius},set:function(t){this._blurRadius=t}},{key:"sssIntensity",get:function(){return this._sssIntensity},set:function(t){this._sssIntensity=t}}]),t}();function $M(t,e){e<1e3?e=1e3:e>15e3&&(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 tP,eP={DIRECTIONAL:0,SPHERE:1,SPOT:2,POINT:3,RANGED_DIRECTIONAL:4,UNKNOWN:5},iP=function(t){return 4*Math.PI*Math.PI*t*t},nP=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=US}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,$M(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}(),rP=new ir(0,0,-1),sP=new ir,aP=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=jT.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._shadowSaturation=1,e._shadowDistance=50,e._shadowInvisibleOcclusionRange=200,e._csmLevel=qT.LEVEL_4,e._csmNeedUpdate=!1,e._csmLayerLambda=.75,e._csmOptimizationMode=XT.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(sP,rP,this._node.worldRotation))},i.activate=function(){var t=A.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 rb().isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){rb().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,JT.MAX_FAR)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(t){this._shadowInvisibleOcclusionRange=Math.min(t,JT.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,JT.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}(nP),oP=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=gh.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/iP(.15),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;gh.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 rb().isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){rb().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}(nP),hP=new ir(0,0,-1),uP=new kr,lP=new Kr,cP=new Kr,fP=new Kr,_P=new Kr,dP=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=gh.create(),e._frustum=Dh.create(),e._angle=0,e._needUpdate=!1,e._size=.15,e._luminanceHDR=0,e._luminanceLDR=0,e._shadowEnabled=!1,e._shadowPcf=jT.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/iP(.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,hP,this._node.getWorldRotation(uP)),ir.normalize(this._dir,this._dir),gh.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,this._range,this._range,this._range),this._node.getWorldRT(lP),Kr.invert(lP,lP),Kr.perspective(cP,this._angle,1,.001,this._range),Kr.multiply(fP,cP,lP),this._frustum.update(fP,_P),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 rb().isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){rb().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}(nP),pP=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=gh.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/iP(1),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;gh.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 rb().isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){rb().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}(nP),mP=new ir(0,0,-1),gP=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,mP,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 rb().isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){rb().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}(nP),yP=new Id;yP.format=35;var vP=new Md;vP.format=55;var bP=new Od([yP],vP),SP={width:1,height:1,renderPassInfo:bP},wP=t("e9",Kh("cc.RenderTexture")(tP=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=A.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=A.director.root;SP.title=this._name,SP.width=this._width,SP.height=this._height,SP.renderPassInfo=t&&t.passInfo?t.passInfo:bP,SP.externalResLow=t&&t.externalResLow?t.externalResLow:0,SP.externalResHigh=t&&t.externalResHigh?t.externalResHigh:0,SP.externalFlag=t&&t.externalFlag?t.externalFlag:0,SP.renderPassInfo.colorAttachments.forEach((function(t){t.format=e.device.swapchainFormat})),yP.barrier=Wp.gfxDevice.getGeneralBarrier(new Rd(128,128)),this._window?(this._window.destroy(),this._window.initialize(Wp.gfxDevice,SP)):this._window=e.createWindow(SP)},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<a)return ht(7607,a),null;var o=this._getGFXDevice(),h=[],u=[],l=new id;return l.texOffset.x=t,l.texOffset.y=e,l.texExtent.width=i,l.texExtent.height=n,u.push(l),h.push(r),null==o||o.copyTextureToBuffers(s,h,u),r},n(e,[{key:"window",get:function(){return this._window}}]),e}(Ym))||tP);A.RenderTexture=wP;var xP,TP,AP={SKYBOX:14,SOLID_COLOR:7},CP={CUBE:0,PLANAR:1},DP=[nr(0,-90,0),nr(0,90,0),nr(90,0,0),nr(-90,0,0),nr(0,0,0),nr(0,180,0)],BP=nr(),IP=function(){function t(t){this.bakedCubeTextures=[],this.realtimePlanarTexture=null,this._resolution=256,this._clearFlag=14,this._backgroundColor=new cr(0,0,0,255),this._visibility=US,this._probeType=0,this._cubemap=null,this._size=nr(1,1,1),this._camera=null,this._probeId=0,this._needRefresh=!1,this._needRender=!1,this._node=null,this._cameraNode=null,this._boundingBox=null,this._cameraWorldPos=nr(),this._cameraWorldRotation=Ur(),this._forward=nr(),this._up=nr(),this._previewSphere=null,this._previewPlane=null,this._probeId=t}var e=t.prototype;return e.initialize=function(t,e){this._node=t,this._cameraNode=e,this.node.getWorldPosition(BP);var i=this._size;this._boundingBox=gh.create(BP.x,BP.y,BP.z,i.x,i.y,i.z),this._createCamera(e)},e.initBakedTextures=function(){if(0===this.bakedCubeTextures.length)for(var t=0;t<6;t++){var e=this._createTargetTexture(this._resolution,this._resolution);this.bakedCubeTextures.push(e)}},e.captureCubemap=function(){this.initBakedTextures(),this._resetCameraParams(),this._needRender=!0},e.renderPlanarReflection=function(t){if(t){if(!this.realtimePlanarTexture){var e=A.view.getDesignResolutionSize();this.realtimePlanarTexture=this._createTargetTexture(e.width,e.height),A.internal.reflectionProbeManager.updatePlanarMap(this,this.realtimePlanarTexture.getGFXTexture())}this._syncCameraParams(t),this._transformReflectionCamera(t),this._needRender=!0}},e.switchProbeType=function(t,e){0===t?this._needRender=!1:null!==e&&this.renderPlanarReflection(e)},e.getProbeId=function(){return this._probeId},e.updateProbeId=function(t){this._probeId=t},e.renderArea=function(){return 1===this._probeType?new ds(this.realtimePlanarTexture.width,this.realtimePlanarTexture.height):new ds(this.resolution,this.resolution)},e.isFinishedRendering=function(){return!0},e.validate=function(){return null!==this.cubemap},e.destroy=function(){this._camera&&(this._camera.destroy(),this._camera=null);for(var t=0;t<this.bakedCubeTextures.length;t++)this.bakedCubeTextures[t].destroy();this.bakedCubeTextures=[],this.realtimePlanarTexture&&(this.realtimePlanarTexture.destroy(),this.realtimePlanarTexture=null)},e.enable=function(){},e.disable=function(){},e.updateCameraDir=function(t){this.cameraNode.setRotationFromEuler(DP[t]),this.camera.update(!0)},e.updateBoundingBox=function(){if(this.node){this.node.getWorldPosition(BP);var t=this._size;gh.set(this._boundingBox,BP.x,BP.y,BP.z,t.x,t.y,t.z)}},e.hasFrameBuffer=function(t){if(1===this.probeType){var e;if(!this.realtimePlanarTexture)return!1;if((null==(e=this.realtimePlanarTexture.window)?void 0:e.framebuffer)===t)return!0}else{if(0===this.bakedCubeTextures.length)return!1;for(var i=0;i<this.bakedCubeTextures.length;i++){var n;if((null==(n=this.bakedCubeTextures[i].window)?void 0:n.framebuffer)===t)return!0}}return!1},e.isRGBE=function(){return!0},e._syncCameraParams=function(t){this.camera.projectionType=t.projectionType,this.camera.orthoHeight=t.orthoHeight,this.camera.nearClip=t.nearClip,this.camera.farClip=t.farClip,this.camera.fov=t.fov,this.camera.clearFlag=t.clearFlag,this.camera.clearColor=t.clearColor,this.camera.priority=t.priority-1,this.camera.resize(t.width,t.height)},e._createCamera=function(t){var e=A.director.root;if(!this._camera){if(this._camera=e.createCamera(),!this._camera)return null;this._camera.initialize({name:t.name,node:t,projection:1,window:e&&e.tempWindow,priority:0,cameraType:-1,trackingType:0})}return this._camera.setViewportInOrientedSpace(new bs(0,0,1,1)),this._camera.fovAxis=0,this._camera.fov=nn(90),this._camera.orthoHeight=10,this._camera.nearClip=1,this._camera.farClip=1e3,this._camera.clearColor=this._backgroundColor,this._camera.clearDepth=1,this._camera.clearStencil=0,this._camera.clearFlag=this._clearFlag,this._camera.visibility=this._visibility,this._camera.aperture=19,this._camera.shutter=7,this._camera.iso=0,this._camera},e._resetCameraParams=function(){this.camera.projectionType=1,this.camera.orthoHeight=10,this.camera.nearClip=1,this.camera.farClip=1e3,this.camera.fov=nn(90),this.camera.priority=0,this.camera.resize(this.resolution,this.resolution),this.camera.visibility=this._visibility,this.camera.clearFlag=this._clearFlag,this.camera.clearColor=this._backgroundColor,this.cameraNode.worldPosition=this.node.worldPosition,this.cameraNode.worldRotation=this.node.worldRotation,this.camera.update(!0)},e._createTargetTexture=function(t,e){var i=new wP;return i.reset({width:t,height:e}),i},e._transformReflectionCamera=function(t){var e=ir.dot(this.node.worldPosition,this.node.up);this._reflect(this._cameraWorldPos,t.node.worldPosition,this.node.up,e),this.cameraNode.worldPosition=this._cameraWorldPos,ir.transformQuat(this._forward,ir.FORWARD,t.node.worldRotation),this._reflect(this._forward,this._forward,this.node.up,0),this._forward.normalize(),this._forward.negative(),ir.transformQuat(this._up,ir.UP,t.node.worldRotation),this._reflect(this._up,this._up,this.node.up,0),this._up.normalize(),kr.fromViewUp(this._cameraWorldRotation,this._forward,this._up),this.cameraNode.worldRotation=this._cameraWorldRotation,this.camera.update(!0);var i=new Vn(this.node.up.x,this.node.up.y,this.node.up.z,-ir.dot(this.node.up,this.node.worldPosition));i.transformMat4(this.camera.matView.clone().invert().transpose()),this.camera.calculateObliqueMat(i)},e._reflect=function(t,e,i,n){var r=ir.clone(i);r.normalize();var s=ir.dot(r,e)-n;return r.multiplyScalar(2*s),ir.subtract(t,e,r),t},n(t,[{key:"probeType",get:function(){return this._probeType},set:function(t){this._probeType=t}},{key:"resolution",get:function(){return this._resolution},set:function(t){t!==this._resolution&&this.bakedCubeTextures.forEach((function(e){e.resize(t,t)})),this._resolution=t}},{key:"clearFlag",get:function(){return this._clearFlag},set:function(t){this._clearFlag=t,this.camera.clearFlag=this._clearFlag}},{key:"backgroundColor",get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this.camera.clearColor=this._backgroundColor}},{key:"visibility",get:function(){return this._visibility},set:function(t){this._visibility=t,this._camera.visibility=this._visibility}},{key:"size",get:function(){return this._size},set:function(t){this._size.set(t),this.node.getWorldPosition(BP),gh.set(this._boundingBox,BP.x,BP.y,BP.z,t.x,t.y,t.z)}},{key:"cubemap",get:function(){return this._cubemap},set:function(t){this._cubemap=t}},{key:"node",get:function(){return this._node}},{key:"camera",get:function(){return this._camera}},{key:"needRefresh",get:function(){return this._needRefresh},set:function(t){this._needRefresh=t}},{key:"needRender",get:function(){return this._needRender},set:function(t){this._needRender=t}},{key:"boundingBox",get:function(){return this._boundingBox}},{key:"cameraNode",get:function(){return this._cameraNode},set:function(t){this._cameraNode=t}},{key:"previewSphere",get:function(){return this._previewSphere},set:function(t){this._previewSphere=t}},{key:"previewPlane",get:function(){return this._previewPlane},set:function(t){this._previewPlane=t}}]),t}(),MP=function(){function t(){this.screenUsagePercentage=1,this._models=[]}var e=t.prototype;return e.addModel=function(t){this._models.splice(0,0,t)},e.eraseModel=function(t){var e=this._models.indexOf(t);e>=0&&this._models.splice(e,1)},e.clearModels=function(){this._models.length=0},n(t,[{key:"models",get:function(){return this._models}}]),t}(),PP=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=Wp.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<e;i++)if(t[i]!==this._lockedLODLevelVec[i]){this._isLockLevelChanged=!0;break}this._lockedLODLevelVec=t.slice()},e.isLockLevelChanged=function(){return this._isLockLevelChanged},e.resetLockChangeFlag=function(){this._isLockLevelChanged=!1},e.getLockedLODLevels=function(){return this._lockedLODLevelVec},e.clearLODs=function(){this._lodDataArray.length=0},e.insertLOD=function(t,e){this._lodDataArray.splice(t,0,e)},e.updateLOD=function(t,e){this._lodDataArray[t]=e},e.eraseLOD=function(t){this._lodDataArray.splice(t,1)},e.getVisibleLODLevel=function(t){for(var e=this.getScreenUsagePercentage(t),i=-1,n=0;n<this.lodCount;++n)if(e>=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}(),EP=Object.freeze({__proto__:null,Ambient:vb,CSMLevel:qT,CSMOptimizationMode:XT,Camera:NM,CameraAperture:BM,CameraFOVAxis:CM,CameraISO:IM,CameraProjection:DM,CameraShutter:MM,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:$M,DirectionalLight:aP,EnvironmentLightingType:tA,FOG_TYPE_NONE:rA,Fog:sA,FogType:nA,LODData:MP,LODGroup:PP,Light:nP,LightType:eP,Model:KM,ModelType:{DEFAULT:0,SKINNING:1,BAKED_SKINNING:2,BATCH_2D:3,PARTICLE_BATCH:4,LINE:5},Octree:QM,PCFType:jT,PointLight:pP,PostSettings:ID,ProbeClearFlag:AP,ProbeType:CP,RangedDirectionalLight:gP,ReflectionProbe:IP,SKYBOX_FLAG:8,ShadowSize:HT,ShadowType:WT,Shadows:JT,Skin:ZM,SkyBoxFlagValue:{VALUE:8},Skybox:eA,SphereLight:oP,SpotLight:dP,SubModel:UM,ToneMappingType:BD,TrackingType:{NO_TRACKING:0,POSITION_AND_ROTATION:1,POSITION:2,ROTATION:3},nt2lm:iP}),OP=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 RP(this),!0},e.update=function(t){var e=this._mainLight;e&&e.update();for(var i=this._sphereLights,n=0;n<i.length;n++)i[n].update();for(var r=this._spotLights,s=0;s<r.length;s++)r[s].update();for(var a=this._pointLights,o=0;o<a.length;o++)a[o].update();for(var h=this._rangedDirLights,u=0;u<h.length;u++)h[u].update();for(var l=this._models,c=0;c<l.length;c++){var f=l[c];f.enabled&&(f.updateTransform(t),f.updateUBOs(t))}this._lodStateCache.updateLodState()},e.destroy=function(){this.removeCameras(),this.removeSphereLights(),this.removeSpotLights(),this.removeRangedDirLights(),this.removeModels(),this.removeLODGroups(),this._lodStateCache.clearCache()},e.isCulledByLod=function(t,e){return this._lodStateCache.isLodModelCulled(t,e)},e.addCamera=function(t){t.attachToScene(this),this._cameras.push(t),this._lodStateCache.addCamera(t)},e.removeCamera=function(t){for(var e=0;e<this._cameras.length;++e)if(this._cameras[e]===t)return this._cameras.splice(e,1),t.detachFromScene(),void this._lodStateCache.removeCamera(t)},e.removeCameras=function(){var t=this;this._cameras.forEach((function(e){e.detachFromScene(),t._lodStateCache.removeCamera(e)})),this._cameras.length=0},e.setMainLight=function(t){this._mainLight=t,this._mainLight&&this._mainLight.activate()},e.unsetMainLight=function(t){if(this._mainLight===t){var e=this._directionalLights;if(e.length)return this.setMainLight(e[e.length-1]),void(this._mainLight.node&&(this._mainLight.node.hasChangedFlags|=2));this.setMainLight(null)}},e.addDirectionalLight=function(t){t.attachToScene(this),this._directionalLights.push(t)},e.removeDirectionalLight=function(t){for(var e=0;e<this._directionalLights.length;++e)if(this._directionalLights[e]===t)return t.detachFromScene(),void this._directionalLights.splice(e,1)},e.addSphereLight=function(t){t.attachToScene(this),this._sphereLights.push(t)},e.removeSphereLight=function(t){for(var e=0;e<this._sphereLights.length;++e)if(this._sphereLights[e]===t)return t.detachFromScene(),void this._sphereLights.splice(e,1)},e.addSpotLight=function(t){t.attachToScene(this),this._spotLights.push(t)},e.removeSpotLight=function(t){for(var e=0;e<this._spotLights.length;++e)if(this._spotLights[e]===t)return t.detachFromScene(),void this._spotLights.splice(e,1)},e.removeSphereLights=function(){for(var t=0;t<this._sphereLights.length;++t)this._sphereLights[t].detachFromScene();this._sphereLights.length=0},e.removeSpotLights=function(){for(var t=0;t<this._spotLights.length;++t)this._spotLights[t].detachFromScene();this._spotLights.length=0},e.addPointLight=function(t){t.attachToScene(this),this._pointLights.push(t)},e.removePointLight=function(t){for(var e=0;e<this._pointLights.length;++e)if(this._pointLights[e]===t)return t.detachFromScene(),void this._pointLights.splice(e,1)},e.removePointLights=function(){for(var t=0;t<this._pointLights.length;++t)this._pointLights[t].detachFromScene();this._pointLights.length=0},e.addRangedDirLight=function(t){t.attachToScene(this),this._rangedDirLights.push(t)},e.removeRangedDirLight=function(t){for(var e=0;e<this._rangedDirLights.length;++e)if(this._rangedDirLights[e]===t)return t.detachFromScene(),void this._rangedDirLights.splice(e,1)},e.removeRangedDirLights=function(){for(var t=0;t<this._rangedDirLights.length;++t)this._rangedDirLights[t].detachFromScene();this._rangedDirLights.length=0},e.addModel=function(t){t.attachToScene(this),this._models.push(t)},e.removeModel=function(t){for(var e=0;e<this._models.length;++e)if(this._models[e]===t)return this._lodStateCache.removeModel(t),t.detachFromScene(),void this._models.splice(e,1)},e.removeModels=function(){var t=this;this._models.forEach((function(e){t._lodStateCache.removeModel(e),e.detachFromScene(),e.destroy()})),this._models.length=0},e.addBatch=function(t){this._batches.push(t)},e.removeBatch=function(t){for(var e=0;e<this._batches.length;++e)if(this._batches[e]===t)return void this._batches.splice(e,1)},e.removeBatches=function(){this._batches.length=0},e.addLODGroup=function(t){this._lodGroups.push(t),t.attachToScene(this),this._lodStateCache.addLodGroup(t)},e.removeLODGroup=function(t){var e=this._lodGroups.indexOf(t);e>=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}(),kP=function(){this.usedLevel=-1,this.lastUsedLevel=-1,this.transformDirty=!0},RP=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;i<e.length;i++){var n=e[i].node.layer;if((t.visibility&n)===n){this._lodStateInCamera.has(t)||this._lodStateInCamera.set(t,new Map);break}}},e.removeCamera=function(t){this._lodStateInCamera.has(t)&&this._lodStateInCamera.delete(t)},e.addLodGroup=function(t){this._newAddedLodGroupVec.push(t);for(var e=this._renderScene.cameras,i=0;i<e.length;i++){var n=e[i];if(!this._lodStateInCamera.has(n)){var r=t.node.layer;(n.visibility&r)===r&&this._lodStateInCamera.set(n,new Map)}}},e.removeLodGroup=function(t){for(var e=this,i=0;i<t.lodCount;i++)t.lodDataArray[i].models.forEach((function(t){e._modelsInLODGroup.delete(t)}));for(var n,r=p(this._lodStateInCamera);!(n=r()).done;)n.value[1].delete(t);this._levelModels.delete(t)},e.removeModel=function(t){this._modelsInLODGroup.has(t)&&this._modelsInLODGroup.delete(t)},e.updateLodState=function(){var t=this;this._newAddedLodGroupVec.forEach((function(e){var i=t._levelModels.get(e);i||(i=new Map,t._levelModels.set(e,i));for(var n=0;n<e.lodCount;n++){var r=i.get(n);r||(r=[]);for(var s=e.lodDataArray[n].models,a=0;a<s.length;a++){var o=s[a],h=t._modelsInLODGroup.get(o);h||(h=new Map),t._modelsInLODGroup.set(o,h),r.push(o)}i.set(n,r)}})),this._newAddedLodGroupVec.length=0;for(var e=this._renderScene.lodGroups,i=function(){var i=e[n];if(i.enabled){var r=i.getLockedLODLevels();if(r.length>0){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 kP,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 _=l.value,d=_[1].get(i);d||(d=new kP,_[1].set(i,d));var m=_[0].node.hasChangedFlags,g=i.node.hasChangedFlags;if(m>0||g>0||d.transformDirty){d.transformDirty&&(d.transformDirty=!1);var y=i.getVisibleLODLevel(_[0]);y!==d.usedLevel&&(d.lastUsedLevel=d.usedLevel,d.usedLevel=y,c=!0)}}var v=t._levelModels.get(i);if(!v)return 0;i.isLockLevelChanged()?(i.resetLockChangeFlag(),v.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=v.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=v.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;n<e.length;n++)i()},e.isLodModelCulled=function(t,e){var i=this._modelsInLODGroup.get(e);return!!i&&!i.has(t)},e.clearCache=function(){this._levelModels.clear(),this._modelsInLODGroup.clear(),this._lodStateInCamera.clear(),this._newAddedLodGroupVec.length=0},e.isLodGroupVisibleByCamera=function(t,e){var i=t.node.layer;return(e.visibility&i)===i},t}(),FP=((xP={})[Ne.PORTRAIT]=0,xP[Ne.LANDSCAPE_RIGHT]=1,xP[Ne.PORTRAIT_UPSIDE_DOWN]=2,xP[Ne.LANDSCAPE_LEFT]=3,xP),LP=0,VP=function(){var t=e.prototype;function e(){this._title="",this._width=1,this._height=1,this._swapchain=null,this._renderPass=null,this._colorTextures=[],this._depthStencilTexture=null,this._cameras=[],this._hasOnScreenAttachments=!1,this._hasOffScreenAttachments=!1,this._framebuffer=null,this._device=null,this._renderWindowId=LP++,this._isResized=!0,this._colorName="Color"+this._renderWindowId,this._depthStencilName="DepthStencil"+this._renderWindowId}return t.isRenderWindowResized=function(){return this._isResized},t.setRenderWindowResizeHandled=function(){this._isResized=!1},e.registerCreateFunc=function(t){t._createWindowFun=function(){return new e}},t.initialize=function(t,e){if(void 0!==e.title&&(this._title=e.title),void 0!==e.swapchain&&(this._swapchain=e.swapchain),this._width=e.width,this._height=e.height,this._device=t,this._renderPass=t.createRenderPass(e.renderPassInfo),e.swapchain)this._swapchain=e.swapchain,this._colorTextures.push(e.swapchain.colorTexture),this._depthStencilTexture=e.swapchain.depthStencilTexture;else{for(var i=0;i<e.renderPassInfo.colorAttachments.length;i++){var n=new dd(1,21,e.renderPassInfo.colorAttachments[i].format,this._width,this._height);e.externalFlag&&(8&e.externalFlag||4&e.externalFlag)&&(n.flags|=e.externalFlag,n.externalRes=e.externalResLow?e.externalResLow:0),this._colorTextures.push(t.createTexture(n))}e.renderPassInfo.depthStencilAttachment&&0!==e.renderPassInfo.depthStencilAttachment.format&&(this._depthStencilTexture=t.createTexture(new dd(1,36,e.renderPassInfo.depthStencilAttachment.format,this._width,this._height)),this._hasOffScreenAttachments=!0)}return this._framebuffer=t.createFramebuffer(new Vd(this._renderPass,this._colorTextures,this._depthStencilTexture)),!0},t.destroy=function(){this.clearCameras(),this._framebuffer&&(this._framebuffer.destroy(),this._framebuffer=null),this._depthStencilTexture&&(this._depthStencilTexture.destroy(),this._depthStencilTexture=null);for(var t=0;t<this._colorTextures.length;t++){var e=this._colorTextures[t];e&&e.destroy()}this._colorTextures.length=0,this._device=null},t.resize=function(t,e){if(this._swapchain)this._swapchain.resize(t,e,FP[sh.orientation]),this._width=this._swapchain.width,this._height=this._swapchain.height;else{for(var i=0;i<this._colorTextures.length;i++)this._colorTextures[i].resize(t,e);this._depthStencilTexture&&this._depthStencilTexture.resize(t,e),this._width=t,this._height=e}this.framebuffer&&(this.framebuffer.destroy(),this._framebuffer=this._device.createFramebuffer(new Vd(this._renderPass,this._colorTextures,this._depthStencilTexture))),this._cameras.forEach((function(i){i.resize(t,e)})),this._isResized=!0},t.extractRenderCameras=function(t){for(var e=0;e<this._cameras.length;e++){var i=this._cameras[e];i.enabled&&(i.update(),t.push(i))}},t.attachCamera=function(t){for(var e=0;e<this._cameras.length;e++)if(this._cameras[e]===t)return;this._cameras.push(t),this.sortCameras(),this._isResized=!0},t.detachCamera=function(t){for(var e=0;e<this._cameras.length;++e)if(this._cameras[e]===t)return void this._cameras.splice(e,1)},t.clearCameras=function(){this._cameras.length=0},t.sortCameras=function(){this._cameras.sort((function(t,e){return t.priority-e.priority}))},n(e,[{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"swapchain",get:function(){return this._swapchain}},{key:"framebuffer",get:function(){return this._framebuffer}},{key:"cameras",get:function(){return this._cameras}},{key:"renderWindowId",get:function(){return this._renderWindowId}},{key:"colorName",get:function(){return this._colorName}},{key:"depthStencilName",get:function(){return this._depthStencilName}}]),e}(),NP=(t("dj",{RENDER_FRAME_BEGIN:"render-frame-begin",RENDER_FRAME_END:"render-frame-end",RENDER_CAMERA_BEGIN:"render-camera-begin",RENDER_CAMERA_END:"render-camera-end",ATTACHMENT_SCALE_CAHNGED:"attachment-scale-changed"}),t("di",function(t){function e(){var e;return(e=t.call(this)||this).eventTargetOn=t.prototype.on,e.eventTargetOnce=t.prototype.once,e}s(e,t);var i=e.prototype;return i.on=function(t,e,i,n){return this.eventTargetOn(t,e,i,n)},i.once=function(t,e,i){return this.eventTargetOnce(t,e,i)},e}(Io))),zP=t("aJ",function(){function t(t){var e=this;this._createSceneFun=null,this._createWindowFun=null,this._windows=[],this._mainWindow=null,this._curWindow=null,this._tempWindow=null,this._usesCustomPipeline=!0,this._pipeline=null,this._pipelineEvent=new NP,this._classicPipeline=null,this._customPipeline=null,this._batcher=null,this._scenes=[],this._modelPools=new Map,this._cameraPool=null,this._lightPools=new Map,this._debugView=new AM,this._fpsTime=0,this._frameCount=0,this._fps=0,this._fixedFPS=0,this._useDeferredPipeline=!1,this._cumulativeTime=0,this._frameTime=0,this._cameraList=[],this._device=t,this._dataPoolMgr=A.internal.DataPoolManager&&new A.internal.DataPoolManager(t),OP.registerCreateFunc(this),VP.registerCreateFunc(this),this._cameraPool=new ho((function(){return new NM(e._device)}),4,(function(t){return t.destroy()}))}var e=t.prototype;return e.initialize=function(){var t,e=Wp.swapchain,i=new Id;i.format=e.colorTexture.format;var n=new Md;n.format=e.depthStencilTexture.format,n.depthStoreOp=1,n.stencilStoreOp=1;var r=new Od([i],n);this._mainWindow=this.createWindow({title:"rootMainWindow",width:e.width,height:e.height,renderPassInfo:r,swapchain:e}),this._curWindow=this._mainWindow;var s=ze.querySettings("animation","customJointTextureLayouts")||[];null==(t=this._dataPoolMgr)||t.jointTexturePool.registerCustomTextureLayouts(s),this._resizeMaxJointForDS()},e.destroy=function(){this.destroyScenes(),this._pipeline&&(this._pipeline.destroy(),this._pipeline=null,this._pipelineEvent=null),this._batcher&&(this._batcher.destroy(),this._batcher=null),this._curWindow=null,this._mainWindow=null,this.dataPoolManager.clear(),A.rendering&&A.rendering.destroy()},e.resize=function(t,e){this._windows.forEach((function(i){i.swapchain&&i.resize(t,e)}))},e.setRenderPipeline=function(t){var e=A.internal,i=A.director,n=A.rendering,r=A.legacy_rendering;if(void 0===n&&void 0===r)return ht(1223),!1;var s=!1;if(t)this._customPipeline=n.createCustomPipeline(),s=!0,this._pipeline=this._customPipeline,X("Using custom pipeline: "+Ue.CUSTOM_PIPELINE_NAME);else{var a=r.createDefaultPipeline();s=!0,X("Using legacy pipeline"),this._classicPipeline=a,this._pipeline=this._classicPipeline,this._pipelineEvent=this._classicPipeline,this._usesCustomPipeline=!1}if((3!==ze.querySettings("rendering","renderMode")||this._classicPipeline)&&!this._pipeline.activate(this._mainWindow.swapchain))return s&&this._pipeline.destroy(),this._classicPipeline=null,this._customPipeline=null,this._pipeline=null,this._pipelineEvent=null,!1;var o=i.getScene();return o&&o.globals.activate(),this.onGlobalPipelineStateChanged(),!(!this._batcher&&e.Batcher2D&&(this._batcher=new e.Batcher2D(this),!this._batcher.initialize())&&(this.destroy(),1))},e.onGlobalPipelineStateChanged=function(){for(var t=0;t<this._scenes.length;t++)this._scenes[t].onGlobalPipelineStateChanged();rb().skybox.enabled&&rb().skybox.model.onGlobalPipelineStateChanged(),this._pipeline.onGlobalPipelineStateChanged()},e.activeWindow=function(t){this._curWindow=t},e.resetCumulativeTime=function(){this._cumulativeTime=0},e.frameMove=function(t){this._frameTime=t,++this._frameCount,this._cumulativeTime+=t,this._fpsTime+=t,this._fpsTime>1&&(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;e<this._windows.length;++e)if(this._windows[e]===t)return t.destroy(),void this._windows.splice(e,1)},e.destroyWindows=function(){this._windows.forEach((function(t){t.destroy()})),this._windows.length=0},e.createScene=function(t){var e=this._createSceneFun(this);return e.initialize(t),this._scenes.push(e),e},e.destroyScene=function(t){for(var e=0;e<this._scenes.length;++e)if(this._scenes[e]===t)return t.destroy(),void this._scenes.splice(e,1)},e.destroyScenes=function(){this._scenes.forEach((function(t){t.destroy()})),this._scenes.length=0},e.createModel=function(t){var e=this._modelPools.get(t);e||(this._modelPools.set(t,new ho((function(){return new t}),10,(function(t){return t.destroy()}))),e=this._modelPools.get(t));var i=e.alloc();return i.initialize(),i},e.destroyModel=function(t){var e=this._modelPools.get(t.constructor);e?(e.free(t),t.scene&&t.scene.removeModel(t)):at(1300,t.constructor.name),t.destroy()},e.createCamera=function(){return this._cameraPool.alloc()},e.createLight=function(t){var e=this._lightPools.get(t);e||(this._lightPools.set(t,new ho((function(){return new t}),4,(function(t){return t.destroy()}))),e=this._lightPools.get(t));var i=e.alloc();return i.initialize(),i},e.destroyLight=function(t){if(t.scene)switch(t.type){case 0:t.scene.removeDirectionalLight(t);break;case 1:t.scene.removeSphereLight(t);break;case 2:t.scene.removeSpotLight(t);break;case 3:t.scene.removePointLight(t);break;case 4:t.scene.removeRangedDirLight(t)}t.destroy()},e.recycleLight=function(t){var e=this._lightPools.get(t.constructor);if(e&&(e.free(t),t.scene))switch(t.type){case 0:t.scene.removeDirectionalLight(t);break;case 1:t.scene.removeSphereLight(t);break;case 2:t.scene.removeSpotLight(t);break;case 3:t.scene.removePointLight(t);break;case 4:t.scene.removeRangedDirLight(t)}},e._doWebXRFrameMove=function(){},e._frameMoveBegin=function(){for(var t=0;t<this._scenes.length;++t)this._scenes[t].removeBatches();this._cameraList.length=0},e._frameMoveProcess=function(){for(var t=A.director,e=this._windows,i=this._cameraList,n=0;n<e.length;n++)e[n].extractRenderCameras(i);if(this._pipeline&&i.length>0){this._device.acquire([Wp.swapchain]);var r=this._scenes,s=t.getTotalFrames();this._batcher&&(this._batcher.update(),this._batcher.uploadBuffers());for(var a=0;a<r.length;a++)r[a].update(s)}},e._frameMoveEnd=function(){var t=A.director,e=A.Director,i=this._cameraList;if(this._pipeline&&i.length>0){t.emit(e.EVENT_BEFORE_COMMIT),i.sort((function(t,e){return t.priority-e.priority}));for(var n=0;n<i.length;++n){var r;null==(r=i[n].geometryRenderer)||r.update()}t.emit(e.EVENT_BEFORE_RENDER),this._pipeline.render(i),t.emit(e.EVENT_AFTER_RENDER),this._device.present()}this._batcher&&this._batcher.reset()},e._resizeMaxJointForDS=function(){var t=Math.max((288+Wb.COUNT)/4,100),e=Math.floor((Wp.gfxDevice.capabilities.maxVertexUniformVectors-t)/3);tS(e=e<256?e:256)},n(t,[{key:"device",get:function(){return this._device}},{key:"mainWindow",get:function(){return this._mainWindow}},{key:"curWindow",get:function(){return this._curWindow},set:function(t){this._curWindow=t}},{key:"tempWindow",get:function(){return this._tempWindow},set:function(t){this._tempWindow=t}},{key:"windows",get:function(){return this._windows}},{key:"usesCustomPipeline",get:function(){return this._usesCustomPipeline}},{key:"pipeline",get:function(){return this._pipeline}},{key:"customPipeline",get:function(){return this._customPipeline}},{key:"pipelineEvent",get:function(){return this._pipelineEvent}},{key:"batcher2D",get:function(){return this._batcher}},{key:"scenes",get:function(){return this._scenes}},{key:"debugView",get:function(){return this._debugView}},{key:"cumulativeTime",get:function(){return this._cumulativeTime}},{key:"frameTime",get:function(){return this._frameTime}},{key:"frameCount",get:function(){return this._frameCount}},{key:"fps",get:function(){return this._fps}},{key:"fixedFPS",get:function(){return this._fixedFPS},set:function(t){t>0&&(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}());A.Root=zP,Vi.Attr.setClassAttr(mg,"target","type","Object"),Vi.Attr.setClassAttr(mg,"target","ctor",eb),pt(eb.prototype,"Node",[{name:"childrenCount",newName:"children.length",customGetter:function(){return this.children.length}}]),pt(eb.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 ms),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(hI.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(hI.prototype,"SceneGlobals.prototype",[{name:"distance",newName:"planeHeight"},{name:"normal",newName:"planeDirection"},{name:"size",newName:"shadowMapSize"}]),mt(eb.prototype,"Node.prototype",[{name:"addLayer"},{name:"removeLayer"}]),pt(Vy.prototype,"NodeUIProperties",[{name:"opacityDirty",newName:"colorDirty"}]),mt(Ly,"Layers",[{name:"All"},{name:"RaycastMask"},{name:"check"}]),pt(Ly,"Layers",[{name:"Default",newName:"DEFAULT",target:Ly.Enum,targetName:"Layers.Enum"},{name:"Always",newName:"ALWAYS",target:Ly.Enum,targetName:"Layers.Enum"},{name:"IgnoreRaycast",newName:"IGNORE_RAYCAST",target:Ly.Enum,targetName:"Layers.Enum"},{name:"Gizmos",newName:"GIZMOS",target:Ly.Enum,targetName:"Layers.Enum"},{name:"Editor",newName:"EDITOR",target:Ly.Enum,targetName:"Layers.Enum"},{name:"UI",newName:"UI_3D",target:Ly.Enum,targetName:"Layers.Enum"},{name:"UI2D",newName:"UI_2D",target:Ly.Enum,targetName:"Layers.Enum"},{name:"SceneGizmo",newName:"SCENE_GIZMO",target:Ly.Enum,targetName:"Layers.Enum"},{name:"makeInclusiveMask",newName:"makeMaskInclude",target:Ly,targetName:"Layers"},{name:"makeExclusiveMask",newName:"makeMaskExclude",target:Ly,targetName:"Layers"}]),mt(Ly.Enum,"Layers.Enum",[{name:"ALWAYS"}]),mt(Ly.BitMask,"Layers.BitMask",[{name:"ALWAYS"}]);var UP=t("dM",Kh("cc.PrivateNode")(TP=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}(eb))||TP);function GP(t,e){if(!e){var i=C.director.getScene();if(!i)return null;e=i}return e.getChildByPath(t)}pt($y,"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:eb.EventType,targetName:"Node.EventType"}}))),pt(eb.EventType,"Node.EventType",[{name:"DEVICEMOTION",target:xM.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_DOWN",target:xM.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_UP",target:xM.EventType,targetName:"SystemEvent.EventType"}]),C.PrivateNode=UP,Dt({BaseNode:{newName:"Node",since:"3.7.0",removed:!1}}),C.find=GP;var HP=be,WP=65536,jP=2048;function qP(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(h<i)r=a+1;else{var u=o._id;if(u>n)s=a-1;else{if(!(u<n))return a;r=a+1}}}return~r}function XP(t,e){for(var i=t.array,n=t.i+1;n<i.length;){var r=i[n];r.node._activeInHierarchy?++n:(t.removeAt(n),e&&(r._objFlags&=~e))}}var YP=function(){function t(t){var e=ye;this._zero=new e([]),this._neg=new e([]),this._pos=new e([]),this._invoke=t}return n(t,[{key:"zero",get:function(){return this._zero}},{key:"neg",get:function(){return this._neg}},{key:"pos",get:function(){return this._pos}}]),t}();function JP(t,e){return t.constructor._executionOrder-e.constructor._executionOrder}YP.stableRemoveInactive=XP;var KP=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.add=function(t){var e=t.constructor._executionOrder;(0===e?this._zero:e<0?this._neg:this._pos).array.push(t)},i.remove=function(t){var e=t.constructor._executionOrder;(0===e?this._zero:e<0?this._neg:this._pos).fastRemove(t)},i.cancelInactive=function(t){XP(this._zero,t),XP(this._neg,t),XP(this._pos,t)},i.invoke=function(){var t=this._neg;t.array.length>0&&(t.array.sort(JP),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(JP),this._invoke(e),e.array.length=0)},e}(YP),QP=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=qP(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=qP(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}(YP);function ZP(t,e,i){var n="var a=it.array;for(it.i=0;it.i<a.length;++it.i){var c=a[it.i];"+t+"}",r=e?Function("it","dt",n):Function("it",n);return $P(Function("c","dt",t),r,i)}function $P(t,e,i){return function(n,r){try{e(n,r)}catch(e){C._throw(e);var s=n.array;for(i&&(s[n.i]._objFlags|=i),++n.i;n.i<s.length;++n.i)try{t(s[n.i],r)}catch(t){C._throw(t),i&&(s[n.i]._objFlags|=i)}}}}var tE=ZP("c.start();c._objFlags|="+WP,!1,WP),eE=ZP("c.update(dt)",!0),iE=ZP("c.lateUpdate(dt)",!0),nE=function(t){var e=C.director._compScheduler,i=t.array;for(t.i=0;t.i<i.length;++t.i){var n=i[t.i];n._enabled&&(n.onEnable(),!n.node._activeInHierarchy||e._onEnabled(n))}},rE=function(){function t(){this._deferredComps=[],this.unscheduleAll()}var e=t.prototype;return e.unscheduleAll=function(){this.startInvoker=new KP(tE),this.updateInvoker=new QP(eE),this.lateUpdateInvoker=new QP(iE),this._updating=!1},e._onEnabled=function(t){C.director.getScheduler().resumeTarget(t),t._objFlags|=jP,this._updating?this._deferredComps.push(t):this._scheduleImmediate(t)},e._onDisabled=function(t){C.director.getScheduler().pauseTarget(t),t._objFlags&=-2049;var e=this._deferredComps.indexOf(t);e>=0?HP(this._deferredComps,e):(!t.internalStart||t._objFlags&WP||this.startInvoker.remove(t),t.internalUpdate&&this.updateInvoker.remove(t),t.internalLateUpdate&&this.lateUpdateInvoker.remove(t))},e.enableComp=function(t,e){if(!(t._objFlags&jP)){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&jP&&(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&WP||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;e<i;e++)this._scheduleImmediate(t[e]);t.length=0},t}(),sE=8192,aE=32768,oE=16384,hE=function(t){function e(e){return t.call(this,e)||this}s(e,t);var i=e.prototype;return i.add=function(t){this._zero.array.push(t)},i.remove=function(t){this._zero.fastRemove(t)},i.cancelInactive=function(t){YP.stableRemoveInactive(this._zero,t)},i.invoke=function(){this._invoke(this._zero),this._zero.array.length=0},e}(YP),uE=ZP("c.__preload();"),lE=ZP("c.onLoad();c._objFlags|="+oE,!1,oE),cE=new ge(4);function fE(t,e,i){ht(3817,t.name,i),X("Corrupted component value:",e),e?t._removeComponent(e):ve(t.getWritableComponents(),i)}cE.get=function(){var t=this._get()||{preload:new hE(uE),onLoad:new KP(lE),onEnable:new KP(nE)};t.preload.zero.i=-1;var e=t.onLoad;return e.zero.i=-1,e.neg.i=-1,e.pos.i=-1,(e=t.onEnable).zero.i=-1,e.neg.i=-1,e.pos.i=-1,t};var _E=t("du",function(){function t(){this.reset()}var e=t.prototype;return e.reset=function(){this._activatingStack=[]},e.activateNode=function(t,e){if(e){var i=cE.get();i&&(this._activatingStack.push(i),this._activateNodeRecursively(t,i.preload,i.onLoad,i.onEnable),i.preload.invoke(),i.onLoad.invoke(),i.onEnable.invoke(),this._activatingStack.pop(),cE.put(i))}else{this._deactivateNodeRecursively(t);for(var n,r=p(this._activatingStack);!(n=r()).done;){var s=n.value;s.preload.cancelInactive(sE),s.onLoad.cancelInactive(aE),s.onEnable.cancelInactive(2048)}}t.emit("active-in-hierarchy-changed",t)},e.activateComp=function(t,e,i,n){if(bo(t,!0)&&(t._objFlags&sE||(t._objFlags|=sE,t.internalPreload&&(e?e.add(t):t.internalPreload())),t._objFlags&aE||(t._objFlags|=aE,t.internalOnLoad?i?i.add(t):(t.internalOnLoad(),t._objFlags|=oE):t._objFlags|=oE),t._enabled)){if(!t.node.activeInHierarchy)return;C.director._compScheduler.enableComp(t,n)}},e.destroyComp=function(t){C.director._compScheduler.disableComp(t),t.internalOnDestroy&&t._objFlags&oE&&t.internalOnDestroy()},e._activateNodeRecursively=function(t,e,i,n){if(256&t._objFlags)ht(3816,t.name);else{t._setActiveInHierarchy(!0);for(var r=t.components.length,s=0;s<r;++s){var a=t.components[s];a instanceof C.Component?this.activateComp(a,e,i,n):(fE(t,a,s),--s,--r)}for(var o=0,h=t.children.length;o<h;++o){var u=t.children[o];u.active&&this._activateNodeRecursively(u,e,i,n)}t._onPostActivated(!0)}},e._deactivateNodeRecursively=function(t){t._objFlags|=256,t._setActiveInHierarchy(!1);for(var e=t.components.length,i=0;i<e;++i){var n=t.components[i];if(n._enabled&&(C.director._compScheduler.disableComp(n),t.activeInHierarchy))return void(t._objFlags&=-257)}for(var r=0,s=t.children.length;r<s;++r){var a=t.children[r];if(a.activeInHierarchy&&(this._deactivateNodeRecursively(a),t.activeInHierarchy))return void(t._objFlags&=-257)}t._onPostActivated(!1),t._objFlags&=-257},t}()),dE=Vi.Attr.DELIMETER+"default",pE=Vi.IDENTIFIER_RE,mE="var ",gE="o",yE={"cc.ClickEvent":!1,"cc.PrefabInfo":!1},vE=Vi.escapeForJS,bE=function(){function t(t,e){this.varName=t,this.expression=e}return t.prototype.toString=function(){return mE+this.varName+"="+this.expression+";"},t}();function SE(t,e){return e instanceof bE?new bE(e.varName,t+e.expression):t+e}function wE(t,e,i){Array.isArray(i)?(i[0]=SE(e,i[0]),t.push(i)):t.push(SE(e,i)+";")}var xE=function(){function t(t){this._exps=[],this._targetExp=t}var e=t.prototype;return e.setTargetExp=function(t){this._targetExp=t},e.append=function(t,e){this._exps.push([t,e])},e.writeCode=function(t){var e;if(this._exps.length>1)t.push("t="+this._targetExp+";"),e="t";else{if(1!==this._exps.length)return;e=this._targetExp}for(var i=0;i<this._exps.length;i++){var n=this._exps[i];wE(t,e+TE(n[0])+"=",n[1])}},t}();function TE(t){return pE.test(t)?"."+t:"["+vE(t)+"]"}xE.pool=new ge((function(t){t._exps.length=0,t._targetExp=null}),1),xE.pool.get=function(t){var e=this._get()||new xE;return e.setTargetExp(t),e};var AE,CE,DE,BE,IE,ME,PE=function(){function t(t,e){var i;this.objsToClear_iN$t=[],this.codeArray=[],this.objs=[],this.funcs=[],this.globalVariables=[],this.globalVariableId=0,this.localVariableId=0,this.parent=e,this.funcModuleCache=Gt(),$t(this.funcModuleCache,yE),this.codeArray.push(mE+gE+",t;","if(R){","o=R;","}else{","o=R=new "+this.getFuncModule(t.constructor,!0)+"();","}"),t._iN$t={globalVar:"R"},this.objsToClear_iN$t.push(t),this.enumerateObject(this.codeArray,t),this.globalVariables.length>0&&(i=mE+this.globalVariables.join(",")+";");var n=Zf(["return (function(R){",i||[],this.codeArray,"return o;","})"]);this.result=Function("O","F",n)(this.objs,this.funcs);for(var r=0,s=this.objsToClear_iN$t.length;r<s;++r)this.objsToClear_iN$t[r]._iN$t=null;this.objsToClear_iN$t.length=0}var e=t.prototype;return e.getFuncModule=function(t,e){var i=Ht(t);if(i){var n=this.funcModuleCache[i];if(n)return n;if(void 0===n){var r=-1!==i.indexOf(".");if(r)try{if(r=t===Function("return "+i)())return this.funcModuleCache[i]=i,i}catch(t){}}}var s=this.funcs.indexOf(t);s<0&&(s=this.funcs.length,this.funcs.push(t));var a="F["+s+"]";return e&&(a="("+a+")"),this.funcModuleCache[i]=a,a},e.getObjRef=function(t){var e=this.objs.indexOf(t);return e<0&&(e=this.objs.length,this.objs.push(t)),"O["+e+"]"},e.setValueType=function(t,e,i,n){var r=xE.pool.get(n),s=e.constructor.__props__;s||(s=Object.keys(e));for(var a=0;a<s.length;a++){var o=s[a],h=i[o];if(e[o]!==h){var u=this.enumerateField(i,o,h);r.append(o,u)}}r.writeCode(t),xE.pool.put(r)},e.enumerateCCClass=function(t,e,i){for(var n=i.__values__,r=Vi.Attr.getClassAttrs(i),s=0;s<n.length;s++){var a=n[s],o=e[a],h=r[a+dE];if(!EE(h,o))if("object"==typeof o&&o instanceof A.ValueType&&(h=Vi.getDefault(h))&&h.constructor===o.constructor){var u=gE+TE(a);this.setValueType(t,h,o,u)}else this.setObjProp(t,e,a,o)}},e.instantiateArray=function(t){if(0===t.length)return"[]";var e="a"+ ++this.localVariableId,i=[new bE(e,"new Array("+t.length+")")];t._iN$t={globalVar:"",source:i},this.objsToClear_iN$t.push(t);for(var n=0;n<t.length;++n)wE(i,e+"["+n+"]=",this.enumerateField(t,n,t[n]));return i},e.instantiateTypedArray=function(t){var e=t.constructor.name;if(0===t.length)return"new "+e;var i="a"+ ++this.localVariableId,n=[new bE(i,"new "+e+"("+t.length+")")];t._iN$t={globalVar:"",source:n},this.objsToClear_iN$t.push(t);for(var r=0;r<t.length;++r)0!==t[r]&&wE(n,i+"["+r+"]=",t[r]);return n},e.enumerateField=function(t,e,i){if("object"==typeof i&&i){var n=i._iN$t;if(n){var r=n.globalVar;if(!r){r=n.globalVar="v"+ ++this.globalVariableId,this.globalVariables.push(r);var s=n.source[0];n.source[0]=SE(r+"=",s)}return r}return ArrayBuffer.isView(i)?this.instantiateTypedArray(i):Array.isArray(i)?this.instantiateArray(i):this.instantiateObj(i)}return"function"==typeof i?this.getFuncModule(i):"string"==typeof i?vE(i):("_objFlags"===e&&vo(t)&&(i&=-4192741),i)},e.setObjProp=function(t,e,i,n){wE(t,gE+TE(i)+"=",this.enumerateField(e,i,n))},e.enumerateObject=function(t,e){var i=e.constructor;if(Ni(i))this.enumerateCCClass(t,e,i);else for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&(95!==n.charCodeAt(0)||95!==n.charCodeAt(1)||"__type__"===n)){var r=e[n];"object"==typeof r&&r&&r===e._iN$t||this.setObjProp(t,e,n,r)}},e.instantiateObj=function(t){if(t instanceof A.ValueType)return Vi.getNewValueTypeCode(t);if(t instanceof A.Asset)return this.getObjRef(t);if(1&t._objFlags)return null;var e,i=t.constructor;if(Ni(i)){if(this.parent)if(this.parent instanceof A.Component){if(t instanceof A.Node||t instanceof A.Component)return this.getObjRef(t)}else if(this.parent instanceof A.Node)if(t instanceof A.Node){if(!t.isChildOf(this.parent))return this.getObjRef(t)}else if(t instanceof A.Component){var n;if(null==(n=t.node)||!n.isChildOf(this.parent))return this.getObjRef(t)}e=new bE(gE,"new "+this.getFuncModule(i,!0)+"()")}else if(i===Object)e=new bE(gE,"{}");else{if(i)return this.getObjRef(t);e=new bE(gE,"Object.create(null)")}var r=[e];return t._iN$t={globalVar:"",source:r},this.objsToClear_iN$t.push(t),this.enumerateObject(r,t),["(function(){",r,"return o;})();"]},t}();function EE(t,e){if("function"==typeof t)try{t=t()}catch(t){return!1}if(t===e)return!0;if(t&&e&&"object"==typeof t&&"object"==typeof e&&t.constructor===e.constructor)if(t instanceof A.ValueType){if(t.equals(e))return!0}else{if(Array.isArray(t))return 0===t.length&&0===e.length;if(t.constructor===Object)return Ft(t)&&Ft(e)}return!1}var OE=Ee({AUTO:0,SINGLE_INSTANCE:1,MULTI_INSTANCE:2}),kE=t("dv",Kh("cc.Prefab")((ME=function(t){function e(){var e;return(e=t.call(this)||this).data=DE&&DE(),e.optimizationPolicy=BE&&BE(),e.persistent=IE&&IE(),e._createFunction=null,e._instantiatedTimes=0,e}s(e,t);var i=e.prototype;return i.createNode=function(t){var e=C.instantiate(this);e.name=this.name,t(null,e)},i.compileCreateFunction=function(){var t,e;this._createFunction=(e=(t=this.data)instanceof A.Node&&t,new PE(t,e).result)},i._doInstantiate=function(t){return this.data._prefab||at(3700),this._createFunction||this.compileCreateFunction(),this._createFunction(t)},i._instantiate=function(){var t;return this.optimizationPolicy!==OE.SINGLE_INSTANCE&&(this.optimizationPolicy===OE.MULTI_INSTANCE||this._instantiatedTimes+1>=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 eb,this.data.name="(Missing Node)";var i=new C._PrefabInfo;i.asset=this,i.root=this.data,this.data._prefab=i},i.validate=function(){return!!this.data},i.onLoaded=function(){var t=this.data;CI(t),TI(t)},e}(Cm),ME.OptimizationPolicy=OE,ME.OptimizationPolicyThreshold=3,DE=zh((CE=ME).prototype,"data",[uu],(function(){return null})),BE=zh(CE.prototype,"optimizationPolicy",[uu],(function(){return OE.AUTO})),IE=zh(CE.prototype,"persistent",[uu],(function(){return!1})),AE=CE))||AE);Vt(kE,"_utils",kI),C.Prefab=kE,Wt(C,"cc._Prefab","Prefab");var RE=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&&(we(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;e<this._dirtyRenderers.length;e++)t[e].updateRenderer();this._dirtyRenderers.length=0,this._dirtyVersion++},t}(),FE=new RE,LE=[".png",".jpg",".bmp",".jpeg",".gif",".ico",".tiff",".webp",".image",".pvr",".pkm",".astc"],VE=[".mp3",".ogg",".wav",".m4a"];function NE(){return!0}var zE={transformURL:function(t){var e=fm(t);if(!e)return t;var i=$p.find((function(t){return!!t.getAssetInfo(e)}));if(!i)return t;var n,r=i.getAssetInfo(e);if(!(n=t.startsWith(i.base+i.config.nativeBase)?r.nativeVer||"":r.ver||"")||-1!==t.indexOf(n))return t;var s=!1;if(".ttf"===Ho(t)&&(s=!0),s){var a=qo(t),o=jo(t);t=a+"."+n+"/"+o}else t=t.replace(/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,})/,(function(t){return t+"."+n}));return t}},UE=t("eg",function(){function t(){this._autoReleaseSetting=Object.create(null),this._parseLoadResArgs=nx}var e=t.prototype;return e.load=function(t,e,i){void 0===i&&void 0!==e&&(i=e,e=null);for(var n=Array.isArray(t)?t:[t],r=0;r<n.length;r++){var s=n[r];"string"==typeof s?n[r]={url:s,__isNative__:!0}:(s.type&&(s.ext="."+s.type,s.type=void 0),s.url&&(s.__isNative__=!0))}var a=[],o=[];fT.loadAny(n,null,(function(t,i,n){n.content&&(LE.includes(n.ext)?a.push(n.content):VE.includes(n.ext)&&o.push(n.content)),e&&e(t,i,n)}),(function(t,e){var r=null;if(!t){e=Array.isArray(e)?e:[e];for(var s=function(t){var i=e[t];if(!(i instanceof Cm)){var r=i,s=n[t].url;a.includes(r)?Hx.create(s,i,".png",{},(function(i,n){r=e[t]=n})):o.includes(r)&&Hx.create(s,i,".mp3",{},(function(i,n){r=e[t]=n})),Kp.add(s,r)}},h=0;h<e.length;h++)s(h);if(e.length>1){var u=Object.create(null);e.forEach((function(t){u[t._uuid]=t})),r={isCompleted:NE,_map:u}}else r=e[0]}i&&i(t,r)}))},e.getXMLHttpRequest=function(){return new XMLHttpRequest},e.getItem=function(t){return fT.assets.has(t)?{content:fT.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=Ho(t);h&&!ox.getInfoWithPath(t,s)&&(t=t.slice(0,-h.length)),ox.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=Ho(e);n&&!ox.getInfoWithPath(e,s)&&(t[i]=e.slice(0,-n.length))})),ox.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;ox.loadDir(t,s,a,(function(e,i){var n=[];e||(n=ox.getDirWithPath(t,s).map((function(t){return t.path}))),o&&o(e,i,n)}))},e.getRes=function(t,e){return Kp.has(t)?Kp.get(t):ox.get(t,e)},e.getResCount=function(){return Kp.count},e.getDependsRecursively=function(t){if(!t)return[];var e="string"==typeof t?t:t._uuid;return Sy.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();Mx.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();Zx.register(e)},e.release=function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++){var i=t[e];"string"==typeof i&&(i=Kp.get(i)),fT.releaseAsset(i)}else t&&("string"==typeof t&&(t=Kp.get(t)),fT.releaseAsset(t))},e.releaseAsset=function(t){fT.releaseAsset(t)},e.releaseRes=function(t,e){ox.release(t,e)},e.releaseAll=function(){fT.releaseAll(),Kp.clear()},e.removeItem=function(t){return!!Kp.remove(t)},e.setAutoRelease=function(t,e){"object"==typeof t&&(t=t._uuid),this._autoReleaseSetting[t]=!!e},e.setAutoReleaseRecursively=function(t,e){"object"==typeof t&&(t=t._uuid),e=!!e,this._autoReleaseSetting[t]=e;for(var i=Sy.getDepsRecursively(t),n=0;n<i.length;n++)this._autoReleaseSetting[i[n]]=e},e.isAutoRelease=function(t){return"object"==typeof t&&(t=t._uuid),!!this._autoReleaseSetting[t]},n(t,[{key:"onProgress",set:function(t){Xw=t}},{key:"_cache",get:function(){if(Kp instanceof Yp)return Kp.map;var t={};return Kp.forEach((function(e,i){t[i]=e})),t}},{key:"md5Pipe",get:function(){return zE}},{key:"downloader",get:function(){return Mx}},{key:"loader",get:function(){return fT.parser}}]),t}()),GE=t("eh",new UE),HE=t("ei",{init:function(t){t.importBase=t.libraryPath,t.nativeBase=t.rawAssetsBase,fT.init(t),t.rawAssets&&ox.init({base:"",deps:[],scenes:{},redirect:[],debug:!0,packs:{},types:[],versions:{import:[],native:[]},name:"resources",importBase:t.importBase,nativeBase:t.nativeBase,paths:t.rawAssets.assets,uuids:Object.keys(t.rawAssets.assets),extensionMap:{}})},loadAsset:function(t,e){fT.loadAny(t,e)}}),WE=t("ej",{});pt(WE,"url",[{name:"normalize",target:fT.utils,targetName:"assetManager.utils",newName:"normalize"},{name:"raw",targetName:"Asset.prototype",newName:"nativeUrl",customFunction:function(t){return t.startsWith("resources/")?mm({path:Xo(t.substring(10)),bundle:"resources",__isNative__:!0,ext:Ho(t)}):""}}]),mt(HE,"AssetLibrary",[{name:"getLibUrlNoExt",suggest:"AssetLibrary.getLibUrlNoExt was removed, if you want to transform url, please use assetManager.utils.getUrlWithUuid instead"},{name:"queryAssetInfo",suggest:"AssetLibrary.queryAssetInfo was removed"}]),mt(GE,"loader",[{name:"releaseResDir",suggest:"loader.releaseResDir was removed, please use assetManager.releaseAsset instead"},{name:"flowInDeps",suggest:"loader.flowInDeps was removed"},{name:"assetLoader",suggest:"loader.assetLoader was removed, assetLoader and md5Pipe were merged into assetManager.transformPipeline"}]),pt(A,"cc",[{name:"loader",newName:"assetManager",logTimes:1,customGetter:function(){return GE}},{name:"AssetLibrary",newName:"assetManager",logTimes:1,customGetter:function(){return HE}},{name:"Pipeline",target:cT,targetName:"AssetManager",newName:"Pipeline",logTimes:1},{name:"url",targetName:"assetManager",newName:"utils",logTimes:1,customGetter:function(){return WE}}]),mt(A,"cc",[{name:"LoadingItems",suggest:ft(1400,"LoadingItems","AssetManager.Task")}]),pt(Ue,"macro",[{name:"DOWNLOAD_MAX_CONCURRENT",target:Mx,targetName:"assetManager.downloader",newName:"maxConcurrency"}]);var jE=qw._autoRelease;qw._autoRelease=function(t,e,i){jE.call(qw,t,e,i);for(var n=GE._autoReleaseSetting,r=Object.keys(n),s=0;s<r.length;s++){var a=r[s];if(!0===n[a]){var o=Kp.get(a);o&&qw.tryRelease(o)}}};var qE=t("dS",{INIT:"director_init",RESET:"director_reset",BEFORE_SCENE_LOADING:"director_before_scene_loading",BEFORE_SCENE_LAUNCH:"director_before_scene_launch",AFTER_SCENE_LAUNCH:"director_after_scene_launch",BEFORE_UPDATE:"director_before_update",AFTER_UPDATE:"director_after_update",BEFORE_DRAW:"director_before_draw",AFTER_DRAW:"director_after_draw",BEFORE_COMMIT:"director_before_commit",BEFORE_RENDER:"director_before_render",AFTER_RENDER:"director_after_render",BEFORE_PHYSICS:"director_before_physics",AFTER_PHYSICS:"director_after_physics",BEGIN_FRAME:"director_begin_frame",END_FRAME:"director_end_frame"}),XE=t("dT",function(t){function e(){var e;return(e=t.call(this)||this)._compScheduler=new rE,e._nodeActivator=new _E,e._invalid=!1,e._paused=!1,e._root=null,e._loadingScene="",e._scene=null,e._totalFrames=0,e._scheduler=new Gf,e._systems=[],e._persistRootNodes={},e}s(e,t);var i=e.prototype;return i.end=function(){var t=this;this.once("director_end_frame",(function(){t.purgeDirector()}))},i.pause=function(){this._paused=!0},i.purgeDirector=function(){this._scheduler.unscheduleAll(),this._compScheduler.unscheduleAll(),this._nodeActivator.reset(),bo(this._scene)&&this._scene.destroy(),this._scene=null,this.stopAnimation(),fT.releaseAll()},i.reset=function(){for(var t in this.purgeDirector(),this._persistRootNodes)this.removePersistRootNode(this._persistRootNodes[t]);var e=this.getScene();e&&e.destroy(),this.emit("director_reset"),this.startAnimation()},i.runSceneImmediate=function(t,e,i){var n=this;t instanceof FI&&(t=t.scene),lt(t instanceof RI,1216),t._load();for(var r=Object.keys(this._persistRootNodes).map((function(t){return n._persistRootNodes[t]})),s=0;s<r.length;s++){var a=r[s];a.emit("scene-changed-for-persists",t.renderScene);var o=t.uuid===a._originalSceneId&&t.getChildByUuid(a.uuid);if(o){var h=o.siblingIndex;a.hideFlags&=-9,a.hideFlags|=8&o.hideFlags,o._destroyImmediate(),t.insertChild(a,h)}else a.hideFlags|=8,a.parent=t}var u=this._scene;bo(u)&&u.destroy(),qw._autoRelease(u,t,this._persistRootNodes),this._scene=null,mo._deferredDestroy(),e&&e(),this.emit("director_before_scene_launch",t),this._scene=t,t._activate(),this._root&&this._root.resetCumulativeTime(),this.startAnimation(),i&&i(null,t),this.emit("director_after_scene_launch",t)},i.runScene=function(t,e,i){var n=this;t instanceof FI&&(t=t.scene),lt(Boolean(t),1205),lt(t instanceof RI,1216),this.once("director_end_frame",(function(){n.runSceneImmediate(t,e,i)}))},i.loadScene=function(t,e,i){var n=this;if(this._loadingScene)return at(1208,t,this._loadingScene),!1;var r=fT.bundles.find((function(e){return!!e.getSceneInfo(t)}));return r?(this.emit("director_before_scene_loading",t),this._loadingScene=t,console.time("LoadScene "+t),r.loadScene(t,(function(r,s){console.timeEnd("LoadScene "+t),n._loadingScene="",r?(J(r),e&&e(r)):n.runSceneImmediate(s,i,e)})),!0):(ht(1209,t),!1)},i.preloadScene=function(t,e,i){var n=fT.bundles.find((function(e){return!!e.getSceneInfo(t)}));if(n)n.preloadScene(t,null,e,i);else{var r='Can not preload the scene "'+t+'" because it is not in the build settings.';i&&i(new Error(r)),J("preloadScene: "+r)}},i.resume=function(){this._paused=!1},i.getScene=function(){return this._scene},i.getDeltaTime=function(){return A.game.deltaTime},i.getTotalTime=function(){return A.game.totalTime},i.getCurrentTime=function(){return A.game.frameStartTime},i.getTotalFrames=function(){return this._totalFrames},i.isPaused=function(){return this._paused},i.getScheduler=function(){return this._scheduler},i.setScheduler=function(t){this._scheduler!==t&&(this.unregisterSystem(this._scheduler),this._scheduler=t,this.registerSystem(Gf.ID,t,200))},i.registerSystem=function(t,e,i){e.id=t,e.priority=i,this._systems.push(e),this._systems.sort(Ff.sortByPriority)},i.unregisterSystem=function(t){we(this._systems,t),this._systems.sort(Ff.sortByPriority)},i.getSystem=function(t){return this._systems.find((function(e){return e.id===t}))},i.getAnimationManager=function(){return this.getSystem(A.AnimationManager.ID)},i.startAnimation=function(){this._invalid=!1},i.stopAnimation=function(){this._invalid=!0},i.mainLoop=function(){var t;t=A.game._calculateDT(!1),this.tick(t)},i.tick=function(t){if(!this._invalid){if(this.emit("director_begin_frame"),wM._frameDispatchEvents(),!this._paused){this.emit("director_before_update"),this._compScheduler.startPhase(),this._compScheduler.updatePhase(t);for(var e=0;e<this._systems.length;++e)this._systems[e].update(t);this._compScheduler.lateUpdatePhase(t),this.emit("director_after_update"),mo._deferredDestroy();for(var i=0;i<this._systems.length;++i)this._systems[i].postUpdate(t)}this.emit("director_before_draw"),FE.updateAllDirtyRenderers(),this._root.frameMove(t),this.emit("director_after_draw"),eb.resetHasChangedFlags(),eb.clearNodeArray(),oo.update(t),this.emit("director_end_frame"),this._totalFrames++}},i.buildRenderPipeline=function(){if(this._root){var t=this._root.customPipeline,e=this._root.cameraList;t.beginSetup();var i=A.rendering.getCustomPipeline(Ue.CUSTOM_PIPELINE_NAME);A.rendering.dispatchResizeEvents(e,i,t),i.setup(e,t),t.endSetup()}},i.setupRenderPipelineBuilder=function(){""!==Ue.CUSTOM_PIPELINE_NAME&&A.rendering&&this._root&&this._root.usesCustomPipeline&&this.on("director_before_scene_launch",A.rendering.forceResizeAllWindows,A.rendering)},i.init=function(){this._totalFrames=0,this._paused=!1,this.registerSystem(Gf.ID,this._scheduler,200),this._root=new zP(Wp.gfxDevice),this._root.initialize({}),this.setupRenderPipelineBuilder();for(var t=0;t<this._systems.length;t++)this._systems[t].init();this.emit("director_init")},i.addPersistRootNode=function(t){if(eb.isNode(t)&&t.uuid){var e=t.uuid;if(!this._persistRootNodes[e]){var i=this._scene;if(bo(i))if(t.parent){if(!(t.parent instanceof RI))return void at(3801);if(t.parent!==i)return void at(3802);t._originalSceneId=i.uuid}else t.parent=i,t._originalSceneId=i.uuid;this._persistRootNodes[e]=t,t._persistNode=!0,qw._addPersistNodeRef(t)}}else at(3800)},i.removePersistRootNode=function(t){var e=t.uuid||"";t===this._persistRootNodes[e]&&(delete this._persistRootNodes[e],t._persistNode=!1,t._originalSceneId="",qw._removePersistNodeRef(t))},i.isPersistRootNode=function(t){return!!t._persistNode},n(e,[{key:"root",get:function(){return this._root}}]),e}(Io));XE.EVENT_INIT="director_init",XE.EVENT_RESET="director_reset",XE.EVENT_BEFORE_SCENE_LOADING="director_before_scene_loading",XE.EVENT_BEFORE_SCENE_LAUNCH="director_before_scene_launch",XE.EVENT_AFTER_SCENE_LAUNCH="director_after_scene_launch",XE.EVENT_BEFORE_UPDATE="director_before_update",XE.EVENT_AFTER_UPDATE="director_after_update",XE.EVENT_BEFORE_DRAW="director_before_draw",XE.EVENT_AFTER_DRAW="director_after_draw",XE.EVENT_BEFORE_COMMIT="director_before_commit",XE.EVENT_BEFORE_RENDER="director_before_render",XE.EVENT_AFTER_RENDER="director_after_render",XE.EVENT_BEFORE_PHYSICS="director_before_physics",XE.EVENT_AFTER_PHYSICS="director_after_physics",XE.EVENT_BEGIN_FRAME="director_begin_frame",XE.EVENT_END_FRAME="director_end_frame",XE.instance=void 0,A.Director=XE,A.DirectorEvent=qE;var YE=t("dU",XE.instance=A.director=new XE);var JE,KE=function(){function t(){var t=this;this._stHandle=0,this._onTick=null,this._targetFrameRate=60,this._frameTime=0,this._startTime=0,this._isPlaying=!1,this._frameCount=0,this._callback=null,this._rAF=void 0,this._cAF=void 0,this._handleRAF=function(){var e=performance.now(),i=e-t._startTime,n=Math.floor(i/t._frameTime);n<0&&(t._startTime=e,t._frameCount=0),n<t._frameCount?t._stHandle=t._rAF.call(window,t._handleRAF):(t._frameCount=n+1,t._callback&&t._callback())},this._frameTime=1e3/this._targetFrameRate,this._rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame,this._cAF=window.cancelAnimationFrame||window.cancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.ocancelAnimationFrame}var e=t.prototype;return e.start=function(){var t=this;if(!this._isPlaying){var e=void 0===this._rAF||x;this._startTime=performance.now(),this._stHandle=this._stTime((function i(){e&&(t._startTime=performance.now()),t._isPlaying&&(t._stHandle=t._stTime(i)),t._onTick&&t._onTick()})),this._isPlaying=!0,this._frameCount=0}},e.stop=function(){this._isPlaying&&(this._ctTime(this._stHandle),this._stHandle=0,this._isPlaying=!1,this._frameCount=0)},e._stTime=function(t){if(void 0===this._rAF){var e=performance.now(),i=Math.max(0,e-this._startTime),n=Math.max(0,this._frameTime-i);return setTimeout(t,n)}return this._callback=t,this._rAF.call(window,this._handleRAF)},e._ctTime=function(t){void 0===this._cAF?clearTimeout(t):t&&this._cAF.call(window,t)},n(t,[{key:"targetFrameRate",get:function(){return this._targetFrameRate},set:function(t){this._targetFrameRate!==t&&(this._targetFrameRate=t,this._frameTime=1e3/this._targetFrameRate,this._isPlaying&&(this.stop(),this.start()))}},{key:"onTick",get:function(){return this._onTick},set:function(t){this._onTick=t}}]),t}(),QE=t("dm",(function(){this.quadIB=null,this.quadVB=null,this.quadIA=null}));mt(Ym.prototype,"TextureBase.prototype",[{name:"hasPremultipliedAlpha"},{name:"setPremultiplyAlpha"},{name:"setFlipY"}]),pt(wP.prototype,"RenderTexture.prototype",[{name:"getGFXWindow",customFunction:function(){return this.window}}]);var ZE=((JE={})[1]="Uint",JE[2]="Int",JE[3]="Uint",JE[4]="Int",JE[5]="Float",JE[6]="Float",JE.default="Uint",JE);function $E(t){return""+(ZE[t.type]||ZE.default)+t.size/t.count*8}function tO(t,e,i,n,r){void 0===i&&(i=11),void 0===n&&(n=0),void 0===r&&(r=0);var s=ip[i];r||(r=s.size);for(var a="set"+$E(s),o=s.size/s.count,h=Math.floor(e.length/s.count),u=hh.isLittleEndian,l=0;l<h;++l)for(var c=n+r*l,f=0;f<s.count;++f){var _=c+o*f;t[a](_,e[s.count*l+f],u)}}function eO(t,e,i,n,r,s){void 0===e&&(e=11),void 0===i&&(i=0),void 0===n&&(n=t.byteLength-i),void 0===r&&(r=0),void 0===s&&(s=[]);var a=ip[e];r||(r=a.size);for(var o="get"+$E(a),h=a.size/a.count,u=Math.floor(n/r),l=hh.isLittleEndian,c=0;c<u;++c)for(var f=i+r*c,_=0;_<a.count;++_){var d=f+h*_;s[a.count*c+_]=t[o](d,l)}return s}function iO(t,e,i,n,r,s,a){void 0===i&&(i=11),void 0===n&&(n=0),void 0===r&&(r=t.byteLength-n),void 0===s&&(s=0),a||(a=new DataView(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)));var o=ip[i];s||(s=o.size);for(var h="set"+$E(o),u="get"+$E(o),l=o.size/o.count,c=Math.floor(r/s),f=hh.isLittleEndian,_=0;_<c;++_)for(var d=n+s*_,p=0;p<o.count;++p){var m=d+l*p,g=t[u](m,f);a[h](m,e(g,p,t),f)}return a}var nO,rO={positions:new Float32Array,indices:new Uint8Array,boundingBox:{min:ir.ZERO,max:ir.ZERO}},sO=t("e0",function(){function t(t,e,i,n,r,s){void 0===n&&(n=null),void 0===r&&(r=null),void 0===s&&(s=!0),this.mesh=void 0,this.subMeshIdx=void 0,this._flatBuffers=[],this._jointMappedBuffers=void 0,this._jointMappedBufferIndices=void 0,this._vertexIdChannel=void 0,this._geometricInfo=void 0,this._vertexBuffers=void 0,this._drawInfo=null,this._attributes=e,this._vertexBuffers=t,this._indexBuffer=n,this._indirectBuffer=r,this._primitiveMode=i,this._iaInfo=new Bd(e,t,n,r),this._isOwnerOfIndexBuffer=s}var e=t.prototype;return e.invalidateGeometricInfo=function(){this._geometricInfo=void 0},e.genFlatBuffers=function(){if(!this._flatBuffers.length&&this.mesh&&void 0!==this.subMeshIdx){var t=this.mesh,e=0,i=t.struct.primitives[this.subMeshIdx];i.indexView&&(e=i.indexView.count);for(var n=0;n<i.vertexBundelIndices.length;n++){var r=i.vertexBundelIndices[n],s=t.struct.vertexBundles[r],a=i.indexView?i.indexView.count:s.view.count,o=s.view.stride,h=o*a,u=new Uint8Array(t.data.buffer,s.view.offset,s.view.length),l=new Uint8Array(i.indexView?h:s.view.length);if(i.indexView){for(var c=t.readIndices(this.subMeshIdx),f=0;f<e;++f)for(var _=f*o,d=c[f]*o,p=0;p<o;++p)l[_+p]=u[d+p];this._flatBuffers.push({stride:o,count:a,buffer:l})}else l.set(t.data.subarray(s.view.offset,s.view.offset+s.view.length)),this._flatBuffers.push({stride:o,count:a,buffer:l})}}},e.destroy=function(){for(var t=0;t<this.vertexBuffers.length;t++)this.vertexBuffers[t].destroy();if(this.vertexBuffers.length=0,this._indexBuffer&&(this._isOwnerOfIndexBuffer&&this._indexBuffer.destroy(),this._indexBuffer=null),this._jointMappedBuffers&&this._jointMappedBufferIndices){for(var e=0;e<this._jointMappedBufferIndices.length;e++)this._jointMappedBuffers[this._jointMappedBufferIndices[e]].destroy();this._jointMappedBuffers=void 0,this._jointMappedBufferIndices=void 0}this._indirectBuffer&&(this._indirectBuffer.destroy(),this._indirectBuffer=null)},e.enableVertexIdChannel=function(t){if(!this._vertexIdChannel){var e=this.vertexBuffers.length,i=this.attributes.length,n=this._allocVertexIdBuffer(t);this._vertexBuffers.push(n),this._attributes.push(new Cd("a_vertexId",11,!1,e)),this._iaInfo.attributes=this._attributes,this._iaInfo.vertexBuffers=this._vertexBuffers,this._vertexIdChannel={stream:e,index:i}}},e._allocVertexIdBuffer=function(t){for(var e=0===this.vertexBuffers.length||0===this.vertexBuffers[0].stride?0:this.vertexBuffers[0].size/this.vertexBuffers[0].stride,i=new Float32Array(e),n=0;n<e;++n)i[n]=n+.5;var r=t.createBuffer(new ud(10,1,i.byteLength,i.BYTES_PER_ELEMENT));return r.update(i),r},n(t,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexBuffers",get:function(){return this._vertexBuffers}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"indirectBuffer",get:function(){return this._indirectBuffer}},{key:"primitiveMode",get:function(){return this._primitiveMode}},{key:"geometricInfo",get:function(){if(this._geometricInfo)return this._geometricInfo;if(void 0===this.mesh)return rO;if(void 0===this.subMeshIdx)return rO;var t,e=this.mesh,i=this.subMeshIdx,n=this.attributes.find((function(t){return"a_position"===t.name}));if(!n)return rO;switch(n.format){case 21:case 32:if(!(t=e.readAttribute(i,"a_position")))return rO;break;case 44:var r=e.readAttribute(i,"a_position");if(!r)return rO;var s=r.length/4;t=new Float32Array(3*s);for(var a=0;a<s;++a){var o=3*a,h=4*a;t[o]=r[h],t[o+1]=r[h+1],t[o+2]=r[h+2]}break;case 18:case 29:var u=e.readAttribute(i,"a_position");if(!u)return rO;t=new Float32Array(u.length);for(var l=0;l<u.length;++l)t[l]=Tn(u[l]);break;case 41:var c=e.readAttribute(i,"a_position");if(!c)return rO;var f=c.length/4;t=new Float32Array(3*f);for(var _=0;_<f;++_){var d=3*_,p=4*_;t[d]=Tn(c[p]),t[d+1]=Tn(c[p+1]),t[d+2]=Tn(c[p+2])}break;default:return rO}var m=e.readIndices(i)||void 0,g=new ir,y=new ir,v=ip[n.format].count;2===v?(g.set(t[0],t[1],0),y.set(t[0],t[1],0)):(g.set(t[0],t[1],t[2]),y.set(t[0],t[1],t[2]));for(var b=0;b<t.length;b+=v)2===v?(g.x=t[b]>g.x?t[b]:g.x,g.y=t[b+1]>g.y?t[b+1]:g.y,y.x=t[b]<y.x?t[b]:y.x,y.y=t[b+1]<y.y?t[b+1]:y.y):(g.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,y.x=t[b]<y.x?t[b]:y.x,y.y=t[b+1]<y.y?t[b+1]:y.y,y.z=t[b+2]<y.z?t[b+2]:y.z);return this._geometricInfo={positions:t,indices:m,boundingBox:{max:g,min:y}},this._geometricInfo}},{key:"drawInfo",get:function(){return this._drawInfo},set:function(t){this._drawInfo=t}},{key:"flatBuffers",get:function(){return this._flatBuffers}},{key:"jointMappedBuffers",get:function(){var t=this;if(this._jointMappedBuffers)return this._jointMappedBuffers;var e=this._jointMappedBuffers=[],i=this._jointMappedBufferIndices=[];if(!this.mesh||void 0===this.subMeshIdx)return this._jointMappedBuffers=this.vertexBuffers;var n,r,s=this.mesh.struct,a=s.primitives[this.subMeshIdx];if(!s.jointMaps||void 0===a.jointMapIndex||!s.jointMaps[a.jointMapIndex])return this._jointMappedBuffers=this.vertexBuffers;for(var o=A.director.root.device,h=function(){var h=s.vertexBundles[a.vertexBundelIndices[u]];r=0,n=0;for(var l=0;l<h.attributes.length;l++){var c=h.attributes[l];if("a_joints"===c.name){n=c.format;break}r+=ip[c.format].size}if(n){var f=new Uint8Array(t.mesh.data.buffer,h.view.offset,h.view.length),_=new DataView(f.slice().buffer),d=s.jointMaps[a.jointMapIndex];iO(_,(function(t){return d.indexOf(t)}),n,r,h.view.length,h.view.stride,_);var p=o.createBuffer(new ud(10,1,h.view.length,h.view.stride));p.update(_.buffer),e.push(p),i.push(u)}else e.push(t.vertexBuffers[a.vertexBundelIndices[u]])},u=0;u<a.vertexBundelIndices.length;u++)h();return this._vertexIdChannel&&e.push(this._allocVertexIdBuffer(o)),e}},{key:"iaInfo",get:function(){return this._iaInfo}}]),t}()),aO=new Kr,oO=new Kr,hO=new Kr,uO=new Kr,lO=new Kr,cO=new Kr,fO=new Kr,_O=new ir(0,0,0),dO=new ir,pO=new ds,mO=new ir,gO=new ir,yO=new ir(1e7,1e7,1e7),vO=new ir(-1e7,-1e7,-1e7),bO=new ir,SO=0,wO=0,xO=function(){function t(t){this._shadowObjects=[],this._shadowCameraFar=0,this._matShadowView=new Kr,this._matShadowProj=new Kr,this._matShadowViewProj=new Kr,this._validFrustum=new Dh,this._splitFrustum=new Dh,this._lightViewFrustum=new Dh,this._castLightViewBoundingBox=new gh,this._level=t,this._validFrustum.accurate=!0,this._splitFrustum.accurate=!0,this._lightViewFrustum.accurate=!0}var e=t.prototype;return e.copyToValidFrustum=function(t){Dh.copy(this._validFrustum,t)},e.calculateValidFrustumOrtho=function(t,e,i,n,r){Dh.createOrtho(this._validFrustum,t,e,i,n,r)},e.calculateSplitFrustum=function(t,e,i,n){this._splitFrustum.split(i,n,t.aspect,t.fov,e)},e.destroy=function(){this._shadowObjects.length=0},e.createMatrix=function(t,e,i){var n=A.director.root.device,r=t.shadowInvisibleOcclusionRange;Dh.copy(this._lightViewFrustum,this._splitFrustum),Kr.fromRT(oO,t.node.rotation,_O),Kr.invert(hO,oO);var s,a,o=hO.clone();this._lightViewFrustum.transform(hO),gh.fromPoints(this._castLightViewBoundingBox,yO,vO),this._castLightViewBoundingBox.mergeFrustum(this._lightViewFrustum),t.csmOptimizationMode===XT.DisableRotationFix?(s=2*this._castLightViewBoundingBox.halfExtents.x,a=2*this._castLightViewBoundingBox.halfExtents.y):s=a=ir.distance(this._lightViewFrustum.vertices[0],this._lightViewFrustum.vertices[6]);var h=A.director.root.pipeline.pipelineSceneData.csmSupported?t.csmLevel:1;if(h>1&&t.csmOptimizationMode===XT.RemoveDuplicates)if(this._level>=h-1)wO=this._castLightViewBoundingBox.halfExtents.z,SO=this._castLightViewBoundingBox.center.z;else{var u=Math.abs(this._castLightViewBoundingBox.center.z-SO)+wO;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(bO.set(c.x,c.y,c.z+l+r),ir.transformMat4(bO,bO,oO),Kr.fromRT(oO,t.node.rotation,bO),Kr.invert(hO,oO),!i){var f=.5*s,_=.5*a;Kr.ortho(uO,-f,f,-_,_,.1,this._shadowCameraFar,n.capabilities.clipSpaceMinZ,n.capabilities.clipSpaceSignY),Kr.multiply(cO,uO,o),ir.transformMat4(dO,bO,cO);var d=2/e;pO.set(d,d);var p=dO.x%pO.x,m=dO.y%pO.y;mO.set(dO.x-p,dO.y-m,dO.z),Kr.invert(fO,cO),ir.transformMat4(gO,mO,fO),Kr.fromRT(oO,t.node.rotation,gO),Kr.invert(hO,oO),Kr.multiply(lO,uO,hO),Kr.copy(this._matShadowView,hO),Kr.copy(this._matShadowProj,uO),Kr.copy(this._matShadowViewProj,lO)}Dh.createOrtho(this._validFrustum,s,a,.1,this._shadowCameraFar,oO)},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}(),TO=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=A.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}(xO),AO=function(){function t(){this._castShadowObjects=[],this._layerObjects=new lo(64),this._layers=[],this._levelCount=0,this._specialLayer=new xO(1),this._shadowDistance=0;for(var t=0;t<qT.LEVEL_4;t++)this._layers[t]=new TO(t)}var e=t.prototype;return e.update=function(t,e){var i=e.scene.mainLight;if(null!==i){var n=t.shadows,r=A.director.root.pipeline.pipelineSceneData.csmSupported?i.csmLevel:1,s=i.shadowDistance;n.enabled&&i.shadowEnabled&&(i.shadowFixedArea?this._updateFixedArea(i):((i.csmNeedUpdate||this._levelCount!==r||this._shadowDistance!==s)&&(this._splitFrustumLevels(i),this._levelCount=r,this._shadowDistance=s),this._calculateCSM(e,i,n)))}},e.destroy=function(){this._castShadowObjects.length=0;for(var t=0;t<this._layers.length;t++)this._layers[t].destroy();this._layers.length=0},e._updateFixedArea=function(t){var e=A.director.root.device,i=t.shadowOrthoSize,n=t.shadowOrthoSize,r=t.shadowNear,s=t.shadowFar;Kr.fromRT(oO,t.node.worldRotation,t.node.worldPosition),Kr.invert(hO,oO),Kr.ortho(uO,-i,i,-n,n,r,s,e.capabilities.clipSpaceMinZ,e.capabilities.clipSpaceSignY),Kr.multiply(lO,uO,hO),this._specialLayer.matShadowView=hO,this._specialLayer.matShadowProj=uO,this._specialLayer.matShadowViewProj=lO,this._specialLayer.calculateValidFrustumOrtho(2*i,2*n,r,s,oO)},e._splitFrustumLevels=function(t){var e=.1,i=t.shadowDistance,n=i/e,r=A.director.root.pipeline.pipelineSceneData.csmSupported?t.csmLevel:1,s=t.csmLayerLambda;this._layers[0].splitCameraNear=e;for(var a=1;a<r;a++){var o=a/r,h=s*e*Math.pow(n,o)+(1-s)*(e+(i-e)*o),u=1.005*h;this._layers[a].splitCameraNear=h,this._layers[a-1].splitCameraFar=u}this._layers[r-1].splitCameraFar=i,t.csmNeedUpdate=!1},e._calculateCSM=function(t,e,i){var n=A.director.root.pipeline.pipelineSceneData.csmSupported?e.csmLevel:1,r=n>1?.5*i.size.x:i.size.x;if(!(r<0)){this._getCameraWorldMatrix(aO,t);for(var s=n-1;s>=0;s--){var a=this._layers[s],o=a.splitCameraNear,h=a.splitCameraFar;a.calculateSplitFrustum(t,aO,o,h),a.createMatrix(e,r,!1)}n===qT.LEVEL_1?(this._specialLayer.shadowCameraFar=this._layers[0].shadowCameraFar,Kr.copy(this._specialLayer.matShadowView,this._layers[0].matShadowView),Kr.copy(this._specialLayer.matShadowProj,this._layers[0].matShadowProj),Kr.copy(this._specialLayer.matShadowViewProj,this._layers[0].matShadowViewProj),this._specialLayer.copyToValidFrustum(this._layers[0].validFrustum)):(this._specialLayer.calculateSplitFrustum(t,aO,.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;Kr.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}(),CO=t("df",function(){function t(){this.fog=new sA,this.ambient=new vb,this.skybox=new eA,this.shadows=new JT,this.csmLayers=new AO,this.octree=new QM,this.skin=new ZM,this.postSettings=new ID,this.lightProbes=A.internal.LightProbes?new A.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 GT,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;r<n.length;++r)this._geometryRendererPasses[t]=n[r],this._geometryRendererShaders[t]=n[r].getShaderVariant(),t++}},e.initOcclusionQuery=function(){if(this._occlusionQueryInputAssembler||(this._occlusionQueryInputAssembler=this._createOcclusionQueryIA()),!this._occlusionQueryMaterial){var t=new GT;t._uuid="default-occlusion-query-material",t.initialize({effectName:"internal/builtin-occlusion-query"}),this._occlusionQueryMaterial=t,t.passes.length>0&&(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 ud(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 ud(6,1,72,2)),this._occlusionQueryIndicesBuffer.update(i);var n=[new Cd("a_position",32)],r=new Bd(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}()),DO=gs(),BO=((nO={})[Ue.ORIENTATION_AUTO]=Ne.AUTO,nO[Ue.ORIENTATION_LANDSCAPE]=Ne.LANDSCAPE,nO[Ue.ORIENTATION_PORTRAIT]=Ne.PORTRAIT,nO),IO=t("h8",function(t){function e(){var e;(e=t.call(this)||this)._designResolutionSize=gs(0,0),e._scaleX=1,e._scaleY=1,e._viewportRect=Ss(),e._visibleRect=Ss(),e._autoFullScreen=!1,e._retinaEnabled=!1,e._resizeCallback=null;var i=MO,n=PO;return e._rpExactFit=new NO(i.EQUAL_TO_FRAME,n.EXACT_FIT),e._rpShowAll=new NO(i.EQUAL_TO_FRAME,n.SHOW_ALL),e._rpNoBorder=new NO(i.EQUAL_TO_FRAME,n.NO_BORDER),e._rpFixedHeight=new NO(i.EQUAL_TO_FRAME,n.FIXED_HEIGHT),e._rpFixedWidth=new NO(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=oh.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,DO.width=this._visibleRect.width,DO.height=this._visibleRect.height,uh.init(this._visibleRect),this.resizeWithBrowserSize(!0);var n=ze.querySettings("screen","designResolution");n&&this.setDesignResolutionSize(Number(n.width),Number(n.height),n.policy||NO.FIXED_HEIGHT),oh.on("window-resize",this._updateAdaptResult,this),oh.on("fullscreen-change",this._updateAdaptResult,this)},i.resizeWithBrowserSize=function(t){sh.handleResizeEvent=t},i.setResizeCallback=function(t){"function"!=typeof t&&null!=t||(this._resizeCallback=t)},i.setOrientation=function(t){sh.orientation=BO[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&&oh.requestFullScreen().catch((function(){})))},i.isAutoFullScreenEnabled=function(){return this._autoFullScreen},i.setCanvasSize=function(t,e){sh.resolutionScale=1;var i=sh.devicePixelRatio,n=new ms(t*i,e*i);oh.windowSize=n},i.getCanvasSize=function(){return oh.windowSize},i.getFrameSize=function(){var t=sh.devicePixelRatio,e=oh.windowSize;return e.width/=t,e.height/=t,e},i.setFrameSize=function(t,e){var i=sh.devicePixelRatio;oh.windowSize=new ms(t*i,e*i)},i.getVisibleSize=function(){return new ms(this._visibleRect.width,this._visibleRect.height)},i.getVisibleSizeInPixel=function(){return new ms(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 NO)this._resolutionPolicy=t;else{var e=NO;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=zO.getDesignResolutionSize();zO.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),DO.width=this._visibleRect.width,DO.height=this._visibleRect.height,uh.init(this._visibleRect),this.emit("design-resolution-changed")}else ht(2200)},i.getDesignResolutionSize=function(){return new ms(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 sh.devicePixelRatio},i.convertToLocationInView=function(t,e,i,n){void 0===n&&(n=new ds);var r=sh.devicePixelRatio*(t-i.left),s=sh.devicePixelRatio*(i.top+i.height-e);return sh.isFrameRotated?(n.x=oh.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){A.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):K(!1,"_updateAdaptResult Invalid size."),this.emit("canvas-resize"),this._resizeCallback&&this._resizeCallback()},e}(Bo(Ff)));IO.instance=void 0;var MO=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=A.game.canvas;if(t){var e=oh.windowSize;t.width!==e.width&&(t.width=e.width),t.height!==e.height&&(t.height=e.height)}},t}();MO.EQUAL_TO_FRAME=void 0,MO.PROPORTION_TO_FRAME=void 0;var PO=function(){function t(){this.name="ContentStrategy",this._result={scale:[1,1],viewport:null},this._strategy=NO.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 bs(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}(),EO=function(t){function e(){var e;return(e=t.call(this)||this).name="EqualToFrame",e}return s(e,t),e.prototype.apply=function(){sh.isProportionalToFrame=!1,this._setupCanvas()},e}(MO),OO=function(t){function e(){var e;return(e=t.call(this)||this).name="ProportionalToFrame",e}return s(e,t),e.prototype.apply=function(){sh.isProportionalToFrame=!0,this._setupCanvas()},e}(MO);MO.EQUAL_TO_FRAME=new EO,MO.PROPORTION_TO_FRAME=new OO;var kO=function(t){function e(){var e;return(e=t.call(this)||this).name="ExactFit",e._strategy=NO.EXACT_FIT,e}return s(e,t),e.prototype.apply=function(t,e){var i=oh.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}(PO),RO=function(t){function e(){var e;return(e=t.call(this)||this).name="ShowAll",e._strategy=NO.SHOW_ALL,e}return s(e,t),e.prototype.apply=function(t,e){var i,n,r=oh.windowSize,s=r.width,a=r.height,o=e.width,h=e.height,u=s/o,l=a/h,c=0;return u<l?(i=s,n=h*(c=u)):(i=o*(c=l),n=a),this._buildResult(s,a,i,n,c,c)},e}(PO),FO=function(t){function e(){var e;return(e=t.call(this)||this).name="NoBorder",e._strategy=NO.NO_BORDER,e}return s(e,t),e.prototype.apply=function(t,e){var i,n,r,s=oh.windowSize,a=s.width,o=s.height,h=e.width,u=e.height,l=a/h,c=o/u;return l<c?(n=h*(i=c),r=o):(n=a,r=u*(i=l)),this._buildResult(a,o,n,r,i,i)},e}(PO),LO=function(t){function e(){var e;return(e=t.call(this)||this).name="FixedHeight",e._strategy=NO.FIXED_HEIGHT,e}return s(e,t),e.prototype.apply=function(t,e){var i=oh.windowSize,n=i.width,r=i.height,s=r/e.height,a=n,o=r;return this._buildResult(n,r,a,o,s,s)},e}(PO),VO=function(t){function e(){var e;return(e=t.call(this)||this).name="FixedWidth",e._strategy=NO.FIXED_WIDTH,e}return s(e,t),e.prototype.apply=function(t,e){var i=oh.windowSize,n=i.width,r=i.height,s=n/e.width,a=n,o=r;return this._buildResult(n,r,a,o,s,s)},e}(PO),NO=t("h9",function(){function t(t,e){this.name="ResolutionPolicy",this._containerStrategy=t,this._contentStrategy=e}var e=t.prototype;return e.preApply=function(t){this._contentStrategy.preApply(t)},e.apply=function(t,e){return this._containerStrategy.apply(t,e),this._contentStrategy.apply(t,e)},e.postApply=function(t){this._contentStrategy.postApply(t)},e.setContainerStrategy=function(t){this._containerStrategy=t},e.setContentStrategy=function(t){this._contentStrategy=t},e.getContentStrategy=function(){return this._contentStrategy},n(t,[{key:"canvasSize",get:function(){return oh.windowSize}}]),t}());NO.EXACT_FIT=0,NO.NO_BORDER=1,NO.SHOW_ALL=2,NO.FIXED_HEIGHT=3,NO.FIXED_WIDTH=4,NO.UNKNOWN=5,NO.ContainerStrategy=MO,NO.ContentStrategy=PO,A.ResolutionPolicy=NO,PO.EXACT_FIT=new kO,PO.SHOW_ALL=new RO,PO.NO_BORDER=new FO,PO.FIXED_HEIGHT=new LO,PO.FIXED_WIDTH=new VO;var zO=t("ha",IO.instance=A.view=new IO);YE.registerSystem("view",zO,0),A.winSize=DO;var UO=new ds;function GO(t,e,i,n){t.setProperty(e,i,n)}var HO=function(){var t=e.prototype;function e(){this.settings=void 0,this._curTime=0,this.device=void 0,this.swapchain=void 0,this.shader=void 0,this.sampler=void 0,this.cmdBuff=void 0,this.quadAssmebler=void 0,this.vertexBuffers=void 0,this.indicesBuffers=void 0,this.renderArea=void 0,this.clearColors=void 0,this.projection=void 0,this.isMobile=!1,this.bgMat=void 0,this.bgImage=void 0,this.bgTexture=void 0,this.logoMat=void 0,this.logoImage=void 0,this.logoTexture=void 0,this.watermarkMat=void 0,this.watermarkTexture=void 0,this.bgWidth=1920,this.bgHeight=1080,this.logoWidthTemp=140,this.logoHeightTemp=200,this.logoWidth=0,this.logoHeight=0,this.logoXTrans=.5,this.logoYTrans=1/6+2.5/6,this.textSize=24,this.textHeight=24,this.textXTrans=.5,this.textYExtraTrans=32,this.textExpandSize=4,this.scaleSize=1}return t.init=function(){var t,e,i,n,r,s,a,o=this,h=NO.SHOW_ALL,u=ze.querySettings("screen","designResolution");if(null!==u&&(h=u.policy),this.settings={policy:null!==(t=h)&&void 0!==t?t:NO.SHOW_ALL,displayRatio:null!==(e=ze.querySettings("splashScreen","displayRatio"))&&void 0!==e?e:.4,totalTime:null!==(i=ze.querySettings("splashScreen","totalTime"))&&void 0!==i?i:3e3,watermarkLocation:null!==(n=ze.querySettings("splashScreen","watermarkLocation"))&&void 0!==n?n:"default",autoFit:null===(r=ze.querySettings("splashScreen","autoFit"))||void 0===r||r,logo:null!==(s=ze.querySettings("splashScreen","logo"))&&void 0!==s?s:void 0,background:null!==(a=ze.querySettings("splashScreen","background"))&&void 0!==a?a:void 0},this._curTime=0,!(this.settings.totalTime<=0||void 0===this.settings.logo||void 0===this.settings.background)){this.device=A.director.root.device,this.swapchain=A.director.root.mainWindow.swapchain,this.preInit(),this.initLayout(),"default"===this.settings.logo.type&&this.initWaterMark();var l=Promise.resolve(),c=Promise.resolve();return"custom"===this.settings.background.type&&(l=new Promise((function(t,e){o.bgImage=new B.Image,o.bgImage.onload=function(){o.initBG(),t()},o.bgImage.onerror=function(){e()},o.bgImage.src=o.settings.background.base64}))),"none"!==this.settings.logo.type&&(c=new Promise((function(t,e){o.logoImage=new B.Image,o.logoImage.onload=function(){o.initLogo(),t()},o.logoImage.onerror=function(){e()},o.logoImage.src=o.settings.logo.base64}))),Promise.all([l,c])}return this.settings.totalTime=0,Promise.resolve([])},t.preInit=function(){var t,e=null==(t=this.settings.background)?void 0:t.color;this.clearColors=e?[new rd(e.x,e.y,e.z,e.w)]:[new rd(0,0,0,1)];var i=this.device,n=this.swapchain,r=i.capabilities;this.renderArea=new K_(0,0,n.width,n.height),this.cmdBuff=i.commandBuffer;var s=new Float32Array([.5,.5,1,0,-.5,.5,0,0,.5,-.5,1,1,-.5,-.5,0,1]);this.vertexBuffers=i.createBuffer(new ud(10,1,64,16)),this.vertexBuffers.update(s);var a=new Uint16Array([0,1,2,1,3,2]);this.indicesBuffers=i.createBuffer(new ud(6,1,12,2)),this.indicesBuffers.update(a);var o=[new Cd("a_position",21),new Cd("a_texCoord",21)],h=new Bd(o,[this.vertexBuffers],this.indicesBuffers);this.quadAssmebler=i.createInputAssembler(h),this.projection=new Kr,Kr.ortho(this.projection,-1,1,-1,1,-1,1,r.clipSpaceMinZ,r.clipSpaceSignY,n.surfaceTransform),this.isMobile=hh.isMobile},t.initLayout=function(){this.isMobile?(this.bgWidth=812,this.bgHeight=375,this.logoWidthTemp=70,this.logoHeightTemp=100,this.textSize=12,this.textHeight=this.textSize+this.textExpandSize,this.textXTrans=.5,this.textYExtraTrans=16):(this.bgWidth=1920,this.bgHeight=1080,this.logoWidthTemp=140,this.logoHeightTemp=200,this.textSize=24,this.textHeight=this.textSize+this.textExpandSize,this.textXTrans=.5,this.textYExtraTrans=32),this.logoXTrans=.5,this.logoYTrans=1/6+2.5/6,this.initScale()},t.initScale=function(){var t=this.swapchain.width,e=this.swapchain.height,i=this.isMobile?375:1080,n=this.isMobile?812:1920;if(t>e){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;Kr.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=nl(tn(this._curTime/e.totalTime)),h=1,u=1,l=this.bgImage;if("custom"===e.background.type){e.policy===NO.FIXED_WIDTH?(h=s,u=s/l.width*l.height):e.policy===NO.FIXED_HEIGHT?(h=a/l.height*l.width,u=a):e.policy===NO.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===NO.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;GO(c,"resolution",UO.set(s,a),0),GO(c,"scale",UO.set(h,u),0),GO(c,"translate",UO.set(.5*s,.5*a),0),GO(c,"percent",1),GO(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 _=this.logoMat;GO(_,"resolution",UO.set(s,a),0),GO(_,"scale",UO.set(h,u),0),GO(_,"translate",UO.set(s*this.logoXTrans,f),0),GO(_,"percent",o),GO(_,"u_projection",this.projection),_.passes[0].update()}if("default"===this.settings.logo.type&&this.watermarkMat){var d=this.watermarkTexture.width,p=this.watermarkTexture.height;h=d,u=p;var m=f-(.5*this.logoHeight*e.displayRatio+this.textYExtraTrans)*this.scaleSize-.5*p,g=this.watermarkMat;GO(g,"resolution",UO.set(s,a),0),GO(g,"scale",UO.set(h,u),0),GO(g,"translate",UO.set(s*this.textXTrans,m),0),GO(g,"percent",o),GO(g,"u_projection",this.projection),g.passes[0].update()}this.frame()},t.initBG=function(){var t=this.device;this.bgMat=new GT,this.bgMat.initialize({effectName:"util/splash-screen"});var e=new md;e.addressU=2,e.addressV=2,e.addressW=2,this.sampler=t.getSampler(e),this.bgTexture=t.createTexture(new dd(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 id,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 GT,this.logoMat.initialize({effectName:"util/splash-screen"});var e=new md;e.addressU=2,e.addressV=2,e.addressW=2,this.sampler=t.getSampler(e),this.logoTexture=t.createTexture(new dd(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 id,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=B.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 id,s=r.texExtent;s.width=t.width,s.height=t.height,s.depth=1,this.watermarkTexture=this.device.createTexture(new dd(1,6,35,t.width,t.height)),this.device.copyTexImagesToTexture([t],this.watermarkTexture,[r]),this.watermarkMat=new GT,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,!hh.isXR||xr.entry.isRenderAllowable())for(var o=hh.isXR?2:1,h=0;h<o;h++){t.enableAutoBarrier(!0),t.acquire([e]);var u=this.cmdBuff,l=A.director.root.mainWindow.framebuffer,c=this.renderArea;if(c.width=e.width,c.height=e.height,u.begin(),u.beginRenderPass(l.renderPass,l,c,this.clearColors,1,0),A.director.root.pipeline,"custom"===s.background.type){var f=i.passes[0],_=AT.getOrCreatePipelineState(t,f,this.shader,l.renderPass,a);u.bindPipelineState(_),u.bindDescriptorSet(1,f.descriptorSet),u.bindInputAssembler(a),u.draw(a)}if("none"!==s.logo.type){var d=n.passes[0],p=AT.getOrCreatePipelineState(t,d,this.shader,l.renderPass,a);u.bindPipelineState(p),u.bindDescriptorSet(1,d.descriptorSet),u.bindInputAssembler(a),u.draw(a)}if("default"===s.logo.type&&r){var m=this.watermarkMat.passes[0],g=AT.getOrCreatePipelineState(t,m,this.shader,l.renderPass,a);u.bindPipelineState(g),u.bindDescriptorSet(1,m.descriptorSet),u.bindInputAssembler(a),u.draw(a)}u.endRenderPass(),u.end(),t.flushCommands([u]),t.queue.submit([u]),t.present(),t.enableAutoBarrier(!C.rendering)}},t.destroy=function(){this.device=null,this.swapchain=null,this.clearColors=null,this.bgImage&&(this.bgImage.destroy&&this.bgImage.destroy(),this.bgImage=null),this.bgMat&&(this.bgMat.destroy(),this.bgMat=null),this.bgTexture&&(this.bgTexture.destroy(),this.bgTexture=null),this.logoImage&&(this.logoImage.destroy&&this.logoImage.destroy(),this.logoImage=null),this.logoMat&&(this.logoMat.destroy(),this.logoMat=null),this.logoTexture&&(this.logoTexture.destroy(),this.logoTexture=null),this.renderArea=null,this.cmdBuff=null,this.shader=null,this.quadAssmebler&&(this.quadAssmebler.destroy(),this.quadAssmebler=null),this.vertexBuffers&&(this.vertexBuffers.destroy(),this.vertexBuffers=null),this.indicesBuffers&&(this.indicesBuffers.destroy(),this.indicesBuffers=null),this.sampler=null,this.watermarkMat&&(this.watermarkMat.destroy(),this.watermarkMat=null),this.watermarkTexture&&(this.watermarkTexture.destroy(),this.watermarkTexture=null),this.settings=null},e.createInstance=function(){return e._ins=new e,e._ins},e.releaseInstance=function(){e._ins&&(e._ins.destroy(),e._ins=null)},n(e,[{key:"isFinished",get:function(){return this._curTime>=this.settings.totalTime}},{key:"curTime",get:function(){return this._curTime},set:function(t){this._curTime=t}}],[{key:"instance",get:function(){return e._ins}}]),e}();HO._ins=null,A.internal.SplashScreen=HO;var WO=new(function(){function t(){this._data=null}return t.prototype.init=function(t){var e=this;return void 0===t&&(t=""),C.rendering&&C.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}());C.effectSettings=WO;var jO=ze.querySettings.bind(ze),qO=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 Fo,e.onPostBaseInitDelegate=new Fo,e.onPreInfrastructureInitDelegate=new Fo,e.onPostInfrastructureInitDelegate=new Fo,e.onPreSubsystemInitDelegate=new Fo,e.onPostSubsystemInitDelegate=new Fo,e.onPreProjectInitDelegate=new Fo,e.onPostProjectInitDelegate=new Fo,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(){YE.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&&(wM._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){YE.once("director_end_frame",(function(){return t()}))})).then((function(){YE.reset(),A.Object._deferredDestroy(),t.pause(),t.resume(),t._shouldLoadLaunchScene=!0})).then((function(){return HO.createInstance().init()})).then((function(){t._safeEmit(i.EVENT_RESTART)}))},r.end=function(){Vo.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 hh.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,oh.init(),Jf.init(),Wp.init(n.canvas,Cb)})).then((function(){if(jO("rendering","customPipeline")){if(!A.rendering)return void ht(12109);Ue.CUSTOM_PIPELINE_NAME||(Ue.CUSTOM_PIPELINE_NAME="Builtin")}else A.rendering=void 0;fT.init(),mT.init(),Ly.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 WO.init(jO("rendering","effectSettingsPath"))})).then((function(){if(A.rendering&&A.rendering.enableEffectImport)if(3!==jO("rendering","renderMode")){var t=WO.data;null!==t?A.rendering.init(Wp.gfxDevice,t):ht(1102)}else A.rendering.init(Wp.gfxDevice,null)})).then((function(){var t=jO("scripting","scriptPackages");return t?Promise.all(t.map((function(t){return e.import(t)}))):Promise.resolve([])})).then((function(){return YE.init(),mT.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=jO("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 mT.compileBuiltinMaterial(),HO.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=jO("assets","preloadAssets");return t?Promise.all(t.map((function(t){return new Promise((function(e,i){fT.loadAny(t,(function(t){t?i(t):e()}))}))}))):Promise.resolve([])},r._loadCCEScripts=function(){return new Promise((function(t){t()}))},r._loadProjectBundles=function(){var t=jO("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),fT.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(HO.instance&&!HO.instance.isFinished)HO.instance.update(this._calculateDT(!1));else if(this._shouldLoadLaunchScene){HO.releaseInstance(),this._shouldLoadLaunchScene=!1;var e,i=jO("launch","launchScene");i?YE.loadScene(i,(function(){it(1103,i),t._initTime=performance.now(),YE.startAnimation(),null==t.onStart||t.onStart()})):(this._initTime=performance.now(),YE.startAnimation(),null==(e=this.onStart)||e.call(this))}else YE.tick(this._calculateDT(!1))},r.initPacer=function(){var t,e=null!==(t=jO("screen","frameRate"))&&void 0!==t?t:60;K("number"==typeof e),this._pacer=new KE,this._pacer.onTick=this._updateCallback.bind(this),this.frameRate=e},r._initEvents=function(){Vo.on("show",this._onShow,this),Vo.on("hide",this._onHide,this),Vo.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),Vo.exit()},r.addPersistRootNode=function(t){YE.addPersistRootNode(t)},r.removePersistRootNode=function(t){YE.removePersistRootNode(t)},r.isPersistRootNode=function(t){return YE.isPersistRootNode(t)},r._setupRenderPipeline=function(){var t=jO("rendering","customPipeline");return this._setRenderPipeline(!!t)},r._setRenderPipeline=function(t){YE.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));qO.EVENT_HIDE="game_on_hide",qO.EVENT_SHOW="game_on_show",qO.EVENT_LOW_MEMORY="game_on_low_memory",qO.EVENT_GAME_INITED="game_inited",qO.EVENT_ENGINE_INITED="engine_inited",qO.EVENT_RENDERER_INITED="renderer_inited",qO.EVENT_PRE_BASE_INIT="pre_base_init",qO.EVENT_POST_BASE_INIT="post_base_init",qO.EVENT_PRE_INFRASTRUCTURE_INIT="pre_infrastructure_init",qO.EVENT_POST_INFRASTRUCTURE_INIT="post_infrastructure_init",qO.EVENT_PRE_SUBSYSTEM_INIT="pre_subsystem_init",qO.EVENT_POST_SUBSYSTEM_INIT="post_subsystem_init",qO.EVENT_PRE_PROJECT_INIT="pre_project_init",qO.EVENT_POST_PROJECT_INIT="post_project_init",qO.EVENT_RESTART="game_on_restart",qO.EVENT_PAUSE="game_on_pause",qO.EVENT_RESUME="game_on_resume",qO.EVENT_CLOSE="game_on_close",qO.RENDER_TYPE_CANVAS=0,qO.RENDER_TYPE_WEBGL=1,qO.RENDER_TYPE_OPENGL=2,qO.RENDER_TYPE_HEADLESS=3,qO.DEBUG_DT_THRESHOLD=1,A.Game=qO;var XO=t("dW",A.game=new qO);gt(XE.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(XE.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(YE,"director",[{name:"_getSceneUuid",targetName:"assetManager.main",newName:"getSceneInfo",customFunction:function(t){var e;return fT.main?null==(e=fT.main.getSceneInfo(t))?void 0:e.uuid:""}}]),gt(XO,"game",[{name:"collisionMatrix"},{name:"groupList"}]),pt(XO,"game",[{name:"_sceneInfos",targetName:"assetManager.main",newName:"getSceneInfo",customGetter:function(){var t=[];return fT.main&&fT.main.config.scenes.forEach((function(e){t.push(e)})),t}}]);var YO=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=new ky(this._textureSize,this._textureSize),this._atlases.push(t)),t},i.beforeSceneLoad=function(){this.reset()},i.init=function(){this.enabled=!Ue.CLEANUP_IMAGE_CACHE},i.insertSpriteFrame=function(t){if(!this._enabled||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<this._maxAtlasCount?(i=this.newAtlas())?i.insertSpriteFrame(t):null:n},i.reset=function(){for(var t=0,e=this._atlases.length;t<e;t++)this._atlases[t].destroy();this._atlases.length=0,this._atlasIndex=-1},i.deleteAtlasSpriteFrame=function(t){if(t.original){for(var e=this._atlases.length-1;e>=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(),YE.on("director_before_scene_launch",this.beforeSceneLoad,this)):(this.reset(),YE.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}(Ff));YO.instance=void 0;var JO=t("a5",YO.instance=new YO);YE.registerSystem("dynamicAtlasManager",JO,0),A.internal.dynamicAtlasManager=JO;var KO={positions:"a_position",normals:"a_normal",uvs:"a_texCoord",colors:"a_color"},QO=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 ZO(t,e){return new $O(t,e)}var $O=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;n<i;++n){var r=this._mesh.struct.morph.subMeshMorphs[n];r&&(r.targets.length>60?this._subMeshRenderings[n]=new ek(this._mesh,n,this._mesh.struct.morph,e):this._subMeshRenderings[n]=new tk(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<e;++n){var r,s;i[n]=null!==(r=null==(s=this._subMeshRenderings[n])?void 0:s.createInstance())&&void 0!==r?r:null}return{setWeights:function(t,e){var n;null==(n=i[t])||n.setWeights(e)},requiredPatches:function(e){t._mesh.struct.morph;var n=t._mesh.struct.morph.subMeshMorphs[e],r=i[e];if(null===r)return null;var s=[{name:"CC_USE_MORPH",value:!0},{name:"CC_MORPH_TARGET_COUNT",value:n.targets.length}];return n.attributes.includes("a_position")&&s.push({name:"CC_MORPH_TARGET_HAS_POSITION",value:!0}),n.attributes.includes("a_normal")&&s.push({name:"CC_MORPH_TARGET_HAS_NORMAL",value:!0}),n.attributes.includes("a_tangent")&&s.push({name:"CC_MORPH_TARGET_HAS_TANGENT",value:!0}),s.push.apply(s,r.requiredPatches()),s},adaptPipelineState:function(t,e){var n;null==(n=i[t])||n.adaptPipelineState(e)},destroy:function(){i.forEach((function(t){t&&t.destroy()}))}}},t}(),tk=function(){function t(t,e,i,n){this._gfxDevice=n;var r=i.subMeshMorphs[e];this._subMeshMorph=r,sk(t,e,n);var s=t.struct.vertexBundles[t.struct.primitives[e].vertexBundelIndices[0]].view.count;this._verticesCount=s;var a=r.targets.length,o=rk(n,s*a);this._textureInfo={width:o.width,height:o.height},this._attributes=r.attributes.map((function(e,i){var n=o.create(),a=n.valueView;return r.targets.forEach((function(e,n){for(var r=e.displacements[i],o=new Float32Array(t.data.buffer,t.data.byteOffset+r.offset,r.count),h=s*n*4,u=0;u<s;++u)a[h+4*u+0]=o[3*u+0],a[h+4*u+1]=o[3*u+1],a[h+4*u+2]=o[3*u+2]})),n.updatePixels(),{name:e,morphTexture:n}}))}var e=t.prototype;return e.destroy=function(){this._attributes.forEach((function(t){t.morphTexture.destroy()}))},e.createInstance=function(){var t=this,e=new nk(this._gfxDevice,this._subMeshMorph.targets.length);return e.setMorphTextureInfo(this._textureInfo.width,this._textureInfo.height),e.setVerticesCount(this._verticesCount),e.commit(),{setWeights:function(t){e.setWeights(t),e.commit()},requiredPatches:function(){return[{name:"CC_MORPH_TARGET_USE_TEXTURE",value:!0}]},adaptPipelineState:function(i){for(var n=0;n<t._attributes.length;++n){var r=t._attributes[n],s=void 0;switch(r.name){case"a_position":s=8;break;case"a_normal":s=9;break;case"a_tangent":s=10;break;default:at(16374)}void 0!==s&&(i.bindSampler(s,r.morphTexture.sampler),i.bindTexture(s,r.morphTexture.texture))}i.bindBuffer(eS.BINDING,e.buffer),i.update()},destroy:function(){}}},t}(),ek=function(){function t(t,e,i,n){this._attributes=[],this._gfxDevice=n;var r=i.subMeshMorphs[e];sk(t,e,n),this._attributes=r.attributes.map((function(e,i){return{name:e,targets:r.targets.map((function(e){return{displacements:new Float32Array(t.data.buffer,t.data.byteOffset+e.displacements[i].offset,e.displacements[i].count)}}))}}))}return t.prototype.createInstance=function(){return new ik(this,this._attributes[0].targets[0].displacements.length/3,this._gfxDevice)},n(t,[{key:"data",get:function(){return this._attributes}}]),t}(),ik=function(){function t(t,e,i){this._owner=t,this._morphUniforms=new nk(i,0);var n=rk(i,e);this._morphUniforms.setMorphTextureInfo(n.width,n.height),this._morphUniforms.commit(),this._attributes=this._owner.data.map((function(t){var e=n.create();return{attributeName:t.name,morphTexture:e}}))}var e=t.prototype;return e.setWeights=function(t){for(var e=0;e<this._attributes.length;++e){var i=this._attributes[e],n=i.morphTexture.valueView,r=this._owner.data[e];t.length,r.targets.length;for(var s=0;s<r.targets.length;++s){var a=r.targets[s].displacements,o=t[s],h=a.length/3;if(0===s)for(var u=0;u<h;++u)n[4*u+0]=a[3*u+0]*o,n[4*u+1]=a[3*u+1]*o,n[4*u+2]=a[3*u+2]*o;else if(0!==o)for(var l=0;l<h;++l)n[4*l+0]+=a[3*l+0]*o,n[4*l+1]+=a[3*l+1]*o,n[4*l+2]+=a[3*l+2]*o}i.morphTexture.updatePixels()}},e.requiredPatches=function(){return[{name:"CC_MORPH_TARGET_USE_TEXTURE",value:!0},{name:"CC_MORPH_PRECOMPUTED",value:!0}]},e.adaptPipelineState=function(t){for(var e=0;e<this._attributes.length;++e){var i=this._attributes[e],n=void 0;switch(i.attributeName){case"a_position":n=8;break;case"a_normal":n=9;break;case"a_tangent":n=10;break;default:at(16374)}void 0!==n&&(t.bindSampler(n,i.morphTexture.sampler),t.bindTexture(n,i.morphTexture.texture))}t.bindBuffer(eS.BINDING,this._morphUniforms.buffer),t.update()},e.destroy=function(){this._morphUniforms.destroy();for(var t=0;t<this._attributes.length;++t)this._attributes[t].morphTexture.destroy()},t}(),nk=function(){function t(t,e){this._targetCount=e,this._localBuffer=new DataView(new ArrayBuffer(256)),this._remoteBuffer=t.createBuffer(new ud(18,3,256,256))}var e=t.prototype;return e.destroy=function(){this._remoteBuffer.destroy()},e.setWeights=function(t){t.length,this._targetCount;for(var e=A.sys.isLittleEndian,i=0;i<t.length;++i)this._localBuffer.setFloat32(0+4*i,t[i],e)},e.setMorphTextureInfo=function(t,e){var i=A.sys.isLittleEndian;this._localBuffer.setFloat32(240,t,i),this._localBuffer.setFloat32(244,e,i)},e.setVerticesCount=function(t){var e=A.sys.isLittleEndian;this._localBuffer.setFloat32(248,t,e)},e.commit=function(){this._remoteBuffer.update(this._localBuffer.buffer)},n(t,[{key:"buffer",get:function(){return this._remoteBuffer}}]),t}();function rk(t,e){var i,n,r,s;2&t.getFormatFeatures(44)?(i=e,r=16,n=44,s=Float32Array):(i=4*e,r=4,n=35,s=Uint8Array);var a=ak(i),o=a.width,h=a.height;return{width:o,height:h,create:function(){var e=new ArrayBuffer(o*h*r),i=new Float32Array(e),a=s===Float32Array?i:new s(e),u=new Hm({width:o,height:h,_data:a,_compressed:!1,format:n}),l=new Ey;l.setFilters(1,1),l.setMipFilter(0),l.setWrapMode(2,2,2),l.image=u,l.getGFXTexture()||at(16375);var c=t.getSampler(l.getSamplerInfo());return{get texture(){return l.getGFXTexture()},get sampler(){return c},get valueView(){return i},destroy:function(){l.destroy()},updatePixels:function(){l.uploadData(a)}}}}}function sk(t,e,i){t.renderingSubMeshes[e].enableVertexIdChannel(i)}function ak(t){t<5&&(t=5);var e=E(fn(t)),i=e>>1;return{width:1<<(1&e?i+1:i),height:1<<i}}function ok(t,e){return hk(t).then((function(t){return WebAssembly.instantiate(t,e)}))}function hk(t){return new Promise((function(i,n){try{t=new URL(t,e.meta.url).href,fetch(t).then((function(t){return t.arrayBuffer().then(i)})).catch((function(){}))}catch(t){n(t)}}))}function uk(){return Promise.resolve()}var lk={},ck={};(function(){function t(t){throw t}var e=void 0,i=this;function n(t,n){var r,s=t.split("."),a=i;!(s[0]in a)&&a.execScript&&a.execScript("var "+s[0]);for(;s.length&&(r=s.shift());)s.length||n===e?a=a[r]?a[r]:a[r]={}:a[r]=n}var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;function s(t){var e,i,n,s,a,o,h,u,l,c,f=t.length,_=0,d=Number.POSITIVE_INFINITY;for(u=0;u<f;++u)t[u]>_&&(_=t[u]),t[u]<d&&(d=t[u]);for(e=1<<_,i=new(r?Uint32Array:Array)(e),n=1,s=0,a=2;n<=_;){for(u=0;u<f;++u)if(t[u]===n){for(o=0,h=s,l=0;l<n;++l)o=o<<1|1&h,h>>=1;for(c=n<<16|u,l=o;l<e;l+=a)i[l]=c;++s}++n,s<<=1,a<<=1}return[i,_,d]}function a(e,i){switch(this.g=[],this.h=32768,this.d=this.f=this.a=this.j=0,this.input=r?new Uint8Array(e):e,this.k=!1,this.e=h,this.o=!1,!i&&(i={})||(i.index&&(this.a=i.index),i.bufferSize&&(this.h=i.bufferSize),i.bufferType&&(this.e=i.bufferType),i.resize&&(this.o=i.resize)),this.e){case o:this.b=32768,this.c=new(r?Uint8Array:Array)(32768+this.h+258);break;case h:this.b=0,this.c=new(r?Uint8Array:Array)(this.h);break;default:t(Error("invalid inflate mode"))}}var o=0,h=1,u={q:o,p:h};a.prototype.i=function(){for(;!this.k;){var i=B(this,3);switch(1&i&&(this.k=!0),i>>>=1){case 0:var n=this.input,a=this.a,u=this.c,l=this.b,c=n.length,f=e,d=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=d-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=O(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,A,D);break;case o:M(this,A,D);break;default:t(Error("invalid inflate mode"))}break;case 2:var m,g,y,v,b=B(this,5)+257,S=B(this,5)+1,w=B(this,4)+4,x=new(r?Uint8Array:Array)(_.length),T=e,C=e,k=e,R=e,F=e;for(F=0;F<w;++F)x[_[F]]=B(this,3);if(!r)for(F=w,w=x.length;F<w;++F)x[_[F]]=0;for(m=s(x),T=new(r?Uint8Array:Array)(b+S),F=0,v=b+S;F<v;)switch(C=I(this,m),C){case 16:for(R=3+B(this,2);R--;)T[F++]=k;break;case 17:for(R=3+B(this,3);R--;)T[F++]=0;k=0;break;case 18:for(R=11+B(this,7);R--;)T[F++]=0;k=0;break;default:k=T[F++]=C}switch(g=s(r?T.subarray(0,b):T.slice(0,b)),y=s(r?T.subarray(b):T.slice(b)),this.e){case h:P(this,g,y);break;case o:M(this,g,y);break;default:t(Error("invalid inflate mode"))}break;default:t(Error("unknown BTYPE: "+i))}}switch(this.e){case o:var L,V,N,z,U,G,H=0,W=this.c,j=this.g,q=new(r?Uint8Array:Array)(this.j+(this.b-32768));if(0===j.length)L=r?this.c.subarray(32768,this.b):this.c.slice(32768,this.b);else{for(N=0,z=j.length;N<z;++N)for(U=0,G=(V=j[N]).length;U<G;++U)q[H++]=V[U];for(N=32768,z=this.b;N<z;++N)q[H++]=W[N];this.g=[],L=this.buffer=q}return L;case h:var X,Y=this.b;return r?this.o?(X=new Uint8Array(Y)).set(this.c.subarray(0,Y)):X=this.c.subarray(0,Y):(this.c.length>Y&&(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],_=r?new Uint16Array(f):f,d=[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(d):d,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,y=[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],v=r?new Uint16Array(y):y,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,w=new(r?Uint8Array:Array)(288);for(l=0,c=w.length;l<c;++l)w[l]=143>=l?8:255>=l?9:279>=l?7:8;var x,T,A=s(w),C=new(r?Uint8Array:Array)(30);for(x=0,T=C.length;x<T;++x)C[x]=5;var D=s(C);function B(e,i){var n,r=e.f,s=e.d,a=e.input,o=e.a;for(o+(i-s+7>>3)>=a.length&&t(Error("input buffer is broken"));s<i;)r|=a[o++]<<s,s+=8;return n=r&(1<<i)-1,e.f=r>>>i,e.d=s-i,e.a=o,n}function I(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<c&&!(h>=u);)s|=o[h++]<<a,a+=8;return(r=(n=l[s&(1<<c)-1])>>>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=I(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<g[a]&&(h+=B(t,g[a])),s=I(t,i),o=v[s],0<S[s]&&(o+=B(t,S[s])),r>=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=I(t,e));)if(256>s)r>=u&&(u=(n=O(t)).length),n[r++]=s;else for(h=p[a=s-257],0<g[a]&&(h+=B(t,g[a])),s=I(t,i),o=v[s],0<S[s]&&(o+=B(t,S[s])),r+h>u&&(u=(n=O(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;e<i;++e)n[e]=a[e+32768];if(t.g.push(n),t.j+=n.length,r)a.set(a.subarray(s,s+32768));else for(e=0;32768>e;++e)a[e]=a[s+e];return t.b=32768,a}function O(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)<h.length?h.length+s:h.length<<1:h.length*a,r?(i=new Uint8Array(n)).set(h):i=h,t.c=i,t.c}function k(e,i){var n,r;this.input=e,this.a=0,!i&&(i={})||(i.index&&(this.a=i.index),i.verify&&(this.s=i.verify)),n=e[this.a++],r=e[this.a++],(15&n)===R?this.method=R:t(Error("unsupported compression method")),0!=((n<<8)+r)%31&&t(Error("invalid fcheck flag:"+((n<<8)+r)%31)),32&r&&t(Error("fdict flag is not supported")),this.n=new a(e,{index:this.a,bufferSize:i.bufferSize,bufferType:i.bufferType,resize:i.resize})}k.prototype.i=function(){var e,i,n=this.input;if(e=this.n.i(),this.a=this.n.a,this.s){i=(n[this.a++]<<24|n[this.a++]<<16|n[this.a++]<<8|n[this.a++])>>>0;var r=e;if("string"==typeof r){var s,a,o=r.split("");for(s=0,a=o.length;s<a;s++)o[s]=(255&o[s].charCodeAt(0))>>>0;r=o}for(var h,u=1,l=0,c=r.length,f=0;0<c;){c-=h=1024<c?1024:c;do{l+=u+=r[f++]}while(--h);u%=65521,l%=65521}i!==(l<<16|u)>>>0&&t(Error("invalid adler-32 checksum"))}return e};var R=8;n("Zlib.Inflate",k),n("Zlib.Inflate.prototype.decompress",k.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<N;++V)n("Zlib.Inflate.BufferType."+(L=F[V]),z[L])}).call(ck);var fk,_k,dk,pk,mk,gk=ck.Zlib;gk.Inflate=gk.Inflate,gk.Inflate.BufferType=gk.Inflate.BufferType,gk.Inflate.prototype.decompress=gk.Inflate.prototype.decompress;var yk=ir.add,vk=ir.multiplyScalar,bk=ir.subtract,Sk=gh.transform,wk=gh.fromPoints,xk=ir.max,Tk=ir.min,Ak=ir.transformQuat,Ck=ir.transformMat4;function Dk(t){switch(t){case 1:default:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array}}var Bk=new ir,Ik=new ir,Mk=new Uint8Array,Pk=t("aa",Kh("cc.Mesh")((_k=function(t){function e(e){var i;return(i=t.call(this,e)||this).morphRendering=null,i._struct=dk&&dk(),i._hash=pk&&pk(),i._data=Mk,i._initialized=!1,i._allowDataAccess=mk&&mk(),i._isMeshDataUploaded=!1,i._renderingSubMeshes=null,i._boneSpaceBounds=new Map,i._jointBufferIndices=null,i}s(e,t);var i=e.prototype;return i.onLoaded=function(){this.initialize()},i.initialize=function(){if(!this._initialized){this._initialized=!0;var t={struct:this.struct,data:this.data};if(t.struct.compressed&&(t=Vk(t)),this.struct.encoded&&(t=Lk(t)),!this.struct.quantized||16&Wp.gfxDevice.getFormatFeatures(29)||(t=Nk(t)),this._struct=t.struct,this._data=t.data,this._struct.dynamic){for(var e=Wp.gfxDevice,i=[],n=[],r=0;r<this._struct.vertexBundles.length;r++){var s=this._struct.vertexBundles[r],a=e.createBuffer(new ud(10,1,s.view.length,s.view.stride));i.push(a)}for(var o=0;o<this._struct.primitives.length;o++){var h=this._struct.primitives[o],u=h.indexView,l=null;u&&(l=e.createBuffer(new ud(6,1,u.length,u.stride)));for(var c=[],f=0;f<h.vertexBundelIndices.length;f++){var _=h.vertexBundelIndices[f];c.push(i[_])}for(var d=[],p=0;p<h.vertexBundelIndices.length;p++)for(var m=h.vertexBundelIndices[p],g=this._struct.vertexBundles[m].attributes,y=0;y<g.length;y++){var v=g[y],b=new Cd;b.copy(v),d.push(b)}var S=new sO(c,d,h.primitiveMode,l);S.drawInfo=new cd,S.mesh=this,S.subMeshIdx=o,n.push(S)}this._renderingSubMeshes=n}else{for(var w=this._data.buffer,x=Wp.gfxDevice,T=this._createVertexBuffers(x,w),A=[],C=[],D=0;D<this._struct.primitives.length;D++){var B=this._struct.primitives[D];if(0!==B.vertexBundelIndices.length){var I=null,M=void 0;if(B.indexView){var P=B.indexView,E=P.stride,O=P.length;if(4===E&&!x.hasFeature(0)){var k=this._struct.vertexBundles[B.vertexBundelIndices[0]].view.count;if(k>=65536){at(10001,k,65536);continue}E>>=1,O>>=1}I=x.createBuffer(new ud(4,1,O,E)),A.push(I),M=new(Dk(P.stride))(w,P.offset,P.count),P.stride!==E&&(M=Dk(E).from(M)),I.update(M)}var R=B.vertexBundelIndices.map((function(t){return T[t]})),F=[];if(B.vertexBundelIndices.length>0)for(var L=B.vertexBundelIndices[0],V=this._struct.vertexBundles[L].attributes,N=0;N<V.length;++N){var z=V[N];F[N]=new Cd(z.name,z.format,z.isNormalized,z.stream,z.isInstanced,z.location)}var U=new sO(R,F,B.primitiveMode,I);U.mesh=this,U.subMeshIdx=D,C.push(U)}}this._renderingSubMeshes=C,this._struct.morph&&(this.morphRendering=ZO(this,x)),this._isMeshDataUploaded=!0,this._allowDataAccess||this.releaseData()}}},i.updateSubMesh=function(t,e){if(this._struct.dynamic)if(t>=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;n<e.customAttributes.length;n++)i.push(e.customAttributes[n].values);for(var r=this._struct.dynamic,s=r.info,a=this._struct.primitives[t],o=this._renderingSubMeshes[t],h=o.drawInfo,u=0;u<i.length;u++){var l=i[u],c=this._struct.vertexBundles[a.vertexBundelIndices[u]],f=c.view.stride,_=l.byteLength/f,d=l.byteLength,p=new Uint8Array(this._data.buffer,c.view.offset,d),m=new Uint8Array(l.buffer,l.byteOffset,d),g=o.vertexBuffers[u];s.maxSubMeshVertices,d>0&&(p.set(m),g.update(m,d)),c.view.count=_,h.vertexCount=_}if(a.indexView){var y=a.indexView,v=y.stride,b=2===v?e.indices16.length:e.indices32.length,S=b*v,w=new Uint8Array(this._data.buffer,y.offset,S),x=2===v?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&&(w.set(x),T.update(x,S)),y.count=b,h.indexCount=b}if(e.minPos&&e.maxPos){var A=nr(e.minPos.x,e.minPos.y,e.minPos.z),C=nr(e.maxPos.x,e.maxPos.y,e.maxPos.z);r.bounds[t]||(r.bounds[t]=new gh),wk(r.bounds[t],A,C);var D=nr(),B=nr();r.bounds.forEach((function(t){t&&(t.getBoundary(D,B),Tk(A,D,A),xk(C,B,C))})),this._struct.minPosition=nr(A.x,A.y,A.z),this._struct.maxPosition=nr(C.x,C.y,C.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<this._renderingSubMeshes.length;t++)this._renderingSubMeshes[t].destroy();this._renderingSubMeshes=null,this._initialized=!1,this._isMeshDataUploaded=!1}},i.assign=function(t,e){this.reset({struct:t,data:e})},i.reset=function(t){this.destroyRenderingMesh(),this._struct=t.struct,this._data=t.data,this._hash=0},i.getBoneSpaceBounds=function(t){if(this._boneSpaceBounds.has(t.hash))return this._boneSpaceBounds.get(t.hash);var e=[];this._boneSpaceBounds.set(t.hash,e);for(var i=[],n=t.bindposes,r=0;r<n.length;r++)e.push(new gh(1/0,1/0,1/0,-1/0,-1/0,-1/0)),i.push(!1);for(var s=this._struct.primitives,a=0;a<s.length;a++){var o=this.readAttribute(a,"a_joints"),h=this.readAttribute(a,"a_weights"),u=this.readAttribute(a,"a_position");if(o&&h&&u)for(var l=Math.min(o.length/4,h.length/4,u.length/3),c=0;c<l;c++){ir.set(Bk,u[3*c+0],u[3*c+1],u[3*c+2]);for(var f=0;f<4;++f){var _=4*c+f,d=o[_];if(!(0===h[_]||d>=n.length)){Ck(Ik,Bk,n[d]),i[d]=!0;var p=e[d];Tk(p.center,p.center,Ik),xk(p.halfExtents,p.halfExtents,Ik)}}}}for(var m=0;m<n.length;m++){var g=e[m];i[m]?wk(g,g.center,g.halfExtents):e[m]=null}return e},i.merge=function(t,e,i){if(i&&!this.validateMergingMesh(t))return!1;var n=new ir,r=e&&new kr,s=e&&new gh;if(r&&e.getRotation(r),!this._initialized){var a=JSON.parse(JSON.stringify(t._struct)),o=t._data.slice();if(e){a.maxPosition&&a.minPosition&&(yk(s.center,a.maxPosition,a.minPosition),vk(s.center,s.center,.5),bk(s.halfExtents,a.maxPosition,a.minPosition),vk(s.halfExtents,s.halfExtents,.5),Sk(s,s,e),yk(a.maxPosition,s.center,s.halfExtents),bk(a.minPosition,s.center,s.halfExtents));for(var h=0;h<a.vertexBundles.length;h++)for(var u=a.vertexBundles[h],l=0;l<u.attributes.length;l++)if("a_position"===u.attributes[l].name||"a_normal"===u.attributes[l].name){var c=u.attributes[l].format,f=new DataView(o.buffer,u.view.offset+Ek(u.attributes,l)),_=Rk(f,c),d=Fk(f,c);if(!_||!d)continue;for(var m=u.view.count,g=u.view.stride,y=kk(c),v=0;v<m;v++){var b=v*g,S=b+y,w=S+y;switch(n.set(_(b),_(S),_(w)),u.attributes[l].name){case"a_position":n.transformMat4(e);break;case"a_normal":Ak(n,n,r)}d(b,n.x),d(S,n.y),d(w,n.z)}}}return this.reset({struct:a,data:o}),this.initialize(),!0}for(var x,T,A,C,D,B=new QO,I=0,M=0,P=0,E=0,O=0,k=0,R=0,F=0,L=!1,V=new Array(this._struct.vertexBundles.length),N=0;N<this._struct.vertexBundles.length;++N){var z=this._struct.vertexBundles[N],U=t._struct.vertexBundles[N];P=z.view.offset,E=U.view.offset,M=z.view.stride,I=z.view.count+U.view.count,x=new ArrayBuffer(I*M),T=new Uint8Array(x),P+=(A=this._data.subarray(P,P+z.view.length)).length,E+=(C=t._data.subarray(E,E+U.view.length)).length,T.set(A),O=0;for(var G,H=p(z.attributes);!(G=H()).done;){var W=G.value;R=0,L=!1;for(var j,q=p(U.attributes);!(j=q()).done;){var X=j.value;if(W.name===X.name&&W.format===X.format){L=!0;break}R+=ip[X.format].size}if(L){F=ip[W.format].size,k=z.view.length+O;for(var Y=0;Y<U.view.count;++Y){if(D=C.subarray(R,R+F),T.set(D,k),("a_position"===W.name||"a_normal"===W.name)&&e){var J=new Float32Array(T.buffer,k,3);switch(n.set(J[0],J[1],J[2]),W.name){case"a_position":n.transformMat4(e);break;case"a_normal":Ak(n,n,r)}J[0]=n.x,J[1]=n.y,J[2]=n.z}k+=z.view.stride,R+=U.view.stride}}O+=ip[W.format].size}V[N]={attributes:z.attributes,view:{offset:B.getLength(),length:x.byteLength,count:I,stride:M}},B.addBuffer(x)}for(var K,Q,Z,$=0,tt=2,et=new Array(this._struct.primitives.length),it=0;it<this._struct.primitives.length;++it){var nt=this._struct.primitives[it],rt=t._struct.primitives[it];et[it]={primitiveMode:nt.primitiveMode,vertexBundelIndices:nt.vertexBundelIndices};for(var st,at=0,ot=p(nt.vertexBundelIndices);!(st=ot()).done;){var ht=st.value;at=Math.max(at,this._struct.vertexBundles[ht].view.count)}if(nt.indexView&&rt.indexView){$=nt.indexView.count,$+=rt.indexView.count,P=nt.indexView.offset,E=rt.indexView.offset,tt=$<256?1:$<65536?2:4;var ut=new ArrayBuffer($*tt);if(K=2===tt?new Uint16Array(ut):1===tt?new Uint8Array(ut):new Uint32Array(ut),Q=2===nt.indexView.stride?new Uint16Array(this._data.buffer,P,nt.indexView.count):1===nt.indexView.stride?new Uint8Array(this._data.buffer,P,nt.indexView.count):new Uint32Array(this._data.buffer,P,nt.indexView.count),tt===nt.indexView.stride)K.set(Q);else for(var lt=0;lt<nt.indexView.count;++lt)K[lt]=Q[lt];P+=nt.indexView.length,Z=2===rt.indexView.stride?new Uint16Array(t._data.buffer,E,rt.indexView.count):1===rt.indexView.stride?new Uint8Array(t._data.buffer,E,rt.indexView.count):new Uint32Array(t._data.buffer,E,rt.indexView.count);for(var ct=0;ct<rt.indexView.count;++ct)K[nt.indexView.count+ct]=at+Z[ct];E+=rt.indexView.length,et[it].indexView={offset:B.getLength(),length:ut.byteLength,count:$,stride:tt},B.setNextAlignment(tt),B.addBuffer(ut)}}var ft={vertexBundles:V,primitives:et,minPosition:this._struct.minPosition,maxPosition:this._struct.maxPosition};return ft.minPosition&&t._struct.minPosition&&ft.maxPosition&&t._struct.maxPosition&&(e?(yk(s.center,t._struct.maxPosition,t._struct.minPosition),vk(s.center,s.center,.5),bk(s.halfExtents,t._struct.maxPosition,t._struct.minPosition),vk(s.halfExtents,s.halfExtents,.5),Sk(s,s,e),yk(n,s.center,s.halfExtents),xk(ft.maxPosition,ft.maxPosition,n),bk(n,s.center,s.halfExtents),Tk(ft.minPosition,ft.minPosition,n)):(Tk(ft.minPosition,ft.minPosition,t._struct.minPosition),xk(ft.maxPosition,ft.maxPosition,t._struct.maxPosition))),this.reset({struct:ft,data:new Uint8Array(B.getCombined())}),this.initialize(),!0},i.validateMergingMesh=function(t){if(this._struct.dynamic||t._struct.dynamic)return!1;if(this._struct.vertexBundles.length!==t._struct.vertexBundles.length)return!1;for(var e=0;e<this._struct.vertexBundles.length;++e){var i=this._struct.vertexBundles[e],n=t._struct.vertexBundles[e];if(i.attributes.length!==n.attributes.length)return!1;for(var r=0;r<i.attributes.length;++r)if(i.attributes[r].format!==n.attributes[r].format)return!1}if(this._struct.primitives.length!==t._struct.primitives.length)return!1;for(var s=0;s<this._struct.primitives.length;++s){var a=this._struct.primitives[s],o=t._struct.primitives[s];if(a.vertexBundelIndices.length!==o.vertexBundelIndices.length)return!1;for(var h=0;h<a.vertexBundelIndices.length;++h)if(a.vertexBundelIndices[h]!==o.vertexBundelIndices[h])return!1;if(a.primitiveMode!==o.primitiveMode)return!1;if(a.indexView){if(void 0===o.indexView)return!1}else if(o.indexView)return!1}return!0},i.readAttribute=function(t,e){var i=this,n=null;return this._accessAttribute(t,e,(function(t,e){var r=t.view.count,s=t.attributes[e].format,a=cp(ip[s]);if(0!==r){var o=new DataView(i._data.buffer,t.view.offset+Ek(t.attributes,e)),h=ip[s],u=Rk(o,s);if(a&&u){for(var l=h.count,c=new a(r*l),f=t.view.stride,_=0;_<r;++_)for(var d=0;d<l;++d)c[l*_+d]=u(f*_+c.BYTES_PER_ELEMENT*d);n=c}}})),n},i.copyAttribute=function(t,e,i,n,r){var s=this,a=!1;return this._accessAttribute(t,e,(function(t,e){var o=t.view.count;if(0!==o){var h=t.attributes[e].format,u=new DataView(s._data.buffer,t.view.offset+Ek(t.attributes,e)),l=new DataView(i,r),c=ip[h],f=Rk(u,h),_=Fk(l,h);if(f&&_){for(var d=c.count,p=t.view.stride,m=kk(h),g=n,y=m,v=0;v<o;++v)for(var b=0;b<d;++b)_(g*v+y*b,f(p*v+m*b));a=!0}}else a=!0})),a},i.readIndices=function(t){if(t>=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=Rk(new DataView(this._data.buffer),r),a=0;a<n;++a)e[a]=s(i.indexView.offset+ip[r].size*a);return!0},i.readAttributeFormat=function(t,e){var i=null;return this._accessAttribute(t,e,(function(t,e){var n=t.attributes[e].format;i=ip[n]})),i},i._accessAttribute=function(t,e,i){if(!(t>=this._struct.primitives.length))for(var n=this._struct.primitives[t].vertexBundelIndices,r=0;r<n.length;r++){var s=n[r],a=this._struct.vertexBundles[s],o=a.attributes.findIndex((function(t){return t.name===e}));if(!(o<0)){i(a,o);break}}},i._createVertexBuffers=function(t,e){return this._struct.vertexBundles.map((function(i){var n=t.createBuffer(new ud(8,1,i.view.length,i.view.stride)),r=new Uint8Array(e,i.view.offset,i.view.length);return n.update(r),n}))},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.reset({struct:{vertexBundles:[],primitives:[]},data:Mk})},i.releaseData=function(){this._data=Mk},n(e,[{key:"_nativeAsset",get:function(){return this._data.buffer},set:function(t){this._data=new Uint8Array(t)}},{key:"subMeshCount",get:function(){var t=this.renderingSubMeshes;return t?t.length:0}},{key:"minPosition",get:function(){return this.struct.minPosition}},{key:"maxPosition",get:function(){return this.struct.maxPosition}},{key:"struct",get:function(){return this._struct}},{key:"data",get:function(){return this._data}},{key:"hash",get:function(){return this._hash||(this._hash=qf(this._data,666)),this._hash}},{key:"jointBufferIndices",get:function(){return this._jointBufferIndices?this._jointBufferIndices:this._jointBufferIndices=this._struct.primitives.map((function(t){return t.jointMapIndex||0}))}},{key:"renderingSubMeshes",get:function(){return this.initialize(),this._renderingSubMeshes}},{key:"allowDataAccess",get:function(){return this._allowDataAccess},set:function(t){this._allowDataAccess=t,this._isMeshDataUploaded&&!this._allowDataAccess&&this.releaseData()}}]),e}(Cm),dk=zh(_k.prototype,"_struct",[uu],(function(){return{vertexBundles:[],primitives:[]}})),pk=zh(_k.prototype,"_hash",[uu],(function(){return 0})),mk=zh(_k.prototype,"_allowDataAccess",[uu],(function(){return!0})),fk=_k))||fk);function Ek(t,e){for(var i=0,n=0;n<e;++n){var r=t[n];i+=ip[r.format].size}return i}A.Mesh=Pk;var Ok=hh.isLittleEndian;function kk(t){var e=ip[t];return e.size/e.count}function Rk(t,e){var i=ip[e],n=i.size/i.count;switch(i.type){case 1:case 3:switch(n){case 1:return function(e){return t.getUint8(e)};case 2:return function(e){return t.getUint16(e,Ok)};case 4:return function(e){return t.getUint32(e,Ok)}}break;case 2:case 4:switch(n){case 1:return function(e){return t.getInt8(e)};case 2:return function(e){return t.getInt16(e,Ok)};case 4:return function(e){return t.getInt32(e,Ok)}}break;case 6:switch(n){case 2:return function(e){return t.getUint16(e,Ok)};case 4:return function(e){return t.getFloat32(e,Ok)}}}return null}function Fk(t,e){var i=ip[e],n=i.size/i.count;switch(i.type){case 1:case 3:switch(n){case 1:return function(e,i){return t.setUint8(e,i)};case 2:return function(e,i){return t.setUint16(e,i,Ok)};case 4:return function(e,i){return t.setUint32(e,i,Ok)}}break;case 2:case 4:switch(n){case 1:return function(e,i){return t.setInt8(e,i)};case 2:return function(e,i){return t.setInt16(e,i,Ok)};case 4:return function(e,i){return t.setInt32(e,i,Ok)}}break;case 6:switch(n){case 2:return function(e,i){return t.setUint16(e,i,Ok)};case 4:return function(e,i){return t.setFloat32(e,i,Ok)}}}return null}function Lk(t){if(!t.struct.encoded)return t;var e=function(t){t<0&&ht(14204,t)},i=JSON.parse(JSON.stringify(t.struct)),n=new QO;n.setNextAlignment(0);for(var r,s=p(i.vertexBundles);!(r=s()).done;){var a=r.value,o=a.view,h=o.count*o.stride,u=new Uint8Array(h),l=new Uint8Array(t.data.buffer,o.offset,o.length);e(lk.decodeVertexBuffer(u,o.count,o.stride,l)),n.setNextAlignment(o.stride);var c={offset:n.getLength(),length:u.byteLength,count:o.count,stride:o.stride};a.view=c,n.addBuffer(u)}for(var f,_=p(i.primitives);!(f=_()).done;){var d=f.value;if(void 0!==d.indexView){var m=d.indexView,g=m.count*m.stride,y=new Uint8Array(g),v=new Uint8Array(t.data.buffer,m.offset,m.length);e(lk.decodeIndexBuffer(y,m.count,m.stride,v)),n.setNextAlignment(m.stride);var b={offset:n.getLength(),length:y.byteLength,count:m.count,stride:m.stride};d.indexView=b,n.addBuffer(y)}}return{struct:i,data:new Uint8Array(n.getCombined())}}function Vk(t){var e=new gk.Inflate(t.data).decompress();return t.data=e,t.struct.compressed=!1,t}function Nk(t){var e=JSON.parse(JSON.stringify(t.struct)),i=new QO;function n(t,e,i,n,r,s,a){for(var o=0;o<i;o++)for(var h=0;h<n;h++)e(a*o+r*h,t(s*o+r*h))}function r(t,e,i,n,r,s){for(var a=0;a<i;a++)for(var o=0;o<n;o++)e(s*a+4*o,Tn(t(r*a+2*o)))}i.setNextAlignment(0);for(var s=0;s<e.vertexBundles.length;++s){for(var a=e.vertexBundles[s],o=a.view,h=a.attributes,u=t.struct.vertexBundles[s].attributes,l=[],c=[],f=[],_=0;_<h.length;++_){var d=h[_],m=Rk(new DataView(t.data.buffer,o.offset+Ek(u,_)),d.format),g=!0;switch(d.format){case 8:d.format=11;break;case 18:d.format=21;break;case 29:d.format=32;break;case 41:d.format=44;break;default:g=!1}l.push(ip[d.format].size),c.push(g),f.push(m)}for(var y=l.reduce((function(t,e){return t+e}),0),v=new Uint8Array(y*o.count),b=0;b<h.length;++b){var S=h[b],w=f[b],x=Fk(new DataView(v.buffer,Ek(h,b)),S.format),T=c[b],A=ip[S.format];T?r(w,x,o.count,A.count,o.stride,y):n(w,x,o.count,A.count,A.size/A.count,o.stride,y)}i.setNextAlignment(y);var C={offset:i.getLength(),length:v.byteLength,count:o.count,stride:y};a.view=C,i.addBuffer(v)}for(var D,B=p(e.primitives);!(D=B()).done;){var I=D.value;if(void 0!==I.indexView){var M=I.indexView,P=new Uint8Array(t.data.buffer,M.offset,M.length);i.setNextAlignment(M.stride);var E={offset:i.getLength(),length:P.byteLength,count:M.count,stride:M.stride};I.indexView=E,i.addBuffer(P)}}var O=new Uint8Array(i.getCombined());return e.quantized=!1,{struct:e,data:O}}var zk=[new Cd("a_position",32),new Cd("a_normal",32),new Cd("a_texCoord",21),new Cd("a_tangent",44),new Cd("a_color",44)],Uk=new ir;function Gk(t,e,i){i=i||{};var n,r=[],s=0,a=[],o=0,h=t.positions.slice();if(h.length>0){n=null,t.attributes&&(n=t.attributes.find((function(t){return"a_position"===t.name}))||null),n||(n=zk[0]),r.push(n);var u=ip[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=zk[1]);var l=ip[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=zk[2]);var c=ip[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=zk[3]);var f=ip[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=zk[4]);var _=ip[n.format];r.push(n),o=Math.max(o,Math.floor(t.colors.length/_.count)),a.push({offset:s,data:t.colors,attribute:n}),s+=_.size}if(t.customAttributes)for(var d=0;d<t.customAttributes.length;d++){var p=t.customAttributes[d],m=ip[p.attr.format];r.push(p.attr),o=Math.max(o,Math.floor(p.values.length/m.count)),a.push({offset:s,data:p.values,attribute:p.attr}),s+=m.size}var g=new QO,y=new ArrayBuffer(o*s),v=new DataView(y);a.forEach((function(t){tO(v,t.data,t.attribute.format,t.offset,s)})),g.setNextAlignment(0);var b={attributes:r,view:{offset:g.getLength(),length:y.byteLength,count:o,stride:s}};g.addBuffer(y);var S=null,w=0;if(t.indices){var x=t.indices;w=x.length,S=new ArrayBuffer(2*w),tO(new DataView(S),x,9)}var T={primitiveMode:t.primitiveMode||7,vertexBundelIndices:[0]};S&&(g.setNextAlignment(2),T.indexView={offset:g.getLength(),length:S.byteLength,count:w,stride:2},g.addBuffer(S));var A=t.minPos;if(!A&&i.calculateBounds){A=ir.set(new ir,1/0,1/0,1/0);for(var C=0;C<o;++C)ir.set(Uk,h[3*C+0],h[3*C+1],h[3*C+2]),ir.min(A,A,Uk)}var D=t.maxPos;if(!D&&i.calculateBounds){D=ir.set(new ir,-1/0,-1/0,-1/0);for(var B=0;B<o;++B)ir.set(Uk,h[3*B+0],h[3*B+1],h[3*B+2]),ir.max(D,D,Uk)}var I={vertexBundles:[b],primitives:[T]};return A&&(I.minPosition=new ir(A.x,A.y,A.z)),D&&(I.maxPosition=new ir(D.x,D.y,D.z)),e||(e=new Pk),e.reset({struct:I,data:new Uint8Array(g.getCombined())}),e}function Hk(t,e){if(e>0){var i=t%e;if(0!==i)return e-i}return 0}function Wk(t,e,i,n){n=n||{maxSubMeshes:1,maxSubMeshVertices:1024,maxSubMeshIndices:1024};var r=[],s=0;if(e.positions.length>0&&r.push(new Cd("a_position",32,!1,s++,!1,0)),e.normals&&e.normals.length>0&&r.push(new Cd("a_normal",32,!1,s++,!1,0)),e.uvs&&e.uvs.length>0&&r.push(new Cd("a_texCoord",21,!1,s++,!1,0)),e.tangents&&e.tangents.length>0&&r.push(new Cd("a_tangent",44,!1,s++,!1,0)),e.colors&&e.colors.length>0&&r.push(new Cd("a_color",44,!1,s++,!1,0)),e.customAttributes)for(var a=0;a<e.customAttributes.length;a++){var o=e.customAttributes[a],h=new Cd;h.copy(o.attr),h.stream=s++,r.push(h)}for(var u=[],l=[],c=0,f=0;f<n.maxSubMeshes;f++){for(var _,d={vertexBundelIndices:[],primitiveMode:e.primitiveMode||7},m=p(r);!(_=m()).done;){var g=_.value,y=ip[g.format],v=n.maxSubMeshVertices*y.size,b={view:{offset:c,length:v,count:0,stride:y.size},attributes:[g]},S=u.length;d.vertexBundelIndices.push(S),u.push(b),c+=v}var w=0;if(e.indices16&&e.indices16.length>0?w=2:e.indices32&&e.indices32.length>0&&(w=4),w>0){c+=Hk(c,w);var x=n.maxSubMeshIndices*w,T={offset:c,length:x,count:0,stride:w};d.indexView=T,c+=x}l.push(d)}var A={info:{maxSubMeshes:n.maxSubMeshes,maxSubMeshVertices:n.maxSubMeshVertices,maxSubMeshIndices:n.maxSubMeshIndices},bounds:[]};A.bounds.length=n.maxSubMeshes;var C={struct:{vertexBundles:u,primitives:l,dynamic:A},data:new Uint8Array(c)};return i||(i=new Pk),i.reset(C),i.initialize(),i.updateSubMesh(t,e),i}var jk,qk,Xk=function(){function t(){}return t.createMesh=function(t,e,i){return Gk(t,e,i)},t.createDynamicMesh=function(t,e,i,n){return Wk(t,e,i,n)},t.decodeMesh=function(t){return Lk(t)},t.inflateMesh=function(t){return Vk(t)},t}(),Yk=Object.freeze({__proto__:null,MeshUtils:Xk,createMesh:Gk,find:GP,mapBuffer:iO,readBuffer:eO,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=KO[t.name];e&&(i[e]=(i[e]||[]).concat(eO(n,t.format,s,o,h))),s+=ip[t.format].size}))}));var a=s.indexView;return i.indices=eO(n,s_["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:tO});t("a8",Yk);var Jk,Kk,Qk,Zk=nr(),$k=$r(),tR=ir.transformMat4,eR=ir.toArray,iR=[{u:0,v:0},{u:0,v:0},{u:0,v:0},{u:0,v:0}],nR=(t("b",{UV_UPDATED:"uv_updated"}),t("c",Kh("cc.SpriteFrame")((qk=function(t){function e(e){var i;return(i=t.call(this,e)||this).vertices=null,i.uv=[],i.unbiasUV=[],i.uvSliced=[],i._rect=Ss(),i._trimmedBorder=Nn(),i._offset=ps(),i._originalSize=gs(),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=ps(.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 Hm?t:new Hm(t),n=new Ey;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&&JO&&JO.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){iR[0].u=e.x/r,iR[1].u=(e.x+l)/r,iR[2].u=(e.x+l+c)/r,iR[3].u=(e.x+e.height)/r,iR[3].v=e.y/s,iR[2].v=(e.y+a)/s,iR[1].v=(e.y+a+h)/s,iR[0].v=(e.y+e.width)/s;for(var _=0;_<4;++_)for(var d=iR[_],p=0;p<4;++p){var m=iR[3-p];f.push({u:d.u,v:m.v})}}else{iR[0].u=e.x/r,iR[1].u=(e.x+a)/r,iR[2].u=(e.x+a+h)/r,iR[3].u=(e.x+e.width)/r,iR[3].v=e.y/s,iR[2].v=(e.y+u)/s,iR[1].v=(e.y+u+c)/s,iR[0].v=(e.y+e.height)/s;for(var g=0;g<4;++g)for(var y=iR[g],v=0;v<4;++v){var b=iR[v];f.push({u:b.u,v:y.v})}}this.emit("uv_updated",this)},i._calculateUV=function(){var t=Ae,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,_=0===a?1:(i.x+i.height)/a,d=0===o?0:i.y/o,p=0===o?1:(i.y+i.width)/o;e._isFlipUVX&&e._isFlipUVY?t(r,_,p,_,d,f,p,f,d):e._isFlipUVX?t(r,_,d,_,p,f,d,f,p):e._isFlipUVY?t(r,f,p,f,d,_,p,_,d):t(r,f,d,f,p,_,d,_,p)}else{var m=0===a?0:i.x/a,g=0===a?1:(i.x+i.width)/a,y=0===o?1:(i.y+i.height)/o,v=0===o?0:i.y/o;e._isFlipUVX&&e._isFlipUVY?t(n,g,v,m,v,g,y,m,y):e._isFlipUVX?t(n,g,y,m,y,g,v,m,v):e._isFlipUVY?t(n,m,v,g,v,m,y,g,y):t(n,m,y,g,y,m,v,g,v);var b=0===a?0:i.x/a,S=0===a?1:(i.x+i.width)/a,w=0===o?1:(i.y+i.height)/o,x=0===o?0:i.y/o;e._isFlipUVX&&e._isFlipUVY?t(r,S,x,b,x,S,w,b,w):e._isFlipUVX?t(r,S,w,b,w,S,x,b,x):e._isFlipUVY?t(r,b,x,S,x,b,w,S,w):t(r,b,w,S,w,b,x,S,x)}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=JO;if(t){var e=this._texture;if(e instanceof Ey&&!e.isCompressed){var i=this.width,n=this.height;if(!e.image||i>t.maxFrameSize||n>t.maxFrameSize)this._packable=!1;else{var r=B.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 bs(n.x,n.y,n.width,n.height));var r=i.offset;i.offset&&(e._offset=ps(r.x,r.y));var s=i.originalSize;i.originalSize&&(e._originalSize=gs(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=ps(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;c<l.length;c+=3)e.vertices.rawPosition.push(nr(l[c],l[c+1],l[c+2]));e._updateMeshVertices()}},i.clone=function(){var t,i,n,r,s,a=this,o=new e,h=a.vertices;return o.vertices=h?{rawPosition:h.rawPosition.slice(0),positions:h.positions.slice(0),indexes:h.indexes.slice(0),uv:h.uv.slice(0),nuv:h.nuv.slice(0),minPos:h.minPos.clone(),maxPos:h.maxPos.clone()}:null,(t=o.uv).splice.apply(t,[0,o.uv.length].concat(a.uv)),(i=o.unbiasUV).splice.apply(i,[0,o.unbiasUV.length].concat(a.unbiasUV)),(n=o.uvSliced).splice.apply(n,[0,o.uvSliced.length].concat(a.uvSliced)),o._rect.set(a._rect),o._trimmedBorder.set(a._trimmedBorder),o._offset.set(a._offset),o._originalSize.set(a._originalSize),o._rotated=a._rotated,(r=o._capInsets).splice.apply(r,[0,o._capInsets.length].concat(a._capInsets)),o._atlasUuid=a._atlasUuid,o._texture=a._texture,o._isFlipUVX=a._isFlipUVX,o._isFlipUVY=a._isFlipUVY,a._original?o._original={_texture:a._original._texture,_x:a._original._x,_y:a._original._y}:o._original=null,o._packable=a._packable,o._pixelsToUnit=a._pixelsToUnit,o._pivot.set(a._pivot),o._meshType=a._meshType,o._extrude=a._extrude,(s=o._customOutLine).splice.apply(s,[0,o._customOutLine.length].concat(a._customOutLine)),o._minPos=a._minPos,o._maxPos=a._maxPos,a._mesh&&o._createMesh(),o},i._refreshTexture=function(t){var e=this;e._texture=t;var i=e._texture,n={},r=!1;0!==e._rect.width&&0!==e._rect.height&&e.checkRect(i)||(n.rect=Ss(0,0,i.width,i.height),r=!0),(0===e._originalSize.width||0===e._originalSize.height||r)&&(n.originalSize=gs(i.width,i.height),r=!0),r&&e.reset(n),e._checkPackable(),e._mesh&&e._updateMesh()},i.onLoaded=function(){this._calcTrimmedBorder()},i.initDefault=function(e){t.prototype.initDefault.call(this,e);var i=new Ey;i.initDefault(),this._refreshTexture(i),this._calculateUV()},i.validate=function(){return this._texture&&this._rect&&0!==this._rect.width&&0!==this._rect.height},i._initVertices=function(){var t=this;if(t.vertices){var e=t.vertices;e.rawPosition.length=0,e.positions.length=0,e.indexes.length=0,e.uv.length=0,e.nuv.length=0,e.minPos.set(0,0,0),e.maxPos.set(0,0,0)}else t.vertices={rawPosition:[],positions:[],indexes:[],uv:[],nuv:[],minPos:nr(),maxPos:nr()};var i=t.vertices;if(1===t._meshType);else{var n=t.texture,r=n.width,s=n.height,a=t.rect,o=a.width,h=a.height,u=a.x,l=s-a.y-h,c=o/2,f=h/2,_=0===r?0:u/r,d=0===r?1:(u+o)/r,p=0===s?1:(l+h)/s,m=0===s?0:l/s,g=i.uv,y=i.nuv,v=i.rawPosition,b=i.indexes;Zk.set(-c,-f,0),v.push(Zk.clone()),g.push(u,l+h),y.push(_,m),i.minPos.set(Zk),Zk.set(c,-f,0),v.push(Zk.clone()),g.push(u+o,l+h),y.push(d,m),Zk.set(-c,f,0),v.push(Zk.clone()),g.push(u,l),y.push(_,p),Zk.set(c,f,0),v.push(Zk.clone()),g.push(u+o,l),y.push(d,p),i.maxPos.set(Zk),b.push(0,1,2,2,1,3)}this._updateMeshVertices()},i._updateMeshVertices=function(){$k.identity();var t=1/this._pixelsToUnit,e=nr(-(this._pivot.x-.5)*this.rect.width*t,-(this._pivot.y-.5)*this.rect.height*t,0);$k.transform(e),e.set(t,t,1),$k.scale(e);for(var i=this.vertices,n=0;n<i.rawPosition.length;n++){var r=i.rawPosition[n];tR(e,r,$k),eR(i.positions,e,3*n)}tR(this._minPos,i.minPos,$k),tR(this._maxPos,i.maxPos,$k)},i._createMesh=function(){this._mesh=Gk({primitiveMode:7,positions:this.vertices.positions,uvs:this.vertices.nuv,indices:this.vertices.indexes,minPos:this._minPos,maxPos:this._maxPos,attributes:[new Cd("a_position",32),new Cd("a_texCoord",21)]})},i._updateMesh=function(){this._mesh&&this._mesh.destroy(),this._initVertices(),this._createMesh()},n(e,[{key:"insetTop",get:function(){return this._capInsets[1]},set:function(t){this._capInsets[1]!==t&&(this._capInsets[1]=t,this._texture&&this._calculateSlicedUV())}},{key:"insetBottom",get:function(){return this._capInsets[3]},set:function(t){this._capInsets[3]!==t&&(this._capInsets[3]=t,this._texture&&this._calculateSlicedUV())}},{key:"insetLeft",get:function(){return this._capInsets[0]},set:function(t){this._capInsets[0]!==t&&(this._capInsets[0]=t,this._texture&&this._calculateSlicedUV())}},{key:"insetRight",get:function(){return this._capInsets[2]},set:function(t){this._capInsets[2]!==t&&(this._capInsets[2]=t,this._texture&&this._calculateSlicedUV())}},{key:"rect",get:function(){return this._rect},set:function(t){this._rect.equals(t)||(this._rect.set(t),this._texture&&this._calculateUV(),this._calcTrimmedBorder())}},{key:"originalSize",get:function(){return this._originalSize},set:function(t){this._originalSize.equals(t)||(this._originalSize.set(t),this._texture&&this._calculateUV(),this._calcTrimmedBorder())}},{key:"offset",get:function(){return this._offset},set:function(t){this._offset.set(t),this._calcTrimmedBorder()}},{key:"rotated",get:function(){return this._rotated},set:function(t){this._rotated!==t&&(this._rotated=t,this._texture&&this._calculateUV())}},{key:"texture",get:function(){return this._texture},set:function(t){t?t!==this._texture&&this.reset({texture:t},!0):at(3122,this.name)}},{key:"atlasUuid",get:function(){return this._atlasUuid},set:function(t){this._atlasUuid=t}},{key:"width",get:function(){return this._texture.width}},{key:"height",get:function(){return this._texture.height}},{key:"_textureSource",set:function(t){globalThis.Build?this._texture=t:t&&(this._refreshTexture(t),this._calculateUV())}},{key:"flipUVX",get:function(){return this._isFlipUVX},set:function(t){this._isFlipUVX=t,this._calculateUV()}},{key:"flipUVY",get:function(){return this._isFlipUVY},set:function(t){this._isFlipUVY=t,this._calculateUV()}},{key:"packable",get:function(){return this._packable},set:function(t){this._packable=t}},{key:"original",get:function(){return this._original}},{key:"pixelsToUnit",get:function(){return this._pixelsToUnit}},{key:"pivot",get:function(){return this._pivot}},{key:"mesh",get:function(){return this._mesh}},{key:"trimmedBorder",get:function(){return this._trimmedBorder}}]),e}(Cm),qk.EVENT_UV_UPDATED="uv_updated",qk.MeshType={RECT:0,POLYGON:1},jk=qk))||jk));A.SpriteFrame=nR;var rR,sR=t("a",Kh("cc.SpriteAtlas")((Kk=function(t){function e(e){var i;return(i=t.call(this,e)||this).spriteFrames=Qk&&Qk(),i}s(e,t);var i=e.prototype;return i.getTexture=function(){var t=Object.keys(this.spriteFrames);if(t.length>0){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<n.length;r+=2)e.result.push(this.spriteFrames,n[r],n[r+1],me(nR))},e}(Cm),Qk=zh(Kk.prototype,"spriteFrames",[uu],(function(){return Gt()})),Jk=Kk))||Jk);A.SpriteAtlas=sR;var aR,oR,hR,uR=t("F",Kh("cc.Font")(rR=function(t){function e(e){return t.call(this,e)||this}return s(e,t),e}(Cm))||rR);A.Font=uR;var lR=t("T",Kh("cc.TTFFont")((oR=function(t){function e(){var e;return(e=t.call(this)||this)._fontFamily=hR&&hR(),e}return s(e,t),e.prototype.initDefault=function(e){this._fontFamily="Arial",t.prototype.initDefault.call(this,e)},n(e,[{key:"_nativeAsset",get:function(){return this._fontFamily},set:function(t){this._fontFamily=t||"Arial"}},{key:"_nativeDep",get:function(){return{uuid:this._uuid,__nativeName__:this._native,ext:Ho(this._native),__isNative__:!0}}}]),e}(uR),hR=zh(oR.prototype,"_fontFamily",[uu],(function(){return null})),v(oR.prototype,"_nativeAsset",[Gu,Eu],Object.getOwnPropertyDescriptor(oR.prototype,"_nativeAsset"),oR.prototype),v(oR.prototype,"_nativeDep",[Gu],Object.getOwnPropertyDescriptor(oR.prototype,"_nativeDep"),oR.prototype),aR=oR))||aR);A.TTFFont=lR;var cR={},fR=t("D",.26),_R=0,dR=t("E",(fR+1)/2-fR);function pR(){return _R}var mR=new ge(2);mR.get=function(){return this._get()||{key:"",value:0,prev:null,next:null}};var gR=t("K",function(){function t(t){this.count=0,this.limit=0,this.datas={},this.head=null,this.tail=null,this.limit=t}var e=t.prototype;return e.moveToHead=function(t){t.next=this.head,t.prev=null,this.head&&(this.head.prev=t),this.head=t,this.tail||(this.tail=t),this.count++,this.datas[t.key]=t},e.put=function(t,e){var i=mR.get();if(i.key=t,i.value=e,this.count>=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,mR.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}()),yR=new gR(100),vR=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûа-яА-ЯЁё]+|\S)/,bR=/^[!,.:;'}\]%\?>、‘“》?。,!]/,SR="[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]",wR=new RegExp("("+SR+"+|\\S)$"),xR=new RegExp(SR+"+$"),TR=new RegExp("^"+SR);function AR(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 CR(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 DR(t,e,i){var n=(i||t.font)+"🎮"+e,r=yR.get(n);if(null!==r)return r;var s=t.measureText(e),a=s&&s.width||0;return yR.put(n,a),a}function BR(t){for(var e=t.length,i=0,n=0,r=0;r<e;r++)8205!==(n=t.charCodeAt(r))&&(n>=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 IR(t,e){for(var i=t.length,n=0,r=0,s=0,a=0,o=0;o<i;o++)if(8205!==(a=t.charCodeAt(o)))if(a>=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 MR(t,e){var i=IR(t,e);if(1===i.length)return""+i.charCodeAt(0);for(var n="",r=0;r<i.length;r++)n+=""+i.charCodeAt(r);return""+n}function PR(t,e){if(e>=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 ER(t,e){for(var i=e,n=e,r=t[n];n<t.length;)if(""===r&&(i++,(r=t[++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],!(n<t.length&&""===t[n]))break;i++,r=t[n]}return i}function OR(t,e,i){var n=PR(t,e);n<e&&(n=ER(t,e)+1);var r=i;if(void 0!==i){r=ER(t,i=Math.max(0,i-1));var s=PR(t,i);s<n||s===n&&e>n?r=n:r+=1}return t.substring(n,r)}function kR(t){return TR.exec(t)}function RR(t){return xR.exec(t)}function FR(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=OR(s,a),h=e-n(o),u=o,l=0,c=0;h>i&&c++<100;)a*=i/h,h=e-n(o=OR(s,a|=0));for(c=0;o&&h<=i&&c++<100;){var f=vR.exec(o);u=o,h=e-n(o=OR(s,a+=l=f?f[0].length:1))}0==(a-=l)?(a=1,u=OR(s,1)):1===a&&s[0]>="\ud800"&&s[0]<="\udbff"&&(a=2,u=OR(s,2));var _=OR(s,0,a),d=void 0;bR.test(u||o)&&(0==(a-=(d=wR.exec(_))?d[0].length:0)&&(a=1),u=OR(s,a),_=OR(s,0,a)),TR.test(u)&&(d=xR.exec(_))&&_!==d[0]&&(u=OR(s,a-=d[0].length),_=OR(s,0,a)),(0===r.length||(_=_.trim()).length>0)&&r.push(_),e=n(s=u||o)}return(0===r.length||(s=s.trim()).length>0)&&r.push(s),r}var LR,VR=B.document,NR=null,zR=-1,UR="BES bswy:->@123丁ぁᄁ",GR=Object.create(null),HR=[],WR=3e3,jR=function(){if(void 0===LR)if("FontFace"in B){var t=/Gecko.*Firefox\/(\d+)/.exec(B.navigator.userAgent),e=/OS X.*Version\/10\..*Safari/.exec(B.navigator.userAgent)&&/Apple/.exec(B.navigator.vendor);LR=t?parseInt(t[1],10)>42:!e}else LR=!1;return LR};function qR(){for(var t=!0,e=Date.now(),i=HR.length-1;i>=0;i--){var n=HR[i],r=n.fontFamilyName;if(e-n.startTime>WR)at(4933,r),n.onComplete(null,r),HR.splice(i,1);else{var s=n.refWidth,a="40px "+r;NR.font=a,s!==DR(NR,UR,a)?(HR.splice(i,1),n.onComplete(null,r)):t=!1}}t&&(clearInterval(zR),zR=-1)}function XR(t,e,i){var n=new Promise((function(i,n){!function r(){Date.now()-t>=WR?n():VR.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,WR)}));Promise.race([s,n]).then((function(){r&&(clearTimeout(r),r=null),i(null,e)}),(function(){at(4933,e),i(null,e)}))}function YR(t,e,i){var n=JR(t);if(GR[n])i(null,n);else{if(!NR){var r=VR.createElement("canvas");r.width=100,r.height=100,NR=r.getContext("2d")}var s="40px "+n,a=VR.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+"}",VR.body.appendChild(a);var h=VR.createElement("div"),u=h.style;if(u.fontFamily=n,h.innerHTML=".",u.position="absolute",u.left="-100px",u.top="-100px",VR.body.appendChild(h),jR())XR(Date.now(),n,i);else{var l={fontFamilyName:n,refWidth:DR(NR,UR,s),onComplete:i,startTime:Date.now()};HR.push(l),-1===zR&&(zR=setInterval(qR,100))}GR[n]=a}}function JR(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 KR(t,e,i,n){var r=new lR;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}Mx.register({".font":YR,".eot":YR,".ttf":YR,".woff":YR,".svg":YR,".ttc":YR}),Hx.register({".font":KR,".eot":KR,".ttf":KR,".woff":KR,".svg":KR,".ttc":KR});var QR,ZR,$R,tF,eF,iF,nF,rF,sF,aF=/^(click)(\s)*=|(param)(\s)*=/,oF=/(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*align(\s)*=|(\s)*offset(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/,hF=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<i;){var n=t.indexOf(">",e),r=-1;if(n>=0&&(r=t.lastIndexOf("<",n))<e-1&&(r=t.indexOf("<",n+1),n=t.indexOf(">",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=oF.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=oF.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,_=/(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;for(i=_.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=_.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<n||-1===n);return n>-1&&(n<r||-1===r)?(e=n,i=t.indexOf("'",e+1>=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=aF.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=aF.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}()),uF=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},lF=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 uF;$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=MR(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}(),cF=t("B",(QR=Kh("cc.BitmapFont"),ZR=Ou(nR),QR((tF=function(t){function e(){var e;return(e=t.call(this)||this).fntDataStr=eF&&eF(),e.spriteFrame=iF&&iF(),e.fontSize=nF&&nF(),e.fntConfig=rF&&rF(),e}return s(e,t),e.prototype.onLoaded=function(){var t=this.spriteFrame;!this.fontDefDictionary&&t&&(this.fontDefDictionary=new lF(t.texture));var e=this.fntConfig;if(e){var i=e.fontDefDictionary;for(var n in i){var r=i[n],s=new uF,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}(uR),eF=zh(tF.prototype,"fntDataStr",[uu],(function(){return""})),iF=zh(tF.prototype,"spriteFrame",[ZR],(function(){return null})),nF=zh(tF.prototype,"fontSize",[uu],(function(){return-1})),rF=zh(tF.prototype,"fntConfig",[uu],(function(){return null})),$R=tF))||$R));A.BitmapFont=cF;var fF,_F=t("L",Kh("cc.LabelAtlas")(sF=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(cF))||sF);A.LabelAtlas=_F;var dF=function(){function t(){this.pool=[]}t.getInstance=function(){return fF||(fF=new t),fF};var e=t.prototype;return e.get=function(){var t=this.pool.pop();if(!t){var e=B.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}(),pF=cr.WHITE.clone(),mF="rgba(255, 255, 255, "+(1/255).toFixed(3)+")",gF=pR(),yF=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=""+MR(t,0)+e.hash}var e=t.prototype;return e.updateRenderData=function(){this._updateProperties(),this._updateTexture()},e.destroy=function(){this.image=null,dF.getInstance().put(this.data),this.data=null},e._updateProperties=function(){if(this.data=dF.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=DR(this.context,this.char,this.labelInfo.fontDesc),i=2*this.labelInfo.margin+2;this.width=parseFloat(e.toFixed(2))*t+i,this.height=(1+fR)*this.labelInfo.fontSize*t+i,this.offsetY=-this.labelInfo.fontSize*fR*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 Hm),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=mF,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*dR+s*gF,h=e.color;if(t.lineJoin="round",t.fillStyle="rgba("+h.r+", "+h.g+", "+h.b+", 1)",e.isOutlined){var u=e.out||pF;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}(),vF=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 id;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}(Ey),bF=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 vF;i.initWithSize(t,e),this.fontDefDictionary=new lF(i),this._halfBleed=1,this._width=t,this._height=e,YE.on("director_before_scene_launch",this.beforeSceneLoad,this)}var e=t.prototype;return e.insertLetterTexture=function(t){var e=t.image,i=YE.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 uF;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 vF;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=MR(t,0)+e.hash,n=this.fontDefDictionary.letterDefinitions[i];if(!n){var r=new yF(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}(),SF={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 wF(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 xF="a_position",TF="a_color",AF="a_texCoord",CF="a_color2",DF=[new Cd(xF,32)],BF=[new Cd(xF,32),new Cd(TF,44)],IF=[new Cd(xF,32),new Cd(AF,21),new Cd(TF,44)],MF=[new Cd(xF,32),new Cd(AF,21),new Cd(TF,35,!0)],PF=[new Cd(xF,32),new Cd(AF,21),new Cd(TF,44),new Cd(CF,44)],EF=[new Cd(xF,32),new Cd(AF,21),new Cd(TF,35,!0),new Cd(CF,35,!0)];function OF(t){for(var e=0,i=0;i<t.length;i++){var n=t[i];e+=ip[n.format].count}return e}function kF(t){for(var e=0,i=0;i<t.length;i++){var n=t[i];e+=ip[n.format].size}return e}A.internal.vfmtPosUvColor=IF,A.internal.vfmtPosUvTwoColor=PF,A.internal.vfmtPosUvColor4B=MF,A.internal.vfmtPosUvTwoColor4B=EF,t("w",Object.freeze({__proto__:null,getAttributeStride:kF,getComponentPerVertex:OF,vfmt:DF,vfmtPosColor:BF,vfmtPosUvColor:IF,vfmtPosUvColor4B:MF,vfmtPosUvTwoColor:PF,vfmtPosUvTwoColor4B:EF}));var RF=t("M",function(){var t=e.prototype;function e(){this._byteOffset=0,this._vertexOffset=0,this._indexOffset=0,this._dirty=!1,this._floatsPerVertex=0,this._vData=null,this._iData=null,this._vertexFormatBytes=0,this._initVDataCount=0,this._initIDataCount=0,this._attributes=null,this._iaPool=[],this._iaInfo=null,this._nextFreeIAHandle=0,this.initSharedBuffer(),this.syncSharedBufferToNative()}return t.initSharedBuffer=function(){},t.syncSharedBufferToNative=function(){},t.initialize=function(t,e,i,n){this._initVDataCount=i,this._initIDataCount=n,this._attributes=e,this.floatsPerVertex=kF(e)>>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;t<this._iaPool.length;++t){var e=this._iaPool[t],i=e.vertexBuffers[0];i&&i.destroy();var n=e.indexBuffer;n&&n.destroy(),e.ia.destroy()}this._iaPool.length=0},t.setDirty=function(){this.dirty=!0},t.request=function(){return at(9002),!1},t.requireFreeIA=function(t){return this._iaPool.length<=this._nextFreeIAHandle&&this._iaPool.push(this.createNewIA(t)),this._iaPool[this._nextFreeIAHandle++].ia},t.recycleIA=function(t){for(var e=this._iaPool,i=0;i<this._nextFreeIAHandle;++i)if(t===e[i].ia){var n=e[i];return e[i]=e[--this._nextFreeIAHandle],void(e[this._nextFreeIAHandle]=n)}},t.checkCapacity=function(t,e){var i=(this.vertexOffset+t)*this._floatsPerVertex,n=this.indexOffset+e;return!(i>this._initVDataCount||n>this._initIDataCount)},t.uploadBuffers=function(){if(0!==this.byteOffset&&this._dirty){var t=hh.__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<e;++o){var h=this._iaPool[o],u=new Float32Array(this.vData.buffer,0,s>>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(hh.__isWebIOS14OrIPadOS14Env||!this._iaPool[0]){var r=this._vertexFormatBytes=4*this._floatsPerVertex,s=t.createBuffer(new ud(10,3,r,r));n=t.createBuffer(new ud(6,3,2,2)),i=[s],this._iaInfo=new Bd(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}()),FF=function(){function t(t,e){this._buffers=[],this._device=t,this._attributes=e,this._floatsPerVertex=kF(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}(),LF=new ho((function(){return{offset:0,length:0}}),32),VF=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}(),NF=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;e<this._buffers.length;++e){this._buffers[e].destroy();for(var i=this._freeLists[e],n=0;n<i.length;++n)LF.free(i[n])}this._buffers.length=0,this._freeLists.length=0,t.prototype.destroy.call(this)},i.reset=function(){for(var t=0;t<this._buffers.length;++t){var e=this._buffers[t];e.indexOffset=0,e.reset()}},i.getVertexBuffer=function(t){return this._buffers[t].vData},i.getIndexBuffer=function(t){return this._buffers[t].iData},i.getMeshBuffer=function(t){return this._buffers[t]},i.uploadBuffers=function(){for(var t=0;t<this._buffers.length;++t){var e=this._freeLists[t][0],i=this._buffers[t];(!e||e.length<i.vData.byteLength)&&i.uploadBuffers()}},i.appendIndices=function(t,e){var i=this._buffers[t];if(e.length){var n=i.indexOffset+e.length;if(i.iData.length<n){var r=Math.floor(1.25*n),s=new Uint16Array(r);s.set(i.iData),i.iData=s}i.iData.set(e,i.indexOffset),i.indexOffset+=e.length}},i.allocateChunk=function(t,e){var i=t*this.vertexFormatBytes;if(t>this._vCount||e>this._iCount)return ht(9004,i),null;for(var n,r=null,s=0,a=-1,o=null,h=0;h<this._buffers.length;++h){r=this._buffers[h],n=this._freeLists[h];for(var u=0;u<n.length;++u)if(n[u].length>=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 VF(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<n;)o=h,h=e[++a];if(o&&0==n-(o.offset+o.length)&&(o.length+=r,n=o.offset,r=o.length,h&&h.offset-(n+r)==0&&(o.length+=h.length,e.splice(a,1),LF.free(h),h=null),s=!0),!s&&h){if(0==h.offset-(n+r))h.offset=n,h.length+=r;else{var u=LF.alloc();u.offset=n,u.length=r,e.splice(a,0,u)}s=!0}if(s)n+r===i.byteOffset&&(i.byteOffset=n);else{var l=LF.alloc();l.offset=n,l.length=r,e.push(l)}}},i._allocateChunkFromEntry=function(t,e,i,n){var r=i.length-n,s=i.offset+n,a=this._buffers[t];a.byteOffset<s&&(a.byteOffset=s),lt(r>=0,9004,t,i.offset,i.length),0===r?(this._freeLists[t].splice(e,1),LF.free(i)):(i.offset+=n,i.length=r)},i._allocateBuffer=function(){lt(this._buffers.length===this._freeLists.length,9003);var t=new RF,e=this._vCount*this._floatsPerVertex;t.initialize(this._device,this._attributes,e,this._iCount),this._buffers.push(t);var i=LF.alloc();i.offset=0,i.length=t.vData.byteLength;var n=[i];return this._freeLists.push(n),YE.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}(FF);NF.IB_SCALE=4,NF.ID_COUNT=0;var zF,UF,GF,HF,WF,jF,qF,XF,YF,JF,KF,QF=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}(),ZF=kF(IF)>>2,$F=t("t",function(){function t(t){void 0===t&&(t=IF),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=IF,this._drawInfoType=0,this._multiOwner=!1,this._batcher=null,this._floatStride=t===IF?ZF:kF(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=YE.root.batcher2D),this._batcher}}]),t}()),tL=t("u",function(t){function e(e,i){var n;return void 0===e&&(e=IF),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=IF),void 0===i&&(i=null);var n=new e(t,i);return i||(i=YE.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=qf(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=YE.root.device;return new NF(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<t;i++)e.push({x:0,y:0,z:0,u:0,v:0,color:cr.WHITE.clone()});e.length=t}this.syncRender2dBuffer()}},{key:"data",get:function(){return this._data}},{key:"vertDirty",get:function(){return this._vertDirty},set:function(t){this._vertDirty=t}},{key:"textureHash",get:function(){return this._textureHash},set:function(t){this._textureHash=t}},{key:"frame",get:function(){return this._frame},set:function(t){this._frame=t}},{key:"accessor",get:function(){return this._accessor}}]),e}($F)),eL=t("v",function(t){function e(e){var i;return void 0===e&&(e=IF),(i=t.call(this,e)||this)._isMeshBuffer=!0,i.vertexStart=0,i.vertexRange=0,i.indexStart=0,i.indexRange=0,i.lastFilledIndex=0,i.lastFilledVertex=0,i.frame=null,i._byteLength=0,i._vertexBuffers=[],i._indexBuffer=null,i._iaPool=null,i._iaInfo=null,i.vData=new Float32Array(256*i.stride),i.iData=new Uint16Array(1536),i}s(e,t),e.add=function(t){void 0===t&&(t=IF);var i=new e;return i._floatStride=t===IF?ZF:kF(t)>>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<i||s<n;)r=4*(a*=2),s=o*=2;this._reallocBuffer(a,o)}return!0},i.resize=function(t,e){var i=t*this.stride;t>=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 ud(10,1,i,i))),this._indexBuffer||(this._indexBuffer=t.createBuffer(new ud(6,1,2,2))),this._iaInfo=new Bd(this._vertexFormat,n,this._indexBuffer),this._iaPool=new uo((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}($F)),iL=new ds,nL=new ds,rL=new ir,sL=new Kr,aL=new Kr,oL=new Kr,hL=new Kr(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),uL=new bs,lL=t("e",Kh("cc.UITransform")(zF=Zh(110)(zF=$h((WF=function(t){function e(){var e;return(e=t.call(this)||this)._priority=0,e._contentSize=GF&&GF(),e._anchorPoint=HF&&HF(),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,Ki)&&Zi(t.height,r.height,Ki))return;i=t.width,n=t.height}else{if(Zi(t,r.width,Ki)&&Zi(e,r.height,Ki))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=iL,r=nL,s=this._getRenderScene().cameras,a=0;a<s.length;a++){var o=s[a];if(o.visibility&this.node.layer){o.node.getWorldRT(sL);var h=sL.m12,u=sL.m13,l=uh.center;if(sL.m12=l.x-(sL.m00*h+sL.m04*u),sL.m13=l.y-(sL.m01*h+sL.m05*u),Kr.invert(sL,sL),ds.transformMat4(n,t,sL),this.node.getWorldMatrix(oL),Kr.invert(sL,oL),!Kr.strictEquals(sL,hL)){ds.transformMat4(r,n,sL),r.x+=this._anchorPoint.x*e,r.y+=this._anchorPoint.y*i;var c=!1;if(r.x>=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=rL,s=iL,a=nL,o=this._getRenderScene().cameras,h=0;h<o.length;h++){var u=o[h];if(u.visibility&this.node.layer&&(!u.window||u.window.swapchain)&&u.systemWindowId===e&&(ir.set(r,t.x,t.y,0),u.screenToWorld(r,r),ds.set(s,r.x,r.y),this.node.getWorldMatrix(oL),Kr.invert(sL,oL),!Kr.strictEquals(sL,hL))){ds.transformMat4(a,s,sL),a.x+=this._anchorPoint.x*i,a.y+=this._anchorPoint.y*n;var l=!1;if(a.x>=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&&o<s;++a,r=r.parent){var h=n[o];if(a===h.index){if(r!==h.comp.node){n.length=o;break}var u=h.comp;if(u&&u._enabled&&!u.isHit(t))return!1;o++}else if(a>h.index){n.length=o;break}}return!0},i.convertToNodeSpaceAR=function(t,e){return this.node.getWorldMatrix(oL),Kr.invert(sL,oL),e||(e=new ir),ir.transformMat4(e,t,sL)},i.convertToWorldSpaceAR=function(t,e){return this.node.getWorldMatrix(oL),e||(e=new ir),ir.transformMat4(e,t,oL)},i.getBoundingBox=function(){var t=new bs;return this._selfBoundingBox(t),Kr.fromSRT(aL,this.node.rotation,this.node.position,this.node.scale),t.transformMat4(aL),t},i.getBoundingBoxToWorld=function(){for(var t=new bs,i=this.node.children,n=0;n<i.length;++n){var r=i[n];if(r&&r.active){var s=r.getComponent(e);s&&s.contentSize.width&&s.contentSize.height&&(s._selfBoundingBox(uL),uL.transformMat4(r.worldMatrix),0===t.width?t.set(uL):bs.union(t,t,uL))}}return this._contentSize.width&&this._contentSize.height&&(this._selfBoundingBox(uL),uL.transformMat4(this.node.worldMatrix),0===t.width?t.set(uL):bs.union(t,t,uL)),t},i.getBoundingBoxTo=function(t){var i=new bs,n=this.node.children;Kr.invert(sL,t);for(var r=0;r<n.length;++r){var s=n[r];if(s&&s.active){var a=s.getComponent(e);a&&a.contentSize.width&&a.contentSize.height&&(a._selfBoundingBox(uL),Kr.multiply(aL,s.worldMatrix,sL),uL.transformMat4(aL),0===i.width?i.set(uL):bs.union(i,i,uL))}}return this._contentSize.width&&this._contentSize.height&&(this._selfBoundingBox(uL),Kr.multiply(aL,this.node.worldMatrix,sL),uL.transformMat4(aL),0===i.width?i.set(uL):bs.union(i,i,uL)),i},i.getComputeAABB=function(t){var e=this._contentSize.width,i=this._contentSize.height;uL.set(-this._anchorPoint.x*e,-this._anchorPoint.y*i,e,i),uL.transformMat4(this.node.worldMatrix);var n=uL.x+.5*uL.width,r=uL.y+.5*uL.height,s=this.node.worldPosition.z,a=uL.width/2,o=uL.height/2;return null!=t?(gh.set(t,n,r,s,a,o,.001),t):new gh(n,r,s,a,o,.001)},i._selfBoundingBox=function(t){var e=this._contentSize.width,i=this._contentSize.height;return t.set(-this._anchorPoint.x*e,-this._anchorPoint.y*i,e,i),t},i._parentChanged=function(){this.node.getComponent("cc.RenderRoot2D")||this.node.parent&&e.insertChangeMap(this.node.parent)},i._markRenderDataDirty=function(){var t=this.node._uiProps.uiComp;t&&t._markForUpdateRenderData()},e.insertChangeMap=function(t){var i=t.uuid;e.priorityChangeNodeMap.has(i)||e.priorityChangeNodeMap.set(i,t)},e._sortChildrenSibling=function(t){var e=t.children;e&&e.sort((function(t,e){var i=t._getUITransformComp(),n=e._getUITransformComp(),r=(i?i._priority:0)-(n?n._priority:0);return 0===r?t.siblingIndex-e.siblingIndex:r}))},e._sortSiblings=function(){e.priorityChangeNodeMap.forEach((function(t){e._sortChildrenSibling(t),t._updateSiblingIndex(),t.emit("childrenSiblingOrderChanged")})),e.priorityChangeNodeMap.clear()},e._cleanChangeMap=function(){e.priorityChangeNodeMap.clear()},n(e,[{key:"contentSize",get:function(){return this._contentSize},set:function(t){this._contentSize.equals(t)||(this._contentSize.set(t),this.node.emit("size-changed"),this._markRenderDataDirty())}},{key:"width",get:function(){return this._contentSize.width},set:function(t){this._contentSize.width!==t&&(this._contentSize.width=t,this.node.emit("size-changed"),this._markRenderDataDirty())}},{key:"height",get:function(){return this._contentSize.height},set:function(t){this.contentSize.height!==t&&(this._contentSize.height=t,this.node.emit("size-changed"),this._markRenderDataDirty())}},{key:"anchorPoint",get:function(){return this._anchorPoint},set:function(t){this._anchorPoint.equals(t)||(this._anchorPoint.set(t),this.node.emit("anchor-changed",this._anchorPoint),this._markRenderDataDirty())}},{key:"anchorX",get:function(){return this._anchorPoint.x},set:function(t){this._anchorPoint.x!==t&&(this._anchorPoint.x=t,this.node.emit("anchor-changed",this._anchorPoint),this._markRenderDataDirty())}},{key:"anchorY",get:function(){return this._anchorPoint.y},set:function(t){this._anchorPoint.y!==t&&(this._anchorPoint.y=t,this.node.emit("anchor-changed",this._anchorPoint),this._markRenderDataDirty())}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority!==t&&(this.node.getComponent("cc.RenderRoot2D")?at(6706):(this._priority=t,this.node.parent&&e.insertChangeMap(this.node.parent)))}},{key:"visibility",get:function(){var t=YE.root.batcher2D.getFirstRenderCamera(this.node);return t?t.visibility:0}},{key:"cameraPriority",get:function(){var t=YE.root.batcher2D.getFirstRenderCamera(this.node);return t?t.priority:0}}]),e}(yg),WF.EventType=Gy,WF.priorityChangeNodeMap=new Map,GF=zh((UF=WF).prototype,"_contentSize",[uu],(function(){return new ms(100,100)})),HF=zh(UF.prototype,"_anchorPoint",[uu],(function(){return new ds(.5,.5)})),zF=UF))||zF)||zF)||zF);YE.on("director_after_update",lL._sortSiblings),YE.on("director_before_scene_launch",lL._cleanChangeMap);var cL,fL,_L,dL,pL,mL,gL,yL,vL,bL,SL,wL,xL={parent:null,owner:null,subModelIdx:0},TL=$h,AL=Ou,CL=t("dP",(jF=Kh("cc.Renderer"),qF=AL(GT),XF=AL([GT]),jF(YF=TL((JF=function(t){function e(){var e;return(e=t.call(this)||this)._materials=KF&&KF(),e._materialInstances=[],e}s(e,t);var i=e.prototype;return i.getMaterial=function(t){return this.getSharedMaterial(t)},i.setMaterial=function(t,e){this.setSharedMaterial(t,e)},i.getSharedMaterial=function(t){return t<0||t>=this._materials.length?null:this._materials[t]},i.setSharedMaterial=function(t,e){if(t&&t instanceof QT&&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]){xL.parent=this._materials[t],xL.owner=this,xL.subModelIdx=t;var e=new QT(xL);xL.parent=null,xL.owner=null,xL.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;e<t.length;e++)t[e]!==this._materials[e]&&this.setSharedMaterial(t[e],e);if(t.length<this._materials.length){for(var i=t.length;i<this._materials.length;i++)this.setSharedMaterial(null,i);this._materials.splice(t.length)}}},{key:"material",get:function(){return this.getMaterialInstance(0)},set:function(t){(1!==this._materials.length||this._materialInstances[0]||this._materials[0]!==t)&&this.setMaterialInstance(t,0)}},{key:"materials",get:function(){for(var t=0;t<this._materials.length;t++)this._materialInstances[t]=this.getMaterialInstance(t);return this._materialInstances},set:function(t){for(var e=t.length,i=this._materials.length,n=e;n<i;n++)this.setMaterialInstance(null,n);this._materials.length=e,this._materialInstances.length=e;for(var r=0;r<e;r++)this._materialInstances[r]!=t[r]&&this.setMaterialInstance(t[r],r)}}]),e}(yg),v(JF.prototype,"sharedMaterials",[qF],Object.getOwnPropertyDescriptor(JF.prototype,"sharedMaterials"),JF.prototype),KF=zh(JF.prototype,"_materials",[XF],(function(){return[]})),YF=JF))||YF)||YF)),DL=function(){function t(){this._renderEntityType=0,this._dynamicDrawInfoArr=[],this._node=null,this._renderTransform=null,this._stencilStage=0,this._useLocal=!1,this._maskMode=0,this._color=cr.WHITE.clone(),this._localOpacity=255,this._colorDirty=!0,this._enabled=!1}var e=t.prototype;return e.addDynamicRenderDrawInfo=function(){},e.removeDynamicRenderDrawInfo=function(){},e.clearDynamicRenderDrawInfos=function(){},e.clearStaticRenderDrawInfos=function(){},e.setDynamicRenderDrawInfo=function(){},e.setMaskMode=function(t){this._maskMode=t},e.getStaticRenderDrawInfo=function(){return null},e.setNode=function(t){this._node=t},e.setRenderTransform=function(t){this._renderTransform=t},e.setStencilStage=function(t){this._stencilStage=t},e.setUseLocal=function(t){this._useLocal=t},e.initSharedBuffer=function(){},n(t,[{key:"nativeObj",get:function(){return this._nativeObj}},{key:"renderDrawInfoArr",get:function(){return this._dynamicDrawInfoArr}},{key:"renderEntityType",get:function(){return this._renderEntityType}},{key:"color",get:function(){return this._color},set:function(t){this._color=t}},{key:"localOpacity",get:function(){return this._localOpacity},set:function(t){this._localOpacity=t}},{key:"colorDirty",get:function(){return this._colorDirty},set:function(t){this._colorDirty=t}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}}]),t}();Re(T_),Re(A_),Re(C_),t("I",{ADD_COLOR:0,ADD_COLOR_AND_TEXTURE:1,GRAYSCALE:2,USE_ALPHA_SEPARATED:3,USE_ALPHA_SEPARATED_AND_GRAY:4});var BL=t("d",(cL=Kh("cc.UIRenderer"),fL=Qh(lL),_L=Ou(GT),dL=Ou(GT),cL(pL=fL((wL=function(t){function e(){var e;return(e=t.call(this)||this)._renderData=null,e._materials=gL&&gL(),e._customMaterial=yL&&yL(),e._srcBlendFactor=vL&&vL(),e._dstBlendFactor=bL&&bL(),e._color=SL&&SL(),e._stencilStage=0,e._assembler=null,e._postAssembler=null,e._renderDataFlag=!0,e._renderFlag=!0,e._instanceMaterialType=-1,e._srcBlendFactorCache=2,e._dstBlendFactorCache=4,e._dirtyVersion=-1,e._internalId=-1,e._flagChangedVersion=-1,e._useVertexOpacity=!1,e._lastParent=null,e._renderEntity=e.createRenderEntity(),e}s(e,t);var i=e.prototype;return i.setRenderData=function(t){this._renderData=t},i.onLoad=function(){this._renderEntity.setNode(this.node)},i.__preload=function(){this.node._uiProps.uiComp=this,this._flushAssembler&&this._flushAssembler()},i.onEnable=function(){this.node.on("anchor-changed",this._nodeStateChange,this),this.node.on("size-changed",this._nodeStateChange,this),this.node.on("parent-changed",this._colorDirty,this),!this._renderData&&this._flushAssembler&&this._flushAssembler(),this.updateMaterial(),this._colorDirty(),FE.addRenderer(this),this._markForUpdateRenderData()},i.onRestore=function(){this.updateMaterial(),this._markForUpdateRenderData()},i.onDisable=function(){this.node.off("anchor-changed",this._nodeStateChange,this),this.node.off("size-changed",this._nodeStateChange,this),this.node.off("parent-changed",this._colorDirty,this),this.destroyRenderData(),FE.removeRenderer(this),this._renderFlag=!1,this._renderEntity.enabled=!1},i.onDestroy=function(){if(this._renderEntity.setNode(null),this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null),this.destroyRenderData(),this._materialInstances)for(var t=0;t<this._materialInstances.length;t++){var e=this._materialInstances[t];e&&e.destroy()}},i.markForUpdateRenderData=function(t){void 0===t&&(t=!0),this._markForUpdateRenderData(t)},i._markForUpdateRenderData=function(t){if(void 0===t&&(t=!0),t){var e=this._renderData;e&&(e.vertDirty=!0),FE.markDirtyRenderer(this)}},i.requestRenderData=function(t){void 0===t&&(t=0);var e=tL.add();return e.initRenderDrawInfo(this,t),this._renderData=e,e},i.destroyRenderData=function(){this._renderData&&(this._renderData.removeRenderDrawInfo(this),tL.remove(this._renderData),this._renderData=null)},i.updateRenderer=function(){var t=this._assembler;t&&t.updateRenderData&&t.updateRenderData(this),this._renderFlag=this._canRender(),this._renderEntity.enabled=this._renderFlag},i.fillBuffers=function(t){this._renderFlag&&this._render(t)},i.postUpdateAssembler=function(t){this._postAssembler&&this._renderFlag&&this._postRender(t)},i._render=function(){},i._postRender=function(){},i._canRender=function(){return null!==this.getSharedMaterial(0)&&this._enabled&&this._color.a>0},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<t.children.length;r++)e.setEntityColorDirtyRecursively(t.children[r],i)},i.setEntityColorDirty=function(){},i.setEntityColor=function(){},i.setEntityOpacity=function(){},i.setEntityEnabled=function(){},i._updateBlendFunc=function(){var t=this.getRenderMaterial(0).passes[0].blendState.targets[0];if(this._dstBlendFactorCache=t.blendDst,this._srcBlendFactorCache=t.blendSrc,this._dstBlendFactorCache!==this._dstBlendFactor||this._srcBlendFactorCache!==this._srcBlendFactor){(t=this.getMaterialInstance(0).passes[0].blendState.targets[0]).blend=!0,t.blendDstAlpha=4,t.blendDst=this._dstBlendFactor,t.blendSrc=this._srcBlendFactor;var e=this.getMaterialInstance(0).passes[0];e.blendState.setTarget(0,t),e._updatePassHash(),this._dstBlendFactorCache=this._dstBlendFactor,this._srcBlendFactorCache=this._srcBlendFactor}},i._nodeStateChange=function(){this._renderData&&this._markForUpdateRenderData();for(var t=0;t<this.node.children.length;++t){var i=this.node.children[t].getComponent(e);i&&i._markForUpdateRenderData()}},i._colorDirty=function(){this.node._uiProps.colorDirty=!0,this.setEntityColorDirty(!0)},i._onMaterialModified=function(e,i){this._renderData&&(this._markForUpdateRenderData(),this._renderData.passDirty=!0),t.prototype._onMaterialModified.call(this,e,i)},i._updateBuiltinMaterial=function(){var t;switch(this._instanceMaterialType){case 0:t=mT.get("ui-base-material");break;case 2:t=mT.get("ui-sprite-gray-material");break;case 3:t=mT.get("ui-sprite-alpha-sep-material");break;case 4:t=mT.get("ui-sprite-gray-alpha-sep-material");break;default:t=mT.get("ui-sprite-material")}return t},i.setNodeDirty=function(){this._renderData&&(this._renderData.nodeDirty=!0)},i.setTextureDirty=function(){this._renderData&&(this._renderData.textureDirty=!0)},i.createRenderEntity=function(){return new DL(0)},n(e,[{key:"sharedMaterials",get:function(){return this._materials},set:function(t){for(var e=0;e<t.length;e++)t[e]!==this._materials[e]&&this.setSharedMaterial(t[e],e);if(t.length<this._materials.length){for(var i=t.length;i<this._materials.length;i++)this.setSharedMaterial(null,i);this._materials.splice(t.length)}}},{key:"customMaterial",get:function(){return this._customMaterial},set:function(t){this._customMaterial=t,this.updateMaterial()}},{key:"color",get:function(){return this._color},set:function(t){this._color.equals(t)||(this._color.set(t),this._updateColor())}},{key:"renderData",get:function(){return this._renderData}},{key:"useVertexOpacity",get:function(){return this._useVertexOpacity}},{key:"stencilStage",get:function(){return this._stencilStage},set:function(t){this._stencilStage=t,this._renderEntity.setStencilStage(t)}},{key:"srcBlendFactor",get:function(){return this._srcBlendFactor},set:function(t){this._srcBlendFactor=t}},{key:"batcher",get:function(){return YE.root.batcher2D}},{key:"renderEntity",get:function(){return this._renderEntity}}]),e}(CL),wL.BlendState=T_,wL.Assembler=null,wL.PostAssembler=null,v((mL=wL).prototype,"sharedMaterials",[Gu],Object.getOwnPropertyDescriptor(mL.prototype,"sharedMaterials"),mL.prototype),v(mL.prototype,"customMaterial",[_L],Object.getOwnPropertyDescriptor(mL.prototype,"customMaterial"),mL.prototype),gL=zh(mL.prototype,"_materials",[Gu],(function(){return[]})),yL=zh(mL.prototype,"_customMaterial",[dL],(function(){return null})),vL=zh(mL.prototype,"_srcBlendFactor",[uu],(function(){return 2})),bL=zh(mL.prototype,"_dstBlendFactor",[uu],(function(){return 4})),SL=zh(mL.prototype,"_color",[uu],(function(){return cr.WHITE.clone()})),pL=mL))||pL)||pL));A.internal.UIRenderer=BL;var IL,ML,PL,EL,OL,kL,RL,FL,LL,VL,NL,zL,UL,GL,HL,WL,jL,qL,XL,YL,JL,KL,QL,ZL,$L,tV,eV,iV,nV,rV,sV,aV,oV,hV,uV=function(){function t(){this.isBold=!1,this.isItalic=!1,this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineColor=cr.WHITE.clone(),this.outlineWidth=1,this.hasShadow=!1,this.shadowColor=cr.BLACK.clone(),this.shadowBlur=2,this.shadowOffsetX=0,this.shadowOffsetY=0,this.color=cr.WHITE.clone(),this.fontSize=40,this.actualFontSize=0,this.isSystemFontUsed=!1,this.originFontSize=0,this.bmfontScale=1,this.fontFamily="Arial",this.fontDesc="",this.fntConfig=null,this.spriteFrame=null,this.fontScale=1}return t.prototype.reset=function(){this.isBold=!1,this.isItalic=!1,this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineColor.set(),this.outlineWidth=1,this.hasShadow=!1,this.shadowColor.set(),this.shadowBlur=2,this.shadowOffsetX=0,this.shadowOffsetY=0},t}(),lV=function(){function t(){this.horizontalAlign=0,this.verticalAlign=0,this.wrapping=!0,this.overFlow=0,this.lineHeight=10,this.maxLineWidth=0,this.spacingX=0,this.textWidthTemp=0,this.textHeightTemp=0,this.textDimensions=new ms,this.horizontalKerning=[],this.numberOfLines=1,this.linesOffsetX=[],this.letterOffsetY=0,this.tailoredTopY=0,this.tailoredBottomY=0,this.textDesiredHeight=0,this.linesWidth=[]}return t.prototype.reset=function(){this.horizontalAlign=0,this.verticalAlign=0,this.wrapping=!0,this.overFlow=0,this.lineHeight=10,this.maxLineWidth=0,this.spacingX=0,this.textWidthTemp=0,this.textHeightTemp=0,this.textDimensions.set(),this.horizontalKerning.length=0,this.numberOfLines=1,this.linesOffsetX.length=0,this.letterOffsetY=0,this.tailoredTopY=0,this.tailoredBottomY=0,this.textDesiredHeight=0,this.linesWidth.length=0},t}(),cV=function(){function t(){this.parsedString=[],this.nodeContentSize=ms.ZERO.clone(),this.canvasSize=new ms,this.canvasPadding=new bs,this.contentSizeExtend=ms.ZERO.clone(),this.startPosition=ds.ZERO.clone()}return t.prototype.reset=function(){this.parsedString.length=0,this.nodeContentSize.set(0,0),this.canvasSize.set(),this.canvasPadding.set(),this.contentSizeExtend.set(),this.startPosition.set()},t}(),fV=function(){function t(){this.quadCount=0,this.vertexBuffer=[],this.texture=null,this.uiTransAnchorX=.5,this.uiTransAnchorY=.5}return t.prototype.reset=function(){this.quadCount=0,this.vertexBuffer.length=0,this.texture=null,this.uiTransAnchorX=.5,this.uiTransAnchorY=.5},t}();cr.WHITE.clone();var _V=t("H",{LEFT:0,CENTER:1,RIGHT:2});Re(_V);var dV=t("V",{TOP:0,CENTER:1,BOTTOM:2});Re(dV);var pV=t("O",{NONE:0,CLAMP:1,SHRINK:2,RESIZE_HEIGHT:3});Re(pV);var mV=t("o",{NONE:0,BITMAP:1,CHAR:2});Re(mV);var gV,yV,vV,bV,SV,wV,xV,TV,AV,CV,DV,BV,IV,MV,PV,EV,OV,kV,RV,FV,LV=t("p",(IL=Kh("cc.Label"),ML=Zh(110),PL=Ou(_V),EL=Ou(dV),OL=Ou(pV),kL=Ou(uR),RL=Ou(mV),IL(FL=ML((hV=function(t){function e(){var e;return(e=t.call(this)||this)._string=VL&&VL(),e._horizontalAlign=NL&&NL(),e._verticalAlign=zL&&zL(),e._actualFontSize=UL&&UL(),e._fontSize=GL&&GL(),e._fontFamily=HL&&HL(),e._lineHeight=WL&&WL(),e._overflow=jL&&jL(),e._enableWrapText=qL&&qL(),e._font=XL&&XL(),e._isSystemFontUsed=YL&&YL(),e._spacingX=JL&&JL(),e._isItalic=KL&&KL(),e._isBold=QL&&QL(),e._isUnderline=ZL&&ZL(),e._underlineHeight=$L&&$L(),e._cacheMode=tV&&tV(),e._enableOutline=eV&&eV(),e._outlineColor=iV&&iV(),e._outlineWidth=nV&&nV(),e._enableShadow=rV&&rV(),e._shadowColor=sV&&sV(),e._shadowOffset=aV&&aV(),e._shadowBlur=oV&&oV(),e._N$file=null,e._texture=null,e._ttfSpriteFrame=null,e._userDefinedFont=null,e._assemblerData=null,e._fontAtlas=null,e._letterTexture=null,e._contentWidth=0,e._textStyle=null,e._textLayout=null,e._textRenderData=null,e._textLayoutData=null,e._ttfSpriteFrame=null,e._textStyle=new uV,e._textLayout=new lV,e._textLayoutData=new cV,e._textRenderData=new fV,e}s(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this._font||this._isSystemFontUsed||(this.useSystemFont=!0),this._isSystemFontUsed&&!this._fontFamily&&(this.fontFamily="Arial"),this._applyFontTexture()},i.destroyTtfSpriteFrame=function(){if(this._ttfSpriteFrame){this._ttfSpriteFrame._resetDynamicAtlasFrame();var t=this._ttfSpriteFrame.texture;if(this._ttfSpriteFrame.destroy(),t){var e=t;e.image&&e.image.destroy(),t.destroy()}this._ttfSpriteFrame=null}},i._onPreDestroy=function(){t.prototype._onPreDestroy.call(this),this._isOnLoadCalled||this.destroyTtfSpriteFrame()},i.onDestroy=function(){this._assembler&&this._assembler.resetAssemblerData&&this._assembler.resetAssemblerData(this._assemblerData),this._assemblerData=null,this.destroyTtfSpriteFrame(),this.destroyLetterTexture(),t.prototype.onDestroy.call(this)},i.destroyLetterTexture=function(){var t=this._letterTexture;t&&(t.decRef(!1),t.refCount<=0&&t.destroy()),this._letterTexture=null},i.updateRenderData=function(t){void 0===t&&(t=!1),t&&(this._flushAssembler(),this.renderData&&(this.renderData.vertDirty=!0),this._applyFontTexture()),this._assembler&&this._assembler.updateRenderData(this)},i._render=function(t){t.commitComp(this,this.renderData,this._texture,this._assembler,null)},i._updateColor=function(){t.prototype._updateColor.call(this),this._markForUpdateRenderData()},i.setEntityColor=function(){},i._canRender=function(){if(!t.prototype._canRender.call(this)||!this._string)return!1;var e=this._font;if(e&&e instanceof cF){var i=e.spriteFrame;if(!i||!i.texture)return!1}return!0},i._flushAssembler=function(){var t=e.Assembler.getAssembler(this);this._assembler!==t&&(this.destroyRenderData(),this._assembler=t,this.textStyle.reset(),this.textLayout.reset(),this.textLayoutData.reset(),this.textRenderData.reset()),this.renderData||this._assembler&&this._assembler.createData&&(this._renderData=this._assembler.createData(this),this.renderData.material=this.material,this._updateColor())},i._applyFontTexture=function(){this._markForUpdateRenderData();var t=this._font;if(t instanceof cF){var e=t.spriteFrame;e&&e.texture&&(this._texture=e,this.renderData&&(this.renderData.textureDirty=!0),this.changeMaterialForDefine(),this._assembler&&this._assembler.updateRenderData(this))}else{if(2===this.cacheMode){var i=this._letterTexture,n=this._assembler.getAssemblerData();n!==i&&(this.destroyLetterTexture(),n&&n.addRef()),this._texture=this._letterTexture=n}else if(!this._ttfSpriteFrame){this._ttfSpriteFrame=new nR,this._assemblerData=this._assembler.getAssemblerData();var r=new Hm(this._assemblerData.canvas),s=new Ey;s.image=r,this._ttfSpriteFrame.texture=s}2!==this.cacheMode&&(this._texture=this._ttfSpriteFrame),this.changeMaterialForDefine()}},i.changeMaterialForDefine=function(){if(this._texture){var t=!1;if(2!==this.cacheMode){var e=this._texture.texture;if(e instanceof Ym){var i=e.getPixelFormat();t=1026===i||1025===i||1024===i}}this._instanceMaterialType=t?3:1,this.updateMaterial()}},i._updateBlendFunc=function(){t.prototype._updateBlendFunc.call(this)},n(e,[{key:"string",get:function(){return this._string},set:function(t){t=null==t?"":t.toString(),this._string!==t&&(this._string=t,this._markForUpdateRenderData())}},{key:"horizontalAlign",get:function(){return this._horizontalAlign},set:function(t){this._horizontalAlign!==t&&(this._horizontalAlign=t,this._markForUpdateRenderData())}},{key:"verticalAlign",get:function(){return this._verticalAlign},set:function(t){this._verticalAlign!==t&&(this._verticalAlign=t,this._markForUpdateRenderData())}},{key:"actualFontSize",get:function(){return this._actualFontSize},set:function(t){this._actualFontSize=t}},{key:"fontSize",get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this._markForUpdateRenderData())}},{key:"lineHeight",get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this._markForUpdateRenderData())}},{key:"spacingX",get:function(){return this._spacingX},set:function(t){this._spacingX!==t&&(this._spacingX=t,this._markForUpdateRenderData())}},{key:"overflow",get:function(){return this._overflow},set:function(t){this._overflow!==t&&(this._overflow=t,this._markForUpdateRenderData())}},{key:"enableWrapText",get:function(){return this._enableWrapText},set:function(t){this._enableWrapText!==t&&(this._enableWrapText=t,this._markForUpdateRenderData())}},{key:"useSystemFont",get:function(){return this._isSystemFontUsed},set:function(t){this._isSystemFontUsed!==t&&(this.destroyRenderData(),this._isSystemFontUsed=!!t,t&&(this.font=null),this._flushAssembler(),this._markForUpdateRenderData())}},{key:"fontFamily",get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._markForUpdateRenderData())}},{key:"font",get:function(){return this._font},set:function(t){this._font!==t&&(this._isSystemFontUsed=!t,this._font=t,this.destroyRenderData(),this._fontAtlas=null,this.updateRenderData(!0))}},{key:"cacheMode",get:function(){return this._cacheMode},set:function(t){var e=this._cacheMode;e!==t&&(1!==e||this._font instanceof cF||!this._ttfSpriteFrame||this._ttfSpriteFrame._resetDynamicAtlasFrame(),2===e&&(this._ttfSpriteFrame=null,this.destroyLetterTexture()),this._cacheMode=t,this.updateRenderData(!0))}},{key:"isBold",get:function(){return this._isBold},set:function(t){this._isBold!==t&&(this._isBold=t,this._markForUpdateRenderData())}},{key:"isItalic",get:function(){return this._isItalic},set:function(t){this._isItalic!==t&&(this._isItalic=t,this._markForUpdateRenderData())}},{key:"isUnderline",get:function(){return this._isUnderline},set:function(t){this._isUnderline!==t&&(this._isUnderline=t,this._markForUpdateRenderData())}},{key:"underlineHeight",get:function(){return this._underlineHeight},set:function(t){this._underlineHeight!==t&&(this._underlineHeight=t,this._markForUpdateRenderData())}},{key:"enableOutline",get:function(){return this._enableOutline},set:function(t){this._enableOutline!==t&&(this._enableOutline=t,this._markForUpdateRenderData())}},{key:"outlineColor",get:function(){return this._outlineColor},set:function(t){this._outlineColor!==t&&(this._outlineColor.set(t),this._markForUpdateRenderData())}},{key:"outlineWidth",get:function(){return this._outlineWidth},set:function(t){this._outlineWidth!==t&&(this._outlineWidth=t,this._markForUpdateRenderData())}},{key:"enableShadow",get:function(){return this._enableShadow},set:function(t){this._enableShadow!==t&&(this._enableShadow=t,this._markForUpdateRenderData())}},{key:"shadowColor",get:function(){return this._shadowColor},set:function(t){this._shadowColor!==t&&(this._shadowColor.set(t),this._markForUpdateRenderData())}},{key:"shadowOffset",get:function(){return this._shadowOffset},set:function(t){this._shadowOffset!==t&&(this._shadowOffset.set(t),this._markForUpdateRenderData())}},{key:"shadowBlur",get:function(){return this._shadowBlur},set:function(t){this._shadowBlur!==t&&(this._shadowBlur=t,this._markForUpdateRenderData())}},{key:"spriteFrame",get:function(){return this._texture}},{key:"ttfSpriteFrame",get:function(){return this._ttfSpriteFrame}},{key:"assemblerData",get:function(){return this._assemblerData}},{key:"fontAtlas",get:function(){return this._fontAtlas},set:function(t){this._fontAtlas=t}},{key:"_bmFontOriginalSize",get:function(){return this._font instanceof cF?this._font.fontSize:-1}},{key:"textStyle",get:function(){return this._textStyle}},{key:"textLayout",get:function(){return this._textLayout}},{key:"textRenderData",get:function(){return this._textRenderData}},{key:"textLayoutData",get:function(){return this._textLayoutData}},{key:"contentWidth",get:function(){return this._contentWidth},set:function(t){this._contentWidth=t}}]),e}(BL),hV.HorizontalAlign=_V,hV.VerticalAlign=dV,hV.Overflow=pV,hV.CacheMode=mV,hV._canvasPool=dF.getInstance(),v((LL=hV).prototype,"horizontalAlign",[PL],Object.getOwnPropertyDescriptor(LL.prototype,"horizontalAlign"),LL.prototype),v(LL.prototype,"verticalAlign",[EL],Object.getOwnPropertyDescriptor(LL.prototype,"verticalAlign"),LL.prototype),v(LL.prototype,"overflow",[OL],Object.getOwnPropertyDescriptor(LL.prototype,"overflow"),LL.prototype),v(LL.prototype,"font",[kL],Object.getOwnPropertyDescriptor(LL.prototype,"font"),LL.prototype),v(LL.prototype,"cacheMode",[RL],Object.getOwnPropertyDescriptor(LL.prototype,"cacheMode"),LL.prototype),VL=zh(LL.prototype,"_string",[uu],(function(){return"label"})),NL=zh(LL.prototype,"_horizontalAlign",[uu],(function(){return 1})),zL=zh(LL.prototype,"_verticalAlign",[uu],(function(){return 1})),UL=zh(LL.prototype,"_actualFontSize",[uu],(function(){return 0})),GL=zh(LL.prototype,"_fontSize",[uu],(function(){return 40})),HL=zh(LL.prototype,"_fontFamily",[uu],(function(){return"Arial"})),WL=zh(LL.prototype,"_lineHeight",[uu],(function(){return 40})),jL=zh(LL.prototype,"_overflow",[uu],(function(){return 0})),qL=zh(LL.prototype,"_enableWrapText",[uu],(function(){return!0})),XL=zh(LL.prototype,"_font",[uu],(function(){return null})),YL=zh(LL.prototype,"_isSystemFontUsed",[uu],(function(){return!0})),JL=zh(LL.prototype,"_spacingX",[uu],(function(){return 0})),KL=zh(LL.prototype,"_isItalic",[uu],(function(){return!1})),QL=zh(LL.prototype,"_isBold",[uu],(function(){return!1})),ZL=zh(LL.prototype,"_isUnderline",[uu],(function(){return!1})),$L=zh(LL.prototype,"_underlineHeight",[uu],(function(){return 2})),tV=zh(LL.prototype,"_cacheMode",[uu],(function(){return 0})),eV=zh(LL.prototype,"_enableOutline",[uu],(function(){return!1})),iV=zh(LL.prototype,"_outlineColor",[uu],(function(){return new cr(0,0,0,255)})),nV=zh(LL.prototype,"_outlineWidth",[uu],(function(){return 2})),rV=zh(LL.prototype,"_enableShadow",[uu],(function(){return!1})),sV=zh(LL.prototype,"_shadowColor",[uu],(function(){return new cr(0,0,0,255)})),aV=zh(LL.prototype,"_shadowOffset",[uu],(function(){return new ds(2,2)})),oV=zh(LL.prototype,"_shadowBlur",[uu],(function(){return 2})),FL=LL))||FL)||FL));A.Label=LV;var VV={SIMPLE:0,SLICED:1,TILED:2,FILLED:3};Re(VV);var NV={HORIZONTAL:0,VERTICAL:1,RADIAL:2};Re(NV);var zV={CUSTOM:0,TRIMMED:1,RAW:2};Re(zV);var UV,GV=t("h",(gV=Kh("cc.Sprite"),yV=Zh(110),vV=Ou(sR),bV=Ou(nR),SV=Ou(VV),wV=Ou(NV),xV=Ou(zV),gV(TV=yV((FV=function(t){function e(){var e;return(e=t.call(this)||this)._spriteFrame=CV&&CV(),e._type=DV&&DV(),e._fillType=BV&&BV(),e._sizeMode=IV&&IV(),e._fillCenter=MV&&MV(),e._fillStart=PV&&PV(),e._fillRange=EV&&EV(),e._isTrimmedMode=OV&&OV(),e._useGrayscale=kV&&kV(),e._atlas=RV&&RV(),e}s(e,t);var i=e.prototype;return i.__preload=function(){this.changeMaterialForDefine(),t.prototype.__preload.call(this)},i.onEnable=function(){t.prototype.onEnable.call(this),this._activateMaterial();var e=this._spriteFrame;e&&(this._updateUVs(),1===this._type&&e.on("uv_updated",this._updateUVs,this))},i.onDisable=function(){t.prototype.onDisable.call(this),this._spriteFrame&&1===this._type&&this._spriteFrame.off("uv_updated",this._updateUVs,this)},i.onDestroy=function(){t.prototype.onDestroy.call(this)},i.changeSpriteFrameFromAtlas=function(t){if(this._atlas){var e=this._atlas.getSpriteFrame(t);this.spriteFrame=e}else at(16377)},i.changeMaterialForDefine=function(){var t,e=this._instanceMaterialType;this._spriteFrame&&(t=this._spriteFrame.texture);var i=!1;if(t instanceof Ym){var n=t.getPixelFormat();i=1026===n||1025===n||1024===n}i&&this.grayscale?this._instanceMaterialType=4:i?this._instanceMaterialType=3:this.grayscale?this._instanceMaterialType=2:this._instanceMaterialType=1,e!==this._instanceMaterialType&&this.updateMaterial()},i._updateBuiltinMaterial=function(){var e=t.prototype._updateBuiltinMaterial.call(this);if(this.spriteFrame&&this.spriteFrame.texture instanceof wP){var i=new GT;i.copy(e,{defines:{SAMPLE_FROM_RT:!0}}),e=i}return e},i._render=function(t){t.commitComp(this,this.renderData,this._spriteFrame,this._assembler,null)},i._canRender=function(){if(!t.prototype._canRender.call(this))return!1;var e=this._spriteFrame;return!(!e||!e.texture)},i._flushAssembler=function(){var t=this,i=e.Assembler.getAssembler(t);t._assembler!==i&&(t.destroyRenderData(),t._assembler=i),t._renderData||i&&i.createData&&((t._renderData=i.createData(t)).material=t.getRenderMaterial(0),t._markForUpdateRenderData(),t.spriteFrame&&i.updateUVs(t),t._updateColor());var n=t._spriteFrame;n&&(1===t._type?n.on("uv_updated",t._updateUVs,t):n.off("uv_updated",t._updateUVs,t))},i._applySpriteSize=function(){var t=this,e=t._spriteFrame;if(e){var i=t.node._uiProps;if(2===t._sizeMode){var n=e.originalSize;i.uiTransformComp.setContentSize(n)}else if(1===t._sizeMode){var r=e.rect;i.uiTransformComp.setContentSize(r.width,r.height)}}},i._resized=function(){},i._activateMaterial=function(){var t=this._spriteFrame,e=this.getRenderMaterial(0);t&&e&&this._markForUpdateRenderData(),this.renderData&&(this.renderData.material=e)},i._updateUVs=function(){this._assembler&&this._assembler.updateUVs(this)},i._applySpriteFrame=function(t){var e=this,i=e._spriteFrame;t&&1===e._type&&t.off("uv_updated",e._updateUVs,e);var n=!1;i&&(t&&t.texture===i.texture||(n=!0),n&&(e.renderData&&(e.renderData.textureDirty=!0),(!!t&&t.texture instanceof wP)!=i.texture instanceof wP&&(e._instanceMaterialType=-1),e.changeMaterialForDefine()),e._applySpriteSize(),1===e._type&&i.on("uv_updated",e._updateUVs,e))},n(e,[{key:"spriteAtlas",get:function(){return this._atlas},set:function(t){this._atlas!==t&&(this._atlas=t)}},{key:"spriteFrame",get:function(){return this._spriteFrame},set:function(t){if(this._spriteFrame!==t){var e=this._spriteFrame;this._spriteFrame=t,this._markForUpdateRenderData(),this._applySpriteFrame(e)}}},{key:"type",get:function(){return this._type},set:function(t){this._type!==t&&(this._type=t,this._flushAssembler())}},{key:"fillType",get:function(){return this._fillType},set:function(t){this._fillType!==t&&(2===t||2===this._fillType?this.destroyRenderData():this.renderData&&this._markForUpdateRenderData(!0)),this._fillType=t,this._flushAssembler()}},{key:"fillCenter",get:function(){return this._fillCenter},set:function(t){this._fillCenter.x=t.x,this._fillCenter.y=t.y,3===this._type&&this.renderData&&this._markForUpdateRenderData()}},{key:"fillStart",get:function(){return this._fillStart},set:function(t){this._fillStart=$i(t,0,1),3===this._type&&this.renderData&&(this._markForUpdateRenderData(),this._updateUVs())}},{key:"fillRange",get:function(){return this._fillRange},set:function(t){this._fillRange=$i(t,-1,1),3===this._type&&this.renderData&&(this._markForUpdateRenderData(),this._updateUVs())}},{key:"trim",get:function(){return this._isTrimmedMode},set:function(t){this._isTrimmedMode!==t&&(this._isTrimmedMode=t,0===this._type&&this.renderData&&this._markForUpdateRenderData(!0))}},{key:"grayscale",get:function(){return this._useGrayscale},set:function(t){this._useGrayscale!==t&&(this._useGrayscale=t,this.changeMaterialForDefine(),this.updateMaterial())}},{key:"sizeMode",get:function(){return this._sizeMode},set:function(t){this._sizeMode!==t&&(this._sizeMode=t,0!==t&&this._applySpriteSize())}}]),e}(BL),FV.FillType=NV,FV.Type=VV,FV.SizeMode=zV,FV.EventType={SPRITE_FRAME_CHANGED:"spriteframe-changed"},v((AV=FV).prototype,"spriteAtlas",[vV],Object.getOwnPropertyDescriptor(AV.prototype,"spriteAtlas"),AV.prototype),v(AV.prototype,"spriteFrame",[bV],Object.getOwnPropertyDescriptor(AV.prototype,"spriteFrame"),AV.prototype),v(AV.prototype,"type",[SV],Object.getOwnPropertyDescriptor(AV.prototype,"type"),AV.prototype),v(AV.prototype,"fillType",[wV],Object.getOwnPropertyDescriptor(AV.prototype,"fillType"),AV.prototype),v(AV.prototype,"sizeMode",[xV],Object.getOwnPropertyDescriptor(AV.prototype,"sizeMode"),AV.prototype),CV=zh(AV.prototype,"_spriteFrame",[uu],(function(){return null})),DV=zh(AV.prototype,"_type",[uu],(function(){return 0})),BV=zh(AV.prototype,"_fillType",[uu],(function(){return 0})),IV=zh(AV.prototype,"_sizeMode",[uu],(function(){return 1})),MV=zh(AV.prototype,"_fillCenter",[uu],(function(){return new ds(0,0)})),PV=zh(AV.prototype,"_fillStart",[uu],(function(){return 0})),EV=zh(AV.prototype,"_fillRange",[uu],(function(){return 0})),OV=zh(AV.prototype,"_isTrimmedMode",[uu],(function(){return!0})),kV=zh(AV.prototype,"_useGrayscale",[uu],(function(){return!1})),RV=zh(AV.prototype,"_atlas",[uu],(function(){return null})),TV=AV))||TV)||TV));A.Sprite=GV;var HV,WV=t("i",Kh("cc.UIMeshRenderer")(UV=Zh(110)(UV=function(t){function e(){var e;return(e=t.call(this)||this)._modelComponent=null,e._dirtyVersion=-1,e._internalId=-1,e.stencilStage=0,e._renderData=null,e._renderEntity=new DL(1),e}s(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiComp=this},i.onEnable=function(){FE.addRenderer(this),this._markForUpdateRenderData()},i.onDisable=function(){FE.removeRenderer(this),this.renderEntity.enabled=this._canRender()},i.onLoad=function(){this.node._getUITransformComp()||this.node.addComponent("cc.UITransform"),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent?this.renderEntity.setNode(this.node):at(16378,this.node?this.node.name:"")},i.onDestroy=function(){this.renderEntity.setNode(null),this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent&&(this._modelComponent._sceneGetter=null)},i._render=function(t){if(this._modelComponent){var e=this._modelComponent._collectModels();this._modelComponent._detachFromScene();for(var i=0;i<e.length;i++)e[i].enabled&&t.commitModel(this,e[i],this._modelComponent.material);return!0}return!1},i.fillBuffers=function(t){this.enabled&&this._render(t)},i.updateRenderer=function(){},i._uploadRenderData=function(){},i.postUpdateAssembler=function(){},i.update=function(){this._fitUIRenderQueue()},i._fitUIRenderQueue=function(){if(this._modelComponent)for(var t=this._modelComponent.sharedMaterials.length,e=0;e<t;e++){var i=this._modelComponent.getMaterialInstance(e);if(null!=i)for(var n=i.passes,r=n.length,s=0;s<r;s++)n[s].setPriority(244),i.recompileShaders({CC_FORCE_FORWARD_SHADING:!0},s)}},i.markForUpdateRenderData=function(t){void 0===t&&(t=!0),this._markForUpdateRenderData(t)},i._markForUpdateRenderData=function(){FE.markDirtyRenderer(this)},i.setNodeDirty=function(){},i.setTextureDirty=function(){},i._canRender=function(){return this.enabled&&null!==this._modelComponent},n(e,[{key:"modelComponent",get:function(){return this._modelComponent}},{key:"renderEntity",get:function(){return this._renderEntity}},{key:"renderData",get:function(){return this._renderData}}]),e}(yg))||UV)||UV);A.UIMeshRenderer=WV;var jV=t("j",Kh("cc.LabelOutline")(HV=Zh(110)(HV=Qh(LV)(HV=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){this.node.getComponent(LV).enableOutline=!0},i.onDisable=function(){this.node.getComponent(LV).enableOutline=!1},n(e,[{key:"color",get:function(){return this.node.getComponent(LV).outlineColor},set:function(t){this.node.getComponent(LV).outlineColor=t}},{key:"width",get:function(){return this.node.getComponent(LV).outlineWidth},set:function(t){this.node.getComponent(LV).outlineWidth=t}}]),e}(yg))||HV)||HV)||HV);A.LabelOutline=jV;var qV,XV,YV,JV,KV,QV,ZV=Ly.Enum.NONE|Ly.Enum.UI_3D,$V=function(){function t(){this.model=null,this.texture=null,this.sampler=null,this.useLocalData=null,this.isStatic=!1,this.textureHash=0,this.samplerHash=0,this._passes=[],this._shaders=[],this.visFlags=ZV,this.inputAssembler=null,this.descriptorSet=null}var e=t.prototype;return e.destroy=function(){this._passes=[]},e.clear=function(){this.inputAssembler=null,this.descriptorSet=null,this.texture=null,this.sampler=null,this.textureHash=0,this.samplerHash=0,this.model=null,this.isStatic=!1,this.useLocalData=null,this.visFlags=ZV},e.fillPasses=function(t,e,i,n){if(t){var r=t.passes;if(!r)return;this._shaders.length=r.length;for(var s=0;s<r.length;s++){this._passes[s]||(this._passes[s]=new wT(A.director.root));var a=r[s],o=this._passes[s];a.update(),e||(e=a.depthStencilState,i=0),o._initPassFromTarget(a,e,i),this._shaders[s]=o.getShaderVariant(n)}}},n(t,[{key:"passes",get:function(){return this._passes}},{key:"shaders",get:function(){return this._shaders}}]),t}(),tN=t("k",Kh("cc.UIStaticBatch")(qV=Zh(110)((XV=function(t){function e(){var e;return(e=t.call(this)||this)._init=!1,e._bufferAccessor=null,e._dirty=!0,e._uiDrawBatchList=[],e}s(e,t);var i=e.prototype;return i.postUpdateAssembler=function(){},i.markAsDirty=function(){},i._requireDrawBatch=function(){var t=new $V;return t.isStatic=!0,this._uiDrawBatchList.push(t),t},i._clearData=function(){if(this._bufferAccessor){this._bufferAccessor.reset();for(var t=this._getBatcher(),e=0;e<this._uiDrawBatchList.length;e++)this._uiDrawBatchList[e].destroy(t)}this._uiDrawBatchList.length=0,this._init=!1},i._getBatcher=function(){return YE.root&&YE.root.batcher2D?YE.root.batcher2D:(at(9301),null)},n(e,[{key:"color",get:function(){return this._color},set:function(t){this._color!==t&&this._color.set(t)}},{key:"drawBatchList",get:function(){return this._uiDrawBatchList}}]),e}(BL),v(XV.prototype,"color",[Gu],Object.getOwnPropertyDescriptor(XV.prototype,"color"),XV.prototype),qV=XV))||qV)||qV),eN=t("m",Kh("cc.LabelShadow")(YV=Zh(110)(YV=Qh(LV)(YV=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){this.node.getComponent(LV).enableShadow=!0},i.onDisable=function(){this.node.getComponent(LV).enableShadow=!1},n(e,[{key:"color",get:function(){return this.node.getComponent(LV).shadowColor},set:function(t){this.node.getComponent(LV).shadowColor=t}},{key:"offset",get:function(){return this.node.getComponent(LV).shadowOffset},set:function(t){this.node.getComponent(LV).shadowOffset=t}},{key:"blur",get:function(){return this.node.getComponent(LV).shadowBlur},set:function(t){this.node.getComponent(LV).shadowBlur=t}}]),e}(yg))||YV)||YV)||YV),iN=t("n",Kh("cc.UIOpacity")(JV=Zh(110)(JV=$h((KV=function(t){function e(){var e;return(e=t.call(this)||this)._parentOpacity=1,e._parentOpacityResetFlag=!0,e._opacity=QV&&QV(),e}s(e,t);var i=e.prototype;return i._setParentOpacity=function(t){this._parentOpacity=t},i._getParentOpacity=function(t){if(null==t||!t.isValid)return 1;var i=t._uiProps.uiComp,n=t.getComponent(e);return i&&i.color?1:n?n._parentOpacity*(n._opacity/255):this._getParentOpacity(t.getParent())},i._parentChanged=function(){},i._setEntityLocalOpacityRecursively=function(){},i.onEnable=function(){this.node.on("parent-changed",this._parentChanged,this),this.node._uiProps.localOpacity=this._parentOpacity*this._opacity/255,this._parentOpacityResetFlag?(this._parentChanged(),this._parentOpacityResetFlag=!1):this._setEntityLocalOpacityRecursively(this.node._uiProps.localOpacity)},i.onDisable=function(){this.node.off("parent-changed",this._parentChanged,this),this.node._uiProps.localOpacity=1,this._setEntityLocalOpacityRecursively(this.node._uiProps.localOpacity)},n(e,[{key:"opacity",get:function(){return this._opacity},set:function(t){this._opacity!==t&&(t=$i(t,0,255),this._opacity=t,this.node._uiProps.localOpacity=t/255)}}]),e}(yg),QV=zh(KV.prototype,"_opacity",[uu],(function(){return 255})),JV=KV))||JV)||JV)||JV);function nN(t){return--t,t|=t>>16,t|=t>>8,t|=t>>4,t|=t>>2,t|=t>>1,++t}function rN(t,e){return Math.ceil(t/e)*e}var sN=function(){function t(t){this._format=0,this._formatSize=0,this._chunks=[],this._chunkCount=0,this._handles=[],this._region0=new id,this._region1=new id,this._region2=new id,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=ip[t.format];this._format=t.format,this._formatSize=e.size,this._channels=e.count,this._bufferViewCtor=cp(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<this._chunkCount;++t)this._chunks[t].texture.destroy();this._chunks.length=0,this._handles.length=0},e.alloc=function(t,e){t=rN(t,this._alignment);var i=-1,n=-1;if(void 0!==e&&(i=e,n=this._findAvailableSpace(t,i)),n<0)for(var r=0;r<this._chunkCount&&(i=r,!((n=this._findAvailableSpace(t,i))>=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,nN(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;e<this._handles.length;++e)if(this._handles[e]===t)return this._chunks[t.chunkIdx].end=t.end,void this._handles.splice(e,1)},e.createChunk=function(t){var e=t*t*this._formatSize;Q("TextureBufferPool: Allocate chunk "+this._chunkCount+", size: "+e+", format: "+this._format);var i={texture:this._device.createTexture(new dd(1,6,this._format,t,t)),size:e,start:0,end:e};return this._chunks[this._chunkCount]=i,this._chunkCount++},e.update=function(t,e){var i=[],n=[],r=t.start/this._formatSize,s=e.byteLength/this._formatSize,a=r%t.texture.width,o=Math.floor(r/t.texture.width),h=Math.min(t.texture.width-a,s),u=0;a>0&&(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;a<s.length;a++){var o=s[a];if(r+t<=o.start){n=!0;break}r=o.end}!n&&r+t<=i.size&&(n=!0)}return n?r:-1},e._McDonaldAlloc=function(t){t=rN(t,this._alignment);for(var e=0;e<this._chunkCount;++e){var i=this._chunks[e],n=!1,r=i.start;if(r+t<=i.end?n=!0:r>i.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,nN(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(OP.prototype,"RenderScene.prototype",[{name:"raycastUI2DNode"},{name:"raycastUINode"}]),mt(OP.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(KM.prototype,"Model.prototype",[{name:"isInstancingEnabled"},{name:"instancedAttributes"}]);var aN={};mt(aN,"CameraVisFlags",[{name:"GENERAL"}]),pt(aN,"CameraVisFlags",[{name:"PROFILER",newName:"PROFILER",target:Ly.BitMask,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Ly.BitMask,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Ly.BitMask,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Ly.BitMask,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Ly.BitMask,targetName:"UI_2D"}]),C.CameraVisFlags=aN;var oN={};mt(oN,"VisibilityFlags",[{name:"GENERAL"}]),pt(oN,"VisibilityFlags",[{name:"ALWALS",newName:"ALWALS",target:Ly.Enum,targetName:"ALWALS"},{name:"PROFILER",newName:"PROFILER",target:Ly.Enum,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Ly.Enum,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Ly.Enum,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Ly.Enum,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Ly.Enum,targetName:"UI_2D"}]),C.VisibilityFlags=oN,pt(wT.prototype,"Pass.prototype",[{name:"getBindingTypeFromHandle",newName:"getDescriptorTypeFromHandle"}]),mt(NM.prototype,"Camera.prototype",[{name:"getSplitFrustum"},{name:"setMatView"},{name:"setMatViewInv"},{name:"setMatProjInv"},{name:"setMatViewProjInv"},{name:"setMatProj"},{name:"setMatViewProj"},{name:"getMatViewInv"}]),mt(JT.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(dP.prototype,"SpotLight.prototype",[{name:"aspect"}]),pt(UM.prototype,"SubModel.prototype",[{name:"subMeshData",newName:"subMesh"}]),mt(UM.prototype,"SubModel.prototype",[{name:"getSubModel",suggest:"Use `subModels[i]` instead"},{name:"subModelNum",suggest:"Use `subModels.length` instead"}]);var hN=Object.freeze({__proto__:null,BatchingSchemes:{NONE:0,INSTANCING:1},CameraVisFlags:aN,MaterialInstance:QT,Pass:wT,PassInstance:KT,PassStage:{DEFAULT:1,FORWARD:2,SHADOWCAST:4},RenderQueue:{OPAQUE:0,TRANSPARENT:1,OVERLAY:2},RenderScene:OP,RenderWindow:VP,TextureBufferPool:sN,VisibilityFlags:oN,createIA:function(t,e){if(!e.positions)return ht(16306),null;for(var i=[],n=e.positions.length/3,r=0;r<n;++r)i.push(e.positions[3*r],e.positions[3*r+1],e.positions[3*r+2]),e.normals&&i.push(e.normals[3*r],e.normals[3*r+1],e.normals[3*r+2]),e.uvs&&i.push(e.uvs[2*r],e.uvs[2*r+1]),e.colors&&i.push(e.colors[3*r],e.colors[3*r+1],e.colors[3*r+2]);var s=[];s.push(new Cd("a_position",32)),e.normals&&s.push(new Cd("a_normal",32)),e.uvs&&s.push(new Cd("a_texCoord",21)),e.colors&&s.push(new Cd("a_color",32));var a=t.createBuffer(new ud(10,1,4*i.length,4*i.length/n));a.update(new Float32Array(i));var o=null;return e.indices&&(o=t.createBuffer(new ud(6,1,2*e.indices.length,2))).update(new Uint16Array(e.indices)),t.createInputAssembler(new Bd(s,[a],o))},customizeType:ew,genHandle:KS,getBindingFromHandle:ZS,getCountFromHandle:$S,getDefaultFromType:aw,getDeviceShaderVersion:Aw,getOffsetFromHandle:tw,getStringFromType:ow,getTypeFromHandle:QS,nearestPOT:nN,overrideMacros:hw,programLib:Ow,scene:EP,type2reader:iw,type2validator:rw,type2writer:nw});t("aI",hN);var uN={BUTT:0,ROUND:1,SQUARE:2};Re(uN);var lN={BEVEL:0,ROUND:1,MITER:2};Re(lN),Re({PT_CORNER:1,PT_LEFT:2,PT_BEVEL:4,PT_INNERBEVEL:8});var cN=Math.PI,fN=Math.min,_N=Math.max,dN=Math.cos,pN=Math.sin,mN=Math.abs,gN=Math.sign,yN=.5522847493;function vN(t,e,i,n,r,s,a){var o,h,u=0,l=0,c=0,f=0,_=0,d=0,p=0,m=0,g=0,y=0,v=0,b=0,S=0,w=0;if(l=s-r,a=a||!1)if(mN(l)>=2*cN)l=2*cN;else for(;l<0;)l+=2*cN;else if(mN(l)>=2*cN)l=2*-cN;else for(;l>0;)l-=2*cN;for(h=0|_N(1,fN(mN(l)/(.5*cN)+.5,5)),c=mN(4/3*(1-dN(o=l/h/2))/pN(o)),a||(c=-c),w=0;w<=h;w++)d=e+(f=dN(u=r+l*(w/h)))*n,p=i+(_=pN(u))*n,m=-_*n*c,g=f*n*c,0===w?t.moveTo(d,p):t.bezierCurveTo(y+b,v+S,d-m,p-g,d,p),y=d,v=p,b=m,S=g}function bN(t,e,i,n,r){t.moveTo(e-n,i),t.bezierCurveTo(e-n,i+r*yN,e-n*yN,i+r,e,i+r),t.bezierCurveTo(e+n*yN,i+r,e+n,i+r*yN,e+n,i),t.bezierCurveTo(e+n,i-r*yN,e+n*yN,i-r,e,i-r),t.bezierCurveTo(e-n*yN,i-r,e-n,i-r*yN,e-n,i),t.close()}function SN(t,e,i,n,r,s){if(s<.1)t.rect(e,i,n,r);else{var a=fN(s,.5*mN(n))*gN(n),o=fN(s,.5*mN(r))*gN(r);t.moveTo(e,i+o),t.lineTo(e,i+r-o),t.bezierCurveTo(e,i+r-o*(1-yN),e+a*(1-yN),i+r,e+a,i+r),t.lineTo(e+n-a,i+r),t.bezierCurveTo(e+n-a*(1-yN),i+r,e+n,i+r-o*(1-yN),e+n,i+r-o),t.lineTo(e+n,i+o),t.bezierCurveTo(e+n,i+o*(1-yN),e+n-a*(1-yN),i,e+n-a,i),t.lineTo(e+a,i),t.bezierCurveTo(e+a*(1-yN),i,e,i+o*(1-yN),e,i+o),t.close()}}function wN(t,e,i,n,r,s,a,o,h,u,l){var c,f,_,d,p,m,g,y,v,b,S,w,x,T,A,C;u>10||(p=.5*(s+o),m=.5*(a+h),g=.5*((c=.5*(e+n))+(_=.5*(n+s))),y=.5*((f=.5*(i+r))+(d=.5*(r+a))),((A=mN((n-o)*(T=h-i)-(r-h)*(x=o-e)))+(C=mN((s-o)*T-(a-h)*x)))*(A+C)<t.tessTol*(x*x+T*T)?t.addPoint(o,h,0===l?4|l:l):(wN(t,e,i,c,f,g,y,S=.5*(g+(v=.5*(_+p))),w=.5*(y+(b=.5*(d+m))),u+1,0),wN(t,S,w,v,b,p,m,o,h,u+1,l)))}var xN,TN,AN,CN,DN,BN,IN,MN,PN,EN,ON,kN,RN,FN,LN,VN,NN,zN,UN,GN,HN,WN,jN,qN=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).dx=0,n.dy=0,n.dmx=0,n.dmy=0,n.flags=0,n.len=0,n}return s(e,t),e.prototype.reset=function(){this.dx=0,this.dy=0,this.dmx=0,this.dmy=0,this.flags=0,this.len=0},e}(ds),XN=function(){function t(){this.closed=!1,this.bevel=0,this.complex=!0,this.points=[]}return t.prototype.reset=function(){this.closed=!1,this.bevel=0,this.complex=!0,this.points.length=0},t}(),YN=function(){function t(t){this.dataOffset=0,this.updatePathOffset=!1,this.pathLength=0,this.pathOffset=0,this.paths=[],this.tessTol=.25,this.distTol=.01,this.fillColor=cr.WHITE.clone(),this.lineCap=0,this.strokeColor=cr.BLACK.clone(),this.lineJoin=2,this.lineWidth=0,this.pointsOffset=0,this._commandX=0,this._commandY=0,this._points=[],this._renderDataList=[],this._curPath=null,this._comp=t}var e=t.prototype;return e.moveTo=function(t,e){this.updatePathOffset&&(this.pathOffset=this.pathLength,this.updatePathOffset=!1),this._addPath(),this.addPoint(t,e,1),this._commandX=t,this._commandY=e},e.lineTo=function(t,e){this.addPoint(t,e,1),this._commandX=t,this._commandY=e},e.bezierCurveTo=function(t,e,i,n,r,s){var a=this._curPath,o=a.points[a.points.length-1];o&&(o.x!==t||o.y!==e||i!==r||n!==s?(wN(this,o.x,o.y,t,e,i,n,r,s,0,1),this._commandX=r,this._commandY=s):this.lineTo(r,s))},e.quadraticCurveTo=function(t,e,i,n){var r=this._commandX,s=this._commandY;this.bezierCurveTo(r+2/3*(t-r),s+2/3*(e-s),i+2/3*(t-i),n+2/3*(e-n),i,n)},e.arc=function(t,e,i,n,r,s){vN(this,t,e,i,n,r,s)},e.ellipse=function(t,e,i,n){bN(this,t,e,i,n),this._curPath.complex=!1},e.circle=function(t,e,i){bN(this,t,e,i,i),this._curPath.complex=!1},e.rect=function(t,e,i,n){this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+n),this.lineTo(t,e+n),this.close(),this._curPath.complex=!1},e.roundRect=function(t,e,i,n,r){SN(this,t,e,i,n,r),this._curPath.complex=!1},e.clear=function(){this.pathLength=0,this.pathOffset=0,this.pointsOffset=0,this.dataOffset=0,this._curPath=null,this.paths.length=0,this._points.length=0;for(var t=this._renderDataList,e=0,i=t.length;e<i;e++){var n=t[e];n&&(eL.remove(n),n.removeRenderDrawInfo(this._comp))}this._renderDataList.length=0},e.close=function(){this._curPath.closed=!0},e.requestRenderData=function(){var t=eL.add();return this._renderDataList.push(t),t},e.getRenderDataList=function(){return 0===this._renderDataList.length&&this.requestRenderData(),this._renderDataList},e.addPoint=function(t,e,i){var n=this._curPath;if(n){var r=this._points,s=n.points,a=r[this.pointsOffset++];a?(a.x=t,a.y=e):(a=new qN(t,e),r.push(a)),a.flags=i,s.push(a)}},e._addPath=function(){var t=this.pathLength,e=this.paths[t];return e?e.reset():(e=new XN,this.paths.push(e)),this.pathLength++,this._curPath=e,e},t}(),JN=BF.concat([new Cd("a_dist",11)]),KN=OF(JN),QN=kF(JN),ZN=t("G",(xN=Kh("cc.Graphics"),TN=Zh(110),AN=Ou(lN),CN=Ou(uN),xN(DN=TN((RN=function(t){function e(){var e;return(e=t.call(this)||this).impl=null,e.model=null,e._lineWidth=IN&&IN(),e._strokeColor=MN&&MN(),e._lineJoin=PN&&PN(),e._lineCap=EN&&EN(),e._fillColor=ON&&ON(),e._miterLimit=kN&&kN(),e._isDrawing=!1,e._isNeedUploadData=!0,e._graphicsUseSubMeshes=[],e._instanceMaterialType=0,e.impl=new YN(f(e)),e}s(e,t);var i=e.prototype;return i.onRestore=function(){this.impl||this._flushAssembler()},i.onLoad=function(){t.prototype.onLoad.call(this),this.model=YE.root.createModel(KM),this.model.node=this.model.transform=this.node,this._flushAssembler()},i.onEnable=function(){t.prototype.onEnable.call(this),this._updateMtlForGraphics()},i.onDestroy=function(){this._sceneGetter=null,this.model&&(YE.root.destroyModel(this.model),this.model=null);var e=this._graphicsUseSubMeshes.length;if(e>0){for(var i=0;i<e;++i)this._graphicsUseSubMeshes[i].destroy();this._graphicsUseSubMeshes.length=0}this.impl&&(this._isDrawing=!1,this.impl.clear(),this.impl=null),t.prototype.onDestroy.call(this)},i.moveTo=function(t,e){this.impl&&this.impl.moveTo(t,e)},i.lineTo=function(t,e){this.impl&&this.impl.lineTo(t,e)},i.bezierCurveTo=function(t,e,i,n,r,s){this.impl&&this.impl.bezierCurveTo(t,e,i,n,r,s)},i.quadraticCurveTo=function(t,e,i,n){this.impl&&this.impl.quadraticCurveTo(t,e,i,n)},i.arc=function(t,e,i,n,r,s){this.impl&&this.impl.arc(t,e,i,n,r,s)},i.ellipse=function(t,e,i,n){this.impl&&this.impl.ellipse(t,e,i,n)},i.circle=function(t,e,i){this.impl&&this.impl.circle(t,e,i)},i.rect=function(t,e,i,n){this.impl&&this.impl.rect(t,e,i,n)},i.roundRect=function(t,e,i,n,r){this.impl&&this.impl.roundRect(t,e,i,n,r)},i.fillRect=function(t,e,i,n){this.rect(t,e,i,n),this.fill()},i.clear=function(){if(this.impl){if(this.impl.clear(),this._isDrawing=!1,this.model)for(var t=0;t<this.model.subModels.length;t++)this.model.subModels[t].inputAssembler.indexCount=0;this._markForUpdateRenderData()}},i.close=function(){this.impl&&this.impl.close()},i.stroke=function(){this._assembler||this._flushAssembler(),this._isDrawing=!0,this._isNeedUploadData=!0,this._assembler.stroke(this)},i.fill=function(){this._assembler||this._flushAssembler(),this._isDrawing=!0,this._isNeedUploadData=!0,this._assembler.fill(this)},i._updateMtlForGraphics=function(){var t;this._customMaterial?t=this.getMaterialInstance(0):(t=mT.get("ui-graphics-material"),this.setSharedMaterial(t,0),(t=this.getMaterialInstance(0)).recompileShaders({USE_LOCAL:!0}))},i.activeSubModel=function(t){if(this.model){if(this.model.subModels.length<=t){var e=Wp.gfxDevice,i=e.createBuffer(new ud(10,1,65535*QN,QN)),n=e.createBuffer(new ud(6,1,262140,2)),r=new sO([i],JN,7,n);r.subMeshIdx=0,this.model.initSubModel(t,r,this.getMaterialInstance(0)),this._graphicsUseSubMeshes.push(r)}}else at(4500,this.node.name)},i._uploadData=function(){var t=this.impl;if(t){var e=t&&t.getRenderDataList();if(!(e.length<=0)&&this.model){for(var i=this.model.subModels,n=0;n<e.length;n++){var r=e[n],s=i[n].inputAssembler;if(r.lastFilledVertex!==r.vertexStart){var a=new Float32Array(r.vData.buffer,0,r.vertexStart*KN);s.vertexBuffers[0].update(a),s.vertexCount=r.vertexStart;var o=new Uint16Array(r.iData.buffer,0,r.indexStart);s.indexBuffer.update(o),s.indexCount=r.indexStart,r.lastFilledVertex=r.vertexStart,r.lastFilledIndex=r.indexStart}}this._isNeedUploadData=!1}}},i._render=function(t){if(this._isNeedUploadData){if(this.impl){var e=this.impl.getRenderDataList(),i=this.model.subModels.length;if(e.length>i)for(var n=i;n<e.length;n++)this.activeSubModel(n)}this._uploadData()}t.commitModel(this,this.model,this.getMaterialInstance(0))},i._flushAssembler=function(){var t=e.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t)},i._canRender=function(){return!!t.prototype._canRender.call(this)&&!!this.model&&this._isDrawing},i.updateRenderer=function(){t.prototype.updateRenderer.call(this)},i.createRenderEntity=function(){return new DL(1)},n(e,[{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.impl&&(this.impl.lineWidth=t)}},{key:"lineJoin",get:function(){return this._lineJoin},set:function(t){this._lineJoin=t,this.impl&&(this.impl.lineJoin=t)}},{key:"lineCap",get:function(){return this._lineCap},set:function(t){this._lineCap=t,this.impl&&(this.impl.lineCap=t)}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this.impl&&(this._strokeColor.set(t),this.impl.strokeColor=this._strokeColor)}},{key:"fillColor",get:function(){return this._fillColor},set:function(t){this.impl&&(this._fillColor.set(t),this.impl.fillColor=this._fillColor)}},{key:"miterLimit",get:function(){return this._miterLimit},set:function(t){this._miterLimit=t}},{key:"color",get:function(){return this._color},set:function(t){this._color!==t&&this._color.set(t)}},{key:"graphicsNativeProxy",get:function(){return this._graphicsNativeProxy}}]),e}(BL),RN.LineJoin=lN,RN.LineCap=uN,v((BN=RN).prototype,"lineJoin",[AN],Object.getOwnPropertyDescriptor(BN.prototype,"lineJoin"),BN.prototype),v(BN.prototype,"lineCap",[CN],Object.getOwnPropertyDescriptor(BN.prototype,"lineCap"),BN.prototype),v(BN.prototype,"color",[Gu],Object.getOwnPropertyDescriptor(BN.prototype,"color"),BN.prototype),IN=zh(BN.prototype,"_lineWidth",[uu],(function(){return 1})),MN=zh(BN.prototype,"_strokeColor",[uu],(function(){return cr.BLACK.clone()})),PN=zh(BN.prototype,"_lineJoin",[uu],(function(){return 2})),EN=zh(BN.prototype,"_lineCap",[uu],(function(){return 0})),ON=zh(BN.prototype,"_fillColor",[uu],(function(){return cr.WHITE.clone()})),kN=zh(BN.prototype,"_miterLimit",[uu],(function(){return 10})),DN=BN))||DN)||DN));A.Graphics=ZN;var $N=new Kr,tz=new ds,ez=new Kr,iz=[];function nz(t,e,i){iz.length=0;for(var n=2*Math.PI/i,r=0;r<i;++r)iz.push(new ir(e.x*Math.cos(n*r)+t.x,e.y*Math.sin(n*r)+t.y,0));return iz}var rz=t("eU",{GRAPHICS_RECT:0,GRAPHICS_ELLIPSE:1,GRAPHICS_STENCIL:2,SPRITE_STENCIL:3});Re(rz);var sz,az,oz,hz,uz,lz,cz=t("q",(FN=Kh("cc.Mask"),LN=Zh(110),VN=Ou(rz),FN(NN=LN((jN=function(t){function e(){var e;return(e=t.call(this)||this)._type=UN&&UN(),e._inverted=GN&&GN(),e._segments=HN&&HN(),e._alphaThreshold=WN&&WN(),e._sprite=null,e._graphics=null,e._stencilStage=0,e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._changeRenderType()},i.onEnable=function(){this._changeRenderType(),this._updateGraphics(),this._enableRender(),this.node.on("anchor-changed",this._nodeStateChange,this),this.node.on("size-changed",this._nodeStateChange,this)},i.onRestore=function(){this._changeRenderType(),this._updateGraphics()},i.onDisable=function(){this._disableRender(),this.node.off("anchor-changed",this._nodeStateChange,this),this.node.off("size-changed",this._nodeStateChange,this)},i.onDestroy=function(){this._removeMaskNode()},i.isHit=function(t){var e=this.node._getUITransformComp(),i=e.contentSize,n=i.width,r=i.height,s=tz;this.node.getWorldMatrix($N),Kr.invert(ez,$N),ds.transformMat4(s,t,ez);var a=e.anchorPoint;s.x+=a.x*n,s.y+=a.y*r;var o=!1;if(0===this.type||2===this.type||3===this.type)o=s.x>=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(GV);if(!t){var e=this.node;t=this._sprite=e.addComponent(GV)}}this._sprite.stencilStage=this.inverted?6:2,this._sprite.updateMaterial()},i._createGraphics=function(){if(!this._graphics){var t=this._graphics=this.node.getComponent(ZN);if(!t){var e=this.node;t=this._graphics=e.addComponent(ZN)}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=nz(new ir(a+n/2,o+r/2,0),new ir(n/2,r/2,0),this._segments),u=0;u<h.length;++u){var l=h[u];0===u?e.moveTo(l.x,l.y):e.lineTo(l.x,l.y)}e.close()}e.fill()}},i._enableRender=function(){this.subComp&&(this.subComp.enabled=!0)},i._disableRender=function(){this.subComp&&(this.subComp.stencilStage=0,this.subComp.updateMaterial(),this.node.activeInHierarchy&&(this.subComp.enabled=!1))},i._removeMaskNode=function(){this._sprite&&(this._sprite=null),this._graphics&&(this._graphics=null)},i.markForUpdateRenderData=function(t){void 0===t&&(t=!0),at(9007),this.subComp&&this.subComp._markForUpdateRenderData(t)},i.requestRenderData=function(){at(9007)},i.destroyRenderData=function(){at(9007)},i.updateRenderer=function(){at(9007),this.subComp&&this.subComp.updateRenderer()},i.fillBuffers=function(){at(9007)},i.postUpdateAssembler=function(){at(9007)},i.setNodeDirty=function(){at(9007),this.subComp&&this.subComp.setNodeDirty()},i.setTextureDirty=function(){at(9007),this.subComp&&this.subComp.setTextureDirty()},i.getMaterial=function(t){return at(9007),this.subComp?this.subComp.getSharedMaterial(t):null},i.setMaterial=function(t,e){at(9007),this.subComp&&this.subComp.setMaterial(t,e)},i.getMaterialInstance=function(t){return at(9007),this.subComp?this.subComp.getMaterialInstance(t):null},i.setMaterialInstance=function(t,e){at(9007),this.subComp&&this.subComp.setMaterialInstance(t,e)},i.getRenderMaterial=function(t){return at(9007),this.subComp?this.subComp.getRenderMaterial(t):null},n(e,[{key:"type",get:function(){return this._type},set:function(t){this._type!==t&&(this._type=t,3!==this._type?(this._sprite&&(this.node.removeComponent(GV),this._sprite._destroyImmediate(),this._sprite=null),this._changeRenderType(),this._updateGraphics()):(this._graphics&&(this._graphics.clear(),this.node.removeComponent(ZN),this._graphics._destroyImmediate(),this._graphics=null),this._changeRenderType()))}},{key:"inverted",get:function(){return this._inverted},set:function(t){this._inverted=t,this.subComp.stencilStage=this.inverted?6:2}},{key:"segments",get:function(){return this._segments},set:function(t){this._segments!==t&&(this._segments=$i(t,3,1e4),this._updateGraphics())}},{key:"spriteFrame",get:function(){return this._sprite?this._sprite.spriteFrame:null},set:function(t){this._sprite?this._sprite.spriteFrame=t:ht(16307)}},{key:"alphaThreshold",get:function(){return this._alphaThreshold},set:function(t){this._alphaThreshold!==t&&(this._alphaThreshold=t,3===this.type&&this._sprite&&this._sprite.getMaterialInstance(0).setProperty("alphaThreshold",this._alphaThreshold))}},{key:"subComp",get:function(){return this._graphics||this._sprite}},{key:"customMaterial",get:function(){return at(9007),this.subComp?this.subComp.customMaterial:null},set:function(t){at(9007),this.subComp&&(this.subComp.customMaterial=t)}},{key:"color",get:function(){return at(9007),this.subComp?this.subComp.color:null},set:function(t){at(9007),this.subComp&&t&&(this.subComp.color=t)}},{key:"sharedMaterial",get:function(){return at(9007),this.subComp?this.subComp.sharedMaterial:null}},{key:"sharedMaterials",get:function(){return at(9007),this.subComp?this.subComp.sharedMaterials:null},set:function(t){at(9007),this.subComp&&t&&(this.subComp.sharedMaterials=t)}},{key:"material",get:function(){return at(9007),this.subComp?this.subComp.material:null},set:function(t){at(9007),this.subComp&&(this.subComp.material=t)}},{key:"materials",get:function(){return at(9007),this.subComp?this.subComp.materials:[null]},set:function(t){at(9007),this.subComp&&(this.subComp.materials=t)}}]),e}(yg),jN.Type=rz,v((zN=jN).prototype,"type",[VN],Object.getOwnPropertyDescriptor(zN.prototype,"type"),zN.prototype),UN=zh(zN.prototype,"_type",[uu],(function(){return 0})),GN=zh(zN.prototype,"_inverted",[uu],(function(){return!1})),HN=zh(zN.prototype,"_segments",[uu],(function(){return 64})),WN=zh(zN.prototype,"_alphaThreshold",[uu],(function(){return.1})),NN=zN))||NN)||NN));hv._maskComp=cz,A.Mask=cz,Dt({RenderComponent:{newName:"UIRenderer",since:"1.2.0",removed:!0},UITransformComponent:{newName:"UITransform",since:"1.2.0",removed:!1},CanvasComponent:{newName:"Canvas",since:"1.2.0",removed:!1}}),Dt({UIRenderable:{newName:"UIRenderer",since:"3.0.0",removed:!0}}),Dt({Renderable2D:{newName:"UIRenderer",since:"3.6.0",removed:!1}});var fz,_z,dz,pz,mz,gz,yz,vz,bz,Sz,wz,xz,Tz,Az,Cz,Dz,Bz,Iz,Mz,Pz,Ez,Oz,kz,Rz,Fz,Lz,Vz,Nz,zz,Uz,Gz,Hz,Wz,jz,qz,Xz,Yz=Kh("cc.PostProcess")(sz=$h((lz=function(t){function e(){var e;return(e=t.call(this)||this).global=oz&&oz(),e._shadingScale=hz&&hz(),e.enableShadingScaleInEditor=uz&&uz(),e.settings=new Map,e}s(e,t);var i=e.prototype;return i.addSetting=function(t){this.settings.set(t.constructor,t)},i.removeSetting=function(t){this.settings.delete(t.constructor)},i.getSetting=function(t){return this.settings.get(t)},i.onEnable=function(){e.all.push(this)},i.onDisable=function(){var t=e.all.indexOf(this);-1!==t&&e.all.splice(t,1)},n(e,[{key:"shadingScale",get:function(){return this._shadingScale},set:function(t){this._shadingScale=t}}]),e}(yg),lz.all=[],oz=zh((az=lz).prototype,"global",[tu,uu],(function(){return!0})),hz=zh(az.prototype,"_shadingScale",[uu],(function(){return 1})),v(az.prototype,"shadingScale",[tu],Object.getOwnPropertyDescriptor(az.prototype,"shadingScale"),az.prototype),uz=zh(az.prototype,"enableShadingScaleInEditor",[tu,uu],(function(){return!1})),sz=az))||sz)||sz,Jz=new ir,Kz=Ee(DM),Qz=Ee(CM),Zz=Ee(BM),$z=Ee(MM),tU=Ee(IM),eU=Ee({SKYBOX:14,SOLID_COLOR:7,DEPTH_ONLY:6,DONT_CLEAR:0}),iU=t("dN",(fz=Kh("cc.Camera"),_z=Ou(Ly.BitMask),dz=Ou(eU),pz=Ou(Kz),mz=Ou(Qz),gz=Ou(Zz),yz=Ou($z),vz=Ou(tU),bz=Ou(wP),Sz=Ou(Yz),fz((qz=function(t){function e(){var e;return(e=t.call(this)||this)._projection=Tz&&Tz(),e._priority=Az&&Az(),e._fov=Cz&&Cz(),e._fovAxis=Dz&&Dz(),e._orthoHeight=Bz&&Bz(),e._near=Iz&&Iz(),e._far=Mz&&Mz(),e._color=Pz&&Pz(),e._depth=Ez&&Ez(),e._stencil=Oz&&Oz(),e._clearFlags=kz&&kz(),e._rect=Rz&&Rz(),e._aperture=Fz&&Fz(),e._shutter=Lz&&Lz(),e._iso=Vz&&Vz(),e._screenScale=Nz&&Nz(),e._visibility=zz&&zz(),e._targetTexture=Uz&&Uz(),e._postProcess=Gz&&Gz(),e._usePostProcess=Hz&&Hz(),e._camera=null,e._inEditorMode=!1,e._flows=void 0,e._cameraType=Wz&&Wz(),e._trackingType=jz&&jz(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._createCamera()},i.onEnable=function(){this.node.hasChangedFlags|=1,this._camera&&this._attachToScene()},i.onDisable=function(){this._camera&&this._detachFromScene()},i.onDestroy=function(){this._camera&&(this._camera.destroy(),this._camera=null),this._targetTexture&&this._targetTexture.off("resize")},i.screenPointToRay=function(t,e,i){return i||(i=Vs.create()),this._camera&&this._camera.screenPointToRay(i,t,e),i},i.worldToScreen=function(t,e){return e||(e=new ir),this._camera&&this._camera.worldToScreen(e,t),e},i.screenToWorld=function(t,e){return e||(e=this.node.getWorldPosition()),this._camera&&this._camera.screenToWorld(e,t),e},i.convertToUINode=function(t,e,i){if(i||(i=new ir),!this._camera)return i;this.worldToScreen(t,Jz);var n=e.getComponent("cc.UITransform"),r=A.view,s=r.getVisibleSize(),a=Jz.x-.5*this._camera.width,o=Jz.y-.5*this._camera.height;return Jz.x=a/r.getScaleX()+.5*s.width,Jz.y=o/r.getScaleY()+.5*s.height,n&&n.convertToNodeSpaceAR(Jz,i),i},i._createCamera=function(){this._camera||(this._camera=A.director.root.createCamera(),this._camera.initialize({name:this.node.name,node:this.node,projection:this._projection,window:this._inEditorMode?A.director.root&&A.director.root.mainWindow:A.director.root&&A.director.root.tempWindow,priority:this._priority,cameraType:this.cameraType,trackingType:this.trackingType}),this._camera.setViewportInOrientedSpace(this._rect),this._camera.fovAxis=this._fovAxis,this._camera.fov=nn(this._fov),this._camera.orthoHeight=this._orthoHeight,this._camera.nearClip=this._near,this._camera.farClip=this._far,this._camera.clearColor=this._color,this._camera.clearDepth=this._depth,this._camera.clearStencil=this._stencil,this._camera.clearFlag=this._clearFlags,this._camera.visibility=this._visibility,this._camera.aperture=this._aperture,this._camera.shutter=this._shutter,this._camera.iso=this._iso,this._camera.postProcess=this._postProcess,this._camera.usePostProcess=this._usePostProcess),this._updateTargetTexture()},i._attachToScene=function(){this.node.scene&&this._camera&&(this._camera&&this._camera.scene&&this._camera.scene.removeCamera(this._camera),this._getRenderScene().addCamera(this._camera))},i._detachFromScene=function(){this._camera&&this._camera.scene&&this._camera.scene.removeCamera(this._camera)},i._checkTargetTextureEvent=function(t){var e=this;t&&t.off("resize"),this._targetTexture&&this._targetTexture.on("resize",(function(t){e._camera&&e._camera.setFixedSize(t.width,t.height)}),this)},i._updateTargetTexture=function(){if(this._camera&&this._targetTexture){var t=this._targetTexture.window;this._camera.changeTargetWindow(t),this._camera.setFixedSize(t.width,t.height)}},n(e,[{key:"camera",get:function(){return this._camera}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t,this._camera&&(this._camera.priority=t)}},{key:"visibility",get:function(){return this._visibility},set:function(t){this._visibility=t,this._camera&&(this._camera.visibility=t)}},{key:"clearFlags",get:function(){return this._clearFlags},set:function(t){this._clearFlags=t,this._camera&&(this._camera.clearFlag=t)}},{key:"clearColor",get:function(){return this._color},set:function(t){this._color.set(t),this._camera&&(this._camera.clearColor=this._color)}},{key:"clearDepth",get:function(){return this._depth},set:function(t){this._depth=t,this._camera&&(this._camera.clearDepth=t)}},{key:"clearStencil",get:function(){return this._stencil},set:function(t){this._stencil=t,this._camera&&(this._camera.clearStencil=t)}},{key:"projection",get:function(){return this._projection},set:function(t){this._projection=t,this._camera&&(this._camera.projectionType=t)}},{key:"fovAxis",get:function(){return this._fovAxis},set:function(t){t!==this._fovAxis&&(this._fovAxis=t,this._camera&&(this._camera.fovAxis=t,this.fov=0===t?this._fov*this._camera.aspect:this._fov/this._camera.aspect))}},{key:"fov",get:function(){return this._fov},set:function(t){this._fov=t,this._camera&&(this._camera.fov=nn(t))}},{key:"orthoHeight",get:function(){return this._orthoHeight},set:function(t){this._orthoHeight=t,this._camera&&(this._camera.orthoHeight=t)}},{key:"near",get:function(){return this._near},set:function(t){this._near=t,this._camera&&(this._camera.nearClip=t)}},{key:"far",get:function(){return this._far},set:function(t){this._far=t,this._camera&&(this._camera.farClip=t)}},{key:"aperture",get:function(){return this._aperture},set:function(t){this._aperture=t,this._camera&&(this._camera.aperture=t)}},{key:"shutter",get:function(){return this._shutter},set:function(t){this._shutter=t,this._camera&&(this._camera.shutter=t)}},{key:"iso",get:function(){return this._iso},set:function(t){this._iso=t,this._camera&&(this._camera.iso=t)}},{key:"rect",get:function(){return this._rect},set:function(t){this._rect=t,this._camera&&this._camera.setViewportInOrientedSpace(t)}},{key:"targetTexture",get:function(){return this._targetTexture},set:function(t){if(this._targetTexture!==t){var e=this._targetTexture;this._targetTexture=t,this._checkTargetTextureEvent(e),this._updateTargetTexture(),!t&&this._camera&&(this._camera.changeTargetWindow(null),this._camera.isWindowSize=!0),this.node.emit("tex-change",this)}}},{key:"usePostProcess",get:function(){return this._usePostProcess},set:function(t){this._usePostProcess=t,this._camera&&(this._camera.usePostProcess=t)}},{key:"postProcess",get:function(){return this._postProcess},set:function(t){this._postProcess=t,this._camera&&(this._camera.postProcess=t)}},{key:"screenScale",get:function(){return this._screenScale},set:function(t){this._screenScale=t,this._camera&&(this._camera.screenScale=t)}},{key:"inEditorMode",get:function(){return this._inEditorMode},set:function(t){if(this._inEditorMode=t,this._camera){var e=A.director.root;this._camera.changeTargetWindow(t?e&&e.mainWindow:e&&e.tempWindow)}}},{key:"cameraType",get:function(){return this._cameraType},set:function(t){this._cameraType!==t&&(this._cameraType=t,this.camera&&(this.camera.cameraType=t))}},{key:"trackingType",get:function(){return this._trackingType},set:function(t){this._trackingType!==t&&(this._trackingType=t,this.camera&&(this.camera.trackingType=t))}}]),e}(yg),qz.ProjectionType=Kz,qz.FOVAxis=Qz,qz.ClearFlag=eU,qz.Aperture=Zz,qz.Shutter=$z,qz.ISO=tU,qz.TARGET_TEXTURE_CHANGE="tex-change",Tz=zh((xz=qz).prototype,"_projection",[uu],(function(){return Kz.PERSPECTIVE})),Az=zh(xz.prototype,"_priority",[uu],(function(){return 0})),Cz=zh(xz.prototype,"_fov",[uu],(function(){return 45})),Dz=zh(xz.prototype,"_fovAxis",[uu],(function(){return Qz.VERTICAL})),Bz=zh(xz.prototype,"_orthoHeight",[uu],(function(){return 10})),Iz=zh(xz.prototype,"_near",[uu],(function(){return 1})),Mz=zh(xz.prototype,"_far",[uu],(function(){return 1e3})),Pz=zh(xz.prototype,"_color",[uu],(function(){return new cr("#333333")})),Ez=zh(xz.prototype,"_depth",[uu],(function(){return 1})),Oz=zh(xz.prototype,"_stencil",[uu],(function(){return 0})),kz=zh(xz.prototype,"_clearFlags",[uu],(function(){return eU.SOLID_COLOR})),Rz=zh(xz.prototype,"_rect",[uu],(function(){return new bs(0,0,1,1)})),Fz=zh(xz.prototype,"_aperture",[uu],(function(){return Zz.F16_0})),Lz=zh(xz.prototype,"_shutter",[uu],(function(){return $z.D125})),Vz=zh(xz.prototype,"_iso",[uu],(function(){return tU.ISO100})),Nz=zh(xz.prototype,"_screenScale",[uu],(function(){return 1})),zz=zh(xz.prototype,"_visibility",[uu],(function(){return US})),Uz=zh(xz.prototype,"_targetTexture",[uu],(function(){return null})),Gz=zh(xz.prototype,"_postProcess",[uu],(function(){return null})),Hz=zh(xz.prototype,"_usePostProcess",[uu],(function(){return!1})),Wz=zh(xz.prototype,"_cameraType",[uu],(function(){return-1})),jz=zh(xz.prototype,"_trackingType",[uu],(function(){return 0})),v(xz.prototype,"visibility",[_z],Object.getOwnPropertyDescriptor(xz.prototype,"visibility"),xz.prototype),v(xz.prototype,"clearFlags",[dz],Object.getOwnPropertyDescriptor(xz.prototype,"clearFlags"),xz.prototype),v(xz.prototype,"projection",[pz],Object.getOwnPropertyDescriptor(xz.prototype,"projection"),xz.prototype),v(xz.prototype,"fovAxis",[mz],Object.getOwnPropertyDescriptor(xz.prototype,"fovAxis"),xz.prototype),v(xz.prototype,"aperture",[gz],Object.getOwnPropertyDescriptor(xz.prototype,"aperture"),xz.prototype),v(xz.prototype,"shutter",[yz],Object.getOwnPropertyDescriptor(xz.prototype,"shutter"),xz.prototype),v(xz.prototype,"iso",[vz],Object.getOwnPropertyDescriptor(xz.prototype,"iso"),xz.prototype),v(xz.prototype,"targetTexture",[bz],Object.getOwnPropertyDescriptor(xz.prototype,"targetTexture"),xz.prototype),v(xz.prototype,"usePostProcess",[tu],Object.getOwnPropertyDescriptor(xz.prototype,"usePostProcess"),xz.prototype),v(xz.prototype,"postProcess",[Sz],Object.getOwnPropertyDescriptor(xz.prototype,"postProcess"),xz.prototype),wz=xz))||wz));A.Camera=iU;var nU,rU,sU,aU,oU,hU,uU,lU,cU,fU=t("R",Kh("cc.RenderRoot2D")(Xz=Zh(100)(Xz=Qh(lL)(Xz=$h(Xz=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){A.director.root.batcher2D.addScreen(this)},i.onDisable=function(){A.director.root.batcher2D.removeScreen(this)},i.onDestroy=function(){A.director.root.batcher2D.removeScreen(this)},e}(yg))||Xz)||Xz)||Xz)||Xz),_U=new ir,dU=t("C",(nU=Kh("cc.Canvas"),rU=Zh(100),sU=Ou(iU),aU=Ou(iU),nU(oU=rU(oU=$h((hU=function(t){function e(){var e;return(e=t.call(this)||this)._cameraComponent=uU&&uU(),e._alignCanvasWithScreen=lU&&lU(),e._pos=new ir,e._renderMode=0,e._thisOnCameraResized=e._onResizeCamera.bind(f(e)),e}s(e,t);var i=e.prototype;return i.__preload=function(){var t=this.getComponent("cc.Widget");t&&t.updateAlignment(),this._cameraComponent&&(this._cameraComponent._createCamera(),this._cameraComponent.node.on("tex-change",this._thisOnCameraResized)),this._onResizeCamera(),zO.on("canvas-resize",this._thisOnCameraResized,this),zO.on("design-resolution-changed",this._thisOnCameraResized,this)},i.onEnable=function(){t.prototype.onEnable.call(this),this._cameraComponent&&this._cameraComponent.node.on("tex-change",this._thisOnCameraResized)},i.onDisable=function(){t.prototype.onDisable.call(this),this._cameraComponent&&this._cameraComponent.node.off("tex-change",this._thisOnCameraResized)},i.onDestroy=function(){t.prototype.onDestroy.call(this),zO.off("canvas-resize",this._thisOnCameraResized,this),zO.off("design-resolution-changed",this._thisOnCameraResized,this)},i._onResizeCamera=function(){if(this._cameraComponent&&this._alignCanvasWithScreen){if(this._cameraComponent.targetTexture)this._cameraComponent.orthoHeight=uh.height/2;else{var t=oh.windowSize;this._cameraComponent.orthoHeight=t.height/zO.getScaleY()/2}this.node.getWorldPosition(_U),this._cameraComponent.node.setWorldPosition(_U.x,_U.y,1e3)}},i._getViewPriority=function(){if(this._cameraComponent){var t,e=null==(t=this.cameraComponent)?void 0:t.priority;return 0===this._renderMode?e|1<<30:-1073741825&e}return 0},n(e,[{key:"renderMode",get:function(){return this._renderMode},set:function(t){this._renderMode=t,this._cameraComponent&&(this._cameraComponent.priority=this._getViewPriority())}},{key:"cameraComponent",get:function(){return this._cameraComponent},set:function(t){this._cameraComponent!==t&&(this._cameraComponent=t,this._onResizeCamera())}},{key:"alignCanvasWithScreen",get:function(){return this._alignCanvasWithScreen},set:function(t){this._alignCanvasWithScreen=t,this._onResizeCamera()}}]),e}(fU),v(hU.prototype,"cameraComponent",[sU],Object.getOwnPropertyDescriptor(hU.prototype,"cameraComponent"),hU.prototype),uU=zh(hU.prototype,"_cameraComponent",[aU],(function(){return null})),lU=zh(hU.prototype,"_alignCanvasWithScreen",[uu],(function(){return!0})),oU=hU))||oU)||oU)||oU));function pU(t,e,i){var n=t.o,r=t.d,s=1/r.x,a=1/r.y,o=1/r.z,h=(e.x-n.x)*s,u=(i.x-n.x)*s,l=(e.y-n.y)*a,c=(i.y-n.y)*a,f=(e.z-n.z)*o,_=(i.z-n.z)*o,d=Math.max(Math.max(Math.min(h,u),Math.min(l,c)),Math.min(f,_)),p=Math.min(Math.min(Math.max(h,u),Math.max(l,c)),Math.max(f,_));return p<0||d>p?0:d>0?d:p}A.Canvas=dU,mt(t("U",Kh("cc.UIComponent")(cU=Qh(lL)(cU=Zh(110)(cU=$h(cU=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}(yg))||cU)||cU)||cU)||cU).prototype,"UIComponent",[{name:"_visibility"},{name:"setVisibility"}]),pt(dU.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(lL.prototype,"UITransform.prototype",[{name:"priority",suggest:"Please use setSiblingIndex to change index of the current node in its parent's children array."}]),A.UITransformComponent=lL,le(lL,"cc.UITransformComponent"),le(BL,"cc.RenderComponent"),A.CanvasComponent=dU,le(dU,"cc.CanvasComponent"),A.internal.Renderable2D=BL,le(BL,"cc.Renderable2D");var mU,gU,yU,vU,bU,SU,wU,xU,TU=(mU=ro.create(),gU={distance:1/0,doubleSided:!1,mode:2},yU=0,vU=function(t,e,i,n,r,s){1===t?(yU>e||0===yU)&&(yU=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))):(yU=e,s&&s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}))},bU=function(t,e,i,n,r){if(7===i)for(var s=e.length,a=0;a<s;a+=3){var o=3*e[a],h=3*e[a+1],u=3*e[a+2];ir.set(mU.a,t[o],t[o+1],t[o+2]),ir.set(mU.b,t[h],t[h+1],t[h+2]),ir.set(mU.c,t[u],t[u+1],t[u+2]);var l=Za.rayTriangle(n,mU,r.doubleSided);if(!(0===l||l>r.distance)&&(vU(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,_=0;_<c;_+=1){var d=3*e[_-f],p=3*e[_+f+1],m=3*e[_+2];ir.set(mU.a,t[d],t[d+1],t[d+2]),ir.set(mU.b,t[p],t[p+1],t[p+2]),ir.set(mU.c,t[m],t[m+1],t[m+2]),f=~f;var g=Za.rayTriangle(n,mU,r.doubleSided);if(!(0===g||g>r.distance)&&(vU(r.mode,g,d,p,m,r.result),2===r.mode))return g}else if(9===i){var y=e.length-1,v=3*e[0];ir.set(mU.a,t[v],t[v+1],t[v+2]);for(var b=1;b<y;b+=1){var S=3*e[b],w=3*e[b+1];ir.set(mU.b,t[S],t[S+1],t[S+2]),ir.set(mU.c,t[w],t[w+1],t[w+2]);var x=Za.rayTriangle(n,mU,r.doubleSided);if(!(0===x||x>r.distance)&&(vU(r.mode,x,v,S,w,r.result),2===r.mode))return x}}return yU},function(t,e,i){if(yU=0,0===e.geometricInfo.positions.length)return yU;var n=void 0===i?gU:i;if(pU(t,e.geometricInfo.boundingBox.min,e.geometricInfo.boundingBox.max)){var r=e.primitiveMode,s=e.geometricInfo,a=s.positions,o=s.indices;bU(a,o,r,t,n)}return yU}),AU=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&&!pU(i,o,h))return t;for(var u=0;u<a;u++){var l=n.renderingSubMeshes[u],c=TU(i,l,s);if(c)if(1===s.mode)(0===t||t>c)&&(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}}(),CU=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:2},i=new Vs,n=new Kr;return function(r,s,a){t=0;var o=void 0===a?e:a,h=s.worldBounds;if(h&&!Za.rayAABB(r,h))return t;Vs.copy(i,r),s.node&&(Kr.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;l<u.length;l++){var c=u[l].subMesh,f=TU(i,c,o);if(f)if(1===o.mode)(0===t||t>f)&&(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}}();Za.rayModel=CU,Za.raySubMesh=TU,Za.rayMesh=AU,gT("specular-pass");var DU,BU,IU,MU,PU,EU,OU,kU,RU,FU,LU,VU,NU,zU,UU,GU,HU=t("dO",Kh("cc.ModelRenderer")((wU=function(t){function e(){var e;return(e=t.call(this)||this)._visFlags=xU&&xU(),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;t<this._models.length;t++)this._models[t].priority=this._priority},n(e,[{key:"visibility",get:function(){return this._visFlags},set:function(t){this._visFlags=t,this._onVisibilityChange(t)}},{key:"priority",get:function(){return this._priority},set:function(t){t!==this._priority&&(this._priority=t,this._updatePriority())}}]),e}(CL),xU=zh(wU.prototype,"_visFlags",[uu],(function(){return Ly.Enum.NONE})),SU=wU))||SU),WU=uu,jU=Ou;t("dR",(DU=Kh("cc.PrefabLink"),BU=jU(kE),DU((MU=function(t){function e(){var e;return(e=t.call(this)||this).prefab=PU&&PU(),e}return s(e,t),e}(yg),PU=zh(MU.prototype,"prefab",[BU,WU],(function(){return null})),IU=MU))||IU)),pt(iU,"Camera",[{name:"CameraClearFlag",newName:"ClearFlag"}]),pt(iU.prototype,"Camera.prototype",[{name:"color",newName:"clearColor"},{name:"depth",newName:"clearDepth"},{name:"stencil",newName:"clearStencil"}]),gt(CL.prototype,"Renderer.prototype",[{name:"getMaterial",suggest:"please use renderer.getSharedMaterial instead."}]),A.CameraComponent=iU,le(iU,"cc.CameraComponent"),A.RenderableComponent=HU,le(HU,"cc.RenderableComponent"),t("f",(EU=Kh("cc.SpriteRenderer"),OU=Zh(100),kU=Ou(nR),EU(RU=OU((FU=function(t){function e(){var e;return(e=t.call(this)||this)._spriteFrame=LU&&LU(),e._mode=VU&&VU(),e._color=NU&&NU(),e._flipX=zU&&zU(),e._flipY=UU&&UU(),e._size=GU&&GU(),e._model=null,e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._spriteFrame&&(this._spriteFrame.mesh||this._spriteFrame.ensureMeshData(),this._spriteFrame.mesh.initialize()),this._updateModels()},i.onRestore=function(){this._updateModels(),this.enabledInHierarchy&&this._attachToScene()},i.onEnable=function(){t.prototype.onEnable.call(this),this._model||this._updateModels(),this._attachToScene()},i.onDisable=function(){this._model&&this._detachFromScene()},i.onDestroy=function(){this._model&&(A.director.root.destroyModel(this._model),this._model=null,this._models.length=0)},i._updateModels=function(){if(this._spriteFrame){var t=this._model;if(t?(t.destroy(),t.initialize(),t.node=t.transform=this.node):this._createModel(),this._model){var e=this._spriteFrame.mesh;this._model.createBoundingShape(e.struct.minPosition,e.struct.maxPosition),this._updateModelParams(),this._onUpdateLocalDescriptorSet()}}},i._createModel=function(){var t=this._model=A.director.root.createModel(KM);t.visFlags=this.visibility,t.node=t.transform=this.node,this._models.length=0,this._models.push(this._model)},i._updateModelParams=function(){if(this._spriteFrame&&this._model){this._spriteFrame.ensureMeshData();var t=this._spriteFrame.mesh;this.node.hasChangedFlags|=1,this._model.transform.hasChangedFlags|=1;var e=t?t.renderingSubMeshes:null;if(e)for(var i=e.length,n=0;n<i;++n){var r=this.getRenderMaterial(n);r&&!r.isValid&&(r=null);var s=e[n];s&&this._model.initSubModel(n,s,r||this._getBuiltinMaterial())}this._model.enabled=!0}},i._getBuiltinMaterial=function(){return mT.get("missing-material")},i._onMaterialModified=function(e,i){t.prototype._onMaterialModified.call(this,e,i),this._spriteFrame&&this._model&&this._model.inited&&this._onRebuildPSO(e,i||this._getBuiltinMaterial())},i._onRebuildPSO=function(t,e){this._model&&this._model.inited&&(this._model.setSubModelMaterial(t,e),this._onUpdateLocalDescriptorSet())},i._onUpdateLocalDescriptorSet=function(){if(this._spriteFrame&&this._model&&this._model.inited)for(var t=this._spriteFrame.getGFXTexture(),e=this._spriteFrame.getGFXSampler(),i=this._model.subModels,n=0;n<i.length;n++){var r=i[n].descriptorSet;r.bindTexture(12,t),r.bindSampler(12,e),r.update()}},i._attachToScene=function(){if(this.node.scene&&this._model){var t=this._getRenderScene();null!==this._model.scene&&this._detachFromScene(),t.addModel(this._model)}},i._detachFromScene=function(){this._model&&this._model.scene&&this._model.scene.removeModel(this._model)},n(e,[{key:"spriteFrame",get:function(){return this._spriteFrame},set:function(t){this._spriteFrame!==t&&(this._spriteFrame,this._spriteFrame=t,this._spriteFrame&&(this._spriteFrame.ensureMeshData(),this._spriteFrame.mesh.initialize()),this._updateModels(),this.enabledInHierarchy&&this._attachToScene())}},{key:"model",get:function(){return this._model}}]),e}(HU),v(FU.prototype,"spriteFrame",[kU],Object.getOwnPropertyDescriptor(FU.prototype,"spriteFrame"),FU.prototype),LU=zh(FU.prototype,"_spriteFrame",[uu],(function(){return null})),VU=zh(FU.prototype,"_mode",[uu],(function(){return 0})),NU=zh(FU.prototype,"_color",[uu],(function(){return cr.WHITE.clone()})),zU=zh(FU.prototype,"_flipX",[uu],(function(){return!1})),UU=zh(FU.prototype,"_flipY",[uu],(function(){return!1})),GU=zh(FU.prototype,"_size",[uu],(function(){return new ds})),RU=FU))||RU)||RU));var qU,XU,YU,JU,KU,QU,ZU,$U,tG,eG,iG,nG,rG,sG,aG,oG,hG,uG,lG,cG,fG,_G,dG,pG,mG,gG=new hF,yG="RICHTEXT_CHILD",vG="RICHTEXT_Image_CHILD",bG=new ds,SG=new ds,wG=new ge((function(t){if(!A.isValid(t.node))return!1;var e=t.node.getComponent(LV);return e&&(e.outlineWidth=0),!0}),20),xG=new ge((function(t){return A.isValid(t.node)}),10);function TG(t){return{node:new eb(t),comp:null,lineCount:0,styleIndex:0,imageOffset:"",clickParam:"",clickHandler:"",type:t}}function AG(t,e){var i;t===yG?i=wG._get():t===vG&&(i=xG._get());var n=(i=i||TG(t)).node;return n||(n=new eb(t)),n.hideFlags|=1032,n.active=!0,t===vG?(i.comp=n.getComponent(GV)||n.addComponent(GV),i.comp.spriteFrame=e,i.comp.type=GV.Type.SLICED,i.comp.sizeMode=0):(i.comp=n.getComponent(LV)||n.addComponent(LV),i.comp.string=e,i.comp.horizontalAlign=0,i.comp.verticalAlign=0,i.comp.underlineHeight=2),n.setPosition(0,0,0),n._getUITransformComp().setAnchorPoint(.5,.5),i.node=n,i.lineCount=0,i.styleIndex=0,i.imageOffset="",i.clickParam="",i.clickHandler="",i}var CG=t("r",(qU=Kh("cc.RichText"),XU=Zh(110),YU=Ou(_V),JU=Ou(dV),KU=Ou(cr),QU=Ou(uR),ZU=Ou(mV),$U=Ou(sR),qU(tG=XU((mG=function(t){function e(){var e;return(e=t.call(this)||this)._lineHeight=iG&&iG(),e._string=nG&&nG(),e._horizontalAlign=rG&&rG(),e._verticalAlign=sG&&sG(),e._fontSize=aG&&aG(),e._fontColor=oG&&oG(),e._maxWidth=hG&&hG(),e._fontFamily=uG&&uG(),e._font=lG&&lG(),e._isSystemFontUsed=cG&&cG(),e._userDefinedFont=fG&&fG(),e._cacheMode=_G&&_G(),e._imageAtlas=dG&&dG(),e._handleTouchEvent=pG&&pG(),e._textArray=[],e._segments=[],e._labelSegmentsCache=[],e._linesWidth=[],e._lineCount=1,e._labelWidth=0,e._labelHeight=0,e._layoutDirty=!0,e._lineOffsetX=0,e._labelChildrenNum=0,e._updateRichTextStatus=e._updateRichText,e}s(e,t);var i=e.prototype;return i.onLoad=function(){this.node.on("layer-changed",this._applyLayer,this),this.node.on("anchor-changed",this._updateRichTextPosition,this)},i.onEnable=function(){this.handleTouchEvent&&this._addEventListeners(),this._updateRichText(),this._activateChildren(!0)},i.onDisable=function(){this.handleTouchEvent&&this._removeEventListeners(),this._activateChildren(!1)},i.onRestore=function(){},i.onDestroy=function(){this._segments.forEach((function(t){t.node.removeFromParent(),t.type===yG?wG.put(t):t.type===vG&&xG.put(t)})),this.node.off("anchor-changed",this._updateRichTextPosition,this),this.node.off("layer-changed",this._applyLayer,this)},i._addEventListeners=function(){this.node.on("touch-end",this._onTouchEnded,this)},i._removeEventListeners=function(){this.node.off("touch-end",this._onTouchEnded,this)},i._updateLabelSegmentTextAttributes=function(){var t=this;this._segments.forEach((function(e){t._applyTextAttribute(e)}))},i._createFontLabel=function(t){return AG(yG,t)},i._createImage=function(t){return AG(vG,t)},i._onTTFLoaded=function(){this._font,this._layoutDirty=!0,this._updateRichText()},i.splitLongStringApproximatelyIn2048=function(t,e){var i=[];if(t.length*this.fontSize<=1638.4)return i.push(t),i;if(this._calculateSize(bG,e,t),bG.x<2048)i.push(t);else for(var n=t.split("\n"),r=0;r<n.length;r++)if(this._calculateSize(bG,e,n[r]),bG.x<2048)i.push(n[r]);else{var s=this.splitLongStringOver2048(n[r],e);i.push.apply(i,s)}return i},i.splitLongStringOver2048=function(t,e){var i=[],n=t,r=0,s=n.length/2,a=n.substring(r,s),o=n.substring(s),h=this._calculateSize(bG,e,a),u=this._calculateSize(SG,e,o),l=this._maxWidth;0===this._maxWidth&&(l=2047.9);for(var c=1*l;h.x>c;){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,_=1;f&&r<t.length;){for(;f&&h.x<c;){var d=kR(o);d&&d.length>0&&(_=d[0].length),s+=_,a=n.substring(r,s),o=n.substring(s),this._calculateSize(h,e,a),f--}for(;f&&a.length>=2&&h.x>c;)s-=_,a=n.substring(r,s),this._calculateSize(h,e,a),_=1,f--;if(a.length>=2){var p=RR(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<c){i.push(a),r=t.length,s=t.length,a=o,""!==o&&i.push(a);break}}return i},i._measureText=function(t,e){var i=this,n=function(e){return i._calculateSize(bG,t,e).x};return e?n(e):n},i._calculateSize=function(t,e,i){var n;0===this._labelSegmentsCache.length?(n=this._createFontLabel(i),this._labelSegmentsCache.push(n)):(n=this._labelSegmentsCache[0]).node.getComponent(LV).string=i,n.styleIndex=e,this._applyTextAttribute(n);var r=n.node._getUITransformComp().contentSize;return ds.set(t,r.x,r.y),t},i._onTouchEnded=function(t){var e=this,i=this.node.getComponents(yg);this._segments.forEach((function(n){var r=n.clickHandler,s=n.clickParam;r&&e._containsTouchLocation(n,t.touch.getUILocation())&&(i.forEach((function(e){var i=e[r];e.enabledInHierarchy&&i&&i.call(e,t,s)})),t.propagationStopped=!0)}))},i._containsTouchLocation=function(t,e){var i=t.node.getComponent(lL);return!!i&&i.getBoundingBoxToWorld().contains(e)},i._resetState=function(){for(var t=this.node.children,e=t.length-1;e>=0;e--){var i=t[e];if(i.name===yG||i.name===vG){i.parent=null;var n=TG(i.name);n.node=i,i.name===yG?(n.comp=i.getComponent(LV),wG.put(n)):(n.comp=i.getComponent(GV),xG.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!==yG&&i.name!==vG||(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(LV);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=FR(t,n,this._maxWidth,this._measureText(i)),l=0;l<u.length;++l){var c=u[l],f=this._addLabelSegment(c,i).node._getUITransformComp().contentSize;this._lineOffsetX+=f.width,u.length>1&&l<u.length-1&&this._updateLineInfo()}else this._lineOffsetX+=n,this._addLabelSegment(t,i)},i._isLastComponentCR=function(t){return t.length-1===t.lastIndexOf("\n")},i._updateLineInfo=function(){this._linesWidth.push(this._lineOffsetX),this._lineOffsetX=0,this._lineCount++},i._needsUpdateTextLayout=function(t){if(this._layoutDirty||!this._textArray||!t)return!0;if(this._textArray.length!==t.length)return!0;for(var e=0;e<this._textArray.length;e++){var i=this._textArray[e],n=t[e];if(i.text!==n.text)return!0;var r=i.style,s=n.style;if(r){if(s){if(!!s.outline!=!!r.outline)return!0;if(r.size!==s.size||r.italic!==s.italic||r.isImage!==s.isImage)return!0;if(r.src!==s.src||r.imageAlign!==s.imageAlign||r.imageHeight!==s.imageHeight||r.imageWidth!==s.imageWidth||r.imageOffset!==s.imageOffset)return!0}else if(r.size||r.italic||r.isImage||r.outline)return!0}else if(s&&(s.size||s.italic||s.isImage||s.outline))return!0}return!1},i._addRichTextImageElement=function(t){if(t.style){var e=t.style,i=e.src,n=this._imageAtlas&&i&&this._imageAtlas.getSpriteFrame(i);if(n){var r=this._createImage(n);switch(r.comp,e.imageAlign){case"top":r.node._getUITransformComp().setAnchorPoint(0,1);break;case"center":r.node._getUITransformComp().setAnchorPoint(0,.5);break;default:r.node._getUITransformComp().setAnchorPoint(0,0)}e.imageOffset&&(r.imageOffset=e.imageOffset),r.node.layer=this.node.layer,this.node.insertChild(r.node,this._labelChildrenNum++),this._segments.push(r);var s=n.rect.clone(),a=1,o=s.width,h=s.height,u=e.imageWidth||0,l=e.imageHeight||0;l>0?(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;t<this._segments.length;++t){var e,i,n=this._segments[t],r=n.node.getComponent(LV);r&&(null!=(e=this._textArray[n.styleIndex])&&null!=(i=e.style)&&i.color||(r.color=this._fontColor))}},i._updateRichText=function(){if(this.enabledInHierarchy){var t=gG.parse(this._string);if(!this._needsUpdateTextLayout(t))return this._textArray=t.slice(),void this._updateLabelSegmentTextAttributes();this._textArray=t.slice(),this._resetState();for(var e,i=!1,n=0;n<this._textArray.length;++n){var r=this._textArray[n],s=r.text;if(void 0!==s){if(""===s){if(r.style&&r.style.isNewLine){this._updateLineInfo();continue}if(r.style&&r.style.isImage&&this._imageAtlas){this._addRichTextImageElement(r);continue}}for(var a=(s=this.splitLongStringApproximatelyIn2048(s,n).join("\n")).split("\n"),o=0;o<a.length;++o){var h=a[o];if(""!==h)if(i=!1,this._maxWidth>0){var u=this._measureText(n,h);this._updateRichTextWithMaxWidth(h,u,n),a.length>1&&o<a.length-1&&this._updateLineInfo()}else e=this._addLabelSegment(h,n),this._lineOffsetX+=e.node._getUITransformComp().width,this._lineOffsetX>this._labelWidth&&(this._labelWidth=this._lineOffsetX),a.length>1&&o<a.length-1&&this._updateLineInfo();else{if(this._isLastComponentCR(s)&&o===a.length-1)continue;this._updateLineInfo(),i=!0}}}}i||this._linesWidth.push(this._lineOffsetX),this._maxWidth>0&&(this._labelWidth=this._maxWidth),this._labelHeight=(this._lineCount+fR)*this._lineHeight,this.node._getUITransformComp().setContentSize(this._labelWidth,this._labelHeight),this._updateRichTextPosition(),this._layoutDirty=!1}},i._getFirstWordLen=function(t,e,i){var n=IR(t,e);if(AR(n)||CR(n))return 1;for(var r=1,s=e+1;s<i&&!CR(n=IR(t,s))&&!AR(n);++s)r++;return r},i._updateRichTextPosition=function(){for(var t=0,e=1,i=this._lineCount,n=this.node._getUITransformComp(),r=n.anchorX,s=n.anchorY,a=0;a<this._segments.length;++a){var o=this._segments[a],h=o.lineCount;h>e&&(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(GV)){var c=o.node.position.clone(),f=this._lineHeight,_=this._lineHeight*(1+fR);switch(o.node._getUITransformComp().anchorY){case 1:c.y+=f+(_-f)/2;break;case.5:c.y+=_/2;break;default:c.y+=(_-f)/2}if(o.imageOffset){var d=o.imageOffset.split(",");if(1===d.length&&d[0]){var p=parseFloat(d[0]);Number.isInteger(p)&&(c.y+=p)}else if(2===d.length){var m=parseFloat(d[0]),g=parseFloat(d[1]);Number.isInteger(m)&&(c.x+=m),Number.isInteger(g)&&(c.y+=g)}}o.node.position=c}var y=o.node.getComponent(LV);if(y&&y.enableOutline){var v=o.node.position.clone();v.y-=y.outlineWidth,o.node.position=v}}},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(LV);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(LV);r||(r=t.node.addComponent(LV)),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 uR&&!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}(yg),mG.HorizontalAlign=_V,mG.VerticalAlign=dV,v((eG=mG).prototype,"horizontalAlign",[YU],Object.getOwnPropertyDescriptor(eG.prototype,"horizontalAlign"),eG.prototype),v(eG.prototype,"verticalAlign",[JU],Object.getOwnPropertyDescriptor(eG.prototype,"verticalAlign"),eG.prototype),v(eG.prototype,"fontColor",[KU],Object.getOwnPropertyDescriptor(eG.prototype,"fontColor"),eG.prototype),v(eG.prototype,"font",[QU],Object.getOwnPropertyDescriptor(eG.prototype,"font"),eG.prototype),v(eG.prototype,"cacheMode",[ZU],Object.getOwnPropertyDescriptor(eG.prototype,"cacheMode"),eG.prototype),v(eG.prototype,"imageAtlas",[$U],Object.getOwnPropertyDescriptor(eG.prototype,"imageAtlas"),eG.prototype),iG=zh(eG.prototype,"_lineHeight",[uu],(function(){return 40})),nG=zh(eG.prototype,"_string",[uu],(function(){return"<color=#00ff00>Rich</color><color=#0fffff>Text</color>"})),rG=zh(eG.prototype,"_horizontalAlign",[uu],(function(){return 0})),sG=zh(eG.prototype,"_verticalAlign",[uu],(function(){return 0})),aG=zh(eG.prototype,"_fontSize",[uu],(function(){return 40})),oG=zh(eG.prototype,"_fontColor",[uu],(function(){return cr.WHITE.clone()})),hG=zh(eG.prototype,"_maxWidth",[uu],(function(){return 0})),uG=zh(eG.prototype,"_fontFamily",[uu],(function(){return"Arial"})),lG=zh(eG.prototype,"_font",[uu],(function(){return null})),cG=zh(eG.prototype,"_isSystemFontUsed",[uu],(function(){return!0})),fG=zh(eG.prototype,"_userDefinedFont",[uu],(function(){return null})),_G=zh(eG.prototype,"_cacheMode",[uu],(function(){return 0})),dG=zh(eG.prototype,"_imageAtlas",[uu],(function(){return null})),pG=zh(eG.prototype,"_handleTouchEvent",[uu],(function(){return!0})),tG=eG))||tG)||tG));A.RichText=CG,A.MaskComponent=cz,le(cz,"cc.MaskComponent"),A.LabelComponent=LV,le(LV,"cc.LabelComponent"),A.LabelOutlineComponent=jV,le(jV,"cc.LabelOutlineComponent"),A.RichTextComponent=CG,le(CG,"cc.RichTextComponent"),A.SpriteComponent=GV,le(GV,"cc.SpriteComponent"),A.UIModelComponent=WV,le(WV,"cc.UIModelComponent"),A.GraphicsComponent=ZN,le(ZN,"cc.GraphicsComponent"),le(tN,"cc.UIStaticBatchComponent"),le(iN,"cc.UIOpacityComponent"),pt(cz.prototype,"Mask",[{name:"graphics",newName:"subComp",target:cz.prototype,targetName:"Mask"}]),pt(rz,"MaskType",[{name:"RECT",newName:"GRAPHICS_RECT",target:rz,targetName:"MaskType"},{name:"ELLIPSE",newName:"GRAPHICS_ELLIPSE",target:rz,targetName:"MaskType"},{name:"IMAGE_STENCIL",newName:"SPRITE_STENCIL",target:rz,targetName:"MaskType"}]),gt(jV.prototype,"LabelOutline",[{name:"width",suggest:"Please use Label.outlineWidth instead."},{name:"color",suggest:"Please use Label.outlineColor instead."}]),gt(eN.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 DG=["left","center","right"],BG=2048,IG=pR(),MG=(1/255).toFixed(3),PG=function(){this.char="",this.valid=!0,this.x=0,this.y=0,this.line=0,this.hash=""},EG=function(){function t(){this._context=null,this._canvas=null,this._canvasData=null,this._lettersInfo=[],this._tmpRect=new bs,this._maxFontSize=100,this._fontScale=1;var t=this._canvasData=dF.getInstance().get();this._canvas=t.canvas,this._context=t.context}var e=t.prototype;return e.destroy=function(){dF.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),SF.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>BG||n.canvasSize.height>BG)&&a<=3;){if(++a>3)this._fontScale=1;else{var o=Math.max(n.canvasSize.width,n.canvasSize.height),h=BG/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<n&&(i=n/t),i<1&&(i=1),i},e._calculateLabelFont=function(t,e,i,n){if(this._context){t.actualFontSize=t.fontSize*this._fontScale;var r=n.split("\n"),s=i.parsedString=r,a=this._getFontDesc(t.actualFontSize,t.fontFamily,t.isBold,t.isItalic);this._context.font=t.fontDesc=a;var o=i.canvasSize,h=i.nodeContentSize,u=i.canvasPadding,l=i.contentSizeExtend,c=this._fontScale;switch(e.overFlow){case 0:for(var f=0,_=0;_<r.length;++_){var d=DR(this._context,r[_],a);f=f>d?f:d}var p=f,m=(s.length+fR)*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+fR)*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,_=this._fontScale;if(i.wrapping){var d=c.width*_,p=c.height*_;if(d<0||p<0)return;o=p+1;for(var m=0,g=0|e.actualFontSize+1,y=0;m<g;){if((y=m+g+1>>1)<=0){it(4003);break}u=y,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r;var v=this._getLineHeight(i.lineHeight,u,e.fontSize);for(o=0,a=0;a<t.length;++a){var b=DR(this._context,t[a],r);o+=FR(t[a],b,d,this._measureText(this._context,r)).length*v}o>p?g=y-1:m=y}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;a<t.length;++a)h<s[a]&&(h=s[a]);var S=(l.width-f.width)*_/h,w=l.height*_/o;u=e.actualFontSize*Math.min(1,S,w)|0,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r}e.actualFontSize=u,e.fontDesc=r}},e._calculateWrapText=function(t,e,i,n){if(i.wrapping&&this._context){var r=[],s=n.nodeContentSize.width*this._fontScale,a=this._getFontDesc(e.actualFontSize,e.fontFamily,e.isBold,e.isItalic);this._context.font=a;for(var o=0;o<t.length;++o){var h=DR(this._context,t[o],a),u=FR(t[o],h,s,this._measureText(this._context,a));r=r.concat(u)}n.parsedString=r,e.fontDesc=a}},e._measureText=function(t,e){return function(i){return DR(t,i,e)}},e._calculateParagraphLength=function(t,e,i){return t.map((function(t){return DR(e,t,i)}))},e._updatePaddingRect=function(t,e){var i=0,n=0,r=0,s=0,a=0,o=e.contentSizeExtend,h=e.canvasPadding;if(o.width=o.height=0,t.isOutlined&&(i=n=r=s=a=t.outlineWidth,o.width=o.height=2*a),t.hasShadow){var u=t.shadowBlur+a,l=t.shadowOffsetX,c=t.shadowOffsetY;r=Math.max(r,-l+u),s=Math.max(s,l+u),i=Math.max(i,c+u),n=Math.max(n,-c+u)}if(t.isItalic){var f=t.fontSize*Math.tan(.20943951);s+=f,o.width+=f}h.x=r,h.y=i,h.width=r+s,h.height=i+n},e._updateLabelDimensions=function(t,e,i){var n=i.canvasSize;n.width=Math.min(n.width,BG),n.height=Math.min(n.height,BG);var r=this._canvas,s=this._context;r.width=n.width,r.height=n.height,s.font=t.fontDesc,s.textAlign=DG[e.horizontalAlign],s.textBaseline="alphabetic"},e._calculateFillTextStartPosition=function(t,e,i){var n=0,r=i.canvasSize,s=i.canvasPadding;2===e.horizontalAlign?n=r.width-s.width:1===e.horizontalAlign&&(n=(r.width-s.width)/2);var a=this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize)*(i.parsedString.length-1),o=t.actualFontSize*(1-fR/2);if(0!==e.verticalAlign){var h=a+s.height+t.actualFontSize-r.height;2===e.verticalAlign?o-=h+=fR/2*t.actualFontSize:o-=h/2}o+=IG*t.actualFontSize,i.startPosition.set(n+s.x,o+s.y)},e._updateTexture=function(t,e,i,n){var r=this._context,s=this._canvas;if(r&&s){r.clearRect(0,0,s.width,s.height),r.font=t.fontDesc,this._calculateFillTextStartPosition(t,e,i);var a=this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);r.lineJoin="round",t.isOutlined?(r.fillStyle="rgba("+t.outlineColor.r+", "+t.outlineColor.g+", "+t.outlineColor.b+", "+MG+")",r.fillRect(0,0,s.width,s.height)):(r.fillStyle="rgba("+t.color.r+", "+t.color.g+", "+t.color.b+", "+MG+")",r.fillRect(0,0,s.width,s.height)),r.fillStyle="rgb("+t.color.r+", "+t.color.g+", "+t.color.b+")";var o=i.startPosition,h=new ds(o.x,o.y),u=h.x,l=0;this._drawTextEffect(h,a,t,e,i);for(var c=i.parsedString,f=0;f<c.length;++f)l=h.y+f*a,t.hasShadow&&(this._setupShadow(t),r.fillText(c[f],u,l)),t.isOutlined&&(this._setupOutline(t),r.strokeText(c[f],u,l)),t.hasShadow&&!t.isOutlined||r.fillText(c[f],u,l);t.hasShadow&&(r.shadowColor="transparent"),this._uploadTexture(n)}},e._uploadTexture=function(t){var e,i=this._canvas;t.texture&&i&&(e=t.texture instanceof nR?t.texture.texture:t.texture,0!==i.width&&0!==i.height&&(e.getGFXTexture(),e.getGFXSampler(),e.reset({width:i.width,height:i.height,mipmapLevel:1}),e.uploadData(i),e.setWrapMode(2,2),t.texture instanceof nR&&(t.texture.rect=new bs(0,0,i.width,i.height),t.texture._calculateUV()),A.director.root&&A.director.root.batcher2D&&A.director.root.batcher2D._releaseDescriptorSetCache(e.getHash())))},e._drawTextEffect=function(t,e,i,n,r){if(i.hasShadow||i.isOutlined||i.isUnderline){for(var s=this._context,a=r.parsedString,o=a.length>1&&i.hasShadow,h=this._measureText(this._context,i.fontDesc),u=0,l=0,c=0;c<a.length;++c)if(u=t.x,l=t.y+c*e,o&&(i.hasShadow&&(this._setupShadow(i),s.fillText(a[c],u,l)),i.isOutlined&&(this._setupOutline(i),s.strokeText(a[c],u,l)),i.hasShadow&&!i.isOutlined||s.fillText(a[c],u,l)),i.isUnderline){var f=h(a[c]),_=new ds;2===n.horizontalAlign?_.x=t.x-f:1===n.horizontalAlign?_.x=t.x-f/2:_.x=t.x,_.y=l+i.actualFontSize/8,s.fillRect(_.x,_.y,f,i.underlineHeight*this._fontScale)}o&&(s.shadowColor="transparent")}},e._setupOutline=function(t){var e=this._context;e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,e.strokeStyle="rgba("+t.outlineColor.r+", "+t.outlineColor.g+", "+t.outlineColor.b+", "+t.outlineColor.a/255+")",e.lineWidth=2*t.outlineWidth*this._fontScale},e._setupShadow=function(t){var e=this._context,i=this._fontScale;e.shadowColor="rgba("+t.shadowColor.r+", "+t.shadowColor.g+", "+t.shadowColor.b+", "+t.shadowColor.a/255+")",e.shadowBlur=t.shadowBlur*i,e.shadowOffsetX=t.shadowOffsetX*i,e.shadowOffsetY=-t.shadowOffsetY*i},e.generateVertexData=function(t,e,i,n,r,s,a){t?this._updateQuads(e,i,n,r,s,a):(this.updateQuatCount(r),a(e,n,r))},e.updateQuatCount=function(t){var e=t.vertexBuffer,i=t.quadCount;if(e.length!==i){for(var n=e.length;n<i;n++)e.push({x:0,y:0,z:0,u:0,v:0,color:cr.WHITE.clone()});e.length=i}},e._setupBMFontOverflowMetrics=function(t,e){var i=e.nodeContentSize,n=i.width,r=i.height;3===t.overFlow&&(r=0),0===t.overFlow&&(n=0,r=0),t.textWidthTemp=n,t.textHeightTemp=r,t.textDimensions.width=n,t.textDimensions.height=r,t.maxLineWidth=n},e._updateFontScale=function(t){t.bmfontScale=t.actualFontSize/(t.originFontSize*this._fontScale)},e._computeHorizontalKerningForText=function(t,e,i){var n=i,r=n.length;if(t.fntConfig){var s=t.fntConfig.kerningDict,a=e.horizontalKerning;if(s&&0!==s.length)for(var o=-1,h=0;h<r;++h){var u=n.charCodeAt(h),l=s[o<<16|65535&u]||0;a[h]=h<r-1?l:0,o=u}}},e._alignText=function(t,e,i,n){this._multilineTextWrap(t,e,i,n,this._getFirstWordLen),2===e.overFlow&&(t.fontSize>0&&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=BR(e);r<a;++r){var o=this._lettersInfo[r];o.valid&&(s===o.line?n+=o.char:(i=i.concat(n),s=o.line,n=""))}i=i.concat(n),t.parsedString=i},e._multilineTextWrap=function(t,e,i,n,r){e.linesWidth.length=0;for(var s=n,a=s.length,o=0,h=0,u=0,l=0,c=0,f=0,_=0,d=null,p=0;p<a;){var m=IR(s,p);if("\n"!==m){for(var g=r(t,e,s,p,a),y=f,v=_,b=c,S=h,w=!1,x=new ds,T=0;T<g;++T){var A=p+T;if("\r"!==(m=IR(s,A)))if(d=SF.fontAtlas.getLetterDefinitionForChar(m,SF)){var C=S+d.offsetX*t.bmfontScale-SF.margin;if(e.wrapping&&e.maxLineWidth>0&&h>0&&C+d.w*t.bmfontScale>e.maxLineWidth&&!CR(m)){e.linesWidth.push(c),c=0,o++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,w=!0;break}x.x=C,x.y=u-d.offsetY*t.bmfontScale,this._recordLetterInfo(x,m,A,o),A+1<e.horizontalKerning.length&&A<a-1&&(S+=e.horizontalKerning[A+1]*t.bmfontScale),S+=d.xAdvance*t.bmfontScale+e.spacingX,b=x.x+d.w*t.bmfontScale,y<x.y&&(y=x.y),v>x.y-d.h*t.bmfontScale&&(v=x.y-d.h*t.bmfontScale)}else this._recordPlaceholderInfo(A,m),null!=t.fntConfig?it(16354,t.fntConfig.atlasName,m):it(16355,t.fontFamily,m);else this._recordPlaceholderInfo(A,m)}w||(h=S,f<y&&(f=y),_>v&&(_=v),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*SF.margin),e.textHeightTemp<=0&&(D.height=parseFloat(e.textDesiredHeight.toFixed(2))+2*SF.margin),e.tailoredTopY=D.height,e.tailoredBottomY=0,f>0&&(e.tailoredTopY=D.height+f),_<-e.textDesiredHeight&&(e.tailoredBottomY=e.textDesiredHeight+_),!0},e._recordPlaceholderInfo=function(t,e){var i=this._lettersInfo;if(t>=i.length){var n=new PG;i.push(n)}i[t].char=e,i[t].hash=""+MR(e,0)+SF.hash,i[t].valid=!1},e._recordLetterInfo=function(t,e,i,n){var r=this._lettersInfo;if(i>=r.length){var s=new PG;r.push(s)}var a=""+MR(e,0)+SF.hash;r[i].line=n,r[i].char=e,r[i].hash=a,r[i].valid=SF.fontAtlas.getLetter(a).valid,r[i].x=t.x,r[i].y=t.y},e._getFirstWordLen=function(t,e,i,n,r){var s=IR(i,n);if(AR(s)||"\n"===s||CR(s))return 1;var a=SF.fontAtlas,o=1,h=a.getLetterDefinitionForChar(s,SF);if(!h)return o;for(var u=h.xAdvance*t.bmfontScale+e.spacingX,l=n+1;l<r&&(s=IR(i,l),h=a.getLetterDefinitionForChar(s,SF));++l){if(u+h.offsetX*t.bmfontScale+h.w*t.bmfontScale>e.maxLineWidth&&!CR(s)&&e.maxLineWidth>0)return o;if(u+=h.xAdvance*t.bmfontScale+e.spacingX,"\n"===s||CR(s)||AR(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;r<e.numberOfLines;++r)e.linesOffsetX.push(0);break;case 1:for(var s=0,a=e.linesWidth.length;s<a;s++)e.linesOffsetX.push((n.width-e.linesWidth[s])/2);break;case 2:for(var o=0,h=e.linesWidth.length;o<h;o++)e.linesOffsetX.push(n.width-e.linesWidth[o])}if(e.letterOffsetY=n.height,0!==e.verticalAlign){var u=n.height-e.textDesiredHeight+e.lineHeight*this._getFontScale(t,e)-t.originFontSize*this._fontScale*t.bmfontScale;2===e.verticalAlign?e.letterOffsetY-=u:e.letterOffsetY-=u/2}},e._getFontScale=function(t,e){return 2===e.overFlow?t.bmfontScale:1},e._isVerticalClamp=function(t,e,i){return e.textDesiredHeight>i.nodeContentSize.height},e._isHorizontalClamp=function(t,e,i,n,r){for(var s=!1,a=0,o=BR(n);a<o;++a){var h=r._lettersInfo[a];if(h.valid){var u=SF.fontAtlas.getLetterDefinitionForChar(h.char,SF);if(!u)continue;var l=h.x+u.w*t.bmfontScale,c=h.line;if(e.textWidthTemp>0){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;i<n;++i)if(t.linesWidth[i]>e.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<a;){var h=o=s+a+1>>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=SF.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=BR(r);c<f;++c){var _=this._lettersInfo[c];if(_.valid){var d=a.getLetter(_.hash);if(d){var p=this._tmpRect;p.height=d.h,p.width=d.w,p.x=d.u,p.y=d.v;var m=_.y+e.letterOffsetY;if(e.textHeightTemp>0){if(m>e.tailoredTopY){var g=m-e.tailoredTopY;p.y+=g,p.height-=g,m-=g}m-p.height*t.bmfontScale<e.tailoredBottomY&&1===e.overFlow&&(p.height=m<e.tailoredBottomY?0:(m-e.tailoredBottomY)/t.bmfontScale)}var y=_.line,v=_.x+d.w/2*t.bmfontScale+e.linesOffsetX[y];if(e.textWidthTemp>0&&this._isHorizontalClamped(e,i,v,y)&&1===e.overFlow&&(p.width=0),p.height>0&&p.width>0){var b=this._determineRect(t),S=_.x+e.linesOffsetX[_.line],w=n.quadCount;n.quadCount+=4,this.updateQuatCount(n),s(t,i,n,w,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}();EG.instance=void 0,EG.instance=new EG;var OG=new bF(64,64),kG=new lF(null),RG=null,FG=null,LG=null,VG=null,NG=null,zG=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=LG?LG.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*SF.margin,i.nodeContentSize.height+=2*SF.margin):3===a?(e.wrapping=!0,i.nodeContentSize.height+=2*SF.margin):e.wrapping=r.enableWrapText,n.uiTransAnchorX=s.anchorX,n.uiTransAnchorY=s.anchorY,SF.lineHeight=r.lineHeight,SF.fontSize=r.fontSize,t.spriteFrame=VG,t.fntConfig=LG,t.fontFamily=SF.fontFamily,t.color.set(r.color)},e.updateRenderData=function(t){if(t.renderData&&RG!==t){if(t.renderData.vertDirty){FG=(RG=t).node._getUITransformComp();var e=t.renderData,i=EG.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,a=t.textRenderData;n.fontScale=zO.getScaleX(),this._updateFontFamily(t),this.updateProcessingData(n,r,s,a,t,FG),this._updateLabelInfo(t),n.fontDesc=SF.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;h<u;h++)o[h]=a.vertexBuffer[h];var l=e.indexCount;this.createQuadIndices(l),e.chunk.setIndexBuffer(NG),RG.actualFontSize=n.actualFontSize,FG.setContentSize(s.nodeContentSize),this.updateUVs(t),e.vertDirty=!1,RG=null,this._resetProperties()}t.spriteFrame&&t.renderData.updateRenderData(t,t.spriteFrame)}},e.updateUVs=function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.vertexCount,r=e.floatStride,s=e.data,a=3,o=0;o<n;o++){var h=s[o];i[a]=h.u,i[a+1]=h.v,a+=r}},e.updateColor=function(){},e.resetRenderData=function(t){var e=t.renderData;e.dataLength=0,e.resize(0,0)},e.generateVertexData=function(t,e,i,n,r,s,a,o,h){var u=n,l=t.bmfontScale,c=i.vertexBuffer,f=r.width,_=r.height,d=s.width,p=s.height,m=0,g=0,y=0,v=0;a?(m=s.x/f,v=(s.x+p)/f,g=(s.y+d)/_,y=s.y/_,c[u].u=m,c[u].v=y,c[u+1].u=m,c[u+1].v=g,c[u+2].u=v,c[u+2].v=y,c[u+3].u=v,c[u+3].v=g):(m=s.x/f,v=(s.x+d)/f,g=(s.y+p)/_,y=s.y/_,c[u].u=m,c[u].v=g,c[u+1].u=v,c[u+1].v=g,c[u+2].u=m,c[u+2].v=y,c[u+3].u=v,c[u+3].v=y),c[u].x=o,c[u].y=h-p*l,c[u+1].x=o+d*l,c[u+1].y=h-p*l,c[u+2].x=o,c[u+2].y=h,c[u+3].x=o+d*l,c[u+3].y=h},e._updateFontFamily=function(t){var e=t.font;VG=e.spriteFrame,LG=e.fntConfig,SF.fontAtlas=e.fontDefDictionary,SF.fontAtlas||(2===t.cacheMode?SF.fontAtlas=OG:SF.fontAtlas=kG),JO.packToDynamicAtlas(t,VG)},e._updateLabelInfo=function(){SF.hash="",SF.margin=0},e._resetProperties=function(){LG=null,VG=null,SF.hash="",SF.margin=0},e.createQuadIndices=function(t){if(t%6==0){var e=t/6;NG=new Uint16Array(t);for(var i=0,n=0;n<e;n++)NG[i++]=0+4*n,NG[i++]=1+4*n,NG[i++]=2+4*n,NG[i++]=1+4*n,NG[i++]=3+4*n,NG[i++]=2+4*n}else ht(16308)},t}(),UG=new cr(255,255,255,255),GG=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){var e=t.node;UG.set(t.color),UG.a=255*e._uiProps.opacity,qp(e,0,t.renderData,UG)},e}(zG),HG=new GG,WG=null,jG=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.getAssemblerData=function(){return WG||(WG=new bF(1024,1024)),WG.getTexture()},i._updateFontFamily=function(t){SF.fontAtlas=WG,SF.fontFamily=this._getFontFamily(t),t.enableOutline&&t.outlineWidth>0?(SF.isOutlined=!0,SF.margin=t.outlineWidth,SF.out=t.outlineColor.clone(),SF.out.a=t.outlineColor.a*t.color.a/255):(SF.isOutlined=!1,SF.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){SF.fontDesc=this._getFontDesc(),SF.color.set(t.color),SF.hash=wF(SF)},i._getFontDesc=function(){return SF.fontSize.toString()+"px "+SF.fontFamily},e}(zG),qG=new cr(255,255,255,255),XG=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;qG.a=255*e._uiProps.opacity,qp(e,0,t.renderData,qG)}},i.updateColor=function(){},e}(jG),YG=new XG;LV.Overflow;var JG=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=LV._canvasPool.get();return t.canvas.width=t.canvas.height=1,t},e.resetAssemblerData=function(t){t&&LV._canvasPool.put(t)},e.updateRenderData=function(t){if(t.renderData){if(t.renderData.vertDirty){var e=t.node._getUITransformComp(),i=EG.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,a=t.textRenderData;n.fontScale=zO.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;JO.packToDynamicAtlas(t,i)}},e._resetDynamicAtlas=function(t){if(1===t.cacheMode){var e=t.ttfSpriteFrame;JO.deleteAtlasSpriteFrame(e),e._resetDynamicAtlasFrame()}},t}(),KG=cr.WHITE.clone(),QG=Uint16Array.from([0,1,2,1,3,2]),ZG=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;a<o;++a)i[s]=r[a].u,i[s+1]=r[a].v,s+=n;for(var h=5,u=0;u<e.dataLength;u++)cr.toArray(i,KG,h),h+=n;return e.chunk.setIndexBuffer(QG),e},i.fillBuffers=function(t){for(var e=t.renderData,i=e.chunk,n=e.data,r=t.node,s=i.vb,a=r.worldMatrix,o=e.floatStride,h=0,u=n.length,l=0;l<u;l++){var c=n[l],f=c.x,_=c.y,d=a.m03*f+a.m07*_+a.m15;d=d?1/d:1,s[0+(h=l*o)]=(a.m00*f+a.m04*_+a.m12)*d,s[h+1]=(a.m01*f+a.m05*_+a.m13)*d,s[h+2]=(a.m02*f+a.m06*_+a.m14)*d}var p=i.vertexOffset,m=i.meshBuffer,g=i.meshBuffer.iData,y=m.indexOffset;g[y++]=p,g[y++]=p+1,g[y++]=p+2,g[y++]=p+2,g[y++]=p+1,g[y++]=p+3,m.indexOffset+=6},i.updateVertexData=function(t){var e=t.renderData;if(e){var i=t.node._getUITransformComp(),n=i.width,r=i.height,s=i.anchorX*n,a=i.anchorY*r,o=e.data;o[0].x=-s,o[0].y=-a,o[1].x=n-s,o[1].y=-a,o[2].x=-s,o[2].y=r-a,o[3].x=n-s,o[3].y=r-a}},i.updateUVs=function(t){var e=t.renderData;if(e&&t.ttfSpriteFrame)for(var i=e.chunk.vb,n=t.ttfSpriteFrame.uv,r=e.floatStride,s=3,a=0;a<e.dataLength;++a){var o=2*a;i[s]=n[o],i[s+1]=n[o+1],s+=r}},i.updateColor=function(){},e}(JG),$G=new ZG,tH=t("l",{getAssembler:function(t){var e=$G;return t.font instanceof cF?e=HG:2===t.cacheMode&&(e=YG),e}});LV.Assembler=tH,GV.FillType;var eH=new Kr,iH=Uint16Array.from([0,1,2,1,3,2]),nH=function(){function t(){}var e=t.prototype;return e.updateRenderData=function(t){var e=t.spriteFrame;JO.packToDynamicAtlas(t,e);var i=t.renderData;if(i&&e){if(!i.vertDirty)return;var n=t.fillStart,r=t.fillRange;r<0&&(n+=r,r=-r),r=(r=(r=n+r)>1?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,_=0,d=0,p=0,m=0,g=0,y=0;n.isRotated()?(u=h.x/a,l=(h.y+h.width)/o,c=_=u,p=g=(h.x+h.height)/a,d=y=l,f=m=h.y/o):(u=h.x/a,l=(h.y+h.height)/o,c=p=u,_=g=(h.x+h.width)/a,f=d=l,m=y=h.y/o);var v=r.floatStride,b=3;switch(t.fillType){case 0:s[b]=c+(_-c)*e,s[b+1]=f+(d-f)*e,s[b+=v]=c+(_-c)*i,s[b+1]=f+(d-f)*i,s[b+=v]=p+(g-p)*e,s[b+1]=m+(y-m)*e,s[b+=v]=p+(g-p)*i,s[b+1]=m+(y-m)*i;break;case 1:s[b]=c+(p-c)*e,s[b+1]=f+(m-f)*e,s[b+=v]=_+(g-_)*e,s[b+1]=d+(y-d)*e,s[b+=v]=c+(p-c)*i,s[b+1]=f+(m-f)*i,s[b+=v]=_+(g-_)*i,s[b+1]=d+(y-d)*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,_=0;switch(t.fillType){case 0:_=u+(c-u)*i,u+=(c-u)*e,c=_;break;case 1:_=l+(f-l)*i,l+=(f-l)*e,f=_;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(iH),e.data.forEach((function(t){t.z=0})),e},e.updateWorldVertexData=function(t,e){t.node.getWorldMatrix(eH);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=eH.m03*h+eH.m07*u+eH.m15;l=l?1/l:1,r[s=a*i]=(eH.m00*h+eH.m04*u+eH.m12)*l,r[s+1]=(eH.m01*h+eH.m05*u+eH.m13)*l,r[s+2]=(eH.m02*h+eH.m06*u+eH.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}(),rH=new nH,sH=2*Math.PI,aH=1e-6,oH=new Kr,hH=[new ds,new ds,new ds,new ds],uH=new Array(4),lH=new Array(8),cH=[new ds,new ds,new ds,new ds],fH=[new ds,new ds,new ds,new ds],_H=new ds,dH=[new ds,new ds,new ds,new ds],pH=null;function mH(t,e,i,n,r,s,a){var o=Math.sin(s);o=Math.abs(o)>aH?o:0;var h=Math.cos(s),u=0,l=0;if(0!==(h=Math.abs(h)>aH?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 _=r.x+l*(n-r.y);a[3].x=_,a[3].y=n}if((i-r.y)*o>0){var d=r.x+l*(i-r.y);a[1].x=d,a[1].y=i}}}function gH(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=uH;l[0]=a,l[1]=o,l[2]=h,l[3]=u;var c=t.fillCenter,f=_H.x=Math.min(Math.max(0,c.x),1)*(h-a)+a,_=_H.y=Math.min(Math.max(0,c.y),1)*(u-o)+o;hH[0].x=hH[3].x=a,hH[1].x=hH[2].x=h,hH[0].y=hH[1].y=o,hH[2].y=hH[3].y=u,dH.forEach((function(t){ds.set(t,0,0)})),f!==l[0]&&ds.set(dH[0],3,0),f!==l[2]&&ds.set(dH[2],1,2),_!==l[1]&&ds.set(dH[1],0,1),_!==l[3]&&ds.set(dH[3],2,3)}function yH(t){var e=t.width,i=t.height,n=t.getRect(),r=0,s=0,a=0,o=0,h=lH;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 vH(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 bH(t,e,i,n,r){var s=uH,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,SH((i.x-a)/(h-a),(i.y-o)/(u-o),t,e),SH((n.x-a)/(h-a),(n.y-o)/(u-o),t,e+1),SH((r.x-a)/(h-a),(r.y-o)/(u-o),t,e+2)}function SH(t,e,i,n){var r=lH,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 wH=function(){function t(){}var e=t.prototype;return e.createData=function(t){return t.requestRenderData()},e.updateRenderData=function(t){var e=t.spriteFrame;JO.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*=sH)+(s*=sH);gH(t),yH(e),mH(uH[0],uH[2],uH[1],uH[3],_H,r,cH),mH(uH[0],uH[2],uH[1],uH[3],_H,r+s,fH);for(var o=0,h=0;h<4;++h){var u=dH[h];if(u)if(s>=sH)i.dataLength=o+3,bH(n,o,_H,hH[u.x],hH[u.y]),o+=3;else{var l=vH(_H,hH[u.x]),c=vH(_H,hH[u.y]);c<l&&(c+=sH),l-=sH,c-=sH;for(var f=0;f<3;++f)l>=a||(l>=r?(i.dataLength=o+3,bH(n,o,_H,hH[u.x],c>=a?fH[h]:hH[u.y]),o+=3):c>r&&(c<=a?(i.dataLength=o+3,bH(n,o,_H,cH[h],hH[u.y]),o+=3):(i.dataLength=o+3,bH(n,o,_H,cH[h],fH[h]),o+=3))),l+=sH,c+=sH}}0===o&&(i.dataLength=0),i.resize(o,o),i.updateRenderData(t,e)}},e.createQuadIndices=function(t){pH=null,pH=new Uint16Array(t);for(var e=0,i=0;i<t;i++)pH[e++]=i},e.fillBuffers=function(t){var e=t.node,i=t.renderData,n=i.chunk;(t._flagChangedVersion!==e.flagChangedVersion||i.vertDirty)&&(this.updateWorldVertexAndUVData(t,n),i.vertDirty=!1,t._flagChangedVersion=e.flagChangedVersion),this.updateColorLate(t),n.bufferId;for(var r=n.vertexOffset,s=n.meshBuffer,a=n.meshBuffer.iData,o=s.indexOffset,h=0;h<i.indexCount;h++)a[o+h]=r+h;s.indexOffset+=i.indexCount,s.setDirty()},e.updateWorldUVData=function(t){for(var e=t.renderData,i=e.floatStride,n=e.data,r=e.chunk.vb,s=0;s<n.length;s++){var a=s*i;r[a+3]=n[s].u,r[a+4]=n[s].v}},e.updateWorldVertexAndUVData=function(t,e){t.node.getWorldMatrix(oH);for(var i=t.renderData,n=i.floatStride,r=t.renderData.data,s=e.vb,a=i.vertexCount,o=0,h=0;h<a;h++){var u=r[h],l=u.x,c=u.y,f=oH.m03*l+oH.m07*c+oH.m15;f=f?1/f:1,s[o+0]=(oH.m00*l+oH.m04*c+oH.m12)*f,s[o+1]=(oH.m01*l+oH.m05*c+oH.m13)*f,s[o+2]=(oH.m02*l+oH.m06*c+oH.m14)*f,s[o+3]=u.u,s[o+4]=u.v,o+=n}},e.updateUVs=function(t){t.renderData.vertDirty=!0,t._markForUpdateRenderData()},e.updateColorLate=function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=e.vertexCount,s=5,a=t.color,o=a.r/255,h=a.g/255,u=a.b/255,l=t.node._uiProps.opacity,c=0;c<r;c++)i[s]=o,i[s+1]=h,i[s+2]=u,i[s+3]=l,s+=n},e.updateColor=function(){},t}(),xH=new wH,TH=Uint16Array.from([0,1,2,1,3,2]),AH=function(){function t(){}var e=t.prototype;return e.createData=function(t){var e=t.requestRenderData();return e.dataLength=4,e.resize(4,6),e.chunk.setIndexBuffer(TH),e},e.updateRenderData=function(t){var e=t.spriteFrame;JO.packToDynamicAtlas(t,e),this.updateUVs(t);var i=t.renderData;i&&e&&(i.vertDirty&&this.updateVertexData(t),i.updateRenderData(t,e))},e.updateWorldVerts=function(t,e){var i=t.renderData;if(i)for(var n=e.vb,r=i.data,s=t.node.worldMatrix,a=s.m00,o=s.m01,h=s.m02,u=s.m03,l=s.m04,c=s.m05,f=s.m06,_=s.m07,d=s.m12,p=s.m13,m=s.m14,g=s.m15,y=i.floatStride,v=0,b=r.length,S=0;S<b;++S){var w=r[S],x=w.x,T=w.y,A=u*x+_*T+g;A=A?1/A:1,n[0+(v=S*y)]=(a*x+l*T+d)*A,n[v+1]=(o*x+c*T+p)*A,n[v+2]=(h*x+f*T+m)*A}},e.fillBuffers=function(t){if(null!==t){var e=t.renderData;if(e){var i=e.chunk;(t._flagChangedVersion!==t.node.flagChangedVersion||e.vertDirty)&&(this.updateWorldVerts(t,i),e.vertDirty=!1,t._flagChangedVersion=t.node.flagChangedVersion);var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,a=r.indexOffset,o=n;s[a++]=o,s[a++]=o+1,s[a++]=o+2,s[a++]=o+1,s[a++]=o+3,s[a++]=o+2,r.indexOffset+=6}}},e.updateVertexData=function(t){var e=t.renderData;if(e){var i=t.node._getUITransformComp(),n=e.data,r=i.width,s=i.height,a=i.anchorX*r,o=i.anchorY*s,h=0,u=0,l=0,c=0;if(t.trim)h=-a,u=-o,l=r-a,c=s-o;else{var f=t.spriteFrame,_=f.originalSize,d=r/_.width,p=s/_.height,m=f.trimmedBorder;h=m.x*d-a,u=m.z*p-o,l=r+m.y*d-a,c=s+m.w*p-o}n[0].x=h,n[0].y=u,n[1].x=l,n[1].y=u,n[2].x=h,n[2].y=c,n[3].x=l,n[3].y=c,e.vertDirty=!0}},e.updateUVs=function(t){var e=t.renderData;if(t.spriteFrame&&e)for(var i=e.chunk.vb,n=t.spriteFrame.uv,r=e.floatStride,s=3,a=0;a<e.dataLength;++a){var o=2*a;i[s]=n[o],i[s+1]=n[o+1],s+=r}},e.updateColor=function(t){var e=t.renderData;if(e)for(var i=e.chunk.vb,n=5,r=t.color,s=r.r/255,a=r.g/255,o=r.b/255,h=r.a/255,u=0;u<4;u++,n+=e.floatStride)i[n]=s,i[n+1]=a,i[n+2]=o,i[n+3]=h},t}(),CH=new AH,DH=[],BH=0;BH<4;BH++)DH.push({x:0,y:0,z:0,u:0,v:0,color:new cr});var IH,MH,PH,EH,OH,kH,RH,FH=function(){function t(){this.QUAD_INDICES=void 0}var e=t.prototype;return e.createData=function(t){var e=t.requestRenderData();e.dataLength=16,e.resize(16,54);var i=this.QUAD_INDICES=new Uint16Array(54);return this.createQuadIndices(4,4),e.chunk.setIndexBuffer(i),e},e.createQuadIndices=function(t,e){for(var i=0,n=this.QUAD_INDICES,r=0;r<t-1;r++)for(var s=0;s<e-1;s++){var a=r*e+s;n[i++]=a,n[i++]=a+1,n[i++]=a+e,n[i++]=a+1,n[i++]=a+1+e,n[i++]=a+e}},e.updateRenderData=function(t){var e=t.spriteFrame;JO.packToDynamicAtlas(t,e),this.updateUVs(t);var i=t.renderData;i&&e&&(i.vertDirty&&this.updateVertexData(t),i.updateRenderData(t,e))},e.updateVertexData=function(t){var e=t.renderData;if(e){var i=e.data,n=t.node._getUITransformComp(),r=n.width,s=n.height,a=n.anchorX*r,o=n.anchorY*s,h=t.spriteFrame,u=h.insetLeft,l=h.insetRight,c=h.insetTop,f=h.insetBottom,_=r-u-l,d=s-c-f,p=r/(u+l),m=s/(c+f);p=Number.isNaN(p)||p>1?1:p,m=Number.isNaN(m)||m>1?1:m,_=_<0?0:_,d=d<0?0:d,DH[0].x=-a,DH[0].y=-o,DH[1].x=u*p-a,DH[1].y=f*m-o,DH[2].x=DH[1].x+_,DH[2].y=DH[1].y+d,DH[3].x=r-a,DH[3].y=s-o;for(var g=0;g<4;g++)for(var y=0;y<4;y++){var v=4*g+y;v<e.dataLength&&g<DH.length&&y<DH.length&&(i[v].x=DH[y].x,i[v].y=DH[g].y)}}},e.fillBuffers=function(t){var e=t.renderData;if(e){var i=e.chunk;(t._flagChangedVersion!==t.node.flagChangedVersion||e.vertDirty)&&(this.updateWorldVertexData(t,i),e.vertDirty=!1,t._flagChangedVersion=t.node.flagChangedVersion),i.bufferId;for(var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,a=r.indexOffset,o=0;o<3;++o)for(var h=0;h<3;++h){var u=n+4*o+h;s[a++]=u,s[a++]=u+1,s[a++]=u+4,s[a++]=u+1,s[a++]=u+5,s[a++]=u+4}r.indexOffset=a}},e.updateWorldVertexData=function(t,e){var i=t.renderData;if(i)for(var n=i.floatStride,r=i.data,s=e.vb,a=t.node.worldMatrix,o=a.m00,h=a.m01,u=a.m02,l=a.m03,c=a.m04,f=a.m05,_=a.m06,d=a.m07,p=a.m12,m=a.m13,g=a.m14,y=a.m15,v=0,b=0;b<4;++b)for(var S=r[4*b],w=0;w<4;++w){var x=r[w].x,T=S.y,A=l*x+d*T+y;A=A?1/A:1,s[0+(v=(4*b+w)*n)]=(o*x+c*T+p)*A,s[v+1]=(h*x+f*T+m)*A,s[v+2]=(u*x+_*T+g)*A}},e.updateUVs=function(t){var e=t.renderData;if(t.spriteFrame&&e)for(var i=e.chunk.vb,n=e.floatStride,r=t.spriteFrame.uvSliced,s=3,a=0;a<16;a++)i[s]=r[a].u,i[s+1]=r[a].v,s+=n},e.updateColor=function(t){var e=t.renderData;if(e)for(var 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<16;l++)i[r]=a,i[r+1]=o,i[r+2]=h,i[r+3]=u,r+=n},t}(),LH=new FH,VH=new Kr,NH=0,zH=[],UH=null;function GH(t){return t&&(t.insetTop>0||t.insetBottom>0||t.insetLeft>0||t.insetRight>0)?2:0}var HH=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,_=r-o-h,d=s-l-c;_=_>0?_:0,d=d>0?d:0;var p=0===u?_:_/u,m=0===f?d:d/f,g=GH(i),y=Math.ceil(m+g),v=Math.ceil(p+g);e.dataLength=4*y*v,this.updateVerts(t,_,d,y,v),e.vertexCount!==y*v*4&&(t.renderEntity.colorDirty=!0),e.resize(y*v*4,y*v*6),e.updateRenderData(t,i)}}},e.createQuadIndices=function(t){if(t%6==0){var e=t/6;UH=new Uint16Array(t);for(var i=0,n=0;n<e;n++)UH[i++]=0+4*n,UH[i++]=1+4*n,UH[i++]=2+4*n,UH[i++]=1+4*n,UH[i++]=3+4*n,UH[i++]=2+4*n}else ht(16308)},e.updateUVs=function(t){var e=t.renderData;e&&(e.vertDirty=!0,t._markForUpdateRenderData())},e.fillBuffers=function(t){var e=t.node,i=t.renderData;if(i){var n=i.chunk;if(null!==n){(t._flagChangedVersion!==e.flagChangedVersion||i.vertDirty)&&(this.updateWorldVertexAndUVData(t,n),i.vertDirty=!1,t._flagChangedVersion=e.flagChangedVersion),this.updateColorLate(t),n.bufferId;for(var r=n.vertexOffset,s=n.meshBuffer,a=n.meshBuffer.iData,o=s.indexOffset,h=0;h<i.indexCount;h+=6)a[o++]=r,a[o++]=r+1,a[o++]=r+2,a[o++]=r+1,a[o++]=r+3,a[o++]=r+2,r+=4,s.indexOffset+=6;s.setDirty()}}},e.updateWorldUVData=function(t){var e=t.renderData;if(e)for(var i=e.floatStride,n=e.data,r=e.chunk.vb,s=0;s<n.length;s++){var a=s*i;r[a+3]=n[s].u,r[a+4]=n[s].v}},e.updateWorldVertexAndUVData=function(t,e){var i=t.renderData;if(i){t.node.getWorldMatrix(VH);for(var n=i.floatStride,r=i.data,s=e.vb,a=r.length,o=0;o<a;o++){var h=r[o].x,u=r[o].y,l=r[o].z,c=VH.m03*h+VH.m07*u+VH.m11*l+VH.m15;c=c?1/c:1;var f=o*n;s[f]=(VH.m00*h+VH.m04*u+VH.m08*l+VH.m12)*c,s[f+1]=(VH.m01*h+VH.m05*u+VH.m09*l+VH.m13)*c,s[f+2]=(VH.m02*h+VH.m06*u+VH.m10*l+VH.m14)*c}this.updateWorldUVData(t)}},e.updateVerts=function(t,e,i,n,r){var s=t.node._getUITransformComp(),a=t.renderData;if(a){var o,h,u=a.data,l=t.spriteFrame,c=l.rect,f=Math.abs(s.width),_=Math.abs(s.height),d=s.anchorX*f,p=s.anchorY*_,m=l.insetLeft,g=l.insetRight,y=c.width-m-g,v=l.insetTop,b=l.insetBottom,S=c.height-v-b,w=s.width/(m+g)>1?1:s.width/(m+g),x=s.height/(v+b)>1?1:s.height/(v+b);o=y>0?Math.floor(1e3*e)/1e3%y==0?y:e%y:e,h=S>0?Math.floor(1e3*i)/1e3%S==0?S:i%S:i,zH.length=0,NH=Math.max(n+1,r+1);for(var T=0;T<NH;T++)zH.push({x:0,y:0,z:0,u:0,v:0,color:new cr});var A=GH(l);if(0===A)for(var C=0;C<NH;C++)zH[C].x=C>=r?f-d:C*y-d,zH[C].y=C>=n?_-p:C*S-p;else for(var D=0;D<NH;D++)0===D?zH[D].x=-d:1===D?zH[D].x=m*w-d:D>1&&D<r-1?zH[D].x=y>0?m*w-d+y*(D-1):m+e-d:D===r-1?zH[D].x=m*w-d+o+y*(D-2):D>=r&&(zH[D].x=Math.min(m+e+g,f)-d),0===D?zH[D].y=-p:1===D?zH[D].y=b*x-p:D>1&&D<n-1?zH[D].y=S>0?b*x-p+S*(D-1):b+i-p:D===n-1?zH[D].y=b*x-p+h+S*(D-2):D>=n&&(zH[D].y=Math.min(b+i+v,_)-p);for(var B=0,I=0,M=0,P=0,E=0;E<n;++E){M=zH[E].y,P=zH[E+1].y;for(var O=0;O<r;++O){B=zH[O].x,I=zH[O+1].x;var k=4*(E*r+O);u[k].x=B,u[k].y=M,u[k+1].x=I,u[k+1].y=M,u[k+2].x=B,u[k+2].y=P,u[k+3].x=I,u[k+3].y=P}}var R=l.rotated;l.uv;var F=l.uvSliced;IH=F[0],MH=F[1],PH=F[2],EH=F[3],OH=F[4],kH=F[8],RH=F[12];for(var L=0,V=0,N=0===y?e:e/y,z=0===S?i:i/S,U=[],G=[],H=0;H<n;++H){V=i>S?i>=(A>0?H:H+1)*S?1:z%1:z;for(var W=0;W<r;++W){L=e>y?e>=(A>0?W:W+1)*y?1:N%1:N,R?(0===A?(U[0]=OH.u,U[1]=OH.u,U[2]=OH.u+(kH.u-OH.u)*V,G[0]=MH.v,G[1]=MH.v+(PH.v-MH.v)*L,G[2]=MH.v):(0===H?(U[0]=IH.u,U[1]=IH.u,U[2]=OH.u):H<n-1?(U[0]=OH.u,U[1]=OH.u,U[2]=OH.u+(kH.u-OH.u)*V):H===n-1&&(U[0]=kH.u,U[1]=kH.u,U[2]=RH.u),0===W?(G[0]=IH.v,G[1]=MH.v,G[2]=IH.v):W<r-1?(G[0]=MH.v,G[1]=MH.v+(PH.v-MH.v)*L,G[2]=MH.v):W===r-1&&(G[0]=PH.v,G[1]=EH.v,G[2]=PH.v)),U[3]=U[2],G[3]=G[1]):(0===A?(U[0]=MH.u,U[1]=MH.u+(PH.u-MH.u)*L,U[2]=MH.u,G[0]=OH.v,G[1]=OH.v,G[2]=OH.v+(kH.v-OH.v)*V):(0===W?(U[0]=IH.u,U[1]=MH.u,U[2]=IH.u):W<r-1?(U[0]=MH.u,U[1]=MH.u+(PH.u-MH.u)*L,U[2]=MH.u):W===r-1&&(U[0]=PH.u,U[1]=EH.u,U[2]=PH.u),0===H?(G[0]=IH.v,G[1]=IH.v,G[2]=OH.v):H<n-1?(G[0]=OH.v,G[1]=OH.v,G[2]=OH.v+(kH.v-OH.v)*V):H===n-1&&(G[0]=kH.v,G[1]=kH.v,G[2]=RH.v)),U[3]=U[1],G[3]=G[2]);var j=4*(H*r+W);u[j].u=U[0],u[j].v=G[0],u[j+1].u=U[1],u[j+1].v=G[1],u[j+2].u=U[2],u[j+2].v=G[2],u[j+3].u=U[3],u[j+3].v=G[3]}}}},e.updateColorLate=function(t){var e=t.renderData;if(e)for(var i=e.chunk.vb,n=e.floatStride,r=e.vertexCount,s=5,a=t.color,o=a.r/255,h=a.g/255,u=a.b/255,l=t.node._uiProps.opacity,c=0;c<r;c++)i[s]=o,i[s+1]=h,i[s+2]=u,i[s+3]=l,s+=n},e.updateColor=function(){},t}(),WH=new HH;GV.Type,GV.FillType;var jH=t("s",{getAssembler:function(t){var e=CH,i=t;switch(i.type){case 1:e=LH;break;case 2:e=WH;break;case 3:e=2===i.fillType?xH:rH}return e}});GV.Assembler=jH;var qH=t("S",function(){function t(){this._maskStack=[],this._stencilPattern={stencilTest:!0,func:7,stencilMask:65535,writeMask:65535,failOp:1,zFailOp:1,passOp:1,ref:1},this._stage=0,this.stencilStateMap=new Map,this.stencilStateMapWithDepth=new Map}var e=t.prototype;return e.pushMask=function(t){this._maskStack.push(t)},e.clear=function(t){return 2!==t.stencilStage?5:1},e.enableMask=function(){this.stage=3},e.exitMask=function(){0!==this._maskStack.length&&(this._maskStack.pop(),0===this._maskStack.length?this.stage=0:this.stage=3)},e.getWriteMask=function(){return 1<<this._maskStack.length-1},e.getExitWriteMask=function(){return 1<<this._maskStack.length},e.getStencilRef=function(){for(var t=0,e=0;e<this._maskStack.length;++e)t+=1<<e;return t},e.getMaskStackSize=function(){return this._maskStack.length},e.reset=function(){this._maskStack.length=0,this.stage=0},e.destroy=function(){this.stencilStateMap.forEach((function(t){t.destroy()})),this.stencilStateMap.clear()},e.getStencilStage=function(t,e){var i=0,n=!1,r=!1,s=1,a=this.stencilStateMap;if(e&&e.passes[0]){var o=e.passes[0].depthStencilState,h=0,u=0;o.depthTest&&(h=1),o.depthWrite&&(u=1),i=h|u<<1|o.depthFunc<<2|t<<6|this._maskStack.length<<9,n=o.depthTest,r=o.depthWrite,s=o.depthFunc,a=this.stencilStateMapWithDepth}else i=t<<16|this._maskStack.length;if(a&&a.has(i))return a.get(i);this.setStateFromStage(t);var l=this._stencilPattern,c=new Cp(n,r,s,l.stencilTest,l.func,l.stencilMask,l.writeMask,l.failOp,l.zFailOp,l.passOp,l.ref,l.stencilTest,l.func,l.stencilMask,l.writeMask,l.failOp,l.zFailOp,l.passOp,l.ref);return a.set(i,c),c},e.getStencilHash=function(t){return t<<8|this._maskStack.length},e.setStateFromStage=function(t){var e=this._stencilPattern;0===t?(e.stencilTest=!1,e.func=7,e.failOp=1,e.stencilMask=e.writeMask=65535,e.ref=1):(e.stencilTest=!0,3===t?(e.func=2,e.failOp=1,e.stencilMask=e.ref=this.getStencilRef(),e.writeMask=this.getWriteMask()):1===t?(e.func=0,e.failOp=0,e.writeMask=e.stencilMask=e.ref=this.getWriteMask()):5===t||2===t?(e.func=0,e.failOp=2,e.writeMask=e.stencilMask=e.ref=this.getWriteMask()):6===t&&(e.func=0,e.failOp=0,e.writeMask=e.stencilMask=e.ref=this.getWriteMask()))},n(t,[{key:"stage",get:function(){return this._stage},set:function(t){this._stage=t}},{key:"pattern",get:function(){return this._stencilPattern}}]),t}());qH.sharedManager=null,qH.sharedManager=new qH;var XH=["mouse-down","mouse-move","mouse-up","mouse-wheel","mouse-leave-window","mouse-enter-window"],YH=["touch-start","touch-move","touch-end","touch-cancel"],JH=function(){function t(){this.priority=1,this._isListDirty=!1,this._inDispatchCount=0,this._pointerEventProcessorList=[],this._processorListToAdd=[],this._processorListToRemove=[],wM._registerEventDispatcher(this);var t=hv.callbacksInvoker;t.on(0,this.addPointerEventProcessor,this),t.on(1,this.removePointerEventProcessor,this),t.on(2,this._markListDirty,this)}var e=t.prototype;return e.onThrowException=function(){this._inDispatchCount=0},e.dispatchEvent=function(t){var e=t.type;return YH.includes(e)?this.dispatchEventTouch(t):!XH.includes(e)||this.dispatchEventMouse(t)},e.addPointerEventProcessor=function(t){0===this._inDispatchCount?this._pointerEventProcessorList.includes(t)||(this._pointerEventProcessorList.push(t),this._isListDirty=!0):this._processorListToAdd.includes(t)||this._processorListToAdd.push(t),Se(this._processorListToRemove,t)},e.removePointerEventProcessor=function(t){0===this._inDispatchCount?(Se(this._pointerEventProcessorList,t),this._isListDirty=!0):this._processorListToRemove.includes(t)||this._processorListToRemove.push(t),Se(this._processorListToAdd,t)},e.dispatchEventMouse=function(t){this._inDispatchCount++,this._sortPointerEventProcessorList();for(var e=this._pointerEventProcessorList,i=e.length,n=!0,r=0;r<i;++r){var s=e[r];if(s.isEnabled&&s.shouldHandleEventMouse&&s._handleEventMouse(t)){if(n=!1,!t.preventSwallow)break;t.preventSwallow=!1}}return--this._inDispatchCount<=0&&this._updatePointerEventProcessorList(),n},e.dispatchEventTouch=function(t){this._inDispatchCount++,this._sortPointerEventProcessorList();for(var e=this._pointerEventProcessorList,i=e.length,n=t.touch,r=!0,s=0;s<i;++s){var a=e[s];if(a.isEnabled&&a.shouldHandleEventTouch)if("touch-start"===t.type){if(a._handleEventTouch(t)){if(a.isEnabled)a.claimedTouchIdList.push(n.getID());else{var o=new Yy([t.touch],!0,"touch-cancel");o.touch=t.touch,a.dispatchEvent(o),a.claimedTouchIdList.length=0}if(r=!1,!t.preventSwallow)break;t.preventSwallow=!1}}else if(a.claimedTouchIdList.length>0){var h=a.claimedTouchIdList.indexOf(n.getID());if(-1!==h){if(a._handleEventTouch(t),"touch-end"!==t.type&&"touch-cancel"!==t.type||(ve(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;r<n;++r){var s=i[r],a=s.claimedTouchIdList.indexOf(e);-1!==a&&ve(s.claimedTouchIdList,a)}},e._updatePointerEventProcessorList=function(){for(var t=this._processorListToAdd,e=t.length,i=0;i<e;++i)this.addPointerEventProcessor(t[i]);t.length=0;for(var n=this._processorListToRemove,r=n.length,s=0;s<r;++s)this.removePointerEventProcessor(n[s]);n.length=0},e._sortPointerEventProcessorList=function(){if(this._isListDirty){for(var t=this._pointerEventProcessorList,e=t.length,i=0;i<e;++i){var n=t[i],r=n.node;if(r._uiProps){var s=r._getUITransformComp();n.cachedCameraPriority=s.cameraPriority}}t.sort(this._sortByPriority),this._isListDirty=!1}},e._sortByPriority=function(t,e){var i=t.node,n=e.node;if(!(e&&n&&n.activeInHierarchy&&n._getUITransformComp()))return-1;if(!(t&&i&&i.activeInHierarchy&&i._getUITransformComp()))return 1;if(t.cachedCameraPriority!==e.cachedCameraPriority)return e.cachedCameraPriority-t.cachedCameraPriority;for(var r=i,s=n,a=!1;(null==(o=r.parent)?void 0:o.uuid)!==(null==(h=s.parent)?void 0:h.uuid);){var o,h,u,l,c,f;r=null===(null==(u=r)||null==(l=u.parent)?void 0:l.parent)?(a=!0)&&n:r&&r.parent,s=null===(null==(c=s)||null==(f=c.parent)?void 0:f.parent)?(a=!0)&&i:s&&s.parent}if(r.uuid===s.uuid){if(r.uuid===n.uuid)return-1;if(r.uuid===i.uuid)return 1}var _=r?r.siblingIndex:0,d=s?s.siblingIndex:0;return a?_-d:d-_},e._markListDirty=function(){this._isListDirty=!0},t}();new JH;var KH=new Ud(null),QH=new Kr,ZH=t("x",function(){function t(t){var e=this;this._screens=[],this._staticVBBuffer=null,this._bufferAccessors=new Map,this._currBID=-1,this._indexStart=0,this._emptyMaterial=new GT,this._currRenderData=null,this._currMaterial=this._emptyMaterial,this._currTexture=null,this._currSampler=null,this._currStaticRoot=null,this._currComponent=null,this._currTransform=null,this._currTextureHash=0,this._currSamplerHash=0,this._currLayer=0,this._currDepthStencilStateStage=null,this._currIsStatic=!1,this._currHash=0,this._currIsMiddleware=!1,this._middlewareEnableBatch=!1,this._middlewareBuffer=null,this._middlewareIndexStart=0,this._middlewareIndexCount=0,this._pOpacity=1,this._opacityDirty=0,this._descriptorSetCache=new tW,this._meshDataArray=[],this._maskClearModel=null,this._maskClearMtl=null,this._maskModelMesh=null,this._root=t,this.device=t.device,this._batches=new lo(64),this._drawBatchPool=new ho((function(){return new $V}),128,(function(t){return t.destroy(e)}))}var e=t.prototype;return e.initialize=function(){return!0},e.destroy=function(){for(var t=0;t<this._batches.length;t++)this._batches.array[t]&&this._batches.array[t].destroy(this);this._batches.destroy();for(var e,i=p(this._bufferAccessors.values());!(e=i()).done;)e.value.destroy();this._bufferAccessors.clear(),this._drawBatchPool&&this._drawBatchPool.destroy(),this._descriptorSetCache.destroy(),qH.sharedManager.destroy(),this._maskClearModel&&this._maskModelMesh&&(A.director.root.destroyModel(this._maskClearModel),this._maskModelMesh.destroy()),this._maskClearMtl&&this._maskClearMtl.destroy()},e.syncRootNodesToNative=function(){},e.addScreen=function(t){this._screens.push(t),this._screens.sort(this._screenSort)},e.removeScreen=function(t){var e=this._screens.indexOf(t);-1!==e&&this._screens.splice(e,1)},e.sortScreens=function(){this._screens.sort(this._screenSort)},e.getFirstRenderCamera=function(t){if(t.scene&&t.scene.renderScene)for(var e=t.scene.renderScene.cameras,i=0;i<e.length;i++){var n=e[i];if(n.visibility&t.layer)return n}return null},e.update=function(){for(var t=this._screens,e=0,i=0;i<t.length;++i){var n=t[i],r=n._getRenderScene();if(n.enabledInHierarchy&&r){this._opacityDirty=0,this._pOpacity=1,this.walk(n.node),this.autoMergeBatches(this._currComponent),this.resetRenderStates();var s=0;if(this._batches.length>e)for(;e<this._batches.length;++e){var a=this._batches.array[e];if(a.model)for(var o=a.model.subModels,h=0;h<o.length;h++)o[h].priority=s++;else a.descriptorSet=this._descriptorSetCache.getDescriptorSet(a);r.addBatch(a)}}}},e.uploadBuffers=function(){if(this._batches.length>0){for(var t=this._meshDataArray.length,e=0;e<t;e++)this._meshDataArray[e].uploadBuffers();for(var i,n=p(this._bufferAccessors.values());!(i=n()).done;){var r=i.value;r.uploadBuffers(),r.reset()}this._descriptorSetCache.update()}},e.reset=function(){for(var t=0;t<this._batches.length;++t){var e=this._batches.array[t];e.isStatic||(e.clear(),this._drawBatchPool.free(e))}for(var i,n=p(this._bufferAccessors.values());!(i=n()).done;)i.value.reset();for(var r=this._meshDataArray.length,s=0;s<r;s++)this._meshDataArray[s].freeIAPool();this._meshDataArray.length=0,this._staticVBBuffer=null,this._currBID=-1,this._indexStart=0,this._currHash=0,this._currLayer=0,this._currRenderData=null,this._currMaterial=this._emptyMaterial,this._currTexture=null,this._currSampler=null,this._currComponent=null,this._currTransform=null,this._batches.clear(),qH.sharedManager.reset()},e.switchBufferAccessor=function(t){void 0===t&&(t=IF);var e=t===IF?36:kF(t);if(!this._staticVBBuffer||this._staticVBBuffer.vertexFormatBytes!==e){var i=this._bufferAccessors.get(e);i||(i=new NF(this.device,t),this._bufferAccessors.set(e,i)),this._staticVBBuffer=i,this._currBID=-1}return this._staticVBBuffer},e.registerBufferAccessor=function(t,e){this._bufferAccessors.set(t,e)},e.updateBuffer=function(t,e){var i=this.switchBufferAccessor(t);this._currBID!==e&&(this._currBID=e,this._indexStart=i.getMeshBuffer(e).indexOffset)},e.commitComp=function(t,e,i,n,r){var s,a=0,o=-1;if(e&&e.chunk){if(!e.isValid())return;a=e.dataHash,s=e.material,o=e.chunk.bufferId}2===t.stencilStage||6===t.stencilStage?this._insertMaskBatch(t):t.stencilStage=qH.sharedManager.stage;var h=t.stencilStage;this._currHash===a&&0!==a&&this._currMaterial===s&&this._currDepthStencilStateStage===h||(this.autoMergeBatches(this._currComponent),e&&!e._isMeshBuffer&&this.updateBuffer(e.vertexFormat,o),this._currRenderData=e,this._currHash=e?e.dataHash:0,this._currComponent=t,this._currTransform=r,this._currMaterial=t.getRenderMaterial(0),this._currDepthStencilStateStage=h,this._currLayer=t.node.layer,i?(this._currTexture=i.getGFXTexture(),this._currSampler=i.getGFXSampler(),this._currTextureHash=i.getHash(),this._currSamplerHash=this._currSampler.hash):(this._currTexture=null,this._currSampler=null,this._currTextureHash=0,this._currSamplerHash=0)),n.fillBuffers&&n.fillBuffers(t,this)},e.commitIA=function(t,e,i,n,r){this._currMaterial!==this._emptyMaterial&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates());var s=null,a=0;t&&(t.stencilStage=qH.sharedManager.stage,s=null!==t.customMaterial?qH.sharedManager.getStencilStage(t.stencilStage,n):qH.sharedManager.getStencilStage(t.stencilStage),a=qH.sharedManager.getStencilHash(t.stencilStage));var o=this._currStaticRoot?this._currStaticRoot._requireDrawBatch():this._drawBatchPool.alloc();o.visFlags=t.node.layer,o.inputAssembler=e,o.useLocalData=r||null,i&&(o.texture=i.getGFXTexture(),o.sampler=i.getGFXSampler(),o.textureHash=i.getHash(),o.samplerHash=o.sampler.hash),o.fillPasses(n||null,s,a,null),this._batches.push(o)},e.commitMiddleware=function(t,e,i,n,r,s,a){var o=r.getGFXTexture();a&&this._middlewareEnableBatch&&this._middlewareBuffer===e&&this._currTexture===o&&this._currMaterial.hash===s.hash&&this._middlewareIndexStart+this._middlewareIndexCount===i&&this._currLayer===t.node.layer?this._middlewareIndexCount+=n:(this.autoMergeBatches(this._currComponent),this.resetRenderStates(),this._currComponent=t,this._currTexture=o,this._currSampler=r.getGFXSampler(),this._currTextureHash=r.getHash(),this._currLayer=t.node.layer,this._currSamplerHash=this._currSampler.hash,this._currHash=0,this._currTransform=a?null:t.node,this._middlewareEnableBatch=a,this._middlewareBuffer=e,this._currMaterial=s,this._middlewareIndexStart=i,this._middlewareIndexCount=n),this._currIsMiddleware=!0},e.commitModel=function(t,e,i){this._currMaterial!==this._emptyMaterial&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates());var n=null,r=0;i&&(2===t.stencilStage||6===t.stencilStage?this._insertMaskBatch(t):t.stencilStage=qH.sharedManager.stage,n=qH.sharedManager.getStencilStage(t.stencilStage,i),r=qH.sharedManager.getStencilHash(t.stencilStage));var s=A.director.getTotalFrames();e&&(e.updateTransform(s),e.updateUBOs(s));for(var a=0;a<e.subModels.length;a++){var o=this._drawBatchPool.alloc(),h=e.subModels[a];o.visFlags=t.node.layer,o.model=e,o.texture=null,o.sampler=null,o.useLocalData=null,n||(n=null),o.fillPasses(i,n,r,h.patches),o.inputAssembler=h.inputAssembler,o.model.visFlags=o.visFlags,o.descriptorSet=h.descriptorSet,this._batches.push(o)}},e.setupStaticBatch=function(t,e){this.finishMergeBatches(),this._staticVBBuffer=e,this.currStaticRoot=t},e.endStaticBatch=function(){this.finishMergeBatches(),this.currStaticRoot=null,this._staticVBBuffer=null,this.switchBufferAccessor()},e.commitStaticBatch=function(t){this._batches.concat(t.drawBatchList),this.finishMergeBatches()},e.autoMergeBatches=function(t){if(this._currIsMiddleware)this.mergeBatchesForMiddleware(t);else{var e=this._currMaterial;if(e){var i,n=this._currRenderData,r=this._staticVBBuffer;if(n&&n._isMeshBuffer)i=n.requestIA(this.device),-1===this._meshDataArray.indexOf(n)&&this._meshDataArray.push(n);else if(r){var s=this._currBID,a=r.getMeshBuffer(s);if(!a)return;var o=a.indexOffset-this._indexStart;if(o<=0)return;this._indexStart,a.indexOffset,a.setDirty(),(i=a.requireFreeIA(this.device)).firstIndex=this._indexStart,i.indexCount=o,this._indexStart=a.indexOffset}if(this._currBID=-1,i&&this._currTexture){var h=null,u=0;t&&(h=null!==t.customMaterial?qH.sharedManager.getStencilStage(t.stencilStage,e):qH.sharedManager.getStencilStage(t.stencilStage),u=qH.sharedManager.getStencilHash(t.stencilStage));var l=this._currStaticRoot?this._currStaticRoot._requireDrawBatch():this._drawBatchPool.alloc();l.visFlags=this._currLayer,l.texture=this._currTexture,l.sampler=this._currSampler,l.inputAssembler=i,l.useLocalData=this._currTransform,l.textureHash=this._currTextureHash,l.samplerHash=this._currSamplerHash,l.fillPasses(e,h,u,null),this._batches.push(l)}}}},e.mergeBatchesForMiddleware=function(t){var e,i;t.stencilStage=qH.sharedManager.stage,i=null!==t.customMaterial?qH.sharedManager.getStencilStage(t.stencilStage,this._currMaterial):qH.sharedManager.getStencilStage(t.stencilStage),e=qH.sharedManager.getStencilHash(t.stencilStage);var n=this._currStaticRoot?this._currStaticRoot._requireDrawBatch():this._drawBatchPool.alloc();n.visFlags=t.node.layer;var r=this._middlewareBuffer.requireFreeIA(this.device);r.firstIndex=this._middlewareIndexStart,r.indexCount=this._middlewareIndexCount,n.inputAssembler=r,n.useLocalData=this._currTransform,n.texture=this._currTexture,n.sampler=this._currSampler,n.textureHash=this._currTextureHash,n.samplerHash=this._currSamplerHash,n.fillPasses(this._currMaterial||null,i,e,null),this._batches.push(n),this._currIsMiddleware=!1,this._middlewareBuffer=null},e.forceMergeBatches=function(t,e,i){this._currMaterial=t,e?(this._currTexture=e.getGFXTexture(),this._currSampler=e.getGFXSampler(),this._currTextureHash=e.getHash(),this._currSamplerHash=this._currSampler.hash):(this._currTexture=this._currSampler=null,this._currTextureHash=this._currSamplerHash=0),this._currLayer=i.node.layer,this.autoMergeBatches(i)},e.resetRenderStates=function(){this._currMaterial=this._emptyMaterial,this._currRenderData=null,this._currTexture=null,this._currComponent=null,this._currTransform=null,this._currTextureHash=0,this._currSamplerHash=0,this._currLayer=0},e.finishMergeBatches=function(){this.autoMergeBatches(),this.resetRenderStates()},e.flushMaterial=function(t){this._currMaterial=t},e.walk=function(t,e){if(void 0===e&&(e=0),t.activeInHierarchy){var i=t.children,n=t._uiProps,r=n.uiComp,s=this._pOpacity,a=s,o=r&&r.color?r.color.a/255:1;if(this._pOpacity=a*=o*n.localOpacity,n.setOpacity(a),!Zi(a,0,Ki)){if(n.colorDirty&&this._opacityDirty++,r&&r.enabledInHierarchy&&r.fillBuffers(this),this._opacityDirty&&r&&!r.useVertexOpacity&&r.renderData&&r.renderData.vertexCount>0){Xp(r.renderData,a);var h=r.renderData.getMeshBuffer();h&&h.setDirty()}if(i.length>0&&!t._static)for(var u=0;u<i.length;++u){var l=i[u];this.walk(l,e)}n.colorDirty&&(this._opacityDirty--,n.colorDirty=!1)}this._pOpacity=s,r&&r.enabledInHierarchy&&(r.postUpdateAssembler(this),(2===r.stencilStage||6===r.stencilStage)&&qH.sharedManager.getMaskStackSize()>0&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates(),qH.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=mT.get("default-clear-stencil"),this._maskClearModel=A.director.root.createModel(KM);var t=kF(DF),e=Wp.gfxDevice,i=e.createBuffer(new ud(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 ud(6,1,12,2)),s=new Uint16Array([0,1,2,2,1,3]);r.update(s),this._maskModelMesh=new sO([i],DF,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=qH.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=A.director.getTotalFrames();a&&(a.updateTransform(o),a.updateUBOs(o));for(var h=0;h<a.subModels.length;h++){var u=this._drawBatchPool.alloc(),l=a.subModels[h];u.visFlags=t.node.layer,u.model=a,u.texture=null,u.sampler=null,u.useLocalData=null,n||(n=null),u.fillPasses(s,n,r,l.patches),u.inputAssembler=l.inputAssembler,u.model.visFlags=u.visFlags,u.descriptorSet=l.descriptorSet,this._batches.push(u)}e.enableMask()},e.syncMeshBuffersToNative=function(){},n(t,[{key:"nativeObj",get:function(){return this._nativeObj}},{key:"currBufferAccessor",get:function(){return this._staticVBBuffer||(this._staticVBBuffer=this.switchBufferAccessor()),this._staticVBBuffer}},{key:"batches",get:function(){return this._batches}},{key:"currStaticRoot",set:function(t){this._currStaticRoot=t}},{key:"currIsStatic",set:function(t){this._currIsStatic=t}}]),t}()),$H=function(){var t=e.prototype;function e(){this._descriptorSet=null,this._transform=null,this._textureHash=0,this._samplerHash=0,this._localBuffer=null,this._transformUpdate=!0;var t=Wp.gfxDevice;this._localData=new Float32Array(56),this._localBuffer=t.createBuffer(new ud(18,3,224,224))}return t.getDescriptorSet=function(){return this._descriptorSet},t.initialize=function(t){var e=Wp.gfxDevice;this._transform=t.useLocalData,this._textureHash=t.textureHash,this._samplerHash=t.samplerHash,KH.layout=t.passes[0].localSetLayout,this._descriptorSet=e.createDescriptorSet(KH),this._descriptorSet.bindBuffer(0,this._localBuffer),this._descriptorSet.bindTexture(12,t.texture),this._descriptorSet.bindSampler(12,t.sampler),this._descriptorSet.update(),this._transformUpdate=!0},t.updateTransform=function(t){t!==this._transform&&(this._transform=t,this._transformUpdate=!0,this.uploadLocalData())},t.equals=function(t,e,i){return this._transform===t&&this._textureHash===e&&this._samplerHash===i},t.reset=function(){this._transform=null,this._textureHash=0,this._samplerHash=0},t.destroy=function(){this._localBuffer&&(this._localBuffer.destroy(),this._localBuffer=null),this._descriptorSet&&(this._descriptorSet.destroy(),this._descriptorSet=null),this._localData=null},t.isValid=function(){return this._transform&&this._transform.isValid},t.uploadLocalData=function(){var t=this._transform;if((t.hasChangedFlags||t.isTransformDirty())&&(t.updateWorldTransform(),this._transformUpdate=!0),this._transformUpdate){var e=t.worldMatrix;Kr.toArray(this._localData,e,0),Kr.invert(QH,e),Kr.transpose(QH,QH);var i=Kr.determinant(QH),n=1/Math.sqrt(i);Kr.multiplyScalar(QH,QH,n),Kr.toArray(this._localData,QH,16),this._localBuffer.update(this._localData),this._transformUpdate=!1}},e}(),tW=function(){function t(){this._descriptorSetCache=new Map,this._dsCacheHashByTexture=new Map,this._localDescriptorSetCache=[],this._localCachePool=new ho((function(){return new $H}),16,(function(t){return t.destroy()}))}var e=t.prototype;return e.getDescriptorSet=function(t){if(A.director.root,t.useLocalData){for(var e=this._localDescriptorSetCache,i=0,n=e.length;i<n;i++){var r=e[i];if(r.equals(t.useLocalData,t.textureHash,t.samplerHash))return r.getDescriptorSet()}var s=this._localCachePool.alloc();return s.initialize(t),this._localDescriptorSetCache.push(s),s.getDescriptorSet()}var a=t.textureHash^t.samplerHash;if(this._descriptorSetCache.has(a))return this._descriptorSetCache.get(a);KH.layout=t.passes[0].localSetLayout;var o=Wp.gfxDevice.createDescriptorSet(KH);return o.bindTexture(12,t.texture),o.bindSampler(12,t.sampler),o.update(),this._descriptorSetCache.set(a,o),this._dsCacheHashByTexture.set(t.textureHash,a),o},e.update=function(){var t=this._localDescriptorSetCache,e=t.length;if(0!==e){for(var i=[],n=0;n<e;n++){var r=t[n];if(r.isValid())r.uploadLocalData();else{r.reset();var s=t.indexOf(r);i.push(s)}}for(var a=i.length-1;a>=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<e;i++){var n=t[i];this._localCachePool.free(n)}this._localDescriptorSetCache.length=0},e.releaseDescriptorSetCache=function(t){var e=this._dsCacheHashByTexture.get(t);e&&this._descriptorSetCache.has(e)&&(this._descriptorSetCache.get(e).destroy(),this._descriptorSetCache.delete(e),this._dsCacheHashByTexture.delete(t))},e.destroy=function(){for(var t,e=p(this._descriptorSetCache.values());!(t=e()).done;)t.value.destroy();this._descriptorSetCache.clear(),this._dsCacheHashByTexture.clear(),this._localDescriptorSetCache.length=0,this._localCachePool.destroy()},t}();A.internal.Batcher2D=ZH,t("y",function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}($V)),gt(RF.prototype,"MeshBuffer",["byteStart","vertexStart","indicesStart","request"].map((function(t){return{name:t,suggest:"please use meshBuffer.accessor."+t+" instead"}}))),pt(RF.prototype,"MeshBuffer",[{name:"indicesOffset",newName:"indexOffset"}]),mt(RF.prototype,"MeshBuffer",[{name:"vertexBuffers"},{name:"indexBuffer"}]),pt(ZH.prototype,"Batcher2D",[{name:"currBufferBatch",newName:"currBufferAccessor"},{name:"acquireBufferBatch",newName:"switchBufferAccessor"}]),mt(eL.prototype,"MeshRenderData",[{name:"formatByte"},{name:"byteStart"},{name:"byteCount"}]),pt(eL.prototype,"MeshRenderData",[{name:"indicesStart",newName:"indexStart"}]),t("Q",function(t){function e(e){var i;return i=t.call(this,e)||this,at(9006),i}return s(e,t),e}(eL)),A.UI={MeshBuffer:RF,spriteAssembler:jH,labelAssembler:tH,RenderData:tL,MeshRenderData:eL},XO.on(qO.EVENT_POST_SUBSYSTEM_INIT,(function(){oW.init()}));var eW,iW,nW,rW,sW,aW,oW=t("a6",function(){function t(){}return t.getSortingPriority=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),(t+32768<<16|e+32768)>>>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<e;r++)if(n=i.next().value,this.nameMap.get(n)===t)return n;return ht(2106),0},t.isLayerValid=function(t){return!!this.indexMap.has(t)||(ht(2105),!1)},t.getBuiltinLayers=function(){return[{id:0,name:"default",value:0}]},t.init=function(){var e=ze.querySettings("engine","sortingLayers");e&&0!==e.length||(e=this.getBuiltinLayers()),t.resetState();for(var i=0;i<e.length;i++){var n=e[i];t.setLayer(n.id,n.name,n.value),t.Enum[n.name]=n.id}Ee.update(t.Enum),Ee.sortList(t.Enum,(function(e,i){return t.getLayerIndex(e.value)-t.getLayerIndex(i.value)}))},t.setLayer=function(t,e,i){this.nameMap.set(t,e),this.indexMap.set(t,i)},t.resetState=function(){for(var e=Object.keys(t.Enum),i=0;i<e.length;i++)delete t.Enum[t.Enum[e[i]]],delete t.Enum[e[i]];t.indexMap.clear(),t.nameMap.clear()},t}());oW.nameMap=new Map,oW.indexMap=new Map,oW.Enum=Ee({default:0}),t("a7",(eW=Kh("cc.Sorting"),iW=Ou(oW.Enum),eW(nW=$h((v((rW=function(t){function e(){var e;return(e=t.call(this)||this)._sortingLayer=sW&&sW(),e._sortingOrder=aW&&aW(),e._modelRenderer=null,e}s(e,t);var i=e.prototype;return i.__preload=function(){this._modelRenderer=this.getComponent("cc.ModelRenderer"),this._modelRenderer||at(16301,this.node.name),this._updateSortingPriority()},i._updateSortingPriority=function(){var t=oW.getLayerIndex(this._sortingLayer),e=oW.getSortingPriority(t,this._sortingOrder);this._modelRenderer&&this._modelRenderer.isValid&&(this._modelRenderer.priority=e)},n(e,[{key:"sortingLayer",get:function(){return this._sortingLayer},set:function(t){t!==this._sortingLayer&&oW.isLayerValid(t)&&(this._sortingLayer=t,this._updateSortingPriority())}},{key:"sortingOrder",get:function(){return this._sortingOrder},set:function(t){t!==this._sortingOrder&&(this._sortingOrder=$i(t,-32768,32767),this._updateSortingPriority())}}]),e}(yg)).prototype,"sortingLayer",[iW],Object.getOwnPropertyDescriptor(rW.prototype,"sortingLayer"),rW.prototype),sW=zh(rW.prototype,"_sortingLayer",[uu],(function(){return oW.Enum.default})),aW=zh(rW.prototype,"_sortingOrder",[uu],(function(){return 0})),nW=rW))||nW)||nW));var hW,uW,lW,cW,fW,_W,dW,pW,mW,gW,yW,vW,bW,SW,wW,xW,TW,AW,CW,DW,BW,IW,MW,PW,EW,OW,kW,RW,FW,LW,VW,NW,zW,UW,GW,HW,WW,jW,qW,XW,YW,JW,KW=function(t){function e(){var e;return(e=t.call(this)||this)._morphRenderingInstance=null,e._usedMaterials=new Set,e}s(e,t);var i=e.prototype;return i.getMacroPatches=function(e){var i=t.prototype.getMacroPatches.call(this,e);if(this._morphRenderingInstance){var n=this._morphRenderingInstance.requiredPatches(e);if(n)return n.concat(null!=i?i:[])}return i},i.initSubModel=function(e,i,n){return t.prototype.initSubModel.call(this,e,i,this._launderMaterial(n))},i.destroy=function(){t.prototype.destroy.call(this),this._morphRenderingInstance=null},i.setSubModelMaterial=function(e,i){return t.prototype.setSubModelMaterial.call(this,e,this._launderMaterial(i))},i.setMorphRendering=function(t){this._morphRenderingInstance=t},i._updateLocalDescriptors=function(e,i){t.prototype._updateLocalDescriptors.call(this,e,i),this._morphRenderingInstance&&this._morphRenderingInstance.adaptPipelineState(e,i)},i._launderMaterial=function(t){return t},e}(KM),QW=t("aq",{NONE:0,BAKED_CUBEMAP:1,PLANAR_REFLECTION:2,BLEND_PROBES:3,BLEND_PROBES_AND_SKYBOX:4}),ZW=Kh,$W=Zh,tj=Ou,ej=lu,ij=uu,nj=gT("specular-pass");function rj(t){var e=t.passes,i=A.rendering;qS()&&(nj=i.getPhaseID(i.getPassID("specular-pass"),"default"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===nj||qS()&&e[n].phaseID===nj)return n;return-1}var sj,aj,oj,hj,uj,lj,cj,fj,_j=Ee({OFF:0,ON:1}),dj=Ee({OFF:0,ON:1}),pj=(hW=ZW("cc.ModelBakeSettings"),uW=ej("_recieveShadow"),lW=tj(li),cW=tj(fi),fW=tj(fi),_W=tj(Ee(QW)),dW=tj(fi),hW((DW=function(t){function e(){var e;return(e=t.call(this)||this).texture=gW&&gW(),e.uvParam=yW&&yW(),e._bakeable=vW&&vW(),e._castShadow=bW&&bW(),e._receiveShadow=SW&&SW(),e._lightmapSize=wW&&wW(),e._useLightProbe=xW&&xW(),e._bakeToLightProbe=TW&&TW(),e._reflectionProbeType=AW&&AW(),e._bakeToReflectionProbe=CW&&CW(),e.probeCubemap=null,e.probeBlendCubemap=null,e.probePlanarmap=null,e}return s(e,t),n(e,[{key:"bakeable",get:function(){return this._bakeable},set:function(t){this._bakeable=t}},{key:"castShadow",get:function(){return this._castShadow},set:function(t){this._castShadow=t}},{key:"receiveShadow",get:function(){return this._receiveShadow},set:function(t){this._receiveShadow=t}},{key:"lightmapSize",get:function(){return this._lightmapSize},set:function(t){this._lightmapSize=t}},{key:"useLightProbe",get:function(){return this._useLightProbe},set:function(t){this._useLightProbe=t,this.emit("use_light_probe_changed")}},{key:"bakeToLightProbe",get:function(){return this._bakeToLightProbe},set:function(t){this._bakeToLightProbe=t}},{key:"reflectionProbe",get:function(){return this._reflectionProbeType},set:function(t){this._reflectionProbeType=t,this.emit("reflection_probe_changed")}},{key:"bakeToReflectionProbe",get:function(){return this._bakeToReflectionProbe},set:function(t){this._bakeToReflectionProbe=t,this.emit("bake_to_reflection_probe_changed")}}]),e}(Io),DW.USE_LIGHT_PROBE_CHANGED="use_light_probe_changed",DW.REFLECTION_PROBE_CHANGED="reflection_probe_changed",DW.BAKE_TO_REFLECTION_PROBE_CHANGED="bake_to_reflection_probe_changed",gW=zh((mW=DW).prototype,"texture",[ij],(function(){return null})),yW=zh(mW.prototype,"uvParam",[ij],(function(){return new Vn})),vW=zh(mW.prototype,"_bakeable",[ij],(function(){return!1})),bW=zh(mW.prototype,"_castShadow",[ij],(function(){return!1})),SW=zh(mW.prototype,"_receiveShadow",[uW],(function(){return!1})),wW=zh(mW.prototype,"_lightmapSize",[ij],(function(){return 64})),xW=zh(mW.prototype,"_useLightProbe",[ij],(function(){return!1})),TW=zh(mW.prototype,"_bakeToLightProbe",[ij],(function(){return!0})),AW=zh(mW.prototype,"_reflectionProbeType",[ij],(function(){return 0})),CW=zh(mW.prototype,"_bakeToReflectionProbe",[ij],(function(){return!0})),v(mW.prototype,"lightmapSize",[lW],Object.getOwnPropertyDescriptor(mW.prototype,"lightmapSize"),mW.prototype),v(mW.prototype,"useLightProbe",[cW],Object.getOwnPropertyDescriptor(mW.prototype,"useLightProbe"),mW.prototype),v(mW.prototype,"bakeToLightProbe",[fW],Object.getOwnPropertyDescriptor(mW.prototype,"bakeToLightProbe"),mW.prototype),v(mW.prototype,"reflectionProbe",[_W],Object.getOwnPropertyDescriptor(mW.prototype,"reflectionProbe"),mW.prototype),v(mW.prototype,"bakeToReflectionProbe",[dW],Object.getOwnPropertyDescriptor(mW.prototype,"bakeToReflectionProbe"),mW.prototype),pW=mW))||pW),mj=t("ac",(BW=ZW("cc.MeshRenderer"),IW=$W(100),MW=tj(ci),PW=tj(ci),EW=tj(_j),OW=tj(dj),kW=tj(Pk),RW=tj(fi),BW(FW=IW((JW=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this).bakeSettings=VW&&VW(),e._mesh=NW&&NW(),e._shadowCastingMode=zW&&zW(),e._shadowReceivingMode=UW&&UW(),e._shadowBias=GW&&GW(),e._shadowNormalBias=HW&&HW(),e._reflectionProbeId=WW&&WW(),e._reflectionProbeBlendId=jW&&jW(),e._reflectionProbeBlendWeight=qW&&qW(),e._enabledGlobalStandardSkinObject=XW&&XW(),e._reflectionProbeDataMap=null,e._subMeshShapesWeights=[],e._modelType=KM,e._model=null,e._morphInstance=null,e._enableMorph=YW&&YW(),ze.querySettings("rendering","highQualityMode")&&(e._shadowCastingMode=_j.ON,e.bakeSettings.castShadow=!0,e.bakeSettings.receiveShadow=!0),e}return e.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)},e.clearGlobalStandardSkinObjectFlag=function(){this._enabledGlobalStandardSkinObject=!1},e.onLoad=function(){this._mesh&&this._mesh.initialize(),this._validateShapeWeights()||this._initSubMeshShapesWeights(),this._watchMorphInMesh(),this._updateModels(),this._updateCastShadow(),this._updateReceiveShadow(),this._updateShadowBias(),this._updateShadowNormalBias(),this._updateUseLightProbe(),this._updateBakeToReflectionProbe(),this._updateUseReflectionProbe(),this._updateReceiveDirLight(),this._updateStandardSkin()},e.onRestore=function(){this._updateModels(),this.enabledInHierarchy&&this._attachToScene(),this._updateCastShadow(),this._updateReceiveShadow(),this._updateShadowBias(),this._updateShadowNormalBias(),this._updateUseLightProbe(),this._updateBakeToReflectionProbe(),this._updateUseReflectionProbe(),this._updateReceiveDirLight(),this._updateStandardSkin()},e.onEnable=function(){t.prototype.onEnable.call(this),this.node.on("mobility-changed",this.onMobilityChanged,this),this.node.on("light-probe-baking-changed",this.onLightProbeBakingChanged,this),this.bakeSettings.on("use_light_probe_changed",this.onUseLightProbeChanged,this),this.bakeSettings.on("reflection_probe_changed",this.onReflectionProbeChanged,this),this.bakeSettings.on("bake_to_reflection_probe_changed",this.onBakeToReflectionProbeChanged,this),this._model||this._updateModels(),this._model.onGlobalPipelineStateChanged(),this._updateCastShadow(),this._updateReceiveShadow(),this._updateShadowBias(),this._updateShadowNormalBias(),this._updateBakeToReflectionProbe(),this._updateUseReflectionProbe(),this._onUpdateLocalShadowBiasAndProbeId(),this._updateUseLightProbe(),this._updateReceiveDirLight(),this._onUpdateReflectionProbeDataMap(),this._onUpdateLocalReflectionProbeData(),this._updateStandardSkin(),this._attachToScene()},e.onDisable=function(){this._model&&this._detachFromScene(),this.node.off("mobility-changed",this.onMobilityChanged,this),this.node.off("light-probe-baking-changed",this.onLightProbeBakingChanged,this),this.bakeSettings.off("use_light_probe_changed",this.onUseLightProbeChanged,this),this.bakeSettings.off("reflection_probe_changed",this.onReflectionProbeChanged,this),this.bakeSettings.off("bake_to_reflection_probe_changed",this.onBakeToReflectionProbeChanged,this)},e.onDestroy=function(){this._model&&(A.director.root.destroyModel(this._model),this._model=null,this._models.length=0),this._morphInstance&&this._morphInstance.destroy()},e.onGeometryChanged=function(){if(this._model&&this._mesh){var t=this._mesh.struct;this._model.createBoundingShape(t.minPosition,t.maxPosition),this._model.updateWorldBound(),this._model.onGeometryChanged()}},e.getWeight=function(t,e){this._subMeshShapesWeights.length;var i=this._subMeshShapesWeights[t];return i.length,i[e]},e.setWeights=function(t,e){var i=this._subMeshShapesWeights;e>=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;n<i.length;n++)for(var r=i[n].instancedAttributeBlock,s=r.attributes,a=r.views,o=0;o<s.length;o++)if(s[o].name===t){a[o].set(e);break}},e._updateLightmap=function(t,e,i,n,r){this.bakeSettings.texture=t,this.bakeSettings.uvParam.x=e,this.bakeSettings.uvParam.y=i,this.bakeSettings.uvParam.z=n,this.bakeSettings.uvParam.w=r,this._onUpdateLightingmap(),this._updateReceiveDirLight()},e.updateProbeCubemap=function(t){this.bakeSettings.probeCubemap&&this.bakeSettings.probeCubemap===t||(this.bakeSettings.probeCubemap=t,null!==this.model&&this.model.updateReflectionProbeCubemap(this.bakeSettings.probeCubemap))},e.updateProbeBlendCubemap=function(t){this.bakeSettings.probeBlendCubemap&&this.bakeSettings.probeBlendCubemap===t||(this.bakeSettings.probeBlendCubemap=t,null!==this.model&&this.model.updateReflectionProbeBlendCubemap(this.bakeSettings.probeBlendCubemap))},e.updateProbePlanarMap=function(t){this.bakeSettings.probePlanarmap!==t&&(this.bakeSettings.probePlanarmap=t,null!==this.model&&this.model.updateReflectionProbePlanarMap(this.bakeSettings.probePlanarmap))},e.updateReflectionProbeDataMap=function(t){this._reflectionProbeDataMap=t,null!==this.model&&this.model.updateReflectionProbeDataMap(t)},e.updateReflectionProbeId=function(t){this._reflectionProbeId=t,this.model&&(this.model.reflectionProbeId=t),this._onUpdateLocalShadowBiasAndProbeId()},e.updateReflectionProbeBlendId=function(t){this._reflectionProbeBlendId=t,this.model&&(this.model.reflectionProbeBlendId=t),this._onUpdateLocalShadowBiasAndProbeId()},e.updateReflectionProbeBlendWeight=function(t){this._reflectionProbeBlendWeight=t,this.model&&(this.model.reflectionProbeBlendWeight=t),this._onUpdateLocalReflectionProbeData()},e._updateReflectionProbeTexture=function(){if(this.model){var t=this.bakeSettings,e=t.reflectionProbe,i=t.probeBlendCubemap,n=t.probePlanarmap,r=t.probeCubemap;1===e?(this.model.updateReflectionProbeCubemap(r),this.model.updateReflectionProbePlanarMap(null),this.model.updateReflectionProbeBlendCubemap(null)):3===e||4===e?(this.model.updateReflectionProbeCubemap(r),this.model.updateReflectionProbeBlendCubemap(i),this.model.updateReflectionProbePlanarMap(null)):2===e?(this.model.updateReflectionProbePlanarMap(n),this.model.updateReflectionProbeCubemap(null),this.model.updateReflectionProbeBlendCubemap(null)):(this.model.updateReflectionProbeCubemap(null),this.model.updateReflectionProbePlanarMap(null),this.model.updateReflectionProbeBlendCubemap(null))}},e._updateModels=function(){if(this.enabledInHierarchy){var t=this._model;if(t?(t.destroy(),t.initialize(),t.node=t.transform=this.node):this._createModel(),this._model){if(this._mesh){var e=this._mesh.struct;this._model.createBoundingShape(e.minPosition,e.maxPosition),this._model.updateWorldBound()}this._model.initLightingmap(this.bakeSettings.texture,this.bakeSettings.uvParam),this._updateUseLightProbe(),this._updateUseReflectionProbeType(),this._updateModelParams(),this._onUpdateLightingmap(),this._onUpdateLocalShadowBiasAndProbeId(),this._updateUseReflectionProbe(),this._updateReceiveDirLight(),this._onUpdateReflectionProbeDataMap(),this._onUpdateLocalReflectionProbeData()}}},e._updateReceiveDirLight=function(){if(this._model){var t=this.node.scene;if(t&&t.renderScene){var e=t.renderScene.mainLight;if(e){var i=e.visibility;if(e.node)if(e.node.mobility===Uy.Static){var n=this.node.scene.globals,r=n.lightProbeInfo.data,s=!1;this.bakeSettings.texture&&!n.disableLightmap&&(s=!0),r&&r.hasCoefficients()&&this._model.useLightProbe&&(s=!0),this.onUpdateReceiveDirLight(i,s)}else this.onUpdateReceiveDirLight(i)}}}},e._createModel=function(){var t=this._morphInstance&&this._modelType===KM?KW:this._modelType,e=this._model=A.director.root.createModel(t);e.visFlags=this.visibility,e.node=e.transform=this.node,this._models.length=0,this._models.push(e),this._morphInstance&&e instanceof KW&&e.setMorphRendering(this._morphInstance)},e._attachToScene=function(){if(this.node.scene&&this._model){var t=this._getRenderScene();null!==this._model.scene&&this._detachFromScene(),t.addModel(this._model)}},e._detachFromScene=function(){this._model&&this._model.scene&&this._model.scene.removeModel(this._model)},e._updateModelParams=function(){if(this._mesh&&this._model){this.node.hasChangedFlags|=1,this._model.transform.hasChangedFlags|=1,this._model.isDynamicBatching=this._isBatchingEnabled();var t=this._mesh?this._mesh.renderingSubMeshes.length:0,e=this._mesh.renderingSubMeshes;if(e)for(var i=0;i<t;++i){var n=this.getRenderMaterial(i);n&&!n.isValid&&(n=null);var r=e[i];r&&this._model.initSubModel(i,r,n||this._getBuiltinMaterial())}this._model.enabled=!0}},e._onUpdateLightingmap=function(){null!==this.model&&this.model.updateLightingmap(this.bakeSettings.texture,this.bakeSettings.uvParam),this.setInstancedAttribute("a_lightingMapUVParam",[this.bakeSettings.uvParam.x,this.bakeSettings.uvParam.y,this.bakeSettings.uvParam.z,this.bakeSettings.uvParam.w])},e._onUpdateLocalShadowBiasAndProbeId=function(){null!==this.model&&(this.model.updateLocalShadowBias(),this.model.updateReflectionProbeId()),this.setInstancedAttribute("a_localShadowBiasAndProbeId",[this._shadowBias,this._shadowNormalBias,this._reflectionProbeId,this._reflectionProbeBlendId])},e._onUpdateLocalReflectionProbeData=function(){1!==this.bakeSettings.reflectionProbe&&3!==this.bakeSettings.reflectionProbe&&4!==this.bakeSettings.reflectionProbe||(null!==this.model&&this.model.updateReflectionProbeId(),this.setInstancedAttribute("a_reflectionProbeData",[this._reflectionProbeBlendWeight,0,0,0]))},e._onUpdateReflectionProbeDataMap=function(){null!==this.model&&this.model.updateReflectionProbeDataMap(this._reflectionProbeDataMap)},e._onMaterialModified=function(t,e){this._model&&this._model.inited&&(this._onRebuildPSO(t,e||this._getBuiltinMaterial()),this._updateStandardSkin())},e._onRebuildPSO=function(t,e){this._model&&this._model.inited&&(this._model.isDynamicBatching=this._isBatchingEnabled(),this._model.setSubModelMaterial(t,e),this._onUpdateLightingmap(),this._onUpdateLocalShadowBiasAndProbeId(),this._updateReflectionProbeTexture(),this._onUpdateReflectionProbeDataMap(),this._onUpdateLocalReflectionProbeData())},e._onMeshChanged=function(){},e._clearMaterials=function(){if(this._model)for(var t=this._model.subModels,e=0;e<t.length;++e)this._onMaterialModified(e,null)},e._getBuiltinMaterial=function(){return mT.get("missing-material")},e._onVisibilityChange=function(t){this._model&&(this._model.visFlags=t)},e._updateShadowBias=function(){this._model&&(this._model.shadowBias=this._shadowBias)},e._updateShadowNormalBias=function(){this._model&&(this._model.shadowNormalBias=this._shadowNormalBias)},e._updateCastShadow=function(){this._model&&(this._shadowCastingMode===_j.OFF?this._model.castShadow=!1:(this._shadowCastingMode,_j.ON,this._shadowCastingMode,this._model.castShadow=!0))},e._updateReceiveShadow=function(){this._model&&(this._shadowReceivingMode===dj.OFF?this._model.receiveShadow=!1:this._model.receiveShadow=!0)},e.onMobilityChanged=function(){this._updateUseLightProbe(),this._updateReceiveDirLight()},e.onLightProbeBakingChanged=function(){this._updateReceiveDirLight()},e.onUseLightProbeChanged=function(){this._updateUseLightProbe()},e.onReflectionProbeChanged=function(){this._updateUseReflectionProbe(),this._onUpdateLocalShadowBiasAndProbeId();var t=A.internal.reflectionProbeManager,e=this._model;1===this.bakeSettings.reflectionProbe||3===this.bakeSettings.reflectionProbe||4===this.bakeSettings.reflectionProbe?(t.selectReflectionProbe(e),t.getUsedReflectionProbe(e,!1)||at(16302)):2===this.bakeSettings.reflectionProbe&&(t.selectPlanarReflectionProbe(e),t.getUsedReflectionProbe(e,!0)||at(16302))},e.onBakeToReflectionProbeChanged=function(){this._updateBakeToReflectionProbe()},e._updateUseLightProbe=function(){if(this._model){var t=this.node;this._mesh&&t&&t.mobility===Uy.Movable&&this.bakeSettings.useLightProbe?this._model.useLightProbe=!0:this._model.useLightProbe=!1}},e._isBatchingEnabled=function(){for(var t=0;t<this._materials.length;++t){var e=this._materials[t];if(e)for(var i=0;i<e.passes.length;++i)if(e.passes[i].batchingScheme)return!0}return!1},e._updateUseReflectionProbe=function(){this._model&&(this._model.reflectionProbeType=this.bakeSettings.reflectionProbe,this._updateReflectionProbeTexture())},e._updateUseReflectionProbeType=function(){this._model&&(this._model.reflectionProbeType=this.bakeSettings.reflectionProbe)},e._updateBakeToReflectionProbe=function(){this._model&&(this._model.bakeToReflectionProbe=this.bakeSettings.bakeToReflectionProbe)},e._watchMorphInMesh=function(){if(this._morphInstance&&(this._morphInstance.destroy(),this._morphInstance=null),this._enableMorph&&this._mesh&&this._mesh.struct.morph&&this._mesh.morphRendering){this._morphInstance=this._mesh.morphRendering.createInstance();for(var t=this._mesh.struct.primitives.length,e=0;e<t;++e)this._uploadSubMeshShapesWeights(e);this._model&&this._model instanceof KW&&this._model.setMorphRendering(this._morphInstance)}},e._initSubMeshShapesWeights=function(){var t=this._mesh;if(this._subMeshShapesWeights.length=0,t){var e=t.struct.morph;if(e){var i=e.weights;this._subMeshShapesWeights=e.subMeshMorphs.map((function(t){return t?t.weights?t.weights.slice(0):i?(i.length,t.targets.length,i.slice(0)):new Array(t.targets.length).fill(0):[]}))}}},e._validateShapeWeights=function(){var t=this._mesh,e=this._subMeshShapesWeights;if(!t||!t.struct.morph)return 0===e.length;var i=t.struct.morph;return i.subMeshMorphs.length===e.length&&e.every((function(t,e){var n,r,s=t.length;return(null!==(n=null==(r=i.subMeshMorphs[e])?void 0:r.targets.length)&&void 0!==n?n:0)===s}))},e._uploadSubMeshShapesWeights=function(t){var e;null==(e=this._morphInstance)||e.setWeights(t,this._subMeshShapesWeights[t])},e._updateStandardSkin=function(){var t=rb();if(this._enabledGlobalStandardSkinObject&&(t.standardSkinMeshRenderer=this,t.standardSkinModel=this.model),!t.skinMaterialModel&&this._model)for(var e=this._model.subModels,i=0;i<e.length;i++)if(!(rj(e[i])<0))return void(t.skinMaterialModel=this._model)},n(i,[{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t,this._updateShadowBias(),this._onUpdateLocalShadowBiasAndProbeId()}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t,this._updateShadowNormalBias(),this._onUpdateLocalShadowBiasAndProbeId()}},{key:"shadowCastingMode",get:function(){return this._shadowCastingMode},set:function(t){this._shadowCastingMode=t,this._updateCastShadow()}},{key:"shadowCastingModeForInspector",get:function(){return this.shadowCastingMode===_j.ON},set:function(t){this.shadowCastingMode=!0===t?_j.ON:_j.OFF}},{key:"receiveShadow",get:function(){return this._shadowReceivingMode},set:function(t){this._shadowReceivingMode=t,this._updateReceiveShadow()}},{key:"receiveShadowForInspector",get:function(){return this._shadowReceivingMode===dj.ON},set:function(t){this._shadowReceivingMode=!0===t?dj.ON:dj.OFF,this._updateReceiveShadow()}},{key:"mesh",get:function(){return this._mesh},set:function(t){var e=this._mesh,i=this._mesh=t;null==i||i.initialize(),this._initSubMeshShapesWeights(),this._watchMorphInMesh(),this._onMeshChanged(e),this._updateModels(),this.enabledInHierarchy&&this._attachToScene(),this._updateCastShadow(),this._updateReceiveShadow(),this._updateUseLightProbe(),this._updateUseReflectionProbe(),this._updateReceiveDirLight()}},{key:"model",get:function(){return this._model}},{key:"enableMorph",get:function(){return this._enableMorph},set:function(t){this._enableMorph=t}},{key:"isGlobalStandardSkinObject",get:function(){return this._enabledGlobalStandardSkinObject},set:function(t){rb().standardSkinMeshRenderer=t?this:null,this._enabledGlobalStandardSkinObject=t}}]),i}(HU),JW.ShadowCastingMode=_j,JW.ShadowReceivingMode=dj,VW=zh((LW=JW).prototype,"bakeSettings",[ij],(function(){return new pj})),NW=zh(LW.prototype,"_mesh",[ij],(function(){return null})),zW=zh(LW.prototype,"_shadowCastingMode",[ij],(function(){return _j.OFF})),UW=zh(LW.prototype,"_shadowReceivingMode",[ij],(function(){return dj.ON})),GW=zh(LW.prototype,"_shadowBias",[ij],(function(){return 0})),HW=zh(LW.prototype,"_shadowNormalBias",[ij],(function(){return 0})),WW=zh(LW.prototype,"_reflectionProbeId",[ij],(function(){return-1})),jW=zh(LW.prototype,"_reflectionProbeBlendId",[ij],(function(){return-1})),qW=zh(LW.prototype,"_reflectionProbeBlendWeight",[ij],(function(){return 0})),XW=zh(LW.prototype,"_enabledGlobalStandardSkinObject",[ij],(function(){return!1})),v(LW.prototype,"shadowBias",[MW],Object.getOwnPropertyDescriptor(LW.prototype,"shadowBias"),LW.prototype),v(LW.prototype,"shadowNormalBias",[PW],Object.getOwnPropertyDescriptor(LW.prototype,"shadowNormalBias"),LW.prototype),v(LW.prototype,"shadowCastingMode",[EW],Object.getOwnPropertyDescriptor(LW.prototype,"shadowCastingMode"),LW.prototype),v(LW.prototype,"receiveShadow",[OW],Object.getOwnPropertyDescriptor(LW.prototype,"receiveShadow"),LW.prototype),v(LW.prototype,"mesh",[kW],Object.getOwnPropertyDescriptor(LW.prototype,"mesh"),LW.prototype),v(LW.prototype,"isGlobalStandardSkinObject",[RW],Object.getOwnPropertyDescriptor(LW.prototype,"isGlobalStandardSkinObject"),LW.prototype),YW=zh(LW.prototype,"_enableMorph",[ij],(function(){return!0})),FW=LW))||FW)||FW));function gj(t,e){var i=t.sharedMaterials.length;if(i!==e.sharedMaterials.length)return!1;for(var n=0;n<i;n++)if(t.getRenderMaterial(n)!==e.getRenderMaterial(n))return!1;return!0}t("a9",function(){function t(){}return t.batchStaticModel=function(t,e){var i=t.getComponentsInChildren(mj);if(i.length<2)return console.error("the number of static models to batch is less than 2,it needn't batch."),!1;for(var n=1;n<i.length;n++){if(!i[0].mesh.validateMergingMesh(i[n].mesh))return console.error("the meshes of "+i[0].node.name+" and "+i[n].node.name+" can't be merged"),!1;if(!gj(i[0],i[n]))return console.error("the materials of "+i[0].node.name+" and "+i[n].node.name+" can't be merged"),!1}var r=new Pk,s=new Kr,a=new Kr;t.getWorldMatrix(a),Kr.invert(a,a);for(var o=0;o<i.length;o++){var h=i[o];h.node.getWorldMatrix(s),Kr.multiply(s,a,s),r.merge(i[o].mesh,s),h.enabled=!1}var u=e.addComponent(mj);return u.mesh=r,u.sharedMaterials=i[0].sharedMaterials,!0},t.unbatchStaticModel=function(t,e){for(var i=t.getComponentsInChildren(mj),n=0;n<i.length;n++)i[n].enabled=!0;var r=e.getComponent(mj);return r&&(r.mesh&&r.mesh.destroyRenderingMesh(),r.destroy()),!0},t}()),pt(Pk.prototype,"Mesh.prototype",[{name:"renderingMesh",newName:"renderingSubMeshes"}]),mt(Pk.prototype,"Mesh.prototype",[{name:"hasFlatBuffers"},{name:"destroyFlatBuffers"}]);var yj,vj,bj,Sj,wj,xj,Tj,Aj,Cj,Dj,Bj,Ij,Mj,Pj,Ej,Oj,kj=t("ab",(sj=Kh("cc.Skeleton"),aj=Ou([_i]),oj=Ou([Kr]),sj((uj=function(t){function e(e){var i;return(i=t.call(this,e)||this)._joints=lj&&lj(),i._bindposes=cj&&cj(),i._hash=fj&&fj(),i._invBindposes=null,i}s(e,t);var i=e.prototype;return i.destroy=function(){var e,i;return null==(e=A.director.root)||null==(i=e.dataPoolManager)||i.releaseSkeleton(this),t.prototype.destroy.call(this)},i.validate=function(){return this.joints.length>0&&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;t<this._bindposes.length;t++){var e=new Kr;Kr.invert(e,this._bindposes[t]),this._invBindposes.push(e)}}return this._invBindposes}},{key:"hash",get:function(){if(!this._hash){for(var t="",e=0;e<this._bindposes.length;e++){var i=this._bindposes[e];t+=i.m00.toPrecision(2)+" "+i.m01.toPrecision(2)+" "+i.m02.toPrecision(2)+" "+i.m03.toPrecision(2)+" "+i.m04.toPrecision(2)+" "+i.m05.toPrecision(2)+" "+i.m06.toPrecision(2)+" "+i.m07.toPrecision(2)+" "+i.m08.toPrecision(2)+" "+i.m09.toPrecision(2)+" "+i.m10.toPrecision(2)+" "+i.m11.toPrecision(2)+" "+i.m12.toPrecision(2)+" "+i.m13.toPrecision(2)+" "+i.m14.toPrecision(2)+" "+i.m15.toPrecision(2)+"\n"}this._hash=qf(t,666)}return this._hash}}]),e}(Cm),lj=zh(uj.prototype,"_joints",[aj],(function(){return[]})),cj=zh(uj.prototype,"_bindposes",[oj],(function(){return[]})),fj=zh(uj.prototype,"_hash",[uu],(function(){return 0})),hj=uj))||hj));A.Skeleton=kj,mt(mj.prototype,"MeshRenderer.prototype",[{name:"enableDynamicBatching"},{name:"recieveShadows"}]),A.ModelComponent=mj,le(mj,"cc.ModelComponent");var Rj,Fj,Lj,Vj,Nj,zj,Uj,Gj,Hj,Wj,jj,qj,Xj,Yj,Jj,Kj,Qj,Zj,$j,tq,eq,iq,nq,rq,sq,aq,oq,hq,uq,lq,cq,fq,_q,dq,pq,mq,gq,yq,vq,bq,Sq,wq,xq,Tq,Aq,Cq,Dq,Bq,Iq,Mq,Pq,Eq,Oq,kq,Rq,Fq,Lq,Vq,Nq,zq,Uq,Gq,Hq,Wq,jq,qq,Xq,Yq,Jq,Kq,Qq,Zq,$q,tX,eX,iX,nX,rX,sX,aX,oX,hX,uX,lX,cX,fX,_X,dX,pX,mX,gX,yX,vX,bX,SX,wX,xX,TX,AX,CX,DX,BX,IX,MX,PX,EX,OX,kX,RX,FX,LX,VX,NX,zX,UX,GX,HX,WX,jX=new ir,qX=Ee({LUMINOUS_FLUX:0,LUMINANCE:1}),XX=Kh("cc.StaticLightSettings")((vj=function(){function t(){this._baked=bj&&bj(),this._editorOnly=Sj&&Sj(),this._castShadow=wj&&wj()}return n(t,[{key:"editorOnly",get:function(){return this._editorOnly},set:function(t){this._editorOnly=t}},{key:"baked",get:function(){return this._baked},set:function(t){this._baked=t}},{key:"castShadow",get:function(){return this._castShadow},set:function(t){this._castShadow=t}}]),t}(),bj=zh(vj.prototype,"_baked",[uu],(function(){return!1})),Sj=zh(vj.prototype,"_editorOnly",[uu],(function(){return!1})),wj=zh(vj.prototype,"_castShadow",[uu],(function(){return!1})),yj=vj))||yj,YX=t("ae",(xj=Kh("cc.Light"),Tj=Ou(XX),Aj=Ou(Ly.BitMask),xj((Oj=function(t){function e(){var e;return(e=t.call(this)||this)._color=Bj&&Bj(),e._useColorTemperature=Ij&&Ij(),e._colorTemperature=Mj&&Mj(),e._staticSettings=Pj&&Pj(),e._visibility=Ej&&Ej(),e._type=5,e._lightType=void 0,e._light=null,e._lightType=nP,e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._createLight()},i.onEnable=function(){this._attachToScene()},i.onDisable=function(){this._detachFromScene()},i.onDestroy=function(){this._destroyLight()},i._createLight=function(){this._light||(this._light=A.director.root.createLight(this._lightType)),this.color=this._color,this.useColorTemperature=this._useColorTemperature,this.colorTemperature=this._colorTemperature,this._light.node=this.node,this._light.baked=this.baked,this._light.visibility=this.visibility},i._destroyLight=function(){this._light&&(A.director.root.recycleLight(this._light),this._light=null)},i._attachToScene=function(){if(this._detachFromScene(),this._light&&!this._light.scene&&this.node.scene){var t=this._getRenderScene();switch(this._type){case 0:t.addDirectionalLight(this._light),t.setMainLight(this._light);break;case 1:t.addSphereLight(this._light);break;case 2:t.addSpotLight(this._light);break;case 3:t.addPointLight(this._light);break;case 4:t.addRangedDirLight(this._light)}}},i._detachFromScene=function(){if(this._light&&this._light.scene){var t=this._light.scene;switch(this._type){case 0:t.removeDirectionalLight(this._light),t.unsetMainLight(this._light);break;case 1:t.removeSphereLight(this._light);break;case 2:t.removeSpotLight(this._light);break;case 3:t.removePointLight(this._light);break;case 4:t.removeRangedDirLight(this._light)}}},i._onUpdateReceiveDirLight=function(){},n(e,[{key:"color",get:function(){return this._color},set:function(t){this._color=t.clone(),this._light&&(jX.x=t.r/255,jX.y=t.g/255,jX.z=t.b/255,this._light.color=jX)}},{key:"useColorTemperature",get:function(){return this._useColorTemperature},set:function(t){this._useColorTemperature=t,this._light&&(this._light.useColorTemperature=t)}},{key:"colorTemperature",get:function(){return this._colorTemperature},set:function(t){this._colorTemperature=t,this._light&&(this._light.colorTemperature=t)}},{key:"staticSettings",get:function(){return this._staticSettings},set:function(t){this._staticSettings=t}},{key:"type",get:function(){return this._type}},{key:"baked",get:function(){return this.staticSettings.baked},set:function(t){this.staticSettings.baked=t,null!==this._light&&(this._light.baked=t)}},{key:"visibility",get:function(){return this._visibility},set:function(t){this._visibility=t,this._light&&(this._light.visibility=t),this._onUpdateReceiveDirLight()}}]),e}(yg),Oj.Type=eP,Oj.PhotometricTerm=qX,Bj=zh((Dj=Oj).prototype,"_color",[uu],(function(){return cr.WHITE.clone()})),Ij=zh(Dj.prototype,"_useColorTemperature",[uu],(function(){return!1})),Mj=zh(Dj.prototype,"_colorTemperature",[uu],(function(){return 6550})),Pj=zh(Dj.prototype,"_staticSettings",[uu],(function(){return new XX})),Ej=zh(Dj.prototype,"_visibility",[uu],(function(){return US})),v(Dj.prototype,"staticSettings",[Tj],Object.getOwnPropertyDescriptor(Dj.prototype,"staticSettings"),Dj.prototype),v(Dj.prototype,"visibility",[Aj],Object.getOwnPropertyDescriptor(Dj.prototype,"visibility"),Dj.prototype),Cj=Dj))||Cj)),JX=tu,KX=uu,QX=lu,ZX=Ou,$X=t("ad",(Rj=Kh("cc.DirectionalLight"),Fj=QX("_illuminance"),Lj=ZX(li),Vj=JX({group:{name:"DynamicShadowSettings",displayOrder:1}}),Nj=ZX(fi),zj=JX({group:{name:"DynamicShadowSettings",displayOrder:5}}),Uj=ZX(jT),Gj=JX({group:{name:"DynamicShadowSettings",displayOrder:6}}),Hj=ZX(ci),Wj=JX({group:{name:"DynamicShadowSettings",displayOrder:7}}),jj=ZX(ci),qj=JX({group:{name:"DynamicShadowSettings",displayOrder:8}}),Xj=ZX(ci),Yj=JX({group:{name:"DynamicShadowSettings",displayOrder:9}}),Jj=ZX(ci),Kj=JX({group:{name:"DynamicShadowSettings",displayOrder:22}}),Qj=ZX(ci),Zj=JX({group:{name:"DynamicShadowSettings",displayOrder:10}}),$j=ZX(qT),tq=JX({group:{name:"DynamicShadowSettings",displayOrder:11}}),eq=ZX(fi),iq=JX({group:{name:"DynamicShadowSettings",displayOrder:12}}),nq=ZX(ci),rq=JX({group:{name:"DynamicShadowSettings",displayOrder:13}}),sq=ZX(XT),aq=JX({group:{name:"DynamicShadowSettings",displayOrder:14}}),oq=ZX(fi),hq=JX({group:{name:"DynamicShadowSettings",displayOrder:15}}),uq=ZX(ci),lq=JX({group:{name:"DynamicShadowSettings",displayOrder:16}}),cq=ZX(ci),fq=JX({group:{name:"DynamicShadowSettings",displayOrder:17}}),_q=ZX(ci),dq=JX({group:{name:"DynamicShadowSettings",displayOrder:19}}),pq=ZX(fi),mq=JX({group:{name:"DynamicShadowSettings",displayOrder:20}}),gq=ZX(fi),yq=JX({group:{name:"DynamicShadowSettings",displayOrder:21}}),vq=ZX(ci),Rj((Sq=function(t){function e(){var e;return(e=t.call(this)||this)._illuminanceHDR=wq&&wq(),e._illuminanceLDR=xq&&xq(),e._shadowEnabled=Tq&&Tq(),e._shadowPcf=Aq&&Aq(),e._shadowBias=Cq&&Cq(),e._shadowNormalBias=Dq&&Dq(),e._shadowSaturation=Bq&&Bq(),e._shadowDistance=Iq&&Iq(),e._shadowInvisibleOcclusionRange=Mq&&Mq(),e._csmLevel=Pq&&Pq(),e._csmLayerLambda=Eq&&Eq(),e._csmOptimizationMode=Oq&&Oq(),e._csmAdvancedOptions=kq&&kq(),e._csmLayersTransition=Rq&&Rq(),e._csmTransitionRange=Fq&&Fq(),e._shadowFixedArea=Lq&&Lq(),e._shadowNear=Vq&&Vq(),e._shadowFar=Nq&&Nq(),e._shadowOrthoSize=zq&&zq(),e._lightType=aP,ze.querySettings("rendering","highQualityMode")&&(e._shadowPcf=jT.SOFT_2X,e._shadowDistance=50,e.enableCSM=!0,e.staticSettings.castShadow=!0),e}s(e,t);var i=e.prototype;return i._createLight=function(){if(t.prototype._createLight.call(this),this._type=0,this._light){var e=this._light;e.illuminanceHDR=this._illuminanceHDR,e.illuminanceLDR=this._illuminanceLDR,e.shadowEnabled=this._shadowEnabled,e.shadowPcf=this._shadowPcf,e.shadowBias=this._shadowBias,e.shadowNormalBias=this._shadowNormalBias,e.shadowSaturation=this._shadowSaturation,e.shadowDistance=this._shadowDistance,e.shadowInvisibleOcclusionRange=this._shadowInvisibleOcclusionRange,e.shadowFixedArea=this._shadowFixedArea,e.shadowNear=this._shadowNear,e.shadowFar=this._shadowFar,e.shadowOrthoSize=this._shadowOrthoSize,e.csmLevel=this._csmLevel,e.csmLayerLambda=this._csmLayerLambda,e.csmOptimizationMode=this._csmOptimizationMode,e.csmLayersTransition=this._csmLayersTransition,e.csmTransitionRange=this._csmTransitionRange}},i._onUpdateReceiveDirLight=function(){if(this._light){t.prototype._onUpdateReceiveDirLight.call(this);var e=this.node.scene;if(e&&e.renderScene&&e.renderScene.mainLight===this._light)for(var i=e.renderScene.models,n=0;n<i.length;n++){var r=i[n];if(r.node){var s=r.node.getComponent(mj);s&&s.onUpdateReceiveDirLight(this._visibility)}}}},n(e,[{key:"illuminance",get:function(){return rb().isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){rb().isHDR?(this._illuminanceHDR=t,this._light&&(this._light.illuminanceHDR=this._illuminanceHDR)):(this._illuminanceLDR=t,this._light&&(this._light.illuminanceLDR=this._illuminanceLDR))}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t,this._light&&(this._light.shadowEnabled=this._shadowEnabled)}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t,this._light&&(this._light.shadowPcf=this._shadowPcf)}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t,this._light&&(this._light.shadowBias=this._shadowBias)}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t,this._light&&(this._light.shadowNormalBias=this._shadowNormalBias)}},{key:"shadowSaturation",get:function(){return this._shadowSaturation},set:function(t){this._shadowSaturation=$i(t,0,1),this._light&&(this._light.shadowSaturation=this._shadowSaturation)}},{key:"shadowDistance",get:function(){return this._shadowDistance},set:function(t){this._shadowDistance=Math.min(t,JT.MAX_FAR),this._shadowDistance/.1<10&&at(15003,this._shadowDistance),this._light&&(this._light.shadowDistance=this._shadowDistance,this._light.csmNeedUpdate=!0)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(t){this._shadowInvisibleOcclusionRange=Math.min(t,JT.MAX_FAR),this._light&&(this._light.shadowInvisibleOcclusionRange=this._shadowInvisibleOcclusionRange)}},{key:"csmLevel",get:function(){return this._csmLevel},set:function(t){this._csmLevel=t,this._light&&(this._light.csmLevel=this._csmLevel,this._light.csmNeedUpdate=!0)}},{key:"enableCSM",get:function(){return this._csmLevel>qT.LEVEL_1},set:function(t){this._csmLevel=t?qT.LEVEL_4:qT.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,JT.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}(YX),wq=zh(Sq.prototype,"_illuminanceHDR",[JX,Fj],(function(){return 65e3})),xq=zh(Sq.prototype,"_illuminanceLDR",[KX],(function(){return 65e3*NM.standardExposureValue})),Tq=zh(Sq.prototype,"_shadowEnabled",[KX],(function(){return!1})),Aq=zh(Sq.prototype,"_shadowPcf",[KX],(function(){return jT.HARD})),Cq=zh(Sq.prototype,"_shadowBias",[KX],(function(){return 1e-5})),Dq=zh(Sq.prototype,"_shadowNormalBias",[KX],(function(){return 0})),Bq=zh(Sq.prototype,"_shadowSaturation",[KX],(function(){return 1})),Iq=zh(Sq.prototype,"_shadowDistance",[KX],(function(){return 50})),Mq=zh(Sq.prototype,"_shadowInvisibleOcclusionRange",[KX],(function(){return 200})),Pq=zh(Sq.prototype,"_csmLevel",[KX],(function(){return qT.LEVEL_4})),Eq=zh(Sq.prototype,"_csmLayerLambda",[KX],(function(){return.75})),Oq=zh(Sq.prototype,"_csmOptimizationMode",[KX],(function(){return XT.RemoveDuplicates})),kq=zh(Sq.prototype,"_csmAdvancedOptions",[KX],(function(){return!1})),Rq=zh(Sq.prototype,"_csmLayersTransition",[KX],(function(){return!1})),Fq=zh(Sq.prototype,"_csmTransitionRange",[KX],(function(){return.05})),Lq=zh(Sq.prototype,"_shadowFixedArea",[KX],(function(){return!1})),Vq=zh(Sq.prototype,"_shadowNear",[KX],(function(){return.1})),Nq=zh(Sq.prototype,"_shadowFar",[KX],(function(){return 10})),zq=zh(Sq.prototype,"_shadowOrthoSize",[KX],(function(){return 5})),v(Sq.prototype,"illuminance",[Lj],Object.getOwnPropertyDescriptor(Sq.prototype,"illuminance"),Sq.prototype),v(Sq.prototype,"shadowEnabled",[Vj,Nj],Object.getOwnPropertyDescriptor(Sq.prototype,"shadowEnabled"),Sq.prototype),v(Sq.prototype,"shadowPcf",[zj,Uj],Object.getOwnPropertyDescriptor(Sq.prototype,"shadowPcf"),Sq.prototype),v(Sq.prototype,"shadowBias",[Gj,Hj],Object.getOwnPropertyDescriptor(Sq.prototype,"shadowBias"),Sq.prototype),v(Sq.prototype,"shadowNormalBias",[Wj,jj],Object.getOwnPropertyDescriptor(Sq.prototype,"shadowNormalBias"),Sq.prototype),v(Sq.prototype,"shadowSaturation",[qj,Xj],Object.getOwnPropertyDescriptor(Sq.prototype,"shadowSaturation"),Sq.prototype),v(Sq.prototype,"shadowDistance",[Yj,Jj],Object.getOwnPropertyDescriptor(Sq.prototype,"shadowDistance"),Sq.prototype),v(Sq.prototype,"shadowInvisibleOcclusionRange",[Kj,Qj],Object.getOwnPropertyDescriptor(Sq.prototype,"shadowInvisibleOcclusionRange"),Sq.prototype),v(Sq.prototype,"csmLevel",[Zj,$j],Object.getOwnPropertyDescriptor(Sq.prototype,"csmLevel"),Sq.prototype),v(Sq.prototype,"enableCSM",[tq,eq],Object.getOwnPropertyDescriptor(Sq.prototype,"enableCSM"),Sq.prototype),v(Sq.prototype,"csmLayerLambda",[iq,nq],Object.getOwnPropertyDescriptor(Sq.prototype,"csmLayerLambda"),Sq.prototype),v(Sq.prototype,"csmOptimizationMode",[rq,sq],Object.getOwnPropertyDescriptor(Sq.prototype,"csmOptimizationMode"),Sq.prototype),v(Sq.prototype,"shadowFixedArea",[aq,oq],Object.getOwnPropertyDescriptor(Sq.prototype,"shadowFixedArea"),Sq.prototype),v(Sq.prototype,"shadowNear",[hq,uq],Object.getOwnPropertyDescriptor(Sq.prototype,"shadowNear"),Sq.prototype),v(Sq.prototype,"shadowFar",[lq,cq],Object.getOwnPropertyDescriptor(Sq.prototype,"shadowFar"),Sq.prototype),v(Sq.prototype,"shadowOrthoSize",[fq,_q],Object.getOwnPropertyDescriptor(Sq.prototype,"shadowOrthoSize"),Sq.prototype),v(Sq.prototype,"csmAdvancedOptions",[dq,pq],Object.getOwnPropertyDescriptor(Sq.prototype,"csmAdvancedOptions"),Sq.prototype),v(Sq.prototype,"csmLayersTransition",[mq,gq],Object.getOwnPropertyDescriptor(Sq.prototype,"csmLayersTransition"),Sq.prototype),v(Sq.prototype,"csmTransitionRange",[yq,vq],Object.getOwnPropertyDescriptor(Sq.prototype,"csmTransitionRange"),Sq.prototype),bq=Sq))||bq)),tY=t("af",(Uq=Kh("cc.SphereLight"),Gq=lu("_luminance"),Hq=Ou(li),Wq=Ou(li),jq=Ou(qX),qq=Ou(ci),Xq=Ou(ci),Uq((Jq=function(t){function e(){var e;return(e=t.call(this)||this)._size=Kq&&Kq(),e._luminanceHDR=Qq&&Qq(),e._luminanceLDR=Zq&&Zq(),e._term=$q&&$q(),e._range=tX&&tX(),e._lightType=oP,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 rb().isHDR?this._luminanceHDR*iP(this._size):this._luminanceLDR},set:function(t){var e=0;rb().isHDR?(this._luminanceHDR=t/iP(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return rb().isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){rb().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}(YX),Kq=zh(Jq.prototype,"_size",[uu],(function(){return.15})),Qq=zh(Jq.prototype,"_luminanceHDR",[uu,Gq],(function(){return 1700/iP(.15)})),Zq=zh(Jq.prototype,"_luminanceLDR",[uu],(function(){return 1700/iP(.15)*NM.standardExposureValue*NM.standardLightMeterScale})),$q=zh(Jq.prototype,"_term",[uu],(function(){return qX.LUMINOUS_FLUX})),tX=zh(Jq.prototype,"_range",[uu],(function(){return 1})),v(Jq.prototype,"luminousFlux",[Hq],Object.getOwnPropertyDescriptor(Jq.prototype,"luminousFlux"),Jq.prototype),v(Jq.prototype,"luminance",[Wq],Object.getOwnPropertyDescriptor(Jq.prototype,"luminance"),Jq.prototype),v(Jq.prototype,"term",[jq],Object.getOwnPropertyDescriptor(Jq.prototype,"term"),Jq.prototype),v(Jq.prototype,"size",[qq],Object.getOwnPropertyDescriptor(Jq.prototype,"size"),Jq.prototype),v(Jq.prototype,"range",[Xq],Object.getOwnPropertyDescriptor(Jq.prototype,"range"),Jq.prototype),Yq=Jq))||Yq)),eY=Ou,iY=uu,nY=lu,rY=tu,sY=t("ag",(eX=Kh("cc.SpotLight"),iX=nY("_luminance"),nX=eY(qX),rX=eY(ci),sX=rY({group:{name:"DynamicShadowSettings",displayOrder:1}}),aX=eY(fi),oX=rY({group:{name:"DynamicShadowSettings",displayOrder:2}}),hX=eY(jT),uX=rY({group:{name:"DynamicShadowSettings",displayOrder:3}}),lX=eY(ci),cX=rY({group:{name:"DynamicShadowSettings",displayOrder:4}}),fX=eY(ci),eX((dX=function(t){function e(){var e;return(e=t.call(this)||this)._size=pX&&pX(),e._luminanceHDR=mX&&mX(),e._luminanceLDR=gX&&gX(),e._term=yX&&yX(),e._range=vX&&vX(),e._spotAngle=bX&&bX(),e._angleAttenuationStrength=SX&&SX(),e._shadowEnabled=wX&&wX(),e._shadowPcf=xX&&xX(),e._shadowBias=TX&&TX(),e._shadowNormalBias=AX&&AX(),e._lightType=dP,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 rb().isHDR?this._luminanceHDR*iP(this._size):this._luminanceLDR},set:function(t){var e=0;rb().isHDR?(this._luminanceHDR=t/iP(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return rb().isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){rb().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}(YX),pX=zh(dX.prototype,"_size",[iY],(function(){return.15})),mX=zh(dX.prototype,"_luminanceHDR",[iY,iX],(function(){return 1700/iP(.15)})),gX=zh(dX.prototype,"_luminanceLDR",[iY],(function(){return 1700/iP(.15)*NM.standardExposureValue*NM.standardLightMeterScale})),yX=zh(dX.prototype,"_term",[iY],(function(){return qX.LUMINOUS_FLUX})),vX=zh(dX.prototype,"_range",[iY],(function(){return 1})),bX=zh(dX.prototype,"_spotAngle",[iY],(function(){return 60})),SX=zh(dX.prototype,"_angleAttenuationStrength",[iY],(function(){return 0})),wX=zh(dX.prototype,"_shadowEnabled",[iY],(function(){return!1})),xX=zh(dX.prototype,"_shadowPcf",[iY],(function(){return jT.HARD})),TX=zh(dX.prototype,"_shadowBias",[iY],(function(){return 1e-5})),AX=zh(dX.prototype,"_shadowNormalBias",[iY],(function(){return 0})),v(dX.prototype,"term",[nX],Object.getOwnPropertyDescriptor(dX.prototype,"term"),dX.prototype),v(dX.prototype,"size",[rX],Object.getOwnPropertyDescriptor(dX.prototype,"size"),dX.prototype),v(dX.prototype,"shadowEnabled",[sX,aX],Object.getOwnPropertyDescriptor(dX.prototype,"shadowEnabled"),dX.prototype),v(dX.prototype,"shadowPcf",[oX,hX],Object.getOwnPropertyDescriptor(dX.prototype,"shadowPcf"),dX.prototype),v(dX.prototype,"shadowBias",[uX,lX],Object.getOwnPropertyDescriptor(dX.prototype,"shadowBias"),dX.prototype),v(dX.prototype,"shadowNormalBias",[cX,fX],Object.getOwnPropertyDescriptor(dX.prototype,"shadowNormalBias"),dX.prototype),_X=dX))||_X));t("ah",(CX=Kh("cc.PointLight"),DX=lu("_luminance"),BX=Ou(li),IX=Ou(li),MX=Ou(qX),PX=Ou(ci),CX((OX=function(t){function e(){var e;return(e=t.call(this)||this)._luminanceHDR=kX&&kX(),e._luminanceLDR=RX&&RX(),e._term=FX&&FX(),e._range=LX&&LX(),e._lightType=pP,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 rb().isHDR?this._luminanceHDR*iP(1):this._luminanceLDR},set:function(t){var e=0;rb().isHDR?(this._luminanceHDR=t/iP(1),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return rb().isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){rb().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}(YX),kX=zh(OX.prototype,"_luminanceHDR",[uu,DX],(function(){return 1700/iP(.15)})),RX=zh(OX.prototype,"_luminanceLDR",[uu],(function(){return 1700/iP(.15)*NM.standardExposureValue*NM.standardLightMeterScale})),FX=zh(OX.prototype,"_term",[uu],(function(){return qX.LUMINOUS_FLUX})),LX=zh(OX.prototype,"_range",[uu],(function(){return 1})),v(OX.prototype,"luminousFlux",[BX],Object.getOwnPropertyDescriptor(OX.prototype,"luminousFlux"),OX.prototype),v(OX.prototype,"luminance",[IX],Object.getOwnPropertyDescriptor(OX.prototype,"luminance"),OX.prototype),v(OX.prototype,"term",[MX],Object.getOwnPropertyDescriptor(OX.prototype,"term"),OX.prototype),v(OX.prototype,"range",[PX],Object.getOwnPropertyDescriptor(OX.prototype,"range"),OX.prototype),EX=OX))||EX)),t("ai",(VX=Kh("cc.RangedDirectionalLight"),NX=lu("_illuminance"),zX=Ou(li),VX((GX=function(t){function e(){var e;return(e=t.call(this)||this)._illuminanceHDR=HX&&HX(),e._illuminanceLDR=WX&&WX(),e._lightType=gP,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 rb().isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){rb().isHDR?(this._illuminanceHDR=t,this._light&&(this._light.illuminanceHDR=this._illuminanceHDR)):(this._illuminanceLDR=t,this._light&&(this._light.illuminanceLDR=this._illuminanceLDR))}}]),e}(YX),HX=zh(GX.prototype,"_illuminanceHDR",[tu,NX],(function(){return 65e3})),WX=zh(GX.prototype,"_illuminanceLDR",[uu],(function(){return 65e3*NM.standardExposureValue})),v(GX.prototype,"illuminance",[zX],Object.getOwnPropertyDescriptor(GX.prototype,"illuminance"),GX.prototype),UX=GX))||UX)),A.LightComponent=YX,le(YX,"cc.LightComponent"),A.DirectionalLightComponent=$X,le($X,"cc.DirectionalLightComponent"),A.SphereLightComponent=tY,le(tY,"cc.SphereLightComponent"),A.SpotLightComponent=sY,le(sY,"cc.SpotLightComponent"),pt(sY.prototype,"SpotLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),pt(tY.prototype,"SphereLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),pt(YX.PhotometricTerm,"Light.PhotometricTerm",[{name:"LUMINOUS_POWER",newName:"LUMINOUS_FLUX"}]);var aY=Symbol("BakeNodeCurves"),oY=t("g2",function(){function t(){}return t.getOrExtract=function(e){var i=t.pool.get(e);if(!i||i.samples!==e.sample){i&&A.director.root.dataPoolManager.releaseAnimationClip(e);var n=Math.ceil(e.sample*e.duration)+1,r=e.sample;i=e[aY](0,r,n),t.pool.set(e,i)}return i},t.destroy=function(e){t.pool.delete(e)},t}());oY.pool=new Map;var hY=new Kr;function uY(t,e,i){for(Kr.identity(i);t!==e;)Kr.fromRTS(hY,t.rotation,t.position,t.scale),Kr.multiply(i,hY,i),t=t.parent;return i}var lY=new md(1,1,0,2,2,2),cY=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 fY(t){return 2&t.getFormatFeatures(44)?44:35}function _Y(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 dY=new ir,pY=new ir,mY=new ir,gY=new ir,yY=new Kr,vY=new Kr,bY=new gh,SY=Number.MAX_SAFE_INTEGER,wY=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=fY(this._device);this._formatSize=ip[e].size,this._pixelsPerJoint=48/this._formatSize,this._pool=new sN(t),this._pool.initialize({format:e,roundUpFn:_Y}),this._customPool=new sN(t),this._customPool.initialize({format:e,roundUpFn:_Y})}var e=t.prototype;return e.clear=function(){this._pool.destroy(),this._textureBuffers.clear()},e.registerCustomTextureLayouts=function(t){for(var e=0;e<t.length;e++){var i=t[e],n=i.textureLength;2&this._device.getFormatFeatures(44)||(n*=2);for(var r=this._customPool.createChunk(n),s=0;s<i.contents.length;s++){var a=i.contents[s],o=a.skeleton;this._chunkIdxMap.set(o,r);for(var h=0;h<a.clips.length;h++){var u=a.clips[h];this._chunkIdxMap.set(o^u,r)}}}},e.getDefaultPoseTexture=function(t,e,i){var n=0^t.hash,r=this._textureBuffers.get(n)||null;if(r&&r.bounds.has(e.hash))return r.refCount++,r;var s=t.joints,a=t.bindposes,o=null,h=!1,u=s.length;if(r)r.refCount++;else{var l=12*u,c=this._chunkIdxMap.get(n),f=void 0!==c?this._customPool.alloc(4*l,c):this._pool.alloc(4*l);if(!f)return r;r={pixelOffset:f.start/this._formatSize,refCount:1,bounds:new Map,skeletonHash:t.hash,clipHash:0,readyToBeDeleted:!1,handle:f},o=new Float32Array(l),h=!0}ir.set(mY,SY,SY,SY),ir.set(gY,-SY,-SY,-SY);for(var _=e.getBoneSpaceBounds(t),d=0,p=0;d<u;d++,p+=12){var m=i.getChildByPath(s[d]),g=m?uY(m,i,yY):t.inverseBindposes[d],y=_[d];y&&(gh.transform(bY,y,g),bY.getBoundary(dY,pY),ir.min(mY,mY,dY),ir.max(gY,gY,pY)),h&&(m&&Kr.multiply(g,g,a[d]),cY(o,p,m?g:Kr.IDENTITY))}var v=[new gh];return r.bounds.set(e.hash,v),gh.fromPoints(v[0],mY,gY),h&&(this._pool.update(r.handle,o.buffer),this._textureBuffers.set(n,r)),r},e.getSequencePoseTexture=function(t,e,i,n){var r=t.hash^e.hash,s=this._textureBuffers.get(r)||null;if(s&&s.bounds.has(i.hash))return s.refCount++,s;var a=t.joints,o=t.bindposes,h=oY.getOrExtract(e).frames,u=null,l=!1,c=a.length;if(s)s.refCount++;else{var f=12*c*h,_=this._chunkIdxMap.get(r),d=void 0!==_?this._customPool.alloc(4*f,_):this._pool.alloc(4*f);if(!d)return null;var p=this._createAnimInfos(t,e,n);s={pixelOffset:d.start/this._formatSize,refCount:1,bounds:new Map,skeletonHash:t.hash,clipHash:e.hash,readyToBeDeleted:!1,handle:d,animInfos:p},u=new Float32Array(f),l=!0}var m=i.getBoneSpaceBounds(t),g=[];s.bounds.set(i.hash,g);for(var y=0;y<h;y++)g.push(new gh(SY,SY,SY,-SY,-SY,-SY));for(var v=0,b=0;v<h;v++){for(var S=g[v],w=0;w<c;w++,b+=12){var x=s.animInfos[w],T=x.curveData,A=x.downstream,C=x.bindposeIdx,D=x.bindposeCorrection,B=void 0,I=!0;T&&A?B=Kr.multiply(yY,T[v],A):T?B=T[v]:A?B=A:(B=t.inverseBindposes[C],I=!1);var M=m[w];if(M){var P=D?Kr.multiply(vY,B,D):B;gh.transform(bY,M,P),bY.getBoundary(dY,pY),ir.min(S.center,S.center,dY),ir.max(S.halfExtents,S.halfExtents,pY)}l&&(I&&Kr.multiply(yY,B,o[C]),cY(u,b,I?yY:Kr.IDENTITY))}gh.fromPoints(S,S.center,S.halfExtents)}return l&&(this._pool.update(s.handle,u.buffer),this._textureBuffers.set(r,s)),s},e.releaseHandle=function(t){if(t.refCount>0&&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=oY.getOrExtract(e),h=0;h<a;h++){for(var u=r[h],l=o.joints[u],c=i.getChildByPath(u),f=void 0,_=void 0;!l;){var d=u.lastIndexOf("/");if(u=u.substring(0,d),l=o.joints[u],c?(f||(f=new Kr),Kr.fromRTS(yY,c.rotation,c.position,c.scale),Kr.multiply(f,yY,f),c=c.parent):_=u,d<0)break}var p=h,m=void 0;if(void 0!==_&&l){p=h-1;for(var g=0;g<a;g++)if(r[g]===_){p=g,m=new Kr,Kr.multiply(m,s[g],t.inverseBindposes[h]);break}}n.push({curveData:l&&l.transforms,downstream:f,bindposeIdx:p,bindposeCorrection:m})}return n},n(t,[{key:"pixelsPerJoint",get:function(){return this._pixelsPerJoint}}]),t}(),xY=function(){function t(t){this._pool=new Map,this._device=void 0,this._device=t}var e=t.prototype;return e.getData=function(t){void 0===t&&(t="-1");var e=this._pool.get(t);if(e)return e;var i=this._device.createBuffer(new ud(18,3,Qb.SIZE,Qb.SIZE)),n=new Float32Array([0,0,0,0]);i.update(n);var r={buffer:i,data:n,dirty:!1,dirtyForJSB:new Uint8Array([0]),currentClip:null};return this._pool.set(t,r),r},e.destroy=function(t){var e=this._pool.get(t);e&&(e.buffer.destroy(),this._pool.delete(t))},e.switchClip=function(t,e){return t.currentClip=e,t.data[0]=0,t.buffer.update(t.data),t.dirty=!1,t},e.clear=function(){for(var t,e=p(this._pool.values());!(t=e()).done;)t.value.buffer.destroy();this._pool.clear()},t}(),TY=[],AY=new Map;function CY(t,e){for(var i=0,n=Kr.IDENTITY;t;){if(t.stamp===e||t.stamp+1===e&&!t.node.hasChangedFlags){n=t.world,t.stamp=e;break}t.stamp=e,TY[i++]=t,t=t.parent}for(;i>0;){t=TY[--i],TY[i]=null;var r=t.node;Kr.fromRTS(t.local,r.rotation,r.position,r.scale),n=Kr.multiply(t.world,n,t.local)}return n}function DY(t,e){for(var i,n=null,r=0;t!==e;){var s=t.uuid;if(AY.has(s)){n=AY.get(s);break}n={node:t,local:new Kr,world:new Kr,stamp:-1,parent:null},AY.set(s,n),TY[r++]=n,t=t.parent,n=null}for(;r>0;)i=TY[--r],TY[r]=null,i.parent=n,n=i;return n}function BY(t){for(var e=AY.get(t.uuid)||null;e;)AY.delete(e.node.uuid),e=e.parent}var IY=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!1}],MY=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!0}];function PY(t,e,i,n){for(var r=0;r<i.length;r++){for(var s=i[r],a=-1,o=0;o<s.length;o++)if(s[o]===n){a=o;break}a>=0&&(e.push(r),t.push(a))}}var EY=new ir,OY=new ir,kY=new ir,RY=new ir,FY=new Kr,LY=new gh,VY=function(){this._format=44,this._textures=[],this._buffers=[]};VY.WIDTH=256,VY.HEIGHT=3;var NY,zY,UY,GY,HY,WY,jY,qY,XY,YY,JY,KY,QY,ZY,$Y,tJ,eJ,iJ,nJ,rJ,sJ,aJ,oJ,hJ,uJ,lJ,cJ,fJ,_J,dJ,pJ,mJ,gJ=function(t){function e(){var e;return(e=t.call(this)||this)._buffers=[],e._dataArray=[],e._joints=[],e._bufferIndices=null,e._realTimeJointTexture=new VY,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<this._buffers.length;e++)this._buffers[e].destroy();this._buffers.length=0}this._dataArray.length=0,this._realTimeJointTexture._textures.forEach((function(t){t.destroy()})),this._realTimeJointTexture._textures.length=0,this._realTimeJointTexture._buffers.length=0,t.prototype.destroy.call(this)},i.uploadAnimation=function(){},i.bindSkeleton=function(t,e,i){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null);for(var n=0;n<this._joints.length;n++)BY(this._joints[n].target);if(this._bufferIndices=null,this._joints.length=0,t&&e&&i){this._realTimeTextureMode=!1,$b.JOINT_UNIFORM_CAPACITY<t.joints.length&&(this._realTimeTextureMode=!0),this.transform=e;var r=i.getBoneSpaceBounds(t),s=i.struct.jointMaps;this._ensureEnoughBuffers(s&&s.length||1),this._bufferIndices=i.jointBufferIndices,this._initRealTimeJointTexture();for(var a=0;a<t.joints.length;a++){var o=r[a],h=e.getChildByPath(t.joints[a]);if(o&&h){var u=DY(h,e),l=t.bindposes[a],c=[],f=[];s?PY(c,f,s,a):(c.push(a),f.push(0)),this._joints.push({indices:c,buffers:f,bound:o,target:h,bindpose:l,transform:u})}}}},i.updateTransform=function(t){var e=this.transform;(e.hasChangedFlags||e.isTransformDirty())&&(e.updateWorldTransform(),this._localDataUpdated=!0),ir.set(EY,1/0,1/0,1/0),ir.set(OY,-1/0,-1/0,-1/0);for(var i=0;i<this._joints.length;i++){var n=this._joints[i],r=n.bound,s=CY(n.transform,t);gh.transform(LY,r,s),LY.getBoundary(kY,RY),ir.min(EY,EY,kY),ir.max(OY,OY,RY)}var a=this._worldBounds;this._modelBounds&&a&&(gh.fromPoints(this._modelBounds,EY,OY),this._modelBounds.transform(e._mat,e._pos,e._rot,e._scale,this._worldBounds))},i.updateUBOs=function(e){t.prototype.updateUBOs.call(this,e);for(var i=0;i<this._joints.length;i++){var n=this._joints[i],r=n.indices,s=n.buffers,a=n.transform,o=n.bindpose;Kr.multiply(FY,a.world,o);for(var h=0;h<s.length;h++)cY(this._dataArray[s[h]],12*r[h],FY)}if(this._realTimeTextureMode)this._updateRealTimeJointTextureBuffer();else for(var u=0;u<this._buffers.length;u++)this._buffers[u].update(this._dataArray[u]);return!0},i.initSubModel=function(e,i,n){var r=i.vertexBuffers,s=i.iaInfo;s.vertexBuffers=i.jointMappedBuffers,t.prototype.initSubModel.call(this,e,i,n),s.vertexBuffers=r},i.getMacroPatches=function(e){var i=t.prototype.getMacroPatches.call(this,e),n=IY;return this._realTimeTextureMode&&(n=MY),i?n.concat(i):n},i._updateLocalDescriptors=function(e,i){t.prototype._updateLocalDescriptors.call(this,e,i);var n=this._bufferIndices[e];if(this._realTimeTextureMode)this._bindRealTimeJointTexture(n,i);else{var r=this._buffers[n];r&&i.bindBuffer($b.BINDING,r)}},i._updateInstancedAttributes=function(e,i){0!==i.passes[0].batchingScheme&&at(3936,this.node.getPathInHierarchy()),t.prototype._updateInstancedAttributes.call(this,e,i)},i._ensureEnoughBuffers=function(t){if(this._buffers.length){for(var e=0;e<this._buffers.length;e++)this._buffers[e].destroy();this._buffers.length=0}if(this._dataArray.length&&(this._dataArray.length=0),this._realTimeTextureMode)for(var i=0;i<t;i++){var n=VY.WIDTH;this._dataArray[i]=new Float32Array(12*n)}else for(var r=0;r<t;r++){this._buffers[r]=this._device.createBuffer(new ud(18,3,$b.SIZE,$b.SIZE));var s=$b.JOINT_UNIFORM_CAPACITY;this._dataArray[r]=new Float32Array(12*s)}},i._initRealTimeJointTexture=function(){if(this._realTimeJointTexture._textures.length&&(this._realTimeJointTexture._textures.forEach((function(t){t.destroy()})),this._realTimeJointTexture._textures.length=0),this._realTimeJointTexture._buffers.length=0,this._realTimeTextureMode){var t=YE.root.device,e=VY.WIDTH,i=VY.HEIGHT;!(2&t.getFormatFeatures(44))&&(this._realTimeJointTexture._format=35,e=4*VY.WIDTH);for(var n=this._realTimeJointTexture._textures,r=this._realTimeJointTexture._buffers,s=this._realTimeJointTexture._format,a=0;a<this._dataArray.length;a++){r[a]=new Float32Array(4*VY.HEIGHT*VY.WIDTH);var o=r[a],h=44===s?o:new Uint8Array(o.buffer),u=new Hm({width:e,height:i,_data:h,_compressed:!1,format:s}),l=new Ey;l.setFilters(1,1),l.setMipFilter(0),l.setWrapMode(2,2,2),l.image=u,n[a]=l}}},i._bindRealTimeJointTexture=function(t,e){if(this._realTimeTextureMode){var i=this._realTimeJointTexture._textures[t];if(i){var n=i.getGFXTexture(),r=i.getGFXSampler();e.bindTexture(7,n),e.bindSampler(7,r)}}},i._updateRealTimeJointTextureBuffer=function(){if(this._realTimeTextureMode)for(var t=this._realTimeJointTexture._textures,e=this._realTimeJointTexture._buffers,i=0;i<t.length;i++){for(var n=e[i],r=this._dataArray[i],s=r.length/12,a=0,o=0,h=0;h<s;h++)o=4*h,n[o++]=r[a++],n[o++]=r[a++],n[o++]=r[a++],n[o++]=r[a++],o=4*(h+VY.WIDTH),n[o++]=r[a++],n[o++]=r[a++],n[o++]=r[a++],n[o++]=r[a++],o=4*(h+2*VY.WIDTH),n[o++]=r[a++],n[o++]=r[a++],n[o++]=r[a++],n[o++]=r[a++];var u=44===this._realTimeJointTexture._format?n:new Uint8Array(n.buffer);t[i].uploadData(u)}},e}(KW),yJ=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_BAKED_ANIMATION",value:!0}],vJ=function(t){function e(){var e;(e=t.call(this)||this).uploadedAnim=void 0,e._jointsMedium=void 0,e._skeleton=null,e._mesh=null,e._dataPoolManager=void 0,e._instAnimInfoIdx=-1,e.type=2,e._dataPoolManager=A.director.root.dataPoolManager;var i=new Float32Array(4),n=e._dataPoolManager.jointAnimationInfo.getData();return e._jointsMedium={buffer:null,jointTextureInfo:i,animInfo:n,texture:null,boundsInfo:null},e}s(e,t);var i=e.prototype;return i.destroy=function(){this.uploadedAnim=void 0,this._jointsMedium.boundsInfo=null,this._jointsMedium.buffer&&(this._jointsMedium.buffer.destroy(),this._jointsMedium.buffer=null),this._applyJointTexture(),t.prototype.destroy.call(this)},i.bindSkeleton=function(t,e,i){if(void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),this._skeleton=t,this._mesh=i,t&&e&&i){this.transform=e;var n=this._dataPoolManager;this._jointsMedium.animInfo=n.jointAnimationInfo.getData(e.uuid),this._jointsMedium.buffer||(this._jointsMedium.buffer=this._device.createBuffer(new ud(18,1,Kb.SIZE,Kb.SIZE)))}},i.updateTransform=function(e){if(t.prototype.updateTransform.call(this,e),this.uploadedAnim){var i=this._jointsMedium,n=i.animInfo,r=i.boundsInfo[n.data[0]],s=this._worldBounds;if(s&&r){var a=this.transform;r.transform(a._mat,a._pos,a._rot,a._scale,s)}}},i.updateUBOs=function(e){t.prototype.updateUBOs.call(this,e);for(var i=this._jointsMedium.animInfo,n=!1,r=this._instAnimInfoIdx,s=0;s<this._subModels.length;s++){var a=this._subModels[s];r>=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(yJ):yJ},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<this._subModels.length;++a)this._subModels[a].descriptorSet.bindTexture(7,s)}},i._updateLocalDescriptors=function(e,i){t.prototype._updateLocalDescriptors.call(this,e,i);var n=this._jointsMedium,r=n.buffer,s=n.texture,a=n.animInfo;if(i.bindBuffer(Kb.BINDING,r),i.bindBuffer(Qb.BINDING,a.buffer),s){var o=this._device.getSampler(lY);i.bindTexture(7,s.handle.texture),i.bindSampler(7,o)}},i._updateInstancedAttributes=function(e,i){t.prototype._updateInstancedAttributes.call(this,e,i),this._instAnimInfoIdx=i.getInstancedAttributeIndex(Zb),this.updateInstancedJointTextureInfo()},i.updateInstancedJointTextureInfo=function(){for(var t=this._jointsMedium,e=t.jointTextureInfo,i=t.animInfo,n=this._instAnimInfoIdx,r=0;r<this._subModels.length;r++){var s=this._subModels[r].instancedAttributeBlock.views;if(n>=0&&s.length>0){var a=s[n];a[0]=i.data[0],a[1]=e[1],a[2]=e[2]}}},e}(KW),bJ=t("aj",(NY=Kh("cc.SkinnedMeshRenderer"),zY=Zh(100),UY=Ou(kj),GY=Ou(eb),HY=Ou(kj),WY=Ou(eb),NY(jY=zY((qY=function(t){function e(){var e;return(e=t.call(this)||this)._skeleton=XY&&XY(),e._skinningRoot=YY&&YY(),e._clip=null,e.associatedAnimation=null,e._modelType=vJ,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?vJ:gJ;(e||this._modelType!==i)&&(this._modelType=i,this._model&&(A.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===gJ&&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}(mj),XY=zh(qY.prototype,"_skeleton",[UY],(function(){return null})),YY=zh(qY.prototype,"_skinningRoot",[GY],(function(){return null})),v(qY.prototype,"skeleton",[HY],Object.getOwnPropertyDescriptor(qY.prototype,"skeleton"),qY.prototype),v(qY.prototype,"skinningRoot",[WY],Object.getOwnPropertyDescriptor(qY.prototype,"skinningRoot"),qY.prototype),jY=qY))||jY)||jY)),SJ=new Cd("a_batch_id",11),wJ=new Cd("a_batch_uv",21),xJ=ip[SJ.format].size+ip[wJ.format].size,TJ=t("al",(JY=Kh("cc.SkinnedMeshUnit"),KY=Ou(Pk),QY=Ou(kj),ZY=Ou(GT),$Y=Ou(bJ),JY((eJ=function(){function t(){this.mesh=iJ&&iJ(),this.skeleton=nJ&&nJ(),this.material=rJ&&rJ(),this._localTransform=sJ&&sJ(),this._offset=aJ&&aJ(),this._size=oJ&&oJ()}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&&uY(t.node,t.skinningRoot,this._localTransform))}}]),t}(),iJ=zh(eJ.prototype,"mesh",[KY],(function(){return null})),nJ=zh(eJ.prototype,"skeleton",[QY],(function(){return null})),rJ=zh(eJ.prototype,"material",[ZY],(function(){return null})),sJ=zh(eJ.prototype,"_localTransform",[uu],(function(){return new Kr})),aJ=zh(eJ.prototype,"_offset",[uu],(function(){return new ds(0,0)})),oJ=zh(eJ.prototype,"_size",[uu],(function(){return new ds(1,1)})),v(eJ.prototype,"copyFrom",[$Y],Object.getOwnPropertyDescriptor(eJ.prototype,"copyFrom"),eJ.prototype),tJ=eJ))||tJ)),AJ=new Kr;new Kr;var CJ,DJ,BJ,IJ,MJ,PJ,EJ,OJ,kJ,RJ,FJ,LJ,VJ,NJ,zJ,UJ,GJ,HJ=new ir,WJ=t("ak",(hJ=Kh("cc.SkinnedMeshBatchRenderer"),uJ=Zh(100),lJ=Ou([_i]),cJ=Ou([TJ]),hJ(fJ=uJ((_J=function(t){function e(){var e;return(e=t.call(this)||this).atlasSize=dJ&&dJ(),e.batchableTextureNames=pJ&&pJ(),e.units=mJ&&mJ(),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<t.units.length;o++){var h=t.units[o];h.material&&a.push(h.material.getProperty(i.slice(0,-3),n))}e.setProperty(i,a,n)}};for(var a in r.properties)s(a)},r=0;r<i.passes.length;r++)n(r)}else Y("incomplete batch material!")},i.cookSkeletons=function(){if(this._skinningRoot){for(var t=[],e=[],i=0;i<this.units.length;i++){var n=this.units[i];if(n&&n.skeleton){var r=n.skeleton;Kr.invert(AJ,n._localTransform);for(var s=function(){var i=r.joints[a];if(t.findIndex((function(t){return t===i}))>=0)return 1;t.push(i),e.push(Kr.multiply(new Kr,r.bindposes[a]||Kr.IDENTITY,AJ))},a=0;a<r.joints.length;a++)s()}}var o=Array.from(Array(t.length).keys()).sort((function(e,i){return t[e]>t[i]?1:t[e]<t[i]?-1:0})),h=new kj;h.joints=t.map((function(t,e,i){return i[o[e]]})),h.bindposes=e.map((function(t,e,i){return i[o[e]]})),this._skeleton&&this._skeleton.destroy(),this.skeleton=h}else Y("no skinning root specified!")},i.cookMeshes=function(){for(var t=this,e=!1,i=0;i<this.units.length;i++)if(this.units[i].mesh){e=!0;break}if(e&&this._skinningRoot){this._mesh?this._mesh.destroyRenderingMesh():this._mesh=new Pk;for(var n=0,r=0,s=0,a=0,o=0,h=0,u=0,l=0,c=0,f=0,_=new Array(this.units.length),d=this.units.length,p=0;p<d;p++){var m=this.units[p];m&&m.skeleton&&(_[p]=m.skeleton.joints.map((function(e){return t._skeleton.joints.findIndex((function(t){return e===t}))})))}for(var g=function(){var e=t.units[y];if(!e||!e.mesh||!e.mesh.data)return 1;var i=t._createUnitMesh(y,e.mesh),d=new DataView(i.data.buffer);Kr.invert(AJ,e._localTransform),Kr.transpose(AJ,AJ);for(var p=e.offset,m=e.size,g=function(){var t=i.struct.vertexBundles[v];n=t.view.offset,r=0;for(var g=0;g<t.attributes.length;g++){var b=t.attributes[g];if("a_position"===b.name){r=b.format;break}n+=ip[b.format].size}if(r){for(var S=eO(d,r,n,t.view.length,t.view.stride),w=0;w<S.length;w+=3)ir.fromArray(HJ,S,w),ir.transformMat4(HJ,HJ,e._localTransform),ir.toArray(S,HJ,w);tO(d,S,r,n,t.view.stride)}s=t.view.offset,a=0;for(var x=0;x<t.attributes.length;x++){var T=t.attributes[x];if("a_normal"===T.name){a=T.format;break}s+=ip[T.format].size}if(a){for(var A=eO(d,a,s,t.view.length,t.view.stride),C=0;C<A.length;C+=3)ir.fromArray(HJ,A,C),ir.transformMat4Normal(HJ,HJ,AJ),ir.toArray(A,HJ,C);tO(d,A,a,s,t.view.stride)}o=t.view.offset,h=0;for(var D=0;D<t.attributes.length;D++){var B=t.attributes[D];if("a_tangent"===B.name){h=B.format;break}o+=ip[B.format].size}if(h){for(var I=eO(d,h,o,t.view.length,t.view.stride),M=0;M<I.length;M+=3)ir.fromArray(HJ,I,M),ir.transformMat4Normal(HJ,HJ,AJ),ir.toArray(I,HJ,M);tO(d,I,h,o,t.view.stride)}u=t.view.offset,l=0;for(var P=0;P<t.attributes.length;P++){var E=t.attributes[P];if("a_batch_uv"===E.name){l=E.format;break}u+=ip[E.format].size}l&&iO(d,(function(t,e){var i,n=0===e?"x":"y";return(t=(i=t)-Math.floor(i))*m[n]+p[n]}),l,u,t.view.length,t.view.stride,d);var O=_[y];if(!O)return 1;c=t.view.offset,f=0;for(var k=0;k<t.attributes.length;k++){var R=t.attributes[k];if("a_joints"===R.name){f=R.format;break}c+=ip[R.format].size}f&&iO(d,(function(t){return O[t]}),f,c,t.view.length,t.view.stride,d)},v=0;v<i.struct.vertexBundles.length;v++)g();t._mesh.merge(i)},y=0;y<d;y++)g();this._onMeshChanged(this._mesh),this._updateModels()}},i.cookTextures=function(t,e,i){for(var n=[],r=[],s=[],a=[],o=0;o<this.units.length;o++){var h=this.units[o];if(h.material){var u=h.material.getProperty(e,i);if(u&&u.image&&u.image.data){var l=new id;l.texOffset.x=h.offset.x*this.atlasSize,l.texOffset.y=h.offset.y*this.atlasSize,l.texExtent.width=h.size.x*this.atlasSize,l.texExtent.height=h.size.y*this.atlasSize;var c=u.image.data;ArrayBuffer.isView(c)?(s.push(c),a.push(l)):(n.push(c),r.push(l))}}}var f=t.getGFXTexture(),_=A.director.root.device;s.length>0&&_.copyBuffersToTexture(s,f,a),n.length>0&&_.copyTexImagesToTexture(n,f,r)},i.createTexture=function(t){var e=new Ey;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;r<e.struct.primitives.length;r++){for(var s=e.struct.primitives[r],a=0,o=0,h=0;h<s.vertexBundelIndices.length;h++){var u=e.struct.vertexBundles[s.vertexBundelIndices[h]];a=u.view.offset,o=0;for(var l=0;l<u.attributes.length;l++){var c=u.attributes[l];if("a_texCoord"===c.name){o=c.format;break}a+=ip[c.format].size}if(o)break}if(void 0===n[h]){n[h]=[o,a];var f=i.vertexBundles[h];f.attributes.push(SJ),f.attributes.push(wJ),f.view.offset=0,f.view.length+=f.view.count*xJ,f.view.stride+=xJ}}for(var _=0,d=0;d<i.vertexBundles.length;d++)_+=i.vertexBundles[d].view.length;for(var p=0;p<i.primitives.length;p++){var m=i.primitives[p];m.indexView&&(m.indexView.offset=_,_+=m.indexView.length)}var g=new Uint8Array(_),y=e.data,v=new DataView(g.buffer),b=new DataView(y.buffer),S=A.sys.isLittleEndian;for(var w in n)for(var x=i.vertexBundles[w],T=e.struct.vertexBundles[w],C=n[w],D=eO(b,C[0],C[1],T.view.length,T.view.stride),B=T.view,I=x.view,M=B.stride,P=I.stride,E=B.offset,O=I.offset,k=0;k<I.count;k++){var R=y.subarray(E,E+M);g.set(R,O),v.setFloat32(O+M,t),v.setFloat32(O+M+4,D[2*k],S),v.setFloat32(O+M+8,D[2*k+1],S),O+=P,E+=M}for(var F=0;F<i.primitives.length;F++){var L=e.struct.primitives[F],V=i.primitives[F];if(L.indexView&&V.indexView)for(var N=L.indexView.stride,z=V.indexView.stride,U=L.indexView.offset,G=V.indexView.offset,H=0;H<V.indexView.count;H++){var W=y.subarray(U,U+N);g.set(W,G),G+=z,U+=N}}var j=new Pk;return j.reset({struct:i,data:g}),j},n(e,[{key:"mesh",get:function(){return t.prototype.mesh},set:function(t){this.mesh=t}},{key:"skeleton",get:function(){return t.prototype.skeleton},set:function(t){this.skeleton=t}}]),e}(bJ),dJ=zh(_J.prototype,"atlasSize",[uu],(function(){return 1024})),pJ=zh(_J.prototype,"batchableTextureNames",[lJ,uu],(function(){return[]})),mJ=zh(_J.prototype,"units",[cJ,uu],(function(){return[]})),v(_J.prototype,"mesh",[Gu],Object.getOwnPropertyDescriptor(_J.prototype,"mesh"),_J.prototype),v(_J.prototype,"skeleton",[Gu],Object.getOwnPropertyDescriptor(_J.prototype,"skeleton"),_J.prototype),fJ=_J))||fJ)||fJ));A.SkinningModelComponent=bJ,le(bJ,"cc.SkinningModelComponent"),A.SkinningModelUnit=TJ,le(TJ,"cc.SkinningModelUnit"),A.BatchedSkinningModelComponent=WJ,le(WJ,"cc.BatchedSkinningModelComponent");var jJ=[.25,.125,.01],qJ=t("am",(CJ=Kh("cc.LOD"),DJ=Ou([mj]),BJ=Ou(ci),IJ=Ou([mj]),MJ=Ou([li]),CJ((EJ=function(){function t(){this._screenUsagePercentage=OJ&&OJ(),this._renderers=kJ&&kJ(),this._LODData=new MP,this._modelAddedCallback=void 0,this._LODData.screenUsagePercentage=this._screenUsagePercentage,this._modelAddedCallback=null}var e=t.prototype;return e.insertRenderer=function(t,e){(t<0||t>this._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?J("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;i<t.length;i++){var n;this._renderers[i]=t[i];var r=null==(n=t[i])?void 0:n.model;r&&(e=!0,this._LODData.addModel(r))}this._modelAddedCallback&&e&&this._modelAddedCallback()}}},{key:"triangleCount",get:function(){var t=[];return this._renderers.forEach((function(e){var i=0;if(e&&e.mesh){var n=e.mesh.struct.primitives;null==n||n.forEach((function(t){t&&t.indexView&&(i+=t.indexView.count)}))}t.push(i/3)})),t}},{key:"rendererCount",get:function(){return this._renderers.length}},{key:"lodData",get:function(){return this._LODData}},{key:"modelAddedCallback",set:function(t){this._modelAddedCallback=t}}]),t}(),OJ=zh(EJ.prototype,"_screenUsagePercentage",[uu],(function(){return 1})),kJ=zh(EJ.prototype,"_renderers",[DJ,uu],(function(){return[]})),v(EJ.prototype,"screenUsagePercentage",[BJ],Object.getOwnPropertyDescriptor(EJ.prototype,"screenUsagePercentage"),EJ.prototype),v(EJ.prototype,"renderers",[IJ],Object.getOwnPropertyDescriptor(EJ.prototype,"renderers"),EJ.prototype),v(EJ.prototype,"triangleCount",[MJ],Object.getOwnPropertyDescriptor(EJ.prototype,"triangleCount"),EJ.prototype),PJ=EJ))||PJ)),XJ=(t("an",(RJ=Kh("cc.LODGroup"),FJ=Ou(ci),LJ=Ou([qJ]),RJ((NJ=function(t){function e(){var e;return(e=t.call(this)||this)._localBoundaryCenter=zJ&&zJ(),e._objectSize=UJ&&UJ(),e._LODs=GJ&&GJ(),e._lodGroup=new PP,e._eventRegistered=!1,e._forceUsedLevels=[],e}s(e,t);var i=e.prototype;return i.onLodModelAddedCallback=function(){0===this.objectSize&&this.recalculateBounds()},i.insertLOD=function(t,e,i){if((t<0||t>this.lodCount)&&(t=this.lodCount),i||(i=new qJ),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=jJ[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;r<this.lodCount;++r){var s=this.getLOD(r);if(s)for(var a=0;a<s.rendererCount;++a){var o,h,u=s.getRenderer(a);if(u){null==(o=u.model)||o.updateWorldBound();var l=null==(h=u.model)?void 0:h.worldBounds;l&&(l.getBoundary(t,e),i?(ir.min(i,i,t),ir.max(n,n,e)):(i=t.clone(),n=e.clone()))}}}if(i){var c=i,f=new ir(.5*(n.x+c.x),.5*(n.y+c.y),.5*(n.z+c.z)),_=new ir(.5*(n.x-c.x),.5*(n.y-c.y),.5*(n.z-c.z)),d=function(t,e,i){var n,r,s=new Array(new ir(t.x-e.x,t.y-e.y,t.z-e.z),new ir(t.x-e.x,t.y+e.y,t.z-e.z),new ir(t.x+e.x,t.y+e.y,t.z-e.z),new ir(t.x+e.x,t.y-e.y,t.z-e.z),new ir(t.x-e.x,t.y-e.y,t.z+e.z),new ir(t.x-e.x,t.y+e.y,t.z+e.z),new ir(t.x+e.x,t.y+e.y,t.z+e.z),new ir(t.x+e.x,t.y-e.y,t.z+e.z));r=(n=s[0].transformMat4(i)).clone();for(var a=1;a<8;++a){var o=s[a].transformMat4(i);n=ir.min(n,n,o),r=ir.max(r,r,o)}return[n,r]}(f,_,this.node.worldMatrix.clone().invert()),p=d[0],m=d[1];f.set(.5*(m.x+p.x),.5*(m.y+p.y),.5*(m.z+p.z)),_.set(.5*(m.x-p.x),.5*(m.y-p.y),.5*(m.z-p.z)),this.localBoundaryCenter=f,this.objectSize=2*Math.max(_.x,_.y,_.z)}else this.localBoundaryCenter=new ir(0,0,0),this.objectSize=0;this._emitChangeNode(this.node)},i.resetObjectSize=function(){if(1!==this.objectSize){0===this.objectSize&&(this.objectSize=1);var t=1/this.objectSize;this.objectSize=1;for(var e=0;e<this.lodCount;++e){var i=this.getLOD(e);i&&(i.screenUsagePercentage*=t)}this._emitChangeNode(this.node)}},i.forceLOD=function(t){this._forceUsedLevels=t<0?[]:[t],this.lodGroup.lockLODLevels(this._forceUsedLevels)},i.forceLODs=function(){},i.onLoad=function(){this._lodGroup.node=this.node,this._lodGroup.objectSize=this._objectSize,this._lodGroup.localBoundaryCenter=this._localBoundaryCenter,this._eventRegistered||(this.node.on("component-removed",this._onRemove,this),this._eventRegistered=!0),this._constructLOD()},i._onRemove=function(t){t===this&&this.onDisable()},i._constructLOD=function(){if(this.lodCount<1)for(var t=jJ.length,e=0;e<t;e++)this.insertLOD(e,jJ[e])},i.onRestore=function(){this._constructLOD(),this.enabledInHierarchy&&this._attachToScene()},i.onEnable=function(){var t=this;this._attachToScene(),0===this.objectSize&&this.recalculateBounds(),this.lodGroup.lockLODLevels(this._forceUsedLevels),this.lodCount>0&&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;r<n.length;r++){var s=e.lodData,a=n[r];s&&a&&a.model&&s.addModel(a.model)}t._lodGroup.insertLOD(i,e.lodData)}))},i.onDisable=function(){this._detachFromScene(),this.lodGroup.lockLODLevels([])},i._attachToScene=function(){if(this.node&&this.node.scene){var t=this._getRenderScene();this._lodGroup.scene&&this._detachFromScene(),t.addLODGroup(this._lodGroup)}},i._detachFromScene=function(){this._lodGroup.scene&&this._lodGroup.scene.removeLODGroup(this._lodGroup)},i._emitChangeNode=function(){},i._updateDataToScene=function(){this._detachFromScene(),this._attachToScene()},n(e,[{key:"localBoundaryCenter",get:function(){return this._localBoundaryCenter.clone()},set:function(t){this._localBoundaryCenter.set(t),this._lodGroup.localBoundaryCenter=t}},{key:"lodCount",get:function(){return this._LODs.length}},{key:"objectSize",get:function(){return this._objectSize},set:function(t){this._objectSize=t,this._lodGroup.objectSize=t}},{key:"LODs",get:function(){return this._LODs},set:function(t){var e=this;t!==this._LODs?(this._LODs.length=0,this.lodGroup.clearLODs(),t.forEach((function(t,i){e.lodGroup.insertLOD(i,t.lodData),e._LODs[i]=t,t.modelAddedCallback=e.onLodModelAddedCallback.bind(e)})),this._updateDataToScene()):this._updateDataToScene()}},{key:"lodGroup",get:function(){return this._lodGroup}}]),e}(yg),zJ=zh(NJ.prototype,"_localBoundaryCenter",[uu],(function(){return new ir(0,0,0)})),UJ=zh(NJ.prototype,"_objectSize",[uu],(function(){return 0})),GJ=zh(NJ.prototype,"_LODs",[uu],(function(){return[]})),v(NJ.prototype,"objectSize",[FJ],Object.getOwnPropertyDescriptor(NJ.prototype,"objectSize"),NJ.prototype),v(NJ.prototype,"LODs",[LJ],Object.getOwnPropertyDescriptor(NJ.prototype,"LODs"),NJ.prototype),VJ=NJ))||VJ)),Ly.makeMaskExclude([Ly.BitMask.UI_2D,Ly.BitMask.UI_3D,Ly.BitMask.GIZMOS,Ly.BitMask.EDITOR,Ly.BitMask.SCENE_GIZMO,Ly.BitMask.PROFILER,Ly.Enum.IGNORE_RAYCAST])),YJ=t("ap",function(){function t(){this._probes=[],this._useCubeModels=new Map,this._usePlanarModels=new Map,this._updateForRuntime=!0,this._dataTexture=null,this._registeredEvent=!1}var e=t.prototype;return e.registerEvent=function(){this._registeredEvent||(A.director.on(A.DirectorEvent.BEFORE_UPDATE,this.onUpdateProbes,this),this._registeredEvent=!0)},e.onUpdateProbes=function(){if(0!==this._probes.length){var t=A.director.getScene();if(t&&t.renderScene)for(var e=t.renderScene.models,i=0;i<e.length;i++){var n=e[i];n.node&&n.node.layer&XJ&&(1===n.reflectionProbeType||this._isUsedBlending(n)?this.selectReflectionProbe(n):2===n.reflectionProbeType&&this.selectPlanarReflectionProbe(n))}}},e.filterModelsForPlanarReflection=function(){if(0!==this._probes.length){var t=A.director.getScene();if(t&&t.renderScene)for(var e=t.renderScene.models,i=0;i<e.length;i++){var n=e[i];n.node&&n.node.layer&XJ&&2===n.reflectionProbeType&&this.selectPlanarReflectionProbe(n)}}},e.clearPlanarReflectionMap=function(t){for(var e,i=p(this._usePlanarModels.entries());!(e=i()).done;){var n=e.value;n[1]===t&&this._updatePlanarMapOfModel(n[0],null,null)}},e.register=function(t){-1===this._probes.indexOf(t)&&(this._probes.push(t),this.updateProbeData())},e.unregister=function(t){for(var e=0;e<this._probes.length;e++)if(this._probes[e]===t){var i=this._probes.splice(e,1);i[0]&&this._removeDependentModels(i[0]);break}this.updateProbeData()},e.exists=function(t){if(0===this._probes.length)return!1;for(var e=0;e<this._probes.length;e++)if(this._probes[e].getProbeId()===t)return!0;return!1},e.getNewReflectionProbeId=function(){for(var t=0;;){if(!this.exists(t))return t;t++}},e.getProbes=function(){return this._probes},e.getProbeById=function(t){for(var e=0;e<this._probes.length;e++)if(this._probes[e].getProbeId()===t)return this._probes[e];return null},e.clearAll=function(){this._probes=[]},e.getProbeByCamera=function(t){for(var e=0;e<this._probes.length;e++)if(this._probes[e].camera===t)return this._probes[e];return null},e.updateBakedCubemap=function(t){var e=this._getModelsByProbe(t);if(t.cubemap){for(var i=0;i<e.length;i++){var n=e[i];this._updateCubemapOfModel(n,t)}if(t.needRefresh=!1,0===e.length)for(var r,s=p(this._useCubeModels.entries());!(r=s()).done;){var a=r.value;a[0].reflectionProbeBlendId===t.getProbeId()&&this._updateBlendCubemap(a[0],t)}}},e.updatePlanarMap=function(t,e){if(t.node&&t.node.scene){for(var i=this._getModelsByProbe(t),n=0;n<i.length;n++)this._updatePlanarMapOfModel(i[n],e,t);if(t.previewPlane){var r=t.previewPlane.getComponent(mj);r&&r.updateProbePlanarMap(e)}}},e.selectPlanarReflectionProbe=function(t){if(t.node&&t.worldBounds&&2===t.reflectionProbeType){for(var e=0;e<this._probes.length;e++){var i=this._probes[e];1===i.probeType&&t.node.layer&XJ&&(t.updateWorldBound(),Za.aabbWithAABB(t.worldBounds,i.boundingBox)?this._usePlanarModels.set(t,i):this._usePlanarModels.has(t)&&this._usePlanarModels.get(t)===i&&(this._usePlanarModels.delete(t),this._updatePlanarMapOfModel(t,null,null)))}for(var n=0;n<this._probes.length;n++)1===this._probes[n].probeType&&(this._probes[n].realtimePlanarTexture?this.updatePlanarMap(this._probes[n],this._probes[n].realtimePlanarTexture.getGFXTexture()):this.updatePlanarMap(this._probes[n],null))}},e.selectReflectionProbe=function(t){if(t.node&&t.worldBounds&&t.node.layer&XJ){t.updateWorldBound();var e=this._getNearestProbe(t);e?this._useCubeModels.has(t)?(this._useCubeModels.get(t)!==e&&this._useCubeModels.set(t,e),e.needRefresh=!0):(this._useCubeModels.set(t,e),e.needRefresh=!0):(this._updateCubemapOfModel(t,null),this._useCubeModels.delete(t))}for(var i=0;i<this._probes.length;i++)(this._probes[i].needRefresh&&0===this._probes[i].probeType||this._isUsedBlending(t))&&this.updateBakedCubemap(this._probes[i])},e.updatePreviewSphere=function(t){if(t&&t.previewSphere){var e=t.previewSphere.getComponent(mj);e&&(e.updateProbeCubemap(t.cubemap),e.updateReflectionProbeId(t.getProbeId()))}},e.updatePreviewPlane=function(t){t&&t.previewPlane&&t.previewPlane.getComponent(mj)&&t.realtimePlanarTexture&&this.updatePlanarMap(t,t.realtimePlanarTexture.getGFXTexture())},e.updateProbeData=function(){if(0!==this._probes.length){var t=this.getMaxProbeId(),e=t+1;this._dataTexture&&this._dataTexture.destroy();for(var i=new Float32Array(12*e),n=0,r=0;r<=t;r++){var s=this.getProbeById(r);if(s){if(0===s.probeType){i[n]=s.node.worldPosition.x,i[n+1]=s.node.worldPosition.y,i[n+2]=s.node.worldPosition.z,i[n+3]=0,i[n+4]=s.size.x,i[n+5]=s.size.y,i[n+6]=s.size.z,i[n+7]=0;var a=s.isRGBE()?1e3:0;i[n+8]=s.cubemap?s.cubemap.mipmapLevel+a:1+a}else i[n]=s.node.up.x,i[n+1]=s.node.up.y,i[n+2]=s.node.up.z,i[n+3]=1,i[n+4]=1,i[n+5]=1,i[n+6]=0,i[n+7]=0,i[n+8]=1;n+=12}else n+=12}var o=new Uint8Array(i.buffer),h=new Hm({_data:o,_compressed:!1,width:12,height:e,format:35});this._dataTexture=new Ey,this._dataTexture.setFilters(0,0),this._dataTexture.setMipFilter(0),this._dataTexture.setWrapMode(2,2,2),this._dataTexture.image=h,this._dataTexture.uploadData(o);for(var u=0;u<this._probes.length;u++)for(var l=this._probes[u],c=this._getModelsByProbe(l),f=0;f<c.length;f++){var _=c[f].node.getComponent(mj);_&&_.updateReflectionProbeDataMap(this._dataTexture)}}},e.getMaxProbeId=function(){return 0===this._probes.length?-1:1===this._probes.length?this._probes[0].getProbeId():(this._probes.sort((function(t,e){return t.getProbeId()-e.getProbeId()})),this._probes[this._probes.length-1].getProbeId())},e.getUsedReflectionProbe=function(t,e){if(e){if(this._usePlanarModels.has(t))return this._usePlanarModels.get(t)}else if(this._useCubeModels.has(t))return this._useCubeModels.get(t);return null},e.setReflectionProbe=function(t,e,i){void 0===i&&(i=null),e&&(this._useCubeModels.set(t,e),this._updateCubemapOfModel(t,e),i&&this._updateBlendProbeInfo(t,e,i))},e.updateProbeOfModels=function(){if(0!==this._probes.length){var t=A.director.getScene();if(t&&t.renderScene)for(var e=t.renderScene.models,i=0;i<e.length;i++){var n=e[i];n.node&&n.node.layer&XJ&&(1===n.reflectionProbeType||2===n.reflectionProbeType||this._isUsedBlending(n))&&n.updateReflectionProbeId()}}},e._getNearestProbe=function(t){if(!t.node||!t.worldBounds||0===this._probes.length)return null;for(var e,i=null,n=1/0,r=p(this._probes);!(e=r()).done;){var s=e.value;if(0===s.probeType&&s.validate()&&Za.aabbWithAABB(t.worldBounds,s.boundingBox)){var a=ir.distance(t.node.worldPosition,s.node.worldPosition);a<n&&(n=a,i=s)}}return i},e._getBlendProbe=function(t){if(!t||!t.node||!t.worldBounds||this._probes.length<2)return null;for(var e=[],i=0;i<this._probes.length;i++)0===this._probes[i].probeType&&this._probes[i].validate()&&Za.aabbWithAABB(t.worldBounds,this._probes[i].boundingBox)&&e.push(this._probes[i]);return e.sort((function(e,i){return ir.distance(t.node.worldPosition,e.node.worldPosition)-ir.distance(t.node.worldPosition,i.node.worldPosition)})),e.length>1?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(mj);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(mj);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(mj);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(mj);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,_=[];if(!o){var d=n.x-s.x;_.push(d/a.x)}if(!h){var p=Math.abs(i.x-r.x);_.push(p/a.x)}if(!u){var m=n.y-s.y;_.push(m/a.y)}if(!l){var g=Math.abs(i.y-r.y);_.push(g/a.y)}if(!c){var y=n.z-s.z;_.push(y/a.z)}if(!f){var v=Math.abs(i.z-r.z);_.push(v/a.z)}return _.length>0?(_.sort((function(t,e){return e-t})),_[0]):0}return 1},n(t,[{key:"updateForRuntime",get:function(){return this._updateForRuntime},set:function(t){this._updateForRuntime=t}}]),t}());function JJ(t){return void 0===(t=t||{}).includeNormal&&(t.includeNormal=!0),void 0===t.includeUV&&(t.includeUV=!0),t}YJ.probeManager=void 0,YJ.probeManager=new YJ,A.internal.reflectionProbeManager=YJ.probeManager;var KJ=new ir,QJ=new ir,ZJ=new ir,$J=new ir,tK=new ir,eK=new ir,iK=new ir,nK=new ir,rK=new ir,sK=new ir,aK=new ir,oK=new ir,hK=new ir(0,0,0),uK=new ir(0,0,0);function lK(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),_=new Array(3*l),d=new Array(3*l),p=new Array(2*l),m=Math.max(t,e),g=new ir(-m,-r,-m),y=new ir(m,r,m),v=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,y=0;y<=s;++y){var v=y/s,w=v*h,x=Math.sin(w),T=Math.cos(w);_[3*b]=g*x,_[3*b+1]=m*i-r,_[3*b+2]=g*T,ir.normalize(hK,ir.set(uK,x,-u,T)),d[3*b]=hK.x,d[3*b+1]=hK.y,d[3*b+2]=hK.z,p[2*b]=2*(1-v)%1,p[2*b+1]=m,c.push(b),++b}n.push(c)}for(var A=0;A<a;++A)for(var C=0;C<s;++C){var D=n[A][C],B=n[A+1][C],I=n[A+1][C+1],M=n[A][C+1];f[S]=D,++S,f[S]=M,++S,f[S]=B,++S,f[S]=M,++S,f[S]=I,++S,f[S]=B,++S}}(),o&&(e>0&&w(!1),t>0&&w(!0)),{positions:_,normals:d,uvs:p,indices:f,minPos:g,maxPos:y,boundingRadius:v};function w(i){for(var n=i?t:e,a=i?1:-1,o=b,u=1;u<=s;++u)_[3*b]=0,_[3*b+1]=r*a,_[3*b+2]=0,d[3*b]=0,d[3*b+1]=a,d[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),y=Math.sin(m);_[3*b]=n*y,_[3*b+1]=r*a,_[3*b+2]=n*g,d[3*b]=0,d[3*b+1]=a,d[3*b+2]=0,p[2*b]=.5-.5*y*a,p[2*b+1]=.5+.5*g,++b}for(var v=0;v<s;++v){var w=o+v,x=l+v;i?(f[S]=x+1,++S,f[S]=w,++S,f[S]=x,++S):(f[S]=w,++S,f[S]=x+1,++S,f[S]=x,++S)}}}function cK(t){return(t=JJ(t)).width=t.width||10,t.length=t.length||10,t.widthSegments=t.widthSegments||10,t.lengthSegments=t.lengthSegments||10,t}var fK=new ir(0,0,0),_K=new ir(0,0,0),dK=new ir(0,0,0),pK=new ir(0,0,0),mK=new ir(0,0,0),gK=new ir(0,0,0),yK=new ir(0,0,0),vK=new ir(0,0,0),bK=new ir(0,0,0);function SK(t){return(t=JJ(t)).segments=64,t}var wK=Object.freeze({__proto__:null,applyDefaultGeometryOptions:JJ,box:function(t){var e=(t=t||{}).widthSegments||1,i=t.heightSegments||1,n=t.lengthSegments||1,r=(t.width||1)/2,s=(t.height||1)/2,a=(t.length||1)/2,o=[ir.set(tK,-r,-s,a),ir.set(eK,r,-s,a),ir.set(iK,r,s,a),ir.set(nK,-r,s,a),ir.set(rK,r,-s,-a),ir.set(sK,-r,-s,-a),ir.set(aK,-r,s,-a),ir.set(oK,r,s,-a)],h=[[2,3,1],[4,5,7],[7,6,2],[1,0,4],[1,4,2],[5,0,6]],u=[[0,0,1],[0,0,-1],[0,1,0],[0,-1,0],[1,0,0],[-1,0,0]],l=[[-1,0,0,1],[-1,0,0,1],[-1,0,0,1],[-1,0,0,1],[0,0,-1,1],[0,0,1,1]],c=[],f=[],_=[],d=[],p=[],m=new ir(-r,-s,-a),g=new ir(r,s,a),y=Math.sqrt(r*r+s*s+a*a);function v(t,e,i){var n,r,s,a,m=c.length/3,g=h[t],y=u[t],v=l[t];for(a=0;a<=i;a++)for(s=0;s<=e;s++)if(n=s/e,r=a/i,ir.lerp(KJ,o[g[0]],o[g[1]],n),ir.lerp(QJ,o[g[0]],o[g[2]],r),ir.subtract(ZJ,QJ,o[g[0]]),ir.add($J,KJ,ZJ),c.push($J.x,$J.y,$J.z),f.push(y[0],y[1],y[2]),_.push(n,r),d.push(v[0],v[1],v[2],v[3]),s<e&&a<i){var b=e+1,S=s+a*b,w=s+(a+1)*b,x=s+1+(a+1)*b,T=s+1+a*b;p.push(m+S,m+T,m+w),p.push(m+w,m+T,m+x)}}return v(0,e,i),v(4,n,i),v(1,e,i),v(5,n,i),v(3,e,n),v(2,e,n),{positions:c,normals:f,uvs:_,tangents:d,indices:p,minPos:m,maxPos:g,boundingRadius:y}},capsule:function(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=i-t-e,s=n.sides||32,a=n.heightSegments||32,o=e/i,h=r/i,u=t/i,l=Math.floor(a*o),c=Math.floor(a*u),f=Math.floor(a*h),_=r+e-i/2,d=e-i/2,p=e-i/2,m=n.arc||2*Math.PI,g=[],y=[],v=[],b=[],S=Math.max(t,e),w=new ir(-S,-i/2,-S),x=new ir(S,i/2,S),T=i/2,A=0,C=[];return function(){for(var t=0;t<=l;++t)for(var i=t*Math.PI/l/2,n=Math.sin(i),r=-Math.cos(i),o=0;o<=s;++o){var h=2*o*Math.PI/s-Math.PI/2,u=Math.sin(h)*n,c=r,f=Math.cos(h)*n,_=o/s,d=t/a;if(g.push(u*e,c*e+p,f*e),y.push(u,c,f),v.push(_,d),t<l&&o<s){var m=s+1,S=m*t+o,w=m*(t+1)+o,x=m*(t+1)+o+1,T=m*t+o+1;b.push(S,T,w),b.push(T,x,w)}++A}}(),function(){for(var i=(t-e)/r,n=0;n<=f;n++){for(var a=[],u=n/f,l=u*(t-e)+e,c=0;c<=s;++c){var _=c/s,p=u*h+o,S=_*m-m/4,w=Math.sin(S),x=Math.cos(S);g.push(l*w),g.push(u*r+d),g.push(l*x),ir.normalize(vK,ir.set(bK,w,-i,x)),y.push(vK.x),y.push(vK.y),y.push(vK.z),v.push(_,p),a.push(A),++A}C.push(a)}for(var T=0;T<f;++T)for(var D=0;D<s;++D){var B=C[T][D],I=C[T+1][D],M=C[T+1][D+1],P=C[T][D+1];b.push(B),b.push(P),b.push(I),b.push(P),b.push(M),b.push(I)}}(),function(){for(var e=0;e<=c;++e)for(var i=e*Math.PI/c/2+Math.PI/2,n=Math.sin(i),r=-Math.cos(i),o=0;o<=s;++o){var h=2*o*Math.PI/s-Math.PI/2,l=Math.sin(h)*n,d=r,p=Math.cos(h)*n,m=o/s,S=e/a+(1-u);if(g.push(l*t,d*t+_,p*t),y.push(l,d,p),v.push(m,S),e<c&&o<s){var w=s+1,x=w*e+o+C[f][s]+1,T=w*(e+1)+o+C[f][s]+1,A=w*(e+1)+o+1+C[f][s]+1,D=w*e+o+1+C[f][s]+1;b.push(x,D,T),b.push(D,A,T)}}}(),{positions:g,normals:y,uvs:v,indices:b,minPos:w,maxPos:x,boundingRadius:T}},circle:function(t){var e=SK(t).segments,i=new Array(3*(e+1));i[0]=0,i[1]=0,i[2]=0;var n=new Array(1+2*e);n[0]=0;for(var r=2*Math.PI/e,s=0;s<e;++s){var a=r*s,o=Math.cos(a),h=Math.sin(a),u=3*(s+1);i[u+0]=o,i[u+1]=h,i[u+2]=0;var l=2*s;n[1+l]=s+1,n[1+(l+1)]=s+2}return e>0&&(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={}),lK(0,t,e,i)},cylinder:lK,invWinding:function(t){for(var e=[],i=0;i<t.length;i+=3)e.push(t[i],t[i+2],t[i+1]);return e},normals:function(t,e,i){void 0===i&&(i=1);for(var n=new Array(2*t.length),r=0;r<t.length/3;++r){var s=3*r,a=6*r;n[a+0]=t[s+0],n[a+1]=t[s+1],n[a+2]=t[s+2],n[a+3]=t[s+0]+e[s+0]*i,n[a+4]=t[s+1]+e[s+1]*i,n[a+5]=t[s+2]+e[s+2]*i}return n},plane:function(t){var e=cK(t),i=e.width,n=e.length,r=e.widthSegments,s=e.lengthSegments,a=.5*i,o=.5*n,h=[],u=[],l=[],c=new ir(-a,0,-o),f=new ir(a,0,o),_=Math.sqrt(i*i+n*n);ir.set(mK,-a,0,o),ir.set(gK,a,0,o),ir.set(yK,-a,0,-o);for(var d=0;d<=s;d++)for(var p=0;p<=r;p++){var m=p/r,g=d/s;if(ir.lerp(fK,mK,gK,m),ir.lerp(_K,mK,yK,g),ir.subtract(dK,_K,mK),ir.add(pK,fK,dK),h.push(pK.x,pK.y,pK.z),e.includeUV&&u.push(m,g),p<r&&d<s){var y=r+1,v=p+d*y,b=p+(d+1)*y,S=p+1+(d+1)*y,w=p+1+d*y;l.push(v,w,b),l.push(w,S,b)}}var x={positions:h,indices:l,minPos:c,maxPos:f,boundingRadius:_};if(e.includeNormal){var T=(s+1)*(r+1),A=new Array(3*T);x.normals=A;for(var C=0;C<T;++C)A[3*C+0]=0,A[3*C+1]=1,A[3*C+2]=0}return e.includeUV&&(x.uvs=u),x},quad:function(t){var e=JJ(t),i={positions:[-.5,-.5,0,-.5,.5,0,.5,.5,0,.5,-.5,0],indices:[0,3,1,3,2,1],minPos:{x:-.5,y:-.5,z:0},maxPos:{x:.5,y:.5,z:0},boundingRadius:Math.sqrt(.5)};return!1!==e.includeNormal&&(i.normals=[0,0,1,0,0,1,0,0,1,0,0,1]),!1!==e.includeUV&&(i.uvs=[0,0,0,1,1,1,1,0]),i},scale:function(t,e){for(var i,n,r,s=null!==(i=e.x)&&void 0!==i?i:1,a=null!==(n=e.y)&&void 0!==n?n:1,o=null!==(r=e.z)&&void 0!==r?r:1,h=Math.floor(t.positions.length/3),u=0;u<h;++u){var l=3*u,c=3*u+1,f=3*u+2;t.positions[l]*=s,t.positions[c]*=a,t.positions[f]*=o}var _=t.minPos,d=t.maxPos;if(_&&(_.x*=s,_.y*=a,_.z*=o),d&&(d.x*=s,d.y*=a,d.z*=o),_&&d){if(s<0){var p=_.x;_.x=d.x,d.x=p}if(a<0){var m=_.y;_.y=d.y,d.y=m}if(o<0){var g=_.z;_.z=d.z,d.z=g}}return void 0!==t.boundingRadius&&(t.boundingRadius*=Math.max(Math.max(Math.abs(s),Math.abs(a)),Math.abs(o))),t},sphere:function(t,e){void 0===t&&(t=.5),void 0===e&&(e={});for(var i=void 0!==e.segments?e.segments:32,n=[],r=[],s=[],a=[],o=new ir(-t,-t,-t),h=new ir(t,t,t),u=t,l=0;l<=i;++l)for(var c=l*Math.PI/i,f=Math.sin(c),_=-Math.cos(c),d=0;d<=i;++d){var p=2*d*Math.PI/i-Math.PI/2,m=Math.sin(p)*f,g=_,y=Math.cos(p)*f,v=d/i,b=l/i;if(n.push(m*t,g*t,y*t),r.push(m,g,y),s.push(v,b),l<i&&d<i){var S=i+1,w=S*l+d,x=S*(l+1)+d,T=S*(l+1)+d+1,A=S*l+d+1;a.push(w,A,x),a.push(A,T,x)}}return{positions:n,indices:a,normals:r,uvs:s,minPos:o,maxPos:h,boundingRadius:u}},toWavefrontOBJ:function(t,e){if(void 0===e&&(e=1),!t.indices||!t.uvs||!t.normals||void 0!==t.primitiveMode&&7!==t.primitiveMode)return"";for(var i=t.positions,n=t.uvs,r=t.normals,s=t.indices,a=function(t){return s[t]+1+"/"+(s[t]+1)+"/"+(s[t]+1)},o="",h=0;h<i.length;h+=3)o+="v "+i[h]*e+" "+i[h+1]*e+" "+i[h+2]*e+"\n";for(var u=0;u<n.length;u+=2)o+="vt "+n[u]+" "+n[u+1]+"\n";for(var l=0;l<r.length;l+=3)o+="vn "+r[l]+" "+r[l+1]+" "+r[l+2]+"\n";for(var c=0;c<s.length;c+=3)o+="f "+a(c)+" "+a(c+1)+" "+a(c+2)+"\n";return o},torus:function(t,e,i){void 0===t&&(t=.4),void 0===e&&(e=.1),void 0===i&&(i={});for(var n=i.radialSegments||32,r=i.tubularSegments||32,s=i.arc||2*Math.PI,a=[],o=[],h=[],u=[],l=new ir(-t-e,-e,-t-e),c=new ir(t+e,e,t+e),f=t+e,_=0;_<=n;_++)for(var d=0;d<=r;d++){var p=d/r,m=_/n,g=p*s,y=m*Math.PI*2,v=(t+e*Math.cos(y))*Math.sin(g),b=e*Math.sin(y),S=(t+e*Math.cos(y))*Math.cos(g),w=Math.sin(g)*Math.cos(y),x=Math.sin(y),T=Math.cos(g)*Math.cos(y);if(a.push(v,b,S),o.push(w,x,T),h.push(p,m),d<r&&_<n){var A=r+1,C=A*_+d,D=A*(_+1)+d,B=A*(_+1)+d+1,I=A*_+d+1;u.push(C,I,D),u.push(I,B,D)}}return{positions:a,normals:o,uvs:h,indices:u,minPos:l,maxPos:c,boundingRadius:f}},translate:function(t,e){for(var i=e.x||0,n=e.y||0,r=e.z||0,s=Math.floor(t.positions.length/3),a=0;a<s;++a){var o=3*a,h=3*a+1,u=3*a+2;t.positions[o]+=i,t.positions[h]+=n,t.positions[u]+=r}return t.minPos&&(t.minPos.x+=i,t.minPos.y+=n,t.minPos.z+=r),t.maxPos&&(t.maxPos.x+=i,t.maxPos.y+=n,t.maxPos.z+=r),t},wireframe:function(t){for(var e=[[0,1],[1,2],[2,0]],i=[],n={},r=0;r<t.length;r+=3)for(var s=0;s<3;++s){var a=t[r+e[s][0]],o=t[r+e[s][1]],h=a>o?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;s<e.length;s+=3)for(var a=0;a<3;++a){var o=e[s+i[a][0]],h=e[s+i[a][1]],u=o>h?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_",wK);var xK=new ir;function TK(t){return t.x=Math.abs(t.x),t.y=Math.abs(t.y),t.z=Math.abs(t.z),t}var AK,CK,DK,BK,IK,MK,PK,EK,OK,kK,RK,FK,LK,VK,NK,zK,UK,GK,HK,WK,jK,qK,XK,YK=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:xK,absolute:TK,cylinder:lK,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;r<n;r+=3){var s=t[r],a=t[r+1],o=t[r+2],h=String(s)+String(a)+String(o),u=qf(h,666);i[u]!==h&&(i[u]=h,e.push(s),e.push(a),e.push(o))}}return e}}),JK=nr();t("ao",(AK=Kh("cc.ReflectionProbe"),CK=Ou(ir),DK=Ou(Ee(CP)),BK=Ou(Ee({Low_256x256:256,Medium_512x512:512,High_768x768:768})),IK=Ou(Ee(AP)),MK=Ou(cr),PK=Ou(Ly.BitMask),EK=Ou(iU),OK=Ou(fi),kK=Ou(ib),AK((XK=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._lastSize=nr(),e._resolution=LK&&LK(),e._clearFlag=VK&&VK(),e._backgroundColor=NK&&NK(),e._visibility=zK&&zK(),e._probeType=UK&&UK(),e._cubemap=GK&&GK(),e._size=HK&&HK(),e._sourceCamera=WK&&WK(),e._probeId=jK&&jK(),e._fastBake=qK&&qK(),e._probe=null,e._previewSphere=null,e._previewPlane=null,e._sourceCameraPos=nr(),e._position=nr(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._createProbe()},i._handleResize$=function(){this.probe&&this.sourceCamera&&1===this.probeType&&this.probe.renderPlanarReflection(this.sourceCamera.camera)},i.onEnable=function(){if(this._probe){var t=YJ.probeManager.getProbeById(this._probeId);null!==t&&t!==this._probe&&(this._probeId=YJ.probeManager.getNewReflectionProbeId(),this._probe.updateProbeId(this._probeId)),YJ.probeManager.register(this._probe),YJ.probeManager.onUpdateProbes(),this._probe.enable()}oh.on("window-resize",this._handleResize$,this),oh.on("fullscreen-change",this._handleResize$,this)},i.onDisable=function(){this._probe&&(YJ.probeManager.unregister(this._probe),this._probe.disable()),oh.off("window-resize",this._handleResize$,this),oh.off("fullscreen-change",this._handleResize$,this)},i.start=function(){this._sourceCamera&&1===this.probeType&&(this.probe.renderPlanarReflection(this.sourceCamera.camera),YJ.probeManager.filterModelsForPlanarReflection()),YJ.probeManager.updateProbeData(),this.node.getWorldPosition(this._position)},i.onDestroy=function(){this.probe&&this.probe.destroy()},i.update=function(){this.probe&&(1===this.probeType&&this.sourceCamera&&(7&this.sourceCamera.node.hasChangedFlags||!this._sourceCameraPos.equals(this.sourceCamera.node.getWorldPosition()))&&(this._sourceCameraPos=this.sourceCamera.node.getWorldPosition(),this.probe.renderPlanarReflection(this.sourceCamera.camera)),1&this.node.hasChangedFlags&&(this.probe.updateBoundingBox(),YJ.probeManager.onUpdateProbes(),YJ.probeManager.updateProbeData()),this.node.getWorldPosition(JK),this._position.equals(JK)||(this._position.set(JK),this.probe.updateBoundingBox(),YJ.probeManager.updateProbeData(),YJ.probeManager.updateProbeOfModels()))},i.clearBakedCubemap=function(){this.cubemap=null,YJ.probeManager.updateBakedCubemap(this.probe),YJ.probeManager.updatePreviewSphere(this.probe)},i._createProbe=function(){if((-1===this._probeId||YJ.probeManager.exists(this._probeId))&&(this._probeId=YJ.probeManager.getNewReflectionProbeId()),this._probe=new IP(this._probeId),this._probe){var t=new eb("ReflectionProbeCamera");t.hideFlags|=1032,this.node.scene.addChild(t),this._probe.initialize(this.node,t),this.enabled&&YJ.probeManager.register(this._probe),this._probe.resolution=this._resolution,this._probe.clearFlag=this._clearFlag,this._probe.backgroundColor=this._backgroundColor,this._probe.visibility=this._visibility,this._probe.probeType=this._probeType,this._probe.size=this._size,this._probe.cubemap=this._cubemap}},n(e,[{key:"size",get:function(){return this._size},set:function(t){this._size.set(t),TK(this._size),this.probe.size=this._size,this.probe&&(this.probe.updateBoundingBox(),YJ.probeManager.onUpdateProbes(),YJ.probeManager.updateProbeData(),YJ.probeManager.updateProbeOfModels())}},{key:"probeType",get:function(){return this._probeType},set:function(t){if(this.probe.probeType=t,t!==this._probeType){var i=this._size.clone(),n=ir.equals(this._lastSize,ir.ZERO);this._probeType=t,0===this._probeType?(n&&this._size.set(e.DEFAULT_CUBE_SIZE),this.probe.switchProbeType(t,null),YJ.probeManager.clearPlanarReflectionMap(this.probe)):(n&&this._size.set(e.DEFAULT_PLANER_SIZE),this._sourceCamera?this.probe.switchProbeType(t,this._sourceCamera.camera):Y("the reflection camera is invalid, please set the reflection camera")),n||this._size.set(this._lastSize),this._lastSize.set(i),this.size=this._size}}},{key:"resolution",get:function(){return this._resolution},set:function(t){this._resolution=t,this.probe.resolution=t}},{key:"clearFlag",get:function(){return this._clearFlag},set:function(t){this._clearFlag=t,this.probe.clearFlag=this._clearFlag}},{key:"backgroundColor",get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this.probe.backgroundColor=this._backgroundColor}},{key:"visibility",get:function(){return this._visibility},set:function(t){this._visibility=t,this.probe.visibility=this._visibility}},{key:"sourceCamera",get:function(){return this._sourceCamera},set:function(t){this._sourceCamera=t,t&&(this.visibility=t.visibility,this.clearFlag=t.clearFlags,this.backgroundColor=t.clearColor,1===this.probeType&&this.probe.switchProbeType(this.probeType,t.camera))}},{key:"fastBake",get:function(){return this._fastBake},set:function(t){this._fastBake=t}},{key:"cubemap",get:function(){return this._cubemap},set:function(t){this._cubemap=t,this.probe.cubemap=t,YJ.probeManager.onUpdateProbes()}},{key:"probe",get:function(){return this._probe}},{key:"previewSphere",get:function(){return this._previewSphere},set:function(t){this._previewSphere=t,this.probe&&(this.probe.previewSphere=t,this._previewSphere&&YJ.probeManager.updatePreviewSphere(this.probe))}},{key:"previewPlane",get:function(){return this._previewPlane},set:function(t){this._previewPlane=t,this.probe&&(this.probe.previewPlane=t,this._previewPlane&&YJ.probeManager.updatePreviewPlane(this.probe))}}]),e}(yg),XK.DEFAULT_CUBE_SIZE=nr(1,1,1),XK.DEFAULT_PLANER_SIZE=nr(5,.5,5),LK=zh((FK=XK).prototype,"_resolution",[uu],(function(){return 256})),VK=zh(FK.prototype,"_clearFlag",[uu],(function(){return 14})),NK=zh(FK.prototype,"_backgroundColor",[uu],(function(){return new cr(0,0,0,255)})),zK=zh(FK.prototype,"_visibility",[uu],(function(){return US})),UK=zh(FK.prototype,"_probeType",[uu],(function(){return 0})),GK=zh(FK.prototype,"_cubemap",[uu],(function(){return null})),HK=zh(FK.prototype,"_size",[uu],(function(){return nr(1,1,1)})),WK=zh(FK.prototype,"_sourceCamera",[uu],(function(){return null})),jK=zh(FK.prototype,"_probeId",[uu],(function(){return-1})),qK=zh(FK.prototype,"_fastBake",[uu],(function(){return!1})),v(FK.prototype,"size",[CK],Object.getOwnPropertyDescriptor(FK.prototype,"size"),FK.prototype),v(FK.prototype,"probeType",[DK],Object.getOwnPropertyDescriptor(FK.prototype,"probeType"),FK.prototype),v(FK.prototype,"resolution",[BK],Object.getOwnPropertyDescriptor(FK.prototype,"resolution"),FK.prototype),v(FK.prototype,"clearFlag",[IK],Object.getOwnPropertyDescriptor(FK.prototype,"clearFlag"),FK.prototype),v(FK.prototype,"backgroundColor",[MK],Object.getOwnPropertyDescriptor(FK.prototype,"backgroundColor"),FK.prototype),v(FK.prototype,"visibility",[PK],Object.getOwnPropertyDescriptor(FK.prototype,"visibility"),FK.prototype),v(FK.prototype,"sourceCamera",[EK],Object.getOwnPropertyDescriptor(FK.prototype,"sourceCamera"),FK.prototype),v(FK.prototype,"fastBake",[OK],Object.getOwnPropertyDescriptor(FK.prototype,"fastBake"),FK.prototype),v(FK.prototype,"cubemap",[kK],Object.getOwnPropertyDescriptor(FK.prototype,"cubemap"),FK.prototype),RK=FK))||RK)),C.utils=Yk;var KK=t("ar",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.identity=function(){return new t},t.clone=function(e){return new t(e.a,e.b,e.c,e.d,e.tx,e.ty)},t.concat=function(t,e,i){var n=e.a,r=e.b,s=e.c,a=e.d,o=e.tx,h=e.ty;t.a=n*i.a+r*i.c,t.b=n*i.b+r*i.d,t.c=s*i.a+a*i.c,t.d=s*i.b+a*i.d,t.tx=o*i.a+h*i.c+i.tx,t.ty=o*i.b+h*i.d+i.ty},t.invert=function(t,e){var i=1/(e.a*e.d-e.b*e.c);t.a=i*e.d,t.b=-i*e.b,t.c=-i*e.c,t.d=i*e.a,t.tx=i*(e.c*e.ty-e.d*e.tx),t.ty=i*(e.b*e.tx-e.a*e.ty)},t.fromMat4=function(t,e){t.a=e.m00,t.b=e.m01,t.c=e.m04,t.d=e.m05,t.tx=e.m12,t.ty=e.m13},t.transformVec2=function(t,e,i,n){var r,s;n?(r=e,s=i):(n=i,r=e.x,s=e.y),t.x=n.a*r+n.c*s+n.tx,t.y=n.b*r+n.d*s+n.ty},t.transformSize=function(t,e,i){t.width=i.a*e.width+i.c*e.height,t.height=i.b*e.width+i.d*e.height},t.transformRect=function(t,e,i){var n=e.x+e.width,r=e.y+e.height,s=i.a*e.x+i.c*e.y+i.tx,a=i.b*e.x+i.d*e.y+i.ty,o=i.a*n+i.c*e.y+i.tx,h=i.b*n+i.d*e.y+i.ty,u=i.a*e.x+i.c*r+i.tx,l=i.b*e.x+i.d*r+i.ty,c=i.a*n+i.c*r+i.tx,f=i.b*n+i.d*r+i.ty,_=Math.min(s,o,u,c),d=Math.max(s,o,u,c),p=Math.min(a,h,l,f),m=Math.max(a,h,l,f);t.x=_,t.y=p,t.width=d-_,t.height=m-p},t.transformObb=function(t,e,i,n,r,s,a){void 0===a&&(a=!0);var o=s.a*r.x+s.c*r.y+s.tx,h=s.b*r.x+s.d*r.y+s.ty,u=s.a*r.width,l=s.b*r.width,c=s.c*r.height,f=s.d*r.height;a?(e.x=o,e.y=h,i.x=u+o,i.y=l+h,t.x=c+o,t.y=f+h,n.x=u+c+o,n.y=l+f+h):(t.x=o,t.y=h,n.x=u+o,n.y=l+h,e.x=c+o,e.y=f+h,i.x=u+c+o,i.y=l+f+h)},t}());C.AffineTransform=KK;var QK,ZK,$K,tQ,eQ,iQ="cc.animation.",nQ=Symbol("CreateEval");Kh(iQ+"EmbeddedPlayer")((QK=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).begin=ZK&&ZK(),e.end=$K&&$K(),e.reconciledSpeed=tQ&&tQ(),e.playable=eQ&&eQ(),e}return s(e,t),e}(Hu),ZK=zh(QK.prototype,"begin",[uu],(function(){return 0})),$K=zh(QK.prototype,"end",[uu],(function(){return 0})),tQ=zh(QK.prototype,"reconciledSpeed",[uu],(function(){return!1})),eQ=zh(QK.prototype,"playable",[uu],(function(){return null})),QK));var rQ=function(){},sQ=function(){function t(t){this._randomAccess=t}return t.prototype.setTime=function(){},n(t,[{key:"randomAccess",get:function(){return this._randomAccess}}]),t}(),aQ=function(){function t(){this._isPlaying=!1,this._isPaused=!1,this._stepOnce=!1}var e=t.prototype;return e.play=function(){this._isPlaying?this._isPaused?(this._isPaused=!1,this.onResume()):this.onError(ft(3912)):(this._isPlaying=!0,this.onPlay())},e.stop=function(){this._isPlaying&&(this._isPlaying=!1,this.onStop(),this._isPaused=!1)},e.pause=function(){this._isPlaying&&!this._isPaused&&(this._isPaused=!0,this.onPause())},e.resume=function(){this._isPlaying&&this._isPaused&&(this._isPaused=!1,this.onResume())},e.step=function(){this.pause(),this._stepOnce=!0,this._isPlaying||this.play()},e.update=function(){},e.onPlay=function(){},e.onPause=function(){},e.onResume=function(){},e.onStop=function(){},e.onError=function(){},n(t,[{key:"isPlaying",get:function(){return this._isPlaying}},{key:"isPaused",get:function(){return this._isPaused}},{key:"isMotionless",get:function(){return!this.isPlaying||this.isPaused}}]),t}(),oQ={Default:0,Normal:1,Reverse:36,Loop:2,LoopReverse:38,PingPong:22,PingPongReverse:54};Re(oQ);var hQ=function(){function t(t){this.ratio=0,this.time=0,this.direction=1,this.stopped=!0,this.iterations=0,this.frameIndex=void 0,t&&this.set(t)}return t.prototype.set=function(t){this.ratio=t.ratio,this.time=t.time,this.direction=t.direction,this.stopped=t.stopped,this.iterations=t.iterations,this.frameIndex=t.frameIndex},t}(),uQ=function(){function t(t){this.weight=0,this._pose=void 0,this._blendStateWriters=[],this._pose=t}var e=t.prototype;return e.destroy=function(){for(var t=0;t<this._blendStateWriters.length;++t)this._pose.destroyWriter(this._blendStateWriters[t]);this._blendStateWriters.length=0},e.createPoseWriter=function(t,e,i){var n=this._pose.createWriter(t,e,this,i);return this._blendStateWriters.push(n),n},t}();function lQ(){return A.director.getAnimationManager()}var cQ={PLAY:"play",STOP:"stop",PAUSE:"pause",RESUME:"resume",LASTFRAME:"lastframe",FINISHED:"finished"};Re(cQ);var fQ,_Q,dQ,pQ=t("au",function(t){function e(e,i){var n;return void 0===i&&(i=""),(n=t.call(this)||this).duration=1,n.time=0,n.frameRate=0,n._targetNode=null,n._curveLoaded=!1,n._clip=void 0,n._speed=1,n._useSimpleProcess=!1,n._target=null,n._wrapMode=1,n._repeatCount=1,n._delay=0,n._delayTime=0,n._currentFramePlayed=!1,n._name=void 0,n._lastIterations=NaN,n._lastWrapInfo=null,n._wrappedInfo=new hQ,n._allowLastFrame=!1,n._blendStateWriterHost={weight:0},n._playbackDuration=0,n._invDuration=1,n._poseOutput=null,n._weight=1,n._clipEval=void 0,n._clipEventEval=void 0,n._clipEmbeddedPlayerEval=void 0,n._doNotCreateEval=!1,n._clip=e,n._name=i||e&&e.name,n._playbackRange={min:0,max:e.duration},n._playbackDuration=e.duration,e.duration||Q("Clip "+e.name+" has zero duration."),n}s(e,t);var i=e.prototype;return i.initialize=function(t,e,i){if(!this._curveLoaded){this._curveLoaded=!0,this._poseOutput&&(this._poseOutput.destroy(),this._poseOutput=null),this._clipEval&&(this._clipEval=void 0),this._clipEventEval&&(this._clipEventEval=void 0),this._clipEmbeddedPlayerEval&&(this._clipEmbeddedPlayerEval.destroy(),this._clipEmbeddedPlayerEval=void 0),this._targetNode=t;var n=this._clip;if(this.duration=n.duration,this._invDuration=1/this.duration,this._speed=n.speed,this.wrapMode=n.wrapMode,this.frameRate=n.sample,this._playbackRange.min=0,this._playbackRange.max=n.duration,this._playbackDuration=n.duration,2&~this.wrapMode?this.repeatCount=1:this.repeatCount=1/0,!this._doNotCreateEval){var r,s,a,o=null!==(r=null!=e?e:null==(s=lQ())?void 0:s.blendState)&&void 0!==r?r:null;o&&(this._poseOutput=new uQ(o)),this._clipEval=n.createEvaluator({target:t,pose:null!==(a=this._poseOutput)&&void 0!==a?a:void 0,mask:i})}n.containsAnyEvent()&&(this._clipEventEval=n.createEventEvaluator(this._targetNode)),n.containsAnyEmbeddedPlayer()&&(this._clipEmbeddedPlayerEval=n.createEmbeddedPlayerEvaluator(this._targetNode),this._clipEmbeddedPlayerEval.notifyHostSpeedChanged(this._speed))}},i.destroy=function(){this.isMotionless||lQ().removeAnimation(this),this._poseOutput&&(this._poseOutput.destroy(),this._poseOutput=null),this._clipEval=void 0},i.emit=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];lQ().pushDelayEvent(this._emit,this,e)},i.on=function(t,e,i){return this._target&&this._target.isValid?this._target.on(t,e,i):null},i.once=function(t,e,i){return this._target&&this._target.isValid?this._target.once(t,e,i):null},i.off=function(t,e,i){this._target&&this._target.isValid&&this._target.off(t,e,i)},i.allowLastFrameEvent=function(t){this._allowLastFrame=t},i._setEventTarget=function(t){this._target=t},i.setTime=function(t){this._currentFramePlayed=!1,this.time=t||0;var e,i=this.getWrappedInfo(t,this._wrappedInfo);null==(e=this._clipEventEval)||e.ignore(i.ratio,i.direction)},i.update=function(t){this._delayTime>0&&(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 hQ(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._lastIterations<n)&&this.emit("lastframe",this),this._lastIterations=n)},i._needReverse=function(t){var e=this.wrapMode,i=!1;return 22&~e||(t-(0|t)==0&&t>0&&(t-=1),1&t&&(i=!i)),36&~e||(i=!i),i},i.getWrappedInfo=function(t,e){e=e||new hQ;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(){lQ().addAnimation(this)},i._onPauseOrStop=function(){lQ().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}(aQ));A.AnimationState=pQ,Kh(iQ+"EmbeddedAnimationClipPlayable")((fQ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).path=_Q&&_Q(),e.clip=dQ&&dQ(),e}return s(e,t),e.prototype.instantiate=function(t){var e=this.clip,i=this.path;if(!e)return null;var n=t.getChildByPath(i);if(!n)return ht(3938,i,t.getPathInHierarchy(),e.name),null;var r=new pQ(e);return r.initialize(n),new yQ(r)},e}(rQ),_Q=zh(fQ.prototype,"path",[uu],(function(){return""})),dQ=zh(fQ.prototype,"clip",[uu],(function(){return null})),fQ));var mQ,gQ,yQ=function(t){function e(e){var i;return(i=t.call(this,!0)||this)._animationState=void 0,i._animationState=e,i}s(e,t);var i=e.prototype;return i.destroy=function(){this._animationState.destroy()},i.play=function(){this._animationState.play()},i.pause=function(){this._animationState.pause()},i.stop=function(){this._animationState.stop()},i.setSpeed=function(t){this._animationState.speed=t},i.setTime=function(t){this._animationState.time=t},e}(sQ);Kh(iQ+"EmbeddedParticleSystemPlayable")((mQ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).path=gQ&&gQ(),e}return s(e,t),e.prototype.instantiate=function(t){var e=t.getChildByPath(this.path);if(!e)return Y("Hierarchy path "+this.path+" does not exists."),null;var i=de("cc.ParticleSystem");if(!i)return Y("Particle system is required for embedded particle system player."),null;var n=e.getComponent(i);return n?new AQ(n):(Y(this.path+" does not includes a particle system component."),null)},e}(rQ),gQ=zh(mQ.prototype,"path",[uu],(function(){return""})),mQ));var vQ,bQ,SQ,wQ,xQ,TQ,AQ=function(t){function e(e){var i;return(i=t.call(this,!1)||this)._particleSystem=void 0,i._particleSystem=e,i}s(e,t);var i=e.prototype;return i.destroy=function(){},i.play=function(){this._particleSystem.play()},i.pause=function(){this._particleSystem.stopEmitting()},i.stop=function(){this._particleSystem.stopEmitting()},i.setSpeed=function(t){this._particleSystem.simulationSpeed=t},e}(sQ);function CQ(t){return"string"==typeof t||"number"==typeof t}var DQ,BQ,IQ,MQ,PQ,EQ,OQ,kQ,RQ,FQ,LQ,VQ,NQ,zQ,UQ,GQ,HQ,WQ=Kh("cc.animation.HierarchyPath")((bQ=function(){function t(t){this.path=SQ&&SQ(),this.path=t||""}return t.prototype.get=function(t){return t instanceof eb?t.getChildByPath(this.path)||(at(3926,t.name,this.path),null):(at(3925),null)},t}(),SQ=zh(bQ.prototype,"path",[uu],(function(){return""})),vQ=bQ))||vQ,jQ=Kh("cc.animation.ComponentPath")((xQ=function(){function t(t){this.component=TQ&&TQ(),this.component=t||""}return t.prototype.get=function(t){return t instanceof eb?t.getComponent(this.component)||(at(3928,t.name,this.component),null):(at(3927),null)},t}(),TQ=zh(xQ.prototype,"component",[uu],(function(){return""})),wQ=xQ))||wQ,qQ=Symbol("NormalizedFollow"),XQ=Symbol("ConvertAsTrsPath"),YQ=Symbol("TrackBinding"),JQ=Kh(iQ+"TrackPath")((BQ=function(){function t(){this._paths=IQ&&IQ()}var e=t.prototype;return e.toProperty=function(t){return this._paths.push(t),this},e.toElement=function(t){return this._paths.push(t),this},e.toHierarchy=function(t){return this._paths.push(new WQ(t)),this},e.toComponent=function(t){var e=new jQ("string"==typeof t?t:Ht(t));return this._paths.push(e),this},e.toCustomized=function(t){return this._paths.push(t),this},e.append=function(){for(var t,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];var r=(t=this._paths).concat.apply(t,i.map((function(t){return t._paths})));return this._paths=r,this},e.isPropertyAt=function(t){return"string"==typeof this._paths[t]},e.parsePropertyAt=function(t){return this._paths[t]},e.isElementAt=function(t){return"number"==typeof this._paths[t]},e.parseElementAt=function(t){return this._paths[t]},e.isHierarchyAt=function(t){return this._paths[t]instanceof WQ},e.parseHierarchyAt=function(t){return this.isHierarchyAt(t),this._paths[t].path},e.isComponentAt=function(t){return this._paths[t]instanceof jQ},e.parseComponentAt=function(t){return this.isComponentAt(t),this._paths[t].component},e.slice=function(e,i){var n=new t;return n._paths=this._paths.slice(e,i),n},e.trace=function(t,e,i){var n,r;return null!==(n=e)&&void 0!==n||(e=0),null!==(r=i)&&void 0!==r||(i=this._paths.length),this[qQ](t,e,i)},e[XQ]=function(){for(var t,e=this._paths,i=e.length,n=0,r="";n<i;++n){var s=e[n];if(!(s instanceof WQ))break;s.path&&(r?r+="/"+s.path:r=s.path)}if(n===i)return null;if(n!==i-1)return null;switch(e[n]){case"position":case"scale":case"rotation":case"eulerAngles":t=e[n];break;default:return null}return{node:r,property:t}},e[qQ]=function(t,e,i){for(var n=this._paths,r=t,s=e;s<i;++s){var a=n[s];if(CQ(a)){if(!(a in r))return at(3929,a),null;r=r[a]}else r=a.get(r);if(null===r)break}return r},n(t,[{key:"length",get:function(){return this._paths.length}}]),t}(),IQ=zh(BQ.prototype,"_paths",[uu],(function(){return[]})),DQ=BQ))||DQ,KQ=Kh(iQ+"TrackBinding")(MQ=_u((kQ=function(){function t(){this.path=EQ&&EQ(),this.proxy=OQ&&OQ()}var e=t.prototype;return e.parseTrsPath=function(){return this.proxy?null:this.path[XQ]()},e.createRuntimeBinding=function(e,i,n){var r=this.path,s=this.proxy,a=r.length,o=a-1;if(0===a||!r.isPropertyAt(o)&&!r.isElementAt(o)||s){if(s){var h=r[qQ](e,0,a);if(null===h)return null;var u=s.forTarget(h);if(!u)return null;var l={setValue:function(t){u.set(t)}},c=u.get;return c&&(l.getValue=function(){return c.call(u)}),l}return ht(3921),null}var f=r.isPropertyAt(o)?r.parsePropertyAt(o):r.parseElementAt(o),_=r[qQ](e,0,a-1);if(null===_)return null;if(i&&_ instanceof eb&&QQ(f))return i.createPoseWriter(_,f,n);var d=t._animationFunctions.get(_.constructor);d||(d=new Map,t._animationFunctions.set(_.constructor,d));var p=d.get(f);return p||(p={setValue:Function("value","this.target."+f+" = value;"),getValue:Function("return this.target."+f+";")},d.set(f,p)),{target:_,setValue:p.setValue,getValue:p.getValue}},e.isMaskedOff=function(t){var e=this.parseTrsPath();if(!e)return!1;for(var i=t.joints[Symbol.iterator](),n=i.next();!n.done;n=i.next()){var r=n.value;if(r.path===e.node)return!r.enabled}return!1},t}(),kQ._animationFunctions=new WeakMap,EQ=zh((PQ=kQ).prototype,"path",[uu],(function(){return new JQ})),OQ=zh(PQ.prototype,"proxy",[uu],null),MQ=PQ))||MQ)||MQ;function QQ(t){return"position"===t||"rotation"===t||"scale"===t||"eulerAngles"===t}var ZQ,$Q,tZ=Kh(iQ+"Track")((FQ=function(){function t(){this._binding=LQ&&LQ()}var e=t.prototype;return e.channels=function(){return[]},e.range=function(){for(var t,e={min:1/0,max:-1/0},i=p(this.channels());!(t=i()).done;){var n=t.value;e.min=Math.min(e.min,n.curve.rangeMin),e.max=Math.max(e.max,n.curve.rangeMax)}return e},n(t,[{key:"path",get:function(){return this._binding.path},set:function(t){this._binding.path=t}},{key:"proxy",get:function(){return this._binding.proxy},set:function(t){this._binding.proxy=t}},{key:YQ,get:function(){return this._binding}}]),t}(),LQ=zh(FQ.prototype,"_binding",[uu],(function(){return new KQ})),RQ=FQ))||RQ,eZ=Kh(iQ+"Channel")((NQ=function(){function t(t){this.name="",this._curve=zQ&&zQ(),this._curve=t}return n(t,[{key:"curve",get:function(){return this._curve}}]),t}(),zQ=zh(NQ.prototype,"_curve",[uu],null),VQ=NQ))||VQ,iZ=Kh(iQ+"SingleChannelTrack")((GQ=function(t){function e(){var e;return(e=t.call(this)||this)._channel=HQ&&HQ(),e._channel=new eZ(e.createCurve()),e}s(e,t);var i=e.prototype;return i.channels=function(){return[this._channel]},i.createCurve=function(){throw new Error("Not impl")},i[nQ]=function(){var t=this._channel.curve;return new nZ(t)},n(e,[{key:"channel",get:function(){return this._channel}}]),e}(tZ),HQ=zh(GQ.prototype,"_channel",[uu],null),UQ=GQ))||UQ,nZ=function(){function t(t){this._curve=t}return t.prototype.evaluate=function(t){return this._curve.evaluate(t)},n(t,[{key:"requiresDefault",get:function(){return!1}}]),t}(),rZ=uu;Kh(iQ+"RealArrayTrack")((ZQ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._channels=$Q&&$Q(),e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[nQ]=function(){return new yZ(this._channels.map((function(t){return t.curve})))},n(e,[{key:"elementCount",get:function(){return this._channels.length},set:function(t){var e=this._channels.length;if(t<e)this._channels.splice(t);else if(t>e){var i;(i=this._channels).push.apply(i,Array.from({length:t-e},(function(){return new eZ(new Zl)})))}}}]),e}(tZ),$Q=zh(ZQ.prototype,"_channels",[rZ],(function(){return[]})),ZQ));var sZ,aZ,oZ,hZ,uZ,lZ,cZ,fZ,_Z,dZ,pZ,mZ,gZ,yZ=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<i;++n)e[n]=this._curves[n].evaluate(t);return this._result},n(t,[{key:"requiresDefault",get:function(){return!1}}]),t}(),vZ=Kh("cc.animation.UniformProxyFactory")((aZ=function(){function t(t,e){this.passIndex=oZ&&oZ(),this.uniformName=hZ&&hZ(),y(this,"channelIndex",uZ,this),this.passIndex=e||0,this.uniformName=t||""}return t.prototype.forTarget=function(t){if(t instanceof GT){var e=this.passIndex,i=this.uniformName,n=this.channelIndex;if(e<0||e>=t.passes.length)at(3941,t.name,e);else{var r=t.passes[e],s=r.getHandle(i);if(s){if(QS(s)<26){var a=void 0===n?s:r.getHandle(i,n,13);return a?bZ(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=ZS(s),h=r.properties[i],u=h&&h.value?""+h.value+ow(h.type):aw(h.type),l=mT.get(u);return l||(Y("Illegal texture default value: "+u+"."),l=mT.get("default-texture")),{set:function(t){t||(t=l);var e=t.getGFXTexture();e&&e.width&&e.height&&(r.bindTexture(o,e),t instanceof Ym&&r.bindSampler(o,Wp.gfxDevice.getSampler(t.getSamplerInfo())))}}}at(3942,t.name,e,i)}}else at(3940,t)},t}(),oZ=zh(aZ.prototype,"passIndex",[uu],(function(){return 0})),hZ=zh(aZ.prototype,"uniformName",[uu],(function(){return""})),uZ=v(aZ.prototype,"channelIndex",[Mu],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){}}),sZ=aZ))||sZ;function bZ(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 SZ,wZ,xZ,TZ,AZ,CZ=Kh("cc.animation.MorphWeightValueProxy")((cZ=function(){function t(){this.subMeshIndex=fZ&&fZ(),this.shapeIndex=_Z&&_Z()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeight(i,e.subMeshIndex,e.shapeIndex)}}},t}(),fZ=zh(cZ.prototype,"subMeshIndex",[uu],(function(){return 0})),_Z=zh(cZ.prototype,"shapeIndex",[uu],(function(){return 0})),lZ=cZ))||lZ,DZ=Kh("cc.animation.MorphWeightsValueProxy")((pZ=function(){function t(){this.subMeshIndex=mZ&&mZ()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeights(i,e.subMeshIndex)}}},t}(),mZ=zh(pZ.prototype,"subMeshIndex",[uu],(function(){return 0})),dZ=pZ))||dZ,BZ=Kh("cc.animation.MorphWeightsAllValueProxy")(gZ=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;s<r;++s)t.setWeights(e,s)}}},t}())||gZ;function IZ(t,e,i,n){var r,s,a,o,h,u=new e,l=new e,c=new e,f=Kh(t)((s=function(){function t(t,i,n){this.dataPoint=a&&a(),this.inTangent=o&&o(),this.outTangent=h&&h(),this.dataPoint=t||new e,this.inTangent=i||new e,this.outTangent=n||new e}var r=t.prototype;return r.lerp=function(t,e,r){var s=this.dataPoint,a=t.dataPoint;l=i(l,this.inTangent,r),c=i(c,t.outTangent,r);var o=e*e*e,h=e*e,f=o-2*h+e,_=-2*o+3*h,d=o-h;return u=i(u,s,2*o-3*h+1),u=n(u,u,l,f),u=n(u,u,a,_),u=n(u,u,c,d)},r.getNoLerp=function(){return this.dataPoint},t}(),a=zh(s.prototype,"dataPoint",[uu],(function(){return new e})),o=zh(s.prototype,"inTangent",[uu],(function(){return new e})),h=zh(s.prototype,"outTangent",[uu],(function(){return new e})),r=s))||r;if(e===kr){var _=f.prototype.lerp;f.prototype.lerp=function(t,e,i){var n=_.call(this,t,e,i);return kr.normalize(n,n),n}}return f}var MZ,PZ,EZ,OZ,kZ,RZ=IZ("cc.CubicSplineVec2Value",ds,ds.multiplyScalar,ds.scaleAndAdd),FZ=IZ("cc.CubicSplineVec3Value",ir,ir.multiplyScalar,ir.scaleAndAdd),LZ=IZ("cc.CubicSplineVec4Value",Vn,Vn.multiplyScalar,Vn.scaleAndAdd),VZ=IZ("cc.CubicSplineQuatValue",kr,kr.multiplyScalar,kr.scaleAndAdd),NZ=Kh("cc.CubicSplineNumberValue")((wZ=function(){function t(t,e,i){this.dataPoint=xZ&&xZ(),this.inTangent=TZ&&TZ(),this.outTangent=AZ&&AZ(),this.dataPoint=t,this.inTangent=e,this.outTangent=i}var e=t.prototype;return e.lerp=function(t,e,i){var n=this.dataPoint,r=t.dataPoint,s=e*e*e,a=e*e;return n*(2*s-3*a+1)+this.outTangent*i*(s-2*a+e)+r*(-2*s+3*a)+t.inTangent*i*(s-a)},e.getNoLerp=function(){return this.dataPoint},t}(),xZ=zh(wZ.prototype,"dataPoint",[uu],(function(){return 0})),TZ=zh(wZ.prototype,"inTangent",[uu],(function(){return 0})),AZ=zh(wZ.prototype,"outTangent",[uu],(function(){return 0})),SZ=wZ))||SZ,zZ=Kh(iQ+"RealTrack")(MZ=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createCurve=function(){return new Zl},e}(iZ))||MZ;function UZ(t){return 0===t.keyFramesCount?void 0:t}var GZ,HZ,WZ,jZ,qZ,XZ,YZ,JZ,KZ=["X","Y","Z","W"],QZ=Kh(iQ+"VectorTrack")((EZ=function(t){function e(){var e;(e=t.call(this)||this)._channels=OZ&&OZ(),e._nComponents=kZ&&kZ(),e._channels=new Array(4);for(var i=0;i<e._channels.length;++i){var n=new eZ(new Zl);n.name=KZ[i],e._channels[i]=n}return e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[nQ]=function(){switch(this._nComponents){default:case 2:return new ZZ(UZ(this._channels[0].curve),UZ(this._channels[1].curve));case 3:return new $Z(UZ(this._channels[0].curve),UZ(this._channels[1].curve),UZ(this._channels[2].curve));case 4:return new t$(UZ(this._channels[0].curve),UZ(this._channels[1].curve),UZ(this._channels[2].curve),UZ(this._channels[3].curve))}},n(e,[{key:"componentsCount",get:function(){return this._nComponents},set:function(t){this._nComponents=t}}]),e}(tZ),OZ=zh(EZ.prototype,"_channels",[uu],null),kZ=zh(EZ.prototype,"_nComponents",[uu],(function(){return 4})),PZ=EZ))||PZ,ZZ=function(){function t(t,e){this._result=new ds,this._x=t,this._y=e}return t.prototype.evaluate=function(t,e){return e&&ds.copy(this._result,e),this._x&&(this._result.x=this._x.evaluate(t)),this._y&&(this._result.y=this._y.evaluate(t)),this._result},n(t,[{key:"requiresDefault",get:function(){return!this._x||!this._y}}]),t}(),$Z=function(){function t(t,e,i){this._result=new ir,this._x=t,this._y=e,this._z=i}return t.prototype.evaluate=function(t,e){var i=this._x,n=this._y,r=this._z,s=this._result;return e&&ir.copy(s,e),i&&(s.x=i.evaluate(t)),n&&(s.y=n.evaluate(t)),r&&(s.z=r.evaluate(t)),s},n(t,[{key:"requiresDefault",get:function(){return!this._x||!this._y||!this._z}}]),t}(),t$=function(){function t(t,e,i,n){this._result=new Vn,this._x=t,this._y=e,this._z=i,this._w=n}return t.prototype.evaluate=function(t,e){return e&&Vn.copy(this._result,e),this._x&&(this._result.x=this._x.evaluate(t)),this._y&&(this._result.y=this._y.evaluate(t)),this._z&&(this._result.z=this._z.evaluate(t)),this._w&&(this._result.w=this._w.evaluate(t)),this._result},n(t,[{key:"requiresDefault",get:function(){return!(this._x&&this._y&&this._z&&this._w)}}]),t}(),e$=Kh(iQ+"QuatTrack")(GZ=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.createCurve=function(){return new Jc},i[nQ]=function(){return new i$(this.channels()[0].curve)},e}(iZ))||GZ,i$=function(){function t(t){this._result=new kr,this._curve=t}return t.prototype.evaluate=function(t){return this._curve.evaluate(t,this._result),this._result},n(t,[{key:"requiresDefault",get:function(){return!1}}]),t}(),n$=["Red","Green","Blue","Alpha"],r$=Kh(iQ+"ColorTrack")((WZ=function(t){function e(){var e;(e=t.call(this)||this)._channels=jZ&&jZ(),e._channels=new Array(4);for(var i=0;i<e._channels.length;++i){var n=new eZ(new Zl);n.name=n$[i],e._channels[i]=n}return e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[nQ]=function(){return new s$(UZ(this._channels[0].curve),UZ(this._channels[1].curve),UZ(this._channels[2].curve),UZ(this._channels[3].curve))},e}(tZ),jZ=zh(WZ.prototype,"_channels",[uu],null),HZ=WZ))||HZ,s$=function(){function t(t,e,i,n){this._result=new cr,this._x=t,this._y=e,this._z=i,this._w=n}return t.prototype.evaluate=function(t,e){return e&&cr.copy(this._result,e),this._x&&(this._result.r=this._x.evaluate(t)),this._y&&(this._result.g=this._y.evaluate(t)),this._z&&(this._result.b=this._z.evaluate(t)),this._w&&(this._result.a=this._w.evaluate(t)),this._result},n(t,[{key:"requiresDefault",get:function(){return!(this._x&&this._y&&this._z&&this._w)}}]),t}(),a$=["Width","Height"],o$=Kh(iQ+"SizeTrack")((XZ=function(t){function e(){var e;(e=t.call(this)||this)._channels=YZ&&YZ(),e._channels=new Array(2);for(var i=0;i<e._channels.length;++i){var n=new eZ(new Zl);n.name=a$[i],e._channels[i]=n}return e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[nQ]=function(){return new h$(UZ(this._channels[0].curve),UZ(this._channels[1].curve))},e}(tZ),YZ=zh(XZ.prototype,"_channels",[uu],null),qZ=XZ))||qZ,h$=function(){function t(t,e){this._result=new ms,this._width=t,this._height=e}return t.prototype.evaluate=function(t,e){return e&&(this._result.x=e.x,this._result.y=e.y),this._width&&(this._result.width=this._width.evaluate(t)),this._height&&(this._result.height=this._height.evaluate(t)),this._result},n(t,[{key:"requiresDefault",get:function(){return!this._width||!this._height}}]),t}(),u$=Kh(iQ+"ObjectTrack")(JZ=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createCurve=function(){return new sf},e}(iZ))||JZ,l$=Symbol("[[Owner]]");function c$(t){t[l$]}var f$,_$,d$,p$,m$,g$,y$,v$,b$,S$,w$,x$,T$,A$=Symbol("CreateInstance"),C$=function(){function t(t){this._refs=[],this.type=t}return t.prototype.bind=function(t,e){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];return this._refs.push({fn:t,thisArg:e,args:n}),this.getValue()},n(t,[{key:"value",get:function(){return this.getValue()},set:function(t){this.setValue(t);for(var e,i=p(this._refs);!(e=i()).done;){var n=e.value,r=n.fn,s=n.thisArg,a=n.args;r.call.apply(r,[s,t].concat(a))}}}]),t}(),D$=Kh("cc.animation.PlainVariable")((_$=function(){function t(t){if(this._type=d$&&d$(),this._value=p$&&p$(),void 0!==t)switch(this._type=t,t){default:break;case 0:case 3:this._value=0;break;case 1:this._value=!1}}return t.prototype[A$]=function(){return new B$(this._type,this._value)},n(t,[{key:"type",get:function(){return this._type}},{key:"value",get:function(){return this._value},set:function(t){this._value=t}}]),t}(),d$=zh(_$.prototype,"_type",[uu],(function(){return 0})),p$=zh(_$.prototype,"_value",[uu],(function(){return 0})),f$=_$))||f$,B$=function(t){function e(e,i){var n;return(n=t.call(this,e)||this)._value=void 0,n._value=i,n}s(e,t);var i=e.prototype;return i.getValue=function(){return this._value},i.setValue=function(t){this._value=t},e}(C$),I$=Kh("cc.animation.TriggerVariable")((g$=function(){function t(){this._flags=y$&&y$()}return t.prototype[A$]=function(){return new M$(this.value,this.resetMode)},n(t,[{key:"type",get:function(){return 2}},{key:"value",get:function(){return!!(1&this._flags)},set:function(t){t?this._flags|=1:this._flags&=-2}},{key:"resetMode",get:function(){return(6&this._flags)>>1},set:function(t){this._flags&=-7,this._flags|=t<<1}}]),t}(),y$=zh(g$.prototype,"_flags",[uu],(function(){return 0})),m$=g$))||m$,M$=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}(C$),P$=Kh("cc.animation.Vec3Variable")((b$=function(){function t(){this._value=S$&&S$()}return t.prototype[A$]=function(){return new E$(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}(),S$=zh(b$.prototype,"_value",[uu],(function(){return new ir})),v$=b$))||v$,E$=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}(C$),O$=Kh("cc.animation.QuatVariable")((x$=function(){function t(){this._value=T$&&T$()}return t.prototype[A$]=function(){return new k$(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}(),T$=zh(x$.prototype,"_value",[uu],(function(){return new kr})),w$=x$))||w$,k$=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}(C$);function R$(t,e){var i;switch(t){case 0:case 3:case 1:i=new D$(t);break;case 2:i=new I$;break;case 4:i=new P$;break;case 5:i=new O$;break;default:throw new Error("Unknown variable type "+t)}return void 0!==e&&(i.value=e),i}var F$,L$,V$,N$,z$,U$,G$=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)),H$=function(t){function e(e){return t.call(this,"Graph variable "+e+" is not defined")||this}return s(e,t),e}(l(Error)),W$=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)),j$=1,q$=-4192741,X$=[];function Y$(t){return"function"==typeof t._instantiate}function J$(t){var e;if(vo(t)){if(Y$(t))return A.game._isCloning=!0,e=t._instantiate(null,!0),A.game._isCloning=!1,e;if(t instanceof A.Asset)throw new TypeError(ft(6903))}return A.game._isCloning=!0,e=K$(t),A.game._isCloning=!1,e}function K$(t,e){var i;Z$(t,i=t._iN$t?t._iN$t:t.constructor?new(0,t.constructor):Object.create(null),e);for(var n=0,r=X$.length;n<r;++n)X$[n]._iN$t=null;return X$.length=0,i}function Q$(t,e,i,n){for(var r=t.__values__,s=0;s<r.length;s++){var a=r[s],o=e[a];if("object"==typeof o&&o){var h=i[a];h instanceof Fe&&h.constructor===o.constructor?h.set(o):i[a]=o._iN$t||$$(o,n)}else i[a]=o}}function Z$(t,e,i){Vt(t,"_iN$t",e,!0),X$.push(t);var n=t.constructor;if(Ni(n))Q$(n,t,e,i);else for(var r in t)if(t.hasOwnProperty(r)&&(95!==r.charCodeAt(0)||95!==r.charCodeAt(1)||"__type__"===r||"__prefab"===r)){var s=t[r];if("object"==typeof s&&s){if(s===e)continue;e[r]=s._iN$t||$$(s,i)}else e[r]=s}vo(t)&&(e._objFlags&=q$)}function $$(t,e){if(t instanceof Fe)return t.clone();if(t instanceof A.Asset)return t;var i;if(ArrayBuffer.isView(t)){var n=t.length;i=new t.constructor(n),t._iN$t=i,X$.push(t);for(var r=0;r<n;++r)i[r]=t[r];return i}if(Array.isArray(t)){var s=t.length;i=new Array(s),t._iN$t=i,X$.push(t);for(var a=0;a<s;++a){var o=t[a];i[a]="object"==typeof o&&o?o._iN$t||$$(o,e):o}return i}if(t._objFlags&j$)return null;var h=t.constructor;if(Ni(h)){if(e)if(e instanceof yg){if(t instanceof eb||t instanceof yg)return t}else if(e instanceof eb)if(t instanceof eb){if(!t.isChildOf(e))return t}else if(t instanceof yg&&t.node&&!t.node.isChildOf(e))return t;i=new h}else if(h===Object)i={};else{if(h)return t;i=Object.create(null)}return Z$(t,i,e),i}function t0(t){var e=t[co];if("object"==typeof e&&e){var i=e;return null==i.clone?void 0:i.clone(t)}}J$._clone=K$,A.instantiate=J$;var e0,i0,n0,r0=Symbol("[[Outgoing transitions]]"),s0=Symbol("[[Incoming transitions]]"),a0=Kh,o0=uu,h0=a0("cc.animation.State")((L$=function(t){function e(){var e;return(e=t.call(this)||this).name=V$&&V$(),e[r0]=[],e[s0]=[],e}return s(e,t),e.prototype.copyTo=function(t){t.name=this.name,t[co]=t0(this)},e}(Hu),V$=zh(L$.prototype,"name",[o0],(function(){return""})),F$=L$))||F$,u0=a0(iQ+"InteractiveState")((z$=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._components=U$&&U$(),e}s(e,t);var i=e.prototype;return i.addComponent=function(t){var e=new t;return this._components.push(e),e},i.removeComponent=function(t){Se(this._components,t)},i.instantiateComponents=function(){return this._components.map((function(t){return J$(t)}))},i.copyTo=function(e){t.prototype.copyTo.call(this,e),e._components=this.instantiateComponents()},n(e,[{key:"components",get:function(){return this._components}}]),e}(h0),U$=zh(z$.prototype,"_components",[o0],(function(){return[]})),N$=z$))||N$;function l0(t,e,i){for(var n=t.components,r=n.length,s=0;s<r;++s){var a=n[s],o=a[e];"function"==typeof o&&o.apply(a,i)}}var c0,f0,_0,d0,p0,m0,g0,y0,v0,b0=Kh(iQ+"AnimationGraphEventBinding")((i0=function(){function t(){this.methodName=n0&&n0()}var e=t.prototype;return e.emit=function(t){this.methodName&&l0(t,this.methodName,[])},e.copyTo=function(t){return t.methodName=this.methodName,this},n(t,[{key:"isBound",get:function(){return!!this.methodName}}]),t}(),n0=zh(i0.prototype,"methodName",[uu],(function(){return""})),e0=i0))||e0,S0=Kh("cc.animation.Motion")((f0=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).motion=_0&&_0(),e.speed=d0&&d0(),e.speedMultiplier=p0&&p0(),e.speedMultiplierEnabled=m0&&m0(),e.transitionInEventBinding=g0&&g0(),e.transitionOutEventBinding=y0&&y0(),e}s(e,t);var i=e.prototype;return i.__callOnAfterDeserializeRecursive=function(){var t;null==(t=this.motion)||t.__callOnAfterDeserializeRecursive()},i.copyTo=function(e){var i,n;return t.prototype.copyTo.call(this,e),e.motion=null!==(i=null==(n=this.motion)?void 0:n.clone())&&void 0!==i?i:null,e.speed=this.speed,e.speedMultiplier=this.speedMultiplier,e.speedMultiplierEnabled=this.speedMultiplierEnabled,this.transitionInEventBinding.copyTo(e.transitionInEventBinding),this.transitionOutEventBinding.copyTo(e.transitionOutEventBinding),this},e}(u0),_0=zh(f0.prototype,"motion",[uu],(function(){return null})),d0=zh(f0.prototype,"speed",[uu],(function(){return 1})),p0=zh(f0.prototype,"speedMultiplier",[uu],(function(){return""})),m0=zh(f0.prototype,"speedMultiplierEnabled",[uu],(function(){return!1})),g0=zh(f0.prototype,"transitionInEventBinding",[uu],(function(){return new b0})),y0=zh(f0.prototype,"transitionOutEventBinding",[uu],(function(){return new b0})),c0=f0))||c0,w0=Symbol("[[OnAfterDeserialized]]"),x0=Kh(iQ+"AnimationGraphLike")(v0=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Cm))||v0;function T0(t,e,i){var n=Object.prototype.propertyIsEnumerable;if(!n.call(t,e))return t;if(i in t)return t;var r={};return"symbol"==typeof e?(Object.entries(t).forEach((function(t){var e=t[0],i=t[1];r[e]=i})),Object.getOwnPropertySymbols(t).forEach((function(s){n.call(t,s)&&(r[s===e?i:s]=t[s])}))):(Object.entries(t).forEach((function(t){var n=t[0],s=t[1];r[n===e?i:n]=s})),Object.getOwnPropertySymbols(t).forEach((function(e){n.call(t,e)&&(r[e]=t[e])}))),r}var A0,C0,D0,B0,I0,M0,P0,E0,O0=function(){var t=!1;try{var e=function(){function t(){}return t[Symbol.hasInstance]=function(t){return Array.isArray(t)},t}();t=[]instanceof e}catch(e){t=!1}return t?function(t){function e(){throw new Error("This function can not be called as a constructor.")}return Object.defineProperty(e,Symbol.hasInstance,{value:function(e){return e instanceof t}}),e}:function(t){return t}}(),k0=Kh(iQ+"PoseGraphNodeShell")((C0=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._bindings=D0&&D0(),e}s(e,t);var i=e.prototype;return i.getBindings=function(){return this._bindings},i.addBinding=function(t,e,i){this._emplaceBinding(new F0(t,e,i))},i.deleteBinding=function(t){var e=this._findBindingIndex(t);e>=0&&this._bindings.splice(e,1)},i.moveArrayElementBindingForward=function(t,e,i){for(var n=this._bindings,r=[],s=0;s<n.length;++s){var a=n[s],o=a.inputPath,h=o[0],u=o[1];h===t&&(void 0===u?-1:u)>=e&&(r.push(a),n.splice(s,1))}for(var l=0,c=r;l<c.length;l++){var f=c[l],_=f.inputPath,d=_[0],p=_[1],m=void 0===p?-1:p;this.addBinding([d,m+(i?-1:1)],f.producer,f.outputIndex)}},i.deleteBindingTo=function(t){for(var e=this._bindings,i=0;i<e.length;++i)e[i].producer===t&&e.splice(i,1)},i.findBinding=function(t){var e=this._findBindingIndex(t);return e>=0?this._bindings[e]:void 0},i._findBindingIndex=function(t){return this._bindings.findIndex((function(e){return R0(e.inputPath,t)}))},i._emplaceBinding=function(t){var e=this._bindings.findIndex((function(e){return R0(e.inputPath,t.inputPath)}));e>=0?this._bindings[e]=t:this._bindings.push(t)},e}(Hu),D0=zh(C0.prototype,"_bindings",[uu],(function(){return[]})),A0=C0))||A0;function R0(t,e){var i=t[0],n=t[1],r=e[0],s=e[1];return i===r&&n===s}var F0=Kh(iQ+"PoseGraphNodeInputBinding")((I0=function(){function t(t,e,i){this._inputPath=M0&&M0(),this._producer=P0&&P0(),this._outputIndex=E0&&E0(),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}(),M0=zh(I0.prototype,"_inputPath",[uu],null),P0=zh(I0.prototype,"_producer",[uu],null),E0=zh(I0.prototype,"_outputIndex",[uu],(function(){return 0})),B0=I0))||B0,L0=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)),V0=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)),N0=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Hu),z0=new WeakMap;function U0(t){var e=z0.get(t);if(e)return e;var i={};return z0.set(t,i),i}function G0(t){return function(e){if(ie(e,N0)||(J("This kind of decorator should only be applied to pose graph node classes."),0)){var i=U0(e);t(i)}}}var H0=function(t){return G0((function(e){var i;Object.assign(null!==(i=e.appearance)&&void 0!==i?i:e.appearance={},t)}))};var W0=["arraySyncGroup"],j0=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,W0),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<n.length;++r)i.push([e,r]);else i.push([e])},o=0,h=Object.entries(s.properties);o<h.length;o++)a()}}(t.constructor),i},e.isPoseInput=function(t,e){var i=e[0],n=this._getPropertyNodeInputRecord(t.constructor,i);return!!n&&5===n.type},e.getInputMetadata=function(t,e){var i=e[0],n=e[1],r=void 0===n?-1:n,s=this._getPropertyNodeInputRecord(t.constructor,i);if(s){var a=t[i];if(Array.isArray(a)){if(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):X0(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):q0(t,e,[n,a],Y0(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<i.members.length;++s){var a=i.members[s],o=this._getPropertyNodeInputRecord(e.constructor,a),h=e[a];Array.isArray(h)&&h.length===n&&q0(t,e,[a,r],Y0(o.type))}},e._deleteInputInArraySyncGroup=function(t,e,i,n,r){for(var s=0;s<i.members.length;++s){var a=i.members[s];this._getPropertyNodeInputRecord(e.constructor,a);var o=e[a];Array.isArray(o)&&o.length===n&&X0(t,e,[a,r])}},t}();function q0(t,e,i,n){var r=t.getShell(e);if(!r)throw new V0(e);var s=i[0],a=i[1],o=void 0===a?-1:a,h=e[s];Array.isArray(h)&&(h.splice(o,0,n),r.moveArrayElementBindingForward(s,o+1,!1))}function X0(t,e,i){var n=t.getShell(e);if(!n)throw new V0(e);var r=i[0],s=i[1],a=void 0===s?-1:s,o=e[r];Array.isArray(o)&&(a<0||a>=o.length||(n.deleteBinding(i),o.splice(a,1),n.moveArrayElementBindingForward(r,a+1,!0)))}function Y0(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 J0,K0=new j0;Re({NO:0,LOCAL:1,COMPONENT:2});var Q0,Z0,$0,t1,e1,i1,n1=Kh(iQ+"PoseNode")(J0=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._dependencyEvaluation=void 0,e}s(e,t);var i=e.prototype;return i.update=function(t){var e;null==(e=this._dependencyEvaluation)||e.evaluate(),this.doUpdate(t)},i.evaluate=function(t,e){var i=this.doEvaluate(t),n=i._poseTransformSpace;switch(e){default:case 0:break;case 1:1===n&&t._poseTransformsSpaceComponentToLocal(i),i._poseTransformSpace;break;case 2:0===n&&t._poseTransformsSpaceLocalToComponent(i),i._poseTransformSpace}return i},e.evaluateDefaultPose=function(t,e){switch(e){default:case 0:case 1:return t.pushDefaultedPose();case 2:return t.pushDefaultedPoseInComponentSpace()}},i._setDependencyEvaluation=function(t){this._dependencyEvaluation=t},i._forceEvaluateEvaluation=function(){var t;null==(t=this._dependencyEvaluation)||t.evaluate()},e}(N0))||J0,r1=function(t){function e(e){var i;return(i=t.call(this)||this)._outputTypes=[],i._outputTypes=e,i}s(e,t);var i=e.prototype;return i.getOutputType=function(t){return this._outputTypes[t]},i.link=function(){},n(e,[{key:"outputCount",get:function(){return this._outputTypes.length}}]),e}(N0);function s1(t){return function(e,i){var n=e.constructor;5!==t.type||ie(n,n1)?ie(n,n1)||ie(n,r1)?a1(t)(e,i):J("@input can be only applied to fields of subclasses of PoseNode or PureValueNode."):J("@input specifying pose input can be only applied to fields of subclasses of PoseNode.")}}function a1(t){return function(e,i){if("string"==typeof i){var n=e.constructor;K0.setPropertyNodeInputRecord(n,i,t),su(e,i).__internalFlags|=3}else J("@input can be only applied to string-named fields.")}}!function(t){function e(e){return t.call(this,[e])||this}s(e,t),e.prototype.selfEvaluate=function(t){t[0]=this.selfEvaluateDefaultOutput()}}(r1);var o1,h1,u1,l1,c1,f1,_1,d1,p1,m1,g1,y1,v1,b1,S1,w1,x1,T1,A1,C1,D1,B1,I1,M1,P1,E1,O1,k1,R1,F1,L1,V1,N1,z1,U1,G1,H1,W1,j1,q1,X1,Y1,J1,K1,Q1,Z1,$1,t2,e2,i2,n2,r2,s2,a2,o2,h2,u2,l2,c2,f2,_2=(Q0=Kh(iQ+"PoseGraphOutputNode"),Z0=H0({themeColor:"#CD3A58",inline:!0}),$0=a1({type:5}),Q0(t1=Z0((e1=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return y(e=t.call.apply(t,[this].concat(n))||this,"pose",i1,f(e)),e}return s(e,t),e}(N0),i1=v(e1.prototype,"pose",[uu,$0],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),t1=e1))||t1)||t1),d2=Kh(iQ+"PoseGraph")((h1=function(t){function e(){var e;return(e=t.call(this)||this)._outputNode=u1&&u1(),e._nodes=l1&&l1(),e._shells=c1&&c1(),e._shellMap=f1&&f1(),e.addNode(e._outputNode),e}s(e,t);var i=e.prototype;return i.__callOnAfterDeserializeRecursive=function(){this._nodes.length,this._shells.length;for(var t=0;t<this._nodes.length;++t){var e=this._nodes[t],i=this._shells[t];this._shellMap.set(e,i),null==e.__callOnAfterDeserializeRecursive||e.__callOnAfterDeserializeRecursive()}},i.nodes=function(){return this._nodes.values()},i.addNode=function(t){if(this._shellMap.has(t))throw new L0(t);var e=new k0;return this._shells.push(e),this._nodes.push(t),this._shellMap.set(t,e),t},i.removeNode=function(t){if(t!==this._outputNode){var e=this._nodes.indexOf(t);if(!(e<0)){this._shellMap.has(t);for(var i,n=p(this._shells);!(i=n()).done;)i.value.deleteBindingTo(t);ve(this._shells,e),ve(this._nodes,e),this._shellMap.delete(t)}}else J("Can not remove the output node.")},i.getShell=function(t){return this._shellMap.get(t)},n(e,[{key:"outputNode",get:function(){return this._outputNode}}]),e}(Hu),u1=zh(h1.prototype,"_outputNode",[uu],(function(){return new _2})),l1=zh(h1.prototype,"_nodes",[uu],(function(){return[]})),c1=zh(h1.prototype,"_shells",[uu],(function(){return[]})),f1=zh(h1.prototype,"_shellMap",[uu],(function(){return new Map})),o1=h1))||o1,p2=Kh(iQ+"Transition")((d1=function(t){function e(e,i,n){var r;return(r=t.call(this)||this).from=p1&&p1(),r.to=m1&&m1(),r.conditions=g1&&g1(),r[l$]=void 0,r.from=e,r.to=i,n&&(r.conditions=n),r}return s(e,t),e.prototype.copyTo=function(t){t.conditions=this.conditions.map((function(t){return t.clone()}))},e}(Hu),p1=zh(d1.prototype,"from",[uu],null),m1=zh(d1.prototype,"to",[uu],null),g1=zh(d1.prototype,"conditions",[uu],(function(){return[]})),_1=d1))||_1,m2=Kh(iQ+"DurationalTransition")((v1=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).destinationStart=b1&&b1(),e.relativeDestinationStart=S1&&S1(),e.startEventBinding=w1&&w1(),e.endEventBinding=x1&&x1(),e[l$]=void 0,e}return s(e,t),e.prototype.copyTo=function(e){t.prototype.copyTo.call(this,e),e.destinationStart=this.destinationStart,e.relativeDestinationStart=this.relativeDestinationStart,this.startEventBinding.copyTo(e.startEventBinding),this.endEventBinding.copyTo(e.endEventBinding)},e}(p2),b1=zh(v1.prototype,"destinationStart",[uu],(function(){return 0})),S1=zh(v1.prototype,"relativeDestinationStart",[uu],(function(){return!1})),w1=zh(v1.prototype,"startEventBinding",[uu],(function(){return new b0})),x1=zh(v1.prototype,"endEventBinding",[uu],(function(){return new b0})),y1=v1))||y1,g2=Kh(iQ+"AnimationTransition")((A1=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).duration=C1&&C1(),e.relativeDuration=D1&&D1(),e.exitConditionEnabled=B1&&B1(),e._exitCondition=I1&&I1(),e}return s(e,t),e.prototype.copyTo=function(e){t.prototype.copyTo.call(this,e),e.duration=this.duration,e.relativeDuration=this.relativeDuration,e.exitConditionEnabled=this.exitConditionEnabled,e.exitCondition=this.exitCondition},n(e,[{key:"exitCondition",get:function(){return this._exitCondition},set:function(t){this._exitCondition=t}}]),e}(m2),C1=zh(A1.prototype,"duration",[uu],(function(){return.3})),D1=zh(A1.prototype,"relativeDuration",[uu],(function(){return!1})),B1=zh(A1.prototype,"exitConditionEnabled",[uu],(function(){return!0})),I1=zh(A1.prototype,"_exitCondition",[uu],(function(){return 1})),T1=A1))||T1;function y2(t){return t instanceof g2}var v2,b2=Kh(iQ+"EmptyState")(M1=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(h0))||M1,S2=Kh(iQ+"EmptyStateTransition")((E1=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).duration=O1&&O1(),e}return s(e,t),e.prototype.copyTo=function(e){t.prototype.copyTo.call(this,e),e.duration=this.duration},e}(m2),O1=zh(E1.prototype,"duration",[uu],(function(){return.3})),P1=E1))||P1,w2=Kh(iQ+"ProceduralPoseState")((R1=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).graph=F1&&F1(),e.transitionInEventBinding=L1&&L1(),e.transitionOutEventBinding=V1&&V1(),e}s(e,t);var i=e.prototype;return i.__callOnAfterDeserializeRecursive=function(){this.graph.__callOnAfterDeserializeRecursive()},i.copyTo=function(e){return t.prototype.copyTo.call(this,e),this.transitionInEventBinding.copyTo(e.transitionInEventBinding),this.transitionOutEventBinding.copyTo(e.transitionOutEventBinding),this},e}(h0),F1=zh(R1.prototype,"graph",[uu],(function(){return new d2})),L1=zh(R1.prototype,"transitionInEventBinding",[uu],(function(){return new b0})),V1=zh(R1.prototype,"transitionOutEventBinding",[uu],(function(){return new b0})),k1=R1))||k1,x2=O0(w2),T2=Kh(iQ+"ProceduralPoseTransition")((z1=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).duration=U1&&U1(),e}return s(e,t),e.prototype.copyTo=function(e){t.prototype.copyTo.call(this,e),e.duration=this.duration},e}(m2),U1=zh(z1.prototype,"duration",[uu],(function(){return.3})),N1=z1))||N1,A2=O0(T2),C2=Kh("cc.animation.StateMachine")((H1=function(t){s(i,t);var e=i.prototype;function i(e){var i;return(i=t.call(this)||this)._states=W1&&W1(),i._transitions=j1&&j1(),i._entryState=q1&&q1(),i._exitState=X1&&X1(),i._anyState=Y1&&Y1(),i._allowEmptyStates=!0,i._allowEmptyStates=null!=e&&e,i._entryState=i._addState(new h0),i._entryState.name="Entry",i._exitState=i._addState(new h0),i._exitState.name="Exit",i._anyState=i._addState(new h0),i._anyState.name="Any",i}return e.__callOnAfterDeserializeRecursive=function(){this[w0]();for(var t=this._states.length,e=0;e<t;++e){var i=this._states[e];i instanceof D2?i.stateMachine.__callOnAfterDeserializeRecursive():(i instanceof w2||i instanceof S0)&&i.__callOnAfterDeserializeRecursive()}},e[w0]=function(){this._states.forEach((function(){})),this._transitions.forEach((function(t){t.from[r0].push(t),t.to[s0].push(t)}))},e.states=function(){return this._states},e.transitions=function(){return this._transitions},e.getTransitionsBetween=function(t,e){return c$(t),c$(e),t[r0].filter((function(t){return t.to===e}))},e.getOutgoings=function(t){return c$(t),t[r0]},e.getIncomings=function(t){return c$(t),t[s0]},e.addMotion=function(){return this._addState(new S0)},e.addSubStateMachine=function(){return this._addState(new D2(this._allowEmptyStates))},e.addEmpty=function(){if(!this._allowEmptyStates)throw new Error("Empty states are now allowed in this state machine.");return this._addState(new b2)},e.addProceduralPoseState=function(){return this._addState(new w2)},e.remove=function(t){c$(t),t!==this.entryState&&t!==this.exitState&&t!==this.anyState&&(this.eraseTransitionsIncludes(t),Se(this._states,t))},e.connect=function(t,e,i){if(c$(t),c$(e),e===this.entryState)throw new G$("to-entry");if(e===this.anyState)throw new G$("to-any");if(t===this.exitState)throw new G$("from-exit");var n=t instanceof S0||t===this._anyState?new g2(t,e,i):t instanceof b2?new S2(t,e,i):t instanceof w2?new T2(t,e,i):new p2(t,e,i);return this._transitions.push(n),t[r0].push(n),e[s0].push(n),n},e.disconnect=function(t,e){c$(t),c$(e);for(var i=t[r0],n=e[s0],r=this._transitions,s=i.filter((function(t){return t.to===e})),a=s.length,o=function(){var t=s[h];Se(i,t),Se(r,t),xe(n,(function(e){return e===t}))},h=0;h<a;++h)o()},e.removeTransition=function(t){Se(this._transitions,t),xe(t.from[r0],(function(e){return e===t})),xe(t.to[s0],(function(e){return e===t}))},e.eraseOutgoings=function(t){var e=this;c$(t);for(var i=t[r0],n=function(){var t=i[r],n=t.to;Se(e._transitions,t),xe(n[s0],(function(e){return e===t}))},r=0;r<i.length;++r)n();i.length=0},e.eraseIncomings=function(t){var e=this;c$(t);for(var i=t[s0],n=function(){var t=i[r],n=t.from;Se(e._transitions,t),xe(n[r0],(function(e){return e===t}))},r=0;r<i.length;++r)n();i.length=0},e.eraseTransitionsIncludes=function(t){this.eraseIncomings(t),this.eraseOutgoings(t)},e.adjustTransitionPriority=function(t,e){var i=t.from;if(0!==e){var n=i[r0],r=n.indexOf(t),s=$i(r+e,0,n.length-1),a=this._transitions,o=a.indexOf(t);if(s>r)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],_=a.indexOf(f);a[o]=f,o=_}a[o]=t,Xf(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 S0||h instanceof D2||h instanceof b2||h instanceof w2){if(h instanceof b2&&!t._allowEmptyStates)continue;var u=J$(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 b2||f.to instanceof b2)){var _=a.get(f.from),d=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}(Hu),W1=zh(H1.prototype,"_states",[uu],(function(){return[]})),j1=zh(H1.prototype,"_transitions",[uu],(function(){return[]})),q1=zh(H1.prototype,"_entryState",[uu],null),X1=zh(H1.prototype,"_exitState",[uu],null),Y1=zh(H1.prototype,"_anyState",[uu],null),G1=H1))||G1,D2=Kh("cc.animation.SubStateMachine")((K1=function(t){function e(e){var i;return(i=t.call(this)||this)._stateMachine=Q1&&Q1(),i._stateMachine=new C2(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}(u0),Q1=zh(K1.prototype,"_stateMachine",[uu],null),J1=K1))||J1,B2=Kh(iQ+"PoseGraphStash")(($1=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).graph=t2&&t2(),e}return s(e,t),e}(Hu),t2=zh($1.prototype,"graph",[uu],(function(){return new d2})),Z1=$1))||Z1,I2=Kh("cc.animation.Layer")((i2=function(){var t=e.prototype;function e(){this[l$]=void 0,this._stateMachine=n2&&n2(),this.name=r2&&r2(),this.weight=s2&&s2(),this.mask=a2&&a2(),this.additive=o2&&o2(),this._stashes=h2&&h2(),this._stateMachine=new C2(!0)}return t.__callOnAfterDeserializeRecursive=function(){for(var t in this.stateMachine._allowEmptyStates=!0,this.stateMachine.__callOnAfterDeserializeRecursive(),this._stashes)this._stashes[t].graph.__callOnAfterDeserializeRecursive()},t.stashes=function(){return Object.entries(this._stashes)},t.getStash=function(t){return this._stashes[t]},t.addStash=function(t){return this._stashes[t]=new B2},t.removeStash=function(t){delete this._stashes[t]},t.renameStash=function(t,e){this._stashes=T0(this._stashes,t,e)},n(e,[{key:"stateMachine",get:function(){return this._stateMachine}}]),e}(),n2=zh(i2.prototype,"_stateMachine",[uu],null),r2=zh(i2.prototype,"name",[uu],(function(){return""})),s2=zh(i2.prototype,"weight",[uu],(function(){return 1})),a2=zh(i2.prototype,"mask",[uu],(function(){return null})),o2=zh(i2.prototype,"additive",[uu],(function(){return!1})),h2=zh(i2.prototype,"_stashes",[uu],(function(){return{}})),e2=i2))||e2,M2=Kh("cc.animation.AnimationGraph")((l2=function(t){function e(){var e;return(e=t.call(this)||this)._layers=c2&&c2(),e._variables=f2&&f2(),e}s(e,t);var i=e.prototype;return i.onLoaded=function(){for(var t=this._layers,e=t.length,i=0;i<e;++i)t[i].__callOnAfterDeserializeRecursive()},i.addLayer=function(){var t=new I2;return this._layers.push(t),t},i.removeLayer=function(t){ve(this._layers,t)},i.moveLayer=function(t,e){Xf(this._layers,t,e)},i.addVariable=function(t,e,i){var n=R$(e,i);return this._variables[t]=n,n},i.removeVariable=function(t){delete this._variables[t]},i.getVariable=function(t){return this._variables[t]},i.renameVariable=function(t,e){this._variables=T0(this._variables,t,e)},n(e,[{key:"layers",get:function(){return this._layers}},{key:"variables",get:function(){return Object.entries(this._variables)}}]),e}(x0),c2=zh(l2.prototype,"_layers",[uu],(function(){return[]})),f2=zh(l2.prototype,"_variables",[uu],(function(){return{}})),u2=l2))||u2,P2=Symbol("[[createEval]]"),E2=Kh(iQ+"MotionBase")(v2=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.__callOnAfterDeserializeRecursive=function(){},e}(Hu))||v2,O2=t("aw",function(){function t(t){var e,i;this.ratios=void 0,this._findRatio=void 0,this.ratios=t;for(var n=!0,r=1,s=t.length;r<s;r++)if(e=t[r]-t[r-1],1===r)i=e;else if(Math.abs(e-i)>1e-6){n=!1;break}this._findRatio=n?L2:kh}return t.prototype.sample=function(t){return this._findRatio(this.ratios,t)},t}());A.RatioSampler=O2;var k2=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<s.length;r++){var a=s[r];this.types[a]=n(e.easingMethods[a])}}else this.type=null;var o=e.values[0];(void 0===e.interpolate||e.interpolate)&&(this._lerp=W2(o)),void 0!==e._arrayLength&&(this._array=new Array(e._arrayLength))}t.Bezier=function(t){return t};var e=t.prototype;return e.hasLerp=function(){return!!this._lerp},e.valueAt=function(t){if(void 0===this._array){var e=this._values[t];return e&&e.getNoLerp?e.getNoLerp():e}for(var i=0;i<this._array.length;++i)this._array[i]=this._values[this._array.length*t+i];return this._array},e.valueBetween=function(t,e,i,n,r){if(this._lerp){var s=this.types?this.types[e]:this.type,a=r-i,o=(t-i)/a;if(s&&(o=F2(o,s)),void 0===this._array){var h=this._values[e],u=this._values[n];return this._lerp(h,u,o,a*this._duration)}for(var l=0;l<this._array.length;++l){var c=this._values[this._array.length*e+l],f=this._values[this._array.length*n+l];this._array[l]=this._lerp(c,f,o,a*this._duration)}return this._array}if(void 0===this._array)return this.valueAt(e);for(var _=0;_<this._array.length;++_)this._array[_]=this._values[this._array.length*e+_];return this._array},e.empty=function(){return 0===this._values.length},e.constant=function(){return 1===this._values.length},t}());function R2(t,e,i){var n=e.sample(i);if(n<0)if((n=~n)<=0)n=0;else{if(!(n>=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 F2(t,e){if("string"==typeof e){var i=Hl[e];i?t=i(t):ht(3906,e)}else Array.isArray(e)&&(t=jc(e,t));return t}function L2(t,e){var i=t.length-1;if(0===i)return 0;var n=t[0];if(e<n)return 0;var r=t[i];if(e>r)return i;var s=(e=(e-n)/(r-n))/(1/i),a=0|s,o=1e-6;return s-a<o?a:a+1-s<o?a+1:~(a+1)}k2.Linear=null,A.AnimCurve=k2,t("ay",function(){function t(){this.events=[]}return t.prototype.add=function(t,e){this.events.push({func:t||"",params:e||[]})},t}()),A.sampleAnimationCurve=R2;var V2,N2,z2,U2,G2,H2,W2=function(){function t(t){var e=new t;return function(i,n,r){return t.lerp(e,i,n,r),e}}function e(t,e,i,n){return t.lerp(e,i,n)}return function(i){if(null!==i){if("number"==typeof i)return en;if("object"==typeof i&&i.constructor){if(i instanceof kr)return n=new kr,function(t,e,i){return kr.slerp(n,t,e,i)};if(i instanceof Fe)return t(i.constructor);if(i.constructor===Number)return en;if("function"==typeof i.lerp)return e}var n}}}(),j2=Kh(iQ+"UntypedTrackChannel")((N2=function(t){function e(){var e;return(e=t.call(this,new Zl)||this).property=z2&&z2(),e}return s(e,t),e}(eZ),z2=zh(N2.prototype,"property",[uu],(function(){return""})),V2=N2))||V2,q2=Kh(iQ+"UntypedTrack")((G2=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._channels=H2&&H2(),e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[nQ]=function(){throw new Error("UntypedTrack should be handled specially. Please file an issue.")},i.createLegacyEval=function(t){var e=this,i=function(t){var i;return null==(i=e._channels.find((function(e){return e.property===t})))?void 0:i.curve};switch(!0){default:throw new Error(ft(3931));case t instanceof ds:return new ZZ(i("x"),i("y"));case t instanceof ir:return new $Z(i("x"),i("y"),i("z"));case t instanceof Vn:return new t$(i("x"),i("y"),i("z"),i("w"));case t instanceof cr:return new s$(i("r"),i("g"),i("b"),i("a"));case t instanceof ms:return new h$(i("width"),i("height"))}},i.addChannel=function(t){var e=new j2;return e.property=t,this._channels.push(e),e},i.upgrade=function(t){var e=this,i=function(t,i){var n=e.channels().find((function(e){return e.property===t}));n&&(i.name=n.name,i.curve.assignSorted(Array.from(n.curve.times()),Array.from(n.curve.values())))},n=t(this.path,this.proxy);switch(n){default:case"size":break;case"vec2":case"vec3":case"vec4":var r=new QZ;r.path=this.path,r.proxy=this.proxy,r.componentsCount="vec2"===n?2:"vec3"===n?3:4;var s=r.channels(),a=s[0],o=s[1],h=s[2],u=s[3];switch(n){case"vec4":i("w",u);case"vec3":i("z",h);default:i("x",a),i("y",o)}return r;case"color":var l=new r$,c=l.channels(),f=c[0],_=c[1],d=c[2],p=c[3];return i("r",f),i("g",_),i("b",d),i("a",p),i("x",f),i("y",_),i("z",d),i("w",p),l}return null},e}(tZ),H2=zh(G2.prototype,"_channels",[uu],(function(){return[]})),U2=G2))||U2,X2=function(){function t(t){this._keys=[],this._curves=[],this._commonTargets=[],this._ratioSamplers=[],this._runtimeCurves=void 0,this._data=null,this._duration=void 0,this._duration=t}var e=t.prototype;return e.getPropertyCurves=function(){return this._runtimeCurves||this._createPropertyCurves(),this._runtimeCurves},e.toTracks=function(){for(var t,e=[],i=this.keys,n=this.curves,r=this.commonTargets,s=function(t,e,i){for(var n,r=new JQ,s=p(e);!(n=s()).done;){var a=n.value;"string"==typeof a?r.toProperty(a):"number"==typeof a?r.toElement(a):a instanceof WQ?r.toHierarchy(a.path):a instanceof jQ?r.toComponent(a.component):r.toCustomized(a)}t.path=r,t.proxy=i},a=r.map((function(t){var i=new q2;return s(i,t.modifiers,t.valueAdapter),e.push(i),i})),o=function(){var n,r=t.value,o=r.data,h=o.values;if(0===h.length)return 0;var u=o.keys<0?[0]:i[o.keys],l=h[0],c=null===(n=o.interpolate)||void 0===n||n;o._arrayLength;var f,_=new J2(o,u.length),d=function(t){s(t,r.modifiers,r.valueAdapter)};if("number"==typeof r.commonTarget){if(!h.every((function(t){return"number"==typeof t})))return at(3932),0;if(r.valueAdapter||1!==r.modifiers.length||"string"!=typeof r.modifiers[0])return at(3933),0;var p=r.modifiers[0],m=a[r.commonTarget].addChannel(p).curve;f=m}!function(){if("number"==typeof l){if(!h.every((function(t){return"number"==typeof t})))return void at(3934);var t;if(f)t=f;else{var i=new zZ;d(i),e.push(i),t=i.channel.curve}var n=c?0:1;return t.assignSorted(u,h.map((function(t){return{value:t,interpolationMode:n}}))),void _.convert(t)}if("object"==typeof l)switch(!0){default:break;case Y2(h,ds):case Y2(h,ir):case Y2(h,Vn):var r=l instanceof ds?2:l instanceof ir?3:4,s=new QZ;d(s),s.componentsCount=r;var a=s.channels(),o=a[0].curve,p=a[1].curve,m=a[2].curve,g=a[3].curve,y=c?0:1,v=function(t){return{value:t,interpolationMode:y}};switch(r){case 4:g.assignSorted(u,h.map((function(t){return v(t.w)}))),_.convert(g);case 3:m.assignSorted(u,h.map((function(t){return v(t.z)}))),_.convert(m);default:o.assignSorted(u,h.map((function(t){return v(t.x)}))),_.convert(o),p.assignSorted(u,h.map((function(t){return v(t.y)}))),_.convert(p)}return void e.push(s);case Y2(h,kr):var b=new e$;d(b);var S=c?0:1;return b.channel.curve.assignSorted(u,h.map((function(t){return{value:kr.clone(t),interpolationMode:S}}))),_.convertQuatCurve(b.channel.curve),void e.push(b);case Y2(h,cr):var w=new r$;d(w);var x=w.channels(),T=x[0].curve,A=x[1].curve,C=x[2].curve,D=x[3].curve,B=c?0:1,I=function(t){return{value:t,interpolationMode:B}};return T.assignSorted(u,h.map((function(t){return I(t.r)}))),_.convert(T),A.assignSorted(u,h.map((function(t){return I(t.g)}))),_.convert(A),C.assignSorted(u,h.map((function(t){return I(t.b)}))),_.convert(C),D.assignSorted(u,h.map((function(t){return I(t.a)}))),_.convert(D),void e.push(w);case Y2(h,ms):var M=new o$;d(M);var P=M.channels(),E=P[0].curve,O=P[1].curve,k=c?0:1,R=function(t){return{value:t,interpolationMode:k}};return E.assignSorted(u,h.map((function(t){return R(t.width)}))),_.convert(E),O.assignSorted(u,h.map((function(t){return R(t.height)}))),_.convert(O),void e.push(M);case Y2(h,NZ):_.nil;var F=new zZ;d(F);var L=c?2:1;return F.channel.curve.assignSorted(u,h.map((function(t){return{value:t.dataPoint,leftTangent:t.inTangent,rightTangent:t.outTangent,interpolationMode:L}}))),void e.push(F);case Y2(h,RZ):case Y2(h,FZ):case Y2(h,LZ):_.nil;var V=l instanceof RZ?2:l instanceof FZ?3:4,N=new QZ;d(N),N.componentsCount=V;var z=N.channels(),U=z[0],G=z[1],H=z[2],W=z[3],j=c?0:1,q=function(t,e,i){return{value:t,leftTangent:e,rightTangent:i,interpolationMode:j}};switch(V){case 4:W.curve.assignSorted(u,h.map((function(t){return q(t.dataPoint.w,t.inTangent.w,t.outTangent.w)})));case 3:H.curve.assignSorted(u,h.map((function(t){return q(t.dataPoint.z,t.inTangent.z,t.outTangent.z)})));default:U.curve.assignSorted(u,h.map((function(t){return q(t.dataPoint.y,t.inTangent.y,t.outTangent.y)}))),G.curve.assignSorted(u,h.map((function(t){return q(t.dataPoint.x,t.inTangent.x,t.outTangent.x)})))}return void e.push(N);case h.every((function(t){return t instanceof VZ})):at(3935)}var X=new u$;d(X),X.channel.curve.assignSorted(u,h),e.push(X)}()},h=p(n);!(t=h()).done;)o();return e},e._createPropertyCurves=function(){var t=this;this._ratioSamplers=this._keys.map((function(e){return new O2(e.map((function(e){return e/t._duration})))})),this._runtimeCurves=this._curves.map((function(e){return{curve:new k2(e.data,t._duration),modifiers:e.modifiers,valueAdapter:e.valueAdapter,sampler:t._ratioSamplers[e.data.keys],commonTarget:e.commonTarget}}))},n(t,[{key:"keys",get:function(){return this._keys},set:function(t){this._keys=t}},{key:"curves",get:function(){return this._curves},set:function(t){this._curves=t,delete this._runtimeCurves}},{key:"commonTargets",get:function(){return this._commonTargets},set:function(t){this._commonTargets=t}},{key:"data",get:function(){return this._data}}]),t}();function Y2(t,e){return t.every((function(t){return t instanceof e}))}var J2=function(){function t(t,e){this._easingMethods=void 0;var i=t.easingMethods;Array.isArray(i)?0===i.length&&0!==e?this._easingMethods=new Array(e).fill(null):this._easingMethods=i:this._easingMethods=void 0===i?new Array(e).fill(t.easingMethod):Array.from({length:e},(function(t,e){var n;return null!==(n=i[e])&&void 0!==n?n:null}))}var e=t.prototype;return e.convert=function(t){var e,i,n,r,s,a,o,h,u,l,c,f,_,d,p,m,g,y,v,b,S,w,x=this._easingMethods;if(x){var T=t.keyFramesCount;if(!(t.keyFramesCount<2)){Array.isArray(x)&&x.length;for(var A=T-1,C=0;C<A;++C){var D=x[C];D&&(Array.isArray(D)?(i=D,n=t.getKeyframeTime(C),r=t.getKeyframeValue(C),s=t.getKeyframeTime(C+1),a=t.getKeyframeValue(C+1),o=void 0,h=void 0,u=void 0,l=void 0,c=void 0,f=void 0,_=void 0,d=void 0,p=void 0,m=void 0,g=void 0,y=void 0,v=void 0,b=void 0,S=void 0,w=void 0,o=i[0],h=i[1],u=i[2],l=i[3],c=r.value,f=3*(s-n),_=3*(a.value-c),m=(1-u)*f,g=(1-l)*_,y=1/3,v=(p=h*_)/(d=o*f),b=Math.sqrt(d*d+p*p)*y,S=g/m,w=Math.sqrt(m*m+g*g)*y,r.interpolationMode=2,r.tangentWeightMode=0===(e=r.tangentWeightMode)?2:1===e?3:e,r.rightTangent=v,r.rightTangentWeight=b,a.tangentWeightMode=x3(a.tangentWeightMode),a.leftTangent=S,a.leftTangentWeight=w):K2(D,t,C))}}}},e.convertQuatCurve=function(t){var e=this._easingMethods;if(e){var i=t.keyFramesCount;if(!(t.keyFramesCount<2)){Array.isArray(e)&&e.length;for(var n=i-1,r=0;r<n;++r){var s=e[r];s&&(Array.isArray(s)?t.getKeyframeValue(r).easingMethod=s.slice():Q2(s,t,r))}}}},n(t,[{key:"nil",get:function(){return!this._easingMethods||this._easingMethods.every((function(t){return null==t}))}}]),t}();function K2(t,e,i){e.keyFramesCount;var n=e.getKeyframeValue(i),r=w3[t];1===r?n.interpolationMode=1:(n.interpolationMode=0,n.easingMethod=r)}function Q2(t,e,i){e.keyFramesCount;var n=e.getKeyframeValue(i),r=w3[t];n.easingMethod=r}var Z2,$2,t3,e3,i3,n3,r3,s3,a3,o3,h3,u3,l3,c3,f3,_3,d3,p3,m3,g3,y3,v3,b3,S3,w3={constant:1,linear:0,quadIn:2,quadOut:3,quadInOut:4,quadOutIn:5,cubicIn:6,cubicOut:7,cubicInOut:8,cubicOutIn:9,quartIn:10,quartOut:11,quartInOut:12,quartOutIn:13,quintIn:14,quintOut:15,quintInOut:16,quintOutIn:17,sineIn:18,sineOut:19,sineInOut:20,sineOutIn:21,expoIn:22,expoOut:23,expoInOut:24,expoOutIn:25,circIn:26,circOut:27,circInOut:28,circOutIn:29,elasticIn:30,elasticOut:31,elasticInOut:32,elasticOutIn:33,backIn:34,backOut:35,backInOut:36,backOutIn:37,bounceIn:38,bounceOut:39,bounceInOut:40,bounceOutIn:41,smooth:42,fade:43};function x3(t){return 0===t?1:2===t?3:t}var T3=Kh,A3=uu;function C3(){throw new Error("split() only valid in Editor.")}T3(iQ+"ExoticAnimation")((Z2=function(){function t(){this._nodeAnimations=$2&&$2()}var e=t.prototype;return e.createEvaluator=function(t){return new R3(this._nodeAnimations,t)},e.createEvaluatorForAnimationGraph=function(t){return new V3(this._nodeAnimations,t)},e.addNodeAnimation=function(t){var e=new D3(t);return this._nodeAnimations.push(e),e},e.collectAnimatedJoints=function(){return Array.from(new Set(this._nodeAnimations.map((function(t){return t.path}))))},e.split=function(){return C3()},e.toHashString=function(){return this._nodeAnimations.map((function(t){return t.toHashString()})).join("\n")},t}(),$2=zh(Z2.prototype,"_nodeAnimations",[A3],(function(){return[]})),Z2));var D3=T3(iQ+"ExoticNodeAnimation")((e3=function(){function t(t){this._path=i3&&i3(),this._position=n3&&n3(),this._rotation=r3&&r3(),this._scale=s3&&s3(),this._path=t}var e=t.prototype;return e.createPosition=function(t,e){this._position=new O3(t,new P3(e))},e.createRotation=function(t,e){this._rotation=new O3(t,new E3(e))},e.createScale=function(t,e){this._scale=new O3(t,new P3(e))},e.createEvaluator=function(t){return new F3(this._path,this._position,this._rotation,this._scale,t)},e.createEvaluatorForAnimationGraph=function(t){var e=t.bindTransform(this._path);return e?new N3(e,this._position,this._rotation,this._scale):null},e.split=function(){return C3()},e.toHashString=function(){var t,e,i,n,r,s;return this._path+"\n"+(null!==(t=null==(e=this._position)?void 0:e.toHashString())&&void 0!==t?t:"")+(null!==(i=null==(n=this._scale)?void 0:n.toHashString())&&void 0!==i?i:"")+(null!==(r=null==(s=this._rotation)?void 0:s.toHashString())&&void 0!==r?r:"")},n(t,[{key:"path",get:function(){return this._path}}]),t}(),i3=zh(e3.prototype,"_path",[A3],(function(){return""})),n3=zh(e3.prototype,"_position",[A3],(function(){return null})),r3=zh(e3.prototype,"_rotation",[A3],(function(){return null})),s3=zh(e3.prototype,"_scale",[A3],(function(){return null})),t3=e3))||t3;function B3(t){return t.toPrecision(2)}function I3(t){return t.map((function(t){return Number.parseFloat(B3(t))})).join(" ")}var M3=T3(iQ+"ExoticVectorLikeTrackValues")((o3=function(){function t(t){this._values=h3&&h3(),this._isQuantized=u3&&u3(),this._values=t}var e=t.prototype;return e.quantize=function(t){this._isQuantized,this._values=Y3(this._values,t),this._isQuantized=!0},e.toHashString=function(){var t=this._isQuantized,e=this._values;return t+" "+(t?e.toHashString():I3(e))},n(t,[{key:"precision",get:function(){return this._isQuantized?this._values.originalPrecision:G3(this._values)}}]),t}(),h3=zh(o3.prototype,"_values",[A3],null),u3=zh(o3.prototype,"_isQuantized",[A3],(function(){return!1})),a3=o3))||a3,P3=T3(iQ+"ExoticVec3TrackValues")(l3=function(t){function e(){return t.apply(this,arguments)||this}s(e,t),e.imitate=function(t,i){var n=new e(t);return i._isQuantized&&n.quantize(i._values.quantizationType),n};var i=e.prototype;return i.get=function(t,e){var i=this._values;this._isQuantized?Q3(i,t,e):ir.fromArray(e,i,3*t)},i.lerp=function(t,e,i,n,r,s){var a=this._values;this._isQuantized?(Q3(a,t,n),Q3(a,e,r)):(ir.fromArray(n,a,3*t),ir.fromArray(r,a,3*e)),ir.lerp(s,n,r,i)},e}(M3))||l3,E3=T3(iQ+"ExoticQuatTrackValues")(c3=function(t){function e(){return t.apply(this,arguments)||this}s(e,t),e.imitate=function(t,i){var n=new e(t);return i._isQuantized&&n.quantize(i._values.quantizationType),n};var i=e.prototype;return i.get=function(t,e){var i=this._values;this._isQuantized?Z3(i,t,e):kr.fromArray(e,i,4*t)},i.lerp=function(t,e,i,n,r,s){var a=this._values;this._isQuantized?(Z3(a,t,n),Z3(a,e,r)):(kr.fromArray(n,a,4*t),kr.fromArray(r,a,4*e)),kr.slerp(s,n,r,i)},e}(M3))||c3,O3=T3(iQ+"ExoticTrack")((_3=function(){function t(t,e){this.times=d3&&d3(),this.values=p3&&p3(),this.times=t,this.values=e}return t.prototype.toHashString=function(){var t=this.times,e=this.values;return"times: "+I3(t)+"; values: "+e.toHashString()},t}(),d3=zh(_3.prototype,"times",[A3],null),p3=zh(_3.prototype,"values",[A3],null),f3=_3))||f3;function k3(t,e){t.length,t.length;var i=0,n=0,r=kh(t,e);if(r>=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<r);else if(e>=s)a=n-1,o=0;else{var h=k3(t,e);a=h.index,o=h.ratio}var u=0,l=0;if(i<r);else if(i>=s)u=n-1,l=0;else{var c=k3(t,i);u=c.index,l=c.ratio}var f=!o,_=!l;a!==u||o!==l?(f||(this.preLerpIndex=a,this.preLerpRatio=o),this.directKeyframesBegin=f?a:a+1,this.directKeyframesEnd=u+1,_||(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 R3=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}(),F3=function(){function t(t,e,i,n,r){this._position=null,this._rotation=null,this._scale=null,e&&(this._position=K3(e.times,e.values,ir,t,"position",r)),i&&(this._rotation=K3(i.times,i.values,kr,t,"rotation",r)),n&&(this._scale=K3(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}(),L3=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=z3(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}(),V3=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;i<e;++i)t[i].destroy()},e.evaluate=function(t,e){for(var i=this._nodeEvaluations,n=i.length,r=0;r<n;++r)i[r].evaluate(t,e)},t}(),N3=function(){function t(t,e,i,n){this._position=null,this._rotation=null,this._scale=null,this._transformHandle=void 0,this._transformHandle=t,e&&(this._position=new L3(e.times,e.values,ir)),i&&(this._rotation=new L3(i.times,i.values,kr)),n&&(this._scale=new L3(n.times,n.values,ir))}var e=t.prototype;return e.destroy=function(){this._transformHandle.destroy()},e.evaluate=function(t,e){var i=this._transformHandle.index,n=this._position,r=this._rotation,s=this._scale,a=e.transforms;if(n){var o=n.evaluate(t);a.setPosition(i,o)}if(r){var h=r.evaluate(t);a.setRotation(i,h)}if(s){var u=s.evaluate(t);a.setScale(i,u)}},t}();function z3(t,e,i){var n=t.length,r=t[0],s=t[n-1];if(e<r)i.just=!0,i.index=0;else if(e>s)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 U3={uint8:Uint8Array,uint16:Uint16Array};function G3(t){switch(t.BYTES_PER_ELEMENT){default:case 4:return 0;case 8:return 1}}var H3,W3,j3,q3,X3=T3(iQ+"QuantizedFloatArray")((g3=function(){function t(t,e,i,n){void 0===n&&(n=0),this.originalPrecision=y3&&y3(),this.min=v3&&v3(),this.extent=b3&&b3(),this.values=S3&&S3(),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+" "+B3(e)+" "+B3(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}(),y3=zh(g3.prototype,"originalPrecision",[A3],null),v3=zh(g3.prototype,"min",[A3],null),b3=zh(g3.prototype,"extent",[A3],null),S3=zh(g3.prototype,"values",[A3],null),m3=g3))||m3;function Y3(t,e){var i=U3[e],n=1<<i.BYTES_PER_ELEMENT,r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;t.forEach((function(t){r=Math.min(t,r),s=Math.max(t,s)}));var a=s-r,o=i.from(t,(function(t){return(t-r)/a*n}));return new X3(G3(t),o,a,r)}function J3(t,e){return t.values[e]/(1<<t.values.BYTES_PER_ELEMENT)*t.extent+t.min}function K3(t,e,i,n,r,s){var a=new KQ;a.path=(new JQ).toHierarchy(n).toProperty(r);var o=s(a);return o?{runtimeBinding:o,evaluator:new L3(t,e,i)}:null}function Q3(t,e,i){ir.set(i,J3(t,3*e+0),J3(t,3*e+1),J3(t,3*e+2))}function Z3(t,e,i){kr.set(i,J3(t,4*e+0),J3(t,4*e+1),J3(t,4*e+2),J3(t,4*e+3))}var $3,t5,e5,i5,n5,r5,s5,a5,o5,h5,u5,l5,c5,f5,_5,d5,p5,m5,g5,y5=Kh(iQ+"AuxiliaryCurveEntry")((W3=function(){this.name=j3&&j3(),this.curve=q3&&q3()},j3=zh(W3.prototype,"name",[uu],(function(){return""})),q3=zh(W3.prototype,"curve",[uu],(function(){return new Zl})),H3=W3))||H3,v5=Symbol("SearchForRootBonePath"),b5=Symbol("ExoticAnimation"),S5=Symbol("[[EmbeddedPlayerCount]]"),w5=Symbol("[[GetEmbeddedPlayers]]"),x5=Symbol("[[AddEmbeddedPlayer]]"),T5=Symbol("[[RemoveEmbeddedPlayer]]"),A5=Symbol("[[ClearEmbeddedPlayers]]"),C5=Symbol("[[Additive Settings]]"),D5=t("at",Kh("cc.AnimationClip")((_5=function(t){function e(e){var i;return(i=t.call(this,e)||this).sample=e5&&e5(),i.speed=i5&&i5(),i.wrapMode=n5&&n5(),i.enableTrsBlending=r5&&r5(),i._duration=s5&&s5(),i._hash=a5&&a5(),i.frameRate=0,i._tracks=o5&&o5(),i._exoticAnimation=h5&&h5(),i._legacyData=void 0,i._legacyDataDirty=!1,i._events=u5&&u5(),i._embeddedPlayers=l5&&l5(),i._additiveSettings=c5&&c5(),i._auxiliaryCurveEntries=f5&&f5(),i._runtimeEvents={ratios:[],eventGroups:[]},i}s(e,t),e.createWithSpriteFrames=function(t,i){var n=new e;n.sample=i||n.sample,n.duration=t.length/n.sample;var r=1/n.sample,s=new u$;return s.path=(new JQ).toComponent("cc.Sprite").toProperty("spriteFrame"),s.channels()[0].curve.assignSorted(t.map((function(t,e){return[r*e,t]}))),n.addTrack(s),n};var i=e.prototype;return i.onLoaded=function(){this.frameRate=this.sample,this.events=this._events},i.range=function(){for(var t={min:1/0,max:-1/0},e=this._tracks,i=e.length,n=0;n<i;++n){var r=e[n].range();t.min=Math.min(t.min,r.min),t.max=Math.max(t.max,r.max)}return t},i.getTrack=function(t){return this._tracks[t]},i.addTrack=function(t){var e=this._tracks.length;return this._tracks.push(t),e},i.removeTrack=function(t){this._tracks.splice(t,1)},i.clearTracks=function(){this._tracks.length=0},i.containsAnyEvent=function(){return 0!==this._events.length},i.createEventEvaluator=function(t){return new N5(t,this._runtimeEvents.ratios,this._runtimeEvents.eventGroups,this.wrapMode)},i.containsAnyEmbeddedPlayer=function(){return 0!==this._embeddedPlayers.length},i.createEmbeddedPlayerEvaluator=function(t){return new M5(this._embeddedPlayers,t)},i.createEvaluator=function(t){var e=this,i=t.target;return this._createEvalWithBinder(i,(function(n){if(!t.mask||!n.isMaskedOff(t.mask)){var r=n.createRuntimeBinding(i,e.enableTrsBlending?t.pose:void 0,!1);return null!=r?r:void 0}}),t.rootMotion)},i.destroy=function(){var e,i=null==(e=A.director.root)?void 0:e.dataPoolManager;return i&&i.releaseAnimationClip(this),oY.destroy(this),t.prototype.destroy.call(this)},i[aY]=function(t,e,i){for(var n=1/e,r=this._collectAnimatedJoints(),s=r.length,a={},o=0;o<s;++o)a[r[o]]={transforms:Array.from({length:i},(function(){return new Kr}))};var h=r.reduce((function(t,e){return t[e]=new O5,t}),{});for(var u in h){var l=h[u],c=u.lastIndexOf("/");if(c>=0){var f=u.substring(0,c),_=h[f];_&&(l.parent=_)}}for(var d=this._createEvalWithBinder(void 0,(function(t){var e=t.parseTrsPath();if(e){var i=h[e.node];if(i)return L5(i,e.property)}}),void 0),p=0;p<i;++p){var m=t+n*p;d.evaluate(m);for(var g=0;g<s;++g){var y=r[g];Kr.copy(a[y].transforms[p],h[y].globalTransform)}for(var v=0;v<s;++v){var b=r[v];h[b].invalidate()}}return{samples:e,frames:i,joints:a}},i.upgradeUntypedTracks=function(t){for(var e=[],i=[],n=this._tracks,r=n.length,s=0;s<r;++s){var a=n[s];if(a instanceof q2){var o=a.upgrade(t);o&&(e.push(o),i.push(a))}}for(var h=i.length,u=0;u<h;++u)Se(n,i[u]);n.push.apply(n,e)},i[v5]=function(){return this._searchForRootBonePath()},i.getPropertyCurves=function(){return this._getLegacyData().getPropertyCurves()},i.updateEventDatas=function(){this.events=this._events},i.hasEvents=function(){return 0!==this.events.length},i.syncLegacyData=function(){this._legacyData&&(this._fromLegacy(this._legacyData),this._legacyData=void 0)},i[w5]=function(){return this._embeddedPlayers},i[x5]=function(t){this._embeddedPlayers.push(t)},i[T5]=function(t){var e=this._embeddedPlayers.indexOf(t);e>=0&&this._embeddedPlayers.splice(e,1)},i[A5]=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 y5).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){xe(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<h;++u){var l=o[u];if(!r.includes(l)&&!Array.from(l.channels()).every((function(t){return 0===t.curve.keyFramesCount}))){var c=e(l[YQ]);if(c){var f=void 0;if(l instanceof q2){if(!c.getValue){ht(3930);continue}var _=c.getValue();f=l.createLegacyEval(_)}else f=l[nQ]();a.push(new I5(c,f))}}}return this._exoticAnimation&&(s=this._exoticAnimation.createEvaluator(e)),new P5(a,s,n)},i._createRootMotionEvaluation=function(t,e,i){if(t instanceof eb){var n=this._searchForRootBonePath();if(n){var r=t.getChildByPath(n);if(r){for(var s=new E5,a=[],o=this._tracks,h=o.length,u=0;u<h;++u){var l=o[u],c=l[YQ].parseTrsPath();if(c&&c.node===n){i.push(l);var f=L5(s,c.property);if(f){var _=l[nQ]();a.push(new I5(f,_))}}}return new R5(r,this._duration,s,a)}at(3924)}else at(3923)}else ht(3920)},i._searchForRootBonePath=function(){var t=this._tracks.map((function(t){var e=t[YQ].parseTrsPath();if(e){var i=e.node;return{path:i,rank:i.split("/").length}}return{path:"",rank:0}}));t.sort((function(t,e){return t.rank-e.rank}));var e=t.findIndex((function(t){return 0!==t.rank}));if(e<0)return"";for(var i=t.length,n=t[e],r=!0,s=e+1;s<i;++s){var a=t[s];if(a.rank!==n.rank)break;if(a.path!==n.path){r=!1;break}}return r?n.path:""},i._getLegacyData=function(){return this._legacyData||(this._legacyData=this._toLegacy()),this._legacyData},i._toLegacy=function(){var t=new X2(this._duration);return t.keys=[],t.curves=[],t.commonTargets=[],t},i._fromLegacy=function(t){for(var e=t.toTracks(),i=e.length,n=0;n<i;++n)this.addTrack(e[n])},i._collectAnimatedJoints=function(){for(var t=new Set,e=this._tracks,i=e.length,n=0;n<i;++n){var r=e[n][YQ].parseTrsPath();r&&t.add(r.node)}if(this._exoticAnimation)for(var s=this._exoticAnimation.collectAnimatedJoints(),a=s.length,o=0;o<a;++o)t.add(s[o]);return Array.from(t)},i._findAuxiliaryCurveEntry=function(t){return this._auxiliaryCurveEntries.find((function(e){return e.name===t}))},n(e,[{key:"duration",get:function(){return this._duration},set:function(t){this._duration=t}},{key:"tracksCount",get:function(){return this._tracks.length}},{key:"tracks",get:function(){return this._tracks}},{key:"hash",get:function(){var t,e;if(this._hash)return this._hash;var i="Exotic:"+(null!==(t=null==(e=this._exoticAnimation)?void 0:e.toHashString())&&void 0!==t?t:"");return this._hash=qf(i,666)}},{key:"events",get:function(){return this._events},set:function(t){var e=this;this._events=t;for(var i=[],n=[],r=this.events.sort((function(t,e){return t.frame-e.frame})),s=r.length,a=function(){var t=r[o],s=t.frame/e._duration,a=i.findIndex((function(t){return t===s}));a<0&&(a=i.length,i.push(s),n.push({events:[]})),n[a].events.push({functionName:t.func,parameters:t.params})},o=0;o<s;++o)a();this._runtimeEvents={ratios:i,eventGroups:n}}},{key:b5,get:function(){return this._exoticAnimation}},{key:b5,set:function(t){this._exoticAnimation=t}},{key:"isAdditive_experimental",get:function(){return this._additiveSettings.enabled}},{key:C5,get:function(){return this._additiveSettings}},{key:"keys",get:function(){return this._getLegacyData().keys}},{key:"keys",set:function(t){this._legacyDataDirty=!0,this._getLegacyData().keys=t}},{key:"curves",get:function(){return this._legacyDataDirty=!0,this._getLegacyData().curves}},{key:"curves",set:function(t){this._getLegacyData().curves=t}},{key:"commonTargets",get:function(){return this._getLegacyData().commonTargets}},{key:"commonTargets",set:function(t){this._legacyDataDirty=!0,this._getLegacyData().commonTargets=t}},{key:"data",get:function(){return this._getLegacyData().data}},{key:"eventGroups",get:function(){return this._runtimeEvents.eventGroups}},{key:S5,get:function(){return this._embeddedPlayers.length}},{key:"auxiliaryCurveCount_experimental",get:function(){return this._auxiliaryCurveEntries.length}}]),e}(Cm),_5.WrapMode=oQ,e5=zh((t5=_5).prototype,"sample",[uu],(function(){return 60})),i5=zh(t5.prototype,"speed",[uu],(function(){return 1})),n5=zh(t5.prototype,"wrapMode",[uu],(function(){return oQ.Normal})),r5=zh(t5.prototype,"enableTrsBlending",[uu],(function(){return!1})),s5=zh(t5.prototype,"_duration",[uu],(function(){return 0})),a5=zh(t5.prototype,"_hash",[uu],(function(){return 0})),o5=zh(t5.prototype,"_tracks",[uu],(function(){return[]})),h5=zh(t5.prototype,"_exoticAnimation",[uu],(function(){return null})),u5=zh(t5.prototype,"_events",[uu],(function(){return[]})),l5=zh(t5.prototype,"_embeddedPlayers",[uu],(function(){return[]})),c5=zh(t5.prototype,"_additiveSettings",[uu],(function(){return new B5})),f5=zh(t5.prototype,"_auxiliaryCurveEntries",[uu],(function(){return[]})),$3=t5))||$3),B5=Kh("cc.AnimationClipAdditiveSettings")((p5=function(){this.enabled=m5&&m5(),this.refClip=g5&&g5()},m5=zh(p5.prototype,"enabled",[uu],(function(){return!1})),g5=zh(p5.prototype,"refClip",[uu],(function(){return null})),d5=p5))||d5;A.AnimationClip=D5;var I5=function(){function t(t,e){this._binding=void 0,this._trackEval=void 0,this._shouldEvaluateDefault=!0,this._binding=t,this._trackEval=e,this._shouldEvaluateDefault=!!t.getValue&&e.requiresDefault}return t.prototype.evaluate=function(t){var e=this._binding,i=this._trackEval,n=this._shouldEvaluateDefault?e.getValue():void 0,r=i.evaluate(t,n);e.setValue(r)},t}(),M5=function(){function t(t,e){this._embeddedPlayers=t,this._embeddedPlayerEvaluationInfos=t.map((function(t){var i=t.playable;if(!i)return null;var n=i.instantiate(e);return n?{instantiatedPlayer:n,entered:!1,hostPauseTime:0,lastIterations:0}:null}))}var e=t.prototype;return e.destroy=function(){for(var t=this._embeddedPlayerEvaluationInfos,e=t.length,i=0;i<e;++i){var n;null==(n=t[i])||n.instantiatedPlayer.destroy()}this._embeddedPlayerEvaluationInfos.length=0},e.evaluate=function(t,e){for(var i=this._embeddedPlayers,n=this._embeddedPlayerEvaluationInfos,r=i.length,s=0;s<r;++s){var a=n[s];if(a){var o=a.entered,h=a.instantiatedPlayer,u=a.lastIterations,l=i[s],c=l.begin,f=l.end;if(t>=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 _=t-c;a.instantiatedPlayer.setTime(_)}}}},e.notifyHostSpeedChanged=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r<n;++r){var s=i[r];if(s){var a=s.instantiatedPlayer;e[r].reconciledSpeed&&a.setSpeed(t)}}},e.notifyHostPlay=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r<n;++r){var s=i[r];if(s){var a=e[r],o=a.begin,h=a.end,u=s.instantiatedPlayer;if(s.entered){var l=s.hostPauseTime;if(u.randomAccess||Zi(l,t,1e-5)){var c=$i(t,o,h);u.play(),u.setTime(c-o)}else u.stop()}}}},e.notifyHostPause=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r<n;++r){var s=i[r];if(s){var a=s.instantiatedPlayer;s.entered&&(a.pause(),s.hostPauseTime=t)}}},e.notifyHostStop=function(){for(var t=this._embeddedPlayers,e=this._embeddedPlayerEvaluationInfos,i=t.length,n=0;n<i;++n){var r=e[n];if(r){var s=r.instantiatedPlayer;r.entered&&(r.entered=!1,s.stop())}}},t}(),P5=function(){function t(t,e,i){this._exoticAnimationEvaluator=void 0,this._trackEvalStatues=[],this._rootMotionEvaluation=void 0,this._trackEvalStatues=t,this._exoticAnimationEvaluator=e,this._rootMotionEvaluation=i}var e=t.prototype;return e.evaluate=function(t){for(var e=this._trackEvalStatues,i=this._exoticAnimationEvaluator,n=e.length,r=0;r<n;++r)e[r].evaluate(t);i&&i.evaluate(t)},e.evaluateRootMotion=function(t,e){var i=this._rootMotionEvaluation;i&&i.evaluate(t,e)},t}(),E5=function(){function t(){this.position=new ir,this.scale=new ir(1,1,1),this.rotation=new kr,this.eulerAngles=new ir}return t.prototype.getTransform=function(t){Kr.fromRTS(t,this.rotation,this.position,this.scale)},t}(),O5=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).parent=null,e._dirty=!0,e._transform=new Kr,e}return s(e,t),e.prototype.invalidate=function(){this._dirty=!0},n(e,[{key:"globalTransform",get:function(){var t=this._transform;return this._dirty&&(this._dirty=!1,Kr.fromRTS(t,this.rotation,this.position,this.scale),this.parent&&Kr.multiply(t,this.parent.globalTransform,t)),this._transform}}]),e}(E5),k5=new Kr,R5=function(){function t(t,e,i,n){this._initialTransformCache=new Kr,this._clipEndTransformCache=new Kr,this._startTransformCache=new Kr,this._endTransformCache=new Kr,this._motionTransformCache=new Kr,this._translationMotionCache=new ir,this._rotationMotionCache=new kr,this._scaleMotionCache=new ir,this._rootBone=t,this._duration=e,this._boneTransform=i,this._trackEvalStatuses=n}var e=t.prototype;return e.evaluate=function(t,e){var i=this._calcMotionTransform(t,e,this._motionTransformCache),n=this._translationMotionCache,r=this._rotationMotionCache,s=this._scaleMotionCache,a=this._rootBone;Kr.toSRT(i,r,n,s),ir.add(n,n,a.position),a.setPosition(n),kr.multiply(r,r,a.rotation),a.setRotation(r),ir.multiply(s,s,a.scale),a.setScale(s)},e._calcMotionTransform=function(t,e,i){var n=this._duration,r=n-t,s=this._evaluateAt(t,this._startTransformCache);if(e<r){var a=this._evaluateAt(t+e,this._endTransformCache);F5(i,s,a)}else{Kr.identity(i);var o=function(t,e){F5(k5,t,e),Kr.multiply(i,i,k5)},h=e-r,u=Math.floor(h/n),l=h-u*n,c=this._evaluateAt(0,this._initialTransformCache),f=this._evaluateAt(n,this._clipEndTransformCache),_=this._evaluateAt(l,this._endTransformCache);o(s,f),F5(k5,c,f);for(var d=0;d<u;++d)Kr.multiply(i,i,k5);o(c,_)}return i},e._evaluateAt=function(t,e){for(var i=this._trackEvalStatuses,n=i.length,r=0;r<n;++r)i[r].evaluate(t);return this._boneTransform.getTransform(e),e},t}();function F5(t,e,i){Kr.invert(t,e),Kr.multiply(t,i,t)}function L5(t,e){switch(e){default:return;case"position":return{setValue:function(e){ir.copy(t.position,e)}};case"rotation":return{setValue:function(e){kr.copy(t.rotation,e)}};case"scale":return{setValue:function(e){ir.copy(t.scale,e)}};case"eulerAngles":return{setValue:function(e){ir.copy(t.eulerAngles,e)}}}}var V5,N5=function(){function t(t,e,i,n){this._lastFrameIndex=-1,this._lastIterations=0,this._lastDirection=0,this._ignoreIndex=-1,this._sampled=!1,this._targetNode=t,this._ratios=e,this._eventGroups=i,this._wrapMode=n}var e=t.prototype;return e.setWrapMode=function(t){this._wrapMode=t},e.ignore=function(t,e){this._ignoreIndex=-1,this._sampled=!1;var i=U5(t,this._ratios);i<0&&(i=~i-1,e<0&&(i+=1),this._ignoreIndex=i)},e.reset=function(){this._lastFrameIndex=-1,this._lastIterations=0,this._lastDirection=0,this._ignoreIndex=-1,this._sampled=!1},e.sample=function(t,e,i){if(0!==this._eventGroups.length){var n=this._eventGroups.length,r=U5(t,this._ratios);if(r<0&&(r=~r-1,e<0&&(r+=1)),this._ignoreIndex!==r&&(this._ignoreIndex=-1),!this._sampled)return this._sampled=!0,this._doFire(r,!1),this._lastFrameIndex=r,this._lastIterations=i,void(this._lastDirection=e);var s=this._wrapMode,a=z5(i),o=z5(this._lastIterations),h=this._lastFrameIndex,u=this._lastDirection,l=-1!==o&&a!==o;if(h===r&&l&&1===n)this._doFire(0,!1);else if(h!==r||l){e=u;do{if(h!==r){if(-1===e&&0===h&&r>0?(22&~s?h=n:e*=-1,o++):1===e&&h===n-1&&r<n-1&&(22&~s?h=-1:e*=-1,o++),h===r)break;if(o>a)break}h+=e,this._doFire(h,!0)}while(h!==r&&h>-1&&h<n)}this._lastFrameIndex=r,this._lastIterations=i,this._lastDirection=e}},e._doFire=function(t,e){e?lQ().pushDelayEvent(this._checkAndFire,this,[t]):this._checkAndFire(t)},e._checkAndFire=function(t){if(this._targetNode&&this._targetNode.isValid){var e=this._eventGroups;if(!(t<0||t>=e.length||this._ignoreIndex===t))for(var i=e[t],n=i.events.length,r=0;r<n;++r){var s=i.events[r];l0(this._targetNode,s.functionName,s.parameters)}}},t}();function z5(t){return t-(0|t)==0&&(t-=1),0|t}function U5(t,e){return kh(e,t)}function G5(t,e,i,n,r,s){if(0===e)return s.time=0,s.ratio=0,s.direction=1,s.stopped=!!Number.isFinite(n),s.iterations=0,s;var a=!1,o=t>0?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=H5(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 H5(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 W5=new ir,j5=new ir,q5=new kr;new kr;var X5,Y5,J5=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(q5,e._rotation,i._rotation),r=ir.multiply(W5,i._scale,e._scale),s=ir.multiply(j5,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),K5(n,e._scale,Ki),ir.negate(r,e._position),ir.multiply(r,r,n),ir.transformQuat(r,r,i),t},t.fromMatrix=function(t,e){return Kr.toSRT(e,t._rotation,t._position,t._scale),t},t.toMatrix=function(t,e){return Kr.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 K5(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 Q5(t,e,i){return ir.subtract(t.position,e.position,i.position),e4(t.rotation,i.rotation,e.rotation),ir.subtract(t.scale,e.scale,i.scale),t}V5=J5,J5.IDENTITY=Object.freeze(new V5),J5.ZERO=Object.freeze(function(){var t=new V5;return ir.copy(t._position,ir.ZERO),kr.set(t._rotation,0,0,0,0),ir.copy(t._scale,ir.ZERO),t}()),J5.calculateRelative=(X5=new kr,Y5=new ir,function(t,e,i){var n=kr.invert(X5,i._rotation),r=K5(Y5,i._scale,Ki),s=ir.subtract(j5,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 Z5,$5,t4=(Z5=new kr,function(t,e,i,n){ir.scaleAndAdd(t.position,e.position,i.position,n);var r=kr.slerp(Z5,kr.IDENTITY,i.rotation,n);return kr.multiply(t.rotation,r,e.rotation),ir.scaleAndAdd(t.scale,e.scale,i.scale,n),t}),e4=($5=new kr,function(t,e,i){var n=kr.invert($5,e);return kr.multiply(t,i,n)}),i4=Object.freeze(function(){var t=new J5;return t.position=ir.ZERO,t.rotation=kr.IDENTITY,t.scale=ir.ZERO,t}()),n4=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}(),r4=function(){function t(t){this._involvedTransforms=new Uint16Array(t)}return n(t,[{key:"involvedTransforms",get:function(){return this._involvedTransforms}}]),t}();function s4(t,e,i,n){void 0===n&&(n=void 0),a4(t.transforms,e.transforms,i,n),c4(t.auxiliaryCurves,e.auxiliaryCurves,i)}function a4(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<n.involvedTransforms.length;++s){var a=n.involvedTransforms[s];l4(t,e,i,a)}else for(var o=0;o<r;++o)l4(t,e,i,o);else n?o4(t,e,n):t.set(e)}function o4(t,e,i){t.length,t.length;for(var n=0;n<i.involvedTransforms.length;++n){var r=i.involvedTransforms[n];t.copyRange(r,e,r,1)}}var h4,u4,l4=(h4=new J5,u4=new J5,function(t,e,i,n){var r=t.getTransform(n,u4),s=e.getTransform(n,h4);J5.lerp(r,r,s,i),t.setTransform(n,r)});function c4(t,e,i){var n=e.length;t.length;for(var r=0;r<n;++r)t[r]=en(t[r],e[r],i)}var f4=function(){var t=new J5,e=new J5;return function(i,n,r){var s=n.getTransform(r,t),a=i.getTransform(r,e);Q5(a,a,s),i.setTransform(r,a)}}();function _4(t,e){var i=t.length;e.length;for(var n=0;n<i;++n)f4(t,e,n)}function d4(t,e){t.length,e.length;for(var i=0;i<t.length;++i)t[i]-=e[i]}function p4(t,e,i,n){void 0===n&&(n=void 0),g4(t.transforms,e.transforms,i,n),y4(t.auxiliaryCurves,e.auxiliaryCurves,i)}var m4=function(){var t=new J5,e=new J5;return function(i,n,r,s){var a=n.getTransform(s,t),o=i.getTransform(s,e);t4(o,o,a,r),i.setTransform(s,o)}}();function g4(t,e,i,n){void 0===n&&(n=void 0);var r=t.length;if(e.length,n)for(var s=0;s<n.involvedTransforms.length;++s){var a=n.involvedTransforms[s];m4(t,e,i,a)}else for(var o=0;o<r;++o)m4(t,e,i,o)}function y4(t,e,i){t.length,e.length;for(var n=0;n<t.length;++n)t[n]+=e[n]*i}var v4=new ir,b4=new kr,S4=function(){function t(t){this._transformHandle=t}return t.prototype.destroy=function(){this._transformHandle.destroy()},t}(),w4=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setValue=function(t,e){e.transforms.setPosition(this._transformHandle.index,t)},i.getValue=function(t){return t.transforms.getPosition(this._transformHandle.index,v4)},e}(S4),x4=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setValue=function(t,e){e.transforms.setRotation(this._transformHandle.index,t)},i.getValue=function(t){return t.transforms.getRotation(this._transformHandle.index,b4)},e}(S4),T4=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setValue=function(t,i){var n=kr.fromEuler(e._EULER_TO_QUAT_CACHE,t.x,t.y,t.z);i.transforms.setRotation(this._transformHandle.index,n)},i.getValue=function(t){var e=t.transforms.getRotation(this._transformHandle.index,b4);return kr.toEuler(v4,e)},e}(S4);T4._EULER_TO_QUAT_CACHE=new kr;var A4=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setValue=function(t,e){e.transforms.setScale(this._transformHandle.index,t)},i.getValue=function(t){return t.transforms.getScale(this._transformHandle.index,v4)},e}(S4),C4=function(){function t(t){this._handle=t}var e=t.prototype;return e.destroy=function(){this._handle.destroy()},e.setValue=function(t,e){e.auxiliaryCurves[this._handle.index]=t},e.getValue=function(t){return t.auxiliaryCurves[this._handle.index]},t}();function D4(t,e){switch(e){case"position":return new w4(t);case"rotation":return new x4(t);case"eulerAngles":return new T4(t);case"scale":return new A4(t)}}var B4=function(){function t(t){this.binding=t}var e=t.prototype;return e.destroy=function(){},e.setValue=function(t){this.binding.setValue(t)},e.getValue=function(){var t,e,i;return null!==(t=null==(e=(i=this.binding).getValue)?void 0:e.call(i))&&void 0!==t?t:void 0},t}(),I4=function(){function t(t,e){this._binding=void 0,this._trackSampler=void 0,this._binding=t,this._trackSampler=e}var e=t.prototype;return e.destroy=function(){this._binding.destroy()},e.evaluate=function(t,e){var i=this._trackSampler,n=this._binding,r=i.requiresDefault?n.getValue(e):void 0,s=i.evaluate(t,r);n.setValue(s,e)},t}();function M4(t,e,i){var n=P4(e[YQ],i);return null!=n?n:void 0}function P4(t,e){var i=e.origin,n=t.path,r=t.proxy,s=n.length,a=s-1;if(0!==s&&(n.isPropertyAt(a)||n.isElementAt(a))&&!r){var o=n.isPropertyAt(a)?n.parsePropertyAt(a):n.parseElementAt(a),h=n[qQ](i,0,s-1);if(null===h)return null;if(h instanceof eb&&QQ(o)){var u=function(){for(var t=[],e=h;e&&e!==i;e=e.parent)t.unshift(e.name);return e===i?t.join("/"):void 0}();if("string"==typeof u){var l=e.bindTransform(u);if(!l)return;return D4(l,o)}}}var c=t.createRuntimeBinding(e.origin,void 0,!1);return c?new B4(c):null}var E4=function(){function t(t,e){this._binding=t,this._curve=e}return t.prototype.evaluate=function(t,e){var i=this._curve,n=this._binding,r=e,s=i.evaluate(t);n.setValue(s,r)},t}();function O4(t,e){return t.isAdditive_experimental?new h6(t,e):new o6(t,e)}var k4,R4,F4,L4,V4,N4,z4,U4,G4,H4,W4,j4,q4,X4,Y4,J4,K4,Q4,Z4,$4,t6,e6,i6,n6,r6,s6,a6,o6=function(){function t(t,e){this._trackEvaluations=[],this._exoticAnimationEvaluation=void 0,this._auxiliaryCurveEvaluations=[],t._trySyncLegacyData();for(var i,n,r=[],s=[],a=t.tracks,o=t[b5],h=p(a);!(n=h()).done;){var u=n.value;if(!(u instanceof q2||Array.from(u.channels()).every((function(t){return 0===t.curve.keyFramesCount})))){var l=M4(0,u,e);if(l){var c=u[nQ](),f=new I4(l,c);r.push(f)}}}o&&(i=o.createEvaluatorForAnimationGraph(e));for(var _=t.getAuxiliaryCurveNames_experimental(),d=_.length,m=0;m<d;++m){var g=_[m],y=t.getAuxiliaryCurve_experimental(g),v=e.bindAuxiliaryCurve(g),b=new C4(v);s.push(new E4(b,y))}this._trackEvaluations=r,this._exoticAnimationEvaluation=i,this._auxiliaryCurveEvaluations=s}var e=t.prototype;return e.destroy=function(){var t;null==(t=this._exoticAnimationEvaluation)||t.destroy();for(var e=this._trackEvaluations,i=e.length,n=0;n<i;++n)e[n].destroy()},e.evaluate=function(t,e){for(var i=this._trackEvaluations,n=this._exoticAnimationEvaluation,r=this._auxiliaryCurveEvaluations,s=e.pushDefaultedPose(),a=i.length,o=0;o<a;++o)i[o].evaluate(t,s);n&&n.evaluate(t,s);for(var h=r.length,u=0;u<h;++u)r[u].evaluate(t,s);return s},t}(),h6=function(){function t(t,e){this._clipEval=void 0,this._refClipEval=void 0,this._clipEval=new o6(t,e);var i=t[C5].refClip;i&&i!==t&&(this._refClipEval=new o6(i,e))}var e=t.prototype;return e.destroy=function(){var t;this._clipEval.destroy(),null==(t=this._refClipEval)||t.destroy()},e.evaluate=function(t,e){var i,n,r=this._clipEval.evaluate(t,e);return n=this._refClipEval?this._refClipEval.evaluate(0,e):this._clipEval.evaluate(0,e),_4((i=r).transforms,n.transforms),d4(i.auxiliaryCurves,n.auxiliaryCurves),e.popPose(),r},t}(),u6=Ou,l6=(k4=Kh("cc.animation.ClipMotion"),R4=u6(D5),k4((L4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).clip=V4&&V4(),e}s(e,t);var i=e.prototype;return i[P2]=function(t,e){return this.clip?new f6(t,this.clip,e):null},i.clone=function(){var t=new e;return t.clip=this.clip,t[co]=t0(this),t},e}(E2),V4=zh(L4.prototype,"clip",[R4,uu],(function(){return null})),F4=L4))||F4),c6=Symbol("EvaluatePort"),f6=function(){function t(t,e,i){var n,r;this._clipEmbeddedPlayerEval=null,this._frameEventEval=null,this._wrapInfo=new hQ,this._duration=0,this._ignoreEmbeddedPlayers=void 0,this._originalClip=e,this._ignoreEmbeddedPlayers=i;var s=null!==(n=null==(r=t.clipOverrides)?void 0:r.get(e))&&void 0!==n?n:e;this._setClip(s,t)}var e=t.prototype;return e.createPort=function(){return new _6(this)},e.getClipStatuses=function(t){var e=this,i=!1;return{next:function(){return i?{done:!0,value:void 0}:(i=!0,{done:!1,value:{__DEBUG_ID__:e.__DEBUG__ID__,clip:e._clip,weight:t}})}}},e[c6]=function(t,e){var i,n,r=this._duration,s=this._clip.duration,a=this._clipEval,o=r*t,h=this._clip.wrapMode,u=G5(o,r,h,2&~h?1:1/0,0,this._wrapInfo),l=u.ratio*s,c=a.evaluate(l,e);return null==(i=this._frameEventEval)||i.sample(u.ratio,u.direction,u.iterations),null==(n=this._clipEmbeddedPlayerEval)||n.evaluate(l,Math.trunc(u.iterations)),c},e.overrideClips=function(t){var e,i=this._originalClip,n=null==(e=t.clipOverrides)?void 0:e.get(i);n&&this._setClip(n,t)},e.reenter=function(){var t;null==(t=this._frameEventEval)||t.reset()},e._setClip=function(t,e){var i;null==(i=this._clipEval)||i.destroy(),this._frameEventEval=null,this._clipEmbeddedPlayerEval&&(this._clipEmbeddedPlayerEval.destroy(),this._clipEmbeddedPlayerEval=null),this._clip=t,this._duration=0===t.speed?0:t.duration/t.speed,this._clipEval=O4(t,e),this._frameEventEval=t.createEventEvaluator(e.origin),!this._ignoreEmbeddedPlayers&&t.containsAnyEmbeddedPlayer()&&(this._clipEmbeddedPlayerEval=t.createEmbeddedPlayerEvaluator(e.origin))},n(t,[{key:"duration",get:function(){return this._duration}}]),t}(),_6=function(){function t(t){this._eval=void 0,this._eval=t}var e=t.prototype;return e.evaluate=function(t,e){return this._eval[c6](t,e)},e.reenter=function(){this._eval.reenter()},t}(),d6=Kh,p6=uu,m6=d6(iQ+"AnimationBlendItem")((z4=function(){function t(){this.motion=U4&&U4()}var e=t.prototype;return e.clone=function(){var e=new t;return this._copyTo(e),e},e._copyTo=function(t){var e,i;return t.motion=null!==(e=null==(i=this.motion)?void 0:i.clone())&&void 0!==e?e:null,t},t}(),U4=zh(z4.prototype,"motion",[p6],(function(){return null})),N4=z4))||N4,g6=d6(iQ+"AnimationBlend")((H4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).name=W4&&W4(),e}return s(e,t),e.prototype.copyTo=function(t){t.name=this.name,t[co]=t0(this)},e}(E2),W4=zh(H4.prototype,"name",[p6],(function(){return""})),G4=H4))||G4,y6=function(){function t(t,e,i,n,r){this._childEvaluators=n.map((function(i){var n,r;return null!==(n=null==(r=i.motion)?void 0:r[P2](t,e))&&void 0!==n?n:null})),this._weights=new Array(this._childEvaluators.length).fill(0),this._inputs=[].concat(r)}var e=t.prototype;return e.createPort=function(){return new v6(this,this._childEvaluators.map((function(t){var e;return null!==(e=null==t?void 0:t.createPort())&&void 0!==e?e:null})))},e.getChildWeight=function(t){return this._weights[t]},e.getChildMotionEval=function(t){return this._childEvaluators[t]},e.getClipStatuses=function(t){var e,i=this._childEvaluators,n=this._weights,r=i.length,s=0;return{next:function(){for(;;){if(e){var a=e.next();if(!a.done)return a}if(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;a<n;++a){var o,h=this._weights[a];if(h){var u=null==(o=t.childPorts[a])?void 0:o.evaluate(e,i);u&&(r+=h,s?(r&&s4(s,u,h/r),i.popPose()):s=u)}}return s||i.pushDefaultedPose()},e.overrideClips=function(t){for(var e=0;e<this._childEvaluators.length;++e){var i;null==(i=this._childEvaluators[e])||i.overrideClips(t)}},e.setInput=function(t,e){this._inputs[e]=t,this.doEval()},e.doEval=function(){this.eval(this._weights,this._inputs)},n(t,[{key:"childCount",get:function(){return this._weights.length}},{key:"duration",get:function(){for(var t=0,e=0;e<this._childEvaluators.length;++e){var i,n;t+=(null!==(i=null==(n=this._childEvaluators[e])?void 0:n.duration)&&void 0!==i?i:0)*this._weights[e]}return t}}]),t}(),v6=function(){function t(t,e){this.childPorts=[],this._host=void 0,this._host=t,this.childPorts=e}var e=t.prototype;return e.evaluate=function(t,e){return this._host.__evaluatePort(this,t,e)},e.reenter=function(){for(var t=this.childPorts,e=t.length,i=0;i<e;++i){var n;null==(n=t[i])||n.reenter()}},t}(),b6=Kh,S6=uu,w6=b6(iQ+"BindableNumber")((q4=function(){function t(t){void 0===t&&(t=0),this.variable=X4&&X4(),this.value=Y4&&Y4(),this.value=t}return t.prototype.clone=function(){var e=new t;return e.value=this.value,e.variable=this.variable,e},t}(),X4=zh(q4.prototype,"variable",[S6],(function(){return""})),Y4=zh(q4.prototype,"value",[S6],(function(){return 0})),j4=q4))||j4,x6=b6(iQ+"BindableBoolean")((K4=function(){function t(t){void 0===t&&(t=!1),this.variable=Q4&&Q4(),this.value=Z4&&Z4(),this.value=t}return t.prototype.clone=function(){var e=new t;return e.value=this.value,e.variable=this.variable,e},t}(),Q4=zh(K4.prototype,"variable",[S6],(function(){return""})),Z4=zh(K4.prototype,"value",[S6],(function(){return!1})),J4=K4))||J4;function T6(t,e,i,n,r){var s=e.variable,a=e.value;if(!s)return a;var o=t.getVar(s);if(!A6(o,s))return a;if(o.type!==i)throw new W$(s,"number");for(var h=arguments.length,u=new Array(h>5?h-5:0),l=5;l<h;l++)u[l-5]=arguments[l];return o.bind.apply(o,[n,r].concat(u))}function A6(t,e){if(t)return!0;throw new H$(e)}function C6(t,e,i){if(t!==e)throw new W$(i,"number")}function D6(t,e){if(2!==t)throw new W$(e,"trigger")}function B6(t,e,i){if(t.fill(0),0===e.length);else if(i<=e[0])t[0]=1;else if(i>=e[e.length-1])t[t.length-1]=1;else{for(var n=0,r=1;r<e.length;++r)if(e[r]>i){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 I6,M6,P6=Kh,E6=uu,O6=P6(iQ+"AnimationBlend1DItem")((t6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).threshold=e6&&e6(),e}s(e,t);var i=e.prototype;return i.clone=function(){var t=new e;return this._copyTo(t),t},i._copyTo=function(e){return t.prototype._copyTo.call(this,e),e.threshold=this.threshold,e},e}(m6),e6=zh(t6.prototype,"threshold",[E6],(function(){return 0})),$4=t6))||$4,k6=P6("cc.animation.AnimationBlend1D")((a6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._items=r6&&r6(),e.param=s6&&s6(),e}s(e,t);var i=e.prototype;return i.clone=function(){var t=new e;return this.copyTo(t),t._items=this._items.map((function(t){return t.clone()})),t.param=this.param.clone(),t},i[P2]=function(t,e){var i=new R6(t,e,this,this._items,this._items.map((function(t){return t.threshold})),0),n=T6(t,this.param,0,i.setInput,i,0);return i.setInput(n,0),i},n(e,[{key:"items",get:function(){return this._items},set:function(t){this._items=Array.from(t).sort((function(t,e){return t.threshold-e.threshold}))}}]),e}(g6),a6.Item=O6,r6=zh((n6=a6).prototype,"_items",[E6],(function(){return[]})),s6=zh(n6.prototype,"param",[E6],(function(){return new w6})),i6=n6))||i6,R6=function(t){function e(e,i,n,r,s,a){var o;return(o=t.call(this,e,i,n,r,[a])||this)._thresholds=s,o.doEval(),o}return s(e,t),e.prototype.eval=function(t,e){var i=e[0];B6(t,this._thresholds,i)},e}(y6),F6=(I6=new ds,M6={wA:0,wB:0},function(t,e,i){if(t.length,e.length,0!==e.length)if(1!==e.length)if(ds.strictEquals(i,ds.ZERO)){var n=e.findIndex((function(t){return ds.strictEquals(t,ds.ZERO)}));n>=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;c<e.length;++c){var f=e[c];if(ds.equals(f,ds.ZERO))a=c;else{var _=ds.normalize(I6,f),d=ds.dot(_,i);_.x*l-_.y*u>0?d>=h&&(h=d,r=c):d>=o&&(o=d,s=c)}}var p=0;if(r<0||s<0)p=1;else{var m=(T=e[r],A=e[s],C=i,D=M6,(B=ds.cross(T,A))?(D.wA=ds.cross(C,A)/B,D.wB=ds.cross(C,T)/-B):(D.wA=0,D.wB=0),D),g=m.wA,y=m.wB,v=0,b=0,S=g+y;S>1?(v=g/S,b=y/S):S<0?(v=0,b=0,p=1):(v=g,b=y,p=1-S),t[r]=v,t[s]=b}if(p>0)if(a>=0)t[a]=p;else for(var w=p/t.length,x=0;x<t.length;++x)t[x]+=w}else t[0]=1;var T,A,C,D,B});function L6(t,e,i){V6(t,e,i,J6)}function V6(t,e,i,n){t.fill(0);for(var r=new ds(0,0),s=new ds(0,0),a=0,o=e.length,h=0;h<o;++h){for(var u=Number.MAX_VALUE,l=!1,c=0;c<o;++c)if(h!==c){n(e[h],e[c],i,r,s);var f=1-ds.dot(r,s)/ds.lengthSqr(s);if(f<0){l=!0;break}u=Math.min(u,f)}l||(t[h]=u,a+=u)}a>0&&t.forEach((function(e,i){return t[i]=e/a}))}var N6,z6,U6,G6,H6,W6,j6,q6,X6,Y6,J6=function(t,e,i,n,r){ds.subtract(n,i,t),ds.subtract(r,e,t)},K6=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;o<n;++o)for(var h=r[o],u=s[o],l=0;l<n;++l)if(o!==l){var c=r[l],f=s[l],_=(h+c)/2,d=3*(n*o+l);a[d+0]=(c-h)/_,a[d+1]=Q6(u,f)*i,a[d+2]=_}this._cacheVIXAngles=new Float32Array(n)}return t.prototype.interpolate=function(e,i){var n=this._exampleDirections,r=this._exampleMagnitudes,s=this._precomputedVIJs,a=this._cacheVIXAngles,o=t._CACHE_INPUT_DIRECTION,h=t._CACHE_VIJ,u=t._CACHE_VIX,l=t._ANGLE_MULTIPLIER,c=n.length;if(e.length,0!==c)if(1!==c){var f=i,_=ds.len(f),d=a;if(ds.equals(f,ds.ZERO))for(var p=0;p<c;++p)d[p]=0;else for(var m=ds.multiplyScalar(o,f,1/_),g=0;g<c;++g){var y=n[g];ds.equals(y,ds.ZERO)?d[g]=0:d[g]=Q6(y,m)*l}for(var v=0,b=0;b<c;++b){for(var S=r[b],w=n[b],x=Number.POSITIVE_INFINITY,T=0;T<c;++T)if(b!==T){var A=n[T],C=3*(c*b+T),D=s[C+0],B=s[C+1],I=s[C+2],M=B,P=d[b];ds.equals(w,ds.ZERO)?M=d[T]:ds.equals(A,ds.ZERO)?M=d[b]:ds.equals(f,ds.ZERO)&&(P=M);var E=ds.set(h,D,M),O=ds.set(u,(_-S)/I,P),k=1-ds.dot(O,E)/ds.lengthSqr(E);if(k<=0){x=0;break}x=Math.min(x,k)}e[b]=x,v+=x}if(v>0)for(var R=0;R<c;++R)e[R]/=v;else for(var F=1/c,L=0;L<c;++L)e[L]=F}else e[0]=1},t}();function Q6(t,e){var i=ds.angle(t,e);return t.x*e.y-t.y*e.x<0?-i:i}K6._CACHE_INPUT_DIRECTION=new ds,K6._CACHE_VIJ=new ds,K6._CACHE_VIX=new ds,K6._ANGLE_MULTIPLIER=1;var Z6=Kh,$6=uu,t8={SIMPLE_DIRECTIONAL:0,FREEFORM_CARTESIAN:1,FREEFORM_DIRECTIONAL:2};Re(t8);var e8,i8,n8,r8,s8,a8,o8=Z6(iQ+"AnimationBlend2DItem")((z6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).threshold=U6&&U6(),e}s(e,t);var i=e.prototype;return i.clone=function(){var t=new e;return this._copyTo(t),t},i._copyTo=function(e){return t.prototype._copyTo.call(this,e),ds.copy(e.threshold,this.threshold),e},e}(m6),U6=zh(z6.prototype,"threshold",[$6],(function(){return new ds})),N6=z6))||N6,h8=Z6("cc.animation.AnimationBlend2D")((Y6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._items=W6&&W6(),e.paramX=j6&&j6(),e.paramY=q6&&q6(),e._algorithm=X6&&X6(),e._polarSpaceGBI=void 0,e}s(e,t);var i=e.prototype;return i.__callOnAfterDeserializeRecursive=function(){this._tryReconstructPolarSpaceInterpolator()},i.clone=function(){var t=new e;return this.copyTo(t),t._items=this._items.map((function(t){var e;return null!==(e=null==t?void 0:t.clone())&&void 0!==e?e:null})),t.paramX=this.paramX.clone(),t.paramY=this.paramY.clone(),t.algorithm=this._algorithm,t},i[P2]=function(t,e){var i,n=this.algorithm;2===n?(this._polarSpaceGBI,i=new l8(t,e,this,this._items,this._polarSpaceGBI,[0,0])):i=new u8(t,e,this,this._items,this._items.map((function(t){return t.threshold})),n,[0,0]);var r=T6(t,this.paramX,0,i.setInput,i,0),s=T6(t,this.paramY,0,i.setInput,i,1);return i.setInput(r,0),i.setInput(s,1),i},i._tryReconstructPolarSpaceInterpolator=function(){2===this._algorithm?this._polarSpaceGBI=new K6(this._items.map((function(t){return t.threshold}))):this._polarSpaceGBI=void 0},n(e,[{key:"algorithm",get:function(){return this._algorithm},set:function(t){t!==this._algorithm&&(this._algorithm=t,this._tryReconstructPolarSpaceInterpolator())}},{key:"items",get:function(){return this._items},set:function(t){this._items=Array.from(t),this._tryReconstructPolarSpaceInterpolator()}}]),e}(g6),Y6.Algorithm=t8,Y6.Item=o8,W6=zh((H6=Y6).prototype,"_items",[$6],(function(){return[]})),j6=zh(H6.prototype,"paramX",[$6],(function(){return new w6})),q6=zh(H6.prototype,"paramY",[$6],(function(){return new w6})),X6=zh(H6.prototype,"_algorithm",[$6],(function(){return 0})),G6=H6))||G6,u8=function(t){function e(e,i,n,r,s,a,o){var h;return(h=t.call(this,e,i,n,r,o)||this)._thresholds=void 0,h._algorithm=void 0,h._value=new ds,h._thresholds=s,h._algorithm=a,h.doEval(),h}return s(e,t),e.prototype.eval=function(t,e){var i=e[0],n=e[1];switch(ds.set(this._value,i,n),t.fill(0),this._algorithm){case 0:F6(t,this._thresholds,this._value);break;case 1:L6(t,this._thresholds,this._value)}},e}(y6),l8=function(t){function e(e,i,n,r,s,a){var o;return(o=t.call(this,e,i,n,r,a)||this)._interpolator=void 0,o._value=new ds,o._interpolator=s,o.doEval(),o}return s(e,t),e.prototype.eval=function(t,e){var i=e[0],n=e[1];ds.set(this._value,i,n),t.fill(0),this._interpolator.interpolate(t,this._value)},e}(y6),c8=Kh,f8=uu,_8=c8(iQ+"AnimationBlendDirectItem")((i8=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).weight=n8&&n8(),e}s(e,t);var i=e.prototype;return i.clone=function(){var t=new e;return this._copyTo(t),t},i._copyTo=function(e){return t.prototype._copyTo.call(this,e),e.weight=this.weight,e},e}(m6),n8=zh(i8.prototype,"weight",[f8],(function(){return new w6(0)})),e8=i8))||e8;c8("cc.animation.AnimationBlendDirect")((a8=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._items=s8&&s8(),e}s(e,t);var i=e.prototype;return i.clone=function(){var t=new e;return this.copyTo(t),t._items=this._items.map((function(t){var e;return null!==(e=null==t?void 0:t.clone())&&void 0!==e?e:null})),t},i[P2]=function(t,e){for(var i=new F8(t,e,this,this._items,new Array(this._items.length).fill(0)),n=0;n<this._items.length;++n){var r=T6(t,this._items[n].weight,0,i.setInput,i,n);i.setInput(r,n)}return i},n(e,[{key:"items",get:function(){return this._items},set:function(t){this._items=Array.from(t)}}]),e}(g6),a8.Item=_8,s8=zh((r8=a8).prototype,"_items",[f8],(function(){return[]})),r8));var d8,p8,m8,g8,y8,v8,b8,S8,w8,x8,T8,A8,C8,D8,B8,I8,M8,P8,E8,O8,k8,R8,F8=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).doEval(),e}return s(e,t),e.prototype.eval=function(t,e){for(var i=t.length,n=0;n<i;++n)t[n]=e[n]},e}(y6),L8=Kh("cc.JointMask")((p8=function(){this.path=m8&&m8(),this.enabled=g8&&g8()},m8=zh(p8.prototype,"path",[uu],(function(){return""})),g8=zh(p8.prototype,"enabled",[uu],(function(){return!0})),d8=p8))||d8;y8=Kh(iQ+"AnimationMask"),v8=Ou(L8),y8((b8=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._jointMasks=S8&&S8(),e}s(e,t);var i=e.prototype;return i.addJoint=function(t,e){this.removeJoint(t);var i=new L8;i.path=t,i.enabled=e,this._jointMasks.push(i)},i.removeJoint=function(t){xe(this._jointMasks,(function(e){return e.path===t}))},i.clear=function(){this._jointMasks.length=0},i.filterDisabledNodes=function(t){for(var e=this._jointMasks,i=e.length,n=new Set,r=0;r<i;++r){var s=e[r],a=s.path;if(!s.enabled){var o=t.getChildByPath(a);o&&n.add(o)}}return n},i.isExcluded=function(t){var e,i;return!(null===(e=null==(i=this._jointMasks.find((function(e){return e.path===t})))?void 0:i.enabled)||void 0===e||e)},n(e,[{key:"joints",get:function(){return this._jointMasks},set:function(t){this.clear();for(var e,i=p(t);!(e=i()).done;){var n=e.value;this.addJoint(n.path,n.enabled)}}}]),e}(Cm),S8=zh(b8.prototype,"_jointMasks",[uu],(function(){return[]})),v(b8.prototype,"joints",[v8],Object.getOwnPropertyDescriptor(b8.prototype,"joints"),b8.prototype),b8));var V8=Kh(iQ+"ClipOverrideEntry")((T8=function(){this.original=A8&&A8(),this.substitution=C8&&C8()},A8=zh(T8.prototype,"original",[uu],(function(){return null})),C8=zh(T8.prototype,"substitution",[uu],(function(){return null})),x8=T8))||x8,N8=(D8=Kh(iQ+"AnimationGraphVariant"),B8=Ou(M2),D8((M8=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._graph=P8&&P8(),e._clipOverrides=E8&&E8(),e}return s(e,t),n(e,[{key:"original",get:function(){return this._graph},set:function(t){this._graph=t}},{key:"clipOverrides",get:function(){return this._clipOverrides}}]),e}(x0),v(M8.prototype,"original",[B8],Object.getOwnPropertyDescriptor(M8.prototype,"original"),M8.prototype),P8=zh(M8.prototype,"_graph",[uu],(function(){return null})),E8=zh(M8.prototype,"_clipOverrides",[uu],(function(){return new z8})),I8=M8))||I8),z8=Kh(iQ+"ClipOverrideMap")((w8=Symbol.iterator,k8=function(){function t(){this._entries=R8&&R8()}var e=t.prototype;return e[w8]=function(){return this._entries[Symbol.iterator]()},e.has=function(t){return!!this._entries.find((function(e){return e.original===t}))},e.get=function(t){var e=this._entries.find((function(e){return e.original===t}));return null==e?void 0:e.substitution},e.set=function(t,e){var i=this._entries.find((function(e){return e.original===t}));if(i)i.substitution=e;else{var n=new V8;n.original=t,n.substitution=e,this._entries.push(n)}},e.delete=function(t){xe(this._entries,(function(e){return e.original===t}))},e.clear=function(){this._entries.length=0},n(t,[{key:"size",get:function(){return this._entries.length}}]),t}(),R8=zh(k8.prototype,"_entries",[uu],(function(){return[]})),O8=k8))||O8,U8=10,G8=ir.fromArray,H8=ir.toArray,W8=kr.fromArray,j8=kr.toArray,q8=function(){function t(t,e,i){this._data=void 0,this._data=void 0===t?new Float64Array:"number"==typeof t?new Float64Array(U8*t):new Float64Array(t,e,"number"==typeof i?U8*i:void 0)}var e=t.prototype;return e.getTransform=function(t,e){var i=this._data,n=e.position,r=e.rotation,s=e.scale,a=U8*t;return G8(n,i,a),W8(r,i,a+3),G8(s,i,a+7),e},e.getPosition=function(t,e){var i=this._data;return G8(e,i,U8*t),e},e.getRotation=function(t,e){var i=this._data;return W8(e,i,U8*t+3),e},e.getScale=function(t,e){var i=this._data;return G8(e,i,U8*t+7),e},e.setTransform=function(t,e){var i=this._data,n=e.position,r=e.rotation,s=e.scale,a=U8*t;H8(i,n,a),j8(i,r,a+3),H8(i,s,a+7)},e.setPosition=function(t,e){var i=this._data;H8(i,e,U8*t)},e.setRotation=function(t,e){var i=this._data;j8(i,e,U8*t+3)},e.setScale=function(t,e){var i=this._data;H8(i,e,U8*t+7)},e.copyWithin=function(t,e,i){this._data.copyWithin(t*U8,e*U8,"number"==typeof i?i*U8:void 0)},e.fill=function(t,e,i){var n,r,s=this.length;if(null!==(n=e)&&void 0!==n||(e=0),null!==(r=i)&&void 0!==r||(i=s),!(e>=s)){this.setTransform(e,t);for(var a=e+1;a<i;++a)this.copyWithin(a,e,e+1)}},e.fillZero=function(t,e){this._data.fill(0,"number"==typeof t?t*U8:void 0,"number"==typeof e?e*U8:void 0)},e.set=function(t,e){this._data.set(t._data,"number"==typeof e?e*U8:void 0)},e.slice=function(e,i){var n=this._data.slice("number"==typeof e?e*U8:void 0,"number"==typeof i?i*U8:void 0);return new t(n.buffer,n.byteOffset,n.length/U8)},e.copyRange=function(t,e,i,n){for(var r=U8*n,s=this._data,a=U8*t,o=e._data,h=U8*i,u=0;u<r;++u)s[a+u]=o[h+u]},n(t,[{key:"buffer",get:function(){return this._data.buffer}},{key:"byteLength",get:function(){return this._data.byteLength}},{key:"byteOffset",get:function(){return this._data.byteOffset}},{key:"length",get:function(){return this._data.length/U8}}],[{key:"BYTES_PER_ELEMENT",get:function(){return 80}}]),t}(),X8=Symbol(""),Y8=Symbol(""),J8=function(t){this.buffer=void 0,this.useCount=0,this.buffer=new ArrayBuffer(t)},K8=function(){function t(t,e){this._locking=!1,this._pages=[],this._allocatorCount=0,this._manager=t,this._pageSize=e}var e=t.prototype;return e.debugLock=function(){this._locking,this._locking=!0},e.debugUnlock=function(){this._locking,this._locking=!1},e.getPageMemory=function(t){return t>=0&&this._pages.length,this._pages[t].buffer},e.pushPage=function(t){var e=t[X8];this._pages.length,e===this._pages.length&&this._pushNewPage(),this._pages.length;var i=this._pages[e];return++i.useCount,++t[X8],i},e.popPage=function(t){var e=t[X8]-1,i=this._pages[e];i.useCount,--i.useCount,--t[X8],0===i.useCount&&(this._pages.length,this._pages.pop())},e.createAllocator=function(t){var e=new Z8(this,t);return++this._allocatorCount,e},e.destroyAllocator=function(t){for(var e=t[X8],i=0;i<e;++i){var n=this._pages[i];n.useCount,--n.useCount}this._allocatorCount,--this._allocatorCount,0===this._allocatorCount&&this._manager[Y8](this)},e._pushNewPage=function(){var t=new J8(this._pageSize);this._pages.push(t)},n(t,[{key:"pageSize",get:function(){return this._pageSize}},{key:"debugLocking",get:function(){return this._locking}},{key:"allocatorCount",get:function(){return this._allocatorCount}}]),t}(),Q8=function(t,e){this.buffer=t,this.byteOffset=e},Z8=function(){function t(t,e){this[X8]=0,this._slicesPerPage=0,this._slices=[],this._resource=t,this._sliceSize=e;var i=Math.floor(this._resource.pageSize/e);this._slicesPerPage=i}var e=t.prototype;return e.destroy=function(){this._slices.length,this._resource.debugLocking,this._resource.destroyAllocator(this)},e.debugLock=function(){this._resource.debugLock()},e.debugUnlock=function(){this._resource.debugUnlock()},e.push=function(){var t=this._sliceSize,e=this._slices,i=this._slicesPerPage,n=e.length,r=0,s=0;0===t?(0===this[X8]&&this._resource.pushPage(this),this[X8]):(n===i*this[X8]&&(this._resource.pushPage(this),this[X8]),s=(n-(r=n%i))/i,this[X8]);var a=this._resource.getPageMemory(s),o=new Q8(a,t*r);return this._slices.push(o),o},e.pop=function(){var t=this._slices,e=this._slicesPerPage,i=t.length-1;0===this._sliceSize?(this[X8],0===i&&this._resource.popPage(this)):0==i%e&&this._resource.popPage(this),this._slices.pop()},n(t,[{key:"isEmpty",get:function(){return 0===this._slices.length}}]),t}(),$8=function(){function t(t){this._stacks=new Map,this._thresholds=t,t.every((function(t,e,i){return 0===e||t>i[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 K8(this,i),this._stacks.set(i,n)),n.createAllocator(e)},e[Y8]=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}(),t7=function(){function t(t,e){this._poses=[],this._allocatedCount=0,this._memoryAllocator=void 0,this._transformCount=t,this._auxiliaryCurveCount=e;var i=e7(t,e,1);this._memoryAllocator=i7.createAllocator(i)}var e=t.prototype;return e.destroy=function(){this._allocatedCount;for(var t=0;t<this._poses.length;++t)this._memoryAllocator.pop();return this._poses.length=0,this._memoryAllocator.destroy()},e.push=function(){0===this._allocatedCount&&this._memoryAllocator.debugLock(),this._allocatedCount===this._poses.length&&(this._allocateNewPose(),this._allocatedCount,this._poses.length);var t=this._poses[this._allocatedCount];return++this._allocatedCount,t},e.pop=function(){this._allocatedCount,--this._allocatedCount,0===this._allocatedCount&&this._memoryAllocator.debugUnlock()},e._allocateNewPose=function(){var t=this._memoryAllocator.push(),e=q8.BYTES_PER_ELEMENT*this._transformCount,i=t.byteOffset,n=new q8(t.buffer,i,this._transformCount),r=new Float64Array(t.buffer,i+e,this._auxiliaryCurveCount),s=n4._create(n,r);this._poses.push(s)},n(t,[{key:"allocatedCount",get:function(){return this._allocatedCount}},{key:"top",get:function(){return this._allocatedCount,this._poses[this._allocatedCount-1]}}]),t}();function e7(t,e,i){return(q8.BYTES_PER_ELEMENT*t+8*e)*i}var i7=new $8([e7(128,10,4)]);function n7(t,e){for(var i=t.length,n=0;n<i&&e(t[n],n,t);++n);if(n===i)return i;for(var r=n,s=n+1;s<i;++s){var a=t[s];if(e(a,s,t)){var o=a;t[s]=t[r],t[r]=o,++r}}return r}var r7,s7,a7,o7,h7,u7,l7,c7,f7=Symbol("PoseHeapAllocator"),_7=function(){function t(t,e){this._transformCount=0,this._metaValueCount=0,this._pages=[],this._allocatedCount=0,this._foremostPossibleFreePage=0,this._transformCount=t,this._metaValueCount=e}var e=t.prototype;return e.allocatePose=function(){++this._allocatedCount;for(var t=this._pages,e=t.length,i=this._foremostPossibleFreePage;i<e;++i){var n=t[i],r=n.tryAllocate();if(r)return r[f7].pageIndex=i,0===n.freeCount&&++this._foremostPossibleFreePage,r}var s=this._allocatePoseInNewPage();return this._foremostPossibleFreePage=s[f7].pageIndex,s},e.destroyPose=function(t){var e=this._pages;e.length;var i=t[f7].pageIndex,n=e[i];n.deallocate(t),--this._allocatedCount,i<this._foremostPossibleFreePage&&(n.freeCount,this._foremostPossibleFreePage=i)},e._allocatePoseInNewPage=function(){var t=new g7(this._transformCount,this._metaValueCount,4),e=this._pages.length;this._pages.push(t);var i=t.tryAllocate();return i[f7].pageIndex=e,i},n(t,[{key:"allocatedCount",get:function(){return this._allocatedCount}}]),t}(),d7=function(){function t(){this._id=-1}return n(t,[{key:"pageIndex",get:function(){return this._id>>m7},set:function(t){this._id&=p7,this._id|=t<<m7}},{key:"poseIndex",get:function(){return this._id&p7},set:function(t){this._id&=-8,this._id|=t}}]),t}(),p7=7,m7=3,g7=function(){function t(t,e,i){this._buffer=void 0,this._idleFlags=15,this._poses=void 0,this._freeCount=0,this._transformCount=t,this._metaValueCount=e,this._capacity=i;var n=(q8.BYTES_PER_ELEMENT*t+8*e)*i;this._buffer=new ArrayBuffer(n),this._poses=new Array(i).fill(null),this._freeCount=i}var e=t.prototype;return e.tryAllocate=function(){var t,e=this._poses,i=this._idleFlags,n=this._capacity,r=y7(i);if(r>=n)return null;r>=0&&e.length;var s=null!==(t=e[r])&&void 0!==t?t:e[r]=this._createPose(r);return s[f7].poseIndex=r,this._idleFlags&=~(1<<r),this._freeCount,--this._freeCount,s},e.deallocate=function(t){var e=this._poses,i=t[f7].poseIndex;i>=0&&e.length,e[i],this._idleFlags|=1<<i,this._freeCount,this._capacity,++this._freeCount},e._createPose=function(t){var e=q8.BYTES_PER_ELEMENT*this._transformCount,i=(e+8*this._metaValueCount)*t,n=new q8(this._buffer,i,this._transformCount),r=new Float64Array(this._buffer,i+e,this._metaValueCount),s=n4._create(n,r);return s[f7]=new d7,s},n(t,[{key:"capacity",get:function(){return this._capacity}},{key:"freeCount",get:function(){return this._freeCount}}]),t}();function y7(t){return 0===t?1/0:Math.log2(t&-t)}function v7(t,e){if(t.name===e)return t;for(var i=t.children.length,n=0;n<i;++n){var r=v7(t.children[n],e);if(r)return r}return null}var b7=function(){function t(t,e,i,n){var r=this;this._origin=void 0,this._layoutMaintainer=void 0,this._varRegistry=void 0,this._additiveFlagStack=[],this._triggerResetter=function(t){return r._resetTrigger(t)},this._isLayerWideContextPropertiesSet=!1,this._stashView=void 0,this._motionSyncManager=void 0,this._clipOverrides=void 0,this._controller=n,this._origin=t,this._layoutMaintainer=e,this._varRegistry=i,this._additiveFlagStack=[!1]}var e=t.prototype;return e.bindTransform=function(t){var e=this._origin.getChildByPath(t);return e?this._layoutMaintainer.getOrCreateTransformBinding(e):null},e.bindTransformByName=function(t){var e=v7(this._origin,t);return e?this._layoutMaintainer.getOrCreateTransformBinding(e):null},e.getBoneChildren=function(t){var e=v7(this._origin,t);return e?e.children.map((function(t){return t.name})):[]},e.getParentBoneNameByName=function(t){var e,i=v7(this._origin,t);return i?i===this._origin?"":null==(e=i.parent)?void 0:e.name:null},e.bindAuxiliaryCurve=function(t){return this._layoutMaintainer.getOrCreateAuxiliaryCurveBinding(t)},e.getEvaluationTimeAuxiliaryCurveView=function(){return this._layoutMaintainer.auxiliaryCurveRegistry},e.getVar=function(t){return this._varRegistry[t]},e._pushAdditiveFlag=function(t){this._additiveFlagStack.push(t)},e._popAdditiveFlag=function(){this._additiveFlagStack.length,this._additiveFlagStack.pop()},e._integrityCheck=function(){return 1===this._additiveFlagStack.length},e._setLayerWideContextProperties=function(t,e){this._isLayerWideContextPropertiesSet,this._isLayerWideContextPropertiesSet=!0,this._stashView=t,this._motionSyncManager=e},e._unsetLayerWideContextProperties=function(){this._isLayerWideContextPropertiesSet,this._isLayerWideContextPropertiesSet=!1,this._stashView=void 0,this._motionSyncManager=void 0},e._setClipOverrides=function(t){this._clipOverrides=t},e._resetTrigger=function(t){var e=this._varRegistry[t];e&&(e.value=!1)},n(t,[{key:"origin",get:function(){return this._origin}},{key:"controller",get:function(){return this._controller}},{key:"triggerResetter",get:function(){return this._triggerResetter}},{key:"clipOverrides",get:function(){return this._clipOverrides}},{key:"additive",get:function(){var t=this._additiveFlagStack;return t[t.length-1]}},{key:"stashView",get:function(){return this._stashView,this._stashView}},{key:"motionSyncManager",get:function(){return this._motionSyncManager,this._motionSyncManager}}]),t}(),S7=new J5,w7=function(){function t(){this._namedCurves=new Map}var e=t.prototype;return e.names=function(){return this._namedCurves.keys()},e.has=function(t){return this._namedCurves.has(t)},e.get=function(t){var e;return null!==(e=this._namedCurves.get(t))&&void 0!==e?e:0},e.set=function(t,e){this._namedCurves.set(t,e)},t}(),x7=(r7=function(){},s7=function(){},a7=function(){},o7=function(){},h7=function(){},u7=function(){},l7=function(){},c7=function(){function t(t,e){this._origin=void 0,this._auxiliaryCurveRegistry=void 0,this._auxiliaryCurveRecords=[],this._transformRecords=[],this._parentTable=[],this._bindStarted=!1,this._transformCountBeforeBind=-1,this._auxiliaryCurveCountBeforeBind=-1,this._origin=t,this._auxiliaryCurveRegistry=e}var e=t.prototype;return e.getOrCreateTransformBinding=function(t){for(var e=this._origin,i=!1,n=t;n;n=n.parent)if(n===e){i=!0;break}if(!i)return null;var r=this._getOrCreateTransformBinding(t);if(t!==e)for(var s=t.parent;s!==e;s=s.parent)this._getOrCreateTransformBinding(s);return r},e._getOrCreateTransformBinding=function(t){var e=this._transformRecords,i=e.findIndex((function(e){return e.node===t}));if(i>=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<e.length;++o)++e[o].handle.index;var h=new T7(new F7(this,r),t);return e.splice(r,0,h),h.handle},e.getOrCreateAuxiliaryCurveBinding=function(t){var e=this._auxiliaryCurveRecords,i=e.findIndex((function(e){return e.name===t}));if(i>=0){var n=e[i];return++n.refCount,n.handle}var r=e.length,s=new A7(new L7(this,r),t);return e.push(s),s.handle},e.createEvaluationContext=function(){return this._bindStarted,new R7(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)J(a.getPathInHierarchy()+" is not a child of "+i.getPathInHierarchy());else if(t.isExcluded(h))continue;n.push(o.index)}return n.sort(),new r4(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<e;++i){var n=this._transformRecords[i].defaultTransform;t.setTransform(i,n)}},e.apply=function(t){var e=t.transforms,i=t.auxiliaryCurves,n=this._transformRecords.length;e.length;for(var r=0;r<n;++r){var s=e.getTransform(r,S7);this._transformRecords[r].node.setRTS(s.rotation,s.position,s.scale)}for(var a=this._auxiliaryCurveRecords.length,o=0;o<a;++o){var h=this._auxiliaryCurveRecords[o].name,u=i[o];this._auxiliaryCurveRegistry.set(h,u)}},e._destroyTransformHandle=function(t){t>=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(C7(t),t.length!==this._transformCountBeforeBind){i|=1;for(var n=t.length,r=0;r<n;++r)t[r].order=r}else{for(var s=t.length,a=!1,o=0;o<s;++o){var h=t[o];h.order!==o&&(a=!0,h.order=o)}a&&(i|=2)}C7(e),e.length!==this._auxiliaryCurveCountBeforeBind&&(i|=4);var u=this._parentTable,l=this._origin;u.length=t.length;for(var c=function(){var e=t[f].node;if(e===l)return u[f]=-1,1;var i=e.parent;if(i===l){var n=t.findIndex((function(t){return t.node===i}));u[f]=n>=0?n:-1}else{var r=t.findIndex((function(t){return t.node===i}));u[f]=r}},f=0;f<t.length;++f)c();return this._bindStarted=!1,i},n(t,[{key:"transformCount",get:function(){return this._transformRecords.length}},{key:"auxiliaryCurveCount",get:function(){return this._auxiliaryCurveRecords.length}},{key:"auxiliaryCurveRegistry",get:function(t){function e(){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(){return this._auxiliaryCurveRegistry}))}]),t}(),v(c7.prototype,"getOrCreateTransformBinding",[r7],Object.getOwnPropertyDescriptor(c7.prototype,"getOrCreateTransformBinding"),c7.prototype),v(c7.prototype,"_getOrCreateTransformBinding",[s7],Object.getOwnPropertyDescriptor(c7.prototype,"_getOrCreateTransformBinding"),c7.prototype),v(c7.prototype,"getOrCreateAuxiliaryCurveBinding",[a7],Object.getOwnPropertyDescriptor(c7.prototype,"getOrCreateAuxiliaryCurveBinding"),c7.prototype),v(c7.prototype,"_destroyTransformHandle",[o7],Object.getOwnPropertyDescriptor(c7.prototype,"_destroyTransformHandle"),c7.prototype),v(c7.prototype,"_destroyAuxiliaryCurveHandle",[h7],Object.getOwnPropertyDescriptor(c7.prototype,"_destroyAuxiliaryCurveHandle"),c7.prototype),v(c7.prototype,"startBind",[u7],Object.getOwnPropertyDescriptor(c7.prototype,"startBind"),c7.prototype),v(c7.prototype,"endBind",[l7],Object.getOwnPropertyDescriptor(c7.prototype,"endBind"),c7.prototype),c7),T7=function(t,e){this.order=-1,this.refCount=1,this.handle=void 0,this.node=void 0,this.defaultTransform=void 0,this.handle=t,this.node=e;var i=new J5;i.position=e.position,i.rotation=e.rotation,i.scale=e.scale,this.defaultTransform=i},A7=function(t,e){this.refCount=1,this.handle=void 0,this.name=void 0,this.handle=t,this.name=e};function C7(t){var e=n7(t,(function(t){return t.refCount,t.refCount>0}));if(t.length,e!==t.length){for(var i=0;i<e;++i)t[i].handle.index=i;t.splice(e,t.length-e)}}var D7,B7,I7,M7,P7=Symbol("[[DefaultTransforms]]"),E7=function(){function t(t){this._layoutMaintainer=t}return t.prototype.createTransformFilter=function(t){return this._layoutMaintainer.createTransformFilter(t)},n(t,[{key:"transformCount",get:function(){return this._layoutMaintainer.transformCount}}]),t}(),O7=new J5,k7=new J5,R7=function(){function t(t,e,i,n){this[P7]=void 0,this._poseAllocator=void 0,this._parentTable=void 0,this._componentNode=void 0,this._cacheComponentToWorldTransform=new J5,this._poseAllocator=new t7(t,e),this._parentTable=i,this._componentNode=n,this[P7]=new q8(t)}var e=t.prototype;return e.destroy=function(){this._poseAllocator.destroy()},e.pushDefaultedPose=function(){var t=this._poseAllocator.push();return t.transforms.set(this[P7]),t._poseTransformSpace=0,t.auxiliaryCurves.fill(0),t},e.pushDefaultedPoseInComponentSpace=function(){var t=this.pushDefaultedPose();return this._poseTransformsSpaceLocalToComponent(t),t},e.pushZeroDeltaPose=function(){var t=this._poseAllocator.push();return t.transforms.fill(i4),t._poseTransformSpace=0,t.auxiliaryCurves.fill(0),t},e.pushDuplicatedPose=function(t){var e=this._poseAllocator.push();return e.transforms.set(t.transforms),e._poseTransformSpace=t._poseTransformSpace,e.auxiliaryCurves.set(t.auxiliaryCurves),e},e.popPose=function(){this._poseAllocator.pop()},e._isStackTopPose_debugging=function(t){return t===this._poseAllocator.top},e._poseTransformsSpaceLocalToComponent=function(t){for(var e=t.transforms,i=e.length,n=0;n<i;++n){var r=this._parentTable[n];if(!(r<0)){var s=e.getTransform(n,O7),a=e.getTransform(r,k7);J5.multiply(s,a,s),e.setTransform(n,s)}}t._poseTransformSpace=1},e._poseTransformsSpaceComponentToLocal=function(t){for(var e=t.transforms,i=e.length-1;i>=0;--i){var n=this._parentTable[i];if(!(n<0)){var r=e.getTransform(i,O7),s=e.getTransform(n,k7);J5.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?J5.multiply(t,this._getComponentToWorldTransform(),t):J5.multiply(t,this._getLocalToWorldTransform(k7,i,n),t);break;case 1:1===r||J5.multiply(t,this._getLocalToComponentTransform(k7,i,n),t);break;case 2:if(1===r){var s=this._parentTable[n];if(s>=0){var a=i.transforms.getTransform(s,k7),o=J5.invert(a,a);J5.multiply(t,o,t)}}break;case 3:var h=i.transforms.getTransform(n,k7),u=J5.invert(h,h);J5.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=J5.invert(k7,this._getComponentToWorldTransform());J5.multiply(t,s,t)}else{var a=this._getLocalToWorldTransform(k7,i,n),o=J5.invert(a,a);J5.multiply(t,o,t)}break;case 1:if(1===r);else{var h=this._getLocalToComponentTransform(k7,i,n),u=J5.invert(h,h);J5.multiply(t,u,t)}break;case 2:if(1===r){var l=this._parentTable[n];if(l>=0){var c=i.transforms.getTransform(l,k7);J5.multiply(t,c,t)}}break;case 3:var f=i.transforms.getTransform(n,k7);J5.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;J5.setIdentity(t);for(var r=n[i];r>=0;r=n[r]){var s=e.transforms.getTransform(r,O7);J5.multiply(t,s,t)}return t},e._getLocalToWorldTransform=function(t,e,i){return this._getLocalToComponentTransform(t,e,i),J5.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}(),F7=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}(),L7=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}(),V7=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}(),N7=function(){function t(){this._allocator=null}var e=t.prototype;return e._reset=function(t,e){this._allocator=new _7(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}(),z7=uu;Kh(iQ+"UnaryCondition")((M7=function(){function t(){this.operator=B7&&B7(),this.operand=I7&&I7()}var e=t.prototype;return e.clone=function(){var e=new t;return e.operator=this.operator,e.operand=this.operand.clone(),e},e[P2]=function(t){var e=this.operator,i=this.operand,n=new Y7(e,!1),r=T6(t,i,1,n.setOperand,n);return n.reset(r),n},t}(),M7.Operator={TRUTHY:0,FALSY:1},B7=zh((D7=M7).prototype,"operator",[z7],(function(){return 0})),I7=zh(D7.prototype,"operand",[z7],(function(){return new x6})),D7));var U7,G7,H7,W7,j7,q7,X7,Y7=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}(),J7=function(){},K7=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(){}},Q7=uu,Z7=Kh(iQ+"TCVariableBinding")(U7=K7(0,3)((G7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).type=H7&&H7(),e.variableName=W7&&W7(),e}s(e,t);var i=e.prototype;return i.getValueType=function(){return this.type},i.bind=function(t){var e=t.getVar(this.variableName);if(e)return new $7(e)},e}(J7),H7=zh(G7.prototype,"type",[Q7,cu],(function(){return 0})),W7=zh(G7.prototype,"variableName",[Q7],(function(){return""})),U7=G7))||U7)||U7,$7=function(){function t(t){this._varInstance=t}return t.prototype.evaluate=function(){return this._varInstance.value},t}(),t9=uu;Kh(iQ+"TCAuxiliaryCurveBinding")(j7=K7(0)((q7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).curveName=X7&&X7(),e}s(e,t);var i=e.prototype;return i.getValueType=function(){return 0},i.bind=function(t){var e=t.getEvaluationTimeAuxiliaryCurveView();return new i9(e,this.curveName)},e}(J7),X7=zh(q7.prototype,"curveName",[t9],(function(){return""})),j7=q7))||j7);var e9,i9=function(){function t(t,e){this._view=t,this._curveName=e}return t.prototype.evaluate=function(){return this._view.get(this._curveName)},t}();Kh(iQ+"TCStateWeightBinding")(e9=K7(0)(e9=void(e9=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.getValueType=function(){return 0},i.bind=function(){return new r9},e}(J7))||e9)||e9);var n9,r9=function(){function t(){}return t.prototype.evaluate=function(t){return t.sourceStateWeight},t}();Kh(iQ+"TCStateMotionTimeBinding")(n9=K7(0)(n9=void(n9=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.getValueType=function(){return 0},i.bind=function(){return new c9},e}(J7))||n9)||n9);var s9,a9,o9,h9,u9,l9,c9=function(){function t(){}return t.prototype.evaluate=function(t){return t.sourceStateMotionTimeNormalized},t}(),f9=uu;Kh(iQ+"BinaryCondition")(((l9=function(){function t(){this.operator=a9&&a9(),this.lhs=o9&&o9(),this.lhsBinding=h9&&h9(),this.rhs=u9&&u9()}var e=t.prototype;return e.clone=function(){var e=new t;return e.operator=this.operator,e.lhs=this.lhs,e.lhsBinding=J$(this.lhsBinding),e.rhs=this.rhs,e},e[P2]=function(t){var e,i=null==(e=this.lhsBinding)?void 0:e.bind(t);return new O9(this.operator,this.lhs,this.rhs,i)},t}()).Operator={EQUAL_TO:0,NOT_EQUAL_TO:1,LESS_THAN:2,LESS_THAN_OR_EQUAL_TO:3,GREATER_THAN:4,GREATER_THAN_OR_EQUAL_TO:5},a9=zh((s9=l9).prototype,"operator",[f9],(function(){return 0})),o9=zh(s9.prototype,"lhs",[f9],(function(){return 0})),h9=zh(s9.prototype,"lhsBinding",[f9],(function(){return new Z7})),u9=zh(s9.prototype,"rhs",[f9],(function(){return 0})),s9));var _9,d9,p9,m9,g9,y9,v9,b9,S9,w9,x9,T9,A9,C9,D9,B9,I9,M9,P9,E9,O9=function(){function t(t,e,i,n){this._operator=t,this._lhsBindingEvaluation=n,this._lhsValue=e,this._rhsValue=i}return t.prototype.eval=function(t){var e,i,n=null!==(e=null==(i=this._lhsBindingEvaluation)?void 0:i.evaluate(t))&&void 0!==e?e:this._lhsValue,r=this._rhsValue;switch(this._operator){default:case 0:return n===r;case 1:return n!==r;case 2:return n<r;case 3:return n<=r;case 4:return n>r;case 5:return n>=r}},t}(),k9=uu,R9=Kh(iQ+"TriggerCondition")((d9=function(){function t(){this.trigger=p9&&p9()}var e=t.prototype;return e.clone=function(){var e=new t;return e.trigger=this.trigger,e},e[P2]=function(t){var e=new F9(!1),i=t.getVar(this.trigger);return A6(i,this.trigger)&&(D6(i.type,this.trigger),e.setTrigger(i.bind(e.setTrigger,e))),e},t}(),p9=zh(d9.prototype,"trigger",[k9],(function(){return""})),_9=d9))||_9,F9=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}(),L9=Kh(iQ+"StateMachineComponent")(m9=function(){function t(){}var e=t.prototype;return e.onMotionStateEnter=function(){},e.onMotionStateExit=function(){},e.onMotionStateUpdate=function(){},e.onStateMachineEnter=function(){},e.onStateMachineExit=function(){},t}())||m9,V9=Kh(iQ+"MotionSyncInfo")((y9=function(){this.group=v9&&v9()},v9=zh(y9.prototype,"group",[uu],(function(){return""})),g9=y9))||g9,N9=1e-5,z9=(b9=Kh(iQ+"PoseNodePlayMotion"),S9=G0((function(t){t.category="i18n:ENGINE.animation_graph.pose_graph_node_sub_categories.pose_nodes/"})),w9=function(t){return G0((function(e){e.factory=t}))}((E9=function(t){var e=new z9;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 l6;break;case"animation-blend-1d":e=new k6;break;case"animation-blend-2d":e=new h8}return E9(e)}})),x9=H0({themeColor:"#227F9B"}),T9=s1({type:0}),A9=s1({type:0}),b9(C9=S9(C9=w9(C9=x9((D9=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).motion=B9&&B9(),e.syncInfo=I9&&I9(),y(e,"startTime",M9,f(e)),y(e,"speedMultiplier",P9,f(e)),e._workspace=null,e._runtimeSyncRecord=void 0,e}s(e,t);var i=e.prototype;return i.bind=function(t){var e=this.motion;if(e){var i=e[P2](t,!1);i&&(this._workspace=new U9(i,i.createPort()),this.syncInfo.group&&(this._runtimeSyncRecord=t.motionSyncManager.register(this.syncInfo)))}},i.settle=function(){},i.reenter=function(){if(this._workspace){var t=this._runtimeSyncRecord,e=this._workspace.motionEval.duration;this._forceEvaluateEvaluation();var i=e<N9?0:tn(this.startTime/e);t?t.notifyRenter(i):this._workspace.normalizedTime=i,this._workspace.lastIndicativeWeight=0}},i.doUpdate=function(t){if(this._workspace){var e=t.deltaTime,i=this._runtimeSyncRecord,n=this._workspace.motionEval.duration,r=0;n>N9&&(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}(n1),B9=zh(D9.prototype,"motion",[uu],(function(){return new l6})),I9=zh(D9.prototype,"syncInfo",[uu],(function(){return new V9})),M9=v(D9.prototype,"startTime",[uu,T9],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),P9=v(D9.prototype,"speedMultiplier",[uu,A9],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),C9=D9))||C9)||C9)||C9)||C9),U9=function(t,e){this.normalizedTime=0,this.lastIndicativeWeight=0,this.motionEval=t,this.motionEvalPort=e};function G9(t){return t instanceof n1||t instanceof r1}var H9=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;n<t.length;++n){var r=t[n],s=r.elapsedMotionTime,a=r.lastIndicativeWeight;a>i&&(i=a,e=s)}return e},t}();function W9(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 H9(void 0,i?[]:void 0);var s=r[0];s.outputIndex,s.producer;var a=new Map,o=j9(t,s.producer,a,e);return new H9(o,i?Array.from(a.values()).filter((function(t){return t instanceof z9})):void 0)}function j9(t,e,i,n){var r=t.getShell(e),s=i.get(e);if(s)return s;var a=J$(e);"__callOnAfterDeserializeRecursive"in a&&a.__callOnAfterDeserializeRecursive(),a instanceof r1&&a.link(n);for(var o,h=a,u=[],l=p(r.getBindings());!(o=l()).done;){var c=o.value,f=c.producer,_=c.outputIndex,d=c.inputPath;if(G9(f)){var m=j9(t,f,i,n);if(m instanceof n1)Y9(h,d,m,_);else{var g=Z9(h,d,m,_);g&&u.push(g)}}else Y("There's a input bound to a node with unrecognized type.")}var y,v=new q9(u);return h instanceof n1?(h._setDependencyEvaluation(v),y=h):y=new X9(h,v),i.set(e,y),y}var q9=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}(),X9=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 Y9(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 J9,K9=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}(),Q9=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 Z9(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 K9(t,r,i,n);if(Array.isArray(o)){if(!(a>=o.length))return new Q9(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 $9=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=Stt.createPool(4),this._updateContextGenerator=new V7,this._conditionEvaluationContext=new btt,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<i;++n)e[n].settle(t)},e.reenter=function(){for(var t,e=p(this._activatedTransitions);!(t=e()).done;){var i=t.value;i.destination.decreaseActiveReference(),this._activatedTransitionPool.free(i)}this._activatedTransitions.length=0,this._topLevelEntry.increaseActiveReference(),this._currentNode.decreaseActiveReference(),this._currentNode=this._topLevelEntry},e.update=function(t){this.exited,this._loopMatchTransitions(),this._resetStateTickFlagsAndWeights(),this._updateActivatedTransitions(t.deltaTime),this._commitStateUpdates(t)},e.evaluate=function(t){return this._sample(t)||this._pushNullishPose(t)},e.getCurrentStateStatus=function(){var t=this._currentNode;return 3===t.kind||5===t.kind?t.getStatus():null},e.getCurrentClipStatuses=function(){var t=this._currentNode;return 3===t.kind?t.getClipStatuses(t.absoluteWeight):itt},e.getCurrentTransition=function(t){var e=this._activatedTransitions;if(0===e.length)return!1;var i=e[e.length-1],n=1===e.length?this._currentNode:e[e.length-2].destination,r=i.getAbsoluteDuration(n);return t.duration=r,t.time=i.normalizedElapsedTime*r,!0},e.getNextStateStatus=function(){var t=this._activatedTransitions;if(0===t.length)return null;var e=t[t.length-1].destination;switch(e.kind){default:break;case 5:case 3:return e.getStatus()}return null},e.getNextClipStatuses=function(){var t,e=this._activatedTransitions;if(0===e.length)return itt;var i=e[e.length-1],n=i.destination;return 3===n.kind&&null!==(t=n.getClipStatuses(i.destination.absoluteWeight))&&void 0!==t?t:itt},e.overrideClips=function(t){for(var e=this._motionStates,i=e.length,n=0;n<i;++n)e[n].overrideClips(t)},e._addStateMachine=function(t,e,i,n){for(var r,s,a,o=this,h=Array.from(t.states()),u=h.map((function(e){if(e instanceof S0){var n=new ott(e,i);return o._motionStates.push(n),n}if(e===t.entryState)return r=new gtt(e,0,e.name);if(e===t.exitState)return a=new gtt(e,1,e.name);if(e===t.anyState)return s=new gtt(e,2,e.name);if(e instanceof b2)return new ytt(e);if(e instanceof x2){var h=new vtt(e,i);return o._proceduralPoseStates.push(h),h}return null})),l={components:null,parent:e,entry:r,exit:a,any:s},c=0;c<h.length;++c){var f=u[c];f&&(f.stateMachine=l)}for(var _=h.map((function(t){if(t instanceof D2){var e=o._addStateMachine(t.stateMachine,l,i,n+"/"+t.name);return e.components=new att(t),e}return null})),d=0;d<h.length;++d){var m=h[d],g=t.getOutgoings(m),y=void 0;if(m instanceof D2){var v=_[d];y=v.exit}else{var b=u[d];y=b}for(var S,w=function(){var t,e=S.value,n=e.to,r=h.findIndex((function(t){return t===e.to}));if(n instanceof D2)t=_[r].entry;else{var s=u[r];t=s instanceof ott?s.entry:s}var a={conditions:e.conditions.map((function(t){return t[P2](i)})),to:t,triggers:void 0,duration:0,normalizedDuration:!1,destinationStart:0,relativeDestinationStart:!1,exitCondition:0,exitConditionEnabled:!1,activated:!1,startEventBinding:void 0,endEventBinding:void 0};(y2(e)||e instanceof S2||e instanceof A2)&&(a.duration=e.duration,a.destinationStart=e.destinationStart,a.relativeDestinationStart=e.relativeDestinationStart,e.startEventBinding.isBound&&(a.startEventBinding=e.startEventBinding),e.endEventBinding.isBound&&(a.endEventBinding=e.endEventBinding),y2(e)&&(a.normalizedDuration=e.relativeDuration,a.exitConditionEnabled=e.exitConditionEnabled,a.exitCondition=e.exitCondition)),a.conditions.forEach((function(t,i){var n,r=e.conditions[i];r instanceof R9&&r.trigger&&(null!==(n=a.triggers)&&void 0!==n?n:a.triggers=[]).push(r.trigger)})),y.addTransition(a)},x=p(g);!(S=x()).done;)w()}return l},e._loopMatchTransitions=function(){var t=this._pendingTransitionPath,e=this._activatedTransitions;t.length;for(var i=0===e.length?this._currentNode:e[e.length-1].destination,n=0;;++n){if(n>=16){at(14e3,16,"");break}var r=this._matchNextTransition(i);if(!r)break;var s=r.to,a=i;if(i=s,ttt(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<e.length;++i)e[i].destination.resetTickFlagsAndWeight()},e._commitStateUpdates=function(t){var e=this._currentNode,i=this._activatedTransitions;this._updateContextGenerator,this._commitStateUpdate(e,t);for(var n=0;n<i.length;++n){var r=i[n].destination;this._commitStateUpdate(r,t)}},e._commitStateUpdate=function(t,e){var i=this._updateContextGenerator;if(!t.testTickFlag(1))if(t.setTickFlag(1),3===t.kind)t.update(e.deltaTime,this._controller);else if(5===t.kind){var n=i.generate(e.deltaTime,e.indicativeWeight*t.absoluteWeight);t.update(n)}},e._sample=function(t){var e,i=this._currentNode,n=this._activatedTransitions,r=1,s=null,a=0;if(3===i.kind)s=null!==(e=i.evaluate(t))&&void 0!==e?e:this._pushNullishPose(t);else if(5===i.kind){var o;s=null!==(o=i.evaluate(t))&&void 0!==o?o:this._pushNullishPose(t)}else r-=i.absoluteWeight,s=null;s&&(a=i.absoluteWeight),i.setTickFlag(2);for(var h=0;h<n.length;++h){var u=n[h].destination;if(!u.testTickFlag(2)){u.setTickFlag(2);var l,c=u.absoluteWeight,f=void 0;4===u.kind?(r-=c,f=null):f=null!==(l=u.evaluate(t))&&void 0!==l?l:this._pushNullishPose(t),f&&(s&&(a+=c)?(s4(s,f,c/a),t.popPose()):s=f)}}return this.passthroughWeight=r,s},e._pushNullishPose=function(t){return this._additive?t.pushZeroDeltaPose():t.pushDefaultedPose()},e._matchNextTransition=function(t){var e=this._matchTransition(t,t);if(e)return e;if(3===t.kind||5===t.kind){var i=this._matchAnyScoped(t);if(i)return i}return null},e._matchAnyScoped=function(t){for(var e=t.stateMachine;null!==e;e=e.parent){var i=this._matchTransition(e.any,t);if(i)return i}return null},e._matchTransition=function(t,e){t===e||t.kind,this._conditionEvaluationContext.set(e);for(var i=t.outgoingTransitions,n=i.length,r=0;r<n;++r){var s=i[r];if(!s.activated){var a=s.conditions,o=a.length;if(0===o){if(0===t.kind||1===t.kind)return s;if(!s.exitConditionEnabled)continue}if(3===e.kind&&s.exitConditionEnabled){var h=e.duration*s.exitCondition;if(e.time<h)break}for(var u=!0,l=0;l<o;++l)if(!a[l].eval(this._conditionEvaluationContext)){u=!1;break}if(u)return s}}return null},e._activateTransition=function(t,e){var i=e.to;ttt(i);var n=this._activatedTransitionPool.alloc();n.reset(t,e),this._activatedTransitions.push(n);for(var r=n.path.length,s=0;s<r;++s){var a=n.path[s];this._resetTriggersOnTransition(a)}for(var o=0;o<n.path.length;++o){var h=n.path[o];this._callEnterMethods(h.to)}this._activatedTransitions.length;var u=1===this._activatedTransitions.length?this._currentNode:this._activatedTransitions[this._activatedTransitions.length-2].destination;u instanceof rtt&&u.transitionOutEventBinding&&this._emit(u.transitionOutEventBinding),e.startEventBinding&&this._emit(e.startEventBinding),i instanceof rtt&&i.transitionInEventBinding&&this._emit(i.transitionInEventBinding)},e._updateActivatedTransitions=function(t){for(var e=this._activatedTransitions,i=e.length-1,n=1,r=i;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<u;++l){var c=h.path[l];this._callExitMethods(c.to)}i.free(h)}if(t===e.length-1)e.length=0;else{for(var f=t+1;f<e.length;++f)e[f-n]=e[f];e.length-=n}this._currentNode.decreaseActiveReference(),this._currentNode=s},e._resetTriggersOnTransition=function(t){var e=t.triggers;if(e)for(var i=e.length,n=0;n<i;++n){var r=e[n];this._resetTrigger(r)}},e._resetTrigger=function(t){(0,this._triggerReset)(t)},e._callEnterMethods=function(t){var e,i=this._controller;switch(t.kind){default:break;case 3:t.components.callMotionStateEnterMethods(i,t.getStatus());break;case 0:null==(e=t.stateMachine.components)||e.callStateMachineEnterMethods(i)}},e._callExitMethods=function(t){var e,i=this._controller;switch(t.kind){default:break;case 3:t.components.callMotionStateExitMethods(i,t.getStatus());break;case 1:null==(e=t.stateMachine.components)||e.callStateMachineExitMethods(i)}},e._emit=function(t){t.emit(this._controller.node)},n(t,[{key:"exited",get:function(){return this._currentNode===this._topLevelExit}}]),t}();function ttt(t){return 3===t.kind||4===t.kind||5===t.kind}var ett={next:function(){return{done:!0,value:void 0}}},itt=((J9={})[Symbol.iterator]=function(){return ett},J9),ntt=function(){function t(t){this.name=void 0,this.outgoingTransitions=[],this._activeReferenceCount=0,this._tickFlags=0,this._absoluteWeight=0,this.name=t.name}var e=t.prototype;return e.setPrefix_debug=function(t){this.__DEBUG_ID__=""+t+this.name},e.addTransition=function(t){this.outgoingTransitions.push(t)},e.increaseActiveReference=function(){0===this._activeReferenceCount&&(this._absoluteWeight=0,this._tickFlags=0),++this._activeReferenceCount},e.decreaseActiveReference=function(){--this._activeReferenceCount},e.resetTickFlagsAndWeight=function(){this._checkActivated(),this._absoluteWeight=0,this._tickFlags=0},e.increaseAbsoluteWeight=function(t){this._absoluteWeight+=t},e.testTickFlag=function(t){return!!(this._tickFlags&t)},e.setTickFlag=function(t){this.testTickFlag(t),stt[t],this._tickFlags|=t},e._checkActivated=function(){this._activeReferenceCount},n(t,[{key:"absoluteWeight",get:function(){return this._absoluteWeight}},{key:"activeReferenceCount",get:function(){return this._activeReferenceCount}}]),t}(),rtt=function(t){function e(e){var i;return(i=t.call(this,e)||this).transitionInEventBinding=void 0,i.transitionOutEventBinding=void 0,e.transitionInEventBinding.isBound&&(i.transitionInEventBinding=e.transitionInEventBinding),e.transitionOutEventBinding.isBound&&(i.transitionOutEventBinding=e.transitionOutEventBinding),i}return s(e,t),e}(ntt),stt={UPDATED:1,EVALUATED:2},att=function(){function t(t){this._components=t.instantiateComponents()}var e=t.prototype;return e.callMotionStateEnterMethods=function(t,e){this._callMotionStateCallbackIfNonDefault("onMotionStateEnter",t,e)},e.callMotionStateUpdateMethods=function(t,e){this._callMotionStateCallbackIfNonDefault("onMotionStateUpdate",t,e)},e.callMotionStateExitMethods=function(t,e){this._callMotionStateCallbackIfNonDefault("onMotionStateExit",t,e)},e.callStateMachineEnterMethods=function(t){this._callStateMachineCallbackIfNonDefault("onStateMachineEnter",t)},e.callStateMachineExitMethods=function(t){this._callStateMachineCallbackIfNonDefault("onStateMachineExit",t)},e._callMotionStateCallbackIfNonDefault=function(t,e,i){for(var n=this._components,r=n.length,s=0;s<r;++s){var a=n[s];a[t]!==L9.prototype[t]&&a[t](e,i)}},e._callStateMachineCallbackIfNonDefault=function(t,e){for(var i=this._components,n=i.length,r=0;r<n;++r){var s=i[r];s[t]!==L9.prototype[t]&&s[t](e)}},t}(),ott=function(){function t(t,e){var i,n;this._source=null,this._baseSpeed=1,this._speed=1,this._publicState=void 0,this._privateState=void 0;var r=t.name;if(this._baseSpeed=t.speed,this._setSpeedMultiplier(1),t.speedMultiplierEnabled&&t.speedMultiplier){var s=t.speedMultiplier,a=e.getVar(s);if(A6(a,s)){C6(a.type,0,s),a.bind(this._setSpeedMultiplier,this);var o=a.value;this._setSpeedMultiplier(o)}}var h=null!==(i=null==(n=t.motion)?void 0:n[P2](e,!1))&&void 0!==i?i:null;h&&Object.defineProperty(h,"__DEBUG_ID__",{value:r}),this._source=h,this._publicState=new htt(this,t,null==h?void 0:h.createPort()),this._privateState=new htt(this,t,null==h?void 0:h.createPort()),this.components=new att(t)}var e=t.prototype;return e.setPrefix_debug=function(t){this._publicState.setPrefix_debug(t),this._privateState.setPrefix_debug(t)},e.addTransition=function(t){t.to===this._publicState?this._publicState.addTransition(r({},t,{to:this._privateState})):this._publicState.addTransition(t),this._privateState.addTransition(t)},e.getClipStatuses=function(t){var e,i=this._source;return i?((e={})[Symbol.iterator]=function(){return i.getClipStatuses(t)},e):itt},e.overrideClips=function(t){var e;null==(e=this._source)||e.overrideClips(t)},e._setSpeedMultiplier=function(t){this._speed=this._baseSpeed*t},n(t,[{key:"duration",get:function(){var t,e;return null!==(t=null==(e=this._source)?void 0:e.duration)&&void 0!==t?t:0}},{key:"speed",get:function(){return this._speed}},{key:"entry",get:function(){return this._publicState}},{key:"stateMachine",get:function(){return this._stateMachine},set:function(t){this._stateMachine=t,this._publicState.stateMachine=t,this._privateState.stateMachine=t}}]),t}(),htt=function(t){function e(e,i,n){var r;return(r=t.call(this,i)||this).kind=3,r._container=void 0,r._progress=0,r._port=void 0,r._statusCache={progress:0},r._container=e,r._port=n,r}s(e,t);var i=e.prototype;return i.reenter=function(t){var e;this._progress=t,null==(e=this._port)||e.reenter()},i.getStatus=function(){var t=this._statusCache;return t.progress=ltt(this._progress),t},i.getClipStatuses=function(t){return this._container.getClipStatuses(t)},i.update=function(t,e){this._progress=utt(this._progress,this.duration,t*this._container.speed),this._container.components.callMotionStateUpdateMethods(e,this.getStatus())},i.evaluate=function(t){var e,i;return null!==(e=null==(i=this._port)?void 0:i.evaluate(this._progress,t))&&void 0!==e?e:null},n(e,[{key:"duration",get:function(){return this._container.duration}},{key:"components",get:function(){return this._container.components}},{key:"normalizedTime",get:function(){return this._progress}},{key:"time",get:function(){return this._progress*this._container.duration}}]),e}(rtt);function utt(t,e,i){return 0===e?0:t+i/e}function ltt(t){var e=t-Math.trunc(t);return e>=0?e:1+e}var ctt,ftt,_tt,dtt,ptt,mtt,gtt=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}(ntt),ytt=function(t){function e(e){var i;return(i=t.call(this,e)||this).kind=4,i}return s(e,t),e}(ntt),vtt=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=W9(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=ltt(this._elapsedTime),this._statusCache},i.countMotionTime=function(){return this._instantiatedPoseGraph.countMotionTime()},e}(rtt),btt=function(){function t(){this.sourceStateWeight=0,this._sourceState=void 0}var e=t.prototype;return e.set=function(t){this._sourceState=t,ttt(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}(),Stt=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(ttt(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 ho((function(){return new t}),e,void 0)},e.reset=function(t,e){var i=e.to;ttt(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}(),wtt=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 xtt(e),this._groups.push(i)),i.addMember()},e.sync=function(){for(var t,e=p(this._groups);!(t=e()).done;)t.value.sync()},t}(),xtt=function(){function t(t){this._lastLeader=void 0,this._records=[],this.name=t}var e=t.prototype;return e.addMember=function(){var t=new Ttt;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<e;++s){var a=t[s];if(!a.active||!Zi(a.weight,r,1e-6))break;if(a===i){n=s;break}}t[n].active,this._lastLeader=t[n];for(var o=t[n].normalizedTime,h=0;h<e;++h){var u=t[h];if(!u.active)break;u.normalizedTime=o,u.reset()}}},t}(),Ttt=function(){function t(){this.normalizedTime=0,this.weight=0,this.active=!1}var e=t.prototype;return e.notifyRenter=function(t){this.reset(),this.normalizedTime=t},e.notifyUpdate=function(t,e){this.normalizedTime+=t,this.active?this.weight+=e:(this.active=!0,this.weight=e)},e.reset=function(){this.active=!1,this.weight=0},e.getSyncedEnterTime=function(){return this.normalizedTime},t}(),Att=function(){function t(t){this._state=0,this._instantiatedPoseGraph=void 0,this._maxRequestedUpdateTime=0,this._evaluationCache=null,this._updateContextGenerator=new V7,this._allocator=t}var e=t.prototype;return e.set=function(t,e){this._state;var i=W9(t.graph,e);i.bind(e),this._instantiatedPoseGraph=i,this._state=1},e.settle=function(t){1===this._state||this._state,this._instantiatedPoseGraph,this._instantiatedPoseGraph.settle(t),this._state=2},e.reset=function(){switch(this._state){case 2:case 4:break;case 3:this._state=4;break;case 6:case 8:this._evaluationCache&&(this._allocator.destroyPose(this._evaluationCache),this._evaluationCache=null),this._maxRequestedUpdateTime=0,this._state=3}},e.reenter=function(){switch(this._state){default:this._state;break;case 3:case 6:break;case 2:case 4:this._state=3,this._instantiatedPoseGraph,this._instantiatedPoseGraph.reenter()}},e.requestUpdate=function(t){var e=t.deltaTime;if(4===this._state||3===this._state||5===this._state||this._state,this._instantiatedPoseGraph,5!==this._state){var i=Math.max(0,e-this._maxRequestedUpdateTime);if(6!==this._state||!Zi(i,0,1e-8)){this._state=5,this._maxRequestedUpdateTime=Math.max(e,this._maxRequestedUpdateTime);var n=this._updateContextGenerator.generate(i,t.indicativeWeight);this._instantiatedPoseGraph.update(n),this._state=6}}},e.evaluate=function(t){switch(this._state){default:this._state;break;case 7:this._state=8;break;case 8:break;case 6:var e;this._evaluationCache,this._state=7;var i=null==(e=this._instantiatedPoseGraph)?void 0:e.evaluate(t);if(this._state=8,i){var n=this._allocator.allocatePose();n.transforms.set(i.transforms),n.auxiliaryCurves.set(i.auxiliaryCurves),this._evaluationCache=n,t.popPose()}this._state=8}return this._state,this._instantiatedPoseGraph,this._evaluationCache?t.pushDuplicatedPose(this._evaluationCache):null},t}(),Ctt=function(){function t(t){this._allocator=void 0,this._stashEvaluations={},this._allocator=t}var e=t.prototype;return e.bindStash=function(t){return this._stashEvaluations[t]},e.getStash=function(t){return this._stashEvaluations[t]},e.addStash=function(t){this._stashEvaluations[t]=new Att(this._allocator)},e.setStash=function(t,e,i){this._stashEvaluations,this._stashEvaluations[t].set(e,i)},e.reset=function(){for(var t in this._stashEvaluations)this._stashEvaluations[t].reset()},e.settle=function(t){for(var e in this._stashEvaluations)this._stashEvaluations[e].settle(t)},t}(),Dtt=function(t){function e(e,i,n){var r;(r=t.call(this)||this)._layerRecords=void 0;var s=e.layers.map((function(t){return new Btt(t,i,n)}));return r._layerRecords=s,r}s(e,t);var i=e.prototype;return i.reenter=function(){},i.bind=function(){},i.settle=function(t){for(var e=this._layerRecords,i=e.length,n=0;n<i;++n)e[n].settle(t)},i.getLayerWeight=function(t){return t>=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;n<i;++n){var r=e[n];t._pushAdditiveFlag(r.additive),r.stateMachineEvaluation.overrideClips(t),t._popAdditiveFlag()}},i.doUpdate=function(t){for(var e=this._layerRecords,i=e.length,n=0;n<i;++n)e[n].update(t)},i.doEvaluate=function(t){for(var e=t.pushDefaultedPose(),i=this._layerRecords,n=i.length,r=0;r<n;++r){var s=i[r],a=s.stateMachineEvaluation.evaluate(t),o=s.weight*s.stateMachineEvaluation.passthroughWeight,h=s.transformFilter;s.additive?p4(e,a,o,h):s4(e,a,o,h),t.popPose(),s.postEvaluate()}return e},n(e,[{key:"layerCount",get:function(){return this._layerRecords.length}}]),e}(n1),Btt=function(){function t(t,e,i){var n;this.additive=!1,this.weight=0,this._topLevelStateMachineEval=void 0,this._stashManager=void 0,this._motionSyncManager=void 0,this._mask=void 0,this.transformFilter=void 0;for(var r,s=new Ctt(i),a=p(t.stashes());!(r=a()).done;){var o=r.value,h=o[0];o[1],s.addStash(h)}this._stashManager=s;var u=new wtt;this._motionSyncManager=u,e._setLayerWideContextProperties(s,u);for(var l,c=p(t.stashes());!(l=c()).done;){var f=l.value,_=f[0],d=f[1];s.setStash(_,d,e)}this.weight=t.weight;var m=this.additive=t.additive;this._mask=null!==(n=t.mask)&&void 0!==n?n:void 0,e._pushAdditiveFlag(m),this._topLevelStateMachineEval=new $9(t.stateMachine,t.name,e),e._popAdditiveFlag(),e._unsetLayerWideContextProperties()}var e=t.prototype;return e.settle=function(t){this._mask&&(this.transformFilter=t.createTransformFilter(this._mask)),this._stashManager.settle(t),this._topLevelStateMachineEval.settle(t)},e.update=function(t){this.stateMachineEvaluation.update(t),this._motionSyncManager.sync()},e.postEvaluate=function(){this._stashManager.reset()},n(t,[{key:"stateMachineEvaluation",get:function(){return this._topLevelStateMachineEval}}]),t}(),Itt=function(){function t(t,e,i,n){this._currentTransitionCache={duration:0,time:0},this._rootPoseNode=void 0,this._varInstances={},this._hasAutoTrigger=!1,this._auxiliaryCurveRegistry=new w7,this._poseLayoutMaintainer=void 0,this._bindingContext=void 0,this._settleContext=void 0,this._rootUpdateContextGenerator=new V7;for(var r,s=p(t.variables);!(r=s()).done;){var a=r.value,o=a[0],h=a[1][A$]();this._varInstances[o]=h,h instanceof M$&&1===h.resetMode&&(this._hasAutoTrigger=!0)}var u=new x7(e,this._auxiliaryCurveRegistry);this._poseLayoutMaintainer=u;var l=new b7(e,u,this._varInstances,i);l._setClipOverrides(null!=n?n:void 0),this._bindingContext=l;var c=new E7(u);this._settleContext=c,u.startBind();var f=new N7;this._poseStashAllocator=f,this._rootPoseNode=new Dtt(t,l,f),this._root=e,this._initializeContexts()}var e=t.prototype;return e.destroy=function(){this._evaluationContext.destroy()},e._destroyAfterException_debugging=function(){var t=this._evaluationContext._stackSize_debugging;if(0!==t)for(var e=0;e<t;++e)this._evaluationContext.popPose();this._evaluationContext.destroy()},e.update=function(t){var e=this._evaluationContext,i=this._poseLayoutMaintainer,n=this._rootUpdateContextGenerator,r=this._rootPoseNode,s=n.generate(t,1);r.update(s);var a=r.evaluate(e,1);if(this._hasAutoTrigger){var o=this._varInstances;for(var h in o){var u=o[h];u instanceof M$&&1===u.resetMode&&(u.value=!1)}}i.apply(a),e.popPose()},e.getVariables=function(){return Object.entries(this._varInstances)},e.getCurrentStateStatus=function(t){return this._rootPoseNode.getLayerTopLevelStateMachineEvaluation(t).getCurrentStateStatus()},e.getCurrentClipStatuses=function(t){return this._rootPoseNode.getLayerTopLevelStateMachineEvaluation(t).getCurrentClipStatuses()},e.getCurrentTransition=function(t){var e=this._currentTransitionCache;return this._rootPoseNode.getLayerTopLevelStateMachineEvaluation(t).getCurrentTransition(e)?e:null},e.getNextStateStatus=function(t){return this._rootPoseNode.getLayerTopLevelStateMachineEvaluation(t).getNextStateStatus()},e.getNextClipStatuses=function(t){return this._rootPoseNode.getLayerTopLevelStateMachineEvaluation(t).getNextClipStatuses()},e.getValue=function(t){var e=this._varInstances[t];return e?e.value:void 0},e.setValue=function(t,e){var i=this._varInstances[t];i&&(i.value=e)},e.getLayerWeight=function(t){return this._rootPoseNode.getLayerWeight(t)},e.setLayerWeight=function(t,e){this._rootPoseNode.setLayerWeight(t,e)},e.overrideClips=function(t){this._poseLayoutMaintainer.startBind(),this._bindingContext._setClipOverrides(t),this._rootPoseNode.overrideClips(this._bindingContext),this._updateAfterPossiblePoseLayoutChange()},e.getAuxiliaryCurveValue=function(t){return this._auxiliaryCurveRegistry.get(t)},e._initializeContexts=function(){var t=this._poseLayoutMaintainer;t.endBind(),this._createOrUpdateTransformFilters();var e=t.createEvaluationContext();this._evaluationContext=e,t.fetchDefaultTransforms(e[P7]),t.resetPoseStashAllocator(this._poseStashAllocator)},e._updateAfterPossiblePoseLayoutChange=function(){var t=this._poseLayoutMaintainer,e=t.endBind();if(0!==e){(1&e||2&e)&&this._createOrUpdateTransformFilters();var i=!1;if(1&e||4&e){var n=t.createEvaluationContext();this._evaluationContext.destroy(),this._evaluationContext=n,i=!0,t.resetPoseStashAllocator(this._poseStashAllocator)}(i||1&e||2&e)&&t.fetchDefaultTransforms(this._evaluationContext[P7])}},e._createOrUpdateTransformFilters=function(){this._rootPoseNode.settle(this._settleContext)},n(t,[{key:"layerCount",get:function(){return this._rootPoseNode.layerCount}}]),t}(),Mtt=Ou,Ptt=uu,Ett=lu,Ott=(ctt=Kh("cc.animation.AnimationController"),ftt=Mtt(x0),_tt=Ett("graph"),ctt((ptt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._graph=mtt&&mtt(),e._graphEval=null,e}s(e,t);var i=e.prototype;return i.__preload=function(){var t=this.graph;if(t){var e,i=null;if(t instanceof N8){if(!t.original)return;e=t.original,i=t.clipOverrides}else e=t;var n=new Itt(e,this.node,this,i);this._graphEval=n}},i.onDestroy=function(){var t;null==(t=this._graphEval)||t.destroy()},i.update=function(t){var e;null==(e=this._graphEval)||e.update(t)},i.getVariables=function(){return this._graphEval.getVariables()},i.setValue=function(t,e){return this.setValue_experimental(t,e)},i.setValue_experimental=function(t,e){this._graphEval.setValue(t,e)},i.getValue=function(t){var e=this.getValue_experimental(t);return"object"==typeof e?void 0:e},i.getValue_experimental=function(t){return this._graphEval.getValue(t)},i.getCurrentStateStatus=function(t){return this._graphEval.getCurrentStateStatus(t)},i.getCurrentClipStatuses=function(t){return this._graphEval.getCurrentClipStatuses(t)},i.getCurrentTransition=function(t){return this._graphEval.getCurrentTransition(t)},i.getNextStateStatus=function(t){return this._graphEval.getNextStateStatus(t)},i.getNextClipStatuses=function(t){return this._graphEval.getNextClipStatuses(t)},i.getLayerWeight=function(t){return this._graphEval.getLayerWeight(t)},i.setLayerWeight=function(t,e){return this._graphEval.setLayerWeight(t,e)},i.overrideClips_experimental=function(t){this._graphEval.overrideClips(t)},i.getAuxiliaryCurveValue_experimental=function(t){var e=this._graphEval;return e?e.getAuxiliaryCurveValue(t):0},n(e,[{key:"graph",get:function(){return this._graph},set:function(t){this._graph=t}},{key:"layerCount",get:function(){var t,e;return null!==(t=null==(e=this._graphEval)?void 0:e.layerCount)&&void 0!==t?t:0}}]),e}(yg),v(ptt.prototype,"graph",[ftt],Object.getOwnPropertyDescriptor(ptt.prototype,"graph"),ptt.prototype),mtt=zh(ptt.prototype,"_graph",[Ptt,_tt],(function(){return null})),dtt=ptt))||dtt),ktt=Object.freeze({__proto__:null,AnimationController:Ott,ColorTrack:r$,ComponentPath:jQ,CubicSplineNumberValue:NZ,CubicSplineQuatValue:VZ,CubicSplineVec2Value:RZ,CubicSplineVec3Value:FZ,CubicSplineVec4Value:LZ,HierarchyPath:WQ,MorphWeightValueProxy:CZ,MorphWeightsAllValueProxy:BZ,MorphWeightsValueProxy:DZ,ObjectTrack:u$,QuatTrack:e$,RealTrack:zZ,SizeTrack:o$,StateMachineComponent:L9,Track:tZ,TrackPath:JQ,UniformProxyFactory:vZ,VariableType:{FLOAT:0,BOOLEAN:1,TRIGGER:2,INTEGER:3,VEC3_experimental:4,QUAT_experimental:5},VectorTrack:QZ,isCustomPath:function(t,e){return t instanceof e},isPropertyPath:CQ});t("as",ktt);var Rtt,Ftt,Ltt=function(){function t(){this._nodeBlendStates=new Map}var e=t.prototype;return e.createWriter=function(t,e,i,n){var r=this.ref(t,e);return new Vtt(t,e,r,i,n)},e.destroyWriter=function(t){var e=t;this.deRef(e.node,e.property)},e.ref=function(t,e){var i=this._nodeBlendStates.get(t);return i||(i=this.createNodeBlendState(),this._nodeBlendStates.set(t,i)),i.refProperty(t,e)},e.deRef=function(t,e){var i=this._nodeBlendStates.get(t);i&&(i.deRefProperty(e),i.empty&&this._nodeBlendStates.delete(t))},e.apply=function(){this._nodeBlendStates.forEach((function(t,e){t.apply(e)}))},t}(),Vtt=function(){function t(t,e,i,n,r){this._node=t,this._property=e,this._propertyBlendState=i,this._host=n,this._constants=r}var e=t.prototype;return e.getValue=function(){return this._node[this._property]},e.setValue=function(t){var e=this._propertyBlendState,i=this._host.weight;e.blend(t,i)},n(t,[{key:"node",get:function(){return this._node}},{key:"property",get:function(){return this._property}}]),t}(),Ntt=function(){function t(){this.refCount=0,this.accumulatedWeight=0,this.result=new ir}var e=t.prototype;return e.blend=function(t,e){this.accumulatedWeight=Wtt(this.result,this.result,this.accumulatedWeight,t,e)},e.reset=function(){this.accumulatedWeight=0,ir.zero(this.result)},t}(),ztt=function(){function t(){this.refCount=0,this.accumulatedWeight=0,this.result=new kr}var e=t.prototype;return e.blend=function(t,e){this.accumulatedWeight=jtt(this.result,this.result,this.accumulatedWeight,t,e)},e.reset=function(){this.accumulatedWeight=0,kr.identity(this.result)},t}(),Utt=function(){function t(){this._transformApplyFlags=0,this._properties={}}var e=t.prototype;return e.refProperty=function(t,e){var i,n,r,s=this._properties;switch(e){default:case"position":case"scale":case"eulerAngles":r=null!==(i=s[e])&&void 0!==i?i:s[e]=this._createVec3BlendState(t[e]);break;case"rotation":r=null!==(n=s[e])&&void 0!==n?n:s[e]=this._createQuatBlendState(t.rotation)}return++r.refCount,r},e.deRefProperty=function(t){var e=this._properties,i=e[t];i&&(--i.refCount,i.refCount>0||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}(),Gtt=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 Ntt},i._createQuatBlendState=function(){return new ztt},e}(Utt),Htt=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createNodeBlendState=function(){return new Gtt},e}(Ltt);function Wtt(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 jtt(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 qtt=t("aB",Kh((Ftt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._anims=new ye([]),e._crossFades=new ye([]),e._delayEvents=[],e._blendStateBuffer=new Htt,e._sockets=[],e}s(e,t);var i=e.prototype;return i.addCrossFade=function(t){-1===this._crossFades.array.indexOf(t)&&this._crossFades.push(t)},i.removeCrossFade=function(t){var e=this._crossFades.array.indexOf(t);e>=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<r.length;++i.i)r[i.i].update(t);var s=this._anims,a=s.array;for(s.i=0;s.i<a.length;++s.i){var o=a[s.i];o.isMotionless||o.update(t)}this._blendStateBuffer.apply();for(var h=YE.getTotalFrames(),u=0,l=n.length;u<l;u++){var c=n[u],f=c.target,_=c.transform;f.matrix=CY(_,h)}for(var d=0,p=e.length;d<p;d++){var m=e[d];m.fn.apply(m.thisArg,m.args)}e.length=0},i.destruct=function(){},i.addAnimation=function(t){-1===this._anims.array.indexOf(t)&&this._anims.push(t)},i.removeAnimation=function(t){var e=this._anims.array.indexOf(t);e>=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&&DY(s,t);a&&i._sockets.push({target:n.target,transform:a})},r=0;r<e.length;++r)n()},i.removeSockets=function(t,e){for(var i=0;i<e.length;++i)for(var n=e[i],r=0;r<this._sockets.length;++r){var s=this._sockets[r];if(s.target===n.target){BY(s.transform.node),this._sockets[r]=this._sockets[this._sockets.length-1],this._sockets.length--;break}}},n(e,[{key:"blendState",get:function(){return this._blendStateBuffer}}]),e}(Ff),Ftt.ID="animation",Rtt=Ftt))||Rtt);YE.on("director_init",(function(){var t=new qtt;YE.registerSystem(qtt.ID,t,200)})),A.AnimationManager=qtt;var Xtt,Ytt,Jtt,Ktt,Qtt,Ztt,$tt,tet,eet,iet,net,ret,set,aet,oet=function(t){function e(e){var i;return(i=t.call(this)||this)._managedStates=[],i._fadings=[],i._scheduled=!1,i._scheduler=null!=e?e:lQ(),i}s(e,t);var i=e.prototype;return i.update=function(t){if(!this.isMotionless){var e=this._managedStates,i=this._fadings;if(1===e.length&&1===i.length){var n=e[0].state;n&&(n.weight=1)}else this._calculateWeights(t);1===e.length&&1===i.length&&this._unscheduleThis()}},i.crossFade=function(t,e){var i;0===this._managedStates.length&&(e=0),0===e&&this.clear();var n=this._managedStates.find((function(e){return e.state===t}));n?null!=(i=n.state)&&i.isMotionless&&n.state.play():(n={state:t,reference:0},t&&t.play(),this._managedStates.push(n)),++n.reference,this._fadings.unshift({easeDuration:e,easeTime:0,target:n}),this.isMotionless||this._scheduleThis()},i.clear=function(){for(var t=0;t<this._managedStates.length;++t){var e=this._managedStates[t].state;e&&e.stop()}this._managedStates.length=0,this._fadings.length=0},i.onPlay=function(){t.prototype.onPlay.call(this),this._scheduleThis()},i.onPause=function(){t.prototype.onPause.call(this);for(var e=0;e<this._managedStates.length;++e){var i=this._managedStates[e].state;i&&i.pause()}this._unscheduleThis()},i.onResume=function(){t.prototype.onResume.call(this);for(var e=0;e<this._managedStates.length;++e){var i=this._managedStates[e].state;i&&i.resume()}this._scheduleThis()},i.onStop=function(){t.prototype.onStop.call(this),this.clear()},i._calculateWeights=function(t){for(var e=this._managedStates,i=this._fadings,n=0;n<e.length;++n){var r=e[n].state;r&&(r.weight=0)}for(var s=1,a=i.length,o=0;o<i.length;++o){var h=i[o];h.easeTime+=t;var u=0===h.easeDuration?1:tn(h.easeTime/h.easeDuration),l=u*s;if(s*=1-u,h.target.state&&(h.target.state.weight+=l),h.easeTime>=h.easeDuration){a=o+1,h.easeTime=h.easeDuration;break}}if(a!==i.length){for(var c=a;c<i.length;++c){var f=i[c];--f.target.reference,f.target.reference<=0&&(f.target.state&&f.target.state.stop(),Se(this._managedStates,f.target))}i.splice(a)}},i._scheduleThis=function(){this._scheduled||(this._scheduler.addCrossFade(this),this._scheduled=!0)},i._unscheduleThis=function(){this._scheduled&&(this._scheduler.removeCrossFade(this),this._scheduled=!1)},e}(aQ),het=t("av",(Xtt=Kh("cc.Animation"),Ytt=Zh(99),Jtt=Ou([D5]),Ktt=Ou(D5),Qtt=Ou([D5]),Xtt(Ztt=Ytt((net=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).playOnLoad=tet&&tet(),e._crossFade=new oet,e._nameToState=Gt(!0),e._clips=eet&&eet(),e._defaultClip=iet&&iet(),e._hasBeenPlayed=!1,e}s(e,t);var i=e.prototype;return i.onLoad=function(){for(var t in this.clips=this._clips,this._nameToState)this._nameToState[t].initialize(this.node)},i.start=function(){this.playOnLoad&&!this._hasBeenPlayed&&this._defaultClip&&this.crossFade(this._defaultClip.name,0)},i.onEnable=function(){this._crossFade.resume()},i.onDisable=function(){this._crossFade.pause()},i.onDestroy=function(){for(var t in this._crossFade.stop(),this._nameToState)this._nameToState[t].destroy();this._nameToState=Gt(!0)},i.play=function(t){if(this._hasBeenPlayed=!0,!t){if(!this._defaultClip)return;t=this._defaultClip.name}this.crossFade(t,0)},i.crossFade=function(t,e){void 0===e&&(e=.3),this._hasBeenPlayed=!0;var i=this._nameToState[t];i&&this.doPlayOrCrossFade(i,e)},i.pause=function(){this._crossFade.pause()},i.resume=function(){this._crossFade.resume()},i.stop=function(){this._crossFade.stop()},i.getState=function(t){var e=this._nameToState[t];return e&&!e.curveLoaded&&e.initialize(this.node),e||null},i.createState=function(t,e){return e=e||t.name,this.removeState(e),this._doCreateState(t,e)},i.removeState=function(t){var e=this._nameToState[t];e&&(e.allowLastFrameEvent(!1),e.stop(),delete this._nameToState[t])},i.addClip=function(t,e){return Te(this._clips,t)||this._clips.push(t),this.createState(t,e)},i.removeClip=function(t,e){var i;for(var n in this._nameToState){var r=this._nameToState[n];if(r.clip===t){i=r;break}}if(t===this._defaultClip){if(!e)return void at(3902);this._defaultClip=null}if(i&&i.isPlaying){if(!e)return void at(3903);i.stop()}this._clips=this._clips.filter((function(e){return e!==t})),i&&delete this._nameToState[i.name]},i.on=function(e,i,n,r){var s=t.prototype.on.call(this,e,i,n,r);return"lastframe"===e&&this._syncAllowLastFrameEvent(),s},i.once=function(e,i,n){var r=t.prototype.once.call(this,e,i,n);return"lastframe"===e&&this._syncAllowLastFrameEvent(),r},i.off=function(e,i,n){t.prototype.off.call(this,e,i,n),"lastframe"===e&&this._syncDisallowLastFrameEvent()},i._createState=function(t,e){return new pQ(t,e)},i._doCreateState=function(t,e){var i=this._createState(t,e);return i._setEventTarget(this),i.allowLastFrameEvent(this.hasEventListener("lastframe")),this.node&&i.initialize(this.node),this._nameToState[i.name]=i,i},i.doPlayOrCrossFade=function(t,e){this._crossFade.play(),this._crossFade.crossFade(t,e)},i._removeStateOfAutomaticClip=function(t){for(var e in this._nameToState){var i=this._nameToState[e];uet(t,i.clip)&&(i.stop(),delete this._nameToState[e])}},i._syncAllowLastFrameEvent=function(){if(this.hasEventListener("lastframe"))for(var t in this._nameToState)this._nameToState[t].allowLastFrameEvent(!0)},i._syncDisallowLastFrameEvent=function(){if(!this.hasEventListener("lastframe"))for(var t in this._nameToState)this._nameToState[t].allowLastFrameEvent(!1)},n(e,[{key:"clips",get:function(){return this._clips},set:function(t){var e=this;this._crossFade&&this._crossFade.clear(),this._clips.forEach((function(t){t&&e._removeStateOfAutomaticClip(t)})),t.forEach((function(t){t&&e.createState(t)}));var i=t.find((function(t){return uet(t,e._defaultClip)}));this._defaultClip=i||null,this._clips=t}},{key:"defaultClip",get:function(){return this._defaultClip},set:function(t){this._defaultClip=t,t&&(this._clips.findIndex((function(e){return uet(e,t)}))>=0||(this._clips.push(t),this.createState(t)))}}]),e}(Bo(yg)),net.EventType=cQ,v(($tt=net).prototype,"clips",[Jtt],Object.getOwnPropertyDescriptor($tt.prototype,"clips"),$tt.prototype),v($tt.prototype,"defaultClip",[Ktt],Object.getOwnPropertyDescriptor($tt.prototype,"defaultClip"),$tt.prototype),tet=zh($tt.prototype,"playOnLoad",[uu],(function(){return!1})),eet=zh($tt.prototype,"_clips",[Qtt],(function(){return[]})),iet=zh($tt.prototype,"_defaultClip",[uu],(function(){return null})),Ztt=$tt))||Ztt)||Ztt));function uet(t,e){return t===e||!!t&&!!e&&t._uuid===e._uuid&&t._uuid}A.Animation=het,A.AnimationComponent=het,le(het,"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"}(ret||(ret={})),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"}(set||(set={})),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"}(aet||(aet={}));var cet=t("aG",function(){function t(){this._bufferView=void 0,this._normalizeFactor=1;for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];if(2===e.length)this._bufferView=e[0],this._normalizeFactor=e[1];else{var n=e[0],r=e[1],s=e[2];this._bufferView=new r(n),this._normalizeFactor=s}}return t.prototype.getData=function(t){return this._bufferView[t]*this._normalizeFactor},n(t,[{key:"length",get:function(){return this._bufferView.length}}]),t}());function fet(t){for(var e=t._operationQueue.length,i=t._operationQueue.slice(),n=[],r=!1,s=e-1;s>=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 _et,det=0;function pet(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()),fet(t);var i=t._operationQueue[0];i&&pet(t,i)})).catch((function(){})))}function met(t,e,i){var n=i.value;i.value=function(){for(var t=this,i=arguments.length,r=new Array(i),s=0;s<i;s++)r[s]=arguments[s];return new Promise((function(i){var s=det++,a=t;a._operationQueue.push({op:e,id:s,func:n,args:r,invoking:!1}),a._eventTarget.once(s.toString(),i),pet(a,a._operationQueue[0])}))}}function get(t){return new Promise((function(e){var i=t.play();return void 0===i?e():(i.then(e).catch((function(){var i=function i(){t.play().then((function(){null==n||n.removeEventListener("touchend",i,{capture:!0}),null==n||n.removeEventListener("mouseup",i,{capture:!0})})).catch((function(){})),e()},n=document.getElementById("GameCanvas");null==n||n.addEventListener("touchend",i,{capture:!0}),null==n||n.addEventListener("mouseup",i,{capture:!0})})),null)}))}var yet,vet,bet=function(){function t(t,e){this._domAudio=void 0,this._onPlayCb=void 0,this._onEndCb=void 0,this._domAudio=t,t.volume=e}var e=t.prototype;return e.play=function(){var t=this;get(this._domAudio).then((function(){null==t.onPlay||t.onPlay()})).catch((function(){}))},e.stop=function(){this._domAudio.pause()},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&&this._domAudio.removeEventListener("ended",this._onEndCb),this._onEndCb=t,t&&this._domAudio.addEventListener("ended",t)}}]),t}(),wet=(_et=function(){function t(t){var e=this;this._domAudio=void 0,this._state=aet.INIT,this._onEnded=void 0,this._eventTarget=new Io,this._operationQueue=[],this._domAudio=t,XO.on(qO.EVENT_PAUSE,this._onInterruptedBegin,this),XO.on(qO.EVENT_RESUME,this._onInterruptedEnd,this),this._onEnded=function(){e.seek(0).catch((function(){})),e._state=aet.INIT,e._eventTarget.emit(ret.ENDED)},this._domAudio.addEventListener("ended",this._onEnded)}var e=t.prototype;return e.destroy=function(){XO.off(qO.EVENT_PAUSE,this._onInterruptedBegin,this),XO.off(qO.EVENT_RESUME,this._onInterruptedEnd,this),this._domAudio.removeEventListener("ended",this._onEnded),this._domAudio=null},t.load=function(e){return new Promise((function(i,n){t.loadNative(e).then((function(e){i(new t(e))})).catch(n)}))},t.loadNative=function(t){return new Promise((function(e,i){var n=document.createElement("audio"),r="canplaythrough";Vo.os===Oo.IOS?r="loadedmetadata":Vo.browserType===Mo.FIREFOX&&(r="canplay");var s=setTimeout((function(){0===n.readyState?h():o()}),8e3),a=function(){clearTimeout(s),n.removeEventListener(r,o,!1),n.removeEventListener("error",h,!1)},o=function(){a(),e(n)},h=function(){a(),i(new Error("load audio failure - "+t))};n.addEventListener(r,o,!1),n.addEventListener("error",h,!1),n.src=t}))},t.loadOneShotAudio=function(e,i){return new Promise((function(n,r){t.loadNative(e).then((function(t){var e=new bet(t,i);n(e)})).catch(r)}))},e._onInterruptedBegin=function(){var t=this;this._state===aet.PLAYING&&this.pause().then((function(){t._state=aet.INTERRUPTED,t._eventTarget.emit(ret.INTERRUPTION_BEGIN)})).catch((function(){}))},e._onInterruptedEnd=function(){var t=this;this._state===aet.INTERRUPTED&&this.play().then((function(){t._eventTarget.emit(ret.INTERRUPTION_END)})).catch((function(){}))},e.getPCMData=function(){},e.seek=function(t){return t=$i(t,0,this.duration),this._domAudio.currentTime=t,Promise.resolve()},e.play=function(){var t=this;return new Promise((function(e){get(t._domAudio).then((function(){t._state=aet.PLAYING,e()})).catch((function(){}))}))},e.pause=function(){return this._domAudio.pause(),this._state=aet.PAUSED,Promise.resolve()},e.stop=function(){var t=this;return new Promise((function(e){t._domAudio.pause(),t._domAudio.currentTime=0,t._state=aet.STOPPED,e()}))},e.onInterruptionBegin=function(t){this._eventTarget.on(ret.INTERRUPTION_BEGIN,t)},e.offInterruptionBegin=function(t){this._eventTarget.off(ret.INTERRUPTION_BEGIN,t)},e.onInterruptionEnd=function(t){this._eventTarget.on(ret.INTERRUPTION_END,t)},e.offInterruptionEnd=function(t){this._eventTarget.off(ret.INTERRUPTION_END,t)},e.onEnded=function(t){this._eventTarget.on(ret.ENDED,t)},e.offEnded=function(t){this._eventTarget.off(ret.ENDED,t)},n(t,[{key:"src",get:function(){return this._domAudio?this._domAudio.src:""}},{key:"type",get:function(){return set.DOM_AUDIO}},{key:"state",get:function(){return this._state}},{key:"loop",get:function(){return this._domAudio.loop},set:function(t){this._domAudio.loop=t}},{key:"volume",get:function(){return this._domAudio.volume},set:function(t){t=tn(t),this._domAudio.volume=t}},{key:"duration",get:function(){return this._domAudio.duration}},{key:"currentTime",get:function(){return this._domAudio.currentTime}},{key:"sampleRate",get:function(){return 0}}]),t}(),v(_et.prototype,"seek",[met],Object.getOwnPropertyDescriptor(_et.prototype,"seek"),_et.prototype),v(_et.prototype,"play",[met],Object.getOwnPropertyDescriptor(_et.prototype,"play"),_et.prototype),v(_et.prototype,"pause",[met],Object.getOwnPropertyDescriptor(_et.prototype,"pause"),_et.prototype),v(_et.prototype,"stop",[met],Object.getOwnPropertyDescriptor(_et.prototype,"stop"),_et.prototype),_et),xet=function(){function t(t){this._nativeAudio=void 0,this._startTime=0,this._startOffset=0,this._isPaused=!0,this._nativeAudio=t}var e=t.prototype;return e.destroy=function(){this._nativeAudio=void 0},e._now=function(){return performance.now()/1e3},e._calculateCurrentTime=function(){var t=this._now()-this._startTime,e=this._startOffset+t;return e>=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}(),Tet=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}(),Aet=new Tet,Cet=window.AudioContext||window.webkitAudioContext||window.mozAudioContext,Det="on-context-running",Bet=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(Det)):t._isRunning=!1}}var e=t.prototype;return e.onceRunning=function(t,e){this._eventTarget.once(Det,t,e)},e.offRunning=function(t,e){this._eventTarget.off(Det,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}();Bet.support=!!Cet,Bet.support&&(vet=new Bet);var Iet,Met,Pet,Eet,Oet=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=vet.createBufferSource(t,!1);var n=vet.createGain(e);this._bufferSourceNode.connect(n),vet.connectContext(n)}var e=t.prototype;return e.play=function(){var t=this;this._bufferSourceNode.start(),vet.runContext().then((function(){null==t.onPlay||t.onPlay(),t._currentTimer=window.setTimeout((function(){Aet.tryReleasingCache(t._url),null==t.onEnd||t.onEnd()}),1e3*t._duration)})).catch((function(t){Y("play error",t)}))},e.stop=function(){clearTimeout(this._currentTimer),Aet.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}(),ket=(yet=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=aet.INIT,this._audioTimer=void 0,this._runningCallback=void 0,this._eventTarget=new Io,this._operationQueue=[],this._audioBuffer=t,this._audioTimer=new xet(t),this._gainNode=vet.createGain(),vet.connectContext(this._gainNode),this._src=e,XO.on(qO.EVENT_PAUSE,this._onInterruptedBegin,this),XO.on(qO.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),Aet.tryReleasingCache(this._src),XO.off(qO.EVENT_PAUSE,this._onInterruptedBegin,this),XO.off(qO.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=Aet.getCache(t);if(n)return Aet.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?vet.decodeAudioData(r.response).then((function(i){Aet.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 Oet(t,i,e);n(r)})).catch(r)}))},e.getPCMData=function(t){return new cet(this._audioBuffer.getChannelData(t),1)},e._onInterruptedBegin=function(){var t=this;this._state===aet.PLAYING&&this.pause().then((function(){t._state=aet.INTERRUPTED,t._eventTarget.emit(ret.INTERRUPTION_BEGIN)})).catch((function(t){Y("_onInterruptedBegin error",t)}))},e._onInterruptedEnd=function(){var t=this;this._state===aet.INTERRUPTED&&this.play().then((function(){t._eventTarget.emit(ret.INTERRUPTION_END)})).catch((function(t){Y("_onInterruptedEnd error",t)}))},e.offRunning=function(){this._runningCallback&&(vet.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===aet.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){vet.isRunning?(t._startSourceNode(),e()):(t.offRunning(),t._runningCallback=function(){t._startSourceNode(),e()},vet.onceRunning(t._runningCallback),vet.runContext().catch((function(t){Y("doPlay error",t)})))}))},e._startSourceNode=function(){var t=this;this._stopSourceNode(),this._sourceNode=vet.createBufferSource(this._audioBuffer,this.loop),this._sourceNode.connect(this._gainNode),this._sourceNode.loop=this._loop,this._sourceNode.start(0,this._audioTimer.currentTime),this._state=aet.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(ret.ENDED),t._state=aet.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===aet.PLAYING&&this._sourceNode?(this._audioTimer.pause(),this._state=aet.PAUSED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):Promise.resolve()},e.stop=function(){return this.offRunning(),this._sourceNode?(this._audioTimer.stop(),this._state=aet.STOPPED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):(this._audioTimer.stop(),this._state=aet.STOPPED,Promise.resolve())},e.onInterruptionBegin=function(t){this._eventTarget.on(ret.INTERRUPTION_BEGIN,t)},e.offInterruptionBegin=function(t){this._eventTarget.off(ret.INTERRUPTION_BEGIN,t)},e.onInterruptionEnd=function(t){this._eventTarget.on(ret.INTERRUPTION_END,t)},e.offInterruptionEnd=function(t){this._eventTarget.off(ret.INTERRUPTION_END,t)},e.onEnded=function(t){this._eventTarget.on(ret.ENDED,t)},e.offEnded=function(t){this._eventTarget.off(ret.ENDED,t)},n(t,[{key:"sampleRate",get:function(){return this._audioBuffer.sampleRate}},{key:"src",get:function(){return this._src}},{key:"type",get:function(){return set.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,vet.setGainValue(this._gainNode,t)}},{key:"duration",get:function(){return this._audioBuffer.duration}},{key:"currentTime",get:function(){return this._audioTimer.currentTime}}]),t}(),v(yet.prototype,"seek",[met],Object.getOwnPropertyDescriptor(yet.prototype,"seek"),yet.prototype),v(yet.prototype,"play",[met],Object.getOwnPropertyDescriptor(yet.prototype,"play"),yet.prototype),v(yet.prototype,"pause",[met],Object.getOwnPropertyDescriptor(yet.prototype,"pause"),yet.prototype),v(yet.prototype,"stop",[met],Object.getOwnPropertyDescriptor(yet.prototype,"stop"),yet.prototype),yet),Ret=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}(),Fet=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)!==set.DOM_AUDIO&&Bet.support?ket.load(e).then((function(e){n(new t(e))})).catch(r):(Bet.support||at(5201),wet.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)!==set.DOM_AUDIO&&Bet.support?ket.loadNative(t):(Bet.support||at(5201),wet.loadNative(t))},t.loadOneShotAudio=function(t,e,i){return new Promise((function(n,r){(null==i?void 0:i.audioLoadMode)!==set.DOM_AUDIO&&Bet.support?ket.loadOneShotAudio(t,e).then((function(t){n(new Ret(t))})).catch(r):(Bet.support||at(5201),wet.loadOneShotAudio(t,e).then((function(t){n(new Ret(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}();Fet.maxAudioChannel=24;var Let=t("aF",Kh("cc.AudioClip")((Eet=function(t){function e(e){var i;return(i=t.call(this,e)||this)._duration=Pet&&Pet(),i._loadMode=set.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&&Fet.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=set.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:aet.INIT}}]),e}(Cm),Eet.AudioType=set,Pet=zh((Met=Eet).prototype,"_duration",[uu],(function(){return 0})),v(Met.prototype,"_nativeDep",[Gu],Object.getOwnPropertyDescriptor(Met.prototype,"_nativeDep"),Met.prototype),Iet=Met))||Iet);function Vet(t,e,i){Fet.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 Net(t,e,i,n){var r=new Let;r._nativeUrl=t,r._nativeAsset=e,r.duration=e.duration,n(null,r)}A.AudioClip=Let,Mx.register({".mp3":Vet,".ogg":Vet,".wav":Vet,".m4a":Vet}),Hx.register({".mp3":Net,".ogg":Net,".wav":Net,".m4a":Net});var zet,Uet,Get,Het,Wet,jet,qet,Xet,Yet,Jet,Ket=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 Fet?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 Fet?this._tryRemovePlaying(this._audioPlayerInfoList,t):this._tryRemovePlaying(this._oneShotAudioInfoList,t)},e.discardOnePlayingIfNeeded=function(){var t;this._audioPlayerInfoList.length+this._oneShotAudioInfoList.length<Fet.maxAudioChannel||(this._oneShotAudioInfoList.length>0?this._oneShotAudioInfoList.forEach((function(e){(!t||e.playTime<t.playTime)&&(t=e)})):this._audioPlayerInfoList.forEach((function(e){(!t||e.playTime<t.playTime)&&(t=e)})),t&&(t.audio.stop(),this.removePlaying(t.audio)))},e.pause=function(){this._oneShotAudioInfoList.forEach((function(t){t.audio.stop()})),this._audioPlayerInfoList.forEach((function(t){t.audio.pause().catch((function(){}))}))},e.resume=function(){this._audioPlayerInfoList.forEach((function(t){t.audio.play().catch((function(){}))}))},t}()),Qet="audiosource-loaded",Zet=t("aE",(zet=Kh("cc.AudioSource"),Uet=Ou(Let),Get=Ou(Let),zet((Jet=function(t){function e(){var e;return(e=t.call(this)||this)._clip=jet&&jet(),e._player=null,e._hasRegisterListener=!1,e._loop=qet&&qet(),e._playOnAwake=Xet&&Xet(),e._volume=Yet&&Yet(),e._cachedCurrentTime=-1,e._operationsBeforeLoading=[],e._isLoaded=!1,e._lastSetClip=null,e}s(e,t);var i=e.prototype;return i._resetPlayer=function(){this._player&&(Ket.removePlaying(this._player),this._unregisterListener(),this._player.destroy(),this._player=null)},i._syncPlayer=function(){var t=this,e=this._clip;if(this._lastSetClip!==e)return e?void(e._nativeAsset?(this._isLoaded=!1,this._lastSetClip=e,this._operationsBeforeLoading.length=0,Fet.load(e._nativeAsset.url,{audioLoadMode:e.loadMode}).then((function(i){var n;t._lastSetClip===e?(t._isLoaded=!0,t._resetPlayer(),t._player=i,t._syncStates(),null==(n=t.node)||n.emit(Qet)):i.destroy()})).catch((function(){}))):console.error("Invalid audio clip")):(this._lastSetClip=null,void this._resetPlayer())},i._registerListener=function(){var t=this;if(!this._hasRegisterListener&&this._player){var e=this._player;e.onEnded((function(){var i;Ket.removePlaying(e),null==(i=t.node)||i.emit("ended",t)})),e.onInterruptionBegin((function(){Ket.removePlaying(e)})),e.onInterruptionEnd((function(){t._player===e&&Ket.addPlaying(e)})),this._hasRegisterListener=!0}},i._unregisterListener=function(){this._player&&this._hasRegisterListener&&(this._player.offEnded(),this._player.offInterruptionBegin(),this._player.offInterruptionEnd(),this._hasRegisterListener=!1)},i.onLoad=function(){this._syncPlayer()},i.onEnable=function(){this._playOnAwake&&!this.playing&&this.play()},i.onDisable=function(){var t=this._getRootNode();null!=t&&t._persistNode||this.pause()},i.onDestroy=function(){this.stop(),this.clip=null},i.getPCMData=function(t){var e=this;return new Promise((function(i){if(0!==t&&1!==t)return Y("Only support channel index 0 or 1 to get buffer"),void i(void 0);var n;e._player?i(e._player.getPCMData(t)):null==(n=e.node)||n.once(Qet,(function(){var n;i(null==(n=e._player)?void 0:n.getPCMData(t))}))}))},i.getSampleRate=function(){var t=this;return new Promise((function(e){var i;t._player?e(t._player.sampleRate):null==(i=t.node)||i.once(Qet,(function(){e(t._player.sampleRate)}))}))},i._getRootNode=function(){for(var t,e,i=this.node,n=null==(t=i)||null==(e=t.parent)?void 0:e.parent;n;){var r,s,a;n=null==(s=i=null==(r=i)?void 0:r.parent)||null==(a=s.parent)?void 0:a.parent}return i},i.play=function(){var t=this;if(this._isLoaded||!this.clip){var e;this._registerListener(),Ket.discardOnePlayingIfNeeded(),this.state===aet.PLAYING&&(null==(e=this._player)||e.stop().catch((function(){})));var i=this._player;i&&(i.play().then((function(){var e;null==(e=t.node)||e.emit("started",t)})).catch((function(){Ket.removePlaying(i)})),Ket.addPlaying(i))}else this._operationsBeforeLoading.push({op:"play",params:null})},i.pause=function(){var t;this._isLoaded||!this.clip?null==(t=this._player)||t.pause().catch((function(){})):this._operationsBeforeLoading.push({op:"pause",params:null})},i.stop=function(){this._isLoaded||!this.clip?this._player&&(this._player.stop().catch((function(){})),Ket.removePlaying(this._player)):this._operationsBeforeLoading.push({op:"stop",params:null})},i.playOneShot=function(t,e){var i;void 0===e&&(e=1),t._nativeAsset?Fet.loadOneShotAudio(t._nativeAsset.url,this._volume*e,{audioLoadMode:t.loadMode}).then((function(t){i=t,Ket.discardOnePlayingIfNeeded(),t.onEnd=function(){Ket.removePlaying(t)},t.play(),Ket.addPlaying(t)})).catch((function(){i&&Ket.removePlaying(i)})):console.error("Invalid audio clip")},i._syncStates=function(){var t=this;this._player&&(this._player.loop=this._loop,this._player.volume=this._volume,this._operationsBeforeLoading.forEach((function(e){var i;"seek"===e.op?(t._cachedCurrentTime=e.params&&e.params[0],t._player&&t._player.seek(t._cachedCurrentTime).catch((function(){}))):null==(i=t[e.op])||i.call(t)})),this._operationsBeforeLoading.length=0)},n(e,[{key:"clip",get:function(){return this._clip},set:function(t){t!==this._clip&&(this._clip=t,this._syncPlayer())}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t,this._player&&(this._player.loop=t)}},{key:"playOnAwake",get:function(){return this._playOnAwake},set:function(t){this._playOnAwake=t}},{key:"volume",get:function(){return this._volume},set:function(t){Number.isNaN(t)?Y("illegal audio volume!"):(t=$i(t,0,1),this._player?(this._player.volume=t,this._volume=this._player.volume):this._volume=t)}},{key:"currentTime",get:function(){return this._player?this._player.currentTime:this._cachedCurrentTime<0?0:this._cachedCurrentTime},set:function(t){var e;Number.isNaN(t)?Y("illegal audio time!"):(t=$i(t,0,this.duration),this._isLoaded||!this.clip?(this._cachedCurrentTime=t,null==(e=this._player)||e.seek(this._cachedCurrentTime).catch((function(){}))):this._operationsBeforeLoading.push({op:"seek",params:[t]}))}},{key:"duration",get:function(){var t,e;return null!==(t=null==(e=this._clip)?void 0:e.getDuration())&&void 0!==t?t:this._player?this._player.duration:0}},{key:"state",get:function(){return this._player?this._player.state:aet.INIT}},{key:"playing",get:function(){return this.state===e.AudioState.PLAYING}}],[{key:"maxAudioChannel",get:function(){return Fet.maxAudioChannel}}]),e}(yg),Jet.AudioState=aet,Jet.EventType={STARTED:"started",ENDED:"ended"},jet=zh((Wet=Jet).prototype,"_clip",[Uet],(function(){return null})),qet=zh(Wet.prototype,"_loop",[uu],(function(){return!1})),Xet=zh(Wet.prototype,"_playOnAwake",[uu],(function(){return!0})),Yet=zh(Wet.prototype,"_volume",[uu],(function(){return 1})),v(Wet.prototype,"clip",[Get],Object.getOwnPropertyDescriptor(Wet.prototype,"clip"),Wet.prototype),Het=Wet))||Het));pt(Let,"AudioClip",[{name:"PlayingState",newName:"AudioState",target:Zet,targetName:"AudioSource"}]),gt(Let.prototype,"AudioClip.prototype",["state","play","pause","stop","playOneShot","setCurrentTime","setVolume","setLoop","getCurrentTime","getVolume","getLoop"].map((function(t){return{name:t,suggest:"please use AudioSource.prototype."+t+" instead"}}))),A.AudioSourceComponent=Zet,le(Zet,"cc.AudioSourceComponent"),C.log=X,C.warn=Y,C.error=J,C.assert=K,C._throw=$,C.logID=it,C.warnID=at,C.errorID=ht,C.assertID=lt,C.debug=bt,C.path={join:Go,extname:Ho,mainFileName:Wo,basename:jo,dirname:qo,changeExtname:Xo,changeBasename:Yo,_normalize:Jo,stripSep:Ko,get sep(){return Qo()}};var $et,tit,eit=t("em",function(){function t(t){this._pool=[],this.poolHandlerComp=t}var e=t.prototype;return e.size=function(){return this._pool.length},e.clear=function(){for(var t=this._pool.length,e=0;e<t;++e)this._pool[e].destroy();this._pool.length=0},e.put=function(t){if(t&&-1===this._pool.indexOf(t)){t.removeFromParent();var e=this.poolHandlerComp?t.getComponent(this.poolHandlerComp):null;e&&e.unuse&&e.unuse(),this._pool.push(t)}},e.get=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var n=this._pool.length-1;if(n<0)return null;var r=this._pool[n];this._pool.length=n;var s=this.poolHandlerComp?r.getComponent(this.poolHandlerComp):null;return s&&s.reuse&&s.reuse(arguments),r},t}());C.NodePool=eit;var iit=null!==($et=globalThis.jsb)&&void 0!==$et?$et:{};t("eE",{DownloaderHints:iit.DownloaderHints,Downloader:iit.Downloader,zipUtils:iit.zipUtils,fileUtils:iit.fileUtils,DebugRenderer:iit.DebugRenderer,copyTextToClipboard:null==(tit=iit.copyTextToClipboard)?void 0:tit.bind(iit),garbageCollect:iit.garbageCollect,reflection:iit.reflection,bridge:iit.bridge,jsbBridgeWrapper:iit.jsbBridgeWrapper,AssetsManager:iit.AssetsManager,EventAssetsManager:iit.EventAssetsManager,Manifest:iit.Manifest,saveImageData:iit.saveImageData,process:iit.process,adpf:iit.adpf}),C.renderer=hN;var nit=Object.setPrototypeOf,rit={};!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;i<n.length;i++)n[i].returnToPool();this._objects.length=0}if(this._clock.advanceTime(e),this._events.length>0){for(var r=0;r<this._events.length;++r){var s=this._events[r],a=s.armature;null!==a._armatureData&&(a.eventDispatcher.dispatchDBEvent(s.type,s),s.type===t.EventObject.SOUND_EVENT&&this._eventManager.dispatchDBEvent(s.type,s)),this.bufferObject(s)}this._events.length=0}},e.prototype.bufferEvent=function(t){this._events.indexOf(t)<0&&this._events.push(t)},e.prototype.bufferObject=function(t){this._objects.indexOf(t)<0&&this._objects.push(t)},Object.defineProperty(e.prototype,"clock",{get:function(){return this._clock},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"eventManager",{get:function(){return this._eventManager},enumerable:!0,configurable:!0}),e.VERSION="5.6.300",e.yDown=!1,e.debug=!1,e.debugDraw=!1,e.webAssembly=!1,e}();t.DragonBones=e}(rit),console.warn||(console.warn=function(){}),console.assert||(console.assert=function(){}),Date.now||(Date.now=function(){return(new Date).getTime()}),nit=function(t,e){function i(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);i.prototype=e.prototype,t.prototype=new i},function(t){var e=function(){function t(){this.hashCode=t._hashCode++,this._isInPool=!1}return t._returnObject=function(e){var i=String(e.constructor),n=i in t._maxCountMap?t._maxCountMap[i]:t._defaultMaxCount,r=t._poolsMap[i]=t._poolsMap[i]||[];r.length<n&&(e._isInPool?console.warn("The object is already in the pool."):(e._isInPool=!0,r.push(e)))},t.toString=function(){throw new Error},t.setMaxCount=function(e,i){if((i<0||i!=i)&&(i=0),null!==e)null!==(r=(n=String(e))in t._poolsMap?t._poolsMap[n]:null)&&r.length>i&&(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}(rit),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,_=n*h+s*u+o,d=i*l+r*u+a,p=n*l+s*u+o,m=i*l+r*c+a,g=n*l+s*c+o,y=i*h+r*c+a,v=n*h+s*c+o,b=0;f>d&&(b=f,f=d,d=b),m>y&&(b=m,m=y,y=b),t.x=Math.floor(f<m?f:m),t.width=Math.ceil((d>y?d:y)-t.x),_>p&&(b=_,_=p,p=b),g>v&&(b=g,g=v,v=b),t.y=Math.floor(_<g?_:g),t.height=Math.ceil((p>v?p:v)-t.y)},t}();t.Matrix=e}(rit),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?e.a/Math.cos(this.rotation):e.b/Math.sin(this.rotation),this.scaleY=s>-r&&s<r?e.d/Math.cos(s):-e.c/Math.sin(s),i>=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}(rit),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}(rit),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}(rit),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}(rit),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 nit(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<this.ints.length?this.ints[t]:0},e.prototype.getFloat=function(t){return void 0===t&&(t=0),t>=0&&t<this.floats.length?this.floats[t]:0},e.prototype.getString=function(t){return void 0===t&&(t=0),t>=0&&t<this.strings.length?this.strings[t]:""},e}(t.BaseObject);t.UserData=e;var i=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.data=null,e}return nit(e,t),e.toString=function(){return"[class dragonBones.ActionData]"},e.prototype._onClear=function(){null!==this.data&&this.data.returnToPool(),this.type=0,this.name="",this.bone=null,this.slot=null,this.data=null},e}(t.BaseObject);t.ActionData=i}(rit),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.frameIndices=[],e.cachedFrames=[],e.armatureNames=[],e.armatures={},e.userData=null,e}return nit(e,t),e.toString=function(){return"[class dragonBones.DragonBonesData]"},e.prototype._onClear=function(){for(var t in this.armatures)this.armatures[t].returnToPool(),delete this.armatures[t];null!==this.userData&&this.userData.returnToPool(),this.autoSearch=!1,this.frameRate=0,this.version="",this.name="",this.stage=null,this.frameIndices.length=0,this.cachedFrames.length=0,this.armatureNames.length=0,this.binary=null,this.intArray=null,this.floatArray=null,this.frameIntArray=null,this.frameFloatArray=null,this.frameArray=null,this.timelineArray=null,this.userData=null},e.prototype.addArmature=function(t){t.name in this.armatures?console.warn("Same armature: "+t.name):(t.parent=this,this.armatures[t.name]=t,this.armatureNames.push(t.name))},e.prototype.getArmature=function(t){return t in this.armatures?this.armatures[t]:null},e.prototype.dispose=function(){console.warn("已废弃"),this.returnToPool()},e}(t.BaseObject);t.DragonBonesData=e}(rit),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.aabb=new t.Rectangle,i.animationNames=[],i.sortedBones=[],i.sortedSlots=[],i.defaultActions=[],i.actions=[],i.bones={},i.slots={},i.constraints={},i.skins={},i.animations={},i.canvas=null,i.userData=null,i}return nit(i,e),i.toString=function(){return"[class dragonBones.ArmatureData]"},i.prototype._onClear=function(){for(var t=0,e=this.defaultActions;t<e.length;t++)e[t].returnToPool();for(var i=0,n=this.actions;i<n.length;i++)n[i].returnToPool();for(var r in this.bones)this.bones[r].returnToPool(),delete this.bones[r];for(var r in this.slots)this.slots[r].returnToPool(),delete this.slots[r];for(var r in this.constraints)this.constraints[r].returnToPool(),delete this.constraints[r];for(var r in this.skins)this.skins[r].returnToPool(),delete this.skins[r];for(var r in this.animations)this.animations[r].returnToPool(),delete this.animations[r];null!==this.canvas&&this.canvas.returnToPool(),null!==this.userData&&this.userData.returnToPool(),this.type=0,this.frameRate=0,this.cacheFrameRate=0,this.scale=1,this.name="",this.aabb.clear(),this.animationNames.length=0,this.sortedBones.length=0,this.sortedSlots.length=0,this.defaultActions.length=0,this.actions.length=0,this.defaultSkin=null,this.defaultAnimation=null,this.canvas=null,this.userData=null,this.parent=null},i.prototype.sortBones=function(){var t=this.sortedBones.length;if(!(t<=0)){var e=this.sortedBones.concat(),i=0,n=0;for(this.sortedBones.length=0;n<t;){var r=e[i++];if(i>=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 nit(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 nit(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 nit(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}(rit),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return nit(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 nit(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 nit(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}(rit),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return nit(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}(rit),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.displays={},e}return nit(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];e<i.length;e++){var n=i[e];null!==n&&n.returnToPool()}delete this.displays[t]}this.name="",this.parent=null},e.prototype.addDisplay=function(t,e){t in this.displays||(this.displays[t]=[]),null!==e&&(e.parent=this),this.displays[t].push(e)},e.prototype.getDisplay=function(t,e){var i=this.getDisplays(t);if(null!==i)for(var n=0,r=i;n<r.length;n++){var s=r[n];if(null!==s&&s.name===e)return s}return null},e.prototype.getDisplays=function(t){return t in this.displays?this.displays[t]:null},e}(t.BaseObject);t.SkinData=e}(rit),function(t){var e=function(){function t(){this.weight=null}return t.prototype.clear=function(){this.isShared||null===this.weight||this.weight.returnToPool(),this.isShared=!1,this.inheritDeform=!1,this.offset=0,this.data=null,this.weight=null},t.prototype.shareFrom=function(t){this.isShared=!0,this.offset=t.offset,this.weight=t.weight},t}();t.VerticesData=e;var i=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.transform=new t.Transform,i}return nit(i,e),i.prototype._onClear=function(){this.name="",this.path="",this.transform.identity(),this.parent=null},i}(t.BaseObject);t.DisplayData=i;var n=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.pivot=new t.Point,i}return nit(i,e),i.toString=function(){return"[class dragonBones.ImageDisplayData]"},i.prototype._onClear=function(){e.prototype._onClear.call(this),this.type=0,this.pivot.clear(),this.texture=null},i}(i);t.ImageDisplayData=n;var r=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.actions=[],e}return nit(e,t),e.toString=function(){return"[class dragonBones.ArmatureDisplayData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this);for(var e=0,i=this.actions;e<i.length;e++)i[e].returnToPool();this.type=1,this.inheritAnimation=!1,this.actions.length=0,this.armature=null},e.prototype.addAction=function(t){this.actions.push(t)},e}(i);t.ArmatureDisplayData=r;var s=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.vertices=new e,i}return nit(i,t),i.toString=function(){return"[class dragonBones.MeshDisplayData]"},i.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=2,this.vertices.clear(),this.texture=null},i}(i);t.MeshDisplayData=s;var a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.boundingBox=null,e}return nit(e,t),e.toString=function(){return"[class dragonBones.BoundingBoxDisplayData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),null!==this.boundingBox&&this.boundingBox.returnToPool(),this.type=3,this.boundingBox=null},e}(i);t.BoundingBoxDisplayData=a;var o=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.vertices=new e,i.curveLengths=[],i}return nit(i,t),i.toString=function(){return"[class dragonBones.PathDisplayData]"},i.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=4,this.closed=!1,this.constantSpeed=!1,this.vertices.clear(),this.curveLengths.length=0},i}(i);t.PathDisplayData=o;var h=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.bones=[],e}return nit(e,t),e.toString=function(){return"[class dragonBones.WeightData]"},e.prototype._onClear=function(){this.count=0,this.offset=0,this.bones.length=0},e.prototype.addBone=function(t){this.bones.push(t)},e}(t.BaseObject);t.WeightData=h}(rit),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return nit(e,t),e.prototype._onClear=function(){this.color=0,this.width=0,this.height=0},e}(t.BaseObject);t.BoundingBoxData=e;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return nit(e,t),e.toString=function(){return"[class dragonBones.RectangleBoundingBoxData]"},e._computeOutCode=function(t,e,i,n,r,s){var a=0;return t<i?a|=1:t>r&&(a|=2),e<n?a|=4:e>s&&(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&&t<o&&i>a&&i<h,_=n>s&&n<o&&r>a&&r<h;if(f&&_)return-1;for(var d=0,p=e._computeOutCode(t,i,s,a,o,h),m=e._computeOutCode(n,r,s,a,o,h);;){if(!(p|m)){d=2;break}if(p&m)break;var g=0,y=0,v=0,b=0!==p?p:m;4&b?(g=t+(n-t)*(a-i)/(r-i),y=a,null!==c&&(v=.5*-Math.PI)):8&b?(g=t+(n-t)*(h-i)/(r-i),y=h,null!==c&&(v=.5*Math.PI)):2&b?(y=i+(r-i)*(o-t)/(n-t),g=o,null!==c&&(v=0)):1&b&&(y=i+(r-i)*(s-t)/(n-t),g=s,null!==c&&(v=Math.PI)),b===p?(t=g,i=y,p=e._computeOutCode(t,i,s,a,o,h),null!==c&&(c.x=v)):(n=g,r=y,m=e._computeOutCode(n,r,s,a,o,h),null!==c&&(c.y=v))}return d&&(f?(d=2,null!==u&&(u.x=n,u.y=r),null!==l&&(l.x=n,l.y=n),null!==c&&(c.x=c.y+Math.PI)):_?(d=1,null!==u&&(u.x=t,u.y=i),null!==l&&(l.x=t,l.y=i),null!==c&&(c.y=c.x+Math.PI)):(d=3,null!==u&&(u.x=t,u.y=i),null!==l&&(l.x=n,l.y=r))),d},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=0},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!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 nit(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,_=i-t,d=(n*=c)-(e*=c),p=Math.sqrt(_*_+d*d),m=_/p,g=d/p,y=(r-t)*m+(s-e)*g,v=a*a,b=v-(t*t+e*e)+y*y,S=0;if(b>=0){var w=Math.sqrt(b),x=y-w,T=y+w,A=x<0?-1:x<=p?0:1,C=T<0?-1:T<=p?0:1,D=A*C;if(D<0)return-1;0===D&&(-1===A?(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/v*f,i/v),l.y=l.x+Math.PI)):1===C?(S=1,t+=x*m,e=(e+x*g)/c,null!==h&&(h.x=t,h.y=e),null!==u&&(u.x=t,u.y=e),null!==l&&(l.x=Math.atan2(e/v*f,t/v),l.y=l.x+Math.PI)):(S=3,null!==h&&(h.x=t+x*m,h.y=(e+x*g)/c,null!==l&&(l.x=Math.atan2(h.y/v*f,h.x/v))),null!==u&&(u.x=t+T*m,u.y=(e+T*g)/c,null!==l&&(l.y=Math.atan2(u.y/v*f,u.x/v)))))}return S},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=1},e.prototype.containsPoint=function(t,e){var i=.5*this.width;if(t>=-i&&t<=i){var n=.5*this.height;if(e>=-n&&e<=n)return e*=i/n,Math.sqrt(t*t+e*e)<=i}return!1},e.prototype.intersectsSegment=function(t,i,n,r,s,a,o){return void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null),e.ellipseIntersectsSegment(t,i,n,r,0,0,.5*this.width,.5*this.height,s,a,o)},e}(e);t.EllipseBoundingBoxData=n;var r=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.vertices=[],e}return nit(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,_=r[h-2],d=r[h-1],p=0,m=0,g=0,y=0,v=0,b=0,S=0;S<h;S+=2){var w=r[S],x=r[S+1];_===w&&(_=w+1e-4),d===x&&(d=x+1e-4);var T=_-w,A=d-x,C=_*x-d*w,D=u*A-l*T,B=(c*T-u*C)/D;if((B>=_&&B<=w||B>=w&&B<=_)&&(0===u||B>=t&&B<=i||B>=i&&B<=t)){var I=(c*A-l*C)/D;if((I>=d&&I<=x||I>=x&&I<=d)&&(0===l||I>=e&&I<=n||I>=n&&I<=e)){if(null===a){g=B,y=I,v=B,b=I,f++,null!==o&&(o.x=Math.atan2(x-d,w-_)-.5*Math.PI,o.y=o.x);break}var M=B-t;M<0&&(M=-M),0===f?(p=M,m=M,g=B,y=I,v=B,b=I,null!==o&&(o.x=Math.atan2(x-d,w-_)-.5*Math.PI,o.y=o.x)):(M<p&&(p=M,g=B,y=I,null!==o&&(o.x=Math.atan2(x-d,w-_)-.5*Math.PI)),M>m&&(m=M,v=B,b=I,null!==o&&(o.y=Math.atan2(x-d,w-_)-.5*Math.PI))),f++}}_=w,d=x}return 1===f?(null!==s&&(s.x=g,s.y=y),null!==a&&(a.x=g,a.y=y),null!==o&&(o.y=o.x+Math.PI)):f>1&&(f++,null!==s&&(s.x=g,s.y=y),null!==a&&(a.x=v,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<r;n+=2){var a=this.vertices[s+1],o=this.vertices[n+1];if(o<e&&a>=e||a<e&&o>=e){var h=this.vertices[s],u=this.vertices[n];(e-o)*(h-u)/(a-o)+u<t&&(i=!i)}s=n}return i},e.prototype.intersectsSegment=function(t,n,r,s,a,o,h){void 0===a&&(a=null),void 0===o&&(o=null),void 0===h&&(h=null);var u=0;return 0!==i.rectangleIntersectsSegment(t,n,r,s,this.x,this.y,this.x+this.width,this.y+this.height,null,null,null)&&(u=e.polygonIntersectsSegment(t,n,r,s,this.vertices,a,o,h)),u},e}(e);t.PolygonBoundingBoxData=r}(rit),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.cachedFrames=[],e.boneTimelines={},e.surfaceTimelines={},e.slotTimelines={},e.constraintTimelines={},e.animationTimelines={},e.boneCachedFrameIndices={},e.slotCachedFrameIndices={},e.actionTimeline=null,e.zOrderTimeline=null,e}return nit(e,t),e.toString=function(){return"[class dragonBones.AnimationData]"},e.prototype._onClear=function(){for(var t in this.boneTimelines){for(var e=0,i=this.boneTimelines[t];e<i.length;e++)i[e].returnToPool();delete this.boneTimelines[t]}for(var t in this.surfaceTimelines){for(var n=0,r=this.surfaceTimelines[t];n<r.length;n++)r[n].returnToPool();delete this.surfaceTimelines[t]}for(var t in this.slotTimelines){for(var s=0,a=this.slotTimelines[t];s<a.length;s++)a[s].returnToPool();delete this.slotTimelines[t]}for(var t in this.constraintTimelines){for(var o=0,h=this.constraintTimelines[t];o<h.length;o++)h[o].returnToPool();delete this.constraintTimelines[t]}for(var t in this.animationTimelines){for(var u=0,l=this.animationTimelines[t];u<l.length;u++)l[u].returnToPool();delete this.animationTimelines[t]}for(var t in this.boneCachedFrameIndices)delete this.boneCachedFrameIndices[t];for(var t in this.slotCachedFrameIndices)delete this.slotCachedFrameIndices[t];null!==this.actionTimeline&&this.actionTimeline.returnToPool(),null!==this.zOrderTimeline&&this.zOrderTimeline.returnToPool(),this.frameIntOffset=0,this.frameFloatOffset=0,this.frameOffset=0,this.frameCount=0,this.playTimes=0,this.duration=0,this.scale=1,this.fadeInTime=0,this.cacheFrameRate=0,this.name="",this.cachedFrames.length=0,this.actionTimeline=null,this.zOrderTimeline=null,this.parent=null},e.prototype.cacheFrames=function(t){if(!(this.cacheFrameRate>0)){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<n;++i)this.cachedFrames[i]=!1;for(var r=0,s=this.parent.sortedBones;r<s.length;r++){var a=s[r];for(i=0,n=(u=new Array(e)).length;i<n;++i)u[i]=-1;this.boneCachedFrameIndices[a.name]=u}for(var o=0,h=this.parent.sortedSlots;o<h.length;o++){var u,l=h[o];for(i=0,n=(u=new Array(e)).length;i<n;++i)u[i]=-1;this.slotCachedFrameIndices[l.name]=u}}},e.prototype.addBoneTimeline=function(t,e){var i=t.name in this.boneTimelines?this.boneTimelines[t.name]:this.boneTimelines[t.name]=[];i.indexOf(e)<0&&i.push(e)},e.prototype.addSurfaceTimeline=function(t,e){var i=t.name in this.surfaceTimelines?this.surfaceTimelines[t.name]:this.surfaceTimelines[t.name]=[];i.indexOf(e)<0&&i.push(e)},e.prototype.addSlotTimeline=function(t,e){var i=t.name in this.slotTimelines?this.slotTimelines[t.name]:this.slotTimelines[t.name]=[];i.indexOf(e)<0&&i.push(e)},e.prototype.addConstraintTimeline=function(t,e){var i=t.name in this.constraintTimelines?this.constraintTimelines[t.name]:this.constraintTimelines[t.name]=[];i.indexOf(e)<0&&i.push(e)},e.prototype.addAnimationTimeline=function(t,e){var i=t in this.animationTimelines?this.animationTimelines[t]:this.animationTimelines[t]=[];i.indexOf(e)<0&&i.push(e)},e.prototype.getBoneTimelines=function(t){return t in this.boneTimelines?this.boneTimelines[t]:null},e.prototype.getSurfaceTimelines=function(t){return t in this.surfaceTimelines?this.surfaceTimelines[t]:null},e.prototype.getSlotTimelines=function(t){return t in this.slotTimelines?this.slotTimelines[t]:null},e.prototype.getConstraintTimelines=function(t){return t in this.constraintTimelines?this.constraintTimelines[t]:null},e.prototype.getAnimationTimelines=function(t){return t in this.animationTimelines?this.animationTimelines[t]:null},e.prototype.getBoneCachedFrameIndices=function(t){return t in this.boneCachedFrameIndices?this.boneCachedFrameIndices[t]:null},e.prototype.getSlotCachedFrameIndices=function(t){return t in this.slotCachedFrameIndices?this.slotCachedFrameIndices[t]:null},e}(t.BaseObject);t.AnimationData=e;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return nit(e,t),e.toString=function(){return"[class dragonBones.TimelineData]"},e.prototype._onClear=function(){this.type=10,this.offset=0,this.frameIndicesOffset=-1},e}(t.BaseObject);t.TimelineData=i}(rit),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.boneMask=[],e}return nit(e,t),e.toString=function(){return"[class dragonBones.AnimationConfig]"},e.prototype._onClear=function(){this.pauseFadeOut=!0,this.fadeOutMode=4,this.fadeOutTweenType=1,this.fadeOutTime=-1,this.actionEnabled=!0,this.additiveBlending=!1,this.displayControl=!0,this.pauseFadeIn=!0,this.resetToPose=!0,this.fadeInTweenType=1,this.playTimes=-1,this.layer=0,this.position=0,this.duration=-1,this.timeScale=-100,this.weight=1,this.fadeInTime=-1,this.autoFadeOutTime=-1,this.name="",this.animation="",this.group="",this.boneMask.length=0},e.prototype.clear=function(){this._onClear()},e.prototype.copyFrom=function(t){this.pauseFadeOut=t.pauseFadeOut,this.fadeOutMode=t.fadeOutMode,this.autoFadeOutTime=t.autoFadeOutTime,this.fadeOutTweenType=t.fadeOutTweenType,this.actionEnabled=t.actionEnabled,this.additiveBlending=t.additiveBlending,this.displayControl=t.displayControl,this.pauseFadeIn=t.pauseFadeIn,this.resetToPose=t.resetToPose,this.playTimes=t.playTimes,this.layer=t.layer,this.position=t.position,this.duration=t.duration,this.timeScale=t.timeScale,this.fadeInTime=t.fadeInTime,this.fadeOutTime=t.fadeOutTime,this.fadeInTweenType=t.fadeInTweenType,this.weight=t.weight,this.name=t.name,this.animation=t.animation,this.group=t.group,this.boneMask.length=t.boneMask.length;for(var e=0,i=this.boneMask.length;e<i;++e)this.boneMask[e]=t.boneMask[e]},e.prototype.containsBoneMask=function(t){return 0===this.boneMask.length||this.boneMask.indexOf(t)>=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<s.length;r++){var a=s[r];this.boneMask.indexOf(a.name)<0&&n.contains(a)&&this.boneMask.push(a.name)}},e.prototype.removeBoneMask=function(t,e,i){void 0===i&&(i=!0);var n=this.boneMask.indexOf(e);if(n>=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<a.length;s++){var o=a[s],h=this.boneMask.indexOf(o.name);h>=0&&r.contains(o)&&this.boneMask.splice(h,1)}else for(var u=0,l=t.getBones();u<l.length;u++)(o=l[u])!==r&&(r.contains(o)||this.boneMask.push(o.name))}},e}(t.BaseObject);t.AnimationConfig=e}(rit),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.textures={},e}return nit(e,t),e.prototype._onClear=function(){for(var t in this.textures)this.textures[t].returnToPool(),delete this.textures[t];this.autoSearch=!1,this.width=0,this.height=0,this.scale=1,this.name="",this.imagePath=""},e.prototype.copyFrom=function(t){for(var e in this.autoSearch=t.autoSearch,this.scale=t.scale,this.width=t.width,this.height=t.height,this.name=t.name,this.imagePath=t.imagePath,this.textures)this.textures[e].returnToPool(),delete this.textures[e];for(var e in t.textures){var i=this.createTexture();i.copyFrom(t.textures[e]),this.textures[e]=i}},e.prototype.addTexture=function(t){t.name in this.textures?console.warn("Same texture: "+t.name):(t.parent=this,this.textures[t.name]=t)},e.prototype.getTexture=function(t){return t in this.textures?this.textures[t]:null},e}(t.BaseObject);t.TextureAtlasData=e;var i=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.region=new t.Rectangle,i.frame=null,i}return nit(i,e),i.createRectangle=function(){return new t.Rectangle},i.prototype._onClear=function(){this.rotated=!1,this.name="",this.region.clear(),this.parent=null,this.frame=null},i.prototype.copyFrom=function(t){this.rotated=t.rotated,this.name=t.name,this.region.copyFrom(t.region),this.parent=t.parent,null===this.frame&&null!==t.frame?this.frame=i.createRectangle():null!==this.frame&&null===t.frame&&(this.frame=null),null!==this.frame&&null!==t.frame&&this.frame.copyFrom(t.frame)},i}(t.BaseObject);t.TextureData=i}(rit),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.vertices=[],e.bones=[],e}return nit(e,t),e.toString=function(){return"[class dragonBones.DeformVertices]"},e.prototype._onClear=function(){this.verticesDirty=!1,this.vertices.length=0,this.bones.length=0,this.verticesData=null},e.prototype.init=function(t,e){if(this.verticesData=t,null!==this.verticesData){var i;i=null!==this.verticesData.weight?2*this.verticesData.weight.count:2*this.verticesData.data.intArray[this.verticesData.offset+0],this.verticesDirty=!0,this.vertices.length=i,this.bones.length=0;for(var n=0,r=this.vertices.length;n<r;++n)this.vertices[n]=0;if(null!==this.verticesData.weight)for(n=0,r=this.verticesData.weight.bones.length;n<r;++n){var s=e.getBone(this.verticesData.weight.bones[n].name);this.bones.push(s)}}else this.verticesDirty=!1,this.vertices.length=0,this.bones.length=0,this.verticesData=null},e.prototype.isBonesUpdate=function(){for(var t=0,e=this.bones;t<e.length;t++){var i=e[t];if(null!==i&&i._childrenTransformDirty)return!0}return!1},e}(t.BaseObject);t.DeformVertices=e}(rit),function(t){var e=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t._bones=[],t._slots=[],t._constraints=[],t._actions=[],t._animation=null,t._proxy=null,t._replaceTextureAtlasData=null,t._clock=null,t}return nit(i,e),i.toString=function(){return"[class dragonBones.Armature]"},i._onSortSlots=function(t,e){return t._zOrder>e._zOrder?1:-1},i.prototype._onClear=function(){null!==this._clock&&this._clock.remove(this);for(var t=0,e=this._bones;t<e.length;t++)e[t].returnToPool();for(var i=0,n=this._slots;i<n.length;i++)n[i].returnToPool();for(var r=0,s=this._constraints;r<s.length;r++)s[r].returnToPool();for(var a=0,o=this._actions;a<o.length;a++)o[a].returnToPool();null!==this._animation&&this._animation.returnToPool(),null!==this._proxy&&this._proxy.dbClear(),null!==this._replaceTextureAtlasData&&this._replaceTextureAtlasData.returnToPool(),this.inheritAnimation=!0,this.userData=null,this._lockUpdate=!1,this._slotsDirty=!0,this._zOrderDirty=!1,this._flipX=!1,this._flipY=!1,this._cacheFrameIndex=-1,this._bones.length=0,this._slots.length=0,this._constraints.length=0,this._actions.length=0,this._armatureData=null,this._animation=null,this._proxy=null,this._display=null,this._replaceTextureAtlasData=null,this._replacedTexture=null,this._dragonBones=null,this._clock=null,this._parent=null},i.prototype._sortZOrder=function(t,e){var i=this._armatureData.sortedSlots,n=null===t;if(this._zOrderDirty||!n){for(var r=0,s=i.length;r<s;++r){var a=n?r:t[e+r];if(!(a<0||a>=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;n<r;++n)this._bones[n].update(this._cacheFrameIndex);for(n=0,r=this._slots.length;n<r;++n)this._slots[n].update(this._cacheFrameIndex)}if(this._actions.length>0){this._lockUpdate=!0;for(var s=0,a=this._actions;s<a.length;s++){var o=a[s],h=o.actionData;if(null!==h&&0===h.type)if(null!==o.slot)null!==(c=o.slot.childArmature)&&c.animation.fadeIn(h.name);else if(null!==o.bone)for(var u=0,l=this.getSlots();u<l.length;u++){var c,f=l[u];f.parent===o.bone&&null!==(c=f.childArmature)&&c.animation.fadeIn(h.name)}else this._animation.fadeIn(h.name);o.returnToPool()}this._actions.length=0,this._lockUpdate=!1}this._proxy.dbUpdate()}else console.warn("The armature data has been disposed.\nPlease make sure dispose armature before call factory.clear().");else console.warn("The armature has been disposed.")},i.prototype.invalidUpdate=function(t,e){if(void 0===t&&(t=null),void 0===e&&(e=!1),null!==t&&t.length>0){if(null!==(a=this.getBone(t))&&(a.invalidUpdate(),e))for(var i=0,n=this._slots;i<n.length;i++)(u=n[i]).parent===a&&u.invalidUpdate()}else{for(var r=0,s=this._bones;r<s.length;r++){var a;(a=s[r]).invalidUpdate()}if(e)for(var o=0,h=this._slots;o<h.length;o++){var u;(u=h[o]).invalidUpdate()}}},i.prototype.containsPoint=function(t,e){for(var i=0,n=this._slots;i<n.length;i++){var r=n[i];if(r.containsPoint(t,e))return r}return null},i.prototype.intersectsSegment=function(t,e,i,n,r,s,a){void 0===r&&(r=null),void 0===s&&(s=null),void 0===a&&(a=null);for(var o=t===i,h=0,u=0,l=0,c=0,f=0,_=0,d=0,p=0,m=null,g=null,y=0,v=this._slots;y<v.length;y++){var b=v[y];if(b.intersectsSegment(t,e,i,n,r,s,a)>0){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||S<h)&&(h=S,l=r.x,c=r.y,m=b,a&&(d=a.x))),null!==s&&((S=s.x-t)<0&&(S=-S),(null===g||S>u)&&(u=S,f=s.x,_=s.y,g=b,null!==a&&(p=a.y)))}}return null!==m&&null!==r&&(r.x=l,r.y=c,null!==a&&(a.x=d)),null!==g&&null!==s&&(s.x=f,s.y=_,null!==a&&(a.y=p)),m},i.prototype.getBone=function(t){for(var e=0,i=this._bones;e<i.length;e++){var n=i[e];if(n.name===t)return n}return null},i.prototype.getBoneByDisplay=function(t){var e=this.getSlotByDisplay(t);return null!==e?e.parent:null},i.prototype.getSlot=function(t){for(var e=0,i=this._slots;e<i.length;e++){var n=i[e];if(n.name===t)return n}return null},i.prototype.getSlotByDisplay=function(t){if(null!==t)for(var e=0,i=this._slots;e<i.length;e++){var n=i[e];if(n.display===t)return n}return null},i.prototype.getBones=function(){return this._bones},i.prototype.getSlots=function(){return this._slots},Object.defineProperty(i.prototype,"flipX",{get:function(){return this._flipX},set:function(t){this._flipX!==t&&(this._flipX=t,this.invalidUpdate())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"flipY",{get:function(){return this._flipY},set:function(t){this._flipY!==t&&(this._flipY=t,this.invalidUpdate())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"cacheFrameRate",{get:function(){return this._armatureData.cacheFrameRate},set:function(t){if(this._armatureData.cacheFrameRate!==t){this._armatureData.cacheFrames(t);for(var e=0,i=this._slots;e<i.length;e++){var n=i[e].childArmature;null!==n&&(n.cacheFrameRate=t)}}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"name",{get:function(){return this._armatureData.name},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"armatureData",{get:function(){return this._armatureData},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animation",{get:function(){return this._animation},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"proxy",{get:function(){return this._proxy},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"eventDispatcher",{get:function(){return this._proxy},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"display",{get:function(){return this._display},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"replacedTexture",{get:function(){return this._replacedTexture},set:function(t){if(this._replacedTexture!==t){null!==this._replaceTextureAtlasData&&(this._replaceTextureAtlasData.returnToPool(),this._replaceTextureAtlasData=null),this._replacedTexture=t;for(var e=0,i=this._slots;e<i.length;e++){var n=i[e];n.invalidUpdate(),n.update(-1)}}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"clock",{get:function(){return this._clock},set:function(t){if(this._clock!==t){null!==this._clock&&this._clock.remove(this),this._clock=t,this._clock&&this._clock.add(this);for(var e=0,i=this._slots;e<i.length;e++){var n=i[e].childArmature;null!==n&&(n.clock=this._clock)}}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),i.prototype.replaceTexture=function(t){this.replacedTexture=t},i.prototype.hasEventListener=function(t){return this._proxy.hasDBEventListener(t)},i.prototype.addEventListener=function(t,e,i){this._proxy.addDBEventListener(t,e,i)},i.prototype.removeEventListener=function(t,e,i){this._proxy.removeDBEventListener(t,e,i)},i.prototype.enableAnimationCache=function(t){console.warn("Deprecated."),this.cacheFrameRate=t},i.prototype.getDisplay=function(){return this._display},i}(t.BaseObject);t.Armature=e}(rit),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.globalTransformMatrix=new t.Matrix,i.global=new t.Transform,i.offset=new t.Transform,i}return nit(i,e),i.prototype._onClear=function(){this.globalTransformMatrix.identity(),this.global.identity(),this.offset.identity(),this.origin=null,this.userData=null,this._globalDirty=!1,this._armature=null},i.prototype.updateGlobalTransform=function(){this._globalDirty&&(this._globalDirty=!1,this.global.fromMatrix(this.globalTransformMatrix))},Object.defineProperty(i.prototype,"armature",{get:function(){return this._armature},enumerable:!0,configurable:!0}),i._helpMatrix=new t.Matrix,i._helpTransform=new t.Transform,i._helpPoint=new t.Point,i}(t.BaseObject);t.TransformObject=e}(rit),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.animationPose=new t.Transform,i._blendState=new t.BlendState,i}return nit(i,e),i.toString=function(){return"[class dragonBones.Bone]"},i.prototype._onClear=function(){e.prototype._onClear.call(this),this.offsetMode=1,this.animationPose.identity(),this._transformDirty=!1,this._childrenTransformDirty=!1,this._localDirty=!0,this._hasConstraint=!1,this._visible=!0,this._cachedFrameIndex=-1,this._blendState.clear(),this._boneData=null,this._parent=null,this._cachedFrameIndices=null},i.prototype._updateGlobalTransformMatrix=function(e){var i=this._boneData,n=this.global,r=this.globalTransformMatrix,s=this.origin,a=this.offset,o=this.animationPose,h=this._parent,u=this._armature.flipX,l=this._armature.flipY===t.DragonBones.yDown,c=null!==h,f=0;if(1===this.offsetMode?null!==s?(n.x=s.x+a.x+o.x,n.scaleX=s.scaleX*a.scaleX*o.scaleX,n.scaleY=s.scaleY*a.scaleY*o.scaleY,t.DragonBones.yDown?(n.y=s.y+a.y+o.y,n.skew=s.skew+a.skew+o.skew,n.rotation=s.rotation+a.rotation+o.rotation):(n.y=s.y-a.y+o.y,n.skew=s.skew-a.skew+o.skew,n.rotation=s.rotation-a.rotation+o.rotation)):(n.copyFrom(a),t.DragonBones.yDown||(n.y=-n.y,n.skew=-n.skew,n.rotation=-n.rotation),n.add(o)):0===this.offsetMode?null!==s?n.copyFrom(s).add(o):n.copyFrom(o):(c=!1,n.copyFrom(a),t.DragonBones.yDown||(n.y=-n.y,n.skew=-n.skew,n.rotation=-n.rotation)),c){var _=0===h._boneData.type?h.globalTransformMatrix:h._getGlobalTransformMatrix(n.x,n.y);if(i.inheritScale)i.inheritRotation||(h.updateGlobalTransform(),f=u&&l?n.rotation-(h.global.rotation+Math.PI):u?n.rotation+h.global.rotation+Math.PI:l?n.rotation+h.global.rotation:n.rotation-h.global.rotation,n.rotation=f),n.toMatrix(r),r.concat(_),i.inheritTranslation?(n.x=r.tx,n.y=r.ty):(r.tx=n.x,r.ty=n.y),e?n.fromMatrix(r):this._globalDirty=!0;else{if(i.inheritTranslation){var d=n.x,p=n.y;n.x=_.a*d+_.c*p+_.tx,n.y=_.b*d+_.d*p+_.ty}else u&&(n.x=-n.x),l&&(n.y=-n.y);i.inheritRotation?(h.updateGlobalTransform(),f=h.global.scaleX<0?n.rotation+h.global.rotation+Math.PI:n.rotation+h.global.rotation,_.a*_.d-_.b*_.c<0&&(f-=2*n.rotation,(u!==l||i.inheritReflection)&&(n.skew+=Math.PI),t.DragonBones.yDown||(n.skew=-n.skew)),n.rotation=f):(u||l)&&(u&&l?f=n.rotation+Math.PI:(f=u?Math.PI-n.rotation:-n.rotation,n.skew+=Math.PI),n.rotation=f),n.toMatrix(r)}}else(u||l)&&(u&&(n.x=-n.x),l&&(n.y=-n.y),u&&l?f=n.rotation+Math.PI:(f=u?Math.PI-n.rotation:-n.rotation,n.skew+=Math.PI),n.rotation=f),n.toMatrix(r)},i.prototype.init=function(t,e){null===this._boneData&&(this._boneData=t,this._armature=e,null!==this._boneData.parent&&(this._parent=this._armature.getBone(this._boneData.parent.name)),this._armature._addBone(this),this.origin=this._boneData.transform)},i.prototype.update=function(t){if(this._blendState.dirty=!1,t>=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<n.length;i++)(a=n[i])._root===this&&a.update();this._transformDirty||null!==this._parent&&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{if(this._hasConstraint)for(var r=0,s=this._armature._constraints;r<s.length;r++){var a;(a=s[r])._root===this&&a.update()}(this._transformDirty||null!==this._parent&&this._parent._childrenTransformDirty)&&(t=-1,this._transformDirty=!0,this._cachedFrameIndex=-1)}if(this._transformDirty)if(this._transformDirty=!1,this._childrenTransformDirty=!0,this._cachedFrameIndex<0){var o=t>=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<i.length;e++){var n=i[e];n.parent===this&&n._updateVisible()}}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"name",{get:function(){return this._boneData.name},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),i.prototype.getBones=function(){console.warn("Deprecated.");for(var t=new Array,e=0,i=this._armature.getBones();e<i.length;e++){var n=i[e];n.parent===this&&t.push(n)}return t},i.prototype.getSlots=function(){console.warn("Deprecated.");for(var t=new Array,e=0,i=this._armature.getSlots();e<i.length;e++){var n=i[e];n.parent===this&&t.push(n)}return t},Object.defineProperty(i.prototype,"slot",{get:function(){console.warn("Deprecated.");for(var t=0,e=this._armature.getSlots();t<e.length;t++){var i=e[t];if(i.parent===this)return i}return null},enumerable:!0,configurable:!0}),i}(t.TransformObject);t.Bone=e}(rit),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._vertices=[],e._deformVertices=[],e._hullCache=[],e._matrixCahce=[],e}return nit(e,t),e.toString=function(){return"[class dragonBones.Surface]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this._dX=0,this._dY=0,this._k=0,this._kX=0,this._kY=0,this._vertices.length=0,this._deformVertices.length=0,this._matrixCahce.length=0,this._hullCache.length=0},e.prototype._getAffineTransform=function(t,e,i,n,r,s,a,o,h,u,l,c,f){var _=a-r,d=o-s,p=h-r,m=u-s;l.rotation=Math.atan2(d,_),l.skew=Math.atan2(m,p)-.5*Math.PI-l.rotation,f&&(l.rotation+=Math.PI),l.scaleX=Math.sqrt(_*_+d*d)/i,l.scaleY=Math.sqrt(p*p+m*m)/n,l.toMatrix(c),l.x=c.tx=r-(c.a*t+c.c*e),l.y=c.ty=s-(c.b*t+c.d*e)},e.prototype._updateVertices=function(){var t=this._boneData.vertices,e=this._vertices,i=this._deformVertices;if(null!==this._parent)if(1===this._parent._boneData.type)for(var n=0,r=t.length;n<r;n+=2){var s=t[n]+i[n],a=t[n+1]+i[n],o=this._parent._getGlobalTransformMatrix(s,a);e[n]=o.a*s+o.c*a+o.tx,e[n+1]=o.b*s+o.d*a+o.ty}else{var h=this._parent.globalTransformMatrix;for(n=0,r=t.length;n<r;n+=2)s=t[n]+i[n],a=t[n+1]+i[n+1],e[n]=h.a*s+h.c*a+h.tx,e[n+1]=h.b*s+h.d*a+h.ty}else for(n=0,r=t.length;n<r;n+=2)e[n]=t[n]+i[n],e[n+1]=t[n+1]+i[n+1]},e.prototype._updateGlobalTransformMatrix=function(){var t=2*this._boneData.segmentX,e=this._vertices.length-2,i=this._vertices[0],n=this._vertices[1],r=this._vertices[t],s=this._vertices[t+1],a=this._vertices[e],o=this._vertices[e+1],h=this._vertices[e-t],u=this._vertices[e-t+1],l=i+.5*(a-i),c=n+.5*(o-n),f=l+.5*(r+.5*(h-r)-l),_=c+.5*(s+.5*(u-s)-c),d=r+.5*(a-r),p=s+.5*(o-s),m=h+.5*(a-h),g=u+.5*(o-u);this._globalDirty=!1,this._getAffineTransform(0,0,200,200,f,_,d,p,m,g,this.global,this.globalTransformMatrix,!1)},e.prototype._getGlobalTransformMatrix=function(t,i){var n=1e3;if(t<-1e3||n<t||i<-1e3||n<i)return this.globalTransformMatrix;var r=!1,s=200,a=this._boneData,o=a.segmentX,h=a.segmentY,u=2*a.segmentX,l=this._dX,c=this._dY,f=Math.floor((t+s)/l),_=Math.floor((i+s)/c),d=0,p=f*l-s,m=_*c-s,g=this._matrixCahce,y=e._helpMatrix;if(t<-200){if(i<-200||i>=s)return this.globalTransformMatrix;if(d=7*(2*(o*(h+1)+2*o+h+_)+((r=i>this._kX*(t+s)+m)?1:0)),this._matrixCahce[d]>0)y.copyFromArray(g,d+1);else{var v=_*(u+2),b=this._hullCache[4],S=this._hullCache[5],w=this._hullCache[2]-(h-_)*b,x=this._hullCache[3]-(h-_)*S,T=this._vertices;r?this._getAffineTransform(-200,m+c,800,c,T[v+u+2],T[v+u+3],w+b,x+S,T[v],T[v+1],e._helpTransform,y,!0):this._getAffineTransform(-1e3,m,800,c,w,x,T[v],T[v+1],w+b,x+S,e._helpTransform,y,!1),g[d]=1,g[d+1]=y.a,g[d+2]=y.b,g[d+3]=y.c,g[d+4]=y.d,g[d+5]=y.tx,g[d+6]=y.ty}}else if(t>=s){if(i<-200||i>=s)return this.globalTransformMatrix;d=7*(2*(o*(h+1)+o+_)+((r=i>this._kX*(t-n)+m)?1:0)),this._matrixCahce[d]>0?y.copyFromArray(g,d+1):(v=(_+1)*(u+2)-2,b=this._hullCache[4],S=this._hullCache[5],w=this._hullCache[0]+_*b,x=this._hullCache[1]+_*S,T=this._vertices,r?this._getAffineTransform(n,m+c,800,c,w+b,x+S,T[v+u+2],T[v+u+3],w,x,e._helpTransform,y,!0):this._getAffineTransform(s,m,800,c,T[v],T[v+1],w,x,T[v+u+2],T[v+u+3],e._helpTransform,y,!1),g[d]=1,g[d+1]=y.a,g[d+2]=y.b,g[d+3]=y.c,g[d+4]=y.d,g[d+5]=y.tx,g[d+6]=y.ty)}else if(i<-200){if(t<-200||t>=s)return this.globalTransformMatrix;d=7*(o*(h+1)+2*f+((r=i>this._kY*(t-p-l)-n)?1:0)),this._matrixCahce[d]>0?y.copyFromArray(g,d+1):(v=2*f,b=this._hullCache[10],S=this._hullCache[11],w=this._hullCache[8]+f*b,x=this._hullCache[9]+f*S,T=this._vertices,r?this._getAffineTransform(p+l,-200,l,800,T[v+2],T[v+3],T[v],T[v+1],w+b,x+S,e._helpTransform,y,!0):this._getAffineTransform(p,-1e3,l,800,w,x,w+b,x+S,T[v],T[v+1],e._helpTransform,y,!1),g[d]=1,g[d+1]=y.a,g[d+2]=y.b,g[d+3]=y.c,g[d+4]=y.d,g[d+5]=y.tx,g[d+6]=y.ty)}else if(i>=s){if(t<-200||t>=s)return this.globalTransformMatrix;d=7*(2*(o*(h+1)+o+h+_)+((r=i>this._kY*(t-p-l)+s)?1:0)),this._matrixCahce[d]>0?y.copyFromArray(g,d+1):(v=h*(u+2)+2*f,b=this._hullCache[10],S=this._hullCache[11],w=this._hullCache[6]-(o-f)*b,x=this._hullCache[7]-(o-f)*S,T=this._vertices,r?this._getAffineTransform(p+l,n,l,800,w+b,x+S,w,x,T[v+2],T[v+3],e._helpTransform,y,!0):this._getAffineTransform(p,s,l,800,T[v],T[v+1],T[v+2],T[v+3],w,x,e._helpTransform,y,!1),g[d]=1,g[d+1]=y.a,g[d+2]=y.b,g[d+3]=y.c,g[d+4]=y.d,g[d+5]=y.tx,g[d+6]=y.ty)}else d=7*(2*(o*_+f)+((r=i>this._k*(t-p-l)+m)?1:0)),this._matrixCahce[d]>0?y.copyFromArray(g,d+1):(v=2*f+_*(u+2),T=this._vertices,r?this._getAffineTransform(p+l,m+c,l,c,T[v+u+4],T[v+u+5],T[v+u+2],T[v+u+3],T[v+2],T[v+3],e._helpTransform,y,!0):this._getAffineTransform(p,m,l,c,T[v],T[v+1],T[v+2],T[v+3],T[v+u+2],T[v+u+3],e._helpTransform,y,!1),g[d]=1,g[d+1]=y.a,g[d+2]=y.b,g[d+3]=y.c,g[d+4]=y.d,g[d+5]=y.tx,g[d+6]=y.ty);return y},e.prototype.init=function(e,i){if(null===this._boneData){t.prototype.init.call(this,e,i);var n=e.segmentX,r=e.segmentY,s=e.vertices.length;this._dX=400/n,this._dY=400/r,this._k=-this._dY/this._dX,this._kX=-this._dY/800,this._kY=-800/this._dX,this._vertices.length=s,this._deformVertices.length=s,this._matrixCahce.length=14*(n*r+2*n+2*r),this._hullCache.length=10;for(var a=0;a<s;++a)this._deformVertices[a]=0}},e.prototype.update=function(t){if(this._blendState.dirty=!1,t>=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<r.length;n++)(o=r[n])._root===this&&o.update();this._transformDirty||null!==this._parent&&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{if(this._hasConstraint)for(var s=0,a=this._armature._constraints;s<a.length;s++){var o;(o=a[s])._root===this&&o.update()}(this._transformDirty||null!==this._parent&&this._parent._childrenTransformDirty)&&(t=-1,this._transformDirty=!0,this._cachedFrameIndex=-1)}if(this._transformDirty){this._transformDirty=!1,this._childrenTransformDirty=!0;for(var h=0,u=this._matrixCahce.length;h<u;h+=7)this._matrixCahce[h]=-1;if(this._updateVertices(),this._cachedFrameIndex<0){var l=t>=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,_=e._helpPoint;this.globalTransformMatrix.transformPoint(1e3,-200,_),this._hullCache[0]=_.x,this._hullCache[1]=_.y,this._hullCache[2]=c-_.x,this._hullCache[3]=f-_.y,this.globalTransformMatrix.transformPoint(0,this._dY,_,!0),this._hullCache[4]=_.x,this._hullCache[5]=_.y,this.globalTransformMatrix.transformPoint(200,1e3,_),this._hullCache[6]=_.x,this._hullCache[7]=_.y,this._hullCache[8]=c-_.x,this._hullCache[9]=f-_.y,this.globalTransformMatrix.transformPoint(this._dX,0,_,!0),this._hullCache[10]=_.x,this._hullCache[11]=_.y}else this._childrenTransformDirty&&(this._childrenTransformDirty=!1);this._localDirty=!0},e}(t.Bone);t.Surface=e}(rit),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 nit(i,e),i.prototype._onClear=function(){e.prototype._onClear.call(this);for(var i=[],n=0,r=this._displayList;n<r.length;n++)null!==(o=r[n])&&o!==this._rawDisplay&&o!==this._meshDisplay&&i.indexOf(o)<0&&i.push(o);for(var s=0,a=i;s<a.length;s++){var o;(o=a[s])instanceof t.Armature?o.dispose():this._disposeDisplay(o,!0)}null!==this._deformVertices&&this._deformVertices.returnToPool(),null!==this._meshDisplay&&this._meshDisplay!==this._rawDisplay&&this._disposeDisplay(this._meshDisplay,!1),null!==this._rawDisplay&&this._disposeDisplay(this._rawDisplay,!1),this.displayController=null,this._displayDirty=!1,this._zOrderDirty=!1,this._blendModeDirty=!1,this._colorDirty=!1,this._transformDirty=!1,this._visible=!0,this._blendMode=0,this._displayIndex=-1,this._animationDisplayIndex=-1,this._zOrder=0,this._cachedFrameIndex=-1,this._pivotX=0,this._pivotY=0,this._localMatrix.identity(),this._colorTransform.identity(),this._displayList.length=0,this._displayDatas.length=0,this._slotData=null,this._rawDisplayDatas=null,this._displayData=null,this._boundingBoxData=null,this._textureData=null,this._deformVertices=null,this._rawDisplay=null,this._meshDisplay=null,this._display=null,this._childArmature=null,this._parent=null,this._cachedFrameIndices=null},i.prototype._getDefaultRawDisplayData=function(t){var e=this._armature._armatureData.defaultSkin;if(null!==e){var i=e.getDisplays(this._slotData.name);if(null!==i)return t<i.length?i[t]:null}return null},i.prototype._updateDisplayData=function(){var e=this._displayData,n=null!==this._deformVertices?this._deformVertices.verticesData:null,r=this._textureData,s=null,a=null;if(this._displayData=null,this._boundingBoxData=null,this._textureData=null,this._displayIndex>=0&&(null!==this._rawDisplayDatas&&(s=this._displayIndex<this._rawDisplayDatas.length?this._rawDisplayDatas[this._displayIndex]:null),null===s&&(s=this._getDefaultRawDisplayData(this._displayIndex)),this._displayIndex<this._displayDatas.length&&(this._displayData=this._displayDatas[this._displayIndex])),null!==this._displayData&&(2===this._displayData.type||4===this._displayData.type?a=this._displayData.vertices:null!==s&&(2===s.type||4===s.type)&&(a=s.vertices),3===this._displayData.type?this._boundingBoxData=this._displayData.boundingBox:null!==s&&3===s.type&&(this._boundingBoxData=s.boundingBox),(0===this._displayData.type||2===this._displayData.type)&&(this._textureData=this._displayData.texture)),this._displayData!==e||a!==n||this._textureData!==r){if(null===a&&null!==this._textureData){var o=this._displayData,h=this._textureData.parent.scale*this._armature._armatureData.scale,u=this._textureData.frame;this._pivotX=o.pivot.x,this._pivotY=o.pivot.y;var l=null!==u?u:this._textureData.region,c=l.width,f=l.height;this._textureData.rotated&&null===u&&(c=l.height,f=l.width),this._pivotX*=c*h,this._pivotY*=f*h,null!==u&&(this._pivotX+=u.x*h,this._pivotY+=u.y*h),null!==this._displayData&&null!==s&&this._displayData!==s&&(s.transform.toMatrix(i._helpMatrix),i._helpMatrix.invert(),i._helpMatrix.transformPoint(0,0,i._helpPoint),this._pivotX-=i._helpPoint.x,this._pivotY-=i._helpPoint.y,this._displayData.transform.toMatrix(i._helpMatrix),i._helpMatrix.invert(),i._helpMatrix.transformPoint(0,0,i._helpPoint),this._pivotX+=i._helpPoint.x,this._pivotY+=i._helpPoint.y),t.DragonBones.yDown||(this._pivotY=(this._textureData.rotated?this._textureData.region.width:this._textureData.region.height)*h-this._pivotY)}else this._pivotX=0,this._pivotY=0;null!==s?this.origin=s.transform:null!==this._displayData?this.origin=this._displayData.transform:this.origin=null,a!==n?(null===this._deformVertices&&(this._deformVertices=t.BaseObject.borrowObject(t.DeformVertices)),this._deformVertices.init(a,this._armature)):null!==this._deformVertices&&this._textureData!==r&&(this._deformVertices.verticesDirty=!0),this._displayDirty=!0,this._transformDirty=!0}},i.prototype._updateDisplay=function(){var e=null!==this._display?this._display:this._rawDisplay,i=this._childArmature;this._displayIndex>=0&&this._displayIndex<this._displayList.length?(this._display=this._displayList[this._displayIndex],null!==this._display&&this._display instanceof t.Armature?(this._childArmature=this._display,this._display=this._childArmature.display):this._childArmature=null):(this._display=null,this._childArmature=null);var n=null!==this._display?this._display:this._rawDisplay;if(n!==e&&(this._onUpdateDisplay(),this._replaceDisplay(e),this._transformDirty=!0,this._visibleDirty=!0,this._blendModeDirty=!0,this._colorDirty=!0),n!==this._rawDisplay&&n!==this._meshDisplay||this._updateFrame(),this._childArmature!==i&&(null!==i&&(i._parent=null,i.clock=null,i.inheritAnimation&&i.animation.reset()),null!==this._childArmature&&(this._childArmature._parent=this,this._childArmature.clock=this._armature.clock,this._childArmature.inheritAnimation))){if(0===this._childArmature.cacheFrameRate){var r=this._armature.cacheFrameRate;0!==r&&(this._childArmature.cacheFrameRate=r)}var s=null;if(null!==this._displayData&&1===this._displayData.type)s=this._displayData.actions;else if(this._displayIndex>=0&&null!==this._rawDisplayDatas){var a=this._displayIndex<this._rawDisplayDatas.length?this._rawDisplayDatas[this._displayIndex]:null;null===a&&(a=this._getDefaultRawDisplayData(this._displayIndex)),null!==a&&1===a.type&&(s=a.actions)}if(null!==s&&s.length>0)for(var o=0,h=s;o<h.length;o++){var u=h[o],l=t.BaseObject.borrowObject(t.EventObject);t.EventObject.actionDataToInstance(u,l,this._armature),l.slot=this,this._armature._bufferAction(l,!1)}else this._childArmature.animation.play()}},i.prototype._updateGlobalTransformMatrix=function(t){var e=0===this._parent._boneData.type?this._parent.globalTransformMatrix:this._parent._getGlobalTransformMatrix(this.global.x,this.global.y);this.globalTransformMatrix.copyFrom(this._localMatrix),this.globalTransformMatrix.concat(e),t?this.global.fromMatrix(this.globalTransformMatrix):this._globalDirty=!0},i.prototype._setDisplayIndex=function(t,e){if(void 0===e&&(e=!1),e){if(this._animationDisplayIndex===t)return!1;this._animationDisplayIndex=t}return this._displayIndex!==t&&(this._displayIndex=t,this._displayDirty=!0,this._updateDisplayData(),this._displayDirty)},i.prototype._setZorder=function(t){return this._zOrder,this._zOrder=t,this._zOrderDirty=!0,this._zOrderDirty},i.prototype._setColor=function(t){return this._colorTransform.copyFrom(t),this._colorDirty=!0,this._colorDirty},i.prototype._setDisplayList=function(e){if(null!==e&&e.length>0){this._displayList.length!==e.length&&(this._displayList.length=e.length);for(var i=0,n=e.length;i<n;++i){var r=e[i];null!==r&&r!==this._rawDisplay&&r!==this._meshDisplay&&!(r instanceof t.Armature)&&this._displayList.indexOf(r)<0&&this._initDisplay(r,!0),this._displayList[i]=r}}else this._displayList.length>0&&(this._displayList.length=0);return this._displayIndex>=0&&this._displayIndex<this._displayList.length?this._displayDirty=this._display!==this._displayList[this._displayIndex]:this._displayDirty=null!==this._display,this._updateDisplayData(),this._displayDirty},i.prototype.init=function(t,e,i,n){if(null===this._slotData){this._slotData=t,this._isFromCache=!1,this._visibleDirty=!0,this._blendModeDirty=!0,this._colorDirty=!0,this._blendMode=this._slotData.blendMode,this._zOrder=this._slotData.zOrder,this._colorTransform.copyFrom(this._slotData.color),this._rawDisplay=i,this._meshDisplay=n,this._armature=e;var r=this._armature.getBone(this._slotData.parent.name);null!==r&&(this._parent=r),this._armature._addSlot(this),this._initDisplay(this._rawDisplay,!1),this._rawDisplay!==this._meshDisplay&&this._initDisplay(this._meshDisplay,!1),this._onUpdateDisplay(),this._addDisplay()}},i.prototype.update=function(t){if(this._isFromCache=!1,this._displayDirty&&(this._displayDirty=!1,this._updateDisplay(),this._transformDirty&&(null!==this.origin?this.global.copyFrom(this.origin).add(this.offset).toMatrix(this._localMatrix):this.global.copyFrom(this.offset).toMatrix(this._localMatrix))),this._zOrderDirty&&(this._zOrderDirty=!1,this._updateZOrder()),t>=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;i<n;++i)this._displayDatas[i]||(this._displayDatas[i]=null)}this._displayDatas[e]=t},i.prototype.containsPoint=function(t,e){return null!==this._boundingBoxData&&(this.updateTransformAndMatrix(),i._helpMatrix.copyFrom(this.globalTransformMatrix),i._helpMatrix.invert(),i._helpMatrix.transformPoint(t,e,i._helpPoint),this._boundingBoxData.containsPoint(i._helpPoint.x,i._helpPoint.y))},i.prototype.intersectsSegment=function(t,e,n,r,s,a,o){if(void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null),null===this._boundingBoxData)return 0;this.updateTransformAndMatrix(),i._helpMatrix.copyFrom(this.globalTransformMatrix),i._helpMatrix.invert(),i._helpMatrix.transformPoint(t,e,i._helpPoint),t=i._helpPoint.x,e=i._helpPoint.y,i._helpMatrix.transformPoint(n,r,i._helpPoint),n=i._helpPoint.x,r=i._helpPoint.y;var h=this._boundingBoxData.intersectsSegment(t,e,n,r,s,a,o);return h>0&&(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<s.length;r++)null!==(h=s[r])&&h!==this._rawDisplay&&h!==this._meshDisplay&&this._displayList.indexOf(h)<0&&n.indexOf(h)<0&&n.push(h);for(var a=0,o=n;a<o.length;a++){var h;(h=o[a])instanceof t.Armature||this._disposeDisplay(h,!0)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"slotData",{get:function(){return this._slotData},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rawDisplayDatas",{get:function(){return this._rawDisplayDatas},set:function(t){if(this._rawDisplayDatas!==t)if(this._displayDirty=!0,this._rawDisplayDatas=t,null!==this._rawDisplayDatas){this._displayDatas.length=this._rawDisplayDatas.length;for(var e=0,i=this._displayDatas.length;e<i;++e){var n=this._rawDisplayDatas[e];null===n&&(n=this._getDefaultRawDisplayData(e)),this._displayDatas[e]=n}}else this._displayDatas.length=0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"displayData",{get:function(){return this._displayData},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"boundingBoxData",{get:function(){return this._boundingBoxData},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rawDisplay",{get:function(){return this._rawDisplay},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"meshDisplay",{get:function(){return this._meshDisplay},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"display",{get:function(){return this._display},set:function(t){if(this._display!==t){var e=this._displayList.length;if(this._displayIndex<0&&0===e&&(this._displayIndex=0),!(this._displayIndex<0)){var i=this.displayList;e<=this._displayIndex&&(i.length=this._displayIndex+1),i[this._displayIndex]=t,this.displayList=i}}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"childArmature",{get:function(){return this._childArmature},set:function(t){this._childArmature!==t&&(this.display=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),i.prototype.getDisplay=function(){return this._display},i.prototype.setDisplay=function(t){this.display=t},i}(t.TransformObject);t.Slot=e}(rit),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return nit(i,e),i.prototype._onClear=function(){this._armature=null,this._target=null,this._root=null,this._bone=null},Object.defineProperty(i.prototype,"name",{get:function(){return this._constraintData.name},enumerable:!0,configurable:!0}),i._helpMatrix=new t.Matrix,i._helpTransform=new t.Transform,i._helpPoint=new t.Point,i}(t.BaseObject);t.Constraint=e;var i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return nit(i,e),i.toString=function(){return"[class dragonBones.IKConstraint]"},i.prototype._onClear=function(){e.prototype._onClear.call(this),this._scaleEnabled=!1,this._bendPositive=!1,this._weight=1,this._constraintData=null},i.prototype._computeA=function(){var e=this._target.global,i=this._root.global,n=this._root.globalTransformMatrix,r=Math.atan2(e.y-i.y,e.x-i.x);i.scaleX<0&&(r+=Math.PI),i.rotation+=t.Transform.normalizeRadian(r-i.rotation)*this._weight,i.toMatrix(n)},i.prototype._computeB=function(){var e=this._bone._boneData.length,i=this._root,n=this._target.global,r=i.global,s=this._bone.global,a=this._bone.globalTransformMatrix,o=a.a*e,h=a.b*e,u=o*o+h*h,l=Math.sqrt(u),c=s.x-r.x,f=s.y-r.y,_=c*c+f*f,d=Math.sqrt(_),p=s.rotation,m=r.rotation,g=Math.atan2(f,c),y=(c=n.x-r.x)*c+(f=n.y-r.y)*f,v=Math.sqrt(y),b=0;if(l+d<=v||v+l<=d||v+d<=l)b=Math.atan2(n.y-r.y,n.x-r.x),l+d<=v||d<l&&(b+=Math.PI);else{var S=(_-u+y)/(2*y),w=Math.sqrt(_-S*S*y)/v,x=r.x+c*S,T=r.y+f*S,A=-f*w,C=c*w,D=!1,B=i.parent;if(null!==B){var I=B.globalTransformMatrix;D=I.a*I.d-I.b*I.c<0}D!==this._bendPositive?(s.x=x-A,s.y=T-C):(s.x=x+A,s.y=T+C),b=Math.atan2(s.y-r.y,s.x-r.x)}var M=t.Transform.normalizeRadian(b-g);r.rotation=m+M*this._weight,r.toMatrix(i.globalTransformMatrix);var P=g+M*this._weight;s.x=r.x+Math.cos(P)*d,s.y=r.y+Math.sin(P)*d;var E=Math.atan2(n.y-s.y,n.x-s.x);s.scaleX<0&&(E+=Math.PI),s.rotation=r.rotation+p-m+t.Transform.normalizeRadian(E-M-p)*this._weight,s.toMatrix(a)},i.prototype.init=function(t,e){if(null===this._constraintData){this._constraintData=t,this._armature=e,this._target=this._armature.getBone(this._constraintData.target.name),this._root=this._armature.getBone(this._constraintData.root.name),this._bone=null!==this._constraintData.bone?this._armature.getBone(this._constraintData.bone.name):null;var i=this._constraintData;this._scaleEnabled=i.scaleEnabled,this._bendPositive=i.bendPositive,this._weight=i.weight,this._root._hasConstraint=!0}},i.prototype.update=function(){this._root.updateByConstraint(),null!==this._bone?(this._bone.updateByConstraint(),this._computeB()):this._computeA()},i.prototype.invalidUpdate=function(){this._root.invalidUpdate(),null!==this._bone&&this._bone.invalidUpdate()},i}(e);t.IKConstraint=i;var n=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t._bones=[],t._spaces=[],t._positions=[],t._curves=[],t._boneLengths=[],t._pathGlobalVertices=[],t._segments=[10],t}return nit(i,e),i.toString=function(){return"[class dragonBones.PathConstraint]"},i.prototype._onClear=function(){e.prototype._onClear.call(this),this.dirty=!1,this.pathOffset=0,this.position=0,this.spacing=0,this.rotateOffset=0,this.rotateMix=1,this.translateMix=1,this._pathSlot=null,this._bones.length=0,this._spaces.length=0,this._positions.length=0,this._curves.length=0,this._boneLengths.length=0,this._pathGlobalVertices.length=0},i.prototype._updatePathVertices=function(t){var e=this._armature,i=e.armatureData.parent,n=e.armatureData.scale,r=i.intArray,s=i.floatArray,a=t.offset,o=r[a+0],h=r[a+2];this._pathGlobalVertices.length=2*o;var u=t.weight;if(null!==u)for(var l=this._pathSlot._deformVertices.bones,c=u.bones.length,f=u.offset,_=r[f+1],d=f+2+c,p=(T=0,0);T<o;T++){for(var m=0,g=0,y=0,v=r[d++];y<v;y++){var b=l[r[d++]];if(null!==b){b.updateByConstraint(),x=b.globalTransformMatrix;var S=s[_++];C=s[_++]*n,D=s[_++]*n,m+=(x.a*C+x.c*D+x.tx)*S,g+=(x.b*C+x.d*D+x.ty)*S}}this._pathGlobalVertices[p++]=m,this._pathGlobalVertices[p++]=g}else{var w=this._pathSlot.parent;w.updateByConstraint();for(var x=w.globalTransformMatrix,T=0,A=h;T<o;T+=2){var C=s[A++]*n,D=s[A++]*n,B=x.a*C+x.c*D+x.tx,I=x.b*C+x.d*D+x.ty;this._pathGlobalVertices[T]=B,this._pathGlobalVertices[T+1]=I}}},i.prototype._computeVertices=function(t,e,i,n){for(var r=i,s=t;r<e;r+=2)n[r]=this._pathGlobalVertices[s++],n[r+1]=this._pathGlobalVertices[s++]},i.prototype._computeBezierCurve=function(t,e,i,n,r){var s=this._armature.armatureData.parent.intArray[t.vertices.offset+0],a=this._positions,o=this._spaces,h=t.closed,u=Array(),l=2*s,c=l/6,f=-1,_=this.position;a.length=3*e+2;var d=0;if(t.constantSpeed){h?(l+=2,u.length=s,this._computeVertices(2,l-4,0,u),this._computeVertices(0,2,l-4,u),u[l-2]=u[0],u[l-1]=u[1]):(c--,l-=4,u.length=l,this._computeVertices(2,l,0,u));var p=new Array(c);d=0;for(var m,g,y,v,b,S,w,x,T=u[0],A=u[1],C=0,D=0,B=0,I=0,M=0,P=0,E=(G=0,2);G<c;G++,E+=6)C=u[E],D=u[E+1],B=u[E+2],I=u[E+3],b=2*(m=.1875*(T-2*C+B))+(y=.09375*(3*(C-B)-T+(M=u[E+4]))),S=2*(g=.1875*(A-2*D+I))+(v=.09375*(3*(D-I)-A+(P=u[E+5]))),w=.75*(C-T)+m+.16666667*y,x=.75*(D-A)+g+.16666667*v,d+=Math.sqrt(w*w+x*x),w+=b,x+=S,b+=y,S+=v,d+=Math.sqrt(w*w+x*x),w+=b,x+=S,d+=Math.sqrt(w*w+x*x),w+=b+y,x+=S+v,d+=Math.sqrt(w*w+x*x),p[G]=d,T=M,A=P;if(n&&(_*=d),r)for(G=0;G<e;G++)o[G]*=d;for(var O=this._segments,k=0,R=(G=0,H=0,W=0,0);G<e;G++,H+=3){var F=_+=o[G];if(h)(F%=d)<0&&(F+=d),W=0;else{if(F<0)continue;if(F>d)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],A=u[V+1],C=u[V+2],D=u[V+3],B=u[V+4],I=u[V+5],b=2*(m=.03*(T-2*C+B))+(y=.006*(3*(C-B)-T+(M=u[V+6]))),S=2*(g=.03*(A-2*D+I))+(v=.006*(3*(D-I)-A+(P=u[V+7]))),w=.3*(C-T)+m+.16666667*y,x=.3*(D-A)+g+.16666667*v,k=Math.sqrt(w*w+x*x),O[0]=k,V=1;V<8;V++)w+=b,x+=S,b+=y,S+=v,k+=Math.sqrt(w*w+x*x),O[V]=k;w+=b,x+=S,k+=Math.sqrt(w*w+x*x),O[8]=k,w+=b+y,x+=S+v,k+=Math.sqrt(w*w+x*x),O[9]=k,R=0}for(F*=k;;R++){var N=O[R];if(!(F>N)){var z;0===R?F/=N:F=R+(F-(z=O[R-1]))/(N-z);break}}this.addCurvePosition(.1*F,T,A,C,D,B,I,M,P,a,H,i)}}else{var U=t.curveLengths;if(d=U[c-=h?1:2],n&&(_*=d),r)for(var G=0;G<e;G++)o[G]*=d;u.length=8;G=0;for(var H=0,W=0;G<e;G++,H+=3){if(_+=o[G],h)(_%=d)<0&&(_+=d),W=0;else{if(_<0)continue;if(_>d)continue}for(var j=0;;W++){var q=U[W];if(!(_>q)){if(0===W)j=_/q;else{var X=U[W-1];j=(_-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,_=f*f,d=t*t,p=_*f,m=_*t*3,g=f*d*3,y=t*d,v=p*e+m*n+g*s+y*o,b=p*i+m*r+g*a+y*h;u[l]=v,u[l+1]=b,u[l+2]=c?Math.atan2(b-(p*i+m*r+g*a),v-(p*e+m*n+g*s)):0},i.prototype.init=function(t,e){this._constraintData=t,this._armature=e;var i=t;this.pathOffset=i.pathDisplayData.vertices.offset,this.position=i.position,this.spacing=i.spacing,this.rotateOffset=i.rotateOffset,this.rotateMix=i.rotateMix,this.translateMix=i.translateMix,this._root=this._armature.getBone(i.root.name),this._target=this._armature.getBone(i.target.name),this._pathSlot=this._armature.getSlot(i.pathSlot.name);for(var n=0,r=i.bones.length;n<r;n++){var s=this._armature.getBone(i.bones[n].name);null!==s&&this._bones.push(s)}2===i.rotateMode&&(this._boneLengths.length=this._bones.length),this._root._hasConstraint=!0},i.prototype.update=function(){var e=this._pathSlot;if(null!==e._deformVertices&&null!==e._deformVertices.verticesData&&e._deformVertices.verticesData.offset===this.pathOffset){var i=this._constraintData,n=e._displayData,r=!1,s=e._deformVertices;if(this._root._childrenTransformDirty?(this._updatePathVertices(n.vertices),r=!0):null!==s&&(s.verticesDirty||s.isBonesUpdate())&&(this._updatePathVertices(n.vertices),s.verticesDirty=!1,r=!0),r||this.dirty){var a=i.positionMode,o=i.spacingMode,h=i.rotateMode,u=this._bones,l=0===o,c=2===h,f=0===h,_=u.length,d=f?_:_+1,p=this.spacing,m=this._spaces;if(m.length=d,c||l){m[0]=0;for(var g=0,y=d-1;g<y;g++){(P=u[g]).updateByConstraint();var v=P._boneData.length,b=v*(E=P.globalTransformMatrix).a,S=v*E.b,w=Math.sqrt(b*b+S*S);c&&(this._boneLengths[g]=w),m[g+1]=(v+p)*w/v}}else for(g=0;g<d;g++)m[g]=p;this._computeBezierCurve(n,d,f,1===a,2===o);var x,T=this._positions,A=this.rotateOffset,C=T[0],D=T[1];0===A?x=1===h:(x=!1,null!==(P=e.parent)&&(A*=(E=P.globalTransformMatrix).a*E.d-E.b*E.c>0?t.Transform.DEG_RAD:-t.Transform.DEG_RAD));for(var B=this.rotateMix,I=this.translateMix,M=(g=0,3);g<_;g++,M+=3){var P,E;(P=u[g]).updateByConstraint(),(E=P.globalTransformMatrix).tx+=(C-E.tx)*I,E.ty+=(D-E.ty)*I;var O=(b=T[M])-C,k=(S=T[M+1])-D;if(c){var R=this._boneLengths[g],F=(Math.sqrt(O*O+k*k)/R-1)*B+1;E.a*=F,E.b*=F}if(C=b,D=S,B>0){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(k,O),U-=Math.atan2(V,L),x){G=Math.cos(U),H=Math.sin(U);var W=P._boneData.length;C+=(W*(G*L-H*V)-O)*B,D+=(W*(H*L+G*V)-k)*B}else U+=A;U>t.Transform.PI?U-=t.Transform.PI_D:U<-t.Transform.PI&&(U+=t.Transform.PI_D),U*=B,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}(rit),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;i<r;++i){var s=this._animatebles[i];null!==s?(n>0&&(this._animatebles[i-n]=s,this._animatebles[i]=null),s.advanceTime(t)):n++}if(n>0){for(r=this._animatebles.length;i<r;++i){var a=this._animatebles[i];null!==a?this._animatebles[i-n]=a:n++}this._animatebles.length-=n}}},t.prototype.contains=function(t){if(t===this)return!1;for(var e=t;e!==this&&null!==e;)e=e.clock;return e===this},t.prototype.add=function(t){this._animatebles.indexOf(t)<0&&(this._animatebles.push(t),t.clock=this)},t.prototype.remove=function(t){var e=this._animatebles.indexOf(t);e>=0&&(this._animatebles[e]=null,t.clock=null)},t.prototype.clear=function(){for(var t=0,e=this._animatebles;t<e.length;t++){var i=e[t];null!==i&&(i.clock=null)}},Object.defineProperty(t.prototype,"clock",{get:function(){return this._clock},set:function(t){this._clock!==t&&(null!==this._clock&&this._clock.remove(this),this._clock=t,null!==this._clock&&this._clock.add(this))},enumerable:!0,configurable:!0}),t.clock=new t,t}();t.WorldClock=e}(rit),function(t){var e=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t._animationNames=[],t._animationStates=[],t._animations={},t._animationConfig=null,t}return nit(i,e),i.toString=function(){return"[class dragonBones.Animation]"},i.prototype._onClear=function(){for(var t=0,e=this._animationStates;t<e.length;t++)e[t].returnToPool();for(var i in this._animations)delete this._animations[i];null!==this._animationConfig&&this._animationConfig.returnToPool(),this.timeScale=1,this._lockUpdate=!1,this._animationDirty=!1,this._inheritTimeScale=1,this._animationNames.length=0,this._animationStates.length=0,this._armature=null,this._animationConfig=null,this._lastAnimationState=null},i.prototype._fadeOut=function(t){switch(t.fadeOutMode){case 1:for(var e=0,i=this._animationStates;e<i.length;e++)null===(u=i[e])._parent&&u.layer===t.layer&&u.fadeOut(t.fadeOutTime,t.pauseFadeOut);break;case 2:for(var n=0,r=this._animationStates;n<r.length;n++)null===(u=r[n])._parent&&u.group===t.group&&u.fadeOut(t.fadeOutTime,t.pauseFadeOut);break;case 3:for(var s=0,a=this._animationStates;s<a.length;s++)null===(u=a[s])._parent&&u.layer===t.layer&&u.group===t.group&&u.fadeOut(t.fadeOutTime,t.pauseFadeOut);break;case 4:for(var o=0,h=this._animationStates;o<h.length;o++){var u;null===(u=h[o])._parent&&u.fadeOut(t.fadeOutTime,t.pauseFadeOut)}}},i.prototype.init=function(e){null===this._armature&&(this._armature=e,this._animationConfig=t.BaseObject.borrowObject(t.AnimationConfig))},i.prototype.advanceTime=function(t){t<0&&(t=-t),this._armature.inheritAnimation&&null!==this._armature._parent?this._inheritTimeScale=this._armature._parent._armature.animation._inheritTimeScale*this.timeScale:this._inheritTimeScale=this.timeScale,1!==this._inheritTimeScale&&(t*=this._inheritTimeScale);var e=this._animationStates.length;if(1===e)if((d=this._animationStates[0])._fadeState>0&&d._subFadeState>0)this._armature._dragonBones.bufferObject(d),this._animationStates.length=0,this._lastAnimationState=null;else{var i=d._animationData,n=i.cacheFrameRate;if(this._animationDirty&&n>0){this._animationDirty=!1;for(var r=0,s=this._armature.getBones();r<s.length;r++){var a=s[r];a._cachedFrameIndices=i.getBoneCachedFrameIndices(a.name)}for(var o=0,h=this._armature.getSlots();o<h.length;o++){var u=h[o],l=u.rawDisplayDatas;if(null!==l&&l.length>0){var c=l[0];if(null!==c&&c.parent===this._armature.armatureData.defaultSkin){u._cachedFrameIndices=i.getSlotCachedFrameIndices(u.name);continue}}u._cachedFrameIndices=null}}d.advanceTime(t,n)}else if(e>1){for(var f=0,_=0;f<e;++f){var d;(d=this._animationStates[f])._fadeState>0&&d._subFadeState>0?(_++,this._armature._dragonBones.bufferObject(d),this._animationDirty=!0,this._lastAnimationState===d&&(this._lastAnimationState=null)):(_>0&&(this._animationStates[f-_]=d),d.advanceTime(t,0)),f===e-1&&_>0&&(this._animationStates.length-=_,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;t<e.length;t++)e[t].returnToPool();this._animationDirty=!1,this._animationConfig.clear(),this._animationStates.length=0,this._lastAnimationState=null},i.prototype.stop=function(t){if(void 0===t&&(t=null),null!==t)null!==(n=this.getState(t))&&n.stop();else for(var e=0,i=this._animationStates;e<i.length;e++){var n;(n=i[e]).stop()}},i.prototype.playConfig=function(e){var i=e.animation;if(!(i in this._animations))return console.warn("Non-existent animation.\n","DragonBones name: "+this._armature.armatureData.parent.name,"Armature name: "+this._armature.name,"Animation name: "+i),null;var n=this._animations[i];if(5===e.fadeOutMode)for(var r=0,s=this._animationStates;r<s.length;r++){var a=s[r];if(a._animationData===n)return a}0===this._animationStates.length?e.fadeInTime=0:e.fadeInTime<0&&(e.fadeInTime=n.fadeInTime),e.fadeOutTime<0&&(e.fadeOutTime=e.fadeInTime),e.timeScale<=-100&&(e.timeScale=1/n.scale),n.frameCount>1?(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;u<l;++u){if(o.layer>this._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();c<f.length;c++){var _=f[c].childArmature;null!==_&&_.inheritAnimation&&_.animation.hasAnimation(i)&&null===_.animation.getState(i)&&_.animation.fadeIn(i)}var d=!1;for(var p in n.animationTimelines){this._lockUpdate||(d=!0,this._lockUpdate=!0);var m=this.fadeIn(p,e.fadeInTime,1,o.layer,null,0);null!==m&&(m.resetToPose=!1,m._parent=o,m.stop())}return d&&(this._lockUpdate=!1),this._lockUpdate||(e.fadeInTime<=0&&this._armature.advanceTime(0),this._lastAnimationState=o),o},i.prototype.play=function(t,e){if(void 0===t&&(t=null),void 0===e&&(e=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=e,this._animationConfig.fadeInTime=0,this._animationConfig.animation=null!==t?t:"",null!==t&&t.length>0)this.playConfig(this._animationConfig);else if(null===this._lastAnimationState){var i=this._armature.armatureData.defaultAnimation;null!==i&&(this._animationConfig.animation=i.name,this.playConfig(this._animationConfig))}else this._lastAnimationState.isPlaying||this._lastAnimationState.isCompleted?(this._animationConfig.animation=this._lastAnimationState.name,this.playConfig(this._animationConfig)):this._lastAnimationState.play();return this._lastAnimationState},i.prototype.fadeIn=function(t,e,i,n,r,s){return void 0===e&&(e=-1),void 0===i&&(i=-1),void 0===n&&(n=0),void 0===r&&(r=null),void 0===s&&(s=3),this._animationConfig.clear(),this._animationConfig.fadeOutMode=s,this._animationConfig.playTimes=i,this._animationConfig.layer=n,this._animationConfig.fadeInTime=e,this._animationConfig.animation=t,this._animationConfig.group=null!==r?r:"",this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByTime=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.position=e,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t,this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByFrame=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t;var n=t in this._animations?this._animations[t]:null;return null!==n&&(this._animationConfig.position=n.duration*e/n.frameCount),this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByProgress=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t;var n=t in this._animations?this._animations[t]:null;return null!==n&&(this._animationConfig.position=n.duration*(e>0?e:0)),this.playConfig(this._animationConfig)},i.prototype.gotoAndStopByTime=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByTime(t,e,1);return null!==i&&i.stop(),i},i.prototype.gotoAndStopByFrame=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByFrame(t,e,1);return null!==i&&i.stop(),i},i.prototype.gotoAndStopByProgress=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByProgress(t,e,1);return null!==i&&i.stop(),i},i.prototype.getState=function(t){for(var e=this._animationStates.length;e--;){var i=this._animationStates[e];if(i.name===t)return i}return null},i.prototype.hasAnimation=function(t){return t in this._animations},i.prototype.getStates=function(){return this._animationStates},Object.defineProperty(i.prototype,"isPlaying",{get:function(){for(var t=0,e=this._animationStates;t<e.length;t++)if(e[t].isPlaying)return!0;return!1},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isCompleted",{get:function(){for(var t=0,e=this._animationStates;t<e.length;t++)if(!e[t].isCompleted)return!1;return this._animationStates.length>0},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;e<i;++e)t.push(this._animations[this._animationNames[e]]);return t},enumerable:!0,configurable:!0}),i}(t.BaseObject);t.Animation=e}(rit),function(t){var e=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t._blendState=new n,t._boneMask=[],t._boneTimelines=[],t._surfaceTimelines=[],t._slotTimelines=[],t._constraintTimelines=[],t._animationTimelines=[],t._poseTimelines=[],t._bonePoses={},t._actionTimeline=null,t._zOrderTimeline=null,t._parent=null,t}return nit(r,e),r.toString=function(){return"[class dragonBones.AnimationState]"},r.prototype._onClear=function(){for(var t=0,e=this._boneTimelines;t<e.length;t++)e[t].returnToPool();for(var i=0,n=this._surfaceTimelines;i<n.length;i++)n[i].returnToPool();for(var r=0,s=this._slotTimelines;r<s.length;r++)s[r].returnToPool();for(var a=0,o=this._constraintTimelines;a<o.length;a++)o[a].returnToPool();for(var h=0,u=this._animationTimelines;h<u.length;h++)u[h].returnToPool();for(var l in this._bonePoses)this._bonePoses[l].returnToPool(),delete this._bonePoses[l];null!==this._actionTimeline&&this._actionTimeline.returnToPool(),null!==this._zOrderTimeline&&this._zOrderTimeline.returnToPool(),this.actionEnabled=!1,this.additiveBlending=!1,this.displayControl=!1,this.resetToPose=!1,this.playTimes=1,this.layer=0,this.timeScale=1,this.weight=1,this.autoFadeOutTime=0,this.fadeTotalTime=0,this.name="",this.group="",this._timelineDirty=2,this._playheadState=0,this._fadeState=-1,this._subFadeState=-1,this._position=0,this._duration=0,this._fadeTime=0,this._time=0,this._fadeProgress=0,this._weightResult=0,this._blendState.clear(),this._boneMask.length=0,this._boneTimelines.length=0,this._surfaceTimelines.length=0,this._slotTimelines.length=0,this._constraintTimelines.length=0,this._animationTimelines.length=0,this._poseTimelines.length=0,this._animationData=null,this._armature=null,this._actionTimeline=null,this._zOrderTimeline=null,this._parent=null},r.prototype._updateTimelines=function(){for(var e=0,i=this._armature._constraints;e<i.length;e++){var n=i[e];if(null!==(h=this._animationData.getConstraintTimelines(n.name)))for(var r=0,s=h;r<s.length;r++)30===(f=s[r]).type&&((_=t.BaseObject.borrowObject(t.IKConstraintTimelineState)).constraint=n,_.init(this._armature,this,f),this._constraintTimelines.push(_));else this.resetToPose&&((_=t.BaseObject.borrowObject(t.IKConstraintTimelineState)).constraint=n,_.init(this._armature,this,null),this._constraintTimelines.push(_),this._poseTimelines.push(_))}for(var a=0,o=this._armature.animation.getStates();a<o.length;a++){var h,u=o[a];if(u._parent===this&&null!==(h=this._animationData.getAnimationTimelines(u.name)))for(var l=0,c=h;l<c.length;l++){var f,_;40===(f=c[l]).type&&((_=t.BaseObject.borrowObject(t.AnimationTimelineState)).animationState=u,_.init(this._armature,this,f),this._animationTimelines.push(_))}}},r.prototype._updateBoneAndSlotTimelines=function(){for(var e={},n=0,r=this._boneTimelines;n<r.length;n++)(h=(y=r[n]).bone.name)in e||(e[h]=[]),e[h].push(y);for(var s=0,a=this._armature.getBones();s<a.length;s++){var o=a[s],h=o.name;if(this.containsBoneMask(h))if(h in e)delete e[h];else if(0===o._boneData.type){var u=this._animationData.getBoneTimelines(h),l=h in this._bonePoses?this._bonePoses[h]:this._bonePoses[h]=t.BaseObject.borrowObject(i);if(null!==u)for(var c=0,f=u;c<f.length;c++)switch((P=f[c]).type){case 10:(y=t.BaseObject.borrowObject(t.BoneAllTimelineState)).bone=o,y.bonePose=l,y.init(this._armature,this,P),this._boneTimelines.push(y);break;case 11:(y=t.BaseObject.borrowObject(t.BoneTranslateTimelineState)).bone=o,y.bonePose=l,y.init(this._armature,this,P),this._boneTimelines.push(y);break;case 12:(y=t.BaseObject.borrowObject(t.BoneRotateTimelineState)).bone=o,y.bonePose=l,y.init(this._armature,this,P),this._boneTimelines.push(y);break;case 13:(y=t.BaseObject.borrowObject(t.BoneScaleTimelineState)).bone=o,y.bonePose=l,y.init(this._armature,this,P),this._boneTimelines.push(y)}else this.resetToPose&&((y=t.BaseObject.borrowObject(t.BoneAllTimelineState)).bone=o,y.bonePose=l,y.init(this._armature,this,null),this._boneTimelines.push(y),this._poseTimelines.push(y))}else if(1===o._boneData.type)if(null!==(u=this._animationData.getSurfaceTimelines(h)))for(var _=0,d=u;_<d.length;_++)50===(P=d[_]).type&&((y=t.BaseObject.borrowObject(t.SurfaceTimelineState)).surface=o,y.init(this._armature,this,P),this._surfaceTimelines.push(y));else this.resetToPose&&((y=t.BaseObject.borrowObject(t.SurfaceTimelineState)).surface=o,y.init(this._armature,this,null),this._surfaceTimelines.push(y),this._poseTimelines.push(y))}for(var p in e)for(var m=0,g=e[p];m<g.length;m++){var y=g[m];this._boneTimelines.splice(this._boneTimelines.indexOf(y),1),y.returnToPool()}for(var v={},b=[],S=0,w=this._slotTimelines;S<w.length;S++)(h=(y=w[S]).slot.name)in v||(v[h]=[]),v[h].push(y);for(var x=0,T=this._armature.getSlots();x<T.length;x++){var A=T[x],C=A.parent.name;if(this.containsBoneMask(C))if(h=A.name,u=this._animationData.getSlotTimelines(h),h in v)delete v[h];else{var D=!1,B=!1;if(b.length=0,null!==u)for(var I=0,M=u;I<M.length;I++){var P;switch((P=M[I]).type){case 20:(y=t.BaseObject.borrowObject(t.SlotDislayTimelineState)).slot=A,y.init(this._armature,this,P),this._slotTimelines.push(y),D=!0;break;case 21:(y=t.BaseObject.borrowObject(t.SlotColorTimelineState)).slot=A,y.init(this._armature,this,P),this._slotTimelines.push(y),B=!0;break;case 22:(y=t.BaseObject.borrowObject(t.DeformTimelineState)).slot=A,y.init(this._armature,this,P),this._slotTimelines.push(y),b.push(y.vertexOffset)}}if(this.resetToPose&&(D||((y=t.BaseObject.borrowObject(t.SlotDislayTimelineState)).slot=A,y.init(this._armature,this,null),this._slotTimelines.push(y),this._poseTimelines.push(y)),B||((y=t.BaseObject.borrowObject(t.SlotColorTimelineState)).slot=A,y.init(this._armature,this,null),this._slotTimelines.push(y),this._poseTimelines.push(y)),null!==A.rawDisplayDatas))for(var E=0,O=A.rawDisplayDatas;E<O.length;E++){var k=O[E];if(null!==k&&2===k.type){var R=k.vertices.offset;b.indexOf(R)<0&&((y=t.BaseObject.borrowObject(t.DeformTimelineState)).vertexOffset=R,y.slot=A,y.init(this._armature,this,null),this._slotTimelines.push(y),this._poseTimelines.push(y))}}}}for(var p in v)for(var F=0,L=v[p];F<L.length;F++)y=L[F],this._slotTimelines.splice(this._slotTimelines.indexOf(y),1),y.returnToPool()},r.prototype._advanceFadeTime=function(e){var i,n=this._fadeState>0;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;r<s;++r)this._boneMask[r]=n.boneMask[r]}this._actionTimeline=t.BaseObject.borrowObject(t.ActionTimelineState),this._actionTimeline.init(this._armature,this,this._animationData.actionTimeline),this._actionTimeline.currentTime=this._time,this._actionTimeline.currentTime<0&&(this._actionTimeline.currentTime=this._duration-this._actionTimeline.currentTime),null!==this._animationData.zOrderTimeline&&(this._zOrderTimeline=t.BaseObject.borrowObject(t.ZOrderTimelineState),this._zOrderTimeline.init(this._armature,this,this._animationData.zOrderTimeline))}},r.prototype.advanceTime=function(e,i){if(this._blendState.dirty=!1,0===this._fadeState&&0===this._subFadeState||this._advanceFadeTime(e),3===this._playheadState&&(1!==this.timeScale&&(e*=this.timeScale),this._time+=e),0!==this._timelineDirty&&(2===this._timelineDirty&&this._updateTimelines(),this._timelineDirty=0,this._updateBoneAndSlotTimelines()),0!==this.weight){var n=0===this._fadeState&&i>0,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;u<l;++u)(p=this._boneTimelines[u]).playState<=0&&p.update(a),(u===l-1||p.bone!==this._boneTimelines[u+1].bone)&&0!==(c=p.bone._blendState.update(this._weightResult,this.layer))&&p.blend(c);for(u=0,l=this._surfaceTimelines.length;u<l;++u){var c=(p=this._surfaceTimelines[u]).surface._blendState.update(this._weightResult,this.layer);p.playState<=0&&p.update(a),0!==c&&p.blend(c)}if(this.displayControl)for(u=0,l=this._slotTimelines.length;u<l;++u){var f=(p=this._slotTimelines[u]).slot.displayController;null!==f&&f!==this.name&&f!==this.group||p.playState<=0&&p.update(a)}for(u=0,l=this._constraintTimelines.length;u<l;++u)(p=this._constraintTimelines[u]).playState<=0&&p.update(a);for(u=0,l=this._animationTimelines.length;u<l;++u)c=(p=this._animationTimelines[u]).animationState._blendState.update(this._weightResult,this.layer),p.playState<=0&&p.update(a),0!==c&&p.blend(c)}if(0===this._fadeState){if(this._subFadeState>0&&(this._subFadeState=0,this._poseTimelines.length>0)){for(var _=0,d=this._poseTimelines;_<d.length;_++){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;i<n.length;i++)(f=n[i]).fadeOut();for(var r=0,s=this._surfaceTimelines;r<s.length;r++)(f=s[r]).fadeOut();for(var a=0,o=this._slotTimelines;a<o.length;a++)(f=o[a]).fadeOut();for(var h=0,u=this._constraintTimelines;h<u.length;h++)(f=u[h]).fadeOut();for(var l=0,c=this._animationTimelines;l<c.length;l++){var f;(f=c[l]).animationState.fadeOut(t,e),f.fadeOut()}}this.displayControl=!1,this.fadeTotalTime=this._fadeProgress>1e-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<r.length;n++){var s=r[n];this._boneMask.indexOf(s.name)<0&&i.contains(s)&&this._boneMask.push(s.name)}this._timelineDirty=1}},r.prototype.removeBoneMask=function(t,e){void 0===e&&(e=!0);var i=this._boneMask.indexOf(t);if(i>=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<a.length;s++){var o=a[s],h=this._boneMask.indexOf(o.name);h>=0&&n.contains(o)&&this._boneMask.splice(h,1)}else for(var u=0,l=r;u<l.length;u++)(o=l[u])!==n&&(n.contains(o)||this._boneMask.push(o.name))}}this._timelineDirty=1},r.prototype.removeAllBoneMask=function(){this._boneMask.length=0,this._timelineDirty=1},Object.defineProperty(r.prototype,"isFadeIn",{get:function(){return this._fadeState<0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isFadeOut",{get:function(){return this._fadeState>0},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._duration<t)&&(t=t%this._duration+e*this._duration)<0&&(t+=this._duration),this.playTimes>0&&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;i<n.length;i++)n[i].playState=-1;for(var r=0,s=this._slotTimelines;r<s.length;r++)s[r].playState=-1}},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"animationData",{get:function(){return this._animationData},enumerable:!0,configurable:!0}),r}(t.BaseObject);t.AnimationState=e;var i=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.current=new t.Transform,i.delta=new t.Transform,i.result=new t.Transform,i}return nit(i,e),i.toString=function(){return"[class dragonBones.BonePose]"},i.prototype._onClear=function(){this.current.identity(),this.delta.identity(),this.result.identity()},i}(t.BaseObject);t.BonePose=i;var n=function(){function t(){}return t.prototype.update=function(t,e){if(this.dirty){if(!(this.leftWeight>0))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}(rit),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return nit(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 nit(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.currentPlayTimes<this._animationState.playTimes-1))if(this._tweenType=this._frameArray[this._frameOffset+1],this._tweenState=0===this._tweenType?1:2,2===this._tweenType?this._curveCount=this._frameArray[this._frameOffset+2]:0!==this._tweenType&&1!==this._tweenType&&(this._tweenEasing=.01*this._frameArray[this._frameOffset+2]),this._framePosition=this._frameArray[this._frameOffset]*this._frameRateR,this._frameIndex===this._frameCount-1)this._frameDurationR=1/(this._animationData.duration-this._framePosition);else{var t=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5+this._frameIndex+1],e=this._frameArray[t]*this._frameRateR-this._framePosition;this._frameDurationR=e>0?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 nit(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 nit(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 nit(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this.constraint=null},e}(i);t.ConstraintTimelineState=s}(rit),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return nit(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;a<r;++a){var o=s[this._frameArray[n+2+a]];if(0===o.type)(h=t.BaseObject.borrowObject(t.EventObject)).time=this._frameArray[n]/this._frameRate,h.animationState=this._animationState,t.EventObject.actionDataToInstance(o,h,this._armature),this._armature._bufferAction(h,!0);else{var h,u=10===o.type?t.EventObject.FRAME_EVENT:t.EventObject.SOUND_EVENT;(11===o.type||i.hasDBEventListener(u))&&((h=t.BaseObject.borrowObject(t.EventObject)).time=this._frameArray[n]/this._frameRate,h.animationState=this._animationState,t.EventObject.actionDataToInstance(o,h,this._armature),this._armature._dragonBones.bufferEvent(h))}}},i.prototype._onArriveAtFrame=function(){},i.prototype._onUpdateFrame=function(){},i.prototype.update=function(e){var i=this.playState,n=this.currentPlayTimes,r=this.currentTime;if(this._setCurrentTime(e)){var s=this._armature.eventDispatcher;if(i<0){if(this.playState===i)return;if(this._animationState.displayControl&&this._animationState.resetToPose&&this._armature._sortZOrder(null,0),n=this.currentPlayTimes,s.hasDBEventListener(t.EventObject.START)){var a=t.BaseObject.borrowObject(t.EventObject);a.type=t.EventObject.START,a.armature=this._armature,a.animationState=this._animationState,this._armature._dragonBones.bufferEvent(a)}}var o=this._animationState.timeScale<0,h=null,u=null;if(this.currentPlayTimes!==n&&(s.hasDBEventListener(t.EventObject.LOOP_COMPLETE)&&((h=t.BaseObject.borrowObject(t.EventObject)).type=t.EventObject.LOOP_COMPLETE,h.armature=this._armature,h.animationState=this._animationState),this.playState>0&&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 _=this._frameIndex;if(this._frameIndex=f,null!==this._timelineArray)if(this._frameOffset=this._animationData.frameOffset+this._timelineArray[l.offset+5+this._frameIndex],o){if(_<0){var d=Math.floor(r*this._frameRate);_=this._frameIndices[l.frameIndicesOffset+d],this.currentPlayTimes===n&&_===f&&(_=-1)}for(;_>=0;){var p=this._animationData.frameOffset+this._timelineArray[l.offset+5+_],m=this._frameArray[p]/this._frameRate;if(this._position<=m&&m<=this._position+this._duration&&this._onCrossFrame(_),null!==h&&0===_&&(this._armature._dragonBones.bufferEvent(h),h=null),_>0?_--:_=this._frameCount-1,_===f)break}}else for(_<0&&(d=Math.floor(r*this._frameRate),_=this._frameIndices[l.frameIndicesOffset+d],p=this._animationData.frameOffset+this._timelineArray[l.offset+5+_],m=this._frameArray[p]/this._frameRate,this.currentPlayTimes===n&&(r<=m?_>0?_--:_=this._frameCount-1:_===f&&(_=-1)));_>=0&&(_<this._frameCount-1?_++:_=0,p=this._animationData.frameOffset+this._timelineArray[l.offset+5+_],m=this._frameArray[p]/this._frameRate,this._position<=m&&m<=this._position+this._duration&&this._onCrossFrame(_),null!==h&&0===_&&(this._armature._dragonBones.bufferEvent(h),h=null),_!==f););}}else this._frameIndex<0&&(this._frameIndex=0,null!==this._timelineData)&&(this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5],m=this._frameArray[this._frameOffset]/this._frameRate,this.currentPlayTimes===n?r<=m&&this._onCrossFrame(this._frameIndex):this._position<=m&&(o||null===h||(this._armature._dragonBones.bufferEvent(h),h=null),this._onCrossFrame(this._frameIndex)));null!==h&&this._armature._dragonBones.bufferEvent(h),null!==u&&this._armature._dragonBones.bufferEvent(u)}},i.prototype.setCurrentTime=function(t){this._setCurrentTime(t),this._frameIndex=-1},i}(t.TimelineState);t.ActionTimelineState=e;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return nit(e,t),e.toString=function(){return"[class dragonBones.ZOrderTimelineState]"},e.prototype._onArriveAtFrame=function(){this.playState>=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 nit(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 nit(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 nit(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 nit(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 nit(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<this._valueCount;++s)this._delta[s]=n[r+s]*i-(this._current[s]=n[e+s]*i)}else for(s=0;s<this._valueCount;++s)this._current[s]=n[e+s]*i}else for(s=0;s<this._valueCount;++s)this._current[s]=0},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this),this.surface._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0);for(var e=0;e<this._valueCount;++e)this._result[e]=this._current[e]+this._delta[e]*this._tweenProgress},e.prototype.init=function(e,i,n){if(t.prototype.init.call(this,e,i,n),null!==this._timelineData){var r=this._animationData.frameIntOffset+this._timelineArray[this._timelineData.offset+3];this._deformCount=this._frameIntArray[r+1],this._valueCount=this._frameIntArray[r+2],this._valueOffset=this._frameIntArray[r+3],this._frameFloatOffset=this._frameIntArray[r+4]+this._animationData.frameFloatOffset}else this._deformCount=this.surface._deformVertices.length,this._valueCount=this._deformCount,this._valueOffset=0,this._frameFloatOffset=0;this._current.length=this._valueCount,this._delta.length=this._valueCount,this._result.length=this._valueCount;for(var s=0;s<this._valueCount;++s)this._delta[s]=0},e.prototype.blend=function(t){for(var e=this.surface._blendState.blendWeight,i=this.surface._deformVertices,n=0;n<this._deformCount;++n){var r;r=n<this._valueOffset?this._frameFloatArray[this._frameFloatOffset+n]:n<this._valueOffset+this._valueCount?this._result[n-this._valueOffset]:this._frameFloatArray[this._frameFloatOffset+n-this._valueCount],2===t?i[n]+=r*e:i[n]=1!==e?r*e:r}0===this._animationState._fadeState&&0===this._animationState._subFadeState||(this.surface._transformDirty=!0)},e}(t.TweenTimelineState);t.SurfaceTimelineState=o;var h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return nit(e,t),e.toString=function(){return"[class dragonBones.SlotDislayTimelineState]"},e.prototype._onArriveAtFrame=function(){if(this.playState>=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 nit(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 nit(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<this._valueCount;++s)this._delta[s]=n[r+s]*i-(this._current[s]=n[e+s]*i)}else for(s=0;s<this._valueCount;++s)this._current[s]=n[e+s]*i}else for(s=0;s<this._valueCount;++s)this._current[s]=0},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this),this._dirty=!0,2!==this._tweenState&&(this._tweenState=0);for(var e=0;e<this._valueCount;++e)this._result[e]=this._current[e]+this._delta[e]*this._tweenProgress},e.prototype.init=function(e,i,n){if(t.prototype.init.call(this,e,i,n),null!==this._timelineData){var r=this._animationData.frameIntOffset+this._timelineArray[this._timelineData.offset+3];this.vertexOffset=this._frameIntArray[r+0],this.vertexOffset<0&&(this.vertexOffset+=65536),this._deformCount=this._frameIntArray[r+1],this._valueCount=this._frameIntArray[r+2],this._valueOffset=this._frameIntArray[r+3],this._frameFloatOffset=this._frameIntArray[r+4]+this._animationData.frameFloatOffset}else{var s=this.slot._deformVertices;this._deformCount=null!==s?s.vertices.length:0,this._valueCount=this._deformCount,this._valueOffset=0,this._frameFloatOffset=0}this._current.length=this._valueCount,this._delta.length=this._valueCount,this._result.length=this._valueCount;for(var a=0;a<this._valueCount;++a)this._delta[a]=0},e.prototype.fadeOut=function(){this._tweenState=0,this._dirty=!1},e.prototype.update=function(e){var i=this.slot._deformVertices;if(null!==i&&null!==i.verticesData&&i.verticesData.offset===this.vertexOffset&&(t.prototype.update.call(this,e),0!==this._tweenState||this._dirty)){var n=i.vertices;if(0!==this._animationState._fadeState||0!==this._animationState._subFadeState){for(var r=Math.pow(this._animationState._fadeProgress,2),s=0;s<this._deformCount;++s)s<this._valueOffset?n[s]+=(this._frameFloatArray[this._frameFloatOffset+s]-n[s])*r:s<this._valueOffset+this._valueCount?n[s]+=(this._result[s-this._valueOffset]-n[s])*r:n[s]+=(this._frameFloatArray[this._frameFloatOffset+s-this._valueCount]-n[s])*r;i.verticesDirty=!0}else if(this._dirty){for(this._dirty=!1,s=0;s<this._deformCount;++s)s<this._valueOffset?n[s]=this._frameFloatArray[this._frameFloatOffset+s]:s<this._valueOffset+this._valueCount?n[s]=this._result[s-this._valueOffset]:n[s]=this._frameFloatArray[this._frameFloatOffset+s-this._valueCount];i.verticesDirty=!0}}},e}(t.SlotTimelineState);t.DeformTimelineState=l;var c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return nit(e,t),e.toString=function(){return"[class dragonBones.IKConstraintTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this._current=0,this._delta=0},e.prototype._onArriveAtFrame=function(){t.prototype._onArriveAtFrame.call(this);var e=this.constraint;if(null!==this._timelineData){var i=this._animationData.frameIntOffset+this._frameValueOffset+2*this._frameIndex,n=this._frameIntArray,r=0!==n[i++];this._current=.01*n[i++],2===this._tweenState?(this._frameIndex===this._frameCount-1&&(i=this._animationData.frameIntOffset+this._frameValueOffset),this._delta=.01*n[i+1]-this._current):this._delta=0,e._bendPositive=r}else{var s=e._constraintData;this._current=s.weight,this._delta=0,e._bendPositive=s.bendPositive}e.invalidUpdate()},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this),2!==this._tweenState&&(this._tweenState=0);var e=this.constraint;e._weight=this._current+this._delta*this._tweenProgress,e.invalidUpdate()},e}(t.ConstraintTimelineState);t.IKConstraintTimelineState=c;var f=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._floats=[0,0,0,0,0,0],e}return nit(e,t),e.toString=function(){return"[class dragonBones.AnimationTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.animationState=null},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameIntOffset+this._frameValueOffset+2*this._frameIndex,i=1/this.animationState._animationData.parent.frameRate,n=this._frameIntArray;this._floats[0]=n[e++]*i,this._floats[3]=.01*n[e++],2===this._tweenState?(this._frameIndex===this._frameCount-1&&(e=this._animationData.frameIntOffset+this._frameValueOffset),this._floats[1]=n[e++]*i-this._floats[0],this._floats[4]=.01*n[e++]-this._floats[3]):(this._floats[1]=0,this._floats[4]=0)}},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this),2!==this._tweenState&&(this._tweenState=0),this._floats[0]>=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}(rit),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return nit(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}(rit),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;a<o;a++){var h=s[a],u=h[e.NAME],l=new t.Rectangle,c=null;l.x=h[e.X]/n,l.y=h[e.Y]/n,l.width=h[e.WIDTH]/n,l.height=h[e.HEIGHT]/n,e.FRAME_WIDTH in h&&((c=new t.Rectangle).x=h[e.FRAME_X]/n,c.y=h[e.FRAME_Y]/n,c.width=h[e.FRAME_WIDTH]/n,c.height=h[e.FRAME_HEIGHT]/n),r[u]={region:l,frame:c,rotated:!1}}return r},e.DATA_VERSION_2_3="2.3",e.DATA_VERSION_3_0="3.0",e.DATA_VERSION_4_0="4.0",e.DATA_VERSION_4_5="4.5",e.DATA_VERSION_5_0="5.0",e.DATA_VERSION_5_5="5.5",e.DATA_VERSION=e.DATA_VERSION_5_5,e.DATA_VERSIONS=[e.DATA_VERSION_4_0,e.DATA_VERSION_4_5,e.DATA_VERSION_5_0,e.DATA_VERSION_5_5],e.TEXTURE_ATLAS="textureAtlas",e.SUB_TEXTURE="SubTexture",e.FORMAT="format",e.IMAGE_PATH="imagePath",e.WIDTH="width",e.HEIGHT="height",e.ROTATED="rotated",e.FRAME_X="frameX",e.FRAME_Y="frameY",e.FRAME_WIDTH="frameWidth",e.FRAME_HEIGHT="frameHeight",e.DRADON_BONES="dragonBones",e.USER_DATA="userData",e.ARMATURE="armature",e.BONE="bone",e.SURFACE="surface",e.SLOT="slot",e.CONSTRAINT="constraint",e.IK="ik",e.PATH_CONSTRAINT="path",e.SKIN="skin",e.DISPLAY="display",e.ANIMATION="animation",e.Z_ORDER="zOrder",e.FFD="ffd",e.FRAME="frame",e.TRANSLATE_FRAME="translateFrame",e.ROTATE_FRAME="rotateFrame",e.SCALE_FRAME="scaleFrame",e.DISPLAY_FRAME="displayFrame",e.COLOR_FRAME="colorFrame",e.DEFAULT_ACTIONS="defaultActions",e.ACTIONS="actions",e.EVENTS="events",e.INTS="ints",e.FLOATS="floats",e.STRINGS="strings",e.CANVAS="canvas",e.TRANSFORM="transform",e.PIVOT="pivot",e.AABB="aabb",e.COLOR="color",e.VERSION="version",e.COMPATIBLE_VERSION="compatibleVersion",e.FRAME_RATE="frameRate",e.TYPE="type",e.SUB_TYPE="subType",e.NAME="name",e.PARENT="parent",e.TARGET="target",e.STAGE="stage",e.SHARE="share",e.PATH="path",e.LENGTH="length",e.DISPLAY_INDEX="displayIndex",e.BLEND_MODE="blendMode",e.INHERIT_TRANSLATION="inheritTranslation",e.INHERIT_ROTATION="inheritRotation",e.INHERIT_SCALE="inheritScale",e.INHERIT_REFLECTION="inheritReflection",e.INHERIT_ANIMATION="inheritAnimation",e.INHERIT_DEFORM="inheritDeform",e.SEGMENT_X="segmentX",e.SEGMENT_Y="segmentY",e.BEND_POSITIVE="bendPositive",e.CHAIN="chain",e.WEIGHT="weight",e.FADE_IN_TIME="fadeInTime",e.PLAY_TIMES="playTimes",e.SCALE="scale",e.OFFSET="offset",e.POSITION="position",e.DURATION="duration",e.TWEEN_EASING="tweenEasing",e.TWEEN_ROTATE="tweenRotate",e.TWEEN_SCALE="tweenScale",e.CLOCK_WISE="clockwise",e.CURVE="curve",e.SOUND="sound",e.EVENT="event",e.ACTION="action",e.X="x",e.Y="y",e.SKEW_X="skX",e.SKEW_Y="skY",e.SCALE_X="scX",e.SCALE_Y="scY",e.VALUE="value",e.ROTATE="rotate",e.SKEW="skew",e.ALPHA_OFFSET="aO",e.RED_OFFSET="rO",e.GREEN_OFFSET="gO",e.BLUE_OFFSET="bO",e.ALPHA_MULTIPLIER="aM",e.RED_MULTIPLIER="rM",e.GREEN_MULTIPLIER="gM",e.BLUE_MULTIPLIER="bM",e.UVS="uvs",e.VERTICES="vertices",e.TRIANGLES="triangles",e.WEIGHTS="weights",e.SLOT_POSE="slotPose",e.BONE_POSE="bonePose",e.GLUE_WEIGHTS="glueWeights",e.GLUE_MESHES="glueMeshes",e.BONES="bones",e.POSITION_MODE="positionMode",e.SPACING_MODE="spacingMode",e.ROTATE_MODE="rotateMode",e.SPACING="spacing",e.ROTATE_OFFSET="rotateOffset",e.ROTATE_MIX="rotateMix",e.TRANSLATE_MIX="translateMix",e.TARGET_DISPLAY="targetDisplay",e.CLOSED="closed",e.CONSTANT_SPEED="constantSpeed",e.VERTEX_COUNT="vertexCount",e.LENGTHS="lengths",e.GOTO_AND_PLAY="gotoAndPlay",e.DEFAULT_NAME="default",e}();t.DataParser=e}(rit),function(t){var e=function(e){function n(){var i=null!==e&&e.apply(this,arguments)||this;return i._rawTextureAtlasIndex=0,i._rawBones=[],i._data=null,i._armature=null,i._bone=null,i._surface=null,i._slot=null,i._skin=null,i._mesh=null,i._animation=null,i._timeline=null,i._rawTextureAtlases=null,i._defaultColorOffset=-1,i._prevClockwise=0,i._prevRotation=0,i._helpMatrixA=new t.Matrix,i._helpMatrixB=new t.Matrix,i._helpTransform=new t.Transform,i._helpColorTransform=new t.ColorTransform,i._helpPoint=new t.Point,i._helpArray=[],i._intArray=[],i._floatArray=[],i._frameIntArray=[],i._frameFloatArray=[],i._frameArray=[],i._timelineArray=[],i._cacheRawMeshes=[],i._cacheMeshes=[],i._actionFrames=[],i._weightSlotPose={},i._weightBonePoses={},i._cacheBones={},i._slotChildActions={},i}return nit(n,e),n._getBoolean=function(t,e,i){if(e in t){var n=t[e],r=typeof n;if("boolean"===r)return n;if("string"!==r)return!!n;switch(n){case"0":case"NaN":case"":case"false":case"null":case"undefined":return!1;default:return!0}}return i},n._getNumber=function(t,e,i){if(e in t){var n=t[e];return null===n||"NaN"===n?i:+n||0}return i},n._getString=function(e,i,n){if(i in e){var r=e[i];if("string"==typeof r){if(t.DragonBones.webAssembly)for(var s=0,a=r.length;s<a;++s)if(r.charCodeAt(s)>255)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,_=l*c,d=3*h*c,p=3*l*f,m=h*f;u.x=_*t+d*i+p*r+m*a,u.y=_*e+d*n+p*s+m*o},n.prototype._samplingEasingCurve=function(t,e){for(var i=t.length,n=-2,r=0,s=e.length;r<s;++r){for(var a=(r+1)/(s+1);(n+6<i?t[n+6]:1)<a;)n+=6;for(var o=n>=0&&n+6<i,h=o?t[n]:0,u=o?t[n+1]:0,l=t[n+2],c=t[n+3],f=t[n+4],_=t[n+5],d=o?t[n+6]:1,p=o?t[n+7]:1,m=0,g=1;g-m>1e-4;){var y=.5*(g+m);this._getCurvePoint(h,u,l,c,f,_,d,p,y,this._helpPoint),a-this._helpPoint.x>0?m=y:g=y}e[r]=this._helpPoint.y}},n.prototype._parseActionDataInFrame=function(e,i,n,r){t.DataParser.EVENT in e&&this._mergeActionFrame(e[t.DataParser.EVENT],i,10,n,r),t.DataParser.SOUND in e&&this._mergeActionFrame(e[t.DataParser.SOUND],i,11,n,r),t.DataParser.ACTION in e&&this._mergeActionFrame(e[t.DataParser.ACTION],i,0,n,r),t.DataParser.EVENTS in e&&this._mergeActionFrame(e[t.DataParser.EVENTS],i,10,n,r),t.DataParser.ACTIONS in e&&this._mergeActionFrame(e[t.DataParser.ACTIONS],i,0,n,r)},n.prototype._mergeActionFrame=function(e,n,r,s,a){for(var o=t.DragonBones.webAssembly?this._armature.actions.size():this._armature.actions.length,h=this._parseActionData(e,r,s,a),u=0,l=null,c=0,f=h;c<f.length;c++){var _=f[c];this._armature.addAction(_,!1)}0===this._actionFrames.length&&((l=new i).frameStart=0,this._actionFrames.push(l),l=null);for(var d=0,p=this._actionFrames;d<p.length;d++){var m=p[d];if(m.frameStart===n){l=m;break}if(m.frameStart>n)break;u++}null===l&&((l=new i).frameStart=n,this._actionFrames.splice(u+1,0,l));for(var g=0;g<h.length;++g)l.actions.push(o+g)},n.prototype._parseArmature=function(e,i){var r=t.BaseObject.borrowObject(t.ArmatureData);if(r.name=n._getString(e,t.DataParser.NAME,""),r.frameRate=n._getNumber(e,t.DataParser.FRAME_RATE,this._data.frameRate),r.scale=i,t.DataParser.TYPE in e&&"string"==typeof e[t.DataParser.TYPE]?r.type=t.DataParser._getArmatureType(e[t.DataParser.TYPE]):r.type=n._getNumber(e,t.DataParser.TYPE,0),0===r.frameRate&&(r.frameRate=24),this._armature=r,t.DataParser.CANVAS in e){var s=e[t.DataParser.CANVAS],a=t.BaseObject.borrowObject(t.CanvasData);t.DataParser.COLOR in s?a.hasBackground=!0:a.hasBackground=!1,a.color=n._getNumber(s,t.DataParser.COLOR,0),a.x=n._getNumber(s,t.DataParser.X,0)*r.scale,a.y=n._getNumber(s,t.DataParser.Y,0)*r.scale,a.width=n._getNumber(s,t.DataParser.WIDTH,0)*r.scale,a.height=n._getNumber(s,t.DataParser.HEIGHT,0)*r.scale,r.canvas=a}if(t.DataParser.AABB in e){var o=e[t.DataParser.AABB];r.aabb.x=n._getNumber(o,t.DataParser.X,0)*r.scale,r.aabb.y=n._getNumber(o,t.DataParser.Y,0)*r.scale,r.aabb.width=n._getNumber(o,t.DataParser.WIDTH,0)*r.scale,r.aabb.height=n._getNumber(o,t.DataParser.HEIGHT,0)*r.scale}if(t.DataParser.BONE in e)for(var h=0,u=e[t.DataParser.BONE];h<u.length;h++){var l=u[h],c=n._getString(l,t.DataParser.PARENT,""),f=this._parseBone(l);if(c.length>0){var _=r.getBone(c);null!==_?f.parent=_:(c in this._cacheBones||(this._cacheBones[c]=[]),this._cacheBones[c].push(f))}if(f.name in this._cacheBones){for(var d=0,p=this._cacheBones[f.name];d<p.length;d++)p[d].parent=f;delete this._cacheBones[f.name]}r.addBone(f),this._rawBones.push(f)}if(t.DataParser.IK in e)for(var m=0,g=e[t.DataParser.IK];m<g.length;m++){var y=g[m];(B=this._parseIKConstraint(y))&&r.addConstraint(B)}if(r.sortBones(),t.DataParser.SLOT in e)for(var v=0,b=0,S=e[t.DataParser.SLOT];b<S.length;b++){var w=S[b];r.addSlot(this._parseSlot(w,v++))}if(t.DataParser.SKIN in e)for(var x=0,T=e[t.DataParser.SKIN];x<T.length;x++){var A=T[x];r.addSkin(this._parseSkin(A))}if(t.DataParser.PATH_CONSTRAINT in e)for(var C=0,D=e[t.DataParser.PATH_CONSTRAINT];C<D.length;C++){var B,I=D[C];(B=this._parsePathConstraint(I))&&r.addConstraint(B)}for(var M=0,P=this._cacheRawMeshes.length;M<P;++M){var E=this._cacheRawMeshes[M];t.DataParser.GLUE_WEIGHTS in E&&t.DataParser.GLUE_MESHES in E&&this._parseMeshGlue(E,this._cacheMeshes[M])}for(M=0,P=this._cacheRawMeshes.length;M<P;++M){var O=this._cacheRawMeshes[M],k=n._getString(O,t.DataParser.SHARE,"");if(0!==k.length){var R=n._getString(O,t.DataParser.SKIN,t.DataParser.DEFAULT_NAME);0===R.length&&(R=t.DataParser.DEFAULT_NAME);var F=r.getMesh(R,"",k);null!==F&&this._cacheMeshes[M].vertices.shareFrom(F.vertices)}}if(t.DataParser.ANIMATION in e)for(var L=0,V=e[t.DataParser.ANIMATION];L<V.length;L++){var N=V[L],z=this._parseAnimation(N);r.addAnimation(z)}if(t.DataParser.DEFAULT_ACTIONS in e)for(var U=0,G=this._parseActionData(e[t.DataParser.DEFAULT_ACTIONS],0,null,null);U<G.length;U++){var H=G[U];r.addAction(H,!0),0===H.type&&null!==(z=r.getAnimation(H.name))&&(r.defaultAnimation=z)}if(t.DataParser.ACTIONS in e)for(var W=0,j=this._parseActionData(e[t.DataParser.ACTIONS],0,null,null);W<j.length;W++)H=j[W],r.addAction(H,!1);for(var q in this._rawBones.length=0,this._cacheRawMeshes.length=0,this._cacheMeshes.length=0,this._armature=null,this._weightSlotPose)delete this._weightSlotPose[q];for(var q in this._weightBonePoses)delete this._weightBonePoses[q];for(var q in this._cacheBones)delete this._cacheBones[q];for(var q in this._slotChildActions)delete this._slotChildActions[q];return r},n.prototype._parseBone=function(e){var i=this._armature.scale;if(0===(t.DataParser.TYPE in e&&"string"==typeof e[t.DataParser.TYPE]?t.DataParser._getBoneType(e[t.DataParser.TYPE]):n._getNumber(e,t.DataParser.TYPE,0))){var r=t.BaseObject.borrowObject(t.BoneData);return r.inheritTranslation=n._getBoolean(e,t.DataParser.INHERIT_TRANSLATION,!0),r.inheritRotation=n._getBoolean(e,t.DataParser.INHERIT_ROTATION,!0),r.inheritScale=n._getBoolean(e,t.DataParser.INHERIT_SCALE,!0),r.inheritReflection=n._getBoolean(e,t.DataParser.INHERIT_REFLECTION,!0),r.length=n._getNumber(e,t.DataParser.LENGTH,0)*i,r.name=n._getString(e,t.DataParser.NAME,""),t.DataParser.TRANSFORM in e&&this._parseTransform(e[t.DataParser.TRANSFORM],r.transform,i),r}var s=t.BaseObject.borrowObject(t.SurfaceData);if(s.name=n._getString(e,t.DataParser.NAME,""),s.segmentX=n._getNumber(e,t.DataParser.SEGMENT_X,0),s.segmentY=n._getNumber(e,t.DataParser.SEGMENT_Y,0),s.vertices.length=(s.segmentX+1)*(s.segmentY+1)*2,t.DataParser.VERTICES in e)for(var a=e[t.DataParser.VERTICES],o=0,h=s.vertices.length;o<h;++o)o<a.length?s.vertices[o]=a[o]*i:s.vertices[o]=0;return s},n.prototype._parseIKConstraint=function(e){var i=this._armature.getBone(n._getString(e,t.DataParser.BONE,""));if(null===i)return null;var r=this._armature.getBone(n._getString(e,t.DataParser.TARGET,""));if(null===r)return null;var s=t.BaseObject.borrowObject(t.IKConstraintData);return s.scaleEnabled=n._getBoolean(e,t.DataParser.SCALE,!1),s.bendPositive=n._getBoolean(e,t.DataParser.BEND_POSITIVE,!0),s.weight=n._getNumber(e,t.DataParser.WEIGHT,1),s.name=n._getString(e,t.DataParser.NAME,""),s.type=0,s.target=r,n._getNumber(e,t.DataParser.CHAIN,0)>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;h<u.length;h++){var l=u[h],c=this._armature.getBone(l);null!==c&&(o.AddBone(c),null===o.root&&(o.root=c))}return o},n.prototype._parseSlot=function(e,i){var r=t.BaseObject.borrowObject(t.SlotData);return r.displayIndex=n._getNumber(e,t.DataParser.DISPLAY_INDEX,0),r.zOrder=i,r.name=n._getString(e,t.DataParser.NAME,""),r.parent=this._armature.getBone(n._getString(e,t.DataParser.PARENT,"")),t.DataParser.BLEND_MODE in e&&"string"==typeof e[t.DataParser.BLEND_MODE]?r.blendMode=t.DataParser._getBlendMode(e[t.DataParser.BLEND_MODE]):r.blendMode=n._getNumber(e,t.DataParser.BLEND_MODE,0),t.DataParser.COLOR in e?(r.color=t.SlotData.createColor(),this._parseColorTransform(e[t.DataParser.COLOR],r.color)):r.color=t.SlotData.DEFAULT_COLOR,t.DataParser.ACTIONS in e&&(this._slotChildActions[r.name]=this._parseActionData(e[t.DataParser.ACTIONS],0,null,null)),r},n.prototype._parseSkin=function(e){var i=t.BaseObject.borrowObject(t.SkinData);if(i.name=n._getString(e,t.DataParser.NAME,t.DataParser.DEFAULT_NAME),0===i.name.length&&(i.name=t.DataParser.DEFAULT_NAME),t.DataParser.SLOT in e){var r=e[t.DataParser.SLOT];this._skin=i;for(var s=0,a=r;s<a.length;s++){var o=a[s],h=n._getString(o,t.DataParser.NAME,""),u=this._armature.getSlot(h);if(null!==u){if(this._slot=u,t.DataParser.DISPLAY in o)for(var l=0,c=o[t.DataParser.DISPLAY];l<c.length;l++){var f=c[l];f?i.addDisplay(h,this._parseDisplay(f)):i.addDisplay(h,null)}this._slot=null}}this._skin=null}return i},n.prototype._parseDisplay=function(e){var i=n._getString(e,t.DataParser.NAME,""),r=n._getString(e,t.DataParser.PATH,""),s=0,a=null;switch(s=t.DataParser.TYPE in e&&"string"==typeof e[t.DataParser.TYPE]?t.DataParser._getDisplayType(e[t.DataParser.TYPE]):n._getNumber(e,t.DataParser.TYPE,s)){case 0:var o=a=t.BaseObject.borrowObject(t.ImageDisplayData);o.name=i,o.path=r.length>0?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);u<l.length;u++){var c=l[u];h.addAction(c)}else if(this._slot.name in this._slotChildActions){var f=this._skin.getDisplays(this._slot.name);if(null===f?0===this._slot.displayIndex:this._slot.displayIndex===f.length){for(var _=0,d=this._slotChildActions[this._slot.name];_<d.length;_++)c=d[_],h.addAction(c);delete this._slotChildActions[this._slot.name]}}break;case 2:var p=a=t.BaseObject.borrowObject(t.MeshDisplayData);p.vertices.inheritDeform=n._getBoolean(e,t.DataParser.INHERIT_DEFORM,!0),p.name=i,p.path=r.length>0?r:i,p.vertices.data=this._data,t.DataParser.SHARE in e?(this._cacheRawMeshes.push(e),this._cacheMeshes.push(p)):this._parseMesh(e,p),t.DataParser.GLUE_WEIGHTS in e&&t.DataParser.GLUE_MESHES in e&&(this._cacheRawMeshes.push(e),this._cacheMeshes.push(p));break;case 3:var m=this._parseBoundingBox(e);if(null!==m){var g=a=t.BaseObject.borrowObject(t.BoundingBoxDisplayData);g.name=i,g.path=r.length>0?r:i,g.boundingBox=m}break;case 4:var y=e[t.DataParser.LENGTHS],v=a=t.BaseObject.borrowObject(t.PathDisplayData);v.closed=n._getBoolean(e,t.DataParser.CLOSED,!1),v.constantSpeed=n._getBoolean(e,t.DataParser.CONSTANT_SPEED,!1),v.name=i,v.path=r.length>0?r:i,v.vertices.data=this._data,v.curveLengths.length=y.length;for(var b=0,S=y.length;b<S;++b)v.curveLengths[b]=y[b];this._parsePath(e,v)}return null!==a&&t.DataParser.TRANSFORM in e&&this._parseTransform(e[t.DataParser.TRANSFORM],a.transform,this._armature.scale),a},n.prototype._parsePath=function(e,i){var r=e[t.DataParser.VERTICES],s=n._getNumber(e,t.DataParser.VERTEX_COUNT,0),a=this._floatArray.length,o=this._intArray.length;if(i.vertices.offset=o,this._intArray.length+=2,this._intArray[o+0]=s,this._intArray[o+2]=a,t.DataParser.WEIGHTS in e){var h=e[t.DataParser.WEIGHTS],u=e[t.DataParser.BONES],l=u.length,c=Math.floor(h.length-s)/2,f=this._intArray.length,_=this._floatArray.length,d=this._armature.sortedBones,p=t.BaseObject.borrowObject(t.WeightData);for(p.count=c,p.offset=f,this._intArray.length+=2+l+s+c,this._intArray[f+0]=l,this._intArray[f+1]=_,B=0;B<l;B++){var m=u[B],g=this._rawBones[m];p.addBone(g),this._intArray[f+2+B]=d.indexOf(g)}this._floatArray.length+=3*c,B=0;for(var y=0,v=0,b=f+2+l,S=_;B<c;B++){var w=h[y++];this._intArray[b++]=w;for(var x=0;x<w;x++){var T=h[y++],A=h[y++],C=r[v++],D=r[v++];this._intArray[b++]=u.indexOf(T),this._floatArray[S++]=A,this._floatArray[S++]=C,this._floatArray[S++]=D}}i.vertices.weight=p}else{this._floatArray.length+=r.length;for(var B=0,I=r.length;B<I;++B)this._floatArray[a+B]=r[B]}},n.prototype._parsePivot=function(e,i){if(t.DataParser.PIVOT in e){var r=e[t.DataParser.PIVOT];i.pivot.x=n._getNumber(r,t.DataParser.X,0),i.pivot.y=n._getNumber(r,t.DataParser.Y,0)}else i.pivot.x=.5,i.pivot.y=.5},n.prototype._parseMesh=function(e,i){var n=e[t.DataParser.VERTICES],r=e[t.DataParser.UVS],s=e[t.DataParser.TRIANGLES],a=Math.floor(n.length/2),o=Math.floor(s.length/3),h=this._floatArray.length,u=h+2*a,l=this._intArray.length,c=this._skin.name+"_"+this._slot.name+"_"+i.name;i.vertices.offset=l,this._intArray.length+=4+3*o,this._intArray[l+0]=a,this._intArray[l+1]=o,this._intArray[l+2]=h;for(var f=0,_=3*o;f<_;++f)this._intArray[l+4+f]=s[f];for(this._floatArray.length+=2*a+2*a,f=0,_=2*a;f<_;++f)this._floatArray[h+f]=n[f],this._floatArray[u+f]=r[f];if(t.DataParser.WEIGHTS in e){var d=e[t.DataParser.WEIGHTS],p=e[t.DataParser.SLOT_POSE],m=e[t.DataParser.BONE_POSE],g=this._armature.sortedBones,y=new Array,v=Math.floor(m.length/7),b=this._floatArray.length,S=Math.floor(d.length-a)/2,w=this._intArray.length,x=t.BaseObject.borrowObject(t.WeightData);for(x.count=S,x.offset=w,y.length=v,this._intArray.length+=2+v+a+S,this._intArray[w+1]=b,f=0;f<v;++f){var T=m[7*f],A=this._rawBones[T];x.addBone(A),y[f]=T,this._intArray[w+2+f]=g.indexOf(A)}this._floatArray.length+=3*S,this._helpMatrixA.copyFromArray(p,0),f=0;for(var C=0,D=w+2+v,B=b;f<a;++f){var I=2*f,M=this._intArray[D++]=d[C++],P=this._floatArray[h+I],E=this._floatArray[h+I+1];this._helpMatrixA.transformPoint(P,E,this._helpPoint),P=this._helpPoint.x,E=this._helpPoint.y;for(var O=0;O<M;++O){T=d[C++];var k=y.indexOf(T);this._helpMatrixB.copyFromArray(m,7*k+1),this._helpMatrixB.invert(),this._helpMatrixB.transformPoint(P,E,this._helpPoint),this._intArray[D++]=k,this._floatArray[B++]=d[C++],this._floatArray[B++]=this._helpPoint.x,this._floatArray[B++]=this._helpPoint.y}}i.vertices.weight=x,this._weightSlotPose[c]=p,this._weightBonePoses[c]=m}},n.prototype._parseMeshGlue=function(){},n.prototype._parseBoundingBox=function(e){var i=null,r=0;switch(r=t.DataParser.SUB_TYPE in e&&"string"==typeof e[t.DataParser.SUB_TYPE]?t.DataParser._getBoundingBoxType(e[t.DataParser.SUB_TYPE]):n._getNumber(e,t.DataParser.SUB_TYPE,r)){case 0:i=t.BaseObject.borrowObject(t.RectangleBoundingBoxData);break;case 1:i=t.BaseObject.borrowObject(t.EllipseBoundingBoxData);break;case 2:i=this._parsePolygonBoundingBox(e)}return null!==i&&(i.color=n._getNumber(e,t.DataParser.COLOR,0),0!==i.type&&1!==i.type||(i.width=n._getNumber(e,t.DataParser.WIDTH,0),i.height=n._getNumber(e,t.DataParser.HEIGHT,0))),i},n.prototype._parsePolygonBoundingBox=function(e){var i=t.BaseObject.borrowObject(t.PolygonBoundingBoxData);if(t.DataParser.VERTICES in e){var n=this._armature.scale,r=e[t.DataParser.VERTICES],s=i.vertices;t.DragonBones.webAssembly?s.resize(r.length,0):s.length=r.length;for(var a=0,o=r.length;a<o;a+=2){var h=r[a]*n,u=r[a+1]*n;t.DragonBones.webAssembly?(s.set(a,h),s.set(a+1,u)):(s[a]=h,s[a+1]=u),0===a?(i.x=h,i.y=u,i.width=h,i.height=u):(h<i.x?i.x=h:h>i.width&&(i.width=h),u<i.y?i.y=u:u>i.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;a<s;++a){var h=r[a];this._parseActionDataInFrame(h,o,null,null),o+=n._getNumber(h,t.DataParser.DURATION,1)}}if(t.DataParser.Z_ORDER in e&&(this._animation.zOrderTimeline=this._parseTimeline(e[t.DataParser.Z_ORDER],null,t.DataParser.FRAME,1,!1,!1,0,this._parseZOrderFrame)),t.DataParser.BONE in e)for(var u=0,l=e[t.DataParser.BONE];u<l.length;u++){var c=l[u];this._parseBoneTimeline(c)}if(t.DataParser.SURFACE in e)for(var f=0,_=e[t.DataParser.SURFACE];f<_.length;f++){c=_[f];var d=n._getString(c,t.DataParser.NAME,"");this._surface=this._armature.getBone(d),null!==this._surface&&(null!==(B=this._parseTimeline(c,null,t.DataParser.FRAME,50,!1,!0,0,this._parseSurfaceFrame))&&this._animation.addSurfaceTimeline(this._surface,B),this._surface=null)}if(t.DataParser.SLOT in e)for(var p=0,m=e[t.DataParser.SLOT];p<m.length;p++)c=m[p],this._parseSlotTimeline(c);if(t.DataParser.FFD in e)for(var g=0,y=e[t.DataParser.FFD];g<y.length;g++){c=y[g];var v=n._getString(c,t.DataParser.SKIN,t.DataParser.DEFAULT_NAME),b=n._getString(c,t.DataParser.SLOT,""),S=n._getString(c,t.DataParser.NAME,"");0===v.length&&(v=t.DataParser.DEFAULT_NAME),this._slot=this._armature.getSlot(b),this._mesh=this._armature.getMesh(v,b,S),null!==this._slot&&null!==this._mesh&&(null!==(B=this._parseTimeline(c,null,t.DataParser.FRAME,22,!1,!0,0,this._parseSlotFFDFrame))&&this._animation.addSlotTimeline(this._slot,B),this._slot=null,this._mesh=null)}if(t.DataParser.IK in e)for(var w=0,x=e[t.DataParser.IK];w<x.length;w++){c=x[w];var T=n._getString(c,t.DataParser.NAME,""),A=this._armature.getConstraint(T);null!==A&&null!==(B=this._parseTimeline(c,null,t.DataParser.FRAME,30,!0,!1,2,this._parseIKConstraintFrame))&&this._animation.addConstraintTimeline(A,B)}if(t.DataParser.ANIMATION in e)for(var C=0,D=e[t.DataParser.ANIMATION];C<D.length;C++){c=D[C];var B,I=n._getString(c,t.DataParser.NAME,"");null!==(B=this._parseTimeline(c,null,t.DataParser.FRAME,40,!0,!1,2,this._parseAnimationFrame))&&this._animation.addAnimationTimeline(I,B)}return this._actionFrames.length>0&&(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,_=this._frameFloatArray.length,d=t.BaseObject.borrowObject(t.TimelineData),p=this._timelineArray.length;if(this._timelineArray.length+=5+c,null!==e?(this._timelineArray[p+0]=Math.round(100*n._getNumber(e,t.DataParser.SCALE,1)),this._timelineArray[p+1]=Math.round(100*n._getNumber(e,t.DataParser.OFFSET,0))):(this._timelineArray[p+0]=100,this._timelineArray[p+1]=0),this._timelineArray[p+2]=c,this._timelineArray[p+3]=u,this._timelineArray[p+4]=o?f-this._animation.frameIntOffset:h?_-this._animation.frameFloatOffset:0,this._timeline=d,d.type=a,d.offset=p,1===c)d.frameIndicesOffset=-1,this._timelineArray[p+5+0]=l.call(this,r[0],0,0)-this._animation.frameOffset;else{var m=this._animation.frameCount+1,g=this._data.frameIndices,y=0;t.DragonBones.webAssembly?(y=g.size(),g.resize(y+m,0)):(y=g.length,g.length+=m),d.frameIndicesOffset=y;for(var v=0,b=0,S=0,w=0;v<m;++v){if(S+w<=v&&b<c){var x=r[b];S=v,w=b===c-1?this._animation.frameCount-S:x instanceof i?this._actionFrames[b+1].frameStart-S:n._getNumber(x,t.DataParser.DURATION,1),this._timelineArray[p+5+b]=l.call(this,x,S,w)-this._animation.frameOffset,b++}t.DragonBones.webAssembly?g.set(y+v,b-1):g[y+v]=b-1}}return this._timeline=null,d},n.prototype._parseBoneTimeline=function(e){var i,r=this._armature.getBone(n._getString(e,t.DataParser.NAME,""));null!==r&&(this._bone=r,this._slot=this._armature.getSlot(this._bone.name),t.DataParser.TRANSLATE_FRAME in e&&null!==(i=this._parseTimeline(e,null,t.DataParser.TRANSLATE_FRAME,11,!1,!0,2,this._parseBoneTranslateFrame))&&this._animation.addBoneTimeline(r,i),t.DataParser.ROTATE_FRAME in e&&null!==(i=this._parseTimeline(e,null,t.DataParser.ROTATE_FRAME,12,!1,!0,2,this._parseBoneRotateFrame))&&this._animation.addBoneTimeline(r,i),t.DataParser.SCALE_FRAME in e&&null!==(i=this._parseTimeline(e,null,t.DataParser.SCALE_FRAME,13,!1,!0,2,this._parseBoneScaleFrame))&&this._animation.addBoneTimeline(r,i),t.DataParser.FRAME in e&&null!==(i=this._parseTimeline(e,null,t.DataParser.FRAME,10,!1,!0,6,this._parseBoneAllFrame))&&this._animation.addBoneTimeline(r,i),this._bone=null,this._slot=null)},n.prototype._parseSlotTimeline=function(e){var i=this._armature.getSlot(n._getString(e,t.DataParser.NAME,""));if(null!==i){this._slot=i;var r;null!==(r=t.DataParser.DISPLAY_FRAME in e?this._parseTimeline(e,null,t.DataParser.DISPLAY_FRAME,20,!1,!1,0,this._parseSlotDisplayFrame):this._parseTimeline(e,null,t.DataParser.FRAME,20,!1,!1,0,this._parseSlotDisplayFrame))&&this._animation.addSlotTimeline(i,r);var s;null!==(s=t.DataParser.COLOR_FRAME in e?this._parseTimeline(e,null,t.DataParser.COLOR_FRAME,21,!0,!1,1,this._parseSlotColorFrame):this._parseTimeline(e,null,t.DataParser.FRAME,21,!0,!1,1,this._parseSlotColorFrame))&&this._animation.addSlotTimeline(i,s),this._slot=null}},n.prototype._parseFrame=function(t,e){var i=this._frameArray.length;return this._frameArray.length+=1,this._frameArray[i+0]=e,i},n.prototype._parseTweenFrame=function(e,i,r){var s=this._parseFrame(e,i,r);if(r>0)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;o<a;++o)this._frameArray[s+3+o]=Math.round(1e4*this._helpArray[o])}else{var h=-2;t.DataParser.TWEEN_EASING in e&&(h=n._getNumber(e,t.DataParser.TWEEN_EASING,-2)),-2===h?(this._frameArray.length+=1,this._frameArray[s+1]=0):0===h?(this._frameArray.length+=1,this._frameArray[s+1]=1):h<0?(this._frameArray.length+=2,this._frameArray[s+1]=3,this._frameArray[s+2]=Math.round(100*-h)):h<=1?(this._frameArray.length+=2,this._frameArray[s+1]=4,this._frameArray[s+2]=Math.round(100*h)):(this._frameArray.length+=2,this._frameArray[s+1]=5,this._frameArray[s+2]=Math.round(100*h-100))}else this._frameArray.length+=1,this._frameArray[s+1]=0;return s},n.prototype._parseActionFrame=function(t,e){var i=this._frameArray.length,n=t.actions.length;this._frameArray.length+=2+n,this._frameArray[i+0]=e,this._frameArray[i+0+1]=n;for(var r=0;r<n;++r)this._frameArray[i+0+2+r]=t.actions[r];return i},n.prototype._parseZOrderFrame=function(e,i,n){var r=this._parseFrame(e,i,n);if(t.DataParser.Z_ORDER in e){var s=e[t.DataParser.Z_ORDER];if(s.length>0){for(var a=this._armature.sortedSlots.length,o=new Array(a-s.length/2),h=new Array(a),u=0;u<o.length;++u)o[u]=0;for(var l=0;l<a;++l)h[l]=-1;for(var c=0,f=0,_=0,d=s.length;_<d;_+=2){for(var p=s[_],m=s[_+1];c!==p;)o[f++]=c++;h[c+m]=c++}for(;c<a;)o[f++]=c++;this._frameArray.length+=1+a,this._frameArray[r+1]=a;for(var g=a;g--;)-1===h[g]?this._frameArray[r+2+g]=o[--f]||0:this._frameArray[r+2+g]=h[g]||0;return r}}return this._frameArray.length+=1,this._frameArray[r+1]=0,r},n.prototype._parseBoneAllFrame=function(e,i,r){this._helpTransform.identity(),t.DataParser.TRANSFORM in e&&this._parseTransform(e[t.DataParser.TRANSFORM],this._helpTransform,1);var s=this._helpTransform.rotation;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.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<h||f-h>=o.length?0:o[f-h],c=f+1<h||f+1-h>=o.length?0:o[f+1-h],this._frameFloatArray[s+f]=l,this._frameFloatArray[s+f+1]=c;if(0===i){var _=this._frameIntArray.length;this._frameIntArray.length+=5,this._frameIntArray[_+0]=0,this._frameIntArray[_+1]=this._frameFloatArray.length-s,this._frameIntArray[_+2]=this._frameFloatArray.length-s,this._frameIntArray[_+3]=0,this._frameIntArray[_+4]=s-this._animation.frameFloatOffset,this._timelineArray[this._timeline.offset+3]=_-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,_=0,d=0,p=0;if(null!==c){var m=this._weightSlotPose[l];this._helpMatrixA.copyFromArray(m,0),this._frameFloatArray.length+=2*c.count,d=c.offset+2+c.bones.length}else this._frameFloatArray.length+=2*u;for(var g=0;g<2*u;g+=2)if(null===o?(f=0,_=0):(f=g<h||g-h>=o.length?0:o[g-h],_=g+1<h||g+1-h>=o.length?0:o[g+1-h]),null!==c){var y=this._weightBonePoses[l],v=this._intArray[d++];this._helpMatrixA.transformPoint(f,_,this._helpPoint,!0),f=this._helpPoint.x,_=this._helpPoint.y;for(var b=0;b<v;++b){var S=this._intArray[d++];this._helpMatrixB.copyFromArray(y,7*S+1),this._helpMatrixB.invert(),this._helpMatrixB.transformPoint(f,_,this._helpPoint,!0),this._frameFloatArray[s+p++]=this._helpPoint.x,this._frameFloatArray[s+p++]=this._helpPoint.y}}else this._frameFloatArray[s+g]=f,this._frameFloatArray[s+g+1]=_;if(0===i){var w=this._frameIntArray.length;this._frameIntArray.length+=5,this._frameIntArray[w+0]=this._mesh.vertices.offset,this._frameIntArray[w+1]=this._frameFloatArray.length-s,this._frameIntArray[w+2]=this._frameFloatArray.length-s,this._frameIntArray[w+3]=0,this._frameIntArray[w+4]=s-this._animation.frameFloatOffset,this._timelineArray[this._timeline.offset+3]=w-this._animation.frameIntOffset}return a},n.prototype._parseIKConstraintFrame=function(e,i,r){var s=this._parseTweenFrame(e,i,r),a=this._frameIntArray.length;return this._frameIntArray.length+=2,this._frameIntArray[a++]=n._getBoolean(e,t.DataParser.BEND_POSITIVE,!0)?1:0,this._frameIntArray[a++]=Math.round(100*n._getNumber(e,t.DataParser.WEIGHT,1)),s},n.prototype._parseAnimationFrame=function(e,i,r){var s=this._parseTweenFrame(e,i,r),a=this._frameIntArray.length;return this._frameIntArray.length+=2,this._frameIntArray[a++]=n._getNumber(e,t.DataParser.VALUE,0),this._frameIntArray[a++]=Math.round(100*n._getNumber(e,t.DataParser.WEIGHT,1)),s},n.prototype._parseActionData=function(e,i,r,s){var a=new Array;if("string"==typeof e)(l=t.BaseObject.borrowObject(t.ActionData)).type=i,l.name=e,l.bone=r,l.slot=s,a.push(l);else if(e instanceof Array)for(var o=0,h=e;o<h.length;o++){var u=h[o],l=t.BaseObject.borrowObject(t.ActionData);if(t.DataParser.GOTO_AND_PLAY in u?(l.type=0,l.name=n._getString(u,t.DataParser.GOTO_AND_PLAY,"")):(t.DataParser.TYPE in u&&"string"==typeof u[t.DataParser.TYPE]?l.type=t.DataParser._getActionType(u[t.DataParser.TYPE]):l.type=n._getNumber(u,t.DataParser.TYPE,i),l.name=n._getString(u,t.DataParser.NAME,"")),t.DataParser.BONE in u){var c=n._getString(u,t.DataParser.BONE,"");l.bone=this._armature.getBone(c)}else l.bone=r;if(t.DataParser.SLOT in u){var f=n._getString(u,t.DataParser.SLOT,"");l.slot=this._armature.getSlot(f)}else l.slot=s;var _=null;if(t.DataParser.INTS in u){null===_&&(_=t.BaseObject.borrowObject(t.UserData));for(var d=0,p=u[t.DataParser.INTS];d<p.length;d++){var m=p[d];_.addInt(m)}}if(t.DataParser.FLOATS in u){null===_&&(_=t.BaseObject.borrowObject(t.UserData));for(var g=0,y=u[t.DataParser.FLOATS];g<y.length;g++)m=y[g],_.addFloat(m)}if(t.DataParser.STRINGS in u){null===_&&(_=t.BaseObject.borrowObject(t.UserData));for(var v=0,b=u[t.DataParser.STRINGS];v<b.length;v++)m=b[v],_.addString(m)}l.data=_,a.push(l)}return a},n.prototype._parseTransform=function(e,i,r){i.x=n._getNumber(e,t.DataParser.X,0)*r,i.y=n._getNumber(e,t.DataParser.Y,0)*r,t.DataParser.ROTATE in e||t.DataParser.SKEW in e?(i.rotation=t.Transform.normalizeRadian(n._getNumber(e,t.DataParser.ROTATE,0)*t.Transform.DEG_RAD),i.skew=t.Transform.normalizeRadian(n._getNumber(e,t.DataParser.SKEW,0)*t.Transform.DEG_RAD)):(t.DataParser.SKEW_X in e||t.DataParser.SKEW_Y in e)&&(i.rotation=t.Transform.normalizeRadian(n._getNumber(e,t.DataParser.SKEW_Y,0)*t.Transform.DEG_RAD),i.skew=t.Transform.normalizeRadian(n._getNumber(e,t.DataParser.SKEW_X,0)*t.Transform.DEG_RAD)-i.rotation),i.scaleX=n._getNumber(e,t.DataParser.SCALE_X,1),i.scaleY=n._getNumber(e,t.DataParser.SCALE_Y,1)},n.prototype._parseColorTransform=function(e,i){i.alphaMultiplier=.01*n._getNumber(e,t.DataParser.ALPHA_MULTIPLIER,100),i.redMultiplier=.01*n._getNumber(e,t.DataParser.RED_MULTIPLIER,100),i.greenMultiplier=.01*n._getNumber(e,t.DataParser.GREEN_MULTIPLIER,100),i.blueMultiplier=.01*n._getNumber(e,t.DataParser.BLUE_MULTIPLIER,100),i.alphaOffset=n._getNumber(e,t.DataParser.ALPHA_OFFSET,0),i.redOffset=n._getNumber(e,t.DataParser.RED_OFFSET,0),i.greenOffset=n._getNumber(e,t.DataParser.GREEN_OFFSET,0),i.blueOffset=n._getNumber(e,t.DataParser.BLUE_OFFSET,0)},n.prototype._parseArray=function(){this._intArray.length=0,this._floatArray.length=0,this._frameIntArray.length=0,this._frameFloatArray.length=0,this._frameArray.length=0,this._timelineArray.length=0},n.prototype._modifyArray=function(){this._intArray.length%Int16Array.BYTES_PER_ELEMENT!=0&&this._intArray.push(0),this._frameIntArray.length%Int16Array.BYTES_PER_ELEMENT!=0&&this._frameIntArray.push(0),this._frameArray.length%Int16Array.BYTES_PER_ELEMENT!=0&&this._frameArray.push(0),this._timelineArray.length%Uint16Array.BYTES_PER_ELEMENT!=0&&this._timelineArray.push(0);var e=this._intArray.length*Int16Array.BYTES_PER_ELEMENT,i=this._floatArray.length*Float32Array.BYTES_PER_ELEMENT,n=this._frameIntArray.length*Int16Array.BYTES_PER_ELEMENT,r=this._frameFloatArray.length*Float32Array.BYTES_PER_ELEMENT,s=this._frameArray.length*Int16Array.BYTES_PER_ELEMENT,a=this._timelineArray.length*Uint16Array.BYTES_PER_ELEMENT,o=e+i+n+r+s+a;if(t.DragonBones.webAssembly){for(var h=t.webAssemblyModule.HEAP16.buffer,u=t.webAssemblyModule._malloc(o),l=new Int16Array(h,u,this._intArray.length),c=new Float32Array(h,u+e,this._floatArray.length),f=new Int16Array(h,u+e+i,this._frameIntArray.length),_=new Float32Array(h,u+e+i+n,this._frameFloatArray.length),d=new Int16Array(h,u+e+i+n+r,this._frameArray.length),p=new Uint16Array(h,u+e+i+n+r+s,this._timelineArray.length),m=0,g=this._intArray.length;m<g;++m)l[m]=this._intArray[m];for(m=0,g=this._floatArray.length;m<g;++m)c[m]=this._floatArray[m];for(m=0,g=this._frameIntArray.length;m<g;++m)f[m]=this._frameIntArray[m];for(m=0,g=this._frameFloatArray.length;m<g;++m)_[m]=this._frameFloatArray[m];for(m=0,g=this._frameArray.length;m<g;++m)d[m]=this._frameArray[m];for(m=0,g=this._timelineArray.length;m<g;++m)p[m]=this._timelineArray[m];t.webAssemblyModule.setDataBinary(this._data,u,e,i,n,r,s,a)}else{var y=new ArrayBuffer(o);for(l=new Int16Array(y,0,this._intArray.length),c=new Float32Array(y,e,this._floatArray.length),f=new Int16Array(y,e+i,this._frameIntArray.length),_=new Float32Array(y,e+i+n,this._frameFloatArray.length),d=new Int16Array(y,e+i+n+r,this._frameArray.length),p=new Uint16Array(y,e+i+n+r+s,this._timelineArray.length),m=0,g=this._intArray.length;m<g;++m)l[m]=this._intArray[m];for(m=0,g=this._floatArray.length;m<g;++m)c[m]=this._floatArray[m];for(m=0,g=this._frameIntArray.length;m<g;++m)f[m]=this._frameIntArray[m];for(m=0,g=this._frameFloatArray.length;m<g;++m)_[m]=this._frameFloatArray[m];for(m=0,g=this._frameArray.length;m<g;++m)d[m]=this._frameArray[m];for(m=0,g=this._timelineArray.length;m<g;++m)p[m]=this._timelineArray[m];this._data.binary=y,this._data.intArray=l,this._data.floatArray=c,this._data.frameIntArray=f,this._data.frameFloatArray=_,this._data.frameArray=d,this._data.timelineArray=p}this._defaultColorOffset=-1},n.prototype.parseDragonBonesData=function(e,i){void 0===i&&(i=1),console.assert(null!=e,"Data error.");var r=n._getString(e,t.DataParser.VERSION,""),s=n._getString(e,t.DataParser.COMPATIBLE_VERSION,"");if(t.DataParser.DATA_VERSIONS.indexOf(r)>=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];o<h.length;o++){var u=h[o];a.addArmature(this._parseArmature(u,i))}this._data.binary||this._modifyArray(),t.DataParser.STAGE in e?a.stage=a.getArmature(n._getString(e,t.DataParser.STAGE,"")):a.armatureNames.length>0&&(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;o<h;++o){var u=a[o],l=i.createTexture();l.rotated=n._getBoolean(u,t.DataParser.ROTATED,!1),l.name=n._getString(u,t.DataParser.NAME,""),l.region.x=n._getNumber(u,t.DataParser.X,0),l.region.y=n._getNumber(u,t.DataParser.Y,0),l.region.width=n._getNumber(u,t.DataParser.WIDTH,0),l.region.height=n._getNumber(u,t.DataParser.HEIGHT,0);var c=n._getNumber(u,t.DataParser.FRAME_WIDTH,-1),f=n._getNumber(u,t.DataParser.FRAME_HEIGHT,-1);c>0&&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}(rit),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return nit(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;e<i;++e)if(t.charCodeAt(e)>255)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<o;++u)c+f<=u&&l<s&&(c=this._frameArrayBuffer[this._animation.frameOffset+this._timelineArrayBuffer[r.offset+5+l]],f=l===s-1?this._animation.frameCount-c:this._frameArrayBuffer[this._animation.frameOffset+this._timelineArrayBuffer[r.offset+5+l+1]]-c,l++),t.DragonBones.webAssembly?h.set(a+u,l-1):h[a+u]=l-1}return this._timeline=null,r},i.prototype._parseVertices=function(e,i){i.offset=e[t.DataParser.OFFSET];var n=this._intArrayBuffer[i.offset+3];if(n>=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;o<a;++o){var h=this._intArrayBuffer[n+2+o];r.addBone(this._rawBones[h])}for(var u=n+2+a,l=0,c=(o=0,s);o<c;++o){var f=this._intArrayBuffer[u++];l+=f,u+=f}r.count=l,i.weight=r}},i.prototype._parseMesh=function(t,e){this._parseVertices(t,e.vertices)},i.prototype._parsePath=function(t,e){this._parseVertices(t,e.vertices)},i.prototype._parseAnimation=function(e){var i=t.BaseObject.borrowObject(t.AnimationData);i.frameCount=Math.max(t.ObjectDataParser._getNumber(e,t.DataParser.DURATION,1),1),i.playTimes=t.ObjectDataParser._getNumber(e,t.DataParser.PLAY_TIMES,1),i.duration=i.frameCount/this._armature.frameRate,i.fadeInTime=t.ObjectDataParser._getNumber(e,t.DataParser.FADE_IN_TIME,0),i.scale=t.ObjectDataParser._getNumber(e,t.DataParser.SCALE,1),i.name=t.ObjectDataParser._getString(e,t.DataParser.NAME,t.DataParser.DEFAULT_NAME),0===i.name.length&&(i.name=t.DataParser.DEFAULT_NAME);var n=e[t.DataParser.OFFSET];if(i.frameIntOffset=n[0],i.frameFloatOffset=n[1],i.frameOffset=n[2],this._animation=i,t.DataParser.ACTION in e&&(i.actionTimeline=this._parseBinaryTimeline(0,e[t.DataParser.ACTION])),t.DataParser.Z_ORDER in e&&(i.zOrderTimeline=this._parseBinaryTimeline(1,e[t.DataParser.Z_ORDER])),t.DataParser.BONE in e){var r=e[t.DataParser.BONE];for(var s in r){var a=r[s];t.DragonBones.webAssembly&&(s=this._getUTF16Key(s));var o=this._armature.getBone(s);if(null!==o)for(var h=0,u=a.length;h<u;h+=2){var l=a[h],c=a[h+1],f=this._parseBinaryTimeline(l,c);this._animation.addBoneTimeline(o,f)}}}if(t.DataParser.SURFACE in e)for(var s in r=e[t.DataParser.SURFACE]){a=r[s],t.DragonBones.webAssembly&&(s=this._getUTF16Key(s));var _=this._armature.getBone(s);if(null!==_)for(h=0,u=a.length;h<u;h+=2)l=a[h],c=a[h+1],f=this._parseBinaryTimeline(l,c),this._animation.addSurfaceTimeline(_,f)}if(t.DataParser.SLOT in e)for(var s in r=e[t.DataParser.SLOT]){a=r[s],t.DragonBones.webAssembly&&(s=this._getUTF16Key(s));var d=this._armature.getSlot(s);if(null!==d)for(h=0,u=a.length;h<u;h+=2)l=a[h],c=a[h+1],f=this._parseBinaryTimeline(l,c),this._animation.addSlotTimeline(d,f)}if(t.DataParser.CONSTRAINT in e)for(var s in r=e[t.DataParser.CONSTRAINT]){a=r[s],t.DragonBones.webAssembly&&(s=this._getUTF16Key(s));var p=this._armature.getConstraint(s);if(null!==p)for(h=0,u=a.length;h<u;h+=2)l=a[h],c=a[h+1],f=this._parseBinaryTimeline(l,c),this._animation.addConstraintTimeline(p,f)}if(t.DataParser.ANIMATION in e)for(var s in r=e[t.DataParser.ANIMATION])for(a=r[s],t.DragonBones.webAssembly&&(s=this._getUTF16Key(s)),h=0,u=a.length;h<u;h+=2)l=a[h],c=a[h+1],f=this._parseBinaryTimeline(l,c),this._animation.addAnimationTimeline(s,f);return this._animation=null,i},i.prototype._parseArray=function(e){var i=e[t.DataParser.OFFSET],n=i[1],r=i[3],s=i[5],a=i[7],o=i[9],h=i[11],u=new Int16Array(this._binary,this._binaryOffset+i[0],n/Int16Array.BYTES_PER_ELEMENT),l=new Float32Array(this._binary,this._binaryOffset+i[2],r/Float32Array.BYTES_PER_ELEMENT),c=new Int16Array(this._binary,this._binaryOffset+i[4],s/Int16Array.BYTES_PER_ELEMENT),f=new Float32Array(this._binary,this._binaryOffset+i[6],a/Float32Array.BYTES_PER_ELEMENT),_=new Int16Array(this._binary,this._binaryOffset+i[8],o/Int16Array.BYTES_PER_ELEMENT),d=new Uint16Array(this._binary,this._binaryOffset+i[10],h/Uint16Array.BYTES_PER_ELEMENT);if(t.DragonBones.webAssembly){for(var p=n+r+s+a+o+h,m=t.webAssemblyModule._malloc(p),g=new Uint8Array(this._binary,this._binaryOffset,p/Uint8Array.BYTES_PER_ELEMENT),y=new Uint8Array(t.webAssemblyModule.HEAP16.buffer,m,g.length),v=0,b=g.length;v<b;++v)y[v]=g[v];t.webAssemblyModule.setDataBinary(this._data,m,n,r,s,a,o,h),this._intArrayBuffer=u,this._floatArrayBuffer=l,this._frameIntArrayBuffer=c,this._frameFloatArrayBuffer=f,this._frameArrayBuffer=_,this._timelineArrayBuffer=d}else this._data.binary=this._binary,this._data.intArray=this._intArrayBuffer=u,this._data.floatArray=this._floatArrayBuffer=l,this._data.frameIntArray=this._frameIntArrayBuffer=c,this._data.frameFloatArray=this._frameFloatArrayBuffer=f,this._data.frameArray=this._frameArrayBuffer=_,this._data.timelineArray=this._timelineArrayBuffer=d},i.prototype.parseDragonBonesData=function(t,i){void 0===i&&(i=1),console.assert(null!=t&&t instanceof ArrayBuffer,"Data error.");var n=new Uint8Array(t,0,8);if(n[0]!=="D".charCodeAt(0)||n[1]!=="B".charCodeAt(0)||n[2]!=="D".charCodeAt(0)||n[3]!=="T".charCodeAt(0))return console.assert(!1,"Nonsupport data."),null;var r=new Uint32Array(t,8,1)[0],s=new Uint8Array(t,12,r),a=this._decodeUTF8(s),o=JSON.parse(a);return this._binaryOffset=12+r,this._binary=t,e.prototype.parseDragonBonesData.call(this,o,i)},i.getInstance=function(){return null===i._binaryDataParserInstance&&(i._binaryDataParserInstance=new i),i._binaryDataParserInstance},i._binaryDataParserInstance=null,i}(t.ObjectDataParser);t.BinaryDataParser=e}(rit),function(t){var e=function(){function e(i){void 0===i&&(i=null),this.autoSearch=!1,this._dragonBonesDataMap={},this._textureAtlasDataMap={},this._dragonBones=null,this._dataParser=null,null===e._objectParser&&(e._objectParser=new t.ObjectDataParser),null===e._binaryParser&&(e._binaryParser=new t.BinaryDataParser),this._dataParser=null!==i?i:e._objectParser}return e.prototype._isSupportMesh=function(){return!0},e.prototype._getTextureData=function(t,e){if(t in this._textureAtlasDataMap)for(var i=0,n=this._textureAtlasDataMap[t];i<n.length;i++)if(null!==(h=(o=n[i]).getTexture(e)))return h;if(this.autoSearch)for(var r in this._textureAtlasDataMap)for(var s=0,a=this._textureAtlasDataMap[r];s<a.length;s++){var o,h;if((o=a[s]).autoSearch&&null!==(h=o.getTexture(e)))return h}return null},e.prototype._fillBuildArmaturePackage=function(t,e,i,n,r){var s=null,a=null;if(e.length>0&&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;n<r.length;n++){var s=r[n];t.BaseObject.borrowObject(0===s.type?t.Bone:t.Surface).init(s,i)}},e.prototype._buildSlots=function(e,i){var n=e.skin,r=e.armature.defaultSkin;if(null!==n&&null!==r){var s={};for(var a in r.displays){var o=r.getDisplays(a);s[a]=o}if(n!==r)for(var a in n.displays)o=n.getDisplays(a),s[a]=o;for(var h=0,u=e.armature.sortedSlots;h<u.length;h++){var l=u[h],c=l.name in s?s[l.name]:null,f=this._buildSlot(e,l,i);if(f.rawDisplayDatas=c,null!==c){for(var _=new Array,d=0,p=t.DragonBones.webAssembly?c.size():c.length;d<p;++d){var m=t.DragonBones.webAssembly?c.get(d):c[d];null!==m?_.push(this._getSlotDisplay(e,m,null,f)):_.push(null)}f._setDisplayList(_)}f._setDisplayIndex(l.displayIndex,!0)}}},e.prototype._buildConstraints=function(e,i){var n=e.armature.constraints;for(var r in n){var s=n[r];switch(s.type){case 0:var a=t.BaseObject.borrowObject(t.IKConstraint);a.init(s,i),i._addConstraint(a);break;case 1:var o=t.BaseObject.borrowObject(t.PathConstraint);o.init(s,i),i._addConstraint(o);break;default:var h=t.BaseObject.borrowObject(t.IKConstraint);h.init(s,i),i._addConstraint(h)}}},e.prototype._buildChildArmature=function(t,e,i){return this.buildArmature(i.path,null!==t?t.dataName:"","",null!==t?t.textureAtlasName:"")},e.prototype._getSlotDisplay=function(e,i,n,r){var s=null!==e?e.dataName:i.parent.parent.parent.name,a=null;switch(i.type){case 0:var o=i;null!==e&&e.textureAtlasName.length>0&&(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,_=c;f<_.length;f++){var d=_[f],p=t.BaseObject.borrowObject(t.EventObject);t.EventObject.actionDataToInstance(d,p,r.armature),p.slot=r,r.armature._bufferAction(p,!1)}else l.animation.play()}u.armature=l.armatureData}a=l}return a},e.prototype.parseDragonBonesData=function(t,i,n){void 0===i&&(i=null),void 0===n&&(n=1);for(var r=t instanceof ArrayBuffer?e._binaryParser:this._dataParser,s=r.parseDragonBonesData(t,n);;){var a=this._buildTextureAtlasData(null,null);if(!r.parseTextureAtlasData(null,a,n)){a.returnToPool();break}this.addTextureAtlasData(a,i)}return null!==s&&this.addDragonBonesData(s,i),s},e.prototype.parseTextureAtlasData=function(t,e,i,n){void 0===i&&(i=null),void 0===n&&(n=1);var r=this._buildTextureAtlasData(null,null);return this._dataParser.parseTextureAtlasData(t,r,n),this._buildTextureAtlasData(r,e||null),this.addTextureAtlasData(r,i),r},e.prototype.updateTextureAtlasData=function(t,e){var i=this.getTextureAtlasData(t);if(null!==i)for(var n=0,r=i.length;n<r;++n)n<e.length&&this._buildTextureAtlasData(i[n],e[n])},e.prototype.getDragonBonesData=function(t){return t in this._dragonBonesDataMap?this._dragonBonesDataMap[t]:null},e.prototype.addDragonBonesData=function(t,e){if(void 0===e&&(e=null),(e=null!==e?e:t.name)in this._dragonBonesDataMap){if(this._dragonBonesDataMap[e]===t)return;console.warn("Can not add same name data: "+e)}else this._dragonBonesDataMap[e]=t},e.prototype.removeDragonBonesData=function(t,e){void 0===e&&(e=!0),t in this._dragonBonesDataMap&&(e&&this._dragonBones.bufferObject(this._dragonBonesDataMap[t]),delete this._dragonBonesDataMap[t])},e.prototype.getTextureAtlasData=function(t){return t in this._textureAtlasDataMap?this._textureAtlasDataMap[t]:null},e.prototype.addTextureAtlasData=function(t,e){void 0===e&&(e=null);var i=(e=null!==e?e:t.name)in this._textureAtlasDataMap?this._textureAtlasDataMap[e]:this._textureAtlasDataMap[e]=[];i.indexOf(t)<0&&i.push(t)},e.prototype.removeTextureAtlasData=function(t,e){if(void 0===e&&(e=!0),t in this._textureAtlasDataMap){var i=this._textureAtlasDataMap[t];if(e)for(var n=0,r=i;n<r.length;n++){var s=r[n];this._dragonBones.bufferObject(s)}delete this._textureAtlasDataMap[t]}},e.prototype.getArmatureData=function(t,e){void 0===e&&(e="");var n=new i;return this._fillBuildArmaturePackage(n,e,t,"","")?n.armature:null},e.prototype.clear=function(t){for(var e in void 0===t&&(t=!0),this._dragonBonesDataMap)t&&this._dragonBones.bufferObject(this._dragonBonesDataMap[e]),delete this._dragonBonesDataMap[e];for(var e in this._textureAtlasDataMap){if(t)for(var i=0,n=this._textureAtlasDataMap[e];i<n.length;i++){var r=n[i];this._dragonBones.bufferObject(r)}delete this._textureAtlasDataMap[e]}},e.prototype.buildArmature=function(t,e,n,r){void 0===e&&(e=""),void 0===n&&(n=""),void 0===r&&(r="");var s=new i;if(!this._fillBuildArmaturePackage(s,e||"",t,n||"",r||""))return console.warn("No armature data: "+t+", "+(null!==e?e:"")),null;var a=this._buildArmature(s);return this._buildBones(s,a),this._buildSlots(s,a),this._buildConstraints(s,a),a.invalidUpdate(null,!0),a.advanceTime(0),a},e.prototype.replaceDisplay=function(e,i,n){void 0===n&&(n=-1),n<0&&(n=e.displayIndex),n<0&&(n=0),e.replaceDisplayData(i,n);var r=e.displayList;if(r.length<=n){r.length=n+1;for(var s=0,a=r.length;s<a;++s)r[s]||(r[s]=null)}if(null!==i){var o=e.rawDisplayDatas,h=null;o&&(t.DragonBones.webAssembly?n<o.size()&&(h=o.get(n)):n<o.length&&(h=o[n])),r[n]=this._getSlotDisplay(null,i,h,e)}else r[n]=null;e.displayList=r},e.prototype.replaceSlotDisplay=function(t,e,i,n,r,s){void 0===s&&(s=-1);var a=this.getArmatureData(e,t||"");if(!a||!a.defaultSkin)return!1;var o=a.defaultSkin.getDisplay(i,n);return!!o&&(this.replaceDisplay(r,o,s),!0)},e.prototype.replaceSlotDisplayList=function(e,i,n,r){var s=this.getArmatureData(i,e||"");if(!s||!s.defaultSkin)return!1;var a=s.defaultSkin.getDisplays(n);if(!a)return!1;for(var o=0,h=0,u=t.DragonBones.webAssembly?a.size():a.length;h<u;++h){var l=t.DragonBones.webAssembly?a.get(h):a[h];this.replaceDisplay(r,l,o++)}return!0},e.prototype.replaceSkin=function(e,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=null);for(var s=!1,a=i.parent.defaultSkin,o=0,h=e.getSlots();o<h.length;o++){var u=h[o];if(!(null!==r&&r.indexOf(u.name)>=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 _=0,d=c;_<d;++_){var p=t.DragonBones.webAssembly?l.get(_):l[_];f[_]=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();h<u.length;h++)for(var l=u[h],c=0,f=0,_=l.displayList;f<_.length;f++){var d=_[f];if(d instanceof t.Armature){var p=r.getDisplays(l.name);if(null!==p&&c<(t.DragonBones.webAssembly?p.size():p.length)){var m=t.DragonBones.webAssembly?p.get(c):p[c];if(null!==m&&1===m.type){var g=this.getArmatureData(m.path,m.parent.parent.parent.name);g&&this.replaceAnimation(d,g,n)}}}c++}return!0},e.prototype.getAllDragonBonesData=function(){return this._dragonBonesDataMap},e.prototype.getAllTextureAtlasData=function(){return this._textureAtlasDataMap},Object.defineProperty(e.prototype,"clock",{get:function(){return this._dragonBones.clock},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dragonBones",{get:function(){return this._dragonBones},enumerable:!0,configurable:!0}),e.prototype.changeSkin=function(t,e,i){return void 0===i&&(i=null),this.replaceSkin(t,e,!1,i)},e.prototype.copyAnimationsToArmature=function(t,e,i,n,r){void 0===n&&(n=""),void 0===r&&(r=!0);var s=this.getArmatureData(e,n);return!!s&&this.replaceAnimation(t,s,r)},e._objectParser=null,e._binaryParser=null,e}();t.BaseFactory=e;var i=function(){this.dataName="",this.textureAtlasName="",this.skin=null};t.BuildArmaturePackage=i}(rit),function(t){t.BinaryOffset={WeigthBoneCount:0,WeigthFloatOffset:1,WeigthBoneIndices:2,MeshVertexCount:0,MeshTriangleCount:1,MeshFloatOffset:2,MeshWeightOffset:3,MeshVertexIndices:4,TimelineScale:0,TimelineOffset:1,TimelineKeyFrameCount:2,TimelineFrameValueCount:3,TimelineFrameValueOffset:4,TimelineFrameOffset:5,FramePosition:0,FrameTweenType:1,FrameTweenEasingOrCurveSampleCount:2,FrameCurveSamples:3,DeformMeshOffset:0,DeformCount:1,DeformValueCount:2,DeformValueOffset:3,DeformFloatOffset:4},t.ArmatureType={Armature:0,MovieClip:1,Stage:2},t.BoneType={Bone:0,Surface:1},t.DisplayType={Image:0,Armature:1,Mesh:2,BoundingBox:3},t.BoundingBoxType={Rectangle:0,Ellipse:1,Polygon:2},t.ActionType={Play:0,Stop:1,GotoAndPlay:2,GotoAndStop:3,FadeIn:4,FadeOut:5,Frame:10,Sound:11},t.BlendMode={Normal:0,Add:1,Alpha:2,Darken:3,Difference:4,Erase:5,HardLight:6,Invert:7,Layer:8,Lighten:9,Multiply:10,Overlay:11,Screen:12,Subtract:13},t.TweenType={None:0,Line:1,Curve:2,QuadIn:3,QuadOut:4,QuadInOut:5},t.TimelineType={Action:0,ZOrder:1,BoneAll:10,BoneTranslate:11,BoneRotate:12,BoneScale:13,Surface:50,SlotDisplay:20,SlotColor:21,SlotFFD:22,IKConstraint:30,AnimationTime:40,AnimationWeight:41}}(rit);var sit,ait,oit,hit,uit,lit,cit,fit,_it,dit,pit,mit,git=rit.DragonBones,yit=rit.BaseObject,vit=rit.Matrix,bit=rit.Transform,Sit=rit.ColorTransform,wit=rit.Point,xit=rit.Rectangle,Tit=rit.UserData,Ait=rit.ActionData,Cit=rit.DragonBonesData,Dit=rit.ArmatureData,Bit=rit.BoneData,Iit=rit.SurfaceData,Mit=rit.SlotData,Pit=rit.ConstraintData,Eit=rit.IKConstraintData,Oit=rit.PathConstraintData,kit=rit.CanvasData,Rit=rit.SkinData,Fit=rit.VerticesData,Lit=rit.DisplayData,Vit=rit.ImageDisplayData,Nit=rit.ArmatureDisplayData,zit=rit.MeshDisplayData,Uit=rit.BoundingBoxDisplayData,Git=rit.PathDisplayData,Hit=rit.WeightData,Wit=rit.BoundingBoxData,jit=rit.RectangleBoundingBoxData,qit=rit.EllipseBoundingBoxData,Xit=rit.PolygonBoundingBoxData,Yit=rit.AnimationData,Jit=rit.TimelineData,Kit=rit.AnimationConfig,Qit=rit.TextureAtlasData,Zit=rit.TextureData,$it=rit.DeformVertices,tnt=rit.Armature,ent=rit.TransformObject,int=rit.Bone,nnt=rit.Surface,rnt=rit.Slot,snt=rit.Constraint,ant=rit.IKConstraint,ont=rit.PathConstraint,hnt=rit.WorldClock,unt=rit.Animation,lnt=rit.AnimationState,cnt=rit.BonePose,fnt=rit.BlendState,_nt=rit.TimelineState,dnt=rit.TweenTimelineState,pnt=rit.BoneTimelineState,mnt=rit.SlotTimelineState,gnt=rit.ConstraintTimelineState,ynt=rit.ActionTimelineState,vnt=rit.ZOrderTimelineState,bnt=rit.BoneAllTimelineState,Snt=rit.BoneTranslateTimelineState,wnt=rit.BoneRotateTimelineState,xnt=rit.BoneScaleTimelineState,Tnt=rit.SurfaceTimelineState,Ant=rit.SlotDislayTimelineState,Cnt=rit.SlotColorTimelineState,Dnt=rit.DeformTimelineState,Bnt=rit.IKConstraintTimelineState,Int=rit.AnimationTimelineState,Mnt=rit.EventObject,Pnt=rit.DataParser,Ent=rit.ObjectDataParser,Ont=rit.ActionFrame,knt=rit.BinaryDataParser,Rnt=rit.BaseFactory,Fnt=rit.BuildArmaturePackage,Lnt=rit.BinaryOffset,Vnt=rit.ArmatureType,Nnt=rit.BoneType,znt=rit.DisplayType,Unt=rit.BoundingBoxType,Gnt=rit.ActionType,Hnt=rit.BlendMode,Wnt=rit.TweenType,jnt=rit.TimelineType,qnt=Kh,Xnt=qnt("dragonBones.CCTextureAtlasData")(sit=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._renderTexture=null,e}s(e,t),e.toString=function(){return"[class dragonBones.CCTextureAtlasData]"};var i=e.prototype;return i.createTexture=function(){return yit.borrowObject(Ynt)},i._onClear=function(){t.prototype._onClear.call(this),this.renderTexture=null},n(e,[{key:"renderTexture",get:function(){return this._renderTexture},set:function(t){if(this._renderTexture=t,t)for(var e in this.textures){var i=this.textures[e];if(!i.spriteFrame){var n=null;i.rotated?n=new bs(i.region.x,i.region.y,i.region.height,i.region.width):(n=new bs(i.region.x,i.region.y,i.region.width,i.region.height),i.spriteFrame=new nR,i.spriteFrame.texture=t,i.spriteFrame.rect=n)}}else for(var r in this.textures)this.textures[r].spriteFrame=null}}]),e}(Qit))||sit,Ynt=qnt("dragonBones.CCTextureData")(ait=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).spriteFrame=null,e}return s(e,t),e.toString=function(){return"[class dragonBones.CCTextureData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.spriteFrame=null},e}(Zit))||ait,Jnt=Kh("dragonBones.CCSlot")(oit=function(t){function e(){var e;return(e=t.call(this)||this)._localVertices=void 0,e._indices=void 0,e._matrix=void 0,e._worldMatrix=void 0,e._worldMatrixDirty=void 0,e._color=void 0,e._localVertices=[],e._indices=[],e._matrix=new Kr,e._worldMatrix=new Kr,e._worldMatrixDirty=!0,e._visible=!1,e._color=new cr,e}s(e,t),e.toString=function(){return"[class dragonBones.CCSlot]"};var i=e.prototype;return i.getTexture=function(){return this._textureData?this._textureData.spriteFrame.texture:null},i.calculWorldMatrix=function(){var t=this._armature._parent;t?this._mulMat(this._worldMatrix,t._worldMatrix,this._matrix):Kr.copy(this._worldMatrix,this._matrix),this._worldMatrixDirty=!1},i._onClear=function(){t.prototype._onClear.call(this),this._localVertices.length=0,this._indices.length=0,Kr.identity(this._matrix),Kr.identity(this._worldMatrix),this._worldMatrixDirty=!0,this._color=new cr,this._visible=!1},i._onUpdateDisplay=function(){},i._initDisplay=function(){},i._addDisplay=function(){this._visible=!0},i._replaceDisplay=function(){},i._removeDisplay=function(){this._visible=!1},i._disposeDisplay=function(){},i._updateVisible=function(){this._visible=this.parent.visible},i._updateGlueMesh=function(){},i._updateZOrder=function(){},i._updateBlendMode=function(){if(this._childArmature)for(var t=this._childArmature.getSlots(),e=0,i=t.length;e<i;e++){var n=t[e];n._blendMode=this._blendMode,n._updateBlendMode()}},i._updateColor=function(){var t=this._color;t.r=255*this._colorTransform.redMultiplier,t.g=255*this._colorTransform.greenMultiplier,t.b=255*this._colorTransform.blueMultiplier,t.a=255*this._colorTransform.alphaMultiplier},i._updateFrame=function(){this._indices.length=0;var t=this._indices,e=this._localVertices,i=0,n=0,r=this._textureData;if(this._display&&!(this._displayIndex<0)&&r&&r.spriteFrame){var s=r.spriteFrame.texture,a=s.width,o=s.height,h=r.region;if(0!==a&&0!==o){var u=null!==this._deformVertices&&this._display===this._meshDisplay?this._deformVertices.verticesData:null;if(u){var l=u.data,c=l.intArray,f=l.floatArray,_=c[u.offset+Lnt.MeshVertexCount],d=c[u.offset+Lnt.MeshTriangleCount],p=c[u.offset+Lnt.MeshFloatOffset];p<0&&(p+=65536);for(var m=p+2*_,g=this._armature._armatureData.scale,y=0,v=2*_;y<v;y+=2)e[n++]=f[p+y]*g,e[n++]=-f[p+y+1]*g,u.rotated?(e[n++]=(h.x+(1-f[m+y])*h.width)/a,e[n++]=(h.y+f[m+y+1]*h.height)/o):(e[n++]=(h.x+f[m+y]*h.width)/a,e[n++]=(h.y+f[m+y+1]*h.height)/o);for(var b=0;b<3*d;++b)t[i++]=c[u.offset+Lnt.MeshVertexIndices+b];e.length=n,t.length=i,u.weight&&this._identityTransform()}else{var S=h.x/a,w=(h.y+h.height)/o,x=(h.x+h.width)/a,T=h.y/o;e[n++]=0,e[n++]=0,e[n++]=S,e[n++]=w,e[n++]=h.width,e[n++]=0,e[n++]=x,e[n++]=w,e[n++]=0,e[n++]=h.height,e[n++]=S,e[n++]=T,e[n++]=h.width,e[n++]=h.height,e[n++]=x,e[n++]=T,t[0]=0,t[1]=1,t[2]=2,t[3]=1,t[4]=3,t[5]=2,e.length=n,t.length=6}this._visibleDirty=!0,this._blendModeDirty=!0,this._colorDirty=!0}else console.error("SpriteFrame "+r.spriteFrame.name+" incorrect size "+a+" x "+o)}},i._updateMesh=function(){var t=this._armature._armatureData.scale,e=this._deformVertices.vertices,i=this._deformVertices.bones,n=this._deformVertices.verticesData,r=n.weight,s=e.length>0&&n.inheritDeform,a=this._localVertices;if(r){var o=n.data,h=o.intArray,u=o.floatArray,l=h[n.offset+Lnt.MeshVertexCount],c=h[r.offset+Lnt.WeigthFloatOffset];c<0&&(c+=65536);for(var f=0,_=r.offset+Lnt.WeigthBoneIndices+i.length,d=c,p=0,m=0;f<l;f++,m+=4){for(var g=h[_++],y=0,v=0,b=0;b<g;++b){var S=i[h[_++]];if(null!==S){var w=S.globalTransformMatrix,x=u[d++],T=u[d++]*t,A=u[d++]*t;s&&(T+=e[p++],A+=e[p++]),y+=(w.a*T+w.c*A+w.tx)*x,v+=(w.b*T+w.d*A+w.ty)*x}}a[m]=y,a[m+1]=-v}}else if(s){var C=this._parent._boneData.type!==Nnt.Bone,D=n.data,B=D.intArray,I=D.floatArray,M=B[n.offset+Lnt.MeshVertexCount],P=B[n.offset+Lnt.MeshFloatOffset];P<0&&(P+=65536);for(var E=0,O=M,k=0;E<O;E++,k+=4){var R=I[P+2*E]*t+e[2*E],F=I[P+2*E+1]*t+e[2*E+1];if(C){var L=this._parent._getGlobalTransformMatrix(R,F);a[k]=L.a*R+L.c*F+L.tx,a[k+1]=-L.b*R+L.d*F+L.ty}else a[k]=R,a[k+1]=-F}}r&&this._identityTransform()},i._identityTransform=function(){var t=this._matrix;t.m00=1,t.m01=0,t.m04=-0,t.m05=-1,t.m12=0,t.m13=0,this._worldMatrixDirty=!0},i._updateTransform=function(){var t=this._matrix;t.m00=this.globalTransformMatrix.a,t.m01=this.globalTransformMatrix.b,t.m04=-this.globalTransformMatrix.c,t.m05=-this.globalTransformMatrix.d,this._childArmature?(t.m12=this.globalTransformMatrix.tx,t.m13=this.globalTransformMatrix.ty):(t.m12=this.globalTransformMatrix.tx-(this.globalTransformMatrix.a*this._pivotX-this.globalTransformMatrix.c*this._pivotY),t.m13=this.globalTransformMatrix.ty-(this.globalTransformMatrix.b*this._pivotX-this.globalTransformMatrix.d*this._pivotY)),this._worldMatrixDirty=!0},i.updateWorldMatrix=function(){if(this._armature){var t=this._armature._parent;if(t&&t.updateWorldMatrix(),this._worldMatrixDirty){this.calculWorldMatrix();var e=this.childArmature;if(!e)return;for(var i=e.getSlots(),n=0,r=i.length;n<r;n++){var s=i[n];s&&(s._worldMatrixDirty=!0)}}}},i._mulMat=function(t,e,i){var n=e.m00,r=e.m01,s=e.m04,a=e.m05,o=e.m12,h=e.m13,u=i.m00,l=i.m01,c=i.m04,f=i.m05,_=i.m12,d=i.m13;0!==r||0!==s?(t.m00=u*n+l*s,t.m01=u*r+l*a,t.m04=c*n+f*s,t.m05=c*r+f*a,t.m12=n*_+s*d+o,t.m13=r*_+a*d+h):(t.m00=u*n,t.m01=l*a,t.m04=c*n,t.m05=f*a,t.m12=n*_+o,t.m13=a*d+h)},e}(rnt))||oit,Knt=Kh("dragonBones.CCArmatureDisplay")(hit=function(t){function e(){var e;return(e=t.call(this)||this).shouldAdvanced=!1,e._ccNode=null,e._ccComponent=null,e._eventTarget=void 0,e._armature=null,e._eventTarget=new Io,e}s(e,t);var i=e.prototype;return i.hasEvent=function(){return Y("Method not implemented."),!1},i.addEvent=function(){Y("Method not implemented.")},i.removeEvent=function(){Y("Method not implemented.")},i.setEventTarget=function(t){this._eventTarget=t},i.getRootDisplay=function(){var t,e=this._armature._parent;if(!e)return this;for(;e;)t=e,e=e._armature._parent;return t._armature.display},i.convertToRootSpace=function(t){var e=this._armature._parent;if(!e)return t;e.updateWorldMatrix();var i=e._worldMatrix,n=new ir(0,0);return n.x=t.x*i.m00+t.y*i.m04+i.m12,n.y=t.x*i.m01+t.y*i.m05+i.m13,n},i.convertToWorldSpace=function(t){var e,i=this.convertToRootSpace(t),n=this.getRootNode();return null==n||null==(e=n._getUITransformComp())?void 0:e.convertToWorldSpaceAR(i)},i.getRootNode=function(){var t=this.getRootDisplay();return t&&t._ccNode},i.dbInit=function(t){this._armature=t},i.dbClear=function(){this._armature=null},i.dbUpdate=function(){this._ccComponent&&this._ccComponent._markForUpdateRenderData()},i.advanceTimeBySelf=function(t){this.shouldAdvanced=!!t},i.hasDBEventListener=function(t){return this._eventTarget.hasEventListener(t)},i.addDBEventListener=function(t,e,i){this._eventTarget.on(t,e,i)},i.removeDBEventListener=function(t,e,i){this._eventTarget.off(t,e,i)},i.dispatchDBEvent=function(t,e){this._eventTarget.emit(t,e)},n(e,[{key:"node",get:function(){return this}}]),e}(Lit))||hit,Qnt=Kh("CCFactory")((lit=function(t){function e(){var e;(e=t.call(this)||this).id=void 0,e.uuid=void 0,e._slots=void 0;var i=new Knt;return e._dragonBones=new git(i),YE.getScheduler()&&(XO.on(qO.EVENT_RESTART,e.onRestart,f(e)),e.initUpdate()),e.id=e.uuid="CCFactory",e}s(e,t),e.getInstance=function(){return e._factory||(e._factory=new e),e._factory};var i=e.prototype;return i.onRestart=function(){e._factory=null},i.initUpdate=function(){Gf.enableForTarget(this),YE.getScheduler().scheduleUpdate(this,200,!1)},i.update=function(t){this._dragonBones.advanceTime(t)},i.getDragonBonesDataByRawData=function(t){return(t instanceof ArrayBuffer?Rnt._binaryParser:this._dataParser).parseDragonBonesData(t,1)},i.buildArmatureDisplay=function(t,e,i,n){var r=this.buildArmature(t,e,i,n);return r?r._display:null},i.createArmatureNode=function(t,e,i){var n=(i=i||new eb).getComponent("dragonBones.ArmatureDisplay");return n||(n=i.addComponent("dragonBones.ArmatureDisplay")),i.name=e,n._armatureName=e,n._dragonAsset=t.dragonAsset,n._dragonAtlasAsset=t.dragonAtlasAsset,n._init(),n},i._buildTextureAtlasData=function(t,e){return t?t.renderTexture=e:t=yit.borrowObject(Xnt),t},i._sortSlots=function(){for(var t=this._slots,e=[],i=0,n=t.length;i<n;i++){for(var r=t[i],s=r._zOrder,a=!1,o=e.length-1;o>=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=yit.borrowObject(tnt);e._skinData=t.skin,e._animation=yit.borrowObject(unt),e._animation._armature=e,e._animation.animations=t.armature.animations,e._isChildArmature=!1;var i=new Knt;return e.init(t.armature,i,i,this._dragonBones),e},i._buildSlot=function(t,e,i){var n=yit.borrowObject(Jnt),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}(Rnt),lit._factory=null,uit=lit))||uit,Znt=1/60,$nt=[],trt=[],ert=0,irt=0,nrt=0,rrt=null,srt=null,art=0,ort=0,hrt=0,urt=0,lrt=0,crt=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;t<e;t++)this.frames[t].segments.length=0;this.invalidAllFrame()},e.begin=function(){if(this._invalid){var t=this._armatureInfo,e=t.curAnimationCache;e&&e!==this&&(this._privateMode?e.invalidAllFrame():e.updateToFrame()),t.armature.animation.play(this._animationName,1),t.curAnimationCache=this,this._invalid=!1,this._frameIdx=-1,this.totalTime=0,this.isCompleted=!1}},e.end=function(){this._needToUpdate()||(this._armatureInfo.curAnimationCache=null,this.frames.length=this._frameIdx+1,this.isCompleted=!0)},e._needToUpdate=function(t){return!this._armatureInfo.armature.animation.isCompleted&&this.totalTime<30&&(void 0===t||this._frameIdx<t)},e.updateToFrame=function(t){if(this._inited&&(this.begin(),this._needToUpdate(t))){var e=this._armatureInfo.armature;do{e.advanceTime(Znt),this._frameIdx++,this.updateFrame(e,this._frameIdx),this.totalTime+=Znt}while(this._needToUpdate(t));this.end()}},e.isInited=function(){return this._inited},e.isInvalid=function(){return this._invalid},e.invalidAllFrame=function(){this.isCompleted=!1,this._invalid=!0},e.updateAllFrame=function(){this.invalidAllFrame(),this.updateToFrame()},e.enableCacheAttachedInfo=function(){this._enableCacheAttachedInfo||(this._enableCacheAttachedInfo=!0,this.invalidAllFrame())},e.updateFrame=function(t,e){nrt=0,ert=0,irt=0,rrt=null,srt=null,art=0,ort=0,hrt=0,urt=0,lrt=0,this.frames[e]=this.frames[e]||{segments:[],colors:[],boneInfos:[],vertices:new Float32Array,uintVert:new Uint32Array,indices:new Uint16Array};var i=this.frames[e],n=this._tempSegments=i.segments,r=this._tempColors=i.colors,s=this._tempBoneInfos=i.boneInfos;this._traverseArmature(t,1),urt>0&&(r[urt-1].vfOffset=nrt),r.length=urt,s.length=ert;var a=hrt-1;if(a>=0)if(ort>0){var o=n[a];o.indexCount=ort,o.vfCount=9*art,o.vertexCount=art,n.length=hrt}else n.length=hrt-1;if(0!==n.length){var h,u=i.vertices,l=nrt/5,c=9*l;(!u||u.length<nrt)&&(u=i.vertices=new Float32Array(c));for(var f=0,_=0;f<c;)u[f]=$nt[_++],u[f+1]=$nt[_++],u[f+3]=$nt[_++],u[f+4]=$nt[_++],h=$nt[_++],u[f+5]=(255&h)/255,u[f+6]=(h>>8&255)/255,u[f+7]=(h>>16&255)/255,u[f+8]=(h>>24&255)/255,f+=9;var d=i.indices;(!d||d.length<irt)&&(d=i.indices=new Uint16Array(irt));for(var p=0;p<irt;p++)d[p]=trt[p];i.vertices=u,i.indices=d,this.maxVertexCount=l>this.maxVertexCount?l:this.maxVertexCount,this.maxIndexCount=d.length>this.maxIndexCount?d.length:this.maxIndexCount}},e._traverseArmature=function(t,e){var i,n,r,s,a,o,h,u,l,c=this._tempColors,f=this._tempSegments,_=this._tempBoneInfos,d=t._slots,p=t._bones;if(this._enableCacheAttachedInfo)for(var m=0,g=p.length;m<g;m++,ert++){var y=p[m],v=_[ert];v||(v=_[ert]={globalTransformMatrix:new vit});var b=y.globalTransformMatrix;v.globalTransformMatrix.copyFrom(b)}for(var S=0,w=d.length;S<w;S++)if((r=d[S])._visible&&r._displayData)if(r.updateWorldMatrix(),a=r._color,r.childArmature)this._traverseArmature(r.childArmature,e*a.a/255);else if(h=r.getTexture()){rrt===h.nativeUrl&&srt===r._blendMode||(rrt=h.nativeUrl,srt=r._blendMode,(u=hrt-1)>=0&&(ort>0?((l=f[u]).indexCount=ort,l.vertexCount=art,l.vfCount=9*art):hrt--),f[hrt]={tex:h,blendMode:r._blendMode,indexCount:0,vertexCount:0,vfCount:0},hrt++,ort=0,art=0),o=(a.a*e<<24>>>0)+(a.b<<16)+(a.g<<8)+a.r,lrt!==o&&(lrt=o,urt>0&&(c[urt-1].vfOffset=nrt),c[urt++]={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 x=0,T=i.length;x<T;)fit=i[x++],_it=i[x++],$nt[nrt++]=fit*s.m00+_it*s.m04+s.m12,$nt[nrt++]=fit*s.m01+_it*s.m05+s.m13,$nt[nrt++]=i[x++],$nt[nrt++]=i[x++],$nt[nrt++]=o;for(var A=0,C=n.length;A<C;A++)trt[irt++]=art+n[A];ort+=n.length,art+=i.length/4}},t}(),frt=function(){function t(){this._privateMode=!1,this._animationPool={},this._armatureCache={}}var e=t.prototype;return e.enablePrivateMode=function(){this._privateMode=!0},e.dispose=function(){for(var t in this._armatureCache){var e=this._armatureCache[t];if(e){var i=e.armature;i&&i.dispose()}}this._armatureCache={},this._animationPool={}},e._removeArmature=function(t){var e=this._armatureCache[t],i=e.animationsCache;for(var n in i){var r=i[n];r&&(this._animationPool[t+"#"+n]=r,r.clear())}var s=e.armature;s&&s.dispose(),delete this._armatureCache[t]},e.resetArmature=function(t){for(var e in this._armatureCache)-1!==e.indexOf(t)&&this._removeArmature(e)},e.getArmatureCache=function(e,i,n){var r,s=this._armatureCache[i];if(s)r=s.armature;else{var a=Qnt.getInstance().buildArmatureDisplay(e,i,"",n);if(!a||!a._armature)return null;if(r=a._armature,!t.canCache(r))return r.dispose(),null;this._armatureCache[i]={armature:r,animationsCache:{},curAnimationCache:null}}return r},e.getAnimationCache=function(t,e){var i=this._armatureCache[t];return i?i.animationsCache[e]:null},e.initAnimationCache=function(t,e){if(!e)return null;var i=this._armatureCache[t],n=i&&i.armature;if(!n)return null;if(!n.animation.hasAnimation(e))return null;var r=i.animationsCache,s=r[e];if(!s){var a=t+"#"+e;(s=this._animationPool[a])?delete this._animationPool[a]:(s=new crt)._privateMode=this._privateMode,s.init(i,e),r[e]=s}return s},e.invalidAnimationCache=function(t){var e=this._armatureCache[t];if(e&&e.armature){var i=e.animationsCache;for(var n in i)i[n].invalidAllFrame()}},e.updateAnimationCache=function(t,e){if(e){var i=this.initAnimationCache(t,e);if(!i)return;i.updateAllFrame()}else{var n=this._armatureCache[t];if(!n||!n.armature)return;var r=n.animationsCache;for(var s in r)r[s].updateAllFrame()}},t.canCache=function(t){for(var e=t._slots,i=0,n=e.length;i<n;i++)if(e[i].childArmature)return!1;return!0},t}();cit=frt,frt.FrameTime=Znt,frt.sharedCache=new cit;var _rt,drt,prt,mrt,grt,yrt,vrt,brt,Srt=uu,wrt=Kh("dragonBones.DragonBonesAsset")((pit=function(t){function e(e){var i;return(i=t.call(this,e)||this)._dragonBonesJson=mit&&mit(),i._factory=null,i._dragonBonesJsonData=void 0,i._armaturesEnum=null,i.reset(),i}s(e,t);var i=e.prototype;return i.createNode=function(t){var e=new eb(this.name);return e.addComponent("dragonBones.ArmatureDisplay").dragonAsset=this,t(null,e)},i.reset=function(){this._clear()},i.init=function(t,e){this._factory=t||Qnt.getInstance(),!this._dragonBonesJsonData&&this.dragonBonesJson&&(this._dragonBonesJsonData=JSON.parse(this.dragonBonesJson));var i;if(i=this._dragonBonesJsonData?this._dragonBonesJsonData:this._nativeAsset,!this._uuid){var n=this._factory.getDragonBonesDataByRawData(i);n?this._uuid=n.name:Y("dragonbones name is empty")}var r=this._uuid+"#"+e;return this._factory.getDragonBonesData(r)||this._factory.parseDragonBonesData(i instanceof ArrayBuffer?i:i.buffer instanceof ArrayBuffer?i.buffer:i,r),r},i.getArmatureEnum=function(){if(this._armaturesEnum)return this._armaturesEnum;this.init();var t=this._factory.getDragonBonesDataByUUID(this._uuid);if(t){for(var e=t.armatureNames,i={},n=0;n<e.length;n++)i[e[n]]=n;return this._armaturesEnum=Ee(i)}return null},i.getAnimsEnum=function(t){this.init();var e=this._factory.getDragonBonesDataByUUID(this._uuid);if(e){var i=e.getArmature(t);if(!i)return null;var n={"<None>":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&&(frt.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),mit=zh(pit.prototype,"_dragonBonesJson",[Srt],(function(){return""})),dit=pit))||dit;A.internal.DragonBonesAsset=wrt;var xrt,Trt=uu,Art=Ou,Crt=(_rt=Kh("dragonBones.DragonBonesAtlasAsset"),drt=Art(Ey),_rt((mrt=function(t){function e(){var e;return(e=t.call(this)||this)._atlasJson=grt&&grt(),e._texture=yrt&&yrt(),e._atlasJsonData=vrt&&vrt(),e._factory=null,e._textureAtlasData=brt&&brt(),e._clear(),e}s(e,t);var i=e.prototype;return i.createNode=function(t){var e=new eb(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&&(frt.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),grt=zh(mrt.prototype,"_atlasJson",[Trt],(function(){return""})),yrt=zh(mrt.prototype,"_texture",[Trt,drt],(function(){return null})),vrt=zh(mrt.prototype,"_atlasJsonData",[Trt],(function(){return{}})),brt=zh(mrt.prototype,"_textureAtlasData",[Trt],(function(){return null})),prt=mrt))||prt);A.internal.DragonBonesAtlasAsset=Crt;var Drt,Brt,Irt,Mrt,Prt,Ert,Ort,krt,Rrt,Frt,Lrt,Vrt,Nrt,zrt,Urt,Grt,Hrt,Wrt,jrt,qrt,Xrt,Yrt,Jrt,Krt,Qrt,Zrt,$rt,tst,est,ist,nst=new Kr,rst=Kh("dragonBones.AttachUtil")(xrt=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=nst).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=nst)}else a.delete(u.path),s.splice(h,1)}}},t}())||xrt,sst=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,YE.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}(Ff);sst.ID="ARMATURE",sst._instance=void 0,A.internal.ArmatureSystem=sst;var ast={default:-1};Re(ast);var ost={"<None>":0};Re(ost);var hst={REALTIME:0};Re(hst);var ust={REALTIME:0,SHARED_CACHE:1,PRIVATE_CACHE:2};Re(ust);var lst=Kh,cst=uu,fst=Ou,_st=Gu,dst=(Drt=lst("dragonBones.ArmatureDisplay.DragonBoneSocket"),Brt=fst(eb),Drt((Mrt=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),this.path=Prt&&Prt(),this.target=Ert&&Ert(),this.boneIndex=null,this.path=t,this.target=e},Prt=zh(Mrt.prototype,"path",[cst],(function(){return""})),Ert=zh(Mrt.prototype,"target",[Brt,cst],(function(){return null})),Irt=Mrt))||Irt);le(dst,"dragonBones.ArmatureDisplay.DragonBoneSocket");var pst=(Ort=lst("dragonBones.ArmatureDisplay"),krt=fst(wrt),Rrt=fst(Crt),Frt=fst(ast),Lrt=fst(ost),Vrt=fst([dst]),Nrt=fst(GT),Ort((ist=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this).playTimes=Grt&&Grt(),e.premultipliedAlpha=Hrt&&Hrt(),e._armature=null,e.attachUtil=void 0,e._defaultArmatureIndexValue=Wrt&&Wrt(),e._dragonAsset=jrt&&jrt(),e._dragonAtlasAsset=qrt&&qrt(),e._armatureName=Xrt&&Xrt(),e._animationName=Yrt&&Yrt(),e._animationIndexValue=Jrt&&Jrt(),e._preCacheMode=-1,e._cacheMode=0,e._defaultCacheModeValue=Krt&&Krt(),e._timeScale=Qrt&&Qrt(),e._playTimes=Zrt&&Zrt(),e._debugBones=$rt&&$rt(),e._enableBatch=tst&&tst(),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 uo((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=est&&est(),e._inited=void 0,e._drawInfoList=[],e._cacheModeEnum=void 0,e._eventTarget=new Io,e._inited=!1,e.attachUtil=new rst,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 QF),this._drawInfoList[t]},e.initFactory=function(){this._factory=Qnt.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 QT({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 mT.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;o<this._drawList.length;o++){this._drawIdx=o;var h=this._drawList.data[o];h.texture&&t.commitMiddleware(this,s,a+h.indexOffset,h.indexCount,h.texture,h.material,this._enableBatch),e+=h.indexCount}var u=i.indices.subarray(0,e);r.appendIndices(n.bufferId,u)}},e.__preload=function(){t.prototype.__preload.call(this),this._init()},e._init=function(){if(this._cacheMode=this._defaultCacheMode,!this._inited){this._inited=!0,this._parseDragonAtlasAsset(),this._refresh();for(var t=this.node.children,e=0,i=t.length;e<i;e++){var n=t[e];n&&"DEBUG_DRAW_NODE"===n.name&&n.destroy()}this._updateDebugDraw(),this._indexBoneSockets(),this._updateSocketBindings()}},e.getArmatureKey=function(){return this._armatureKey},e.setAnimationCacheMode=function(t){this._preCacheMode!==t&&(this._cacheMode=t,this._buildArmature(),this._armature&&!this.isAnimationCached()&&this._factory._dragonBones.clock.add(this._armature),this._updateSocketBindings(),this._markForUpdateRenderData())},e.isAnimationCached=function(){return 0!==this._cacheMode},e.onEnable=function(){t.prototype.onEnable.call(this),this._armature&&!this.isAnimationCached()&&this._factory._dragonBones.clock.add(this._armature),this._flushAssembler(),sst.getInstance().add(this)},e.onDisable=function(){t.prototype.onDisable.call(this),this._armature&&!this.isAnimationCached()&&this._factory._dragonBones.clock.remove(this._armature),sst.getInstance().remove(this)},e._emitCacheCompleteEvent=function(){this._eventTarget.emit(Mnt.LOOP_COMPLETE),this._eventTarget.emit(Mnt.COMPLETE)},e.updateAnimation=function(t){if(this._markForUpdateRenderData(),this.isAnimationCached()&&this._frameCache){var e=this._frameCache;if(e.isInited()){var i=e.frames;if(this._playing){var n=frt.FrameTime;0===this._accTime&&0===this._playCount&&this._eventTarget.emit(Mnt.START),this._accTime+=t*this.timeScale*1;var r=Math.floor(this._accTime/n);if(e.isCompleted||(e.updateToFrame(r),this.renderData&&(this.renderData.vertexCount<e.maxVertexCount||this.renderData.indexCount<e.maxIndexCount)&&(this.maxVertexCount=e.maxVertexCount>this.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.vertexCount<e.maxVertexCount||this.renderData.indexCount<e.maxIndexCount)&&(this.maxVertexCount=e.maxVertexCount>this.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 eb("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=frt.sharedCache:2===this._cacheMode&&(this._armatureCache=new frt,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,ust):Object.assign(this._cacheModeEnum,hst),Ti(this,"_defaultCacheMode",this._cacheModeEnum)},e._updateAnimEnum=function(){var t;t=this.dragonAsset?this.dragonAsset.getAnimsEnum(this.armatureName):ost,this._enumAnimations=Ee({}),Object.assign(this._enumAnimations,t||ost),Ee.update(this._enumAnimations),Ti(this,"_animationIndex",this._enumAnimations)},e._updateArmatureEnum=function(){var t;t=this.dragonAsset?this.dragonAsset.getArmatureEnum():ast,this._enumArmatures=Ee({}),Object.assign(this._enumArmatures,t||ast),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;o<s.length;o++)s[o]._boneIndex=o;for(var h=0;h<s.length;h++)e(h,s,a);for(var u,l=p(a.keys());!(u=l()).done;){var c=u.value;t.set(""+n+a.get(c),c)}for(var f=r.getSlots(),_=0;_<f.length;_++)f[_].childArmature&&i(f[_].name,f[_].childArmature)}("",this._armature)}},e.playAnimation=function(t,e){if(this.playTimes=void 0===e?-1:e,this.animationName=t,this.isAnimationCached()){var i=this._armatureCache.getAnimationCache(this._armatureKey,t);i||(i=this._armatureCache.initAnimationCache(this._armatureKey,t)),i&&(this._accTime=0,this._playCount=0,this._frameCache=i,this._sockets.length>0&&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;t<e;t++){var i=this._sockets[t];if(i.path&&i.target){var n=this._cachedSockets.get(i.path);if(!n){console.error("Skeleton data does not contain path "+i.path);continue}i.boneIndex=n,this._socketNodes.set(i.path,i.target)}}}},e._verifySockets=function(t){for(var e=0,i=t.length;e<i;e++){var n=t[e].target;!n||n.parent&&n.parent===this.node||console.error("Target node "+n.name+" is expected to be a direct child of "+this.node.name)}},e._cleanMaterialCache=function(){for(var t in this._materialCache)this._materialCache[t].destroy();this._materialCache={}},e.createRenderEntity=function(){var t=new DL(1);return t.setUseLocal(!1),t},e.markForUpdateRenderData=function(e){void 0===e&&(e=!0),t.prototype._markForUpdateRenderData.call(this,e),this._debugDraw&&this._debugDraw._markForUpdateRenderData(e)},e.syncAttachedNode=function(){this.attachUtil._syncAttachedNode()},n(i,[{key:"dragonAsset",get:function(){return this._dragonAsset},set:function(t){this._dragonAsset=t,this.destroyRenderData(),this._refresh()}},{key:"dragonAtlasAsset",get:function(){return this._dragonAtlasAsset},set:function(t){this._dragonAtlasAsset=t,this._parseDragonAtlasAsset(),this._refresh()}},{key:"armatureName",get:function(){return this._armatureName},set:function(t){this._armatureName=t;var e=this.getAnimationNames(this._armatureName);(!this.animationName||e.indexOf(this.animationName)<0)&&(this.animationName=""),this._armature&&!this.isAnimationCached()&&this._factory._dragonBones.clock.remove(this._armature),this._refresh(),this._armature&&!this.isAnimationCached()&&this._factory._dragonBones.clock.add(this._armature)}},{key:"animationName",get:function(){return this._animationName},set:function(t){this._animationName=t}},{key:"_defaultArmatureIndex",get:function(){return this._defaultArmatureIndexValue},set:function(t){this._defaultArmatureIndexValue=t;var e="";if(this.dragonAsset){var i;if(this.dragonAsset&&(i=this.dragonAsset.getArmatureEnum()),!i)return void ht(7400,this.name);e=i[this._defaultArmatureIndex]}void 0!==e?this.armatureName=e:ht(7401,this.name),this._markForUpdateRenderData()}},{key:"_animationIndex",get:function(){return this._animationIndexValue},set:function(t){var e;if(this._animationIndexValue=t,0!==this._animationIndex){if(this.dragonAsset&&(e=this.dragonAsset.getAnimsEnum(this.armatureName)),e){var i=e[this._animationIndex];void 0!==i?this.playAnimation(i,this.playTimes):ht(7402,this.name)}}else this.animationName=""}},{key:"_defaultCacheMode",get:function(){return this._defaultCacheModeValue},set:function(t){if(this._defaultCacheModeValue=t,0!==this._defaultCacheMode&&this._armature&&!frt.canCache(this._armature))return this._defaultCacheMode=0,void Y("Animation cache mode doesn't support skeletal nesting");this.setAnimationCacheMode(this._defaultCacheMode)}},{key:"timeScale",get:function(){return this._timeScale},set:function(t){this._timeScale=t,this._armature&&!this.isAnimationCached()&&(this._armature.animation.timeScale=this.timeScale)}},{key:"debugBones",get:function(){return this._debugBones},set:function(t){this._debugBones=t,this._updateDebugDraw()}},{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._verifySockets(t),this._sockets=t,this._updateSocketBindings(),t.length>0&&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}(BL),ist.AnimationCacheMode=ust,v((Urt=ist).prototype,"dragonAsset",[krt],Object.getOwnPropertyDescriptor(Urt.prototype,"dragonAsset"),Urt.prototype),v(Urt.prototype,"dragonAtlasAsset",[Rrt],Object.getOwnPropertyDescriptor(Urt.prototype,"dragonAtlasAsset"),Urt.prototype),v(Urt.prototype,"_defaultArmatureIndex",[Frt],Object.getOwnPropertyDescriptor(Urt.prototype,"_defaultArmatureIndex"),Urt.prototype),v(Urt.prototype,"_animationIndex",[Lrt],Object.getOwnPropertyDescriptor(Urt.prototype,"_animationIndex"),Urt.prototype),v(Urt.prototype,"timeScale",[cst],Object.getOwnPropertyDescriptor(Urt.prototype,"timeScale"),Urt.prototype),Grt=zh(Urt.prototype,"playTimes",[cst],(function(){return-1})),Hrt=zh(Urt.prototype,"premultipliedAlpha",[cst],(function(){return!1})),v(Urt.prototype,"sockets",[Vrt],Object.getOwnPropertyDescriptor(Urt.prototype,"sockets"),Urt.prototype),Wrt=zh(Urt.prototype,"_defaultArmatureIndexValue",[cst],(function(){return-1})),jrt=zh(Urt.prototype,"_dragonAsset",[cst],(function(){return null})),qrt=zh(Urt.prototype,"_dragonAtlasAsset",[cst],(function(){return null})),Xrt=zh(Urt.prototype,"_armatureName",[cst],(function(){return""})),Yrt=zh(Urt.prototype,"_animationName",[cst],(function(){return""})),Jrt=zh(Urt.prototype,"_animationIndexValue",[cst],(function(){return 0})),Krt=zh(Urt.prototype,"_defaultCacheModeValue",[cst],(function(){return 0})),Qrt=zh(Urt.prototype,"_timeScale",[cst],(function(){return 1})),Zrt=zh(Urt.prototype,"_playTimes",[cst],(function(){return-1})),$rt=zh(Urt.prototype,"_debugBones",[cst],(function(){return!1})),tst=zh(Urt.prototype,"_enableBatch",[cst],(function(){return!1})),est=zh(Urt.prototype,"_sockets",[cst],(function(){return[]})),v(Urt.prototype,"customMaterial",[_st,Nrt],Object.getOwnPropertyDescriptor(Urt.prototype,"customMaterial"),Urt.prototype),zrt=Urt))||zrt);A.internal.ArmatureDisplay=pst;var mst,gst,yst,vst,bst,Sst,wst,xst,Tst,Ast,Cst,Dst=new cr(255,0,0,255),Bst=new cr(0,0,255,255),Ist=new cr(0,255,0,255),Mst=0,Pst=0,Est=0,Ost=0,kst=0,Rst=0,Fst=0,Lst=0,Vst=0,Nst=new Float32Array(4),zst=new ir(0,0,0),Ust=new Kr,Gst=null,Hst=null;function Wst(t,e){if(!t)return null;var i,n;switch(e){case 1:i=bst?1:2,n=1;break;case 10:i=7,n=4;break;case 12:i=1,n=8;break;default:i=bst?1:2,n=4}return Ast.getMaterialForBlend(i,n)}function jst(t,e){var i=t.a*e*vst,n=bst?i/255:1,r=t.r*mst*n/255,s=t.g*gst*n/255,a=t.b*yst*n/255;Nst[0]=r,Nst[1]=s,Nst[2]=a,Nst[3]=bst?1:i/255}var qst=null,Xst=function(){function t(){this.accessor=qst,this.vCount=32767}var e=t.prototype;return e.ensureAccessor=function(){if(!qst){var t=YE.root.device,e=YE.root.batcher2D,i=IF;this.accessor=qst=new NF(t,i,this.vCount),e.registerBufferAccessor(Number.parseInt("DRAGONBONES",36),qst)}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;s<i.length;++s){var a=i[s],o=a._localVertices.length%4;n+=0===o?a._localVertices.length/4:(a._localVertices.length-o)/4+1,r+=a._indices.length}(e=tL.add(IF,this.accessor)).resize(n,r),e.indices&&r===e.indices.length||(e.indices=new Uint16Array(r))}return e},e.updateRenderData=function(t){Ast=t,t._armature&&Qst(t)},e.updateColor=function(t){t&&(Ast=t)._markForUpdateRenderData()},t}(),Yst=new Xst;function Jst(t,e,i){var n=wst;Tst=n.chunk.vb,xst=n.indices;for(var r,s,a,o,h,u,l=t._slots,c=0,f=l.length;c<f;c++)if(o=(h=l[c])._color,h._visible&&h._displayData)if(i?Kr.multiply(h._worldMatrix,i,h._matrix):Kr.copy(h._worldMatrix,h._matrix),h.childArmature)Jst(h.childArmature,o.a/255,h._worldMatrix);else if(r=Wst(h.getTexture(),h._blendMode)){Gst||(Gst=r);var _=h.getTexture();if(Sst||r.hash!==Gst.hash||_&&Hst!==_){Sst=!1;var d=Rst-Vst;d>0&&(Ast._requestDrawData(Gst,Hst,Vst,d),Vst=Rst),Hst=_,Gst=r}jst(o,e),Ust.set(h._worldMatrix),s=h._localVertices,Pst=s.length/4,Mst=9*Pst,a=h._indices,kst=a.length;var p=!1;if(Est+Pst>Fst&&(Fst=Est+Pst,p=!0),Rst+kst>Lst&&(Lst=Rst+kst,p=!0),p){var m=xst,g=n.chunk.vertexOffset;n.resizeAndCopy(Fst,Lst>n.indexCount?Lst:n.indexCount),Tst=n.chunk.vb,Lst>xst.length&&(xst=n.indices=new Uint16Array(Lst));for(var y=n.chunk.vertexOffset-g,v=0;v<Rst;++v)xst[v]=m[v]+y}for(var b=0,S=s.length,w=Ost;b<S;w+=9)zst.x=s[b++],zst.y=s[b++],zst.z=0,zst.transformMat4(Ust),Tst[w]=zst.x,Tst[w+1]=zst.y,Tst[w+2]=zst.z,Tst[w+3]=s[b++],Tst[w+4]=s[b++],Tst.set(Nst,w+5);for(var x=n.chunk.vertexOffset,T=0,A=a.length,C=Rst;T<A;T++,C++)xst[C]=Est+a[T]+x;Ost+=Mst,Est+=Pst,Rst+=kst,Pst=0,kst=0}u=Rst-Vst,Hst&&u>0&&(Ast._requestDrawData(Gst,Hst,Vst,u),Vst=Rst),Ast.maxIndexCount<Lst&&(Ast.maxIndexCount=Lst),Ast.maxVertexCount<Fst&&(Ast.maxVertexCount=Fst)}function Kst(t,e){if(t){var i=t.segments;if(0!==i.length){var n=null,r=t.vertices,s=t.indices,a=0,o=0,h=0,u=0,l=0,c=t.colors,f=c[l++],_=f.vfOffset;jst(f,1);for(var d=wst,p=d.chunk.vb,m=d.indices,g=0,y=i.length;g<y;g++){var v=i[g];if(n=Wst(v.tex,v.blendMode)){if(Gst||(Gst=n),Sst||n.hash!==Gst.hash||v.tex&&v.tex!==Hst){Sst=!1;var b=Rst-Vst;b>0&&(Ast._requestDrawData(Gst,Hst,Vst,b),Vst=Rst),Gst=n,Hst=v.tex}Pst=v.vertexCount,kst=v.indexCount,a=d.chunk.vertexOffset;for(var S=Rst,w=Rst+kst;S<w;S++)m[S]=a+Est+s[h++];u=v.vfCount;var x=r.subarray(o,u);p.set(x,o);var T=0;if(e)for(var A=0,C=Pst;A<C;A++)zst.x=p[T],zst.y=p[T+1],zst.z=0,zst.transformMat4(e),p[T]=zst.x,p[T+1]=zst.y,p[T+2]=zst.z,T+=9;if(1&Cst)for(var D=o/9*5,B=o,I=o+u;B<I;B+=9,D+=5)D>=_&&(jst(f=c[l++],1),_=f.vfOffset),p.set(Nst,B+5);o+=u,Est+=Pst,Rst+=kst,Pst=0,kst=0}}var M=Rst-Vst;Hst&&M>0&&Ast._requestDrawData(Gst,Hst,Vst,M)}}}function Qst(t){var e=t._armature;if(e&&null!==t.renderData){Sst=!0,bst=t.premultipliedAlpha,t.drawList.reset(),Ast=t,t.node,wst=t.renderData,Ast=t,Cst=0,Gst=null;var i=t.color;mst=i.r/255,gst=i.g/255,yst=i.b/255,vst=t.node._uiProps.opacity,4294967295!==cr.toUint32(i)&&(Cst|=1);var n=t.node.getWorldMatrix();if(Mst=0,Est=0,Ost=0,kst=0,Rst=0,Vst=0,Fst=Ast.maxVertexCount,Lst=Ast.maxIndexCount,t.isAnimationCached())Kst(t._curFrame,n);else{Jst(e,1,n);var r=t._debugDraw;if(t.debugBones&&r){r.clear(),r.lineWidth=5,r.strokeColor=Dst,r.fillColor=Bst;for(var s=e.getBones(),a=0,o=s.length;a<o;a++){var h=s[a],u=Math.max(h.boneData.length,5),l=h.globalTransformMatrix.tx,c=h.globalTransformMatrix.ty,f=l+h.globalTransformMatrix.a*u,_=c+h.globalTransformMatrix.b*u;r.moveTo(l,c),r.lineTo(f,_),r.stroke(),r.circle(l,c,2*Math.PI),r.fill(),0===a&&(r.fillColor=Ist)}}}qst.getMeshBuffer(wst.chunk.bufferId).setDirty(),Ast=void 0}}A.internal.DragonBonesAssembler=Yst;var Zst={getAssembler:function(){return Yst}};pst.Assembler=Zst;var $st={Frame:0,Sound:1},tat=$st;t("eF",Object.freeze({__proto__:null,ActionData:Ait,ActionFrame:Ont,ActionTimelineState:ynt,ActionType:Gnt,Animation:unt,AnimationCache:crt,AnimationCacheMode:ust,AnimationConfig:Kit,AnimationData:Yit,AnimationFadeOutMode:{None:0,SameLayer:1,SameGroup:2,SameLayerAndGroup:3,All:4},AnimationState:lnt,AnimationTimelineState:Int,Armature:tnt,ArmatureCache:frt,ArmatureData:Dit,ArmatureDisplay:pst,ArmatureDisplayData:Nit,ArmatureType:Vnt,AttachUtil:rst,BaseFactory:Rnt,BaseObject:yit,BinaryDataParser:knt,BinaryOffset:Lnt,BlendMode:Hnt,BlendState:fnt,Bone:int,BoneAllTimelineState:bnt,BoneData:Bit,BonePose:cnt,BoneRotateTimelineState:wnt,BoneScaleTimelineState:xnt,BoneTimelineState:pnt,BoneTranslateTimelineState:Snt,BoneType:Nnt,BoundingBoxData:Wit,BoundingBoxDisplayData:Uit,BoundingBoxType:Unt,BuildArmaturePackage:Fnt,CCArmatureDisplay:Knt,CCFactory:Qnt,CCSlot:Jnt,CCTextureAtlasData:Xnt,CCTextureData:Ynt,CanvasData:kit,ColorTransform:Sit,Constraint:snt,ConstraintData:Pit,ConstraintTimelineState:gnt,DataParser:Pnt,DeformTimelineState:Dnt,DeformVertices:$it,DisplayData:Lit,DisplayType:znt,DragonBoneSocket:dst,DragonBones:git,DragonBonesAsset:wrt,DragonBonesAtlasAsset:Crt,DragonBonesData:Cit,DragonBonesEventType:$st,EllipseBoundingBoxData:qit,EventObject:Mnt,EventType:tat,ExtensionType:{FFD:0,AdjustColor:10,BevelFilter:11,BlurFilter:12,DropShadowFilter:13,GlowFilter:14,GradientBevelFilter:15,GradientGlowFilter:16},IKConstraint:ant,IKConstraintData:Eit,IKConstraintTimelineState:Bnt,ImageDisplayData:Vit,Matrix:vit,MeshDisplayData:zit,ObjectDataParser:Ent,PathConstraint:ont,PathConstraintData:Oit,PathDisplayData:Git,Point:wit,PolygonBoundingBoxData:Xit,Rectangle:xit,RectangleBoundingBoxData:jit,SkinData:Rit,Slot:rnt,SlotColorTimelineState:Cnt,SlotData:Mit,SlotDislayTimelineState:Ant,SlotTimelineState:mnt,Surface:nnt,SurfaceData:Iit,SurfaceTimelineState:Tnt,TextureAtlasData:Qit,TextureData:Zit,TimelineData:Jit,TimelineState:_nt,TimelineType:jnt,Transform:bit,TransformObject:ent,TweenTimelineState:dnt,TweenType:Wnt,UserData:Tit,VerticesData:Fit,WeightData:Hit,WorldClock:hnt,ZOrderTimelineState:vnt,simpleDragonBoneAssembler:Zst,timeScale:1}));var eat=function(t){function e(){var e;return(e=t.call(this)||this)._gpuDescriptorSet=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._layout=t.layout;var e=t.layout.gpuDescriptorSetLayout,i=e.bindings,n=e.descriptorIndices,r=e.descriptorCount;this._buffers=Array(r).fill(null),this._textures=Array(r).fill(null),this._samplers=Array(r).fill(null);var s=[];this._gpuDescriptorSet={gpuDescriptors:s,descriptorIndices:n};for(var a=0;a<i.length;++a)for(var o=i[a],h=0;h<o.count;h++){var u={type:o.descriptorType,gpuBuffer:null,gpuTexture:null,gpuSampler:null};s.push(u)}},i.destroy=function(){this._layout=null,this._gpuDescriptorSet=null},i.update=function(){if(this._isDirty&&this._gpuDescriptorSet){for(var t=this._gpuDescriptorSet.gpuDescriptors,e=0;e<t.length;++e)if(t[e].type&np){var i=this._buffers[e];i&&(t[e].gpuBuffer=i.gpuBuffer||i.gpuBufferView)}else t[e].type&rp&&(this._textures[e]&&(t[e].gpuTexture=this._textures[e].gpuTexture),this._samplers[e]&&(t[e].gpuSampler=this._samplers[e].gpuSampler));this._isDirty=!1}},n(e,[{key:"gpuDescriptorSet",get:function(){return this._gpuDescriptorSet}}]),e}(wp),iat=Math.max,nat=Math.min;function rat(t){switch(t){case 4:case 6:case 14:case 16:case 24:case 25:case 27:case 36:case 35:case 37:case 39:case 51:case 53:case 56:case 58:case 60:case 61:case 62:case 63:case 64:case 66:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 79:case 81:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:default:return 5121;case 5:case 7:case 15:case 17:case 26:case 28:case 38:case 40:case 65:case 67:case 80:case 82:return 5120;case 8:case 18:case 29:case 41:return 36193;case 9:case 19:case 30:case 42:return 5123;case 10:case 20:case 31:case 43:return 5122;case 11:case 21:case 32:case 44:case 48:case 69:case 68:return 5126;case 12:case 22:case 33:case 45:case 52:case 54:return 5125;case 13:case 23:case 34:case 46:return 5124;case 47:return 33635;case 49:return 32820;case 50:return 32819;case 55:return 34042}}function sat(t){switch(t){case 47:return 36194;case 49:return 32855;case 50:return 32854;case 41:return 34842;case 44:return 34836;case 37:return 35907;case 54:return 33189;case 55:return 34041;default:return ht(16309),6408}}function aat(t){switch(t){case 1:return 6406;case 2:return 6409;case 3:return 6410;case 24:case 29:case 32:case 47:return 6407;case 36:case 35:case 37:case 41:case 44:case 49:case 50:return 6408;case 54:return 6402;case 55:return 34041;case 56:return 33776;case 57:return 33777;case 58:return 35916;case 59:return 35917;case 60:return 33778;case 61:return 35918;case 62:return 33779;case 63:return 35919;case 72:return 36196;case 73:return 37492;case 74:return 37493;case 75:return 37494;case 76:return 37495;case 77:return 37496;case 78:return 37497;case 79:return 37488;case 80:return 37489;case 81:return 37490;case 82:return 37491;case 83:return 35841;case 84:return 35843;case 85:return 35840;case 86:return 35842;case 89:return 37808;case 90:return 37809;case 91:return 37810;case 92:return 37811;case 93:return 37812;case 94:return 37813;case 95:return 37814;case 96:return 37815;case 97:return 37816;case 98:return 37817;case 99:return 37818;case 100:return 37819;case 101:return 37820;case 102:return 37821;case 103:return 37840;case 104:return 37841;case 105:return 37842;case 106:return 37843;case 107:return 37844;case 108:return 37845;case 109:return 37846;case 110:return 37847;case 111:return 37848;case 112:return 37849;case 113:return 37850;case 114:return 37851;case 115:return 37852;case 116:return 37853;default:return ht(16310),6408}}function oat(t){switch(t){case 1:return 35670;case 2:return 35671;case 3:return 35672;case 4:return 35673;case 5:return 5124;case 6:return 35667;case 7:return 35668;case 8:return 35669;case 9:return 5125;case 13:return 5126;case 14:return 35664;case 15:return 35665;case 16:return 35666;case 17:return 35674;case 21:return 35675;case 25:return 35676;case 28:return 35678;case 31:return 35680;default:return ht(16311),0}}function hat(t){switch(t){case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:return Int32Array;case 13:case 14:case 15:case 16:case 17:case 21:case 25:return Float32Array;default:return ht(16312),Float32Array}}function uat(t){switch(t){case 35670:return 1;case 35671:return 2;case 35672:return 3;case 35673:return 4;case 5124:return 5;case 35667:return 6;case 35668:return 7;case 35669:return 8;case 5125:return 9;case 5126:return 13;case 35664:return 14;case 35665:return 15;case 35666:return 16;case 35674:return 17;case 35675:return 21;case 35676:return 25;case 35678:return 28;case 35680:return 31;default:return ht(16313),0}}function lat(t){switch(t){case 35670:case 5124:case 5125:case 5126:case 35678:case 35680:return 4;case 35671:case 35667:case 35664:return 8;case 35672:case 35668:case 35665:return 12;case 35673:case 35669:case 35666:case 35674:return 16;case 35675:return 36;case 35676:return 64;default:return ht(16314),0}}function cat(t){switch(t){case 35674:return 2;case 35675:return 3;case 35676:return 4;default:return 1}}var fat=[512,513,514,515,516,517,518,519],_at=[0,7680,7681,7682,7683,5386,34055,34056],dat=[32774,32778,32779,32775,32776],pat=[0,1,770,772,771,773,768,774,769,775,776,32769,32770,32771,32772];function mat(t,e){var i=t.gl,n=t.stateCache,r=2&e.memUsage?35048:35044;if(8&e.usage){e.glTarget=34962;var s=i.createBuffer();s&&(e.glBuffer=s,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),Dat.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),Dat.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 gat(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),Dat.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),Dat.gpuInputAssembler=null,i.bindBuffer(34963,null),n.glElementArrayBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}function yat(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;a<s.length;++a)e.indirects.setDrawInfo(n+a,s[a])}else{var o=i,h=t.gl,u=t.stateCache;switch(e.glTarget){case 34962:t.extensions.useVAO&&u.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),u.glVAO=null),Dat.gpuInputAssembler=null,u.glArrayBuffer!==e.glBuffer&&(h.bindBuffer(34962,e.glBuffer),u.glArrayBuffer=e.glBuffer);break;case 34963:t.extensions.useVAO&&u.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),u.glVAO=null),Dat.gpuInputAssembler=null,u.glElementArrayBuffer!==e.glBuffer&&(h.bindBuffer(34963,e.glBuffer),u.glElementArrayBuffer=e.glBuffer);break;default:return void ht(16316)}Vo.os===Oo.IOS&&2&e.memUsage&&0===n&&r===o.byteLength?h.bufferData(e.glTarget,o,h.DYNAMIC_DRAW):r===o.byteLength?h.bufferSubData(e.glTarget,n,o):h.bufferSubData(e.glTarget,n,o.slice(0,r))}}function vat(t,e){var i=t.gl,n=t.stateCache;e.glFormat=e.glInternalFmt=aat(e.format),e.glType=rat(e.format);var r=e.width,s=e.height;switch(e.type){case 1:e.glTarget=3553;var a=iat(r,s);if(a>t.capabilities.maxTextureSize&&ht(9100,a,t.capabilities.maxTextureSize),t.textureExclusive[e.format]||t.extensions.WEBGL_depth_texture||!ip[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),ip[e.format].isCompressed)for(var h=0;h<e.mipLevel;++h){var u=op(e.format,r,s,1),l=new Uint8Array(u);i.compressedTexImage2D(3553,h,e.glInternalFmt,r,s,0,l),r=iat(1,r>>1),s=iat(1,s>>1)}else for(var c=0;c<e.mipLevel;++c)i.texImage2D(3553,c,e.glInternalFmt,r,s,0,e.glFormat,e.glType,null),r=iat(1,r>>1),s=iat(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=sat(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=iat(r,s);if(f>t.capabilities.maxCubeMapTextureSize&&ht(9100,f,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var _=n.glTexUnits[n.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(34067,e.glTexture),_.glTexture=e.glTexture),ip[e.format].isCompressed)for(var d=0;d<6;++d){r=e.width,s=e.height;for(var p=0;p<e.mipLevel;++p){var m=op(e.format,r,s,1),g=new Uint8Array(m);i.compressedTexImage2D(34069+d,p,e.glInternalFmt,r,s,0,g),r=iat(1,r>>1),s=iat(1,s>>1)}}else for(var y=0;y<6;++y){r=e.width,s=e.height;for(var v=0;v<e.mipLevel;++v)i.texImage2D(34069+y,v,e.glInternalFmt,r,s,0,e.glFormat,e.glType,null),r=iat(1,r>>1),s=iat(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 bat(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;a<r.length;a++)r[a].glTexture===e.glTexture&&(i.activeTexture(33984+a),s=a,i.bindTexture(e.glTarget,null),r[a].glTexture=null);n.texUnit=s,e.glTexture=null}if(e.glRenderbuffer){var o=n.glRenderbuffer;i.deleteRenderbuffer(e.glRenderbuffer),o===e.glRenderbuffer&&(i.bindRenderbuffer(36161,null),n.glRenderbuffer=null),e.glRenderbuffer=null}}function Sat(t,e){if(e.size){var i=t.gl,n=t.stateCache,r=e.width,s=e.height;switch(e.type){case 1:e.glTarget=3553;var a=iat(r,s);if(a>t.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),ip[e.format].isCompressed)for(var h=0;h<e.mipLevel;++h){var u=op(e.format,r,s,1),l=new Uint8Array(u);i.compressedTexImage2D(3553,h,e.glInternalFmt,r,s,0,l),r=iat(1,r>>1),s=iat(1,s>>1)}else for(var c=0;c<e.mipLevel;++c)i.texImage2D(3553,c,e.glInternalFmt,r,s,0,e.glFormat,e.glType,null),r=iat(1,r>>1),s=iat(1,s>>1)}break;case 3:e.glTarget=34067;var f=iat(r,s);f>t.capabilities.maxCubeMapTextureSize&&ht(9100,f,t.capabilities.maxTextureSize);var _=n.glTexUnits[n.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(34067,e.glTexture),_.glTexture=e.glTexture),ip[e.format].isCompressed)for(var d=0;d<6;++d){r=e.width,s=e.height;for(var p=0;p<e.mipLevel;++p){var m=op(e.format,r,s,1),g=new Uint8Array(m);i.compressedTexImage2D(34069+d,p,e.glInternalFmt,r,s,0,g),r=iat(1,r>>1),s=iat(1,s>>1)}}else for(var y=0;y<6;++y){r=e.width,s=e.height;for(var v=0;v<e.mipLevel;++v)i.texImage2D(34069+y,v,e.glInternalFmt,r,s,0,e.glFormat,e.glType,null),r=iat(1,r>>1),s=iat(1,s>>1)}break;default:ht(16317),e.type=1,e.glTarget=3553}}}function wat(t,e){for(var i=0;i<e.gpuColorTextures.length;++i)if(e.gpuColorTextures[i].isSwapchainTexture)return void(e.isOffscreen=!1);var n=t.gl,r=t.stateCache,s=[],a=n.createFramebuffer();if(a){e.glFramebuffer=a,r.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(36160,e.glFramebuffer);for(var o=0;o<e.gpuColorTextures.length;++o){var h=e.gpuColorTextures[o];h&&(h.glTexture?n.framebufferTexture2D(36160,36064+o,h.glTarget,h.glTexture,0):n.framebufferRenderbuffer(36160,36064+o,36161,h.glRenderbuffer),s.push(36064+o),e.width=nat(e.width,h.width),e.height=nat(e.height,h.height))}var u=e.gpuDepthStencilTexture;if(u){var l=ip[u.format].hasStencil?33306:36096;u.glTexture?n.framebufferTexture2D(36160,l,u.glTarget,u.glTexture,0):n.framebufferRenderbuffer(36160,l,36161,u.glRenderbuffer),e.width=nat(e.width,u.width),e.height=nat(e.height,u.height)}t.extensions.WEBGL_draw_buffers&&t.extensions.WEBGL_draw_buffers.drawBuffersWEBGL(s);var c=n.checkFramebufferStatus(36160);if(36053!==c)switch(c){case 36054:ht(16318);break;case 36055:ht(16319);break;case 36057:ht(16320);break;case 36061:ht(16321)}r.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(36160,r.glFramebuffer)}}function xat(t,e){for(var i,n=t.gl,r=t.stateCache,s=function(){var t=e.gpuStages[a],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 o=n.createShader(i);if(o&&(t.glShader=o,n.shaderSource(t.glShader,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+++" "}))),J(n.getShaderInfoLog(t.glShader));for(var h=0;h<e.gpuStages.length;h++){var u=e.gpuStages[a];u.glShader&&(n.deleteShader(u.glShader),u.glShader=null)}return{v:void 0}}},a=0;a<e.gpuStages.length;a++)if(i=s())return i.v;var o=n.createProgram();if(o){e.glProgram=o;for(var h=0;h<e.gpuStages.length;h++){var u=e.gpuStages[h];n.attachShader(e.glProgram,u.glShader)}if(n.linkProgram(e.glProgram),t.extensions.destroyShadersImmediately)for(var l=0;l<e.gpuStages.length;l++){var c=e.gpuStages[l];c.glShader&&(n.detachShader(e.glProgram,c.glShader),n.deleteShader(c.glShader),c.glShader=null)}if(!n.getProgramParameter(e.glProgram,35714))return ht(16326,e.name),void J(n.getProgramInfoLog(e.glProgram));rt(16325,e.name);var f=n.getProgramParameter(e.glProgram,35721);e.glInputs=new Array(f);for(var _=0;_<f;++_){var d=n.getActiveAttrib(e.glProgram,_);if(d){var p,m=d.type,g=d.name,y=d.size,v=g.indexOf("[");p=-1!==v?g.substring(0,v):g;var b=n.getAttribLocation(e.glProgram,p),S=uat(m),w=lat(m);e.glInputs[_]={binding:b,name:p,type:S,stride:w,count:y,size:w*y,glType:m,glLoc:b}}}if(e.blocks.length>0){e.glBlocks=new Array(e.blocks.length);for(var x=0;x<e.blocks.length;++x){var T=e.blocks[x],C={set:T.set,binding:T.binding,name:T.name,size:0,glUniforms:new Array(T.members.length),glActiveUniforms:[]};e.glBlocks[x]=C;for(var D=0;D<T.members.length;++D){var B=T.members[D],I=oat(B.type),M=lat(I),P=M*B.count;C.glUniforms[D]={binding:-1,name:B.name,type:B.type,stride:M,count:B.count,size:P,offset:0,glType:I,glLoc:null,array:null}}}}for(var E=0;E<e.subpassInputs.length;++E){var O=e.subpassInputs[E];e.samplerTextures.push(new vd(O.set,O.binding,O.name,28,O.count))}if(e.samplerTextures.length>0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var k=0;k<e.samplerTextures.length;++k){var R=e.samplerTextures[k];e.glSamplerTextures[k]={set:R.set,binding:R.binding,name:R.name,type:R.type,count:R.count,units:[],glUnits:null,glType:oat(R.type),glLoc:null}}}for(var F=n.getProgramParameter(e.glProgram,35718),L=0;L<F;++L){var V=n.getActiveUniform(e.glProgram,L);if(V&&35678!==V.type&&35680!==V.type){var N=n.getUniformLocation(e.glProgram,V.name);if(t.extensions.isLocationActive(N)){var z,U=V.name.indexOf("[");z=-1!==U?V.name.substring(0,U):V.name;for(var G=0;G<e.glBlocks.length;G++)for(var H=e.glBlocks[G],W=0;W<H.glUniforms.length;W++){var j=H.glUniforms[W];if(j.name===z){j.glLoc=N,j.count=V.size,j.size=j.stride*j.count,j.array=new(hat(j.type))(j.size/4),H.glActiveUniforms.push(j);break}}}}}for(var q=0;q<e.glBlocks.length;q++)for(var X=e.glBlocks[q],Y=0;Y<X.glUniforms.length;Y++){var K=X.glUniforms[Y];K.offset=X.size/4,X.size+=K.size}var Q=[],Z=[],$=t.bindingMappings,tt=t.capabilities,et=t.stateCache.texUnitCacheMap,it=tt.maxTextureUnits;if(A.rendering&&A.rendering.enableEffectImport)for(var nt=0;nt<e.samplerTextures.length;++nt){var st=e.samplerTextures[nt],at=n.getUniformLocation(e.glProgram,st.name);t.extensions.isLocationActive(at)&&(Q.push(e.glSamplerTextures[nt]),Z.push(at)),void 0===et[st.name]&&(et[st.name]=st.flattened%it)}else{for(var ot=0,ut=0;ut<e.blocks.length;++ut)e.blocks[ut].set===$.flexibleSet&&ot++;for(var lt=0,ct=0;ct<e.samplerTextures.length;++ct){var ft=e.samplerTextures[ct],_t=n.getUniformLocation(e.glProgram,ft.name);if(t.extensions.isLocationActive(_t)&&(Q.push(e.glSamplerTextures[ct]),Z.push(_t)),void 0===et[ft.name]){var dt=ft.binding+$.samplerTextureOffsets[ft.set]+lt;ft.set===$.flexibleSet&&(dt-=ot),et[ft.name]=dt%it,lt+=ft.count-1}}}if(Q.length){for(var pt=[],mt=0;mt<Q.length;++mt){var gt=Q[mt],yt=et[gt.name];if(void 0!==yt){gt.glLoc=Z[mt];for(var vt=0;vt<gt.count;++vt){for(;pt[yt];)yt=(yt+1)%it;gt.units.push(yt),pt[yt]=!0}}}for(var bt=0,St=0;St<Q.length;++St){var wt=Q[St];if(!t.extensions.isLocationActive(wt.glLoc)){wt.glLoc=Z[St];for(var xt=0;xt<wt.count;++xt){for(;pt[bt];)bt=(bt+1)%it;void 0===et[wt.name]&&(et[wt.name]=bt),wt.units.push(bt),pt[bt]=!0}}}r.glProgram!==e.glProgram&&n.useProgram(e.glProgram);for(var Tt=0;Tt<Q.length;Tt++){var At=Q[Tt];At.glUnits=new Int32Array(At.units),n.uniform1iv(At.glLoc,At.glUnits)}r.glProgram!==e.glProgram&&n.useProgram(r.glProgram)}for(var Ct=0;Ct<e.glBlocks.length;)e.glBlocks[Ct].glActiveUniforms.length?Ct++:(e.glBlocks[Ct]=e.glBlocks[e.glBlocks.length-1],e.glBlocks.length--);e.glSamplerTextures=Q}}function Tat(t,e){if(e.glProgram){var i=t.gl,n=t.stateCache;if(!t.extensions.destroyShadersImmediately)for(var r=0;r<e.gpuStages.length;r++){var s=e.gpuStages[r];s.glShader&&(i.detachShader(e.glProgram,s.glShader),i.deleteShader(s.glShader),s.glShader=null)}i.deleteProgram(e.glProgram),n.glProgram===e.glProgram&&(i.useProgram(null),n.glProgram=null),e.glProgram=null}}function Aat(t,e){t.gl,e.glAttribs=new Array(e.attributes.length);for(var i=[0,0,0,0,0,0,0,0],n=0;n<e.attributes.length;++n){var r=e.attributes[n],s=r.format,a=r.isNormalized,o=r.isInstanced,h=void 0!==r.stream?r.stream:0,u=e.gpuVertexBuffers[h],l=rat(s),c=ip[s].size;e.glAttribs[n]={name:r.name,glBuffer:u.glBuffer,glType:l,size:c,count:ip[s].count,stride:u.stride,componentCount:cat(l),isNormalized:void 0!==a&&a,isInstanced:void 0!==o&&o,offset:i[h]},i[h]+=c}}function Cat(t,e){for(var i=t.stateCache,n=e.glVAOs.values(),r=n.next(),s=t.extensions.OES_vertex_array_object,a=i.glVAO;!r.done;)s.deleteVertexArrayOES(r.value),a===r.value&&(s.bindVertexArrayOES(null),a=null),r=n.next();i.glVAO=a,e.glVAOs.clear()}var Dat={gpuPipelineState:null,gpuInputAssembler:null,glPrimitive:0},Bat=new K_;function Iat(t,e,i,n,r,s,a){var o=t.gl,h=t.stateCache,u=0;if(i){var l=i.lodLevel;Bat.x=n.x<<l,Bat.y=n.y<<l,Bat.width=n.width<<l,Bat.height=n.height<<l}if(i&&e){var c=i.glFramebuffer,f=Bat.x,_=Bat.y,d=Bat.width,p=Bat.height;h.glFramebuffer!==c&&(o.bindFramebuffer(36160,c),h.glFramebuffer=c);var m=h.viewport;m.left===f&&m.top===_&&m.width===d&&m.height===p||(o.viewport(f,_,d,p),m.left=f,m.top=_,m.width=d,m.height=p);var g=h.scissorRect;g.x===f&&g.y===_&&g.width===d&&g.height===p||(o.scissor(f,_,d,p),g.x=f,g.y=_,g.width=d,g.height=p);var y=r.length;t.extensions.WEBGL_draw_buffers||(y=1);for(var v=h.dss,b=0;b<y;++b){var S=e.colorAttachments[b];if(0!==S.format)switch(S.loadOp){case 0:break;case 1:15!==h.bs.targets[0].blendColorMask&&o.colorMask(!0,!0,!0,!0);var w=r[0];o.clearColor(w.x,w.y,w.z,w.w),u|=16384}}if(e.depthStencilAttachment&&0!==e.depthStencilAttachment.format){switch(e.depthStencilAttachment.depthLoadOp){case 0:break;case 1:v.depthWrite||o.depthMask(!0),o.clearDepth(s),u|=256}if(ip[e.depthStencilAttachment.format].hasStencil)switch(e.depthStencilAttachment.stencilLoadOp){case 0:break;case 1:v.stencilWriteMaskFront||o.stencilMaskSeparate(1028,65535),v.stencilWriteMaskBack||o.stencilMaskSeparate(1029,65535),o.clearStencil(a),u|=1024}}if(u&&o.clear(u),16384&u){var x=h.bs.targets[0].blendColorMask;if(15!==x){var T=!!(1&x),A=!!(2&x),C=!!(4&x),D=!!(8&x);o.colorMask(T,A,C,D)}}256&u&&!v.depthWrite&&o.depthMask(!1),1024&u&&(v.stencilWriteMaskFront||o.stencilMaskSeparate(1028,0),v.stencilWriteMaskBack||o.stencilMaskSeparate(1029,0))}}function Mat(t,e,i,n,r,s){var a,o,h,u=t.gl,l=t.stateCache,c=l.dss,f=l.bs,_=e&&e.gpuShader,d=!1;if(e&&Dat.gpuPipelineState!==e){if(Dat.gpuPipelineState=e,Dat.glPrimitive=e.glPrimitive,e.gpuShader){var p=e.gpuShader.glProgram;l.glProgram!==p&&(u.useProgram(p),l.glProgram=p,d=!0)}var m=e.rs,g=l.rs;if(m){if(g.cullMode!==m.cullMode){switch(m.cullMode){case 0:u.disable(2884);break;case 1:u.enable(2884),u.cullFace(1028);break;case 2:u.enable(2884),u.cullFace(1029)}g.cullMode=m.cullMode}var y=m.isFrontFaceCCW;g.isFrontFaceCCW!==y&&(u.frontFace(y?2305:2304),g.isFrontFaceCCW=y),g.depthBias===m.depthBias&&g.depthBiasSlop===m.depthBiasSlop||(u.polygonOffset(m.depthBias,m.depthBiasSlop),g.depthBias=m.depthBias,g.depthBiasSlop=m.depthBiasSlop),g.lineWidth!==m.lineWidth&&(u.lineWidth(m.lineWidth),g.lineWidth=m.lineWidth)}var v=e.dss;v&&(c.depthTest!==v.depthTest&&(v.depthTest?u.enable(2929):u.disable(2929),c.depthTest=v.depthTest),c.depthWrite!==v.depthWrite&&(u.depthMask(v.depthWrite),c.depthWrite=v.depthWrite),c.depthFunc!==v.depthFunc&&(u.depthFunc(fat[v.depthFunc]),c.depthFunc=v.depthFunc),c.stencilTestFront===v.stencilTestFront&&c.stencilTestBack===v.stencilTestBack||(v.stencilTestFront||v.stencilTestBack?u.enable(2960):u.disable(2960),c.stencilTestFront=v.stencilTestFront,c.stencilTestBack=v.stencilTestBack),c.stencilFuncFront===v.stencilFuncFront&&c.stencilRefFront===v.stencilRefFront&&c.stencilReadMaskFront===v.stencilReadMaskFront||(u.stencilFuncSeparate(1028,fat[v.stencilFuncFront],v.stencilRefFront,v.stencilReadMaskFront),c.stencilFuncFront=v.stencilFuncFront,c.stencilRefFront=v.stencilRefFront,c.stencilReadMaskFront=v.stencilReadMaskFront),c.stencilFailOpFront===v.stencilFailOpFront&&c.stencilZFailOpFront===v.stencilZFailOpFront&&c.stencilPassOpFront===v.stencilPassOpFront||(u.stencilOpSeparate(1028,_at[v.stencilFailOpFront],_at[v.stencilZFailOpFront],_at[v.stencilPassOpFront]),c.stencilFailOpFront=v.stencilFailOpFront,c.stencilZFailOpFront=v.stencilZFailOpFront,c.stencilPassOpFront=v.stencilPassOpFront),c.stencilWriteMaskFront!==v.stencilWriteMaskFront&&(u.stencilMaskSeparate(1028,v.stencilWriteMaskFront),c.stencilWriteMaskFront=v.stencilWriteMaskFront),c.stencilFuncBack===v.stencilFuncBack&&c.stencilRefBack===v.stencilRefBack&&c.stencilReadMaskBack===v.stencilReadMaskBack||(u.stencilFuncSeparate(1029,fat[v.stencilFuncBack],v.stencilRefBack,v.stencilReadMaskBack),c.stencilFuncBack=v.stencilFuncBack,c.stencilRefBack=v.stencilRefBack,c.stencilReadMaskBack=v.stencilReadMaskBack),c.stencilFailOpBack===v.stencilFailOpBack&&c.stencilZFailOpBack===v.stencilZFailOpBack&&c.stencilPassOpBack===v.stencilPassOpBack||(u.stencilOpSeparate(1029,_at[v.stencilFailOpBack],_at[v.stencilZFailOpBack],_at[v.stencilPassOpBack]),c.stencilFailOpBack=v.stencilFailOpBack,c.stencilZFailOpBack=v.stencilZFailOpBack,c.stencilPassOpBack=v.stencilPassOpBack),c.stencilWriteMaskBack!==v.stencilWriteMaskBack&&(u.stencilMaskSeparate(1029,v.stencilWriteMaskBack),c.stencilWriteMaskBack=v.stencilWriteMaskBack));var b=e.bs;if(b){f.isA2C!==b.isA2C&&(b.isA2C?u.enable(32926):u.disable(32926),f.isA2C=b.isA2C),f.blendColor.x===b.blendColor.x&&f.blendColor.y===b.blendColor.y&&f.blendColor.z===b.blendColor.z&&f.blendColor.w===b.blendColor.w||(u.blendColor(b.blendColor.x,b.blendColor.y,b.blendColor.z,b.blendColor.w),f.blendColor.x=b.blendColor.x,f.blendColor.y=b.blendColor.y,f.blendColor.z=b.blendColor.z,f.blendColor.w=b.blendColor.w);var S=b.targets[0],w=f.targets[0];w.blend!==S.blend&&(S.blend?u.enable(3042):u.disable(3042),w.blend=S.blend),w.blendEq===S.blendEq&&w.blendAlphaEq===S.blendAlphaEq||(u.blendEquationSeparate(dat[S.blendEq],dat[S.blendAlphaEq]),w.blendEq=S.blendEq,w.blendAlphaEq=S.blendAlphaEq),w.blendSrc===S.blendSrc&&w.blendDst===S.blendDst&&w.blendSrcAlpha===S.blendSrcAlpha&&w.blendDstAlpha===S.blendDstAlpha||(u.blendFuncSeparate(pat[S.blendSrc],pat[S.blendDst],pat[S.blendSrcAlpha],pat[S.blendDstAlpha]),w.blendSrc=S.blendSrc,w.blendDst=S.blendDst,w.blendSrcAlpha=S.blendSrcAlpha,w.blendDstAlpha=S.blendDstAlpha),w.blendColorMask!==S.blendColorMask&&(u.colorMask(!!(1&S.blendColorMask),!!(2&S.blendColorMask),!!(4&S.blendColorMask),!!(8&S.blendColorMask)),w.blendColorMask=S.blendColorMask)}}if(e&&e.gpuPipelineLayout&&_){for(var x=_.glBlocks.length,T=e.gpuPipelineLayout.dynamicOffsetIndices,A=0;A<x;A++){var C=_.glBlocks[A],D=n[C.set],B=D&&D.descriptorIndices[C.binding],I=B>=0&&D.gpuDescriptors[B],M=null,P=0;if(I&&I.gpuBuffer){var E=I.gpuBuffer,O=T[C.set],k=O&&O[C.binding];k>=0&&(P=r[k]),"vf32"in E?M=E.vf32:(P+=E.offset,M=E.gpuBuffer.vf32),P>>=2}if(M)for(var R=C.glActiveUniforms.length,F=0;F<R;F++){var L=C.glActiveUniforms[F];switch(L.glType){case 35670:case 5124:for(var V=0;V<L.array.length;++V){var N=L.offset+P+V;if(M[N]!==L.array[V]){for(var z=V,U=N;z<L.array.length;++z,++U)L.array[z]=M[U];u.uniform1iv(L.glLoc,L.array);break}}break;case 35671:case 35667:for(var G=0;G<L.array.length;++G){var H=L.offset+P+G;if(M[H]!==L.array[G]){for(var W=G,j=H;W<L.array.length;++W,++j)L.array[W]=M[j];u.uniform2iv(L.glLoc,L.array);break}}break;case 35672:case 35668:for(var q=0;q<L.array.length;++q){var X=L.offset+P+q;if(M[X]!==L.array[q]){for(var Y=q,J=X;Y<L.array.length;++Y,++J)L.array[Y]=M[J];u.uniform3iv(L.glLoc,L.array);break}}break;case 35673:case 35669:for(var K=0;K<L.array.length;++K){var Q=L.offset+P+K;if(M[Q]!==L.array[K]){for(var Z=K,$=Q;Z<L.array.length;++Z,++$)L.array[Z]=M[$];u.uniform4iv(L.glLoc,L.array);break}}break;case 5126:for(var tt=0;tt<L.array.length;++tt){var et=L.offset+P+tt;if(M[et]!==L.array[tt]){for(var it=tt,nt=et;it<L.array.length;++it,++nt)L.array[it]=M[nt];u.uniform1fv(L.glLoc,L.array);break}}break;case 35664:for(var rt=0;rt<L.array.length;++rt){var st=L.offset+P+rt;if(M[st]!==L.array[rt]){for(var at=rt,ot=st;at<L.array.length;++at,++ot)L.array[at]=M[ot];u.uniform2fv(L.glLoc,L.array);break}}break;case 35665:for(var ht=0;ht<L.array.length;++ht){var ut=L.offset+P+ht;if(M[ut]!==L.array[ht]){for(var lt=ht,ct=ut;lt<L.array.length;++lt,++ct)L.array[lt]=M[ct];u.uniform3fv(L.glLoc,L.array);break}}break;case 35666:for(var ft=0;ft<L.array.length;++ft){var _t=L.offset+P+ft;if(M[_t]!==L.array[ft]){for(var dt=ft,pt=_t;dt<L.array.length;++dt,++pt)L.array[dt]=M[pt];u.uniform4fv(L.glLoc,L.array);break}}break;case 35674:for(var mt=0;mt<L.array.length;++mt){var gt=L.offset+P+mt;if(M[gt]!==L.array[mt]){for(var yt=mt,vt=gt;yt<L.array.length;++yt,++vt)L.array[yt]=M[vt];u.uniformMatrix2fv(L.glLoc,!1,L.array);break}}break;case 35675:for(var bt=0;bt<L.array.length;++bt){var St=L.offset+P+bt;if(M[St]!==L.array[bt]){for(var wt=bt,xt=St;wt<L.array.length;++wt,++xt)L.array[wt]=M[xt];u.uniformMatrix3fv(L.glLoc,!1,L.array);break}}break;case 35676:for(var Tt=0;Tt<L.array.length;++Tt){var At=L.offset+P+Tt;if(M[At]!==L.array[Tt]){for(var Ct=Tt,Dt=At;Ct<L.array.length;++Ct,++Dt)L.array[Ct]=M[Dt];u.uniformMatrix4fv(L.glLoc,!1,L.array);break}}}}}for(var Bt=_.glSamplerTextures.length,It=0;It<Bt;It++)for(var Mt=_.glSamplerTextures[It],Pt=n[Mt.set],Et=Pt&&Pt.descriptorIndices[Mt.binding],Ot=Et>=0&&Pt.gpuDescriptors[Et],kt=Mt.units.length,Rt=0;Rt<kt;Rt++){var Ft=Mt.units[Rt];if(Ot&&Ot.gpuSampler){if(Ot.gpuTexture&&Ot.gpuTexture.size>0){var Lt=Ot.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=Ot.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)}Ot=Pt.gpuDescriptors[++Et]}}}if(i&&_&&(d||Dat.gpuInputAssembler!==i)){Dat.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(_.glProgram);if(!Gt){var Ht;Gt=Ut.createVertexArrayOES(),i.glVAOs.set(_.glProgram,Gt),Ut.bindVertexArrayOES(Gt),u.bindBuffer(34962,null),u.bindBuffer(34963,null),l.glArrayBuffer=null,l.glElementArrayBuffer=null;for(var Wt=_.glInputs.length,jt=0;jt<Wt;jt++){var qt=_.glInputs[jt];Ht=null;for(var Xt=i.glAttribs.length,Yt=0;Yt<Xt;Yt++){var Jt=i.glAttribs[Yt];if(Jt.name===qt.name){Ht=Jt;break}}if(Ht){l.glArrayBuffer!==Ht.glBuffer&&(u.bindBuffer(34962,Ht.glBuffer),l.glArrayBuffer=Ht.glBuffer);for(var Kt=0;Kt<Ht.componentCount;++Kt){var Qt=qt.glLoc+Kt,Zt=Ht.offset+Ht.size*Kt;u.enableVertexAttribArray(Qt),l.glCurrentAttribLocs[Qt]=!0,u.vertexAttribPointer(Qt,Ht.count,Ht.glType,Ht.isNormalized,Ht.stride,Zt),zt&&zt.vertexAttribDivisorANGLE(Qt,Ht.isInstanced?1:0)}}}var $t=i.gpuIndexBuffer;$t&&u.bindBuffer(34963,$t.glBuffer),Ut.bindVertexArrayOES(null),u.bindBuffer(34962,null),u.bindBuffer(34963,null),l.glArrayBuffer=null,l.glElementArrayBuffer=null}l.glVAO!==Gt&&(Ut.bindVertexArrayOES(Gt),l.glVAO=Gt)}else{for(var te=0;te<t.capabilities.maxVertexAttributes;++te)l.glCurrentAttribLocs[te]=!1;for(var ee=_.glInputs.length,ie=0;ie<ee;ie++){for(var ne=_.glInputs[ie],re=null,se=i.glAttribs.length,ae=0;ae<se;ae++){var oe=i.glAttribs[ae];if(oe.name===ne.name){re=oe;break}}if(re){l.glArrayBuffer!==re.glBuffer&&(u.bindBuffer(34962,re.glBuffer),l.glArrayBuffer=re.glBuffer);for(var he=0;he<re.componentCount;++he){var ue=ne.glLoc+he,le=re.offset+re.size*he;!l.glEnabledAttribLocs[ue]&&ue>=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;fe<t.capabilities.maxVertexAttributes;++fe)l.glEnabledAttribLocs[fe]!==l.glCurrentAttribLocs[fe]&&(u.disableVertexAttribArray(fe),l.glEnabledAttribLocs[fe]=!1)}}if(e&&e.dynamicStates.length)for(var _e=e.dynamicStates.length,de=0;de<_e;de++)switch(e.dynamicStates[de]){case 1:l.rs.lineWidth!==s.lineWidth&&(u.lineWidth(s.lineWidth),l.rs.lineWidth=s.lineWidth);break;case 2:l.rs.depthBias===s.depthBiasConstant&&l.rs.depthBiasSlop===s.depthBiasSlope||(u.polygonOffset(s.depthBiasConstant,s.depthBiasSlope),l.rs.depthBias=s.depthBiasConstant,l.rs.depthBiasSlop=s.depthBiasSlope);break;case 4:var pe=s.blendConstant;f.blendColor.x===pe.x&&f.blendColor.y===pe.y&&f.blendColor.z===pe.z&&f.blendColor.w===pe.w||(u.blendColor(pe.x,pe.y,pe.z,pe.w),f.blendColor.copy(pe));break;case 16:var me=s.stencilStatesFront,ge=s.stencilStatesBack;c.stencilWriteMaskFront!==me.writeMask&&(u.stencilMaskSeparate(1028,me.writeMask),c.stencilWriteMaskFront=me.writeMask),c.stencilWriteMaskBack!==ge.writeMask&&(u.stencilMaskSeparate(1029,ge.writeMask),c.stencilWriteMaskBack=ge.writeMask);break;case 32:var ye=s.stencilStatesFront,ve=s.stencilStatesBack;c.stencilRefFront===ye.reference&&c.stencilReadMaskFront===ye.compareMask||(u.stencilFuncSeparate(1028,fat[c.stencilFuncFront],ye.reference,ye.compareMask),c.stencilRefFront=ye.reference,c.stencilReadMaskFront=ye.compareMask),c.stencilRefBack===ve.reference&&c.stencilReadMaskBack===ve.compareMask||(u.stencilFuncSeparate(1029,fat[c.stencilFuncBack],ve.reference,ve.compareMask),c.stencilRefBack=ve.reference,c.stencilReadMaskBack=ve.compareMask)}}function Pat(t,e){var i=t.gl,n=t.extensions,r=n.ANGLE_instanced_arrays,s=n.WEBGL_multi_draw,a=Dat.gpuInputAssembler,o=Dat.glPrimitive;if(a){var h=a.gpuIndexBuffer;if(a.gpuIndirectBuffer){var u=a.gpuIndirectBuffer.indirects;if(u.drawByIndex){for(var l=0;l<u.drawCount;l++)u.byteOffsets[l]=u.offsets[l]*h.stride;if(s)u.instancedDraw?s.multiDrawElementsInstancedWEBGL(o,u.counts,0,a.glIndexType,u.byteOffsets,0,u.instances,0,u.drawCount):s.multiDrawElementsWEBGL(o,u.counts,0,a.glIndexType,u.byteOffsets,0,u.drawCount);else for(var c=0;c<u.drawCount;c++)u.instances[c]&&r?r.drawElementsInstancedANGLE(o,u.counts[c],a.glIndexType,u.byteOffsets[c],u.instances[c]):i.drawElements(o,u.counts[c],a.glIndexType,u.byteOffsets[c])}else if(s)u.instancedDraw?s.multiDrawArraysInstancedWEBGL(o,u.offsets,0,u.counts,0,u.instances,0,u.drawCount):s.multiDrawArraysWEBGL(o,u.offsets,0,u.counts,0,u.drawCount);else for(var f=0;f<u.drawCount;f++)u.instances[f]&&r?r.drawArraysInstancedANGLE(o,u.offsets[f],u.counts[f],u.instances[f]):i.drawArrays(o,u.offsets[f],u.counts[f])}else if(e.instanceCount&&r)if(h){if(e.indexCount>0){var _=e.firstIndex*h.stride;r.drawElementsInstancedANGLE(o,e.indexCount,a.glIndexType,_,e.instanceCount)}}else e.vertexCount>0&&r.drawArraysInstancedANGLE(o,e.firstVertex,e.vertexCount,e.instanceCount);else if(h){if(e.indexCount>0){var d=e.firstIndex*h.stride;i.drawElements(o,e.indexCount,a.glIndexType,d)}}else e.vertexCount>0&&i.drawArrays(o,e.firstVertex,e.vertexCount)}}function Eat(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;u<n.length;u++){var l=n[u];r.texSubImage2D(3553,l.texSubres.mipLevel,l.texOffset.x,l.texOffset.y,i.glFormat,i.glType,e[o++])}break;case 34067:for(var c=0;c<n.length;c++){var f=n[c],_=f.texOffset,d=f.texSubres,p=d.baseArrayLayer+d.layerCount;for(h=d.baseArrayLayer;h<p;++h)r.texSubImage2D(34069+h,d.mipLevel,_.x,_.y,i.glFormat,i.glType,e[o++])}break;default:ht(16327)}1&i.flags&&i.isPowerOf2&&r.generateMipmap(i.glTarget)}var Oat=new Uint8Array(1);function kat(t,e,i,n,r){var s=fp(e).height,a=op(e,r.width,r.height,r.depth),o=op(e,n.width,1,1),h=op(e,n.width,n.height,1),u=op(e,r.width,1,1),l=cp(ip[e]);Oat.byteLength<a&&(Oat=new Uint8Array(a));for(var c=0,f=i,_=0;_<r.depth;_++){f=i+h*_;for(var d=0;d<r.height;d+=s)Oat.subarray(c,c+u).set(new Uint8Array(t.buffer,t.byteOffset+f,u)),c+=u,f+=o}var p=a/l.BYTES_PER_ELEMENT;return lt(Number.isInteger(p),9101),new l(Oat.buffer,0,p)}function Rat(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,u=ip[i.format],l=cp(u),c=u.isCompressed,f=fp(i.format),_=new Q_,d=new J_,p=new Q_;switch(i.glTarget){case 3553:for(var m=0;m<n.length;m++){var g=n[m],y=g.texSubres.mipLevel,v=g.texOffset,b=g.texExtent,S=b.width,w=b.height,x=f.width,T=f.height,A=g.buffStride;d.x=0===v.x?0:_p(v.x,x),d.y=0===v.y?0:_p(v.y,T),_.width=S<x?S:_p(S,x),_.height=w<T?S:_p(w,T),p.width=A>0?A:_.width,p.height=g.buffTexHeight>0?g.buffTexHeight:_.height;var C=S+d.x===i.width>>y?S:_.width,D=w+d.y===i.height>>y?w:_.height,B=void 0,I=e[o++];if(p.width===_.width&&p.height===_.height){var M=op(i.format,C,D,1)/l.BYTES_PER_ELEMENT;lt(Number.isInteger(M),9101),B=new l(I.buffer,I.byteOffset+g.buffOffset,M)}else B=kat(I,i.format,g.buffOffset,p,_);c?36196===i.glInternalFmt||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(3553,y,i.glInternalFmt,C,D,0,B):r.compressedTexSubImage2D(3553,y,d.x,d.y,C,D,i.glFormat,B):r.texSubImage2D(3553,y,d.x,d.y,C,D,i.glFormat,i.glType,B)}break;case 34067:for(var P=0;P<n.length;P++){var E=n[P],O=E.texSubres.mipLevel,k=E.texOffset,R=E.texExtent,F=E.texSubres,L=R.width,V=R.height,N=f.width,z=f.height;d.x=0===k.x?0:_p(k.x,N),d.y=0===k.y?0:_p(k.y,z),_.width=L<N?L:_p(L,N),_.height=V<z?L:_p(V,z),p.width=E.buffStride>0?E.buffStride:_.width,p.height=E.buffTexHeight>0?E.buffTexHeight:_.height;var U=L+d.x===i.width>>O?L:_.width,G=V+d.y===i.height>>O?V:_.height,H=F.baseArrayLayer+F.layerCount;for(h=F.baseArrayLayer;h<H;++h){var W=void 0,j=e[o++];if(p.width===_.width&&p.height===_.height){var q=op(i.format,U,G,1)/l.BYTES_PER_ELEMENT;lt(Number.isInteger(q),9101),W=new l(j.buffer,j.byteOffset+E.buffOffset,q)}else W=kat(j,i.format,E.buffOffset,p,_);c?36196===i.glInternalFmt||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(34069+h,O,i.glInternalFmt,U,G,0,W):r.compressedTexSubImage2D(34069+h,O,d.x,d.y,U,G,i.glFormat,W):r.texSubImage2D(34069+h,O,d.x,d.y,U,G,i.glFormat,i.glType,W)}}break;default:ht(16327)}1&i.flags&&r.generateMipmap(i.glTarget)}function Fat(t,e,i,n){var r=t.gl,s=t.stateCache,a=r.createFramebuffer();r.bindFramebuffer(36160,a);var o=0,h=0,u=1,l=1;if(3553===e.glTarget)for(var c=0;c<n.length;c++){var f=n[c];r.framebufferTexture2D(36160,36064,e.glTarget,e.glTexture,f.texSubres.mipLevel),o=f.texOffset.x,h=f.texOffset.y,u=f.texExtent.width,l=f.texExtent.height,r.readPixels(o,h,u,l,e.glFormat,e.glType,i[c])}else ht(16399);r.bindFramebuffer(36160,null),s.glFramebuffer=null,r.deleteFramebuffer(a)}function Lat(t,e,i,n,r){t.blitManager.draw(e,i,n,r)}var Vat=function(){function t(){}return t.setInstance=function(e){t._instance=e},n(t,null,[{key:"instance",get:function(){return t._instance}}]),t}();function Nat(t){return new Int32Array(t)}Vat._instance=null;var zat=function(){function t(){this.drawCount=0,this.drawByIndex=!1,this.instancedDraw=!1,this._capacity=4,this.counts=Nat(this._capacity),this.offsets=Nat(this._capacity),this.instances=Nat(this._capacity),this.byteOffsets=Nat(this._capacity)}var e=t.prototype;return e.clearDraws=function(){this.drawCount=0,this.drawByIndex=!1,this.instancedDraw=!1},e.setDrawInfo=function(t,e){this._ensureCapacity(t),this.drawByIndex=e.indexCount>0,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=R(t);var e=Nat(this._capacity),i=Nat(this._capacity),n=Nat(this._capacity);this.byteOffsets=Nat(this._capacity),e.set(this.counts),i.set(this.offsets),n.set(this.instances),this.counts=e,this.offsets=i,this.instances=n}},t}(),Uat=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=Vat.instance.bindingMappingInfo.maxBlockCounts[0];this._gpuShader={name:"Blit Pass",blocks:[new yd(0,0,"BlitParams",[new gd("tilingOffsetSrc",16,1),new gd("tilingOffsetDst",16,1)],1)],samplerTextures:[new vd(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:[]},xat(Vat.instance,this._gpuShader),this._gpuDescriptorSetLayout={bindings:[new Nd(0,1,1,1),new Nd(t,16,1,16)],dynamicBindings:[],descriptorIndices:[],descriptorCount:t+1};for(var e=0;e<t;e++)this._gpuDescriptorSetLayout.descriptorIndices[e]=0;this._gpuDescriptorSetLayout.descriptorIndices.push(1),this._gpuPipelineLayout={gpuSetLayouts:[this._gpuDescriptorSetLayout],dynamicOffsetCount:0,dynamicOffsetOffsets:[0],dynamicOffsetIndices:[[]]},this._gpuPipelineState={glPrimitive:5,gpuShader:this._gpuShader,gpuPipelineLayout:this._gpuPipelineLayout,rs:null,dss:new Cp(!1,!1),bs:null,dynamicStates:[],gpuRenderPass:null},this._gpuVertexBuffer={usage:8,memUsage:1,size:64,stride:16,buffer:null,vf32:null,indirects:new zat,glTarget:0,glBuffer:null},mat(Vat.instance,this._gpuVertexBuffer),Vat.instance.memoryStatus.bufferSize+=this._gpuVertexBuffer.size;var i=new Float32Array([-1,-1,0,0,1,-1,1,0,-1,1,0,1,1,1,1,1]);yat(Vat.instance,this._gpuVertexBuffer,i,0,i.length),this._gpuInputAssembler={attributes:[new Cd("a_position",21),new Cd("a_texCoord",21)],gpuVertexBuffers:[this._gpuVertexBuffer],gpuIndexBuffer:null,gpuIndirectBuffer:null,glAttribs:[],glIndexType:0,glVAOs:new Map},Aat(Vat.instance,this._gpuInputAssembler),this._gpuPointSampler={glMinFilter:9728,glMagFilter:9728,glWrapS:10497,glWrapT:10497,glWrapR:10497},this._gpuLinearSampler={glMinFilter:9729,glMagFilter:9729,glWrapS:10497,glWrapT:10497,glWrapR:10497},this._uniformBuffer=new Float32Array(8),this._gpuUniformBuffer={usage:16,memUsage:1,size:32,stride:32,buffer:this._uniformBuffer,vf32:null,indirects:new zat,glTarget:0,glBuffer:null},mat(Vat.instance,this._gpuUniformBuffer),Vat.instance.memoryStatus.bufferSize+=this._gpuUniformBuffer.size,this._gpuDescriptorSet={gpuDescriptors:[{type:1,gpuBuffer:this._gpuUniformBuffer,gpuTexture:null,gpuSampler:null},{type:16,gpuBuffer:null,gpuTexture:null,gpuSampler:null}],descriptorIndices:this._gpuDescriptorSetLayout.descriptorIndices},this._drawInfo=new cd(4,0,0,0,0,0,0),this._glFramebuffer=Vat.instance.gl.createFramebuffer()}var e=t.prototype;return e.destroy=function(){this._glFramebuffer&&(Vat.instance.gl.deleteFramebuffer(this._glFramebuffer),this._glFramebuffer=null),this._gpuVertexBuffer&&(Vat.instance.memoryStatus.bufferSize-=this._gpuVertexBuffer.size,gat(Vat.instance,this._gpuVertexBuffer)),this._gpuUniformBuffer&&(Vat.instance.memoryStatus.bufferSize-=this._gpuUniformBuffer.size,gat(Vat.instance,this._gpuUniformBuffer)),this._gpuShader&&Tat(Vat.instance,this._gpuShader),this._gpuInputAssembler&&Cat(Vat.instance,this._gpuInputAssembler)},e.draw=function(t,e,i,n){var r=Vat.instance,s=r.gl,a=r.stateCache,o=a.glFramebuffer;if(s.viewport(0,0,e.width,e.height),s.scissor(0,0,e.width,e.height),this._uniformBuffer&&this._gpuUniformBuffer&&this._gpuPipelineState&&this._gpuInputAssembler&&this._gpuDescriptorSet&&this._drawInfo){var h=this._gpuDescriptorSet.gpuDescriptors[1];h.gpuTexture=t,h.gpuSampler=1===n?this._gpuPointSampler:this._gpuLinearSampler;var u=ip[e.format],l=36064;u.hasStencil?l=33306:u.hasDepth&&(l=36096);var c=i.map((function(t,e){return e}));c.sort((function(t,e){return i[t].srcSubres.mipLevel-i[e].srcSubres.mipLevel})),a.glFramebuffer!==this._glFramebuffer&&(s.bindFramebuffer(36160,this._glFramebuffer),a.glFramebuffer=this._glFramebuffer);var f=i[0].dstSubres.mipLevel;e.glTexture?s.framebufferTexture2D(36160,l,e.glTarget,e.glTexture,f):s.framebufferRenderbuffer(36160,l,36161,e.glRenderbuffer);for(var _=0;_<c.length;++_){var d=i[c[_]];t.glTexture&&f!==d.srcSubres.mipLevel&&(f=d.srcSubres.mipLevel,s.framebufferTexture2D(36160,l,e.glTarget,e.glTexture,f));var p=t.width,m=t.height,g=e.width,y=e.height;this._uniformBuffer[0]=d.srcExtent.width/p,this._uniformBuffer[1]=d.srcExtent.height/m,this._uniformBuffer[2]=d.srcOffset.x/p,this._uniformBuffer[3]=d.srcOffset.y/m,this._uniformBuffer[4]=d.dstExtent.width/g,this._uniformBuffer[5]=d.dstExtent.height/y,this._uniformBuffer[6]=d.dstOffset.x/g,this._uniformBuffer[7]=d.dstOffset.y/y,yat(r,this._gpuUniformBuffer,this._uniformBuffer,0,4*this._uniformBuffer.length),Mat(r,this._gpuPipelineState,this._gpuInputAssembler,[this._gpuDescriptorSet],[],null),Pat(r,this._drawInfo)}a.glFramebuffer!==o&&(s.bindFramebuffer(36160,o),a.glFramebuffer=o);var v=a.viewport;s.viewport(v.left,v.top,v.width,v.height);var b=a.scissorRect;s.scissor(b.x,b.y,b.width,b.height)}},t}(),Gat=function(t){function e(){var e;return(e=t.call(this)||this)._gpuBuffer=null,e._gpuBufferView=null,e._uniformBuffer=null,e}s(e,t);var i=e.prototype;return 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._gpuBufferView={gpuBuffer:e.gpuBuffer,offset:t.offset,range:t.range}}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,16&this._usage&&this._size>0&&(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 zat,glTarget:0,glBuffer:null},16&this._usage&&(this._gpuBuffer.buffer=this._uniformBuffer),mat(Vat.instance,this._gpuBuffer),Vat.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(gat(Vat.instance,this._gpuBuffer),Vat.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=Vat.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),Dat.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),Dat.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),Vat.instance.memoryStatus.bufferSize-=a,Vat.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,yat(Vat.instance,this._gpuBuffer,t,0,i))},n(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}},{key:"gpuBufferView",get:function(){return this._gpuBufferView}}]),e}(pp),Hat=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 Kd,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=Vat.instance.bindingMappings.blockOffsets.length,i=0;i<e;i++)this._curGPUDescriptorSets.push(null)},i.destroy=function(){},i.begin=function(){this._curGPUPipelineState=null,this._curGPUInputAssembler=null,this._curGPUDescriptorSets.length=0,this._numDrawCalls=0,this._numInstances=0,this._numTris=0},i.end=function(){this._isStateInvalied&&this.bindStates(),this._isInRenderPass=!1},i.beginRenderPass=function(){ht(16401),this._isInRenderPass=!0},i.endRenderPass=function(){this._isInRenderPass=!1},i.bindPipelineState=function(t){var e=t.gpuPipelineState;e!==this._curGPUPipelineState&&(this._curGPUPipelineState=e,this._isStateInvalied=!0)},i.bindDescriptorSet=function(t,e,i){var n=e.gpuDescriptorSet;if(n!==this._curGPUDescriptorSets[t]&&(this._curGPUDescriptorSets[t]=n,this._isStateInvalied=!0),i){var r,s=null==(r=this._curGPUPipelineState)?void 0:r.gpuPipelineLayout;if(s){for(var a=this._curDynamicOffsets,o=s.dynamicOffsetOffsets[t],h=0;h<i.length;h++)a[o+h]=i[h];this._isStateInvalied=!0}}},i.bindInputAssembler=function(t){var e=t.getGpuInputAssembler();this._curGPUInputAssembler=e,this._isStateInvalied=!0},i.setViewport=function(t){var e=this._curDynamicStates.viewport;e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height&&e.minDepth===t.minDepth&&e.maxDepth===t.maxDepth||(e.left=t.left,e.top=t.top,e.width=t.width,e.height=t.height,e.minDepth=t.minDepth,e.maxDepth=t.maxDepth,this._isStateInvalied=!0)},i.setScissor=function(t){var e=this._curDynamicStates.scissor;e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height||(e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,this._isStateInvalied=!0)},i.setLineWidth=function(t){this._curDynamicStates.lineWidth!==t&&(this._curDynamicStates.lineWidth=t,this._isStateInvalied=!0)},i.setDepthBias=function(t,e,i){var n=this._curDynamicStates;n.depthBiasConstant===t&&n.depthBiasClamp===e&&n.depthBiasSlope===i||(n.depthBiasConstant=t,n.depthBiasClamp=e,n.depthBiasSlope=i,this._isStateInvalied=!0)},i.setBlendConstants=function(t){var e=this._curDynamicStates.blendConstant;e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w||(e.copy(t),this._isStateInvalied=!0)},i.setDepthBound=function(t,e){var i=this._curDynamicStates;i.depthMinBounds===t&&i.depthMaxBounds===e||(i.depthMinBounds=t,i.depthMaxBounds=e,this._isStateInvalied=!0)},i.setStencilWriteMask=function(t,e){var i=this._curDynamicStates.stencilStatesFront,n=this._curDynamicStates.stencilStatesBack;1&t&&i.writeMask!==e&&(i.writeMask=e,this._isStateInvalied=!0),2&t&&n.writeMask!==e&&(n.writeMask=e,this._isStateInvalied=!0)},i.setStencilCompareMask=function(t,e,i){var n=this._curDynamicStates.stencilStatesFront,r=this._curDynamicStates.stencilStatesBack;1&t&&(n.compareMask===i&&n.reference===e||(n.reference=e,n.compareMask=i,this._isStateInvalied=!0)),2&t&&(r.compareMask===i&&r.reference===e||(r.reference=e,r.compareMask=i,this._isStateInvalied=!0))},i.draw=function(){ht(16328)},i.updateBuffer=function(){ht(16329)},i.copyBuffersToTexture=function(){ht(16330)},i.execute=function(){ht(16402)},i.pipelineBarrier=function(){},i.bindStates=function(){ht(16401)},i.blitTexture=function(){ht(16401)},e}(mp),Wat=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this)._gpuFramebuffer=null,e._gpuColorTextures=[],e._gpuDepthStencilTexture=void 0,e}return e.getGpuFramebuffer=function(){return this._gpuFramebuffer},e.initialize=function(t){var e,i=this;this._renderPass=t.renderPass,this._colorTextures=t.colorTextures||[];for(var n=this._depthStencilTexture=t.depthStencilTexture||null,r=0,s=[],a=0;a<t.colorTextures.length;++a){var o=t.colorTextures[a];o&&(s.push(o.gpuTexture),r=o.lodLevel)}var h=null;n&&(h=n.gpuTexture,r=n.lodLevel);var u=Number.MAX_SAFE_INTEGER,l=Number.MAX_SAFE_INTEGER;this._gpuFramebuffer={gpuRenderPass:t.renderPass.gpuRenderPass,gpuColorTextures:s,gpuDepthStencilTexture:h,glFramebuffer:null,isOffscreen:!0,get width(){return this.gpuColorTextures.length>0?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},wat(Vat.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=Vat.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;i<t.gpuColorTextures.length;i++)if(t.gpuColorTextures[i].glTexture!==this._gpuColorTextures[i])return!0;if((null==(e=t.gpuDepthStencilTexture)?void 0:e.glTexture)!==this._gpuDepthStencilTexture)return!0}return!1}}]),i}(bp),jat=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this)._gpuInputAssembler=null,e}return e.getGpuInputAssembler=function(){return this._gpuInputAssembler},e.initialize=function(t){if(0!==t.vertexBuffers.length){if(this._attributes=t.attributes,this._attributesHash=this.computeAttributesHash(),this._vertexBuffers=t.vertexBuffers,t.indexBuffer)this._indexBuffer=t.indexBuffer,this._drawInfo.indexCount=this._indexBuffer.size/this._indexBuffer.stride,this._drawInfo.firstIndex=0;else{var e=this._vertexBuffers[0];this._drawInfo.vertexCount=e.size/e.stride,this._drawInfo.firstVertex=0,this._drawInfo.vertexOffset=0}this._drawInfo.instanceCount=0,this._drawInfo.firstInstance=0,this._indirectBuffer=t.indirectBuffer||null;for(var i=new Array(t.vertexBuffers.length),n=0;n<t.vertexBuffers.length;++n){var r=t.vertexBuffers[n];r.gpuBuffer&&(i[n]=r.gpuBuffer)}var s=null,a=0;if(t.indexBuffer&&(s=t.indexBuffer.gpuBuffer))switch(s.stride){case 1:a=5121;break;case 2:a=5123;break;case 4:a=5125;break;default:ht(16332)}var o=null;t.indirectBuffer&&(o=t.indirectBuffer.gpuBuffer),this._gpuInputAssembler={attributes:t.attributes,gpuVertexBuffers:i,gpuIndexBuffer:s,gpuIndirectBuffer:o,glAttribs:[],glIndexType:a,glVAOs:new Map},Aat(Vat.instance,this._gpuInputAssembler)}else ht(16331)},e.destroy=function(){var t=Vat.instance;this._gpuInputAssembler&&t.extensions.useVAO&&Cat(t,this._gpuInputAssembler),this._gpuInputAssembler=null},i}(Sp),qat=function(t){function e(){var e;return(e=t.call(this)||this)._gpuDescriptorSetLayout=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){Array.prototype.push.apply(this._bindings,t.bindings);for(var e=0,i=-1,n=[],r=0;r<this._bindings.length;r++){var s=this._bindings[r];n.push(e),e+=s.count,s.binding>i&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;o<this._bindings.length;o++){var h=this._bindings[o];this._bindingIndices[h.binding]=o,a[h.binding]=n[o]}for(var u=[],l=0;l<this._bindings.length;l++){var c=this._bindings[l];if(10&c.descriptorType)for(var f=0;f<c.count;f++)u.push(c.binding)}this._gpuDescriptorSetLayout={bindings:this._bindings,dynamicBindings:u,descriptorIndices:a,descriptorCount:e}},i.destroy=function(){this._bindings.length=0},n(e,[{key:"gpuDescriptorSetLayout",get:function(){return this._gpuDescriptorSetLayout}}]),e}(xp),Xat=function(t){function e(){var e;return(e=t.call(this)||this)._gpuPipelineLayout=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){Array.prototype.push.apply(this._setLayouts,t.setLayouts);for(var e=[],i=[],n=0,r=[],s=0;s<this._setLayouts.length;s++){for(var a=this._setLayouts[s],o=a.gpuDescriptorSetLayout.dynamicBindings,h=Array(a.bindingIndices.length).fill(-1),u=0;u<o.length;u++){var l=o[u];h[l]<0&&(h[l]=n+u)}i.push(a.gpuDescriptorSetLayout),e.push(h),r.push(n),n+=o.length}this._gpuPipelineLayout={gpuSetLayouts:i,dynamicOffsetIndices:e,dynamicOffsetCount:n,dynamicOffsetOffsets:r}},i.destroy=function(){this._setLayouts.length=0},n(e,[{key:"gpuPipelineLayout",get:function(){return this._gpuPipelineLayout}}]),e}(Tp),Yat=[0,1,3,2,0,0,0,4,5,6,0,0,0,0],Jat=function(t){function e(){var e;return(e=t.call(this)||this)._gpuPipelineState=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._primitive=t.primitive,this._shader=t.shader,this._pipelineLayout=t.pipelineLayout;var e=this._bs;if(t.blendState){var i=t.blendState,n=i.targets;n&&n.forEach((function(t,i){e.setTarget(i,t)})),void 0!==i.isA2C&&(e.isA2C=i.isA2C),void 0!==i.isIndepend&&(e.isIndepend=i.isIndepend),void 0!==i.blendColor&&(e.blendColor=i.blendColor)}Object.assign(this._rs,t.rasterizerState),Object.assign(this._dss,t.depthStencilState),this._is=t.inputState,this._renderPass=t.renderPass,this._dynamicStates=t.dynamicStates;for(var r=[],s=0;s<31;s++)this._dynamicStates&1<<s&&r.push(1<<s);this._gpuPipelineState={glPrimitive:Yat[t.primitive],gpuShader:t.shader.gpuShader,gpuPipelineLayout:t.pipelineLayout.gpuPipelineLayout,rs:t.rasterizerState,dss:t.depthStencilState,bs:t.blendState,gpuRenderPass:t.renderPass.gpuRenderPass,dynamicStates:r}},i.destroy=function(){this._gpuPipelineState=null},n(e,[{key:"gpuPipelineState",get:function(){return this._gpuPipelineState}}]),e}(Mp),Kat=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.beginRenderPass=function(t,e,i,n,r,s){Iat(Vat.instance,t.gpuRenderPass,e.getGpuFramebuffer(),i,n,r,s),this._isInRenderPass=!0},i.draw=function(t){if(this._isInRenderPass){this._isStateInvalied&&this.bindStates();var e="drawInfo"in t?t.drawInfo:t;Pat(Vat.instance,e),++this._numDrawCalls,this._numInstances+=e.instanceCount;var i=e.indexCount||e.vertexCount;if(this._curGPUPipelineState)switch(this._curGPUPipelineState.glPrimitive){case 4:this._numTris+=i/3*Math.max(e.instanceCount,1);break;case 5:case 6:this._numTris+=(i-2)*Math.max(e.instanceCount,1)}}else ht(16328)},i.setViewport=function(t){var e=Vat.instance,i=e.stateCache,n=e.gl;i.viewport.left===t.left&&i.viewport.top===t.top&&i.viewport.width===t.width&&i.viewport.height===t.height||(n.viewport(t.left,t.top,t.width,t.height),i.viewport.left=t.left,i.viewport.top=t.top,i.viewport.width=t.width,i.viewport.height=t.height)},i.setScissor=function(t){var e=Vat.instance,i=e.stateCache,n=e.gl;i.scissorRect.x===t.x&&i.scissorRect.y===t.y&&i.scissorRect.width===t.width&&i.scissorRect.height===t.height||(n.scissor(t.x,t.y,t.width,t.height),i.scissorRect.x=t.x,i.scissorRect.y=t.y,i.scissorRect.width=t.width,i.scissorRect.height=t.height)},i.updateBuffer=function(t,e,i){if(this._isInRenderPass)ht(16329);else{var n,r=t.gpuBuffer;r&&(n=void 0!==i?i:64&t.usage?0:e.byteLength,yat(Vat.instance,r,e,0,n))}},i.copyBuffersToTexture=function(t,e,i){if(this._isInRenderPass)ht(16330);else{var n=e.gpuTexture;n&&Rat(Vat.instance,t,n,i)}},i.execute=function(){ht(16402)},i.bindStates=function(){Mat(Vat.instance,this._curGPUPipelineState,this._curGPUInputAssembler,this._curGPUDescriptorSets,this._curDynamicOffsets,this._curDynamicStates),this._isStateInvalied=!1},i.blitTexture=function(t,e,i,n){var r=t.gpuTexture,s=e.gpuTexture;Lat(Vat.instance,r,s,i,n)},e}(Hat),Qat=function(t){function e(){var e;return(e=t.call(this)||this).numDrawCalls=0,e.numInstances=0,e.numTris=0,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._type=t.type},i.destroy=function(){},i.submit=function(t){for(var e=t.length,i=0;i<e;i++){var n=t[i];this.numDrawCalls+=n.numDrawCalls,this.numInstances+=n.numInstances,this.numTris+=n.numTris}},i.clear=function(){this.numDrawCalls=0,this.numInstances=0,this.numTris=0},e}(Pp),Zat=function(t){function e(){var e;return(e=t.call(this)||this)._gpuRenderPass=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._colorInfos=t.colorAttachments,this._depthStencilInfo=t.depthStencilAttachment,this._subpasses=t.subpasses,this._gpuRenderPass={colorAttachments:this._colorInfos,depthStencilAttachment:this._depthStencilInfo},this._hash=this.computeHash()},i.destroy=function(){this._gpuRenderPass=null},n(e,[{key:"gpuRenderPass",get:function(){return this._gpuRenderPass}}]),e}(Ep),$at=[10497,33648,33071,33071],tot=function(t){function e(e,i){var n;(n=t.call(this,e,i)||this)._gpuSampler=null;var r,s,a=n._info.minFilter,o=n._info.magFilter,h=n._info.mipFilter;r=2===a||3===a?2===h||3===h?9987:1===h?9985:9729:2===h||3===h?9986:1===h?9984:9728,s=2===o||3===o?9729:9728;var u=$at[n._info.addressU],l=$at[n._info.addressV],c=$at[n._info.addressW];return n._gpuSampler={glMinFilter:r,glMagFilter:s,glWrapS:u,glWrapT:l,glWrapR:c},n}return s(e,t),n(e,[{key:"gpuSampler",get:function(){return this._gpuSampler}}]),e}(Op),eot=function(t){function e(){var e;return(e=t.call(this)||this)._gpuShader=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._name=t.name,this._stages=t.stages,this._attributes=t.attributes,this._blocks=t.blocks,this._samplers=t.samplers,this._gpuShader={name:t.name,blocks:t.blocks.slice(),samplerTextures:t.samplerTextures.slice(),subpassInputs:t.subpassInputs.slice(),gpuStages:new Array(t.stages.length),glProgram:null,glInputs:[],glUniforms:[],glBlocks:[],glSamplerTextures:[]};for(var e=0;e<t.stages.length;++e){var i=t.stages[e];this._gpuShader.gpuStages[e]={type:i.stage,source:i.source,glShader:null}}},i.destroy=function(){this._gpuShader&&(Tat(Vat.instance,this._gpuShader),this._gpuShader=null)},n(e,[{key:"gpuShader",get:function(){return null===this._gpuShader.glProgram&&xat(Vat.instance,this._gpuShader),this._gpuShader}}]),e}(kp),iot=function(){function t(){this.glArrayBuffer=null,this.glElementArrayBuffer=null,this.glVAO=null,this.texUnit=0,this.glTexUnits=[],this.glRenderbuffer=null,this.glFramebuffer=null,this.viewport=new nd,this.scissorRect=new K_(0,0,0,0),this.rs=new Ap,this.dss=new Cp,this.bs=new Bp,this.glProgram=null,this.glEnabledAttribLocs=[],this.glCurrentAttribLocs=[],this.texUnitCacheMap={}}return t.prototype.initialize=function(t,e){for(var i=0;i<t;++i)this.glTexUnits.push({glTexture:null});this.glEnabledAttribLocs.length=e,this.glEnabledAttribLocs.fill(!1),this.glCurrentAttribLocs.length=e,this.glCurrentAttribLocs.fill(!1)},t}(),not=function(t){function e(){var e;return(e=t.call(this)||this)._gpuTexture=null,e._lodLevel=0,e}s(e,t);var i=e.prototype;return i.initialize=function(t,e){var i=this,n=Vat.instance,r=t,s=t;"texture"in t&&(r=s.texture.info,i._isTextureView=!0);var a=i._info;a.copy(r);var o=i._viewInfo;i._isPowerOf2=sp(a.width)&&sp(a.height),i._size=hp(a.format,i.width,i.height,i.depth,a.levelCount)*a.layerCount,i._isTextureView?(o.copy(s),i._lodLevel=s.baseLevel,i._gpuTexture=s.texture._gpuTexture):(i._gpuTexture={type:r.type,format:r.format,usage:r.usage,width:r.width,height:r.height,depth:r.depth,size:i._size,arrayLayer:r.layerCount,mipLevel:r.levelCount,samples:r.samples,flags:r.flags,isPowerOf2:i._isPowerOf2,glTarget:0,glInternalFmt:0,glFormat:0,glType:0,glUsage:0,glTexture:null,glRenderbuffer:null,glWrapS:0,glWrapT:0,glMinFilter:0,glMagFilter:0,isSwapchainTexture:e||!1},i._gpuTexture.isSwapchainTexture||(vat(n,i._gpuTexture),n.memoryStatus.textureSize+=i._size),o.texture=i,o.type=t.type,o.format=t.format,o.baseLevel=0,o.levelCount=t.levelCount,o.baseLayer=0,o.layerCount=t.layerCount)},i.destroy=function(){var t=this,e=Vat.instance;!t._isTextureView&&t._gpuTexture&&(bat(e,t._gpuTexture),e.memoryStatus.textureSize-=t._size,t._gpuTexture=null)},i.getTextureHandle=function(){var t=this._gpuTexture;return t?t.glTexture?t.glTexture:t.glRenderbuffer?t.glRenderbuffer:0:0},i.resize=function(t,i){var n=this,r=Vat.instance,s=n._info;if(s.width!==t||s.height!==i){s.levelCount===e.getLevelCount(s.width,s.height)?s.levelCount=e.getLevelCount(t,i):s.levelCount>1&&(s.levelCount=Math.min(s.levelCount,e.getLevelCount(t,i)));var a=n._size;s.width=t,s.height=i,n._size=hp(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||(Sat(r,o),r.memoryStatus.textureSize-=a,r.memoryStatus.textureSize+=n._size))}},i.initAsSwapchainTexture=function(t){var e=new dd;e.format=t.format,e.usage=ip[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),rot="webglcontextlost";function sot(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 aot(t,e){for(var i=["","WEBKIT_","MOZ_"],n=0;n<i.length;++n){var r=t.getExtension(i[n]+e);if(r)return r}return null}function oot(t){var e={EXT_texture_filter_anisotropic:aot(t,"EXT_texture_filter_anisotropic"),EXT_blend_minmax:aot(t,"EXT_blend_minmax"),EXT_frag_depth:aot(t,"EXT_frag_depth"),EXT_shader_texture_lod:aot(t,"EXT_shader_texture_lod"),EXT_sRGB:aot(t,"EXT_sRGB"),OES_vertex_array_object:aot(t,"OES_vertex_array_object"),EXT_color_buffer_half_float:aot(t,"EXT_color_buffer_half_float"),WEBGL_color_buffer_float:aot(t,"WEBGL_color_buffer_float"),WEBGL_compressed_texture_etc1:aot(t,"WEBGL_compressed_texture_etc1"),WEBGL_compressed_texture_etc:aot(t,"WEBGL_compressed_texture_etc"),WEBGL_compressed_texture_pvrtc:aot(t,"WEBGL_compressed_texture_pvrtc"),WEBGL_compressed_texture_s3tc:aot(t,"WEBGL_compressed_texture_s3tc"),WEBGL_compressed_texture_s3tc_srgb:aot(t,"WEBGL_compressed_texture_s3tc_srgb"),WEBGL_debug_shaders:aot(t,"WEBGL_debug_shaders"),WEBGL_draw_buffers:aot(t,"WEBGL_draw_buffers"),WEBGL_lose_context:aot(t,"WEBGL_lose_context"),WEBGL_depth_texture:aot(t,"WEBGL_depth_texture"),OES_texture_half_float:aot(t,"OES_texture_half_float"),OES_texture_half_float_linear:aot(t,"OES_texture_half_float_linear"),OES_texture_float:aot(t,"OES_texture_float"),OES_texture_float_linear:aot(t,"OES_texture_float_linear"),OES_standard_derivatives:aot(t,"OES_standard_derivatives"),OES_element_index_uint:aot(t,"OES_element_index_uint"),ANGLE_instanced_arrays:aot(t,"ANGLE_instanced_arrays"),WEBGL_debug_renderer_info:aot(t,"WEBGL_debug_renderer_info"),WEBGL_multi_draw:null,WEBGL_compressed_texture_astc:null,destroyShadersImmediately:!0,noCompressedTexSubImage2D:!1,isLocationActive:function(t){return!!t},useVAO:!1};return Vo.os===Oo.IOS&&14===Vo.osMainVersion&&Vo.isBrowser||(e.WEBGL_compressed_texture_astc=aot(t,"WEBGL_compressed_texture_astc")),Vo.os!==Oo.ANDROID&&Vo.os!==Oo.IOS&&(e.WEBGL_multi_draw=aot(t,"WEBGL_multi_draw")),Vo.browserType===Mo.UC&&(e.ANGLE_instanced_arrays=null),Vo.os===Oo.IOS&&Vo.osMainVersion<=10&&(e.destroyShadersImmediately=!1),e.OES_vertex_array_object&&(e.useVAO=!0),e}function hot(t){var e=null;try{var i={alpha:Ue.ENABLE_TRANSPARENT_CANVAS,antialias:Ue.ENABLE_WEBGL_ANTIALIAS,depth:!0,stencil:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,powerPreference:"default",failIfMajorPerformanceCaveat:!1};e=t.getContext("webgl",i)}catch(t){return null}return e}var uot=function(t){function e(){var e;return(e=t.call(this)||this).stateCache=new iot,e.nullTex2D=null,e.nullTexCube=null,e._canvas=null,e._webGLContextLostHandler=null,e._extensions=null,e._blitManager=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){var e=this;e._canvas=t.windowHandle,e._webGLContextLostHandler=e._onWebGLContextLost.bind(e),e._canvas.addEventListener(rot,e._webGLContextLostHandler);var i=Vat.instance,n=i.gl,r=i.capabilities;e.stateCache.initialize(r.maxTextureUnits,r.maxVertexAttributes),e._extensions=oot(n),sot(n);var s=55,a=n.getParameter(3414),o=n.getParameter(3415);a&&o?s=55:a&&(s=54),e._colorTexture=new not,e._colorTexture.initAsSwapchainTexture({swapchain:e,format:35,width:t.width,height:t.height}),e._depthStencilTexture=new not,e._depthStencilTexture.initAsSwapchainTexture({swapchain:e,format:s,width:t.width,height:t.height}),e.nullTex2D=i.createTexture(new dd(1,4,35,2,2,1)),e.nullTexCube=i.createTexture(new dd(3,4,35,2,2,1,6));var h=new id;h.texExtent.width=2,h.texExtent.height=2;var u=new Uint8Array(e.nullTex2D.size);u.fill(0),i.copyBuffersToTexture([u],e.nullTex2D,[h]),h.texSubres.layerCount=6,i.copyBuffersToTexture([u,u,u,u,u,u],e.nullTexCube,[h]),e._blitManager=new Uat},i.destroy=function(){var t=this;t._canvas&&t._webGLContextLostHandler&&(t._canvas.removeEventListener(rot,t._webGLContextLostHandler),t._webGLContextLostHandler=null),t.nullTex2D&&(t.nullTex2D.destroy(),t.nullTex2D=null),t.nullTexCube&&(t.nullTexCube.destroy(),t.nullTexCube=null),t._blitManager&&(t._blitManager.destroy(),t._blitManager=null),t._extensions=null,t._canvas=null},i.resize=function(t,e){var i=this;i._colorTexture.width===t&&i._colorTexture.height===e||(Q("Resizing swapchain: "+t+"x"+e),i._canvas.width=t,i._canvas.height=e,i._colorTexture.resize(t,e),i._depthStencilTexture.resize(t,e))},i._onWebGLContextLost=function(t){at(11e3),Y(t)},n(e,[{key:"extensions",get:function(){return this._extensions}},{key:"blitManager",get:function(){return this._blitManager}}]),e}(vp);function lot(t,e,i){for(var n=0;n<e.length;++n)t[e[n]]=i}function cot(t,e,i){for(var n=0;n<e.length;++n)t[e[n]]|=i}function fot(t,e,i){for(var n=0;n<e.length;++n)t[e[n]]=i}var _ot=t("eG",function(t){function e(){var e;return(e=t.call(this)||this)._swapchain=null,e._context=null,e._bindingMappings=null,e._textureExclusive=new Array(117),e}s(e,t);var i=e.prototype;return i.initialize=function(t){Vat.setInstance(this),this._gfxAPI=6;var e=this._bindingMappingInfo=t.bindingMappingInfo,i=[],n=[],r=e.setIndices[0];i[r]=0,n[r]=0;for(var s=1;s<e.setIndices.length;++s){var a=e.setIndices[s],o=e.setIndices[s-1];i[a]=e.maxBlockCounts[o]+i[o],n[a]=e.maxSamplerTextureCounts[o]+n[o]}for(var h=0;h<e.setIndices.length;++h){var u=e.setIndices[h];n[u]-=e.maxBlockCounts[u]}this._bindingMappings={blockOffsets:i,samplerTextureOffsets:n,flexibleSet:e.setIndices[e.setIndices.length-1]};var l=this._context=hot(gp.canvas);if(!l)return ht(16333),!1;this._queue=this.createQueue(new jd(0)),this._cmdBuff=this.createCommandBuffer(new Wd(this._queue));var c=l.getParameter.bind(l),f=this._caps;f.maxVertexAttributes=c(34921),f.maxVertexUniformVectors=c(36347),f.maxFragmentUniformVectors=c(36349),f.maxTextureUnits=c(34930),f.maxVertexTextureUnits=c(35660),f.maxTextureSize=c(3379),f.maxCubeMapTextureSize=c(34076),f.maxArrayTextureLayers=0,f.max3DTextureSize=0,f.maxUniformBufferBindings=16;var _=l.getSupportedExtensions(),d="";_&&_.forEach((function(t){d+=t+" "}));var p=oot(l);p.WEBGL_debug_renderer_info?(this._renderer=c(p.WEBGL_debug_renderer_info.UNMASKED_RENDERER_WEBGL),this._vendor=c(p.WEBGL_debug_renderer_info.UNMASKED_VENDOR_WEBGL)):(this._renderer=c(7937),this._vendor=c(7936));var m=c(7938),g=this._features;g.fill(!1),this.initFormatFeatures(p),p.EXT_blend_minmax&&(g[3]=!0),p.OES_element_index_uint&&(g[0]=!0),p.ANGLE_instanced_arrays&&(g[1]=!0),p.WEBGL_draw_buffers&&(g[2]=!0);var y="";return this.getFormatFeatures(72)&&(y+="etc1 "),this.getFormatFeatures(73)&&(y+="etc2 "),this.getFormatFeatures(56)&&(y+="dxt "),this.getFormatFeatures(83)&&(y+="pvrtc "),this.getFormatFeatures(89)&&(y+="astc "),Q("WebGL device initialized."),Q("RENDERER: "+this._renderer),Q("VENDOR: "+this._vendor),Q("VERSION: "+m),Q("COMPRESSED_FORMAT: "+y),Q("EXTENSIONS: "+d),!0},i.destroy=function(){this._queue&&(this._queue.destroy(),this._queue=null),this._cmdBuff&&(this._cmdBuff.destroy(),this._cmdBuff=null),this._swapchain=null},i.flushCommands=function(){},i.acquire=function(){},i.present=function(){var t=this._queue;this._numDrawCalls=t.numDrawCalls,this._numInstances=t.numInstances,this._numTris=t.numTris,t.clear()},i.initFormatFeatures=function(t){var e=this._formatFeatures;e.fill(0);var i=this._textureExclusive;i.fill(!0),lot(e,[24,47,35,50,49],7),lot(e,[54,55],1),fot(i,[47,50,49,54,55],!1),cot(e,[7,17,28,40,6,16,27,39,7,17,28,40,6,16,27,39,11,21,32,44],16),t.EXT_sRGB&&(e[25]=7,e[37]=7,i[37]=!1),t.WEBGL_depth_texture&&(e[54]|=7,e[55]|=7),t.WEBGL_color_buffer_float&&(e[32]|=1,e[44]|=1,i[32]=!1,i[44]=!1),t.EXT_color_buffer_half_float&&(e[29]|=1,e[41]|=1,i[29]=!1,i[41]=!1),t.OES_texture_float&&(e[32]|=3,e[44]|=3),t.OES_texture_half_float&&(e[29]|=3,e[41]|=3),t.OES_texture_float_linear&&(e[32]|=4,e[44]|=4),t.OES_texture_half_float_linear&&(e[29]|=4,e[41]|=4),t.WEBGL_compressed_texture_etc1&&(e[72]=6),t.WEBGL_compressed_texture_etc&&lot(e,[73,77,74,78,75,76],6),t.WEBGL_compressed_texture_s3tc&&lot(e,[56,57,58,59,60,61,62,63],6),t.WEBGL_compressed_texture_pvrtc&&cot(e,[83,84,85,86],6),t.WEBGL_compressed_texture_astc&&cot(e,[89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116],6)},i.createCommandBuffer=function(t){var e=new(0===t.type?Kat:Hat);return e.initialize(t),e},i.createSwapchain=function(t){var e=new uot;return this._swapchain=e,e.initialize(t),e},i.createBuffer=function(t){var e=new Gat;return e.initialize(t),e},i.createTexture=function(t){var e=new not;return e.initialize(t),e},i.createDescriptorSet=function(t){var e=new eat;return e.initialize(t),e},i.createShader=function(t){var e=new eot;return e.initialize(t),e},i.createInputAssembler=function(t){var e=new jat;return e.initialize(t),e},i.createRenderPass=function(t){var e=new Zat;return e.initialize(t),e},i.createFramebuffer=function(t){var e=new Wat;return e.initialize(t),e},i.createDescriptorSetLayout=function(t){var e=new qat;return e.initialize(t),e},i.createPipelineLayout=function(t){var e=new Xat;return e.initialize(t),e},i.createPipelineState=function(t){var e=new Jat;return e.initialize(t),e},i.createQueue=function(t){var e=new Qat;return e.initialize(t),e},i.getSampler=function(t){var e=Op.computeHash(t);return this._samplers.has(e)||this._samplers.set(e,new tot(t,e)),this._samplers.get(e)},i.getSwapchains=function(){return[this._swapchain]},i.getGeneralBarrier=function(t){var e=Fp.computeHash(t);return this._generalBarrierss.has(e)||this._generalBarrierss.set(e,new Fp(t,e)),this._generalBarrierss.get(e)},i.getTextureBarrier=function(t){var e=Lp.computeHash(t);return this._textureBarriers.has(e)||this._textureBarriers.set(e,new Lp(t,e)),this._textureBarriers.get(e)},i.getBufferBarrier=function(t){var e=Vp.computeHash(t);return this._bufferBarriers.has(e)||this._bufferBarriers.set(e,new Vp(t,e)),this._bufferBarriers.get(e)},i.copyBuffersToTexture=function(t,e,i){Rat(this,t,e.gpuTexture,i)},i.copyTextureToBuffers=function(t,e,i){Fat(this,t.gpuTexture,e,i)},i.copyTexImagesToTexture=function(t,e,i){Eat(this,t,e.gpuTexture,i)},n(e,[{key:"gl",get:function(){return this._context}},{key:"extensions",get:function(){return this._swapchain.extensions}},{key:"stateCache",get:function(){return this._swapchain.stateCache}},{key:"nullTex2D",get:function(){return this._swapchain.nullTex2D}},{key:"nullTexCube",get:function(){return this._swapchain.nullTexCube}},{key:"textureExclusive",get:function(){return this._textureExclusive}},{key:"bindingMappings",get:function(){return this._bindingMappings}},{key:"blitManager",get:function(){return this._swapchain.blitManager}}]),e}(gp));C.WebGLDevice=_ot;var dot=function(t,e,i){this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=e,this.y=i};function pot(t,e,i,n,r){var s=0,a=null;if(r===Fot(t,e,i,n)>0)for(s=e;s<i;s+=n)a=kot(s,t[s],t[s+1],a);else for(s=i-n;s>=e;s-=n)a=kot(s,t[s],t[s+1],a);return a&&Bot(a,a.next)&&(Rot(a),a=a.next),a}function mot(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||!Bot(i,i.next)&&0!==Dot(i.prev,i,i.next))i=i.next;else{if(Rot(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function got(t,e,i,n,r,s,a){if(void 0===a&&(a=0),t){!a&&s&&wot(t,n,r,s);for(var o=t,h=null,u=null;t.prev!==t.next;)if(h=t.prev,u=t.next,s?vot(t,n,r,s):yot(t))e.push(h.i/i),e.push(t.i/i),e.push(u.i/i),Rot(t),t=u.next,o=u.next;else if((t=u)===o){a?1===a?got(t=bot(t,e,i),e,i,n,r,s,2):2===a&&Sot(t,e,i,n,r,s):got(mot(t),e,i,n,r,s,1);break}}}function yot(t){var e=t.prev,i=t,n=t.next;if(Dot(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(Aot(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&Dot(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function vot(t,e,i,n){var r=t.prev,s=t,a=t.next;if(Dot(r,s,a)>=0)return!1;for(var o=r.x<s.x?r.x<a.x?r.x:a.x:s.x<a.x?s.x:a.x,h=r.y<s.y?r.y<a.y?r.y:a.y:s.y<a.y?s.y:a.y,u=r.x>s.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=Tot(o,h,e,i,n),f=Tot(u,l,e,i,n),_=t.nextZ;_&&_.z<=f;){if(_!==t.prev&&_!==t.next&&Aot(r.x,r.y,s.x,s.y,a.x,a.y,_.x,_.y)&&Dot(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(_=t.prevZ;_&&_.z>=c;){if(_!==t.prev&&_!==t.next&&Aot(r.x,r.y,s.x,s.y,a.x,a.y,_.x,_.y)&&Dot(_.prev,_,_.next)>=0)return!1;_=_.prevZ}return!0}function bot(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!Bot(r,s)&&Iot(r,n,n.next,s)&&Pot(r,s)&&Pot(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),Rot(n),Rot(n.next),n=t=s),n=n.next}while(n!==t);return n}function Sot(t,e,i,n,r,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&Cot(a,o)){var h=Oot(a,o);return a=mot(a,a.next),h=mot(h,h.next),got(a,e,i,n,r,s),void got(h,e,i,n,r,s)}o=o.next}a=a.next}while(a!==t)}function wot(t,e,i,n){var r=t;do{null===r.z&&(r.z=Tot(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,xot(r)}function xot(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;e<u&&(o++,n=n.nextZ);e++);for(h=u;o>0||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 Tot(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 Aot(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 Cot(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Mot(t,e)&&Pot(t,e)&&Pot(e,t)&&Eot(t,e)}function Dot(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Bot(t,e){return t.x===e.x&&t.y===e.y}function Iot(t,e,i,n){return!!(Bot(t,e)&&Bot(i,n)||Bot(t,n)&&Bot(i,e))||Dot(t,e,i)>0!=Dot(t,e,n)>0&&Dot(i,n,t)>0!=Dot(i,n,e)>0}function Mot(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&&Iot(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}function Pot(t,e){return Dot(t.prev,t,t.next)<0?Dot(t,e,t.next)>=0&&Dot(t,t.prev,e)>=0:Dot(t,e,t.prev)<0||Dot(t,t.next,e)<0}function Eot(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 Oot(t,e){var i=new dot(t.i,t.x,t.y),n=new dot(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 kot(t,e,i,n){var r=new dot(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 Rot(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 Fot(t,e,i,n){for(var r=0,s=e,a=i-n;s<i;s+=n)r+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return r}function Lot(t,e,i){i=i||3;var n=t.length,r=pot(t,0,n,i,!0),s=[];if(!r)return s;var a=0,o=0,h=0,u=0,l=0,c=0,f=0;if(t.length>80*i){a=h=t[0],o=u=t[1];for(var _=i;_<n;_+=i)(l=t[_])<a&&(a=l),(c=t[_+1])<o&&(o=c),l>h&&(h=l),c>u&&(u=c);f=Math.max(h-a,u-o)}return got(r,s,i,a,o,f),s}for(var Vot=Math.PI,Not=Math.min,zot=Math.max,Uot=Math.ceil,Got=Math.acos,Hot=Math.cos,Wot=Math.sin,jot=Math.atan2,qot=null,Xot=null,Yot=new cr,Jot=[],Kot=0;Kot<4;Kot++)Jot.push(new ir);function Qot(t,e,i){var n=2*Got(t/(t+i));return zot(2,Uot(e/n))}function Zot(t,e,i){return t<e?e:t>i?i:t}var $ot=function(){function t(){}var e=t.prototype;return e.updateRenderData=function(){},e.getRenderData=function(t,e){if(!Xot)return null;var i=Xot.getRenderDataList(),n=i[Xot.dataOffset];if(!n)return null;var r=n,s=r?r.vertexStart+e:0;return(s>65535||3*s>131070)&&(++Xot.dataOffset,Xot.dataOffset<i.length?n=i[Xot.dataOffset]:(n=Xot.requestRenderData(),i[Xot.dataOffset]=n),r=n),r&&r.vertexCount<s&&r.request(e,3*e),n},e.stroke=function(t){cr.copy(Yot,t.strokeColor),t.impl&&(this._flattenPaths(t.impl),this._expandStroke(t),t.impl.updatePathOffset=!0,this.end(t))},e.fill=function(t){cr.copy(Yot,t.fillColor),this._expandFill(t),t.impl&&(t.impl.updatePathOffset=!0),this.end(t)},e.end=function(t){t._markForUpdateRenderData()},e._expandStroke=function(t){var e=.5*t.lineWidth,i=t.lineCap,n=t.lineJoin,r=t.miterLimit;if(Xot=t.impl){var s=Qot(e,Vot,Xot.tessTol);this._calculateJoins(Xot,e,n,r);for(var a=Xot.paths,o=0,h=Xot.pathOffset,u=Xot.pathLength;h<u;h++){var l=a[h],c=l.points.length;o+=1===n?2*(c+l.bevel*(s+2)+1):2*(c+5*l.bevel+1),l.closed||(o+=1===i?2*(2*s+2):12)}var f=qot=this.getRenderData(t,o);if(f){for(var _=f.vData,d=f.iData,p=Xot.pathOffset,m=Xot.pathLength;p<m;p++){var g=a[p],y=g.points,v=y.length,b=f.vertexStart,S=void 0,w=void 0,x=0,T=0,A=g.closed;if(A?(S=y[v-1],w=y[0],x=0,T=v):(S=y[0],w=y[1],x=1,T=v-1),w=w||S,!A){var C=new qN(w.x,w.y);C.subtract(S),C.normalize();var D=C.x,B=C.y;0===i?this._buttCapStart(S,D,B,e,0):2===i?this._buttCapStart(S,D,B,e,e):1===i&&this._roundCapStart(S,D,B,e,s)}for(var I=x;I<T;++I)1===n?this._roundJoin(S,w,e,e,s):12&w.flags?this._bevelJoin(S,w,e,e):(this._vSet(w.x+w.dmx*e,w.y+w.dmy*e,1),this._vSet(w.x-w.dmx*e,w.y-w.dmy*e,-1)),S=w,w=y[I+1];if(A){var M=8*b;this._vSet(_[M],_[M+1],1),this._vSet(_[M+8],_[M+8+1],-1)}else{var P=new qN(w.x,w.y);P.subtract(S),P.normalize();var E=P.x,O=P.y;0===i?this._buttCapEnd(w,E,O,e,0):2===i?this._buttCapEnd(w,E,O,e,e):1===i&&this._roundCapEnd(w,E,O,e,s)}for(var k=f.indexStart,R=b+2,F=f.vertexStart;R<F;R++)d[k++]=R-2,d[k++]=R-1,d[k++]=R;f.indexStart=k}qot=null,Xot=null}}},e._expandFill=function(t){if(Xot=t.impl){for(var e=Xot.paths,i=0,n=Xot.pathOffset,r=Xot.pathLength;n<r;n++)i+=e[n].points.length;var s=qot=this.getRenderData(t,i);if(s){for(var a=s,o=a.vData,h=a.iData,u=Xot.pathOffset,l=Xot.pathLength;u<l;u++){var c=e[u],f=c.points,_=f.length;if(0!==_){for(var d=s.vertexStart,p=0;p<_;++p)this._vSet(f[p].x,f[p].y);var m=s.indexStart;if(c.complex){for(var g=[],y=d,v=s.vertexStart;y<v;y++){var b=8*y;g.push(o[b++]),g.push(o[b++]),g.push(o[b++])}var S=Lot(g,0,3);if(!S||0===S.length)continue;for(var w=0,x=S.length;w<x;w++)h[m++]=S[w]+d}else for(var T=d,A=d+2,C=a.vertexStart;A<C;A++)h[m++]=T,h[m++]=A-1,h[m++]=A;a.indexStart=m}}qot=null,Xot=null}}},e._calculateJoins=function(t,e,i,n){var r=0;e>0&&(r=1/e);for(var s=t.paths,a=t.pathOffset,o=t.pathLength;a<o;a++){var h=s[a],u=h.points,l=u.length,c=u[l-1],f=u[0];h.bevel=0;for(var _=0;_<l;_++){var d,p,m=c.dy,g=-c.dx,y=f.dy,v=-f.dx;if(f.dmx=.5*(m+y),f.dmy=.5*(g+v),(d=f.dmx*f.dmx+f.dmy*f.dmy)>1e-6){var b=1/d;b>600&&(b=600),f.dmx*=b,f.dmy*=b}f.dx*c.dy-c.dx*f.dy>0&&(f.flags|=2),d*(p=zot(11,Not(c.len,f.len)*r))*p<1&&(f.flags|=8),1&f.flags&&(d*n*n<1||0===i||1===i)&&(f.flags|=4),12&f.flags&&h.bevel++,c=f,f=u[_+1]}}},e._flattenPaths=function(t){for(var e=t.paths,i=t.pathOffset,n=t.pathLength;i<n;i++){var r=e[i],s=r.points,a=s[s.length-1],o=s[0];s.length>2&&a.equals(o)&&(r.closed=!0,s.pop(),a=s[s.length-1]);for(var h=0,u=s.length;h<u;h++){var l=new qN(o.x,o.y);l.subtract(a),a.len=l.length(),(l.x||l.y)&&l.normalize(),a.dx=l.x,a.dy=l.y,a=o,o=s[h+1]}}},e._chooseBevel=function(t,e,i,n){var r=i.x,s=i.y,a=0,o=0,h=0,u=0;return 0!==t?(a=r+e.dy*n,o=s-e.dx*n,h=r+i.dy*n,u=s-i.dx*n):(a=h=r+i.dmx*n,o=u=s+i.dmy*n),[a,o,h,u]},e._buttCapStart=function(t,e,i,n,r){var s=t.x-e*r,a=t.y-i*r,o=i,h=-e;this._vSet(s+o*n,a+h*n,1),this._vSet(s-o*n,a-h*n,-1)},e._buttCapEnd=function(t,e,i,n,r){var s=t.x+e*r,a=t.y+i*r,o=i,h=-e;this._vSet(s+o*n,a+h*n,1),this._vSet(s-o*n,a-h*n,-1)},e._roundCapStart=function(t,e,i,n,r){for(var s=t.x,a=t.y,o=i,h=-e,u=0;u<r;u++){var l=u/(r-1)*Vot,c=Hot(l)*n,f=Wot(l)*n;this._vSet(s-o*c-e*f,a-h*c-i*f,1),this._vSet(s,a,0)}this._vSet(s+o*n,a+h*n,1),this._vSet(s-o*n,a-h*n,-1)},e._roundCapEnd=function(t,e,i,n,r){var s=t.x,a=t.y,o=i,h=-e;this._vSet(s+o*n,a+h*n,1),this._vSet(s-o*n,a-h*n,-1);for(var u=0;u<r;u++){var l=u/(r-1)*Vot,c=Hot(l)*n,f=Wot(l)*n;this._vSet(s,a,0),this._vSet(s-o*c+e*f,a-h*c+i*f,1)}},e._roundJoin=function(t,e,i,n,r){var s=t.dy,a=-t.dx,o=e.dy,h=-e.dx,u=e.x,l=e.y;if(2&e.flags){var c=this._chooseBevel(8&e.flags,t,e,i),f=c[0],_=c[1],d=c[2],p=c[3],m=jot(-a,-s),g=jot(-h,-o);g>m&&(g-=2*Vot),this._vSet(f,_,1),this._vSet(u-s*n,e.y-a*n,-1);for(var y=Zot(Uot((m-g)/Vot)*r,2,r),v=0;v<y;v++){var b=m+v/(y-1)*(g-m),S=u+Hot(b)*n,w=l+Wot(b)*n;this._vSet(u,l,0),this._vSet(S,w,-1)}this._vSet(d,p,1),this._vSet(u-o*n,l-h*n,-1)}else{var x=this._chooseBevel(8&e.flags,t,e,-n),T=x[0],A=x[1],C=x[2],D=x[3],B=jot(a,s),I=jot(h,o);I<B&&(I+=2*Vot),this._vSet(u+s*n,l+a*n,1),this._vSet(T,A,-1);for(var M=Zot(Uot((I-B)/Vot)*r,2,r),P=0;P<M;P++){var E=B+P/(M-1)*(I-B),O=u+Hot(E)*i,k=l+Wot(E)*i;this._vSet(O,k,1),this._vSet(u,l,0)}this._vSet(u+o*n,l+h*n,1),this._vSet(C,D,-1)}},e._bevelJoin=function(t,e,i,n){var r=0,s=0,a=0,o=0,h=0,u=0,l=0,c=0,f=t.dy,_=-t.dx,d=e.dy,p=-e.dx;if(2&e.flags){var m=this._chooseBevel(8&e.flags,t,e,i);h=m[0],u=m[1],l=m[2],c=m[3],this._vSet(h,u,1),this._vSet(e.x-f*n,e.y-_*n,-1),this._vSet(l,c,1),this._vSet(e.x-d*n,e.y-p*n,-1)}else{var g=this._chooseBevel(8&e.flags,t,e,-n);r=g[0],s=g[1],a=g[2],o=g[3],this._vSet(e.x+f*i,e.y+_*i,1),this._vSet(r,s,-1),this._vSet(e.x+d*i,e.y+p*i,1),this._vSet(a,o,-1)}},e._vSet=function(t,e,i){if(void 0===i&&(i=0),qot){var n=qot,r=8*n.vertexStart,s=n.vData;s[r++]=t,s[r++]=e,s[r++]=0,cr.toArray(s,Yot,r),r+=4,s[r++]=i,n.vertexStart++}},t}(),tht=new $ot,eht=t("eH",{getAssembler:function(){return tht}});function iht(t,e,i,n){var r=(n.x-i.x)*(t.y-i.y)-(n.y-i.y)*(t.x-i.x),s=(e.x-t.x)*(t.y-i.y)-(e.y-t.y)*(t.x-i.x),a=(n.y-i.y)*(e.x-t.x)-(n.x-i.x)*(e.y-t.y);if(0!==a){var o=r/a,h=s/a;if(o>=0&&o<=1&&h>=0&&h<=1)return!0}return!1}ZN.Assembler=eht,A.UI.graphicsAssembler=eht;var nht=new ds,rht=new ds,sht=new ds,aht=new ds;function oht(t,e,i){for(var n=i.length,r=0;r<n;++r)if(iht(t,e,i[r],i[(r+1)%n]))return!0;return!1}function hht(t,e){for(var i=!1,n=t.x,r=t.y,s=e.length,a=0,o=s-1;a<s;o=a++){var h=e[a].x,u=e[a].y,l=e[o].x,c=e[o].y;u>r!=c>r&&n<(l-h)*(r-u)/(c-u)+h&&(i=!i)}return i}function uht(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:nht.set(e.x+h*s,e.y+h*a):e:nht.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 lht=t("eI",(function(){}));lht.lineLine=iht,lht.lineRect=function(t,e,i){var n=nht.set(i.x,i.y),r=rht.set(i.x,i.yMax),s=sht.set(i.xMax,i.yMax),a=aht.set(i.xMax,i.y);return!!(iht(t,e,n,r)||iht(t,e,r,s)||iht(t,e,s,a)||iht(t,e,a,n))},lht.linePolygon=oht,lht.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},lht.rectPolygon=function(t,e){var i=nht.set(t.x,t.y),n=rht.set(t.x,t.yMax),r=sht.set(t.xMax,t.yMax),s=aht.set(t.xMax,t.y);if(oht(i,n,e))return!0;if(oht(n,r,e))return!0;if(oht(r,s,e))return!0;if(oht(s,i,e))return!0;for(var a=0,o=e.length;a<o;++a)if(t.contains(e[a]))return!0;return!!(hht(i,e)||hht(n,e)||hht(r,e)||hht(s,e))},lht.rectCircle=function(t,e,i){var n=e.x,r=e.y,s=t.x,a=t.y,o=t.width,h=t.height,u=n,l=r;n<s?u=s:n>s+o&&(u=s+o),r<a?l=a:r>a+h&&(l=a+h);var c=n-u,f=r-l;return Math.sqrt(c*c+f*f)<=i},lht.polygonPolygon=function(t,e){var i,n;for(i=0,n=t.length;i<n;++i)if(oht(t[i],t[(i+1)%n],e))return!0;for(i=0,n=e.length;i<n;++i)if(hht(e[i],t))return!0;for(i=0,n=t.length;i<n;++i)if(hht(t[i],e))return!0;return!1},lht.circleCircle=function(t,e,i,n){return ds.distance(t,i)<e+n},lht.polygonCircle=function(t,e,i){var n=e;if(hht(n,t))return!0;for(var r=0,s=t.length;r<s;r++)if(uht(n,0===r?t[t.length-1]:t[r-1],t[r],!0)<i)return!0;return!1},lht.pointInPolygon=hht,lht.pointLineDistance=uht;var cht,fht,_ht,dht,pht,mht,ght,yht,vht,bht,Sht,wht,xht,Tht,Aht,Cht,Dht,Bht,Iht,Mht,Pht,Eht,Oht,kht,Rht,Fht,Lht,Vht,Nht,zht,Uht,Ght,Hht,Wht,jht=t("eJ",Ee({UNIFORM:0,ADAPTIVE:1})),qht=t("eK",function(){function t(){}return t.generate=function(t){switch(t.method){case jht.UNIFORM:return this.doGenerateUniform(t);case jht.ADAPTIVE:return this.doGenerateAdaptive(t);default:return[]}},t.doGenerateUniform=function(t){if(t.nProbesX<2||t.nProbesY<2||t.nProbesZ<2)return[];for(var e=[],i=new ir(0,0,0),n=new ir((t.maxPos.x-t.minPos.x)/(t.nProbesX-1),(t.maxPos.y-t.minPos.y)/(t.nProbesY-1),(t.maxPos.z-t.minPos.z)/(t.nProbesZ-1)),r=0;r<t.nProbesX;r++){i.x=r*n.x+t.minPos.x;for(var s=0;s<t.nProbesY;s++){i.y=s*n.y+t.minPos.y;for(var a=0;a<t.nProbesZ;a++)i.z=a*n.z+t.minPos.z,e.push(new ir(i))}}return e},t.doGenerateAdaptive=function(t){return this.doGenerateUniform(t)},t}()),Xht=Kh,Yht=uu,Jht=new yr,Kht=new ir(0,0,0),Qht=new ir(0,0,0),Zht=new ir(0,0,0),$ht=new ir(0,0,0),tut=new ir(0,0,0),eut=new ir(0,0,0),iut=new ir(0,0,0),nut=t("eL",Xht("cc.Vertex")((fht=function(t){this.position=_ht&&_ht(),this.normal=dht&&dht(),this.coefficients=pht&&pht(),this.position.set(t)},_ht=zh(fht.prototype,"position",[Yht],(function(){return new ir(0,0,0)})),dht=zh(fht.prototype,"normal",[Yht],(function(){return new ir(0,0,0)})),pht=zh(fht.prototype,"coefficients",[Yht],(function(){return[]})),cht=fht))||cht),rut=(mht=function(){function t(t,e,i,n){this.tetrahedron=ght&&ght(),this.index=yht&&yht(),this.vertex0=vht&&vht(),this.vertex1=bht&&bht(),this.tetrahedron=t,this.index=e,i<n?(this.vertex0=i,this.vertex1=n):(this.vertex0=n,this.vertex1=i)}var e=t.prototype;return e.set=function(t,e,i,n){this.tetrahedron=t,this.index=e,i<n?(this.vertex0=i,this.vertex1=n):(this.vertex0=n,this.vertex1=i)},e.isSame=function(t){return this.vertex0===t.vertex0&&this.vertex1===t.vertex1},t}(),ght=zh(mht.prototype,"tetrahedron",[Yht],(function(){return-1})),yht=zh(mht.prototype,"index",[Yht],(function(){return-1})),vht=zh(mht.prototype,"vertex0",[Yht],(function(){return-1})),bht=zh(mht.prototype,"vertex1",[Yht],(function(){return-1})),mht),sut=(Sht=function(){function t(t,e,i,n,r,s){this.invalid=wht&&wht(),this.isOuterFace=xht&&xht(),this.tetrahedron=Tht&&Tht(),this.index=Aht&&Aht(),this.vertex0=Cht&&Cht(),this.vertex1=Dht&&Dht(),this.vertex2=Bht&&Bht(),this.vertex3=Iht&&Iht(),this.tetrahedron=t,this.index=e,this.vertex3=s,i<n&&i<r?(this.vertex0=i,n<r?(this.vertex1=n,this.vertex2=r):(this.vertex1=r,this.vertex2=n)):n<i&&n<r?(this.vertex0=n,i<r?(this.vertex1=i,this.vertex2=r):(this.vertex1=r,this.vertex2=i)):(this.vertex0=r,i<n?(this.vertex1=i,this.vertex2=n):(this.vertex1=n,this.vertex2=i))}var e=t.prototype;return e.set=function(t,e,i,n,r,s){this.invalid=!1,this.isOuterFace=!0,this.tetrahedron=t,this.index=e,this.vertex3=s,i<n&&i<r?(this.vertex0=i,n<r?(this.vertex1=n,this.vertex2=r):(this.vertex1=r,this.vertex2=n)):n<i&&n<r?(this.vertex0=n,i<r?(this.vertex1=i,this.vertex2=r):(this.vertex1=r,this.vertex2=i)):(this.vertex0=r,i<n?(this.vertex1=i,this.vertex2=n):(this.vertex1=n,this.vertex2=i))},e.isSame=function(t){return this.vertex0===t.vertex0&&this.vertex1===t.vertex1&&this.vertex2===t.vertex2},t}(),wht=zh(Sht.prototype,"invalid",[Yht],(function(){return!1})),xht=zh(Sht.prototype,"isOuterFace",[Yht],(function(){return!0})),Tht=zh(Sht.prototype,"tetrahedron",[Yht],(function(){return-1})),Aht=zh(Sht.prototype,"index",[Yht],(function(){return-1})),Cht=zh(Sht.prototype,"vertex0",[Yht],(function(){return-1})),Dht=zh(Sht.prototype,"vertex1",[Yht],(function(){return-1})),Bht=zh(Sht.prototype,"vertex2",[Yht],(function(){return-1})),Iht=zh(Sht.prototype,"vertex3",[Yht],(function(){return-1})),Sht),aut=t("eM",Xht("cc.CircumSphere")((Pht=function(){function t(){this.center=Eht&&Eht(),this.radiusSquared=Oht&&Oht()}return t.prototype.init=function(t,e,i,n){Jht.set(e.x-t.x,e.y-t.y,e.z-t.z,i.x-t.x,i.y-t.y,i.z-t.z,n.x-t.x,n.y-t.y,n.z-t.z),Jht.invert(),Jht.transpose(),Kht.set(.5*((e.x+t.x)*(e.x-t.x)+(e.y+t.y)*(e.y-t.y)+(e.z+t.z)*(e.z-t.z)),.5*((i.x+t.x)*(i.x-t.x)+(i.y+t.y)*(i.y-t.y)+(i.z+t.z)*(i.z-t.z)),.5*((n.x+t.x)*(n.x-t.x)+(n.y+t.y)*(n.y-t.y)+(n.z+t.z)*(n.z-t.z))),ir.transformMat3(this.center,Kht,Jht),this.radiusSquared=ir.squaredDistance(t,this.center)},t}(),Eht=zh(Pht.prototype,"center",[Yht],(function(){return new ir(0,0,0)})),Oht=zh(Pht.prototype,"radiusSquared",[Yht],(function(){return 0})),Mht=Pht))||Mht),out=t("eN",Xht("cc.Tetrahedron")((Rht=function(){function t(t,e,i,n,r){if(void 0===r&&(r=-1),this.invalid=Fht&&Fht(),this.vertex0=Lht&&Lht(),this.vertex1=Vht&&Vht(),this.vertex2=Nht&&Nht(),this.vertex3=zht&&zht(),this.neighbours=Uht&&Uht(),this.matrix=Ght&&Ght(),this.offset=Hht&&Hht(),this.sphere=Wht&&Wht(),this.vertex0=e,this.vertex1=i,this.vertex2=n,this.vertex3=r,r>=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)<this.sphere.radiusSquared-Ki},e.contain=function(t){return this.vertex0===t||this.vertex1===t||this.vertex2===t||this.vertex3===t},e.isInnerTetrahedron=function(){return this.vertex3>=0},e.isOuterCell=function(){return this.vertex3<0},t}(),Fht=zh(Rht.prototype,"invalid",[Yht],(function(){return!1})),Lht=zh(Rht.prototype,"vertex0",[Yht],(function(){return-1})),Vht=zh(Rht.prototype,"vertex1",[Yht],(function(){return-1})),Nht=zh(Rht.prototype,"vertex2",[Yht],(function(){return-1})),zht=zh(Rht.prototype,"vertex3",[Yht],(function(){return-1})),Uht=zh(Rht.prototype,"neighbours",[Yht],(function(){return[-1,-1,-1,-1]})),Ght=zh(Rht.prototype,"matrix",[Yht],(function(){return new yr})),Hht=zh(Rht.prototype,"offset",[Yht],(function(){return new ir(0,0,0)})),Wht=zh(Rht.prototype,"sphere",[Yht],(function(){return new aut})),kht=Rht))||kht),hut=t("eO",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;i<t;i++)this.addProbe(i);this._tetrahedrons=this._tetrahedrons.filter((function(e){var i=t;return!(e.contain(i)||e.contain(i+1)||e.contain(i+2)||e.contain(i+3))})),this._probes.length=t,this.reorder(e)},e.initTetrahedron=function(){for(var t=new ir(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),e=new ir(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE),i=0;i<this._probes.length;i++){var n=this._probes[i].position;t.x=Math.min(t.x,n.x),e.x=Math.max(e.x,n.x),t.y=Math.min(t.y,n.y),e.y=Math.max(e.y,n.y),t.z=Math.min(t.z,n.z),e.z=Math.max(e.z,n.z)}var r=new ir(0,0,0);ir.add(r,t,e),ir.multiplyScalar(r,r,.5);var s=new ir(0,0,0);ir.subtract(s,e,t);var a=10*Math.max(s.x,s.y,s.z),o=new ir(r.x,r.y+a,r.z),h=new ir(r.x-a,r.y-a,r.z-a),u=new ir(r.x-a,r.y-a,r.z+a),l=new ir(r.x+a,r.y-a,r.z),c=this._probes.length;return this._probes.push(new nut(o)),this._probes.push(new nut(h)),this._probes.push(new nut(u)),this._probes.push(new nut(l)),this._tetrahedrons.push(new out(this,c,c+1,c+2,c+3)),r},e.addTriangle=function(t,e,i,n,r,s,a){t<this._triangles.length?this._triangles[t].set(e,i,n,r,s,a):this._triangles.push(new sut(e,i,n,r,s,a))},e.addEdge=function(t,e,i,n,r){t<this._edges.length?this._edges[t].set(e,i,n,r):this._edges.push(new rut(e,i,n,r))},e.addProbe=function(t){for(var e=this._probes[t].position,i=0,n=0;n<this._tetrahedrons.length;n++){var r=this._tetrahedrons[n];r.isInCircumSphere(e)&&(r.invalid=!0,this.addTriangle(i,n,0,r.vertex1,r.vertex3,r.vertex2,r.vertex0),this.addTriangle(i+1,n,1,r.vertex0,r.vertex2,r.vertex3,r.vertex1),this.addTriangle(i+2,n,2,r.vertex0,r.vertex3,r.vertex1,r.vertex2),this.addTriangle(i+3,n,3,r.vertex0,r.vertex1,r.vertex2,r.vertex3),i+=4)}for(var s=0;s<i;s++)if(!this._triangles[s].invalid)for(var a=s+1;a<i;a++)if(this._triangles[s].isSame(this._triangles[a])){this._triangles[s].invalid=!0,this._triangles[a].invalid=!0;break}this._tetrahedrons=this._tetrahedrons.filter((function(t){return!t.invalid}));for(var o=0;o<i;o++){var h=this._triangles[o];h.invalid||this._tetrahedrons.push(new out(this,h.vertex0,h.vertex1,h.vertex2,t))}},e.reorder=function(t){this._tetrahedrons.sort((function(e,i){return ir.squaredDistance(e.sphere.center,t)-ir.squaredDistance(i.sphere.center,t)}))},e.computeAdjacency=function(){for(var t=new ir(0,0,0),e=new ir(0,0,0),i=new ir(0,0,0),n=new ir(0,0,0),r=this._tetrahedrons.length,s=0,a=0;a<this._tetrahedrons.length;a++){var o=this._tetrahedrons[a];this.addTriangle(s,a,0,o.vertex1,o.vertex3,o.vertex2,o.vertex0),this.addTriangle(s+1,a,1,o.vertex0,o.vertex2,o.vertex3,o.vertex1),this.addTriangle(s+2,a,2,o.vertex0,o.vertex3,o.vertex1,o.vertex2),this.addTriangle(s+3,a,3,o.vertex0,o.vertex1,o.vertex2,o.vertex3),s+=4}for(var h=0;h<s;h++)if(this._triangles[h].isOuterFace){for(var u=h+1;u<s;u++)if(this._triangles[h].isSame(this._triangles[u])){this._tetrahedrons[this._triangles[h].tetrahedron].neighbours[this._triangles[h].index]=this._triangles[u].tetrahedron,this._tetrahedrons[this._triangles[u].tetrahedron].neighbours[this._triangles[u].index]=this._triangles[h].tetrahedron,this._triangles[h].isOuterFace=!1,this._triangles[u].isOuterFace=!1;break}if(this._triangles[h].isOuterFace){var l=this._probes[this._triangles[h].vertex0],c=this._probes[this._triangles[h].vertex1],f=this._probes[this._triangles[h].vertex2],_=this._probes[this._triangles[h].vertex3];ir.subtract(e,c.position,l.position),ir.subtract(i,f.position,l.position),ir.cross(t,e,i),ir.subtract(n,_.position,l.position);var d=ir.dot(t,n);d>0&&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=d>0?this._triangles[h].vertex2:this._triangles[h].vertex1,g=d>0?this._triangles[h].vertex1:this._triangles[h].vertex2,y=new out(this,p,m,g);y.neighbours[3]=this._triangles[h].tetrahedron,this._tetrahedrons[this._triangles[h].tetrahedron].neighbours[this._triangles[h].index]=this._tetrahedrons.length,this._tetrahedrons.push(y)}}for(var v=0,b=r;b<this._tetrahedrons.length;b++){var S=this._tetrahedrons[b];this.addEdge(v,b,0,S.vertex1,S.vertex2),this.addEdge(v+1,b,1,S.vertex2,S.vertex0),this.addEdge(v+2,b,2,S.vertex0,S.vertex1),v+=3}for(var w=0;w<v;w++)for(var x=w+1;x<v;x++)this._edges[w].isSame(this._edges[x])&&(this._tetrahedrons[this._edges[w].tetrahedron].neighbours[this._edges[w].index]=this._edges[x].tetrahedron,this._tetrahedrons[this._edges[x].tetrahedron].neighbours[this._edges[x].index]=this._edges[w].tetrahedron);for(var T=0;T<this._probes.length;T++)this._probes[T].normal.normalize()},e.computeMatrices=function(){for(var t=0;t<this._tetrahedrons.length;t++){var e=this._tetrahedrons[t];e.vertex3>=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(Qht,i[0],i[2]),ir.subtract(Zht,e[0],e[2]),ir.subtract($ht,i[1],i[2]),ir.subtract(tut,e[1],e[2]),eut.set(i[2]),ir.negate(iut,e[2]);var n=[];n[0]=Zht.y*tut.z-Zht.z*tut.y,n[3]=-Zht.x*tut.z+Zht.z*tut.x,n[6]=Zht.x*tut.y-Zht.y*tut.x,n[9]=Qht.x*tut.y*iut.z-Qht.y*tut.x*iut.z+Zht.x*$ht.y*iut.z-Zht.y*$ht.x*iut.z+Qht.z*tut.x*iut.y-Qht.z*tut.y*iut.x+Zht.z*$ht.x*iut.y-Zht.z*$ht.y*iut.x-Qht.x*tut.z*iut.y+Qht.y*tut.z*iut.x-Zht.x*$ht.z*iut.y+Zht.y*$ht.z*iut.x,n[9]-=eut.x*n[0]+eut.y*n[3]+eut.z*n[6],n[1]=Zht.y*$ht.z+Qht.y*tut.z-Zht.z*$ht.y-Qht.z*tut.y,n[4]=-Qht.x*tut.z-Zht.x*$ht.z+Qht.z*tut.x+Zht.z*$ht.x,n[7]=Qht.x*tut.y-Qht.y*tut.x+Zht.x*$ht.y-Zht.y*$ht.x,n[10]=Qht.x*$ht.y*iut.z-Qht.y*$ht.x*iut.z-Qht.x*$ht.z*iut.y+Qht.y*$ht.z*iut.x+Qht.z*$ht.x*iut.y-Qht.z*$ht.y*iut.x,n[10]-=eut.x*n[1]+eut.y*n[4]+eut.z*n[7],n[2]=-Qht.z*$ht.y+Qht.y*$ht.z,n[5]=-Qht.x*$ht.z+Qht.z*$ht.x,n[8]=Qht.x*$ht.y-Qht.y*$ht.x,n[11]=0,n[11]-=eut.x*n[2]+eut.y*n[5]+eut.z*n[8];var r=Zht.x*tut.y*iut.z-Zht.y*tut.x*iut.z+Zht.z*tut.x*iut.y-Zht.z*tut.y*iut.x+Zht.y*tut.z*iut.x-Zht.x*tut.z*iut.y;if(Math.abs(r)>Ki)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}()),uut=t("eP",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;a<e;a++)for(var o=(a+.5)*r,h=0;h<i;h++){var u=(h+.5)*s,l=this.uniformSampleSphere(o,u);n.push(l)}return n},t.uniformSpherePdf=function(){return 1/(4*Math.PI)},t}()),lut=t("eQ",function(){function t(){}return t.updateUBOData=function(t,e,i){t[e++]=i[3].x*this.basisOverPI[3],t[e++]=i[1].x*this.basisOverPI[1],t[e++]=i[2].x*this.basisOverPI[2],t[e++]=i[0].x*this.basisOverPI[0]-i[6].x*this.basisOverPI[6]/3,t[e++]=i[3].y*this.basisOverPI[3],t[e++]=i[1].y*this.basisOverPI[1],t[e++]=i[2].y*this.basisOverPI[2],t[e++]=i[0].y*this.basisOverPI[0]-i[6].y*this.basisOverPI[6]/3,t[e++]=i[3].z*this.basisOverPI[3],t[e++]=i[1].z*this.basisOverPI[1],t[e++]=i[2].z*this.basisOverPI[2],t[e++]=i[0].z*this.basisOverPI[0]-i[6].z*this.basisOverPI[6]/3,t[e++]=i[4].x*this.basisOverPI[4],t[e++]=i[5].x*this.basisOverPI[5],t[e++]=i[6].x*this.basisOverPI[6],t[e++]=i[7].x*this.basisOverPI[7],t[e++]=i[4].y*this.basisOverPI[4],t[e++]=i[5].y*this.basisOverPI[5],t[e++]=i[6].y*this.basisOverPI[6],t[e++]=i[7].y*this.basisOverPI[7],t[e++]=i[4].z*this.basisOverPI[4],t[e++]=i[5].z*this.basisOverPI[5],t[e++]=i[6].z*this.basisOverPI[6],t[e++]=i[7].z*this.basisOverPI[7],t[e++]=i[8].x*this.basisOverPI[8],t[e++]=i[8].y*this.basisOverPI[8],t[e++]=i[8].z*this.basisOverPI[8],t[e++]=0},t.shaderEvaluate=function(t,e){var i=new Vn(e[3].x*this.basisOverPI[3],e[1].x*this.basisOverPI[1],e[2].x*this.basisOverPI[2],e[0].x*this.basisOverPI[0]-e[6].x*this.basisOverPI[6]/3),n=new Vn(e[3].y*this.basisOverPI[3],e[1].y*this.basisOverPI[1],e[2].y*this.basisOverPI[2],e[0].y*this.basisOverPI[0]-e[6].y*this.basisOverPI[6]/3),r=new Vn(e[3].z*this.basisOverPI[3],e[1].z*this.basisOverPI[1],e[2].z*this.basisOverPI[2],e[0].z*this.basisOverPI[0]-e[6].z*this.basisOverPI[6]/3),s=new Vn(e[4].x*this.basisOverPI[4],e[5].x*this.basisOverPI[5],e[6].x*this.basisOverPI[6],e[7].x*this.basisOverPI[7]),a=new Vn(e[4].y*this.basisOverPI[4],e[5].y*this.basisOverPI[5],e[6].y*this.basisOverPI[6],e[7].y*this.basisOverPI[7]),o=new Vn(e[4].z*this.basisOverPI[4],e[5].z*this.basisOverPI[5],e[6].z*this.basisOverPI[6],e[7].z*this.basisOverPI[7]),h=new ir(e[8].x*this.basisOverPI[8],e[8].y*this.basisOverPI[8],e[8].z*this.basisOverPI[8]),u=new ir(0,0,0),l=new Vn(t.x,t.y,t.z,1);u.x=Vn.dot(i,l),u.y=Vn.dot(n,l),u.z=Vn.dot(r,l);var c=new Vn(t.x*t.y,t.y*t.z,t.z*t.z,t.z*t.x),f=t.x*t.x-t.y*t.y;return u.x+=Vn.dot(s,c),u.y+=Vn.dot(a,c),u.z+=Vn.dot(o,c),ir.scaleAndAdd(u,u,h,f),u},t.evaluate=function(t,e){for(var i=new ir(0,0,0),n=e.length,r=0;r<n;r++){var s=e[r];ir.scaleAndAdd(i,i,s,this.evaluateBasis(r,t))}return i},t.project=function(t,e){t.length>0&&(t.length,e.length);for(var i=this.getBasisCount(),n=t.length,r=1/(uut.uniformSpherePdf()*n),s=[],a=0;a<i;a++){for(var o=new ir(0,0,0),h=0;h<n;h++)ir.scaleAndAdd(o,o,e[h],this.evaluateBasis(a,t[h]));ir.multiplyScalar(o,o,r),s.push(o)}return s},t.convolveCosine=function(t){for(var e=[.8862268925,1.0233267546,.495415926],i=[],n=0;n<=this.LMAX;n++)for(var r=-n;r<=n;r++){var s=this.toIndex(n,r),a=new ir(0,0,0);ir.multiplyScalar(a,t[s],this.lambda(n)*e[n]),i.push(a)}return i},t.getBasisCount=function(){return 9},t.evaluateBasis=function(t,e){return this.getBasisCount(),(0,this.basisFunctions[t])(e)},t.reduceRinging=function(t,e){if(0!==e)for(var i=0;i<=this.LMAX;++i)for(var n=1/(1+e*i*i*(i+1)*(i+1)),r=-i;r<=i;++r){var s=this.toIndex(i,r);ir.multiplyScalar(t[s],t[s],n)}},t.lambda=function(t){return Math.sqrt(4*Math.PI/(2*t+1))},t.toIndex=function(t,e){return t*t+t+e},t}());lut.LMAX=2,lut.basisFunctions=[function(){return.282095},function(t){return.488603*t.y},function(t){return.488603*t.z},function(t){return.488603*t.x},function(t){return 1.09255*t.y*t.x},function(t){return 1.09255*t.y*t.z},function(t){return.946175*(t.z*t.z-1/3)},function(t){return 1.09255*t.z*t.x},function(t){return.546274*(t.x*t.x-t.y*t.y)}],lut.basisOverPI=[.0897936,.155527,.155527,.155527,.347769,.347769,.301177,.347769,.173884],A.internal.SH=lut;var cut,fut,_ut,dut,put,mut,gut,yut=function(){function t(){}return t.getQuadraticUniqueRoot=function(t,e,i){return 0!==t?-e/(2*t):0!==e?-i/e:0},t.getCubicUniqueRoot=function(t,e,i){var n=[],r=-t/3,s=e/3-t*t/9,a=i/2+t*t*t/27-t*e/6,o=s*s*s+a*a;if(o>0){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<n.length;c++)if(n[c]+r>=0)return n[c]+r;return 0},t}(),vut=new ir(0,0,0),but=new ir(0,0,0),Sut=new ir(0,0,0),wut=new ir(0,0,0),xut=new ir(0,0,0),Tut=new ir(0,0,0),Aut=new ir(0,0,0),Cut=new ir(0,0,0),Dut=new ir(0,0,0),But=new ir(0,0,0),Iut=new ir(0,0,0),Mut=new ir(0,0,0),Put=new ir(0,0,0),Eut=new ir(0,0,0),Out=new ir(0,0,0),kut=t("eR",(cut=Kh("cc.LightProbesData"),fut=Ou([nut]),_ut=Ou([out]),cut((put=function(){function t(){this._probes=mut&&mut(),this._tetrahedrons=gut&&gut()}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<e;i++){var n=this._probes[i];if(n)n.position.set(t[i]);else{n=new nut(t[i]);for(var r=0;r<lut.getBasisCount();r++)n.coefficients[r]=ir.ZERO;this._probes[i]=n}}},e.updateTetrahedrons=function(){var t=new hut(this._probes);this._tetrahedrons=t.build()},e.getInterpolationSHCoefficients=function(t,e,i){if(!this.hasCoefficients())return!1;var n=lut.getBasisCount(),r=this._tetrahedrons[t],s=this._probes[r.vertex0].coefficients,a=this._probes[r.vertex1].coefficients,o=this._probes[r.vertex2].coefficients;if(r.vertex3>=0)for(var h=this._probes[r.vertex3].coefficients,u=0;u<n;u++)i[u]=new ir(0,0,0),ir.scaleAndAdd(i[u],i[u],s[u],e.x),ir.scaleAndAdd(i[u],i[u],a[u],e.y),ir.scaleAndAdd(i[u],i[u],o[u],e.z),ir.scaleAndAdd(i[u],i[u],h[u],e.w);else for(var l=0;l<n;l++)i[l]=new ir(0,0,0),ir.scaleAndAdd(i[l],i[l],s[l],e.x),ir.scaleAndAdd(i[l],i[l],a[l],e.y),ir.scaleAndAdd(i[l],i[l],o[l],e.z);return!0},e.getInterpolationWeights=function(t,e,i){var n=this._tetrahedrons.length;(e<0||e>=n)&&(e=0);for(var r=-1,s=-1,a=0;a<n;a++){var o=this._tetrahedrons[e];if(this.getBarycentricCoord(t,o,i),i.x>=0&&i.y>=0&&i.z>=0&&i.w>=0)break;if(r===(s=i.x<i.y&&i.x<i.z&&i.x<i.w?o.neighbours[0]:i.y<i.z&&i.y<i.w?o.neighbours[1]:i.z<i.w?o.neighbours[2]:o.neighbours[3]))break;r=e,e=s}return e},e.hasCoefficients=function(){return!this.empty()&&0!==this._probes[0].coefficients.length},t.getTriangleBarycentricCoord=function(t,e,i,n){if(ir.subtract(vut,e,t),ir.subtract(but,i,t),ir.cross(Sut,vut,but),Sut.lengthSqr()<=Ki)return new ir(0,0,0);var r=Sut.clone();r.normalize();var s=1/r.dot(Sut);ir.subtract(wut,t,n),ir.subtract(xut,e,n),ir.subtract(Tut,i,n),ir.cross(Aut,xut,Tut);var a=r.dot(Aut)*s;ir.cross(Cut,Tut,wut);var o=r.dot(Cut)*s;return new ir(a,o,1-a-o)},e.getBarycentricCoord=function(t,e,i){e.vertex3>=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(But,s,r),ir.subtract(Iut,a,r),ir.cross(Dut,But,Iut),ir.subtract(Mut,e,r);var o=ir.dot(Mut,Dut);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?yut.getCubicUniqueRoot(h.x,h.y,h.z):yut.getQuadraticUniqueRoot(h.x,h.y,h.z),ir.scaleAndAdd(Put,r,this._probes[i.vertex0].normal,o),ir.scaleAndAdd(Eut,s,this._probes[i.vertex1].normal,o),ir.scaleAndAdd(Out,a,this._probes[i.vertex2].normal,o);var u=t.getTriangleBarycentricCoord(Put,Eut,Out,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}(),mut=zh(put.prototype,"_probes",[uu,fut],(function(){return[]})),gut=zh(put.prototype,"_tetrahedrons",[uu,_ut],(function(){return[]})),dut=put))||dut));A.internal.LightProbesData=kut;var Rut,Fut,Lut,Vut,Nut,zut,Uut,Gut,Hut,Wut,jut,qut,Xut,Yut,Jut,Kut=t("eS",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}());A.internal.LightProbes=Kut,t("eT",(Rut=Kh("cc.LightProbeGroup"),Fut=Ou([ir]),Lut=Ou(jht),Vut=Ou(li),Nut=Ou(li),zut=Ou(li),Rut(Uut=$h((Gut=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._probes=Hut&&Hut(),e._method=Wut&&Wut(),e._minPos=jut&&jut(),e._maxPos=qut&&qut(),e._nProbesX=Xut&&Xut(),e._nProbesY=Yut&&Yut(),e._nProbesZ=Jut&&Jut(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){},i.onEnable=function(){},i.onDisable=function(){},i.generateLightProbes=function(){this.node&&(this._probes=qht.generate({method:this._method,nProbesX:this._nProbesX,nProbesY:this._nProbesY,nProbesZ:this._nProbesZ,minPos:this._minPos,maxPos:this._maxPos}),this.onProbeChanged())},i.onProbeChanged=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!0);var i=this.node.scene.globals.lightProbeInfo;i.syncData(this.node,this.probes),i.update(t),e&&this.node.emit("light-probe-changed")},n(e,[{key:"probes",get:function(){return this._probes},set:function(t){this._probes=t}},{key:"method",get:function(){return this._method}},{key:"minPos",get:function(){return this._minPos},set:function(t){this._minPos=t}},{key:"maxPos",get:function(){return this._maxPos},set:function(t){this._maxPos=t}},{key:"nProbesX",get:function(){return this._nProbesX},set:function(t){this._nProbesX=t}},{key:"nProbesY",get:function(){return this._nProbesY},set:function(t){this._nProbesY=t}},{key:"nProbesZ",get:function(){return this._nProbesZ},set:function(t){this._nProbesZ=t}}]),e}(yg),Hut=zh(Gut.prototype,"_probes",[uu],(function(){return[]})),Wut=zh(Gut.prototype,"_method",[uu],(function(){return jht.UNIFORM})),jut=zh(Gut.prototype,"_minPos",[uu],(function(){return new ir(-5,-5,-5)})),qut=zh(Gut.prototype,"_maxPos",[uu],(function(){return new ir(5,5,5)})),Xut=zh(Gut.prototype,"_nProbesX",[uu],(function(){return 3})),Yut=zh(Gut.prototype,"_nProbesY",[uu],(function(){return 3})),Jut=zh(Gut.prototype,"_nProbesZ",[uu],(function(){return 3})),v(Gut.prototype,"probes",[Fut],Object.getOwnPropertyDescriptor(Gut.prototype,"probes"),Gut.prototype),v(Gut.prototype,"method",[Lut],Object.getOwnPropertyDescriptor(Gut.prototype,"method"),Gut.prototype),v(Gut.prototype,"nProbesX",[Vut],Object.getOwnPropertyDescriptor(Gut.prototype,"nProbesX"),Gut.prototype),v(Gut.prototype,"nProbesY",[Nut],Object.getOwnPropertyDescriptor(Gut.prototype,"nProbesY"),Gut.prototype),v(Gut.prototype,"nProbesZ",[zut],Object.getOwnPropertyDescriptor(Gut.prototype,"nProbesZ"),Gut.prototype),Uut=Gut))||Uut)||Uut));var Qut,Zut,$ut,tlt,elt,ilt,nlt,rlt,slt,alt,olt,hlt,ult,llt,clt,flt,_lt,dlt,plt,mlt,glt,ylt,vlt,blt,Slt,wlt,xlt,Tlt,Alt=t("eV",(Qut=Kh("cc.Billboard"),Zut=Ou(Ey),$ut=Ou(Ey),Qut((elt=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this)._texture=ilt&&ilt(),e._height=nlt&&nlt(),e._width=rlt&&rlt(),e._rotation=slt&&slt(),e._techIndex=alt&&alt(),e._model=null,e._mesh=null,e._material=null,e._uniform=new Vn(1,1,0,0),e}return e.updateTexture=function(){this._material&&this._material.setProperty("mainTexture",this._texture)},e.updateHeight=function(){this._material&&(this._uniform.y=this._height,this._material.setProperty("cc_size_rotation",this._uniform))},e.updateWidth=function(){this._material&&(this._uniform.x=this._width,this._material.setProperty("cc_size_rotation",this._uniform))},e.updateRotation=function(){this._material&&(this._uniform.z=this._rotation,this._material.setProperty("cc_size_rotation",this._uniform))},e.updateTechnique=function(){this._model&&this._mesh&&this._material&&this._material.technique!==this._techIndex&&(this.detachFromScene(),this._model.destroy(),this._model=null,this._material.destroy(),this._material=null,this._mesh.destroy(),this._mesh=null,this.createModel(),this.updateWidth(),this.updateHeight(),this.updateRotation(),this.updateTexture(),this.enabled?(this.attachToScene(),this._model.enabled=!0):this._model.enabled=!1)},e.onLoad=function(){this.createModel()},e.onEnable=function(){this.attachToScene(),this._model.enabled=!0,this.updateWidth(),this.updateHeight(),this.updateRotation(),this.updateTexture(),this.updateTechnique()},e.onDisable=function(){this.detachFromScene()},e.attachToScene=function(){this._model&&this.node&&this.node.scene&&(this._model.scene&&this.detachFromScene(),this._getRenderScene().addModel(this._model))},e.detachFromScene=function(){this._model&&this._model.scene&&this._model.scene.removeModel(this._model)},e.createModel=function(){this._mesh=Gk({primitiveMode:7,positions:[0,0,0,0,0,0,0,0,0,0,0,0],uvs:[0,0,1,0,0,1,1,1],colors:[cr.WHITE.r,cr.WHITE.g,cr.WHITE.b,cr.WHITE.a,cr.WHITE.r,cr.WHITE.g,cr.WHITE.b,cr.WHITE.a,cr.WHITE.r,cr.WHITE.g,cr.WHITE.b,cr.WHITE.a,cr.WHITE.r,cr.WHITE.g,cr.WHITE.b,cr.WHITE.a],attributes:[new Cd("a_position",32),new Cd("a_texCoord",21),new Cd("a_color",39,!0)],indices:[0,1,2,1,2,3]},void 0,{calculateBounds:!1});var t=this._model=A.director.root.createModel(KM);t.node=t.transform=this.node,null==this._material&&(this._material=new GT,this._material.copy(mT.get("default-billboard-material"),{technique:this._techIndex})),t.initSubModel(0,this._mesh.renderingSubMeshes[0],this._material)},n(i,[{key:"texture",get:function(){return this._texture},set:function(t){this._texture=t,this.updateTexture()}},{key:"height",get:function(){return this._height},set:function(t){this._height=t,this.updateHeight()}},{key:"width",get:function(){return this._width},set:function(t){this._width=t,this.updateWidth()}},{key:"rotation",get:function(){return Math.round(100*rn(this._rotation))/100},set:function(t){this._rotation=nn(t),this.updateRotation()}},{key:"technique",get:function(){return this._techIndex},set:function(t){var e,i;t=Math.floor(t);var n=null==(e=this._material)||null==(i=e.effectAsset)?void 0:i.techniques;n&&t>=n.length&&(t=n.length-1),t<0&&(t=0),this._techIndex=t,this.updateTechnique()}}]),i}(yg),ilt=zh(elt.prototype,"_texture",[Zut],(function(){return null})),v(elt.prototype,"texture",[$ut],Object.getOwnPropertyDescriptor(elt.prototype,"texture"),elt.prototype),nlt=zh(elt.prototype,"_height",[uu],(function(){return 0})),rlt=zh(elt.prototype,"_width",[uu],(function(){return 0})),slt=zh(elt.prototype,"_rotation",[uu],(function(){return 0})),alt=zh(elt.prototype,"_techIndex",[uu],(function(){return 0})),tlt=elt))||tlt)),Clt=[new Cd("a_position",32),new Cd("a_texCoord",44),new Cd("a_texCoord1",32),new Cd("a_color",35,!0)],Dlt=new ir,Blt=new ir,Ilt=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=Clt;t<e.length;t++){var i=e[t];i.offset=this._vertSize,this._vertSize+=ip[i.format].size}this._vertAttrsFloatCount=this._vertSize/4,this._vBuffer=this.createSubMeshData(),this._vdataF32=new Float32Array(this._vBuffer),this._vdataUint32=new Uint32Array(this._vBuffer)},i.updateMaterial=function(e){this._material=e,t.prototype.setSubModelMaterial.call(this,0,e)},i.createSubMeshData=function(){this._subMeshData&&this.destroySubMeshData(),this._vertCount=2,this._indexCount=6;var t=this._device.createBuffer(new ud(10,1,this._vertSize*this._capacity*this._vertCount,this._vertSize)),e=new ArrayBuffer(this._vertSize*this._capacity*this._vertCount);t.update(e);for(var i=new Uint16Array((this._capacity-1)*this._indexCount),n=0,r=0;r<this._capacity-1;++r){var s=2*r;i[n++]=s,i[n++]=s+1,i[n++]=s+2,i[n++]=s+3,i[n++]=s+2,i[n++]=s+1}var a=this._device.createBuffer(new ud(6,1,(this._capacity-1)*this._indexCount*2,2));return a.update(i),this._iaVertCount=this._capacity*this._vertCount,this._iaIndexCount=(this._capacity-1)*this._indexCount,this._subMeshData=new sO([t],Clt,7,a),this.initSubModel(0,this._subMeshData,this._material),e},i.addLineVertexData=function(t,e,i){if(t.length>1){var n=0;ir.subtract(Dlt,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++]=Dlt.x,this._vdataF32[n++]=Dlt.y,this._vdataF32[n++]=Dlt.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++]=Dlt.x,this._vdataF32[n++]=Dlt.y,this._vdataF32[n++]=Dlt.z,this._vdataUint32[n++]=cr.toUint32(i.evaluate(0,1));for(var r=1;r<t.length-1;r++){ir.subtract(Dlt,t[r-1],t[r]),ir.subtract(Blt,t[r+1],t[r]),ir.subtract(Blt,Blt,Dlt);var s=r/t.length;this._vdataF32[n++]=t[r].x,this._vdataF32[n++]=t[r].y,this._vdataF32[n++]=t[r].z,this._vdataF32[n++]=0,this._vdataF32[n++]=e.evaluate(s,1),this._vdataF32[n++]=s,this._vdataF32[n++]=0,this._vdataF32[n++]=Blt.x,this._vdataF32[n++]=Blt.y,this._vdataF32[n++]=Blt.z,this._vdataUint32[n++]=cr.toUint32(i.evaluate(s,1)),this._vdataF32[n++]=t[r].x,this._vdataF32[n++]=t[r].y,this._vdataF32[n++]=t[r].z,this._vdataF32[n++]=1,this._vdataF32[n++]=e.evaluate(s,1),this._vdataF32[n++]=s,this._vdataF32[n++]=1,this._vdataF32[n++]=Blt.x,this._vdataF32[n++]=Blt.y,this._vdataF32[n++]=Blt.z,this._vdataUint32[n++]=cr.toUint32(i.evaluate(s,1))}ir.subtract(Dlt,t[t.length-1],t[t.length-2]),this._vdataF32[n++]=t[t.length-1].x,this._vdataF32[n++]=t[t.length-1].y,this._vdataF32[n++]=t[t.length-1].z,this._vdataF32[n++]=0,this._vdataF32[n++]=e.evaluate(1,1),this._vdataF32[n++]=1,this._vdataF32[n++]=0,this._vdataF32[n++]=Dlt.x,this._vdataF32[n++]=Dlt.y,this._vdataF32[n++]=Dlt.z,this._vdataUint32[n++]=cr.toUint32(i.evaluate(1,1)),this._vdataF32[n++]=t[t.length-1].x,this._vdataF32[n++]=t[t.length-1].y,this._vdataF32[n++]=t[t.length-1].z,this._vdataF32[n++]=1,this._vdataF32[n++]=e.evaluate(1,1),this._vdataF32[n++]=1,this._vdataF32[n++]=1,this._vdataF32[n++]=Dlt.x,this._vdataF32[n++]=Dlt.y,this._vdataF32[n++]=Dlt.z,this._vdataUint32[n++]=cr.toUint32(i.evaluate(1,1))}this.updateIA(Math.max(0,t.length-1))},i.updateIA=function(t){var e=this._subModels[0].inputAssembler;e.vertexBuffers[0].update(this._vdataF32),e.firstIndex=0,e.indexCount=this._indexCount*t,e.vertexCount=this._iaVertCount},i.destroySubMeshData=function(){this._subMeshData&&(this._subMeshData.destroy(),this._subMeshData=null)},e}(KM),Mlt=Vi.Attr.setClassAttr,Plt=[["mode","constant","multiplier"],["mode","spline","multiplier"],["mode","splineMin","splineMax","multiplier"],["mode","constantMin","constantMax","multiplier"]],Elt=Ee({Constant:0,Curve:1,TwoCurves:2,TwoConstants:3}),Olt=t("eZ",Kh("cc.CurveRange")((hlt=function(){function t(){this.constant=0,this.constantMin=0,this.constantMax=0,this.multiplier=1,this._mode=Elt.Constant}var e=t.prototype;return e.evaluate=function(t,e){switch(this._mode){default:case Elt.Constant:return this.constant;case Elt.Curve:return this.spline.evaluate(t)*this.multiplier;case Elt.TwoCurves:return en(this.splineMin.evaluate(t),this.splineMax.evaluate(t),e)*this.multiplier;case Elt.TwoConstants:return en(this.constantMin,this.constantMax,e)}},e.getMax=function(){switch(this._mode){default:case Elt.Constant:return this.constant;case Elt.Curve:return this.multiplier;case Elt.TwoConstants:return this.constantMax;case Elt.TwoCurves:return this.multiplier}},e.isZero=function(){switch(this._mode){default:case Elt.Constant:return Zi(this.constant,0,Ki);case Elt.Curve:return Zi(this.multiplier,0,Ki);case Elt.TwoConstants:return Zi(Math.max(Math.abs(this.constantMax),Math.abs(this.constantMin)),0,Ki);case Elt.TwoCurves:return Zi(this.multiplier,0,Ki)}},e._onBeforeSerialize=function(){return Plt[this._mode]},n(t,[{key:"mode",get:function(){return this._mode},set:function(t){switch(this._mode=t,t){case Elt.Constant:case Elt.TwoConstants:break;case Elt.Curve:this.spline||(this.spline=mf());break;case Elt.TwoCurves:this.splineMax||(this.splineMax=mf()),this.splineMin||(this.splineMin=mf())}}},{key:"curve",get:function(){var t;return null!==(t=this._curve)&&void 0!==t?t:this._curve=new _f(this.spline)},set:function(t){this._curve=t,this.spline=t._internalCurve}},{key:"curveMin",get:function(){var t;return null!==(t=this._curveMin)&&void 0!==t?t:this._curveMin=new _f(this.splineMin)},set:function(t){this._curveMin=t,this.splineMin=t._internalCurve}},{key:"curveMax",get:function(){var t;return null!==(t=this._curveMax)&&void 0!==t?t:this._curveMax=new _f(this.splineMax)},set:function(t){this._curveMax=t,this.splineMax=t._internalCurve}}]),t}(),hlt.Mode=Elt,olt=hlt))||olt);function klt(t,e,i){switch(t.mode){case Elt.Constant:return t.constant;case Elt.Curve:return t.spline.evaluate(e)*t.multiplier;case Elt.TwoCurves:return 0===i?t.splineMin.evaluate(e)*t.multiplier:t.splineMax.evaluate(e)*t.multiplier;case Elt.TwoConstants:return 0===i?t.constantMin:t.constantMax;default:return 0}}function Rlt(t){switch(t.mode){case Elt.TwoConstants:case Elt.TwoCurves:return 2;default:return 1}}function Flt(t,e,i){var n=new Hm({width:e,height:i,_data:t,_compressed:!1,format:44}),r=new Ey;return r.setFilters(1,1),r.setMipFilter(0),r.setWrapMode(2,2,2),r.image=n,r}function Llt(t,e,i,n){return null===t||i!==t.width||n!==t.height?(t&&t.destroy(),t=Flt(e,i,n)):t.uploadData(e),t}function Vlt(t,e,i,n){var r=Rlt(n),s=i*r*4;null!==e&&e.length===s||(e=new Float32Array(i*r*4));for(var a=1/(i-1),o=0,h=0;h<r;h++)for(var u=0;u<i;u++){var l=klt(n,a*u,h);e[o+2]=l,o+=4}return{texture:Llt(t,e,i,r),texdata:e}}function Nlt(t,e,i,n){var r=Rlt(n),s=i*r*4;null!==e&&e.length===s||(e=new Float32Array(i*r*4));for(var a=1/(i-1),o=0,h=0,u=0;u<r;u++)for(var l=0;l<i;l++)o=klt(n,a*l,u),e[h]=o,e[h+1]=o,e[h+2]=o,h+=4;return{texture:Llt(t,e,i,r),texdata:e}}function zlt(t,e,i,n,r){var s=Math.max(Rlt(n),Rlt(r)),a=i*s*4;null!==e&&e.length===a||(e=new Float32Array(i*s*4));for(var o=[n,r],h=1/(i-1),u=0;u<s;u++)for(var l=0;l<2;l++)for(var c=o[l],f=0,_=0;_<i;_++)f=klt(c,h*_,u),e[4*(u*i+_)+l]=f;return{texture:Llt(t,e,i,s),texdata:e}}function Ult(t,e,i,n,r,s,a){var o=Math.max(Rlt(n),Rlt(r),Rlt(s)),h=i*o*4;null!==e&&e.length===h||(e=new Float32Array(i*o*4));for(var u=[n,r,s],l=1/(i-1),c=0;c<o;c++)for(var f=0;f<3;f++)for(var _=u[f],d=0,p=0,m=0;m<i;m++){var g=klt(_,l*m,c);p=a?g:(d+=g)/(m+1),e[4*(c*i+m)+f]=p}return{texture:Llt(t,e,i,o),texdata:e}}function Glt(t,e,i,n,r,s,a){var o=Math.max(Rlt(n),Rlt(r),Rlt(s),Rlt(a)),h=i*o*4;null!==e&&e.length===h||(e=new Float32Array(i*o*4));for(var u=[n,r,s,a],l=1/(i-1),c=0;c<o;c++)for(var f=0;f<4;f++)for(var _=u[f],d=0,p=0,m=0;m<i;m++)p=(d+=klt(_,l*m,c))/(m+1),e[4*(c*i+m)+f]=p;return{texture:Llt(t,e,i,o),texdata:e}}Vi.fastDefine("cc.CurveRange",Olt,{multiplier:1,constantMax:0,constantMin:0,constant:0,mode:Elt.Constant,splineMax:Object.freeze(mf()),splineMin:Object.freeze(mf()),spline:Object.freeze(mf())}),Mlt(Olt,"multiplier","visible",!0),Mlt(Olt,"constantMax","visible",!0),Mlt(Olt,"constantMin","visible",!0),Mlt(Olt,"constant","visible",!0),Ti(Olt,"mode",Elt),Mlt(Olt,"mode","visible",!0),Mlt(Olt,"splineMax","type","Object"),Mlt(Olt,"splineMax","ctor",Zl),Mlt(Olt,"splineMax","visible",!0),Mlt(Olt,"splineMin","type","Object"),Mlt(Olt,"splineMin","ctor",Zl),Mlt(Olt,"splineMin","visible",!0),Mlt(Olt,"spline","type","Object"),Mlt(Olt,"spline","ctor",Zl),Mlt(Olt,"spline","visible",!0);var Hlt,Wlt,jlt,qlt,Xlt,Ylt,Jlt,Klt,Qlt,Zlt,$lt,tct,ect,ict,nct,rct,sct,act,oct,hct,uct=Ee({Color:0,Gradient:1,TwoColors:2,TwoGradients:3,RandomColor:4}),lct=new cr,cct=new cr,fct=t("e_",(ult=Kh("cc.GradientRange"),llt=Ou(uct),clt=Ou(uf),flt=Ou(uf),_lt=Ou(uf),dlt=Ou(uct),ult((Tlt=function(){function t(){this.color=glt&&glt(),this.colorMin=ylt&&ylt(),this.colorMax=vlt&&vlt(),this.gradient=blt&&blt(),this.gradientMin=Slt&&Slt(),this.gradientMax=wlt&&wlt(),this._mode=xlt&&xlt(),this._color=cr.WHITE.clone()}var e=t.prototype;return e.evaluate=function(t,e){switch(this._mode){case uct.Color:return this.color;case uct.TwoColors:return cr.lerp(this._color,this.colorMin,this.colorMax,e),this._color;case uct.RandomColor:return this.gradient.getRandomColor(this._color);case uct.Gradient:return this.gradient.evaluateFast(this._color,t);case uct.TwoGradients:return cr.lerp(this._color,this.gradientMin.evaluateFast(lct,t),this.gradientMax.evaluateFast(cct,t),e),this._color;default:return this.color}},e._onBeforeSerialize=function(){return(!1)[this._mode]},n(t,[{key:"mode",get:function(){return this._mode},set:function(t){this._mode=t}}]),t}(),Tlt.Mode=uct,v((mlt=Tlt).prototype,"mode",[llt],Object.getOwnPropertyDescriptor(mlt.prototype,"mode"),mlt.prototype),glt=zh(mlt.prototype,"color",[uu],(function(){return cr.WHITE.clone()})),ylt=zh(mlt.prototype,"colorMin",[uu],(function(){return cr.WHITE.clone()})),vlt=zh(mlt.prototype,"colorMax",[uu],(function(){return cr.WHITE.clone()})),blt=zh(mlt.prototype,"gradient",[clt],(function(){return new uf})),Slt=zh(mlt.prototype,"gradientMin",[flt],(function(){return new uf})),wlt=zh(mlt.prototype,"gradientMax",[_lt],(function(){return new uf})),xlt=zh(mlt.prototype,"_mode",[dlt],(function(){return uct.Color})),plt=mlt))||plt));function _ct(t,e,i){switch(t.mode){case uct.Color:return t.color;case uct.TwoColors:return 0===i?t.colorMin:t.colorMax;case uct.RandomColor:return t.gradient.getRandomColor(lct);case uct.Gradient:return t.gradient.evaluateFast(lct,e);case uct.TwoGradients:return 0===i?t.gradientMin.evaluateFast(lct,e):t.gradientMax.evaluateFast(lct,e);default:return t.color}}function dct(t){switch(t.mode){case uct.TwoColors:case uct.TwoGradients:return 2;default:return 1}}function pct(t,e,i,n){var r=dct(n),s=i*r*4;null!==e&&e.length===s||(e=new Uint8Array(i*r*4));for(var a=1/(i-1),o=0,h=0;h<r;h++)for(var u=0;u<i;u++){var l=_ct(n,a*u,h);e[o]=l.r,e[o+1]=l.g,e[o+2]=l.b,e[o+3]=l.a,o+=4}return null!==t&&i===t.width&&r===t.height||(t&&t.destroy(),(t=new Ey).create(i,r,35),t.setFilters(2,2),t.setWrapMode(2,2)),t.uploadData(e),{texture:t,texdata:e}}var mct="CC_USE_WORLD_SPACE",gct={CC_USE_WORLD_SPACE:!1,CC_USE_WORLD_SCALE:!0},yct=t("eW",(Hlt=Kh("cc.Line"),Wlt=Ou(Ey),jlt=Ou(Ey),qlt=Ou(GT),Xlt=Ou([ir]),Ylt=Ou([ir]),Jlt=Ou(Olt),Klt=Ou(fct),Qlt=Ou(ds),Zlt=Ou(ds),Hlt((tct=function(t){function e(){var e;return(e=t.call(this)||this)._texture=ect&&ect(),e._material=ict&&ict(),e._worldSpace=nct&&nct(),e._positions=rct&&rct(),e._width=sct&&sct(),e._color=act&&act(),e._tile=oct&&oct(),e._tile_offset=new Vn,e._offset=hct&&hct(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){var t=A.director.root.createModel(Ilt);if(0===this._models.length?this._models.push(t):this._models[0]=t,t.node=t.transform=this.node,this._material&&(this.lineMaterial=this._material,this._material=null),null===this.lineMaterial){var e=mT.get("default-trail-material");this.material=e}var i=this.getMaterialInstance(0);i&&(gct[mct]=this.worldSpace,i.recompileShaders(gct),t.updateMaterial(i)),t.setCapacity(100)},i.onEnable=function(){t.prototype.onEnable.call(this),0!==this._models.length&&this._models[0]&&(this._attachToScene(),this.texture=this._texture,this.tile=this._tile,this.offset=this._offset,this._models[0].addLineVertexData(this._positions,this.width,this.color))},i.onDisable=function(){this._models.length>0&&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&&(gct[mct]=this.worldSpace,n.recompileShaders(gct),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&&(gct[mct]=this.worldSpace,e.recompileShaders(gct),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}(HU),ect=zh(tct.prototype,"_texture",[Wlt],(function(){return null})),v(tct.prototype,"texture",[jlt],Object.getOwnPropertyDescriptor(tct.prototype,"texture"),tct.prototype),ict=zh(tct.prototype,"_material",[uu],(function(){return null})),v(tct.prototype,"lineMaterial",[qlt],Object.getOwnPropertyDescriptor(tct.prototype,"lineMaterial"),tct.prototype),v(tct.prototype,"sharedMaterials",[Gu,uu],Object.getOwnPropertyDescriptor(tct.prototype,"sharedMaterials"),tct.prototype),nct=zh(tct.prototype,"_worldSpace",[uu],(function(){return!1})),rct=zh(tct.prototype,"_positions",[Xlt],(function(){return[]})),v(tct.prototype,"positions",[Ylt],Object.getOwnPropertyDescriptor(tct.prototype,"positions"),tct.prototype),v(tct.prototype,"width",[Jlt],Object.getOwnPropertyDescriptor(tct.prototype,"width"),tct.prototype),sct=zh(tct.prototype,"_width",[uu],(function(){return new Olt})),v(tct.prototype,"color",[Klt],Object.getOwnPropertyDescriptor(tct.prototype,"color"),tct.prototype),act=zh(tct.prototype,"_color",[uu],(function(){return new fct})),oct=zh(tct.prototype,"_tile",[uu],(function(){return new ds(1,1)})),v(tct.prototype,"tile",[Qlt],Object.getOwnPropertyDescriptor(tct.prototype,"tile"),tct.prototype),hct=zh(tct.prototype,"_offset",[uu],(function(){return new ds(0,0)})),v(tct.prototype,"offset",[Zlt],Object.getOwnPropertyDescriptor(tct.prototype,"offset"),tct.prototype),$lt=tct))||$lt)),vct=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 Kr,this.localMat=new Kr,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}();vct.INDENTIFY_NEG_QUAT=10,vct.R2D=180/Math.PI;var bct,Sct,wct,xct,Tct,Act,Cct="noiseModule",Dct=["sizeModule","colorModule","forceModule","velocityModule","limitModule","rotationModule","textureModule","noiseModule"],Bct=["_colorOverLifetimeModule","_shapeModule","_sizeOvertimeModule","_velocityOvertimeModule","_forceOvertimeModule","_limitVelocityOvertimeModule","_rotationOvertimeModule","_textureAnimationModule","_noiseModule","_trailModule"],Ict=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}(),Mct=new ir(0,0,-1);function Pct(t,e,i,n){return e!==t?(0===t||Kr.invert(i,i),Kr.getRotation(n,i),!0):(kr.set(n,0,0,0,1),!1)}function Ect(t,e){ds.set(t,Math.cos(e),Math.sin(e))}function Oct(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 kct(t,e,i){Oct(t),ir.multiplyScalar(t,t,e+(i-e)*sn())}function Rct(t,e,i,n){Ect(t,n),t.z=0,ir.multiplyScalar(t,t,e+(i-e)*sn())}function Fct(t){for(var e=0;e<t.length;e++){var i=e+hn(0,t.length-e),n=t[i];t[i]=t[e],t[e]=n}}function Lct(){var t=on(-1,1);return 0===t&&t++,M(t)}function Vct(t){var e=Olt.Mode;switch(t.mode){case e.TwoCurves:case e.TwoConstants:return!0;default:return!1}}function Nct(t){var e=fct.Mode;switch(t.mode){case e.TwoGradients:case e.TwoColors:return!0;default:return!1}}var zct=(bct=Kh("cc.ColorOvertimeModule"),Sct=Ou(fct),bct((xct=function(t){function e(){var e;return(e=t.call(this)||this)._enable=Tct&&Tct(),e.color=Act&&Act(),e.name="colorModule",e}return s(e,t),e.prototype.animate=function(t){t.color.set(t.startColor);var e=Nct(this.color)?un(t.randomSeed+91041):0;t.color.multiply(this.color.evaluate(1-t.remainingLifetime/t.startLifetime,e))},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}(Ict),Tct=zh(xct.prototype,"_enable",[uu],(function(){return!1})),Act=zh(xct.prototype,"color",[Sct,uu],(function(){return new fct})),wct=xct))||wct),Uct={World:0,Local:1,Custom:2};Ee(Uct);var Gct={Pause:0,PauseAndCatchup:1,AlwaysSimulate:2};Ee(Gct);var Hct={World:0,Local:1,View:2};Ee(Hct);var Wct={Billboard:0,StrecthedBillboard:1,HorizontalBillboard:2,VerticalBillboard:3,Mesh:4};Ee(Wct);var jct={Box:0,Circle:1,Cone:2,Sphere:3,Hemisphere:4};Ee(jct);var qct={Base:0,Edge:1,Shell:2,Volume:3};Ee(qct);var Xct={Random:0,Loop:1,PingPong:2};Ee(Xct);var Yct={Particles:0};Ee(Yct);var Jct,Kct,Qct,Zct,$ct,tft,eft,ift,nft,rft,sft,aft,oft={Stretch:0};Ee(oft);var hft,uft,lft,cft,fft,_ft,dft,pft,mft,gft,yft,vft,bft,Sft,wft,xft,Tft,Aft,Cft,Dft,Bft,Ift,Mft,Pft,Eft,Oft,kft,Rft=212165,Fft=new ir,Lft=(Jct=Kh("cc.ForceOvertimeModule"),Kct=Ou(Olt),Qct=Ou(Olt),Zct=Ou(Olt),$ct=Ou(Uct),Jct((eft=function(t){function e(){var e;return(e=t.call(this)||this)._enable=ift&&ift(),e.x=nft&&nft(),e.y=rft&&rft(),e.z=sft&&sft(),e.space=aft&&aft(),e.randomized=!1,e.rotation=void 0,e.needTransform=void 0,e.name="forceModule",e.rotation=new kr,e.needTransform=!1,e.needUpdate=!0,e}s(e,t);var i=e.prototype;return i.update=function(t,e){this.needTransform=Pct(t,this.space,e,this.rotation)},i.animate=function(t,e){var i=1-t.remainingLifetime/t.startLifetime,n=Vct(this.x)?un(t.randomSeed+Rft):0,r=Vct(this.y)?un(t.randomSeed+Rft):0,s=Vct(this.z)?un(t.randomSeed+Rft):0,a=ir.set(Fft,this.x.evaluate(i,n),this.y.evaluate(i,r),this.z.evaluate(i,s));this.needTransform&&ir.transformQuat(a,a,this.rotation),ir.scaleAndAdd(t.velocity,t.velocity,a,e),ir.copy(t.ultimateVelocity,t.velocity)},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}(Ict),ift=zh(eft.prototype,"_enable",[uu],(function(){return!1})),nft=zh(eft.prototype,"x",[Kct,uu],(function(){return new Olt})),rft=zh(eft.prototype,"y",[Qct,uu],(function(){return new Olt})),sft=zh(eft.prototype,"z",[Zct,uu],(function(){return new Olt})),aft=zh(eft.prototype,"space",[$ct,uu],(function(){return 1})),tft=eft))||tft),Vft=23541,Nft=new ir,zft=new ir,Uft=(hft=Kh("cc.LimitVelocityOvertimeModule"),uft=Ou(Olt),lft=Ou(Olt),cft=Ou(Olt),fft=Ou(Olt),_ft=Ou(Uct),hft((pft=function(t){function e(){var e;return(e=t.call(this)||this)._enable=mft&&mft(),e.limitX=gft&&gft(),e.limitY=yft&&yft(),e.limitZ=vft&&vft(),e.limit=bft&&bft(),e.dampen=Sft&&Sft(),e.separateAxes=wft&&wft(),e.space=xft&&xft(),e.drag=null,e.multiplyDragByParticleSize=!1,e.multiplyDragByParticleVelocity=!1,e.name="limitModule",e.rotation=void 0,e.needTransform=void 0,e.rotation=new kr,e.needTransform=!1,e.needUpdate=!0,e}s(e,t);var i=e.prototype;return i.update=function(t,e){this.needTransform=Pct(t,this.space,e,this.rotation)},i.animate=function(t){var e=1-t.remainingLifetime/t.startLifetime,i=Nft;if(this.separateAxes){var n=Vct(this.limitX)?un(t.randomSeed+Vft):0,r=Vct(this.limitY)?un(t.randomSeed+Vft):0,s=Vct(this.limitZ)?un(t.randomSeed+Vft):0;ir.set(zft,this.limitX.evaluate(e,n),this.limitY.evaluate(e,r),this.limitZ.evaluate(e,s)),this.needTransform&&ir.transformQuat(zft,zft,this.rotation),ir.set(i,Gft(t.ultimateVelocity.x,zft.x,this.dampen),Gft(t.ultimateVelocity.y,zft.y,this.dampen),Gft(t.ultimateVelocity.z,zft.z,this.dampen))}else{ir.normalize(i,t.ultimateVelocity);var a=Vct(this.limit)?un(t.randomSeed+Vft):0;ir.multiplyScalar(i,i,Gft(t.ultimateVelocity.length(),this.limit.evaluate(e,a),this.dampen))}ir.copy(t.ultimateVelocity,i),ir.copy(t.velocity,t.ultimateVelocity)},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}(Ict),mft=zh(pft.prototype,"_enable",[uu],(function(){return!1})),gft=zh(pft.prototype,"limitX",[uft,uu],(function(){return new Olt})),yft=zh(pft.prototype,"limitY",[lft,uu],(function(){return new Olt})),vft=zh(pft.prototype,"limitZ",[cft,uu],(function(){return new Olt})),bft=zh(pft.prototype,"limit",[fft,uu],(function(){return new Olt})),Sft=zh(pft.prototype,"dampen",[uu],(function(){return 3})),wft=zh(pft.prototype,"separateAxes",[uu],(function(){return!1})),xft=zh(pft.prototype,"space",[_ft,uu],(function(){return 1})),dft=pft))||dft);function Gft(t,e,i){var n=Math.sign(t),r=Math.abs(t);if(r>e){var s=r-r*i;r=s>e?s:e}return r*n}var Hft,Wft,jft,qft,Xft,Yft,Jft,Kft,Qft,Zft,$ft,t_t,e_t,i_t,n_t,r_t,s_t,a_t,o_t,h_t,u_t,l_t,c_t,f_t,__t,d_t,p_t,m_t,g_t,y_t,v_t,b_t,S_t,w_t,x_t,T_t,A_t,C_t,D_t,B_t,I_t,M_t,P_t,E_t,O_t,k_t,R_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,J_t,K_t,Q_t,Z_t,$_t,tdt,edt,idt,ndt,rdt,sdt,adt,odt,hdt,udt,ldt,cdt,fdt,_dt,ddt,pdt,mdt,gdt,ydt,vdt,bdt,Sdt=125292,wdt=(Tft=Kh("cc.RotationOvertimeModule"),Aft=Ou(Olt),Cft=Ou(Olt),Dft=Ou(Olt),Tft((Ift=function(t){function e(){var e;return(e=t.call(this)||this)._enable=Mft&&Mft(),e._separateAxes=Pft&&Pft(),e.x=Eft&&Eft(),e.y=Oft&&Oft(),e.z=kft&&kft(),e.name="rotationModule",e._startMat=new Kr,e._matRot=new Kr,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+=vct.INDENTIFY_NEG_QUAT)},i.animate=function(t,e){var i=1-t.remainingLifetime/t.startLifetime,n=Vct(this.z)?un(t.randomSeed+Sdt):0,r=t.particleSystem.processor.getInfo().renderMode;if(this._separateAxes&&3!==r&&2!==r){var s=Vct(this.x)?un(t.randomSeed+Sdt):0,a=Vct(this.y)?un(t.randomSeed+Sdt):0;kr.fromEuler(t.deltaQuat,this.x.evaluate(i,s)*e*vct.R2D,this.y.evaluate(i,a)*e*vct.R2D,this.z.evaluate(i,n)*e*vct.R2D)}else kr.fromEuler(t.deltaQuat,0,0,this.z.evaluate(i,n)*e*vct.R2D);t.deltaMat=Kr.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*vct.R2D,t.startEuler.y*vct.R2D,t.startEuler.z*vct.R2D),t.startRotated=!0),this._startMat=Kr.fromQuat(this._startMat,t.startRotation),this._matRot=this._startMat.multiply(t.localMat),Kr.getRotation(this._quatRot,this._matRot),this._processRotation(t,vct.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}(Ict),Mft=zh(Ift.prototype,"_enable",[uu],(function(){return!1})),Pft=zh(Ift.prototype,"_separateAxes",[uu],(function(){return!1})),Eft=zh(Ift.prototype,"x",[Aft,uu],(function(){return new Olt})),Oft=zh(Ift.prototype,"y",[Cft,uu],(function(){return new Olt})),kft=zh(Ift.prototype,"z",[Dft,uu],(function(){return new Olt})),Bft=Ift))||Bft),xdt=39825,Tdt=(Hft=Kh("cc.SizeOvertimeModule"),Wft=Ou(Olt),jft=Ou(Olt),qft=Ou(Olt),Xft=Ou(Olt),Hft((Jft=function(t){function e(){var e;return(e=t.call(this)||this)._enable=Kft&&Kft(),e.separateAxes=Qft&&Qft(),e.size=Zft&&Zft(),e.x=$ft&&$ft(),e.y=t_t&&t_t(),e.z=e_t&&e_t(),e.name="sizeModule",e}return s(e,t),e.prototype.animate=function(t){if(this.separateAxes){var e=1-t.remainingLifetime/t.startLifetime,i=Vct(this.x)?un(t.randomSeed+xdt):0,n=Vct(this.y)?un(t.randomSeed+xdt):0,r=Vct(this.z)?un(t.randomSeed+xdt):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=Vct(this.size)?un(t.randomSeed+xdt):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}(Ict),Kft=zh(Jft.prototype,"_enable",[uu],(function(){return!1})),Qft=zh(Jft.prototype,"separateAxes",[uu],(function(){return!1})),Zft=zh(Jft.prototype,"size",[Wft,uu],(function(){return new Olt})),$ft=zh(Jft.prototype,"x",[jft,uu],(function(){return new Olt})),t_t=zh(Jft.prototype,"y",[qft,uu],(function(){return new Olt})),e_t=zh(Jft.prototype,"z",[Xft,uu],(function(){return new Olt})),Yft=Jft))||Yft),Adt=Ee({Grid:0}),Cdt=Ee({WholeSheet:0,SingleRow:1}),Ddt=(i_t=Kh("cc.TextureAnimationModule"),n_t=lu("numTilesX"),r_t=lu("numTilesY"),s_t=Ou(Adt),a_t=Ou(Adt),o_t=Ou(Cdt),h_t=Ou(Olt),u_t=Ou(Olt),i_t((c_t=function(t){function e(){var e;return(e=t.call(this)||this)._enable=f_t&&f_t(),e._numTilesX=__t&&__t(),e._numTilesY=d_t&&d_t(),e._mode=p_t&&p_t(),e.animation=m_t&&m_t(),e.frameOverTime=g_t&&g_t(),e.startFrame=y_t&&y_t(),e.cycleCount=v_t&&v_t(),e._flipU=b_t&&b_t(),e._flipV=S_t&&S_t(),e._uvChannelMask=w_t&&w_t(),e.randomRow=x_t&&x_t(),e.rowIndex=T_t&&T_t(),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=Vct(this.startFrame)?un(t.randomSeed+90794):0,n=Vct(this.frameOverTime)?un(t.randomSeed+90794):0,r=this.startFrame.evaluate(e,i)/(this.numTilesX*this.numTilesY);if(this.animation===Cdt.WholeSheet)t.frameIndex=_n(this.cycleCount*(this.frameOverTime.evaluate(e,n)+r),1);else if(this.animation===Cdt.SingleRow){var s=1/this.numTilesY;if(this.randomRow){var a=_n(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,_n(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!==Adt.Grid&&J("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(){J("particle texture animation's flipU is not supported!")}},{key:"flipV",get:function(){return this._flipV},set:function(){J("particle texture animation's flipV is not supported!")}},{key:"uvChannelMask",get:function(){return this._uvChannelMask},set:function(){J("particle texture animation's uvChannelMask is not supported!")}}]),e}(Ict),f_t=zh(c_t.prototype,"_enable",[uu],(function(){return!1})),__t=zh(c_t.prototype,"_numTilesX",[n_t],(function(){return 0})),d_t=zh(c_t.prototype,"_numTilesY",[r_t],(function(){return 0})),p_t=zh(c_t.prototype,"_mode",[s_t],(function(){return Adt.Grid})),v(c_t.prototype,"mode",[a_t],Object.getOwnPropertyDescriptor(c_t.prototype,"mode"),c_t.prototype),m_t=zh(c_t.prototype,"animation",[o_t,uu],(function(){return Cdt.WholeSheet})),g_t=zh(c_t.prototype,"frameOverTime",[h_t,uu],(function(){return new Olt})),y_t=zh(c_t.prototype,"startFrame",[u_t,uu],(function(){return new Olt})),v_t=zh(c_t.prototype,"cycleCount",[uu],(function(){return 0})),b_t=zh(c_t.prototype,"_flipU",[uu],(function(){return 0})),S_t=zh(c_t.prototype,"_flipV",[uu],(function(){return 0})),w_t=zh(c_t.prototype,"_uvChannelMask",[uu],(function(){return-1})),x_t=zh(c_t.prototype,"randomRow",[uu],(function(){return!1})),T_t=zh(c_t.prototype,"rowIndex",[uu],(function(){return 0})),l_t=c_t))||l_t),Bdt=197866,Idt=new ir,Mdt=(A_t=Kh("cc.VelocityOvertimeModule"),C_t=Ou(Olt),D_t=Ou(Olt),B_t=Ou(Olt),I_t=Ou(Olt),M_t=Ou(Uct),A_t((E_t=function(t){function e(){var e;return(e=t.call(this)||this)._enable=O_t&&O_t(),e.x=k_t&&k_t(),e.y=R_t&&R_t(),e.z=F_t&&F_t(),e.speedModifier=L_t&&L_t(),e.space=V_t&&V_t(),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=Pct(t,this.space,e,this.rotation)},i.animate=function(t){var e=1-t.remainingLifetime/t.startLifetime,i=Vct(this.x)?un(t.randomSeed^Bdt):0,n=Vct(this.y)?un(156497^t.randomSeed):0,r=Vct(this.z)?un(984136^t.randomSeed):0,s=Vct(this.speedModifier)?un(t.randomSeed+Bdt):0,a=ir.set(Idt,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}(Ict),O_t=zh(E_t.prototype,"_enable",[uu],(function(){return!1})),k_t=zh(E_t.prototype,"x",[C_t,uu],(function(){return new Olt})),R_t=zh(E_t.prototype,"y",[D_t,uu],(function(){return new Olt})),F_t=zh(E_t.prototype,"z",[B_t,uu],(function(){return new Olt})),L_t=zh(E_t.prototype,"speedModifier",[I_t,uu],(function(){return new Olt})),V_t=zh(E_t.prototype,"space",[M_t,uu],(function(){return 1})),P_t=E_t))||P_t),Pdt=t("e$",(N_t=Kh("cc.Burst"),z_t=Ou(Olt),N_t((G_t=function(){function t(){this._time=H_t&&H_t(),this._repeatCount=W_t&&W_t(),this.repeatInterval=j_t&&j_t(),this.count=q_t&&q_t(),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=_n(t.time-t.startDelay.evaluate(0,1),t.duration)-e;i=i>0?i:0;var n=_n(t.time-t.startDelay.evaluate(0,1),t.duration);this._curTime>=i&&this._curTime<n&&(t.emit(this.count.evaluate(this._curTime/t.duration,1),e-(n-this._curTime)),this._curTime+=this.repeatInterval,--this._remainingCount)}},e.reset=function(){this._remainingCount=0,this._curTime=0},e.getMaxCount=function(t){return this.count.getMax()*Math.min(Math.ceil(t.duration/this.repeatInterval),this.repeatCount)},n(t,[{key:"time",get:function(){return this._time},set:function(t){this._time=t,this._curTime=t}},{key:"repeatCount",get:function(){return this._repeatCount},set:function(t){this._repeatCount=t,this._remainingCount=t}}]),t}(),H_t=zh(G_t.prototype,"_time",[uu],(function(){return 0})),W_t=zh(G_t.prototype,"_repeatCount",[uu],(function(){return 1})),j_t=zh(G_t.prototype,"repeatInterval",[uu],(function(){return 1})),q_t=zh(G_t.prototype,"count",[z_t,uu],(function(){return new Olt})),U_t=G_t))||U_t)),Edt=new ir(0,0,0),Odt=[0,0,0],kdt=new ir(.5,.5,.5),Rdt=(X_t=Kh("cc.ShapeModule"),Y_t=Ou(jct),J_t=lu("shapeType"),K_t=Ou(jct),Q_t=Ou(qct),Z_t=Ou(Xct),$_t=Ou(Olt),X_t((edt=function(){function t(){this._enable=idt&&idt(),this._shapeType=ndt&&ndt(),this.emitFrom=rdt&&rdt(),this.alignToDirection=sdt&&sdt(),this.randomDirectionAmount=adt&&adt(),this.sphericalDirectionAmount=odt&&odt(),this.randomPositionAmount=hdt&&hdt(),this.radius=udt&&udt(),this.radiusThickness=ldt&&ldt(),this.arcMode=cdt&&cdt(),this.arcSpread=fdt&&fdt(),this.arcSpeed=_dt&&_dt(),this.length=ddt&&ddt(),this.boxThickness=pdt&&pdt(),this._position=mdt&&mdt(),this._rotation=gdt&&gdt(),this._scale=ydt&&ydt(),this._arc=vdt&&vdt(),this._angle=bdt&&bdt(),this.mat=new Kr,this.quat=new kr,this.particleSystem=null,this.lastTime=0,this.totalAngle=0}var e=t.prototype;return e.onInit=function(t){this.particleSystem=t,this.constructMat(),this.lastTime=this.particleSystem.time},e.emit=function(t){switch(this.shapeType){case 0:Ndt(this.emitFrom,this.boxThickness,t.position,t.velocity);break;case 1:zdt(this.radius,this.radiusThickness,this.generateArcAngle(),t.position,t.velocity);break;case 2:Vdt(this.emitFrom,this.radius,this.radiusThickness,this.generateArcAngle(),this._angle,this.length,t.position,t.velocity);break;case 3:Fdt(this.emitFrom,this.radius,this.radiusThickness,t.position,t.velocity);break;case 4:Ldt(this.emitFrom,this.radius,this.radiusThickness,t.position,t.velocity);break;default:Y(this.shapeType+" shapeType is not supported by ShapeModule.")}if(this.randomPositionAmount>0&&(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(Edt,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),Kr.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 _n(t,this._arc);case 2:return dn(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}(),idt=zh(edt.prototype,"_enable",[uu],(function(){return!1})),ndt=zh(edt.prototype,"_shapeType",[Y_t,J_t],(function(){return 2})),v(edt.prototype,"shapeType",[K_t],Object.getOwnPropertyDescriptor(edt.prototype,"shapeType"),edt.prototype),rdt=zh(edt.prototype,"emitFrom",[Q_t,uu],(function(){return 3})),sdt=zh(edt.prototype,"alignToDirection",[uu],(function(){return!1})),adt=zh(edt.prototype,"randomDirectionAmount",[uu],(function(){return 0})),odt=zh(edt.prototype,"sphericalDirectionAmount",[uu],(function(){return 0})),hdt=zh(edt.prototype,"randomPositionAmount",[uu],(function(){return 0})),udt=zh(edt.prototype,"radius",[uu],(function(){return 1})),ldt=zh(edt.prototype,"radiusThickness",[uu],(function(){return 1})),cdt=zh(edt.prototype,"arcMode",[Z_t,uu],(function(){return 0})),fdt=zh(edt.prototype,"arcSpread",[uu],(function(){return 0})),_dt=zh(edt.prototype,"arcSpeed",[$_t,uu],(function(){return new Olt})),ddt=zh(edt.prototype,"length",[uu],(function(){return 5})),pdt=zh(edt.prototype,"boxThickness",[uu],(function(){return new ir(0,0,0)})),mdt=zh(edt.prototype,"_position",[uu],(function(){return new ir(0,0,0)})),gdt=zh(edt.prototype,"_rotation",[uu],(function(){return new ir(0,0,0)})),ydt=zh(edt.prototype,"_scale",[uu],(function(){return new ir(1,1,1)})),vdt=zh(edt.prototype,"_arc",[uu],(function(){return nn(360)})),bdt=zh(edt.prototype,"_angle",[uu],(function(){return nn(25)})),tdt=edt))||tdt);function Fdt(t,e,i,n,r){switch(t){case 3:kct(n,e*(1-i),e),ir.normalize(r,n);break;case 2:Oct(n),ir.multiplyScalar(n,n,e),ir.normalize(r,n);break;default:Y(t+" is not supported for sphere emitter.")}}function Ldt(t,e,i,n,r){switch(t){case 3:kct(n,e*(1-i),e),n.z>0&&(n.z*=-1),ir.normalize(r,n);break;case 2:Oct(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 Vdt(t,e,i,n,r,s,a,o){switch(t){case 0:Rct(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:Ect(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:Rct(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(Edt,o,s*sn()/-o.z));break;default:Y(t+" is not supported for cone emitter.")}}function Ndt(t,e,i,n){switch(t){case 3:r=i,s=kdt,ir.set(r,on(-s.x,s.x),on(-s.y,s.y),on(-s.z,s.z));break;case 2:Odt[0]=on(-.5,.5),Odt[1]=on(-.5,.5),Odt[2]=.5*Lct(),Fct(Odt),Udt(Odt,e),ir.set(i,Odt[0],Odt[1],Odt[2]);break;case 1:Odt[0]=on(-.5,.5),Odt[1]=.5*Lct(),Odt[2]=.5*Lct(),Fct(Odt),Udt(Odt,e),ir.set(i,Odt[0],Odt[1],Odt[2]);break;default:Y(t+" is not supported for box emitter.")}var r,s;ir.copy(n,Mct)}function zdt(t,e,i,n,r){Rct(n,t*(1-e),t,i),ir.normalize(r,n)}function Udt(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 Gdt=[0,0,1,0,0,1,1,1],Hdt=[0,0,0,1,0,0,0,1,0,1,1,0],Wdt=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,Wp.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+=ip[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+=ip[r.format].size):1===r.stream&&(r.offset=this._vertAttribSizeStatic,this._vertAttribSizeStatic+=ip[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 ud(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;s<this._vertCount;++s)r[s*this._vertAttrsFloatCount+i/4]=cr.toUint32(cr.WHITE);for(var a=new Float32Array(e),o=1;o<this._capacity;o++)a.copyWithin(o*this._vertAttribSize*this._vertCount/4,0,this._vertAttribSize*this._vertCount/4)}t.update(e);var h=new Uint16Array(this._bufferSize*this._indexCount);if(this._mesh&&this._capacity>0){this._mesh.copyIndices(0,h);for(var u=1;u<this._capacity;u++)for(var l=0;l<this._indexCount;l++)h[u*this._indexCount+l]=h[l]+u*this._vertCount}else for(var c=0,f=0;f<this._capacity;++f){var _=4*f;h[c++]=_,h[c++]=_+1,h[c++]=_+2,h[c++]=_+3,h[c++]=_+2,h[c++]=_+1}var d=this._device.createBuffer(new ud(6,1,this._bufferSize*this._indexCount*2,2));return d.update(h),this._iaVertCount=this._capacity*this._vertCount,this._iaIndexCount=this._capacity*this._indexCount,this._subMeshData=new sO([t],this._vertAttrs,7,d),this.initSubModel(0,this._subMeshData,this._material),e},i.createSubMeshDataInsDynamic=function(){this._insBuffers.length=0,this.destroySubMeshData();var t=this._device.createBuffer(new ud(10,3,this._vertAttribSize*this._bufferSize,this._vertAttribSize)),e=new ArrayBuffer(this._vertAttribSize*this._bufferSize);return t.update(e),this._insBuffers.push(t),e},i.createSubMeshDataInsStatic=function(){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 ud(10,3,this._vertAttribSizeStatic*this._vertCount,this._vertAttribSizeStatic)),e=new ArrayBuffer(this._vertAttribSizeStatic*this._vertCount);if(this._mesh){var i=this._vertAttrs.findIndex((function(t){return"a_texCoord"===t.name})),n=this._vertAttrs[i].offset;if(this._mesh.copyAttribute(0,"a_texCoord",e,this._vertAttribSizeStatic,n),i=this._vertAttrs.findIndex((function(t){return"a_texCoord3"===t.name})),n=this._vertAttrs[i++].offset,this._mesh.copyAttribute(0,"a_position",e,this._vertAttribSizeStatic,n),n=this._vertAttrs[i++].offset,this._mesh.copyAttribute(0,"a_normal",e,this._vertAttribSizeStatic,n),n=this._vertAttrs[i++].offset,!this._mesh.copyAttribute(0,"a_color",e,this._vertAttribSizeStatic,n))for(var r=new Uint32Array(e),s=0;s<this._vertCount;++s)r[s*this._vertStaticAttrsFloatCount+n/4]=cr.toUint32(cr.WHITE)}else for(var a=new Float32Array(e),o=0;o<Hdt.length;++o)a[o]=Hdt[o];t.update(e);var h=new Uint16Array(this._indexCount);this._mesh?this._mesh.copyIndices(0,h):(h[0]=0,h[1]=1,h[2]=2,h[3]=3,h[4]=2,h[5]=1);var u=this._device.createBuffer(new ud(6,1,2*this._indexCount,2));u.update(h),this._insIndices=u,this._iaVertCount=this._vertCount,this._iaIndexCount=this._indexCount,this._insBuffers.push(t)},i.createInsSubmesh=function(){this._subMeshData=new sO(this._insBuffers,this._vertAttrs,7,this._insIndices),this.initSubModel(0,this._subMeshData,this._material)},i.updateMaterial=function(t){this._material=t,this.setSubModelMaterial(0,t)},i.addParticleVertexData=function(t,e){if(this._useInstance)this.addParticleVertexDataIns(t,e);else if(this._mesh)for(var i=0;i<this._vertCount;i++){var n=(t*this._vertCount+i)*this._vertAttrsFloatCount;this._vdataF32[n++]=e.position.x,this._vdataF32[n++]=e.position.y,this._vdataF32[n++]=e.position.z,n+=2,this._vdataF32[n++]=e.texcoord.z,this._vdataF32[n++]=e.size.x,this._vdataF32[n++]=e.size.y,this._vdataF32[n++]=e.size.z,this._vdataF32[n++]=e.rotation.x,this._vdataF32[n++]=e.rotation.y,this._vdataF32[n++]=e.rotation.z,this._vdataUint32[n++]=e.color}else{var r=t*this._vertAttrsFloatCount;this._vdataF32[r++]=e.position.x,this._vdataF32[r++]=e.position.y,this._vdataF32[r++]=e.position.z,this._vdataF32[r++]=e.texcoord.x,this._vdataF32[r++]=e.texcoord.y,this._vdataF32[r++]=e.texcoord.z,this._vdataF32[r++]=e.size.x,this._vdataF32[r++]=e.size.y,this._vdataF32[r++]=e.size.z,this._vdataF32[r++]=e.rotation.x,this._vdataF32[r++]=e.rotation.y,this._vdataF32[r++]=e.rotation.z,this._vdataUint32[r++]=e.color,e.velocity&&(this._vdataF32[r++]=e.velocity.x,this._vdataF32[r++]=e.velocity.y,this._vdataF32[r++]=e.velocity.z)}},i.addParticleVertexDataIns=function(t,e){var i=t*this._vertAttrsFloatCount;this._mesh?(this._vdataF32[i++]=e.position.x,this._vdataF32[i++]=e.position.y,this._vdataF32[i++]=e.position.z,this._vdataF32[i++]=e.texcoord.z,this._vdataF32[i++]=e.size.x,this._vdataF32[i++]=e.size.y,this._vdataF32[i++]=e.size.z,this._vdataF32[i++]=e.rotation.x,this._vdataF32[i++]=e.rotation.y,this._vdataF32[i++]=e.rotation.z,this._vdataUint32[i++]=e.color):(this._vdataF32[i++]=e.position.x,this._vdataF32[i++]=e.position.y,this._vdataF32[i++]=e.position.z,this._vdataF32[i++]=e.texcoord.z,this._vdataF32[i++]=e.size.x,this._vdataF32[i++]=e.size.y,this._vdataF32[i++]=e.size.z,this._vdataF32[i++]=e.rotation.x,this._vdataF32[i++]=e.rotation.y,this._vdataF32[i++]=e.rotation.z,this._vdataUint32[i++]=e.color,e.velocity&&(this._vdataF32[i++]=e.velocity.x,this._vdataF32[i++]=e.velocity.y,this._vdataF32[i++]=e.velocity.z))},i.addGPUParticleVertexData=function(t,e,i){if(this._useInstance)this.addGPUParticleVertexDataIns(t,e,i);else for(var n=e*this._vertAttrsFloatCount*this._vertCount,r=0;r<this._vertCount;r++){var s=n;this._vdataF32[s++]=t.position.x,this._vdataF32[s++]=t.position.y,this._vdataF32[s++]=t.position.z,this._vdataF32[s++]=i,this._vdataF32[s++]=t.startSize.x,this._vdataF32[s++]=t.startSize.y,this._vdataF32[s++]=t.startSize.z,this._vdataF32[s++]=Gdt[2*r],this._vdataF32[s++]=t.rotation.x,this._vdataF32[s++]=t.rotation.y,this._vdataF32[s++]=t.rotation.z,this._vdataF32[s++]=Gdt[2*r+1],this._vdataF32[s++]=t.startColor.r/255,this._vdataF32[s++]=t.startColor.g/255,this._vdataF32[s++]=t.startColor.b/255,this._vdataF32[s++]=t.startColor.a/255,this._vdataF32[s++]=t.velocity.x,this._vdataF32[s++]=t.velocity.y,this._vdataF32[s++]=t.velocity.z,this._vdataF32[s++]=t.startLifetime,this._vdataF32[s++]=t.randomSeed,n+=this._vertAttrsFloatCount}},i.addGPUParticleVertexDataIns=function(t,e,i){var n=e*this._vertAttrsFloatCount,r=n;this._vdataF32[r++]=t.position.x,this._vdataF32[r++]=t.position.y,this._vdataF32[r++]=t.position.z,this._vdataF32[r++]=i,this._vdataF32[r++]=t.startSize.x,this._vdataF32[r++]=t.startSize.y,this._vdataF32[r++]=t.startSize.z,this._vdataF32[r++]=t.frameIndex,this._vdataF32[r++]=t.rotation.x,this._vdataF32[r++]=t.rotation.y,this._vdataF32[r++]=t.rotation.z,this._vdataF32[r++]=t.startColor.r/255,this._vdataF32[r++]=t.startColor.g/255,this._vdataF32[r++]=t.startColor.b/255,this._vdataF32[r++]=t.startColor.a/255,this._vdataF32[r++]=t.velocity.x,this._vdataF32[r++]=t.velocity.y,this._vdataF32[r++]=t.velocity.z,this._vdataF32[r++]=t.startLifetime,this._vdataF32[r++]=t.randomSeed,n+=this._vertAttrsFloatCount},i.updateGPUParticles=function(t,e,i){if(this._useInstance)return this.updateGPUParticlesIns(t,e,i);for(var n=this._vertAttrsFloatCount*this._vertCount,r=0,s=0,a=0,o=0;o<t;++o)r=o*n,s=this._vdataF32[r+this._startTimeOffset],this._vdataF32[r+this._lifeTimeOffset]-(e-s)<i&&(a=--t*n,this._vdataF32.copyWithin(r,a,a+n),o--);return t},i.updateGPUParticlesIns=function(t,e,i){for(var n=this._vertAttrsFloatCount,r=0,s=0,a=0,o=0;o<t;++o)r=o*n,s=this._vdataF32[r+this._startTimeOffset],this._vdataF32[r+this._lifeTimeOffset]-(e-s)<i&&(a=--t*n,this._vdataF32.copyWithin(r,a,a+n),o--);return t},i.constructAttributeIndex=function(){if(this._vertAttrs){var t=this._vertAttrs.findIndex((function(t){return"a_position_starttime"===t.name})),e=this._vertAttrs[t].offset;this._startTimeOffset=e/4+3,t=this._vertAttrs.findIndex((function(t){return"a_dir_life"===t.name})),e=this._vertAttrs[t].offset,this._lifeTimeOffset=e/4+3}},i.updateIA=function(t){if(this._useInstance)this.updateIAIns(t);else{if(t<=0)return;var e=this._subModels[0].inputAssembler;e.vertexBuffers[0].update(this._vdataF32),e.firstIndex=0,e.indexCount=this._indexCount*t,e.vertexCount=this._iaVertCount}},i.updateIAIns=function(t){if(!(t<=0)){var e=this._subModels[0].inputAssembler;e.vertexBuffers[0].update(this._vdataF32),e.instanceCount=t,e.firstIndex=0,e.indexCount=this._indexCount,e.instanceCount=t,e.vertexCount=this._iaVertCount}},i.clear=function(){this._useInstance?this.clearIns():this._subModels[0].inputAssembler.indexCount=0},i.clearIns=function(){this._subModels[0].inputAssembler.instanceCount=0},i.destroy=function(){t.prototype.destroy.call(this),this.doDestroy()},i.doDestroy=function(){this._vBuffer=null,this._vdataF32=null,this._vdataUint32=null,this._insBuffers=[],this._insIndices=null,this._vertAttrs=null,this._material=null,this._mesh=null,this.destroySubMeshData()},i.rebuild=function(){this._useInstance?this.rebuildIns():(this._vBuffer=this.createSubMeshData(),this._vdataF32=new Float32Array(this._vBuffer),this._vdataUint32=new Uint32Array(this._vBuffer))},i.rebuildIns=function(){this._vBuffer=this.createSubMeshDataInsDynamic(),this._vdataF32=new Float32Array(this._vBuffer),this._vdataUint32=new Uint32Array(this._vBuffer),this.createSubMeshDataInsStatic(),this.createInsSubmesh()},i.destroySubMeshData=function(){this._subMeshData&&(this._subMeshData.destroy(),this._subMeshData=null)},n(e,[{key:"useInstance",get:function(){return this._useInstance},set:function(t){this._useInstance!==t&&(this._useInstance=t)}}]),e}(KM),jdt=function(){function t(t){this._particleSystem=null,this._model=null,this._renderInfo=null,this._vertAttrs=[],this._useInstance=void 0,this._renderInfo=t,Wp.gfxDevice.hasFeature(1)?this._useInstance=!0:this._useInstance=!1}var e=t.prototype;return e.getUseInstance=function(){return this._useInstance},e.getInfo=function(){return this._renderInfo},e.onInit=function(t){this._particleSystem=t},e.onEnable=function(){if(this._particleSystem){this.attachToScene();var t=this._model;t&&(t.node=t.transform=this._particleSystem.node)}},e.onDisable=function(){this.detachFromScene()},e.onDestroy=function(){this._model&&(A.director.root.destroyModel(this._model),this._model=null)},e.attachToScene=function(){var t;this._model&&(this._model.scene&&this.detachFromScene(),null==(t=this._particleSystem)||t._getRenderScene().addModel(this._model))},e.detachFromScene=function(){this._model&&this._model.scene&&this._model.scene.removeModel(this._model)},e.setVertexAttributes=function(){this._model&&(this.updateVertexAttrib(),this._model.setVertexAttributes(4===this._renderInfo.renderMode?this._renderInfo.mesh:null,this._vertAttrs))},e.clear=function(){this._model&&(this._model.enabled=!1)},e.getModel=function(){return this._model},e._initModel=function(){!this._model&&this._particleSystem&&(this._model=A.director.root.createModel(Wdt),this._model.setCapacity(this._particleSystem.capacity),this._model.visFlags=this._particleSystem.visibility)},e.updateTrailMaterial=function(){},e.getDefaultTrailMaterial=function(){return null},n(t,[{key:"model",get:function(){return this._model}}]),t}(),qdt=function(){function t(t){this.permutation=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180],this.accSpeed=new ir,this.noiseSpeed=new ir,this.noiseFrequency=0,this.noiseAbs=new ir,this.noiseAmplitude=new ir,this.octaves=new ir,this.dt=0,this.point=new ir,this.result=new ir,this.mixOut=new ds,t&&(this.permutation=t)}var e=t.prototype;return e.noise=function(t,e,i,n,r){void 0===n&&(n=0),void 0===r&&(r=1);for(var s=new Array(512),a=0;a<256;a++)s[256+a]=s[a]=this.permutation[a];var o=255&Math.floor(t),h=255&Math.floor(e),u=255&Math.floor(i);t-=Math.floor(t),e-=Math.floor(e),i-=Math.floor(i);var l=this.fade(t),c=this.fade(e),f=this.fade(i),_=s[o]+h,d=s[_]+u,p=s[_+1]+u,m=s[o+1]+h,g=s[m]+u,y=s[m+1]+u;return n+this.scale(this.lerp(f,this.lerp(c,this.lerp(l,this.grad(s[d],t,e,i),this.grad(s[g],t-1,e,i)),this.lerp(l,this.grad(s[p],t,e-1,i),this.grad(s[y],t-1,e-1,i))),this.lerp(c,this.lerp(l,this.grad(s[d+1],t,e,i-1),this.grad(s[g+1],t-1,e,i-1)),this.lerp(l,this.grad(s[p+1],t,e-1,i-1),this.grad(s[y+1],t-1,e-1,i-1)))))*(r-n)},e.fade=function(t){return t*t*t*(t*(6*t-15)+10)},e.lerp=function(t,e,i){return e+t*(i-e)},e.grad=function(t,e,i,n){var r=15&t,s=r<8?e:i,a=r<4?i:12===r||14===r?e:n;return(1&r?-s:s)+(2&r?-a:a)},e.scale=function(t){return(1+t)/2},e.setSpeed=function(t,e,i){this.noiseSpeed.set(t,e,i)},e.setFrequency=function(t){this.noiseFrequency=t},e.setAbs=function(t,e,i){this.noiseAbs.set(t,e,i)},e.setAmplititude=function(t,e,i){this.noiseAmplitude.set(t,e,i)},e.setOctaves=function(t,e,i){this.octaves.set(t,e,i)},e.setTime=function(t){this.dt=t},e.setSamplePoint=function(t){this.point.set(t)},e.getResult=function(){return this.result},e.getNoise=function(t,e,i,n,r,s,a){var o=s,h=0;if(h+=this.noise(t*o,e*o,i*o,-1,1),1===a.x)return h;for(var u=1,l=1,c=1;c<a.x;++c)u*=a.y,o*=a.z,l+=u,h+=this.noise(t*o,e*o,i*o,-1,1)*u;return h/l},e.getNoiseMix=function(t,e,i,n,r,s){t.x=this.getNoise(e.x,e.y,e.z,i,n,r,s),t.y=this.getNoise(e.y,e.z,e.x,i,n,r,s)},e.getNoiseParticle=function(){this.accSpeed.set(this.noiseSpeed.x*this.dt,this.noiseSpeed.y*this.dt,this.noiseSpeed.z*this.dt);var t=this.getNoise(this.point.z+this.accSpeed.x,this.point.y,this.point.x,this.dt,this.accSpeed,this.noiseFrequency,this.octaves),e=this.getNoise(this.point.x+1e3,this.point.z+this.accSpeed.y,this.point.y,this.dt,this.accSpeed,this.noiseFrequency,this.octaves),i=this.getNoise(this.point.y,this.point.x+1e3,this.point.z+this.accSpeed.z,this.dt,this.accSpeed,this.noiseFrequency,this.octaves);this.result.set(t*this.noiseAmplitude.x,e*this.noiseAmplitude.y,i*this.noiseAmplitude.z)},e.getPreview=function(t,e,i){for(var n=0;n<i;++n)for(var r=0;r<e;++r){var s=(r-.5*e)/e+this.noiseSpeed.x*this.dt,a=(n-.5*i)/i+this.noiseSpeed.y*this.dt,o=this.getNoise(s,a,0,this.dt,this.accSpeed,this.noiseFrequency,this.octaves);t[n*e+r]=.5*(o+1)}},t}(),Xdt=new Vn,Ydt=nr(),Jdt=new Kr,Kdt=new Kr,Qdt=new kr,Zdt=["_colorOverLifetimeModule","_sizeOvertimeModule","_velocityOvertimeModule","_forceOvertimeModule","_limitVelocityOvertimeModule","_rotationOvertimeModule","_textureAnimationModule","_noiseModule"],$dt=[0,0,1,0,0,1,1,1],tpt="CC_USE_WORLD_SPACE",ept="CC_RENDER_MODE",ipt="a_position",npt="a_normal",rpt="a_color",spt="a_color1",apt="a_texCoord",opt="a_texCoord1",hpt="a_texCoord2",upt="a_texCoord3",lpt="a_texCoord4";function cpt(t,e,i,n,r,s){return void 0===i&&(i=!1),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=0),new Cd(t,e,i,n,r,s)}var fpt=[cpt(ipt,32),cpt(apt,32),cpt(opt,32),cpt(hpt,32),cpt(rpt,35,!0)],_pt=[cpt(ipt,32),cpt(apt,32),cpt(opt,32),cpt(hpt,32),cpt(rpt,35,!0),cpt(spt,32)],dpt=[cpt(ipt,32),cpt(apt,32),cpt(opt,32),cpt(hpt,32),cpt(rpt,35,!0),cpt(upt,32),cpt(npt,32),cpt(spt,35,!0)],ppt=[cpt(lpt,44,!1,0,!0),cpt(opt,32,!1,0,!0),cpt(hpt,32,!1,0,!0),cpt(rpt,35,!0,0,!0),cpt(apt,32,!1,1)],mpt=[cpt(lpt,44,!1,0,!0),cpt(opt,32,!1,0,!0),cpt(hpt,32,!1,0,!0),cpt(rpt,35,!0,0,!0),cpt(spt,32,!1,0,!0),cpt(apt,32,!1,1)],gpt=[cpt(lpt,44,!1,0,!0),cpt(opt,32,!1,0,!0),cpt(hpt,32,!1,0,!0),cpt(rpt,35,!0,0,!0),cpt(apt,32,!1,1),cpt(upt,32,!1,1),cpt(npt,32,!1,1),cpt(spt,35,!0,1)],ypt={parent:null,owner:null,subModelIdx:0},vpt=function(){this.position=void 0,this.texcoord=void 0,this.size=void 0,this.rotation=void 0,this.color=void 0,this.velocity=void 0,this.position=nr(),this.texcoord=nr(),this.size=nr(),this.rotation=nr(),this.color=0,this.velocity=null},bpt=function(t){function e(e){var i;return(i=t.call(this,e)||this)._defines=void 0,i._trailDefines=void 0,i._frameTile_velLenScale=void 0,i._tmp_velLenScale=void 0,i._defaultMat=null,i._node_scale=void 0,i._particleVertexData=void 0,i._particles=null,i._defaultTrailMat=null,i._updateList=new Map,i._animateList=new Map,i._runAnimateList=[],i._fillDataFunc=null,i._uScaleHandle=0,i._uLenHandle=0,i._uNodeRotHandle=0,i._alignSpace=2,i._inited=!1,i._localMat=new Kr,i._gravity=new Vn,i.noise=new qdt,i._model=null,i._frameTile_velLenScale=new Vn(1,1,0,0),i._tmp_velLenScale=i._frameTile_velLenScale.clone(),i._node_scale=nr(),i._particleVertexData=new vpt,i._defines={CC_USE_WORLD_SPACE:!0,CC_USE_BILLBOARD:!0,CC_USE_STRETCHED_BILLBOARD:!1,CC_USE_HORIZONTAL_BILLBOARD:!1,CC_USE_VERTICAL_BILLBOARD:!1},i._trailDefines={CC_USE_WORLD_SPACE:!0},i}s(e,t);var i=e.prototype;return i.onInit=function(e){var i=this;t.prototype.onInit.call(this,e),this._particles=new uo((function(){return new vct(i)}),16),this._setVertexAttrib(),this._setFillFunc(),this._initModuleList(),this._initModel(),this.updateMaterialParams(),this.updateTrailMaterial(),this.setVertexAttributes(),this._inited=!0},i.clear=function(){t.prototype.clear.call(this),this._particles.reset(),this._particleSystem&&this._particleSystem._trailModule&&this._particleSystem._trailModule.clear(),this.updateRenderData(),this._model.enabled=!1},i.updateRenderMode=function(){this._setVertexAttrib(),this._setFillFunc(),this.updateMaterialParams(),this.setVertexAttributes()},i.onDestroy=function(){var e;null==(e=this._particles)||e.destroy(),t.prototype.onDestroy.call(this)},i.getFreeParticle=function(){return this._particleSystem&&this._particles.length>=this._particleSystem.capacity?null:this._particles.add()},i.getDefaultTrailMaterial=function(){return this._defaultTrailMat},i.setNewParticle=function(){},i._initModuleList=function(){var t=this;Zdt.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=Dct.length;e<i;e++){var n=this._animateList.get(Dct[e]);n&&this._runAnimateList.push(n)}},i.enableModule=function(t,e,i){e?(i.needUpdate&&this._updateList.set(i.name,i),i.needAnimate&&this._animateList.set(i.name,i)):(this._animateList.delete(t),this._updateList.delete(t)),this._runAnimateList.length=0;for(var n=0,r=Dct.length;n<r;n++){var s=this._animateList.get(Dct[n]);s&&this._runAnimateList.push(s)}this.updateMaterialParams()},i.updateAlignSpace=function(t){this._alignSpace=t},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(Qdt);else if(0===this._alignSpace){var i;null==(i=this._particleSystem)||i.node.getWorldRotation(Qdt)}else if(2===this._alignSpace){var n,r;Qdt.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)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(Qdt,o.forward);break}}}else Qdt.set(0,0,0,1);t.setUniform(this._uNodeRotHandle,Qdt)}},i.updateScale=function(t){t&&this.doUpdateScale(t)},i.doUpdateScale=function(t){var e,i,n,r=this._node_scale;switch(null==(e=this._particleSystem)?void 0:e.scaleSpace){case 1:null==(i=this._particleSystem)||i.node.getScale(r);break;case 0:null==(n=this._particleSystem)||n.node.getWorldScale(r)}t.setUniform(this._uScaleHandle,Xdt.set(r.x,r.y,r.z))},i.updateParticles=function(t){var e=this,i=this._particleSystem;if(!i)return this._particles.length;i.node.getWorldMatrix(Jdt);var n=(i.getMaterialInstance(0)||this._defaultMat).passes[0];this.doUpdateScale(n),this.doUpdateRotation(n),this._updateList.forEach((function(){}));var r=i._trailModule,s=r&&r.enable;s&&r.update();var a=!i.gravityModifier.isZero();if(a){if(1===i.simulationSpace){var o=i.node.getRotation();Kr.fromQuat(this._localMat,o),this._localMat.transpose()}if(i.node.parent){var h=i.node.parent.worldRotation;Kr.fromQuat(Kdt,h),Kdt.transpose()}}for(var u=function(n){var o=e._particles.data[n];if(o.remainingLifetime-=t,ir.set(o.animatedVelocity,0,0,0),o.remainingLifetime<0)return s&&r.removeParticle(o),e._particles.removeAt(n),--n,l=n,1;if(a){var h=Vct(i.gravityModifier)?un(o.randomSeed):0;if(1===i.simulationSpace){var u=1-o.remainingLifetime/o.startLifetime,c=9.8*-i.gravityModifier.evaluate(u,h)*t;e._gravity.x=0,e._gravity.y=c,e._gravity.z=0,e._gravity.w=1,Zi(c,0,Ki)||(i.node.parent&&(e._gravity=e._gravity.transformMat4(Kdt)),e._gravity=e._gravity.transformMat4(e._localMat),o.velocity.x+=e._gravity.x,o.velocity.y+=e._gravity.y,o.velocity.z+=e._gravity.z)}else o.velocity.y-=9.8*i.gravityModifier.evaluate(1-o.remainingLifetime/o.startLifetime,h)*t}ir.copy(o.ultimateVelocity,o.velocity),e._runAnimateList.forEach((function(e){e.animate(o,t)})),ir.scaleAndAdd(o.position,o.position,o.ultimateVelocity,t),s&&r.animate(o,t),l=n},l=0;l<this._particles.length;++l)u(l);return this._model.enabled=this._particles.length>0,this._particles.length},i.getNoisePreview=function(t,e,i){var n=this;this._runAnimateList.forEach((function(r){r.name===Cct&&r.getNoisePreview(t,n._particleSystem,e,i)}))},i.updateRenderData=function(){for(var t=0,e=0;e<this._particles.length;++e){var i=this._particles.data[e],n=0,r=this._particleSystem._textureAnimationModule;r&&r.enable&&(n=i.frameIndex),t=4*e,this._fillDataFunc(i,t,n)}},i.beforeRender=function(){this._model.updateIA(this._particles.length)},i.getParticleCount=function(){return this._particles.length},i.onMaterialModified=function(t){this._inited&&(0===t?this.updateMaterialParams():this.updateTrailMaterial())},i.onRebuildPSO=function(t,e){this._model&&0===t&&this._model.setSubModelMaterial(0,e);var i=this._particleSystem._trailModule,n=null==i?void 0:i.getModel();n&&1===t&&n.setSubModelMaterial(0,e)},i._setFillFunc=function(){4===this._renderInfo.renderMode?this._fillDataFunc=this._fillMeshData:1===this._renderInfo.renderMode?this._fillDataFunc=this._fillStrecthedData:this._fillDataFunc=this._fillNormalData},i._fillMeshData=function(t,e,i){var n=this._particleVertexData,r=e/4;ir.copy(n.position,t.position),Ydt.z=i,ir.copy(n.texcoord,Ydt),ir.copy(n.size,t.size),ir.copy(n.rotation,t.rotation),n.color=cr.toUint32(t.color),this._model.addParticleVertexData(r,n)},i._fillStrecthedData=function(t,e,i){var n=this._particleVertexData;if(this._useInstance)this._fillStrecthedDataIns(t,e,i);else for(var r=0;r<4;++r)ir.copy(n.position,t.position),Ydt.x=$dt[2*r],Ydt.y=$dt[2*r+1],Ydt.z=i,ir.copy(n.texcoord,Ydt),ir.copy(n.size,t.size),ir.copy(n.rotation,t.rotation),n.color=cr.toUint32(t.color),n.velocity=t.ultimateVelocity,this._model.addParticleVertexData(e++,n)},i._fillStrecthedDataIns=function(t,e,i){var n=this._particleVertexData,r=e/4;ir.copy(n.position,t.position),Ydt.z=i,ir.copy(n.texcoord,Ydt),ir.copy(n.size,t.size),ir.copy(n.rotation,t.rotation),n.color=cr.toUint32(t.color),n.velocity=t.ultimateVelocity,this._model.addParticleVertexData(r,n)},i._fillNormalData=function(t,e,i){var n=this._particleVertexData;if(this._useInstance)this._fillNormalDataIns(t,e,i);else for(var r=0;r<4;++r)ir.copy(n.position,t.position),Ydt.x=$dt[2*r],Ydt.y=$dt[2*r+1],Ydt.z=i,ir.copy(n.texcoord,Ydt),ir.copy(n.size,t.size),ir.copy(n.rotation,t.rotation),this._particleVertexData.color=cr.toUint32(t.color),this._model.addParticleVertexData(e++,n)},i._fillNormalDataIns=function(t,e,i){var n=this._particleVertexData,r=e/4;ir.copy(n.position,t.position),Ydt.z=i,ir.copy(n.texcoord,Ydt),ir.copy(n.size,t.size),ir.copy(n.rotation,t.rotation),this._particleVertexData.color=cr.toUint32(t.color),this._model.addParticleVertexData(r,n)},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<ip.length;++i)if(ip[i].name===t.name){e=i;break}this._vertAttrs[7]=cpt(spt,e,!0,this._useInstance?1:0)}else this._vertAttrs[7]=cpt(spt,35,!0,this._useInstance?1:0)}},i._setVertexAttrib=function(){if(this._useInstance)this._setVertexAttribIns();else switch(this._renderInfo.renderMode){case 1:this._vertAttrs=_pt.slice();break;case 4:this._vertAttrs=dpt.slice();break;default:this._vertAttrs=fpt.slice()}},i._setVertexAttribIns=function(){switch(this._renderInfo.renderMode){case 1:this._vertAttrs=mpt.slice();break;case 4:this._vertAttrs=gpt.slice();break;default:this._vertAttrs=ppt.slice()}},i.updateMaterialParams=function(){if(this._particleSystem){var t=this._particleSystem,e=t.sharedMaterial;null!=e&&(this._renderInfo.mainTexture=e.getProperty("mainTexture",0)),null==t.sharedMaterial&&null==this._defaultMat&&(ypt.parent=mT.get("default-particle-material"),ypt.owner=this._particleSystem,ypt.subModelIdx=0,this._defaultMat=new QT(ypt),ypt.parent=null,ypt.owner=null,ypt.subModelIdx=0,null!==this._renderInfo.mainTexture&&this._defaultMat.setProperty("mainTexture",this._renderInfo.mainTexture));var i=t.getMaterialInstance(0)||this._defaultMat;0===t.simulationSpace?this._defines[tpt]=!0:this._defines[tpt]=!1;var n=i.passes[0];this._uScaleHandle=n.getHandle("scale"),this._uLenHandle=n.getHandle("frameTile_velLenScale"),this._uNodeRotHandle=n.getHandle("nodeRotation");var r=this._renderInfo.renderMode,s=this._frameTile_velLenScale;0===r?this._defines[ept]=0:1===r?(this._defines[ept]=1,s.z=this._renderInfo.velocityScale,s.w=this._renderInfo.lengthScale):2===r?this._defines[ept]=2:3===r?this._defines[ept]=3:4===r?this._defines[ept]=4:Y("particle system renderMode "+r+" not support.");var a=t._textureAnimationModule;a&&a.enable?(Vn.copy(this._tmp_velLenScale,s),ds.set(this._tmp_velLenScale,a.numTilesX,a.numTilesY),n.setUniform(this._uLenHandle,this._tmp_velLenScale)):n.setUniform(this._uLenHandle,s);var o,h=this._particleSystem._rotationOvertimeModule;o=!!h&&h.enable,this._defines.ROTATION_OVER_TIME_MODULE_ENABLE=o,this._defines.CC_INSTANCE_PARTICLE=this._useInstance,i.recompileShaders(this._defines),this._model&&this._model.updateMaterial(i)}},i.updateTrailMaterial=function(){if(this._particleSystem){var t=this._particleSystem,e=t._trailModule;if(e&&e.enable){0===t.simulationSpace||0===e.space?this._trailDefines[tpt]=!0:this._trailDefines[tpt]=!1;var i=t.getMaterialInstance(1);null===i&&null===this._defaultTrailMat&&(ypt.parent=mT.get("default-trail-material"),ypt.owner=this._particleSystem,ypt.subModelIdx=1,this._defaultTrailMat=new QT(ypt),ypt.parent=null,ypt.owner=null,ypt.subModelIdx=0),(i=i||this._defaultTrailMat).recompileShaders(this._trailDefines),e.updateMaterial()}}},i.setUseInstance=function(t){this._useInstance!==t&&(this._useInstance=t,this._model&&(this._model.useInstance=t,this._model.doDestroy()),this.updateRenderMode())},e}(jdt),Spt=new Vn,wpt=new Kr,xpt=new Vn,Tpt=new kr,Apt=new kr;new ir;var Cpt,Dpt,Bpt,Ipt,Mpt,Ppt,Ept,Opt,kpt,Rpt,Fpt,Lpt,Vpt,Npt,zpt,Upt,Gpt,Hpt,Wpt,jpt,qpt,Xpt=32,Ypt="CC_USE_WORLD_SPACE",Jpt="CC_RENDER_MODE",Kpt="a_position_starttime",Qpt="a_size_uv",Zpt="a_rotation_uv",$pt="a_color",tmt="a_dir_life",emt="a_rndSeed",imt="a_size_fid",nmt="a_rotation",rmt=[new Cd(Kpt,44),new Cd(Qpt,44),new Cd(Zpt,44),new Cd($pt,44),new Cd(tmt,44),new Cd(emt,11)],smt=[new Cd(Kpt,44),new Cd(Qpt,44),new Cd(Zpt,44),new Cd($pt,44),new Cd(tmt,44),new Cd(emt,11),new Cd("a_texCoord",32),new Cd("a_texCoord3",32),new Cd("a_normal",32),new Cd("a_color1",35,!0)],amt=[new Cd(Kpt,44,!1,0,!0),new Cd(imt,44,!1,0,!0),new Cd(nmt,32,!1,0,!0),new Cd($pt,44,!1,0,!0),new Cd(tmt,44,!1,0,!0),new Cd(emt,11,!1,0,!0),new Cd("a_uv",32,!1,1)],omt=[new Cd(Kpt,44,!1,0,!0),new Cd(imt,44,!1,0,!0),new Cd(nmt,32,!1,0,!0),new Cd($pt,44,!1,0,!0),new Cd(tmt,44,!1,0,!0),new Cd(emt,11,!1,0,!0),new Cd("a_texCoord",32,!1,1),new Cd("a_texCoord3",32,!1,1),new Cd("a_normal",32,!1,1),new Cd("a_color1",35,!0,1)],hmt={parent:null,owner:null,subModelIdx:0},umt=function(t){function e(e){var i;return(i=t.call(this,e)||this)._defines=void 0,i._frameTile_velLenScale=void 0,i._unifrom_velLenScale=void 0,i._tmp_velLenScale=void 0,i._node_scale=void 0,i._vertAttrs=[],i._defaultMat=null,i._particleNum=0,i._tempParticle=null,i._colorTexture=null,i._forceTexture=null,i._velocityTexture=null,i._rotationTexture=null,i._sizeTexture=null,i._animTexture=null,i._colorData=null,i._forceData=null,i._velocityData=null,i._rotationData=null,i._sizeData=null,i._animData=null,i._uTimeHandle=0,i._uRotHandle=0,i._uNodeRotHandle=0,i._alignSpace=2,i._inited=!1,i._frameTile_velLenScale=new Vn(1,1,0,0),i._unifrom_velLenScale=i._frameTile_velLenScale.clone(),i._tmp_velLenScale=i._frameTile_velLenScale.clone(),i._node_scale=new ir,i._defines={CC_USE_WORLD_SPACE:!0,CC_USE_BILLBOARD:!0,CC_USE_STRETCHED_BILLBOARD:!1,CC_USE_HORIZONTAL_BILLBOARD:!1,CC_USE_VERTICAL_BILLBOARD:!1,COLOR_OVER_TIME_MODULE_ENABLE:!1},i._tempParticle=new vct(null),i._particleNum=0,i}s(e,t);var i=e.prototype;return i.onInit=function(e){t.prototype.onInit.call(this,e),this._setVertexAttrib(),this._initModel(),this.updateMaterialParams(),this.setVertexAttributes(),this._inited=!0},i.updateRenderMode=function(){this._setVertexAttrib(),this.updateMaterialParams(),this.setVertexAttributes()},i.setVertexAttributes=function(){t.prototype.setVertexAttributes.call(this),this._model.constructAttributeIndex()},i.clear=function(){t.prototype.clear.call(this),this._particleNum=0,this.updateRenderData()},i.onDestroy=function(){t.prototype.onDestroy.call(this),this._forceTexture&&this._forceTexture.destroy(),this._velocityTexture&&this._velocityTexture.destroy(),this._colorTexture&&this._colorTexture.destroy(),this._sizeTexture&&this._sizeTexture.destroy(),this._rotationTexture&&this._rotationTexture.destroy(),this._animTexture&&this._animTexture.destroy(),this._forceData=null,this._velocityData=null,this._colorData=null,this._sizeData=null,this._rotationData=null,this._animData=null},i.enableModule=function(){var t,e=(null==(t=this._particleSystem)?void 0:t.getMaterialInstance(0))||this._defaultMat;e&&(this.initShaderUniform(e),e.recompileShaders(this._defines),this._model&&this._model.setSubModelMaterial(0,e))},i.getFreeParticle=function(){var t;return this._particleSystem&&this._particleNum>=(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(Apt);else if(0===this._alignSpace){var i;null==(i=this._particleSystem)||i.node.getWorldRotation(Apt)}else if(2===this._alignSpace){var n,r;Apt.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(Apt,o.forward);break}}}else Apt.set(0,0,0,1);t.setUniform(this._uNodeRotHandle,Apt)}},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"),Spt.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];xpt.x=this._particleSystem.time,xpt.y=t,i.setUniform(this._uTimeHandle,xpt),this._particleSystem.node.getWorldRotation(Tpt),i.setUniform(this._uRotHandle,Tpt),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),xpt.x=Xpt,xpt.y=.03125,o.setUniform(o.getHandle("u_sampleInfo"),xpt);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=Ult(this._forceTexture,this._forceData,Xpt,u.x,u.y,u.z);this._forceTexture=l.texture,this._forceData=l.texdata;var c=o.getHandle("force_over_time_tex0"),f=ZS(c);o.bindSampler(f,this._forceTexture.getGFXSampler()),o.bindTexture(f,this._forceTexture.getGFXTexture());var _=o.getHandle("u_force_space");o.setUniform(_,u.space);var d=o.getHandle("u_force_mode");o.setUniform(d,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=Glt(this._velocityTexture,this._velocityData,Xpt,p.x,p.y,p.z,p.speedModifier);this._velocityTexture=m.texture,this._velocityData=m.texdata;var g=o.getHandle("velocity_over_time_tex0"),y=ZS(g);o.bindSampler(y,this._velocityTexture.getGFXSampler()),o.bindTexture(y,this._velocityTexture.getGFXTexture());var v=o.getHandle("u_velocity_space");o.setUniform(v,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 w=pct(this._colorTexture,this._colorData,Xpt,S.color);this._colorTexture=w.texture,this._colorData=w.texdata;var x=o.getHandle("color_over_time_tex0"),T=ZS(x);o.bindSampler(T,this._colorTexture.getGFXSampler()),o.bindTexture(T,this._colorTexture.getGFXTexture());var A=o.getHandle("u_color_mode");o.setUniform(A,this._colorTexture.height)}var C,D=null==(r=this._particleSystem)?void 0:r._rotationOvertimeModule;if(h=!!D&&D.enable,this._defines.ROTATION_OVER_TIME_MODULE_ENABLE=h,h&&(C=D.separateAxes?Ult(this._rotationTexture,this._rotationData,Xpt,D.x,D.y,D.z):Vlt(this._rotationTexture,this._rotationData,Xpt,D.z),this._rotationTexture=C.texture,this._rotationData=C.texdata,this._rotationTexture)){var B=o.getHandle("rotation_over_time_tex0"),I=ZS(B);o.bindSampler(I,this._rotationTexture.getGFXSampler()),o.bindTexture(I,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?Ult(this._sizeTexture,this._sizeData,Xpt,E.x,E.y,E.z,!0):Nlt(this._sizeTexture,this._sizeData,Xpt,E.size),this._sizeTexture=P.texture,this._sizeData=P.texdata,this._sizeTexture)){var O=o.getHandle("size_over_time_tex0"),k=ZS(O);o.bindSampler(k,this._sizeTexture.getGFXSampler()),o.bindTexture(k,this._sizeTexture.getGFXTexture());var R=o.getHandle("u_size_mode");o.setUniform(R,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=zlt(this._animTexture,this._animData,Xpt,F.startFrame,F.frameOverTime);this._animTexture=L.texture,this._animData=L.texdata;var V=o.getHandle("texture_animation_tex0"),N=ZS(V);o.bindSampler(N,this._animTexture.getGFXSampler()),o.bindTexture(N,this._animTexture.getGFXTexture());var z=o.getHandle("u_anim_info");xpt.x=this._animTexture.height,xpt.y=F.numTilesX*F.numTilesY,xpt.z=F.cycleCount,o.setUniform(z,xpt)}this._defines.USE_VK_SHADER=4===Wp.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<ip.length;++i)if(ip[i].name===t.name){e=i;break}this._vertAttrs[9]=new Cd("a_color1",e,!0,this._useInstance?1:0)}else this._vertAttrs[9]=new Cd("a_color1",35,!0,this._useInstance?1:0)}},i._setVertexAttrib=function(){if(this._useInstance)this._setVertexAttribIns();else switch(this._renderInfo.renderMode){case 1:default:this._vertAttrs=rmt.slice();break;case 4:this._vertAttrs=smt.slice()}},i._setVertexAttribIns=function(){switch(this._renderInfo.renderMode){case 1:default:this._vertAttrs=amt.slice();break;case 4:this._vertAttrs=omt.slice()}},i.updateMaterialParams=function(){if(this._particleSystem){var t=this._particleSystem,e=t.sharedMaterial;null!==e&&(this._renderInfo.mainTexture=e.getProperty("mainTexture",0)),null==t.sharedMaterial&&null==this._defaultMat&&(hmt.parent=mT.get("default-particle-gpu-material"),hmt.owner=t,hmt.subModelIdx=0,this._defaultMat=new QT(hmt),hmt.parent=null,hmt.owner=null,hmt.subModelIdx=0,null!==this._renderInfo.mainTexture&&this._defaultMat.setProperty("mainTexture",this._renderInfo.mainTexture));var i=t.getMaterialInstance(0)||this._defaultMat;t.node.getWorldMatrix(wpt),0===t.simulationSpace?this._defines[Ypt]=!0:this._defines[Ypt]=!1;var n=this._renderInfo.renderMode;0===n?this._defines[Jpt]=0:1===n?(this._defines[Jpt]=1,this._frameTile_velLenScale.z=this._renderInfo.velocityScale,this._frameTile_velLenScale.w=this._renderInfo.lengthScale):2===n?this._defines[Jpt]=2:3===n?this._defines[Jpt]=3:4===n?this._defines[Jpt]=4:Y("particle system renderMode "+n+" not support.");var r=t._textureAnimationModule;r&&r.enable?(ds.set(this._frameTile_velLenScale,r.numTilesX,r.numTilesY),Vn.copy(this._unifrom_velLenScale,this._frameTile_velLenScale)):(this._tmp_velLenScale.z=this._frameTile_velLenScale.z,this._tmp_velLenScale.w=this._frameTile_velLenScale.w,Vn.copy(this._unifrom_velLenScale,this._tmp_velLenScale)),this.initShaderUniform(i),i.recompileShaders(this._defines),this._model&&this._model.updateMaterial(i)}},i.setUseInstance=function(t){this._useInstance!==t&&(this._useInstance=t,this._model&&(this._model.useInstance=t,this._model.doDestroy()),this.updateRenderMode())},i.getNoisePreview=function(){},e}(jdt);function lmt(){var t=YE.root.device;return!!(t.capabilities.maxVertexTextureUnits>=8&&3&t.getFormatFeatures(44))||(A.warn("Maybe the device has restrictions on vertex textures or does not support float textures."),!1)}var cmt,fmt,_mt,dmt,pmt,mmt,gmt,ymt,vmt,bmt,Smt,wmt,xmt,Tmt,Amt,Cmt,Dmt,Bmt,Imt,Mmt,Pmt,Emt,Omt,kmt,Rmt,Fmt,Lmt,Vmt,Nmt,zmt,Umt,Gmt,Hmt,Wmt,jmt,qmt,Xmt,Ymt,Jmt,Kmt,Qmt,Zmt,$mt,tgt,egt,igt,ngt,rgt,sgt,agt,ogt,hgt,ugt,lgt,cgt,fgt,_gt,dgt,pgt,mgt,ggt,ygt,vgt,bgt,Sgt,wgt,xgt,Tgt,Agt,Cgt,Dgt,Bgt,Igt,Mgt,Pgt,Egt,Ogt,kgt,Rgt,Fgt,Lgt,Vgt,Ngt,zgt,Ugt,Ggt,Hgt,Wgt,jgt,qgt,Xgt,Ygt,Jgt,Kgt,Qgt,Zgt,$gt,tyt,eyt,iyt,nyt,ryt,syt,ayt,oyt,hyt,uyt,lyt,cyt,fyt,_yt,dyt,pyt,myt,gyt,yyt,vyt,byt,Syt,wyt,xyt,Tyt,Ayt,Cyt,Dyt,Byt,Iyt,Myt,Pyt,Eyt,Oyt,kyt,Ryt,Fyt,Lyt,Vyt,Nyt,zyt,Uyt,Gyt,Hyt,Wyt,jyt,qyt,Xyt,Yyt=(Cpt=Kh("cc.ParticleSystemRenderer"),Dpt=Ou(Wct),Bpt=Ou(Wct),Ipt=Ou(Pk),Mpt=Ou(GT),Ppt=Ou(GT),Ept=Ou(GT),Opt=Ou(GT),kpt=Ou(Hct),Cpt((qpt=function(){function t(){this._renderMode=Lpt&&Lpt(),this._velocityScale=Vpt&&Vpt(),this._lengthScale=Npt&&Npt(),this._mesh=zpt&&zpt(),this._cpuMaterial=Upt&&Upt(),this._gpuMaterial=Gpt&&Gpt(),this._mainTexture=Hpt&&Hpt(),this._useGPU=Wpt&&Wpt(),this._alignSpace=jpt&&jpt(),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&&lmt();this._particleSystem.processor?ht(6034):(this._particleSystem.processor=e?new umt(this):new bpt(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&&lmt();this.particleMaterial=t?this.gpuMaterial:this.cpuMaterial,this._particleSystem.processor=t?new umt(this):new bpt(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&&(lmt()?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}(),qpt.AlignmentSpace=Hct,v((Fpt=qpt).prototype,"renderMode",[Dpt],Object.getOwnPropertyDescriptor(Fpt.prototype,"renderMode"),Fpt.prototype),Lpt=zh(Fpt.prototype,"_renderMode",[Bpt,uu],(function(){return 0})),Vpt=zh(Fpt.prototype,"_velocityScale",[uu],(function(){return 1})),Npt=zh(Fpt.prototype,"_lengthScale",[uu],(function(){return 1})),zpt=zh(Fpt.prototype,"_mesh",[uu],(function(){return null})),v(Fpt.prototype,"mesh",[Ipt],Object.getOwnPropertyDescriptor(Fpt.prototype,"mesh"),Fpt.prototype),v(Fpt.prototype,"particleMaterial",[Mpt],Object.getOwnPropertyDescriptor(Fpt.prototype,"particleMaterial"),Fpt.prototype),v(Fpt.prototype,"cpuMaterial",[Ppt],Object.getOwnPropertyDescriptor(Fpt.prototype,"cpuMaterial"),Fpt.prototype),Upt=zh(Fpt.prototype,"_cpuMaterial",[uu],(function(){return null})),v(Fpt.prototype,"gpuMaterial",[Ept],Object.getOwnPropertyDescriptor(Fpt.prototype,"gpuMaterial"),Fpt.prototype),Gpt=zh(Fpt.prototype,"_gpuMaterial",[uu],(function(){return null})),v(Fpt.prototype,"trailMaterial",[Opt],Object.getOwnPropertyDescriptor(Fpt.prototype,"trailMaterial"),Fpt.prototype),Hpt=zh(Fpt.prototype,"_mainTexture",[uu],(function(){return null})),Wpt=zh(Fpt.prototype,"_useGPU",[uu],(function(){return!1})),v(Fpt.prototype,"alignSpace",[kpt],Object.getOwnPropertyDescriptor(Fpt.prototype,"alignSpace"),Fpt.prototype),jpt=zh(Fpt.prototype,"_alignSpace",[uu],(function(){return 2})),Rpt=Fpt))||Rpt),Jyt=Math.cos(nn(100)),Kyt={position:new ir,velocity:new ir},Qyt=new kr,Zyt=new ir,$yt=new ir,tvt=new cr,evt=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;s<r;s++)e(t,this.trailElements[s%this.trailElements.length],i,n)&&(this.start++,this.start%=this.trailElements.length);this.start===r&&(this.start=-1,this.end=-1)},e.count=function(){return this.start<this.end?this.end-this.start:this.trailElements.length+this.end-this.start},e.clear=function(){this.start=-1,this.end=-1},t}(),ivt=(cmt=Kh("cc.TrailModule"),fmt=Ou(Yct),_mt=Ou(Olt),dmt=Ou(Uct),pmt=Ou(oft),mmt=Ou(Olt),gmt=Ou(fct),ymt=Ou(fct),vmt=Ou(Uct),cmt((Smt=function(){var t=e.prototype;function e(){this._enable=wmt&&wmt(),this.mode=xmt&&xmt(),this.lifeTime=Tmt&&Tmt(),this._minParticleDistance=Amt&&Amt(),this.existWithParticles=Cmt&&Cmt(),this.textureMode=Dmt&&Dmt(),this.widthFromParticle=Bmt&&Bmt(),this.widthRatio=Imt&&Imt(),this.colorFromParticle=Mmt&&Mmt(),this.colorOverTrail=Pmt&&Pmt(),this.colorOvertime=Emt&&Emt(),this._space=Omt&&Omt(),this._particleSystem=kmt&&kmt(),this._minSquaredDistance=0,this._vertSize=void 0,this._trailNum=0,this._trailLifetime=0,this.vbOffset=0,this.ibOffset=0,this._trailSegments=null,this._particleTrail=void 0,this._trailModel=null,this._subMeshData=null,this._vertAttrs=void 0,this._vbF32=null,this._vbUint32=null,this._iBuffer=null,this._needTransform=!1,this._material=null,this._psTransform=new Kr,this._iaVertCount=0,this._iaIndexCount=0,this._vertAttrs=[new Cd("a_position",32),new Cd("a_texCoord",44),new Cd("a_texCoord1",32),new Cd("a_color",35,!0)],this._vertSize=this._vertAttrs.reduce((function(t,e){return t+ip[e.format].size}),0),this._particleTrail=new Map,this._inited=!1}return t.getModel=function(){return this._trailModel},t.onInit=function(t){this._particleSystem=t,this.minParticleDistance=this._minParticleDistance;for(var e=0,i=t.startLifetime.getMax(),n=t.rateOverTime.getMax(),r=t.duration,s=0,a=t.bursts.length;s<a;s++)e+=t.bursts[s].getMaxCount(t)*Math.ceil(i/r);this.lifeTime.getMax()<1&&at(6036),this._trailNum=Math.ceil(i*Math.ceil(this.lifeTime.getMax())*60*(n*r+e)),this._trailSegments=new ho((function(){return new evt(10)}),Math.ceil(n*r),(function(t){t.trailElements.length=0})),this._enable&&(this.enable=this._enable),this._inited=!0},t.onEnable=function(){this._attachToScene()},t.onDisable=function(){this._particleTrail.clear(),this._detachFromScene()},t._attachToScene=function(){this._trailModel&&(this._trailModel.scene&&this._detachFromScene(),this._particleSystem._getRenderScene().addModel(this._trailModel))},t._detachFromScene=function(){this._trailModel&&this._trailModel.scene&&this._trailModel.scene.removeModel(this._trailModel)},t.destroy=function(){this.destroySubMeshData(),this._trailModel&&(YE.root.destroyModel(this._trailModel),this._trailModel=null),this._trailSegments&&(this._trailSegments.destroy(),this._trailSegments=null)},t.play=function(){this._trailModel&&this._enable&&(this._trailModel.enabled=!0)},t.clear=function(){if(this.enable){for(var t=this._particleTrail.values(),e=t.next();!e.done;)e.value.clear(),e=t.next();this._particleTrail.clear(),this.updateRenderData(),this._trailModel&&(this._trailModel.enabled=!1)}},t.updateMaterial=function(){this._particleSystem&&(this._material=this._particleSystem.getMaterialInstance(1)||this._particleSystem.processor.getDefaultTrailMaterial(),this._trailModel&&this._trailModel.setSubModelMaterial(0,this._material))},t.update=function(){this._trailLifetime=this.lifeTime.evaluate(this._particleSystem.time,1),0===this.space&&1===this._particleSystem.simulationSpace?(this._needTransform=!0,this._particleSystem.node.getWorldMatrix(this._psTransform),this._particleSystem.node.getWorldRotation(Qyt)):this._needTransform=!1},t.animate=function(t,e){if(this._trailSegments)if(t.loopCount>t.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(Zyt,t.position,this._psTransform):ir.copy(Zyt,t.position),!(n&&(i.iterateElement(this,this._updateTrailElement,t,e),ir.squaredDistance(n.position,Zyt)<this._minSquaredDistance))&&(n=i.addElement())){ir.copy(n.position,Zyt),n.lifetime=0,this.widthFromParticle?n.width=t.size.x*this.widthRatio.evaluate(0,1):n.width=this.widthRatio.evaluate(0,1);var r=i.count();if(2===r){var s=i.getElement(i.end-2);ir.subtract(s.velocity,n.position,s.position)}else if(r>2){var a=i.getElement(i.end-2),o=i.getElement(i.end-3);ir.subtract(Zyt,o.position,a.position),ir.subtract($yt,n.position,a.position),ir.subtract(a.velocity,$yt,Zyt),ir.equals(ir.ZERO,a.velocity)&&ir.copy(a.velocity,Zyt),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;u<s;u++){var l=n.trailElements[u%n.trailElements.length],c=u-n.start;this._fillVertexBuffer(l,this.colorOverTrail.evaluate(1-c/a,1),r,1-c*o,c,5)}this._needTransform?ir.transformMat4(Kyt.position,i.position,this._psTransform):ir.copy(Kyt.position,i.position);var f=this._trailModel;if(f&&f.node.invalidateChildren(1),1===a||2===a){var _=n.getElement(n.end-1);ir.subtract(_.velocity,Kyt.position,_.position);var d=this._vbF32,m=this.vbOffset,g=this._vertSize/4,y=_.velocity;d[m-g-4]=y.x,d[m-g-3]=y.y,d[m-g-2]=y.z,d[m-4]=y.x,d[m-3]=y.y,d[m-2]=y.z,ir.subtract(Kyt.velocity,Kyt.position,_.position),this._checkDirectionReverse(Kyt,_)}else if(a>2){var v=n.getElement(n.end-1),b=n.getElement(n.end-2);ir.subtract(Zyt,b.position,v.position),ir.subtract($yt,Kyt.position,v.position),ir.normalize(Zyt,Zyt),ir.normalize($yt,$yt),ir.subtract(v.velocity,$yt,Zyt),ir.normalize(v.velocity,v.velocity),this._checkDirectionReverse(v,b),this.vbOffset-=this._vertSize/4*2,this.ibOffset-=6,this._fillVertexBuffer(v,this.colorOverTrail.evaluate(o,1),r,o,a-1,5),ir.subtract(Kyt.velocity,Kyt.position,v.position),ir.normalize(Kyt.velocity,Kyt.velocity),this._checkDirectionReverse(Kyt,v)}this.widthFromParticle?Kyt.width=i.size.x*this.widthRatio.evaluate(0,1):Kyt.width=this.widthRatio.evaluate(0,1),Kyt.color=i.color,ir.equals(Kyt.velocity,ir.ZERO)?this.ibOffset-=3:this._fillVertexBuffer(Kyt,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=A.director.root.createModel(KM))},t.rebuild=function(){var t=this,e=YE.root.device,i=e.createBuffer(new ud(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 ud(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 sO([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,tvt.set(t.color),tvt.multiply(e),this._vbUint32[this.vbOffset++]=cr.toUint32(tvt),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(tvt),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)<Jyt?t.direction=1-e.direction:t.direction=e.direction},t.destroySubMeshData=function(){this._subMeshData&&(this._subMeshData.destroy(),this._subMeshData=null)},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){t===this._enable&&this._trailModel||(t&&!this._enable&&(this._enable=t,this._particleSystem.processor&&this._particleSystem.processor.updateTrailMaterial()),t&&!this._trailModel&&(this._createModel(),this.rebuild()),this._enable=t,this._trailModel&&(this._trailModel.enabled=t),t?this.onEnable():this.onDisable())}},{key:"minParticleDistance",get:function(){return this._minParticleDistance},set:function(t){this._minParticleDistance=t,this._minSquaredDistance=t*t}},{key:"space",get:function(){return this._space},set:function(t){this._space=t;var e=this._particleSystem;e&&e.processor&&e.processor.updateTrailMaterial()}},{key:"inited",get:function(){return this._inited}}]),e}(),wmt=zh(Smt.prototype,"_enable",[uu],(function(){return!1})),xmt=zh(Smt.prototype,"mode",[fmt,uu],(function(){return 0})),Tmt=zh(Smt.prototype,"lifeTime",[_mt,uu],(function(){return new Olt})),Amt=zh(Smt.prototype,"_minParticleDistance",[uu],(function(){return.1})),v(Smt.prototype,"space",[dmt],Object.getOwnPropertyDescriptor(Smt.prototype,"space"),Smt.prototype),Cmt=zh(Smt.prototype,"existWithParticles",[uu],(function(){return!0})),Dmt=zh(Smt.prototype,"textureMode",[pmt,uu],(function(){return 0})),Bmt=zh(Smt.prototype,"widthFromParticle",[uu],(function(){return!0})),Imt=zh(Smt.prototype,"widthRatio",[mmt,uu],(function(){return new Olt})),Mmt=zh(Smt.prototype,"colorFromParticle",[uu],(function(){return!1})),Pmt=zh(Smt.prototype,"colorOverTrail",[gmt,uu],(function(){return new fct})),Emt=zh(Smt.prototype,"colorOvertime",[ymt,uu],(function(){return new fct})),Omt=zh(Smt.prototype,"_space",[vmt],(function(){return 0})),kmt=zh(Smt.prototype,"_particleSystem",[uu],(function(){return null})),bmt=Smt))||bmt),nvt=new Kr,rvt=new Kr,svt=new kr,avt=new ir,ovt=["_colorOverLifetimeModule","_sizeOvertimeModule","_velocityOvertimeModule","_forceOvertimeModule","_limitVelocityOvertimeModule","_rotationOvertimeModule","_textureAnimationModule"],hvt=function(){function t(t){this._particleSystem=void 0,this._processor=void 0,this._node=void 0,this._particlesAll=void 0,this._updateList=new Map,this._animateList=new Map,this._runAnimateList=[],this._localMat=new Kr,this._gravity=new Vn,this.minPos=new ir,this.maxPos=new ir,this._nodePos=new ir,this._nodeSize=new ir,this._particleSystem=t,this._processor=this._particleSystem.processor,this._node=t.node,this._particlesAll=[],this._initModuleList()}var e=t.prototype;return e._updateBoundingNode=function(){this._nodeSize.set(this.maxPos.x-this.minPos.x,this.maxPos.y-this.minPos.y,this.maxPos.z-this.minPos.z),this._nodePos.set(this.minPos.x+.5*this._nodeSize.x,this.minPos.y+.5*this._nodeSize.y,this.minPos.z+.5*this._nodeSize.z)},e.setBoundingBoxSize=function(t){this.maxPos.x=this._nodePos.x+t.x,this.maxPos.y=this._nodePos.y+t.y,this.maxPos.z=this._nodePos.z+t.z,this.minPos.x=this._nodePos.x-t.x,this.minPos.y=this._nodePos.y-t.y,this.minPos.z=this._nodePos.z-t.z,this._updateBoundingNode()},e.setBoundingBoxCenter=function(t,e,i){this.maxPos.x=t+.5*this._nodeSize.x,this.maxPos.y=e+.5*this._nodeSize.y,this.maxPos.z=i+.5*this._nodeSize.z,this.minPos.x=t-.5*this._nodeSize.x,this.minPos.y=e-.5*this._nodeSize.y,this.minPos.z=i-.5*this._nodeSize.z,this._updateBoundingNode()},e._initModuleList=function(){var t=this;ovt.forEach((function(e){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=Dct.length;e<i;e++){var n=this._animateList.get(Dct[e]);n&&this._runAnimateList.push(n)}},e._emit=function(t,e,i){var n=this._particleSystem,r=this._node,s=n.time%n.duration/n.duration;r.invalidateChildren(1),0===n.simulationSpace&&(r.getWorldMatrix(nvt),r.getWorldRotation(svt));for(var a=0;a<t;++a){var o=new vct(n);o.particleSystem=n,o.reset();var h=un(hn(0,I));n._shapeModule&&n._shapeModule.enable?n._shapeModule.emit(o):(ir.set(o.position,0,0,0),ir.copy(o.velocity,Mct)),n._textureAnimationModule&&n._textureAnimationModule.enable&&n._textureAnimationModule.init(o);var u=n.startSpeed.evaluate(s,h);ir.multiplyScalar(o.velocity,o.velocity,u),0===n.simulationSpace&&(ir.transformMat4(o.position,o.position,nvt),ir.transformQuat(o.velocity,o.velocity,svt)),ir.copy(o.ultimateVelocity,o.velocity),ir.set(o.rotation,0,0,0),n.startSize3D?ir.set(o.startSize,n.startSizeX.evaluate(s,h),n.startSizeY.evaluate(s,h),n.startSizeZ.evaluate(s,h)):(ir.set(o.startSize,n.startSizeX.evaluate(s,h),1,1),o.startSize.y=o.startSize.x),ir.copy(o.size,o.startSize),o.startLifetime=n.startLifetime.evaluate(s,h)+e,o.remainingLifetime=o.startLifetime,i.push(o)}},e._updateParticles=function(t,e){var i=this,n=this._particleSystem;switch(n.node.getWorldMatrix(nvt),n.scaleSpace){case 1:n.node.getScale(avt);break;case 0:n.node.getWorldScale(avt)}if(this._updateList.forEach((function(){})),1===n.simulationSpace){var r=n.node.getRotation();Kr.fromQuat(this._localMat,r),this._localMat.transpose()}n.node.parent&&(n.node.parent.getWorldMatrix(rvt),rvt.invert());for(var s=function(){var r=e[a];if(r.remainingLifetime-=t,ir.set(r.animatedVelocity,0,0,0),n.gravityModifier.mode!==Elt.Constant||0!==n.gravityModifier.constant){var s=Vct(n.gravityModifier)?un(r.randomSeed):0;if(1===n.simulationSpace){var o=9.8*-n.gravityModifier.evaluate(1-r.remainingLifetime/r.startLifetime,s)*t;i._gravity.x=0,i._gravity.y=o,i._gravity.z=0,i._gravity.w=1,Zi(o,0,Ki)||(n.node.parent&&(i._gravity=i._gravity.transformMat4(rvt)),i._gravity=i._gravity.transformMat4(i._localMat),r.velocity.x+=i._gravity.x,r.velocity.y+=i._gravity.y,r.velocity.z+=i._gravity.z)}else r.velocity.y-=9.8*n.gravityModifier.evaluate(1-r.remainingLifetime/r.startLifetime,s)*t}ir.copy(r.ultimateVelocity,r.velocity),i._runAnimateList.forEach((function(e){e.animate(r,t)})),ir.scaleAndAdd(r.position,r.position,r.ultimateVelocity,t)},a=0;a<e.length;++a)s()},e._calculateBounding=function(t){var e=new ir,i=new ir,n=new ir,r=new ir,s=new ir(1,1,1);if(4===this._processor.getInfo().renderMode){var a=this._processor.getInfo().mesh;if(a&&a.struct.minPosition&&a.struct.maxPosition){var o=new gh;gh.fromPoints(o,a.struct.minPosition,a.struct.maxPosition);var h=Math.max(o.halfExtents.x,o.halfExtents.y,o.halfExtents.z);s.set(h,h,h)}}for(var u=this._particleSystem.node.worldMatrix,l=0;l<this._particlesAll.length;++l){var c=this._particlesAll[l];ir.multiply(e,avt,c.size),ir.multiply(e,e,s),i.set(c.position),0!==this._particleSystem.simulationSpace&&ir.transformMat4(i,i,u),t&&0===l?(ir.subtract(this.minPos,i,e),ir.add(this.maxPos,i,e)):(ir.subtract(n,i,e),ir.add(r,i,e),ir.min(this.minPos,this.minPos,n),ir.max(this.maxPos,this.maxPos,r))}},e.calculatePositions=function(){this._emit(this._particleSystem.capacity,0,this._particlesAll);var t=Vct(this._particleSystem.startLifetime)?un(hn(0,I)):0;this._updateParticles(0,this._particlesAll),this._calculateBounding(!0),this._updateParticles(this._particleSystem.startLifetime.evaluate(0,t),this._particlesAll),this._calculateBounding(!1),this._updateBoundingNode()},e.clear=function(){this._particlesAll.length=0},e.destroy=function(){},t}(),uvt=uu,lvt=Ou,cvt=(Rmt=Kh("cc.NoiseModule"),Fmt=lvt(ci),Lmt=lvt(ci),Vmt=lvt(ci),Nmt=lvt(ci),zmt=lvt(ci),Umt=lvt(ci),Gmt=lvt(ci),Hmt=lvt(ci),Wmt=lvt(ci),jmt=lvt(ci),qmt=lvt(li),Xmt=lvt(ci),Ymt=lvt(ci),Rmt((Kmt=function(t){function e(){var e;return(e=t.call(this)||this)._enable=Qmt&&Qmt(),e._strengthX=Zmt&&Zmt(),e._strengthY=$mt&&$mt(),e._strengthZ=tgt&&tgt(),e._noiseSpeedX=egt&&egt(),e._noiseSpeedY=igt&&igt(),e._noiseSpeedZ=ngt&&ngt(),e._noiseFrequency=rgt&&rgt(),e._remapX=sgt&&sgt(),e._remapY=agt&&agt(),e._remapZ=ogt&&ogt(),e._octaves=hgt&&hgt(),e._octaveMultiplier=ugt&&ugt(),e._octaveScale=lgt&&lgt(),e.name=Cct,e.noise=new qdt,e.samplePosition=new ir,e}s(e,t);var i=e.prototype;return i.animate=function(t,e){this.noise.setTime(t.particleSystem.time),this.noise.setSpeed(this.noiseSpeedX,this.noiseSpeedY,this.noiseSpeedZ),this.noise.setFrequency(this.noiseFrequency),this.noise.setAbs(this.remapX,this.remapY,this.remapZ),this.noise.setAmplititude(this.strengthX,this.strengthY,this.strengthZ),this.noise.setOctaves(this.octaves,this.octaveMultiplier,this.octaveScale),this.samplePosition.set(t.position),this.samplePosition.add3f(1*sn(),1*sn(),1*sn()),this.noise.setSamplePoint(this.samplePosition),this.noise.getNoiseParticle();var i=this.noise.getResult();i.multiply3f(sn(),sn(),sn()),ir.add(t.position,t.position,i.multiplyScalar(e))},i.getNoisePreview=function(t,e,i,n){this.noise.setTime(e.time),this.noise.setSpeed(this.noiseSpeedX,this.noiseSpeedY,this.noiseSpeedZ),this.noise.setFrequency(this.noiseFrequency),this.noise.setAbs(this.remapX,this.remapY,this.remapZ),this.noise.setAmplititude(this.strengthX,this.strengthY,this.strengthZ),this.noise.setOctaves(this.octaves,this.octaveMultiplier,this.octaveScale),this.noise.getNoiseParticle(),this.noise.getPreview(t,i,n)},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:"strengthX",get:function(){return this._strengthX},set:function(t){this._strengthX=t}},{key:"strengthY",get:function(){return this._strengthY},set:function(t){this._strengthY=t}},{key:"strengthZ",get:function(){return this._strengthZ},set:function(t){this._strengthZ=t}},{key:"noiseSpeedX",get:function(){return this._noiseSpeedX},set:function(t){this._noiseSpeedX=t}},{key:"noiseSpeedY",get:function(){return this._noiseSpeedY},set:function(t){this._noiseSpeedY=t}},{key:"noiseSpeedZ",get:function(){return this._noiseSpeedZ},set:function(t){this._noiseSpeedZ=t}},{key:"noiseFrequency",get:function(){return this._noiseFrequency},set:function(t){this._noiseFrequency=t}},{key:"remapX",get:function(){return this._remapX},set:function(t){this._remapX=t}},{key:"remapY",get:function(){return this._remapY},set:function(t){this._remapY=t}},{key:"remapZ",get:function(){return this._remapZ},set:function(t){this._remapZ=t}},{key:"octaves",get:function(){return this._octaves},set:function(t){this._octaves=t}},{key:"octaveMultiplier",get:function(){return this._octaveMultiplier},set:function(t){this._octaveMultiplier=t}},{key:"octaveScale",get:function(){return this._octaveScale},set:function(t){this._octaveScale=t}}]),e}(Ict),Qmt=zh(Kmt.prototype,"_enable",[uvt],(function(){return!1})),v(Kmt.prototype,"strengthX",[Fmt],Object.getOwnPropertyDescriptor(Kmt.prototype,"strengthX"),Kmt.prototype),Zmt=zh(Kmt.prototype,"_strengthX",[uvt],(function(){return 10})),v(Kmt.prototype,"strengthY",[Lmt],Object.getOwnPropertyDescriptor(Kmt.prototype,"strengthY"),Kmt.prototype),$mt=zh(Kmt.prototype,"_strengthY",[uvt],(function(){return 10})),v(Kmt.prototype,"strengthZ",[Vmt],Object.getOwnPropertyDescriptor(Kmt.prototype,"strengthZ"),Kmt.prototype),tgt=zh(Kmt.prototype,"_strengthZ",[uvt],(function(){return 10})),v(Kmt.prototype,"noiseSpeedX",[Nmt],Object.getOwnPropertyDescriptor(Kmt.prototype,"noiseSpeedX"),Kmt.prototype),egt=zh(Kmt.prototype,"_noiseSpeedX",[uvt],(function(){return 0})),v(Kmt.prototype,"noiseSpeedY",[zmt],Object.getOwnPropertyDescriptor(Kmt.prototype,"noiseSpeedY"),Kmt.prototype),igt=zh(Kmt.prototype,"_noiseSpeedY",[uvt],(function(){return 0})),v(Kmt.prototype,"noiseSpeedZ",[Umt],Object.getOwnPropertyDescriptor(Kmt.prototype,"noiseSpeedZ"),Kmt.prototype),ngt=zh(Kmt.prototype,"_noiseSpeedZ",[uvt],(function(){return 0})),v(Kmt.prototype,"noiseFrequency",[Gmt],Object.getOwnPropertyDescriptor(Kmt.prototype,"noiseFrequency"),Kmt.prototype),rgt=zh(Kmt.prototype,"_noiseFrequency",[uvt],(function(){return 1})),v(Kmt.prototype,"remapX",[Hmt],Object.getOwnPropertyDescriptor(Kmt.prototype,"remapX"),Kmt.prototype),sgt=zh(Kmt.prototype,"_remapX",[uvt],(function(){return 0})),v(Kmt.prototype,"remapY",[Wmt],Object.getOwnPropertyDescriptor(Kmt.prototype,"remapY"),Kmt.prototype),agt=zh(Kmt.prototype,"_remapY",[uvt],(function(){return 0})),v(Kmt.prototype,"remapZ",[jmt],Object.getOwnPropertyDescriptor(Kmt.prototype,"remapZ"),Kmt.prototype),ogt=zh(Kmt.prototype,"_remapZ",[uvt],(function(){return 0})),v(Kmt.prototype,"octaves",[qmt],Object.getOwnPropertyDescriptor(Kmt.prototype,"octaves"),Kmt.prototype),hgt=zh(Kmt.prototype,"_octaves",[uvt],(function(){return 1})),v(Kmt.prototype,"octaveMultiplier",[Xmt],Object.getOwnPropertyDescriptor(Kmt.prototype,"octaveMultiplier"),Kmt.prototype),ugt=zh(Kmt.prototype,"_octaveMultiplier",[uvt],(function(){return.5})),v(Kmt.prototype,"octaveScale",[Ymt],Object.getOwnPropertyDescriptor(Kmt.prototype,"octaveScale"),Kmt.prototype),lgt=zh(Kmt.prototype,"_octaveScale",[uvt],(function(){return 2})),Jmt=Kmt))||Jmt),fvt=new Kr,_vt=new kr,dvt=Object.getOwnPropertyDescriptor(CL.prototype,"sharedMaterials"),pvt=t("eX",(cgt=Kh("cc.ParticleSystem"),fgt=Zh(99),_gt=Ou(fct),dgt=Ou(Uct),pgt=lu("startSize"),mgt=Ou(Olt),ggt=Ou(Olt),ygt=Ou(Olt),vgt=Ou(Olt),bgt=Ou(Olt),Sgt=Ou(Olt),wgt=Ou(Olt),xgt=lu("startRotation"),Tgt=Ou(Olt),Agt=Ou(Olt),Cgt=Ou(Uct),Dgt=Ou(Olt),Bgt=Ou(Olt),Igt=Ou(Olt),Mgt=Ou([Pdt]),Pgt=Ou(fi),Egt=Ou(Gct),Ogt=Ou(ci),kgt=Ou(ci),Rgt=Ou(ci),Fgt=lu("enableCulling"),Lgt=Ou(zct),Vgt=Ou(zct),Ngt=Ou(Rdt),zgt=Ou(Rdt),Ugt=Ou(Tdt),Ggt=Ou(Tdt),Hgt=Ou(Mdt),Wgt=Ou(Mdt),jgt=Ou(Lft),qgt=Ou(Lft),Xgt=Ou(Uft),Ygt=Ou(Uft),Jgt=Ou(wdt),Kgt=Ou(wdt),Qgt=Ou(Ddt),Zgt=Ou(Ddt),$gt=Ou(cvt),tyt=Ou(cvt),eyt=Ou(ivt),iyt=Ou(ivt),nyt=Ou(Yyt),cgt(ryt=fgt((Xyt=function(t){function e(){var e;(e=t.call(this)||this).startColor=ayt&&ayt(),e.scaleSpace=oyt&&oyt(),e.startSize3D=hyt&&hyt(),e.startSizeX=uyt&&uyt(),e.startSizeY=lyt&&lyt(),e.startSizeZ=cyt&&cyt(),e.startSpeed=fyt&&fyt(),e.startRotation3D=_yt&&_yt(),e.startRotationX=dyt&&dyt(),e.startRotationY=pyt&&pyt(),e.startRotationZ=myt&&myt(),e.startDelay=gyt&&gyt(),e.startLifetime=yyt&&yyt(),e.duration=vyt&&vyt(),e.loop=byt&&byt(),e.simulationSpeed=Syt&&Syt(),e.playOnAwake=wyt&&wyt(),e.gravityModifier=xyt&&xyt(),e.rateOverTime=Tyt&&Tyt(),e.rateOverDistance=Ayt&&Ayt(),e.bursts=Cyt&&Cyt(),e._renderCulling=Dyt&&Dyt(),e._cullingMode=Byt&&Byt(),e._aabbHalfX=Iyt&&Iyt(),e._aabbHalfY=Myt&&Myt(),e._aabbHalfZ=Pyt&&Pyt(),e._dataCulling=Eyt&&Eyt(),e._colorOverLifetimeModule=Oyt&&Oyt(),e._shapeModule=kyt&&kyt(),e._sizeOvertimeModule=Ryt&&Ryt(),e._velocityOvertimeModule=Fyt&&Fyt(),e._forceOvertimeModule=Lyt&&Lyt(),e._limitVelocityOvertimeModule=Vyt&&Vyt(),e._rotationOvertimeModule=Nyt&&Nyt(),e._textureAnimationModule=zyt&&zyt(),e._noiseModule=Uyt&&Uyt(),e._trailModule=Gyt&&Gyt(),e.renderer=Hyt&&Hyt(),e._prewarm=Wyt&&Wyt(),e._capacity=jyt&&jyt(),e._simulationSpace=qyt&&qyt(),e.processor=null;var i=f(e);return i.rateOverTime.constant=10,i.startLifetime.constant=5,i.startSizeX.constant=1,i.startSpeed.constant=5,i._isPlaying=!1,i._isPaused=!1,i._isStopped=!0,i._isEmitting=!1,i._needToRestart=!1,i._needRefresh=!0,i._needAttach=!1,i._time=0,i._emitRateTimeCounter=0,i._emitRateDistanceCounter=0,i._oldWPos=new ir,i._curWPos=new ir,i._boundingBox=null,i._culler=null,i._oldPos=null,i._curPos=null,i._isCulled=!1,i._isSimulating=!0,i._customData1=new ds,i._customData2=new ds,i._subEmitters=[],e}s(e,t);var i=e.prototype;return i.onFocusInEditor=function(){this.renderer.create(this)},i.onLoad=function(){this.renderer.onInit(this),this._shapeModule&&this._shapeModule.onInit(this),this._trailModule&&!this.renderer.useGPU&&this._trailModule.enable&&this._trailModule.onInit(this),this.bindModule(),this._resetPosition()},i._onMaterialModified=function(t,e){null!==this.processor&&this.processor.onMaterialModified(t,e)},i._onRebuildPSO=function(t,e){this.processor.onRebuildPSO(t,e)},i._collectModels=function(){return this._models.length=0,this._models.push(this.processor.model),this._trailModule&&this._trailModule.enable&&this._trailModule.getModel()&&this._models.push(this._trailModule.getModel()),this._models},i._attachToScene=function(){this.processor.attachToScene(),this._trailModule&&this._trailModule.enable&&this._trailModule._attachToScene()},i._detachFromScene=function(){this.processor.detachFromScene(),this._trailModule&&this._trailModule.enable&&this._trailModule._detachFromScene(),this._boundingBox&&(this._boundingBox=null),this._culler&&(this._culler.clear(),this._culler.destroy(),this._culler=null)},i.bindModule=function(){this._colorOverLifetimeModule&&this._colorOverLifetimeModule.bindTarget(this.processor),this._sizeOvertimeModule&&this._sizeOvertimeModule.bindTarget(this.processor),this._rotationOvertimeModule&&this._rotationOvertimeModule.bindTarget(this.processor),this._forceOvertimeModule&&this._forceOvertimeModule.bindTarget(this.processor),this._limitVelocityOvertimeModule&&this._limitVelocityOvertimeModule.bindTarget(this.processor),this._velocityOvertimeModule&&this._velocityOvertimeModule.bindTarget(this.processor),this._textureAnimationModule&&this._textureAnimationModule.bindTarget(this.processor),this._noiseModule&&this._noiseModule.bindTarget(this.processor)},i.play=function(){if(this._needToRestart&&(this.reset(),this._needToRestart=!1),this._isPaused&&(this._isPaused=!1),this._isStopped&&(this._isStopped=!1),this._isPlaying=!0,this._isEmitting=!0,this._resetPosition(),this._prewarm&&this._prewarmSystem(),this._trailModule&&this._trailModule.play(),this.processor){var t=this.processor.getModel();t&&(t.enabled=this.enabledInHierarchy)}},i.pause=function(){this._isStopped?Y("pause(): particle system is already stopped."):(this._isPlaying&&(this._isPlaying=!1),this._isPaused=!0)},i.stopEmitting=function(){this._isEmitting=!1,this._needToRestart=!0},i.stop=function(){(this._isPlaying||this._isPaused)&&this.clear(),this._isPlaying&&(this._isPlaying=!1),this._isPaused&&(this._isPaused=!1),this._isEmitting&&(this._isEmitting=!1),this._isStopped=!0,this._needRefresh=!0,this.reset()},i.reset=function(){this._time=0,this._emitRateTimeCounter=0,this._emitRateDistanceCounter=0,this._resetPosition(),this.bursts.forEach((function(t){t.reset()}))},i.clear=function(){this.enabledInHierarchy&&(this.processor.clear(),this._trailModule&&this._trailModule.clear()),this._calculateBounding(!1)},i.getParticleCount=function(){return this.processor?this.processor.getParticleCount():0},i.setCustomData1=function(t,e){ds.set(this._customData1,t,e)},i.setCustomData2=function(t,e){ds.set(this._customData2,t,e)},i.onDestroy=function(){var t;this.stop(),null!=(t=this.processor.getModel())&&t.scene&&(this.processor.detachFromScene(),this._trailModule&&this._trailModule.enable&&this._trailModule._detachFromScene()),YE.off("director_before_commit",this.beforeRender,this),this.processor.onDestroy(),this._trailModule&&this._trailModule.destroy(),this._culler&&(this._culler.clear(),this._culler.destroy(),this._culler=null)},i.onEnable=function(){t.prototype.onEnable.call(this),YE.on("director_before_commit",this.beforeRender,this),this.playOnAwake&&this.play(),this.processor.onEnable(),this._trailModule&&this._trailModule.onEnable()},i.onDisable=function(){YE.off("director_before_commit",this.beforeRender,this),this.processor.onDisable(),this._trailModule&&this._trailModule.onDisable(),this._boundingBox&&(this._boundingBox=null),this._oldPos=null,this._culler&&(this._culler.clear(),this._culler.destroy(),this._culler=null)},i._calculateBounding=function(t){var e=this;e._boundingBox&&(e._culler||(e._culler=new hvt(e)),e._culler.calculatePositions(),gh.fromPoints(e._boundingBox,e._culler.minPos,e._culler.maxPos),t?(e.aabbHalfX=e._boundingBox.halfExtents.x,e.aabbHalfY=e._boundingBox.halfExtents.y,e.aabbHalfZ=e._boundingBox.halfExtents.z):(e.aabbHalfX?e.setBoundingX(e.aabbHalfX):e.aabbHalfX=e._boundingBox.halfExtents.x,e.aabbHalfY?e.setBoundingY(e.aabbHalfY):e.aabbHalfY=e._boundingBox.halfExtents.y,e.aabbHalfZ?e.setBoundingZ(e.aabbHalfZ):e.aabbHalfZ=e._boundingBox.halfExtents.z),e._culler.clear())},i.update=function(t){var e,i,n=this,r=n.processor,s=n.trailModule,a=t*n.simulationSpeed;if(n.renderCulling){n._boundingBox||(n._boundingBox=new gh,n._calculateBounding(!1)),n._curPos||(n._curPos=new ir),n.node.getWorldPosition(n._curPos),n._oldPos||(n._oldPos=new ir,n._oldPos.set(n._curPos));var o=n._curPos,h=n._oldPos;if(!o.equals(h)&&n._boundingBox&&n._culler){var u=o.x-h.x,l=o.y-h.y,c=o.z-h.z,f=n._boundingBox.center;f.x+=u,f.y+=l,f.z+=c,n._culler.setBoundingBoxCenter(f.x,f.y,f.z),h.set(o)}var _=n.node.scene.renderScene,d=_?_.cameras:void 0,p=!0;if(void 0!==d&&n._boundingBox)for(var m=0;m<d.length;++m){var g=d[m];if((g.visibility&n.node.layer)===n.node.layer&&Za.aabbFrustum(n._boundingBox,g.frustum)){p=!1;break}}if(p){if(2!==n._cullingMode&&(n._isSimulating=!1),n._isCulled||(r.detachFromScene(),n._isCulled=!0),s&&s.enable&&s._detachFromScene(),1===n._cullingMode&&(n._time+=a),2!==n._cullingMode)return}else n._isCulled&&(n._attachToScene(),n._isCulled=!1),n._isSimulating||(n._isSimulating=!0);if(!n._isSimulating)return}else n._boundingBox&&(n._boundingBox=null),n._culler&&(n._culler.clear(),n._culler.destroy(),n._culler=null),n._isSimulating=!0;if(n._isPlaying)n._time+=a,n._emit(a),0!==r.updateParticles(a)||n._isEmitting||n.stop();else{var y=(n.getMaterialInstance(0)||r.getDefaultMaterial()).passes[0];r.updateRotation(y),r.updateScale(y)}n._needAttach&&n.getParticleCount()>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(fvt),n.getWorldRotation(_vt));for(var s=0;s<t;++s){var a=i.processor.getFreeParticle();if(null===a)return;a.particleSystem=i,a.reset();var o=un(hn(0,I));i._shapeModule&&i._shapeModule.enable?i._shapeModule.emit(a):(ir.set(a.position,0,0,0),ir.copy(a.velocity,Mct)),i._textureAnimationModule&&i._textureAnimationModule.enable&&i._textureAnimationModule.init(a);var h=i.startSpeed.evaluate(r,o);ir.multiplyScalar(a.velocity,a.velocity,h),0===i._simulationSpace&&(ir.transformMat4(a.position,a.position,fvt),ir.transformQuat(a.velocity,a.velocity,_vt)),ir.copy(a.ultimateVelocity,a.velocity),i.startRotation3D?a.startEuler.set(i.startRotationX.evaluate(r,o),i.startRotationY.evaluate(r,o),i.startRotationZ.evaluate(r,o)):a.startEuler.set(0,0,i.startRotationZ.evaluate(r,o)),a.rotation.set(a.startEuler),i.startSize3D?ir.set(a.startSize,i.startSizeX.evaluate(r,o),i.startSizeY.evaluate(r,o),i.startSizeZ.evaluate(r,o)):(ir.set(a.startSize,i.startSizeX.evaluate(r,o),1,1),a.startSize.y=a.startSize.x),ir.copy(a.size,a.startSize),a.startColor.set(i.startColor.evaluate(r,o)),a.color.set(a.startColor),a.startLifetime=i.startLifetime.evaluate(r,o)+e,a.remainingLifetime=a.startLifetime,a.randomSeed=hn(0,233280),a.loopCount++,i.processor.setNewParticle(a)}},i._prewarmSystem=function(){this.startDelay.mode=Elt.Constant,this.startDelay.constant=0;for(var t=this.duration/1,e=0;e<t;++e)this._time+=1,this._emit(1),this.processor.updateParticles(1)},i._emit=function(t){var e=this,i=e.startDelay.evaluate(0,1);if(e._time>i){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!Bct.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 gh,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 dvt.get.call(this)},set:function(t){dvt.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}(HU),Xyt.CullingMode=Gct,ayt=zh((syt=Xyt).prototype,"startColor",[_gt,uu],(function(){return new fct})),oyt=zh(syt.prototype,"scaleSpace",[dgt,uu],(function(){return 1})),hyt=zh(syt.prototype,"startSize3D",[uu],(function(){return!1})),uyt=zh(syt.prototype,"startSizeX",[pgt,mgt],(function(){return new Olt})),lyt=zh(syt.prototype,"startSizeY",[ggt,uu],(function(){return new Olt})),cyt=zh(syt.prototype,"startSizeZ",[ygt,uu],(function(){return new Olt})),fyt=zh(syt.prototype,"startSpeed",[vgt,uu],(function(){return new Olt})),_yt=zh(syt.prototype,"startRotation3D",[uu],(function(){return!1})),dyt=zh(syt.prototype,"startRotationX",[bgt,uu],(function(){return new Olt})),pyt=zh(syt.prototype,"startRotationY",[Sgt,uu],(function(){return new Olt})),myt=zh(syt.prototype,"startRotationZ",[wgt,xgt],(function(){return new Olt})),gyt=zh(syt.prototype,"startDelay",[Tgt,uu],(function(){return new Olt})),yyt=zh(syt.prototype,"startLifetime",[Agt,uu],(function(){return new Olt})),vyt=zh(syt.prototype,"duration",[uu],(function(){return 5})),byt=zh(syt.prototype,"loop",[uu],(function(){return!0})),v(syt.prototype,"simulationSpace",[Cgt,uu],Object.getOwnPropertyDescriptor(syt.prototype,"simulationSpace"),syt.prototype),Syt=zh(syt.prototype,"simulationSpeed",[uu],(function(){return 1})),wyt=zh(syt.prototype,"playOnAwake",[uu],(function(){return!0})),xyt=zh(syt.prototype,"gravityModifier",[Dgt,uu],(function(){return new Olt})),Tyt=zh(syt.prototype,"rateOverTime",[Bgt,uu],(function(){return new Olt})),Ayt=zh(syt.prototype,"rateOverDistance",[Igt,uu],(function(){return new Olt})),Cyt=zh(syt.prototype,"bursts",[Mgt,uu],(function(){return[]})),v(syt.prototype,"renderCulling",[Pgt],Object.getOwnPropertyDescriptor(syt.prototype,"renderCulling"),syt.prototype),Dyt=zh(syt.prototype,"_renderCulling",[uu],(function(){return!1})),v(syt.prototype,"cullingMode",[Egt],Object.getOwnPropertyDescriptor(syt.prototype,"cullingMode"),syt.prototype),Byt=zh(syt.prototype,"_cullingMode",[uu],(function(){return 0})),v(syt.prototype,"aabbHalfX",[Ogt],Object.getOwnPropertyDescriptor(syt.prototype,"aabbHalfX"),syt.prototype),Iyt=zh(syt.prototype,"_aabbHalfX",[uu],(function(){return 0})),v(syt.prototype,"aabbHalfY",[kgt],Object.getOwnPropertyDescriptor(syt.prototype,"aabbHalfY"),syt.prototype),Myt=zh(syt.prototype,"_aabbHalfY",[uu],(function(){return 0})),v(syt.prototype,"aabbHalfZ",[Rgt],Object.getOwnPropertyDescriptor(syt.prototype,"aabbHalfZ"),syt.prototype),Pyt=zh(syt.prototype,"_aabbHalfZ",[uu],(function(){return 0})),Eyt=zh(syt.prototype,"_dataCulling",[uu,Fgt],(function(){return!1})),v(syt.prototype,"sharedMaterials",[Gu,uu],Object.getOwnPropertyDescriptor(syt.prototype,"sharedMaterials"),syt.prototype),Oyt=zh(syt.prototype,"_colorOverLifetimeModule",[Lgt],(function(){return null})),v(syt.prototype,"colorOverLifetimeModule",[Vgt],Object.getOwnPropertyDescriptor(syt.prototype,"colorOverLifetimeModule"),syt.prototype),kyt=zh(syt.prototype,"_shapeModule",[Ngt],(function(){return null})),v(syt.prototype,"shapeModule",[zgt],Object.getOwnPropertyDescriptor(syt.prototype,"shapeModule"),syt.prototype),Ryt=zh(syt.prototype,"_sizeOvertimeModule",[Ugt],(function(){return null})),v(syt.prototype,"sizeOvertimeModule",[Ggt],Object.getOwnPropertyDescriptor(syt.prototype,"sizeOvertimeModule"),syt.prototype),Fyt=zh(syt.prototype,"_velocityOvertimeModule",[Hgt],(function(){return null})),v(syt.prototype,"velocityOvertimeModule",[Wgt],Object.getOwnPropertyDescriptor(syt.prototype,"velocityOvertimeModule"),syt.prototype),Lyt=zh(syt.prototype,"_forceOvertimeModule",[jgt],(function(){return null})),v(syt.prototype,"forceOvertimeModule",[qgt],Object.getOwnPropertyDescriptor(syt.prototype,"forceOvertimeModule"),syt.prototype),Vyt=zh(syt.prototype,"_limitVelocityOvertimeModule",[Xgt],(function(){return null})),v(syt.prototype,"limitVelocityOvertimeModule",[Ygt],Object.getOwnPropertyDescriptor(syt.prototype,"limitVelocityOvertimeModule"),syt.prototype),Nyt=zh(syt.prototype,"_rotationOvertimeModule",[Jgt],(function(){return null})),v(syt.prototype,"rotationOvertimeModule",[Kgt],Object.getOwnPropertyDescriptor(syt.prototype,"rotationOvertimeModule"),syt.prototype),zyt=zh(syt.prototype,"_textureAnimationModule",[Qgt],(function(){return null})),v(syt.prototype,"textureAnimationModule",[Zgt],Object.getOwnPropertyDescriptor(syt.prototype,"textureAnimationModule"),syt.prototype),Uyt=zh(syt.prototype,"_noiseModule",[$gt],(function(){return null})),v(syt.prototype,"noiseModule",[tyt],Object.getOwnPropertyDescriptor(syt.prototype,"noiseModule"),syt.prototype),Gyt=zh(syt.prototype,"_trailModule",[eyt],(function(){return null})),v(syt.prototype,"trailModule",[iyt],Object.getOwnPropertyDescriptor(syt.prototype,"trailModule"),syt.prototype),Hyt=zh(syt.prototype,"renderer",[nyt,uu],(function(){return new Yyt})),Wyt=zh(syt.prototype,"_prewarm",[uu],(function(){return!1})),jyt=zh(syt.prototype,"_capacity",[uu],(function(){return 100})),qyt=zh(syt.prototype,"_simulationSpace",[uu],(function(){return 1})),ryt=syt))||ryt)||ryt)),mvt=t("eY",function(){function t(){}return t.instantiate=function(t){this.registeredSceneEvent||(YE.on("director_before_scene_launch",this.onSceneUnload,this),this.registeredSceneEvent=!0);var e=t._uuid;if(!this.particleSystemPool.has(e)){var i=new ho((function(){return J$(t)||new eb}),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(pvt));!(e=i()).done;)e.value.play()},t.stop=function(t){for(var e,i=p(t.getComponentsInChildren(pvt));!(e=i()).done;)e.value.stop()},t.onSceneUnload=function(){this.particleSystemPool.forEach((function(t){return t.destroy()})),this.particleSystemPool.clear()},t}());mvt.particleSystemPool=new Map,mvt.registeredSceneEvent=!1,mt(Pdt.prototype,"Burst.prototype",[{name:"minCount"},{name:"maxCount"}]),pt(pvt.prototype,"ParticleSystem.prototype",[{name:"enableCulling",newName:"dataCulling"}]),A.ParticleSystemComponent=pvt,le(pvt,"cc.ParticleSystemComponent"),A.BillboardComponent=Alt,le(Alt,"cc.BillboardComponent"),A.LineComponent=yct,le(yct,"cc.LineComponent"),A.ParticleUtils=mvt;var gvt=Ee({GRAVITY:0,RADIUS:1}),yvt=Ee({FREE:0,RELATIVE:1,GROUPED:2}),vvt=new ds,bvt=new ds,Svt=new ds,wvt=new ds,xvt=new Vn,Tvt=OF(IF);function Avt(t){for(var e=0,i=t;i;)e+=i.eulerAngles.z,i=i.parent;return e}var Cvt,Dvt,Bvt,Ivt=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},Mvt=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.get=function(){return this._get()||new Ivt},e}(ge),Pvt=new Mvt((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),Evt=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;e<t.length;++e)Pvt.put(t[e]);t.length=0,this.renderData&&this.renderData.resize(0,0)},e.emitParticle=function(t){var e=this.sys,i=Pvt.get();this.particles.push(i),i.timeToLive=e.life+e.lifeVar*(sn()-.5)*2;var n=i.timeToLive=Math.max(0,i.timeToLive);i.pos.x=e.sourcePos.x+e.posVar.x*(sn()-.5)*2,i.pos.y=e.sourcePos.y+e.posVar.y*(sn()-.5)*2;var r,s,a,o,h=e.startColor,u=e.startColorVar,l=e.endColor,c=e.endColorVar;i.color.r=r=$i(h.r+u.r*(sn()-.5)*2,0,255),i.color.g=s=$i(h.g+u.g*(sn()-.5)*2,0,255),i.color.b=a=$i(h.b+u.b*(sn()-.5)*2,0,255),i.color.a=o=$i(h.a+u.a*(sn()-.5)*2,0,255),i.deltaColor.r=($i(l.r+c.r*(sn()-.5)*2,0,255)-r)/n,i.deltaColor.g=($i(l.g+c.g*(sn()-.5)*2,0,255)-s)/n,i.deltaColor.b=($i(l.b+c.b*(sn()-.5)*2,0,255)-a)/n,i.deltaColor.a=($i(l.a+c.a*(sn()-.5)*2,0,255)-o)/n;var f=e.startSize+e.startSizeVar*(sn()-.5)*2;if(f=Math.max(0,f),i.size=f,-1===e.endSize)i.deltaSize=0;else{var _=e.endSize+e.endSizeVar*(sn()-.5)*2;_=Math.max(0,_),i.deltaSize=(_-f)/n}var d=e.startSpin+e.startSpinVar*(sn()-.5)*2,p=e.endSpin+e.endSpinVar*(sn()-.5)*2;i.rotation=d,i.deltaRotation=(p-d)/n,i.startPos.x=t.x,i.startPos.y=t.y,i.aspectRatio=e.aspectRatio||1;var m=nn(e.angle+this._worldRotation+e.angleVar*(sn()-.5)*2);if(e.emitterMode===gvt.GRAVITY){var g=e.speed+e.speedVar*(sn()-.5)*2;i.dir.x=Math.cos(m),i.dir.y=Math.sin(m),i.dir.multiplyScalar(g),i.radialAccel=e.radialAccel+e.radialAccelVar*(sn()-.5)*2,i.tangentialAccel=e.tangentialAccel+e.tangentialAccelVar*(sn()-.5)*2,e.rotationIsDir&&(i.rotation=-rn(Math.atan2(i.dir.y,i.dir.x)))}else{var y=e.startRadius+e.startRadiusVar*(sn()-.5)*2,v=e.endRadius+e.endRadiusVar*(sn()-.5)*2;i.radius=y,i.deltaRadius=-1===e.endRadius?0:(v-y)/n,i.angle=m,i.degreesPerSecond=nn(e.rotatePerS+e.rotatePerSVar*(sn()-.5)*2)}},e.updateUVs=function(t){var e=this.renderData;if(e&&this.sys._renderSpriteFrame){for(var i=e.vData,n=this.sys._renderSpriteFrame.uv,r=t?0:this.uvFilled,s=this.particles.length,a=r;a<s;a++){var o=a*Tvt*4;i[o+3]=n[0],i[o+4]=n[1],i[o+12]=n[2],i[o+13]=n[3],i[o+21]=n[4],i[o+22]=n[5],i[o+30]=n[6],i[o+31]=n[7]}this.uvFilled=s}},e.updateParticleBuffer=function(t,e,i,n){var r=i.vData,s=e.x,a=e.y,o=t.size,h=o,u=t.aspectRatio;u>1?h=o/u:o=h*u;var l=o/2,c=h/2;if(t.rotation){var f=-l,_=-c,d=l,p=c,m=-nn(t.rotation),g=Math.cos(m),y=Math.sin(m);r[n]=f*g-_*y+s,r[n+1]=f*y+_*g+a,r[n+2]=0,r[n+9]=d*g-_*y+s,r[n+10]=d*y+_*g+a,r[n+11]=0,r[n+18]=f*g-p*y+s,r[n+19]=f*y+p*g+a,r[n+20]=0,r[n+27]=d*g-p*y+s,r[n+28]=d*y+p*g+a,r[n+29]=0}else r[n]=s-l,r[n+1]=a-c,r[n+2]=0,r[n+9]=s+l,r[n+10]=a-c,r[n+11]=0,r[n+18]=s-l,r[n+19]=a+c,r[n+20]=0,r[n+27]=s+l,r[n+28]=a+c,r[n+29]=0;var v=t.color;xvt.x=v.r/255,xvt.y=v.g/255,xvt.z=v.b/255,xvt.w=v.a/255,Vn.toArray(r,xvt,n+5),Vn.toArray(r,xvt,n+14),Vn.toArray(r,xvt,n+23),Vn.toArray(r,xvt,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===yvt.FREE){this._worldRotation=Avt(n);var s=n.worldMatrix;vvt.x=s.m12,vvt.y=s.m13}else i.positionType===yvt.RELATIVE?(this._worldRotation=n.eulerAngles.z,vvt.x=n.position.x,vvt.y=n.position.y):this._worldRotation=0;if(this.active&&i.emissionRate){var a=1/i.emissionRate;for(r.length<i.totalParticles&&(this.emitCounter+=t);r.length<i.totalParticles&&this.emitCounter>a;)this.emitParticle(vvt),this.emitCounter-=a;this.elapsed+=t,-1!==i.duration&&i.duration<this.elapsed&&i.stopSystem()}var o=this.renderData;if(o){var h=r.length;o.reset(),this.requestData(4*h,6*h),h>this.uvFilled&&this.updateUVs();for(var u=0;u<r.length;){bvt.x=bvt.y=Svt.x=Svt.y=wvt.x=wvt.y=0;var l=r[u];if(l.timeToLive-=t,l.timeToLive>0){if(i.emitterMode===gvt.GRAVITY){var c=wvt,f=bvt,_=Svt;(l.pos.x||l.pos.y)&&(f.set(l.pos),f.normalize()),_.set(f),f.multiplyScalar(l.radialAccel);var d=_.x;_.x=-_.y,_.y=d,_.multiplyScalar(l.tangentialAccel),c.set(f),c.add(_),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=bvt;p.set(l.pos),i.positionType!==yvt.GROUPED&&p.add(l.startPos);var m=Tvt*u*4;this.updateParticleBuffer(l,p,o,m),++u}else{var g=r[u];u!==r.length-1&&(r[u]=r[r.length-1]),Pvt.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<n;s++){var a=4*s;r[i++]=a,r[i++]=a+1,r[i++]=a+2,r[i++]=a+1,r[i++]=a+3,r[i++]=a+2}}},e.initDrawInfo=function(){var t;null==(t=this.renderData)||t.setRenderDrawInfoAttributes()},t}(),Ovt=uu,kvt=t("f4",Kh("cc.ParticleAsset")((Dvt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).spriteFrame=Bvt&&Bvt(),e}return s(e,t),e}(Cm),Bvt=zh(Dvt.prototype,"spriteFrame",[Ovt],(function(){return null})),Cvt=Dvt))||Cvt);A.ParticleAsset=kvt;for(var Rvt=function(){function t(t){var e=this;this.pos=8,this.palette=[],this.imgData=[],this.transparency={indexed:[],rgb:[],grayscale:0},this.text={},this.width=0,this.height=0,this.bits=0,this.colorType=0,this.compressionMethod=0,this.filterMethod=0,this.interlaceMethod=0,this.colors=0,this.hasAlphaChannel=!1,this.pixelBitlength=0,this._decodedPalette=null;for(var i,n=this.data=t,r=0;;){r=this.readUInt32();var s=function(){for(var t=[],i=0;i<4;++i)t.push(String.fromCharCode(n[e.pos++]));return t}.call(this).join("");switch(s){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=n[this.pos++],this.colorType=n[this.pos++],this.compressionMethod=n[this.pos++],this.filterMethod=n[this.pos++],this.interlaceMethod=n[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(r);break;case"fcTL":i&&this.animation.frames.push(i),this.pos+=4,i={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32(),delay:0,disposeOp:0,blendOp:0,data:[]};var a=this.readUInt16(),o=this.readUInt16()||100;i.delay=1e3*a/o,i.disposeOp=n[this.pos++],i.blendOp=n[this.pos++];break;case"IDAT":case"fdAT":"fdAT"===s&&(this.pos+=4,r-=4),t=(null!=i?i.data:void 0)||this.imgData;for(var h=0;r>=0?h<r:h>r;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?l<u:l>u;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),_=String.fromCharCode.apply(String,c.slice(0,f));this.text[_]=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 d=this.colorType;this.hasAlphaChannel=4===d||6===d;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?e<t:e>t;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 gk.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,_=0,d=0,p=0,m=0,g=0,y=0,v=0,b=0,S=0,w=0,x=0;a<r;){switch(t[a++]){case 0:for(l=c=0;c<i;l=c+=1)n[o++]=t[a++];break;case 1:for(l=f=0;f<i;l=f+=1)h=t[a++],m=l<e?0:n[o-e],n[o++]=(h+m)%256;break;case 2:for(l=_=0;_<i;l=_+=1)h=t[a++],u=(l-l%e)/e,w=s&&n[(s-1)*i+u*e+l%e],n[o++]=(w+h)%256;break;case 3:for(l=d=0;d<i;l=d+=1)h=t[a++],u=(l-l%e)/e,m=l<e?0:n[o-e],w=s&&n[(s-1)*i+u*e+l%e],n[o++]=(h+Math.floor((m+w)/2))%256;break;case 4:for(l=p=0;p<i;l=p+=1)h=t[a++],u=(l-l%e)/e,m=l<e?0:n[o-e],0===s?w=x=0:(w=n[(s-1)*i+u*e+l%e],x=u&&n[(s-1)*i+(u-1)*e+l%e]),g=m+w-x,y=Math.abs(g-m),b=Math.abs(g-w),S=Math.abs(g-x),v=y<=b&&y<=S?m:b<=S?w:x,n[o++]=(h+v)%256;break;default:throw new Error(ft(6018,t[a-1]))}s++}return n},e.copyToImageData=function(t,e){var i,n=this.hasAlphaChannel,r=this.colors;this.palette.length&&(i=null!=this._decodedPalette?this._decodedPalette:this._decodedPalette=this.decodePalette(),r=4,n=!0);var s=t.data||t,a=s.length,o=i||e,h=0,u=0,l=0,c=0;if(1===r)for(;h<a;)l=i?4*e[h/4]:u,c=o[l++],s[h++]=c,s[h++]=c,s[h++]=c,s[h++]=n?o[l++]:255,u=l;else for(;h<a;)l=i?4*e[h/4]:u,s[h++]=o[l++],s[h++]=o[l++],s[h++]=o[l++],s[h++]=n?o[l++]:255,u=l},e.decodePalette=function(){for(var t=this.palette,e=this.transparency.indexed||[],i=new Uint8Array((e.length||0)+t.length),n=0,r=0,s=0,a=0,o=0,h=t.length;o<h;a=o+=3)i[n++]=t[a],i[n++]=t[a+1],i[n++]=t[a+2],s=e[r++],i[n++]=null!=s?s:255;return i},e.render=function(t){t.width=this.width,t.height=this.height;var e=t.getContext("2d");if(e){var i=e.createImageData(this.width,this.height);this.copyToImageData(i,this.decodePixels(null)),e.putImageData(i,0,0)}},t}(),Fvt=function(){function t(){this._littleEndian=!1,this._tiffData=[],this._fileDirectories=[],this._canvas=null}var e=t.prototype;return e.getUint8=function(t){return this._tiffData[t]},e.getUint16=function(t){return this._littleEndian?this._tiffData[t+1]<<8|this._tiffData[t]:this._tiffData[t]<<8|this._tiffData[t+1]},e.getUint32=function(t){var e=this._tiffData;return this._littleEndian?e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]:e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]},e.checkLittleEndian=function(){var t=this.getUint16(0);if(18761===t)this._littleEndian=!0;else{if(19789!==t)throw console.log(t),TypeError(ft(6019));this._littleEndian=!1}return this._littleEndian},e.hasTowel=function(){if(42!==this.getUint16(2))throw RangeError(ft(6020));return!0},e.getFieldTypeName=function(t){return t in Vvt?Vvt[t]:null},e.getFieldTagName=function(t){return t in Lvt?Lvt[t]:(it(6021,t),"Tag"+t)},e.getFieldTypeLength=function(t){return-1!==["BYTE","ASCII","SBYTE","UNDEFINED"].indexOf(t)?1:-1!==["SHORT","SSHORT"].indexOf(t)?2:-1!==["LONG","SLONG","FLOAT"].indexOf(t)?4:-1!==["RATIONAL","SRATIONAL","DOUBLE"].indexOf(t)?8:0},e.getFieldValues=function(t,e,i,n){var r=[],s=this.getFieldTypeLength(e);if(s*i<=4)!1===this._littleEndian?r.push(n>>>8*(4-s)):r.push(n);else for(var a=0;a<i;a++){var o=s*a;s>=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<<a>>>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<e;n+=12,r++){var s=this.getUint16(n),a=this.getUint16(n+2),o=this.getUint32(n+4),h=this.getUint32(n+8),u=this.getFieldTagName(s),l=this.getFieldTypeName(a),c=this.getFieldValues(u,l,o,h);i[u]={type:l,values:c}}this._fileDirectories.push(i);var f=this.getUint32(n);0!==f&&this.parseFileDirectory(f)},e.clampColorSample=function(t,e){var i=Math.pow(2,8-e);return Math.floor(t*i+(i-1))},e.reset=function(){this._littleEndian=!1,this._tiffData=[],this._fileDirectories=[],this._canvas=null},e.parseTIFF=function(t,e){var i=this;if(e=e||B.document.createElement("canvas"),this._tiffData=t,this._canvas=e,this.checkLittleEndian(),this.hasTowel()){var n=this.getUint32(4);this._fileDirectories.length=0,this.parseFileDirectory(n);var r=this._fileDirectories[0],s=r.ImageWidth.values[0],a=r.ImageLength.values[0];this._canvas.width=s,this._canvas.height=a;var o=[],h=r.Compression?r.Compression.values[0]:1,u=r.SamplesPerPixel.values[0],l=[],c=0,f=!1;r.BitsPerSample.values.forEach((function(t,e){l[e]={bitsPerSample:t,hasBytesPerSample:!1,bytesPerSample:void 0},t%8==0&&(l[e].hasBytesPerSample=!0,l[e].bytesPerSample=t/8),c+=t}),this);var _=0;c%8==0&&(f=!0,_=c/8);var d,p=r.StripOffsets.values,m=p.length;if(r.StripByteCounts)d=r.StripByteCounts.values;else{if(it(8003),1!==m)throw Error(ft(6024));d=[Math.ceil(s*a*c/8)]}for(var g=1,y=1,v=0;v<m;v++){var b=p[v];o[v]=[];for(var S=d[v],w=0,x=0,T=1,A=!0,C=[],D=0,I=0,M=0;w<S;w+=T)switch(h){case 1:C=[];for(var P=0;P<u;P++){var E=l[P];if(!E.hasBytesPerSample){var O=this.getBits(E.bitsPerSample,b+w,x);throw C.push(O.bits),w=O.byteOffset-b,x=O.bitOffset,RangeError(ft(6025))}var k=E.bytesPerSample*P;C.push(this.getBytes(E.bytesPerSample,b+w+k))}if(o[v].push(C),!f)throw T=0,RangeError(ft(6026));T=_;break;case 2:case 3:case 4:case 5:case 6:case 7:break;case 32773:if(A){A=!1;var R=this.getUint8(b+w);R>=0&&R<=127?g=R+1:R>=-127&&R<=-1?y=1-R:A=!0}else{for(var F=this.getUint8(b+w),L=0;L<y;L++){var V=l[I];if(!V.hasBytesPerSample)throw RangeError(ft(6025));M=M<<8*D|F,++D===V.bytesPerSample&&(C.push(M),M=D=0,I++),I===u&&(o[v].push(C),C=[],I=0)}0==--g&&(A=!0)}T=1}}var N=this._canvas.getContext("2d");if(N){N.fillStyle="rgba(255, 255, 255, 0)";var z=r.RowsPerStrip?r.RowsPerStrip.values[0]:a,U=o.length,G=a%z,H=0===G?z:G,W=z,j=0,q=r.PhotometricInterpretation.values[0],X=[],Y=0;r.ExtraSamples&&(X=r.ExtraSamples.values,Y=X.length);var J=[],K=0;r.ColorMap&&(J=r.ColorMap.values,K=Math.pow(2,l[0].bitsPerSample));for(var Q=0;Q<U;Q++){Q+1===U&&(W=H);for(var Z=o[Q].length,$=j*Q,tt=0,et=0;tt<W&&et<Z;tt++)for(var nt=function(){var t=o[Q][et],e=0,n=0,r=0,s=1;if(Y>0)for(var a=0;a<Y;a++)if(1===X[a]||2===X[a]){s=t[3+a]/256;break}switch(q){case 0:var h=0;l[0].hasBytesPerSample&&(h=Math.pow(16,2*l[0].bytesPerSample)),t.forEach((function(t,e,i){i[e]=h-t}));case 1:e=n=r=i.clampColorSample(t[0],l[0].bitsPerSample);break;case 2:e=i.clampColorSample(t[0],l[0].bitsPerSample),n=i.clampColorSample(t[1],l[1].bitsPerSample),r=i.clampColorSample(t[2],l[2].bitsPerSample);break;case 3:if(void 0===J)throw Error(ft(6027));var u=t[0];e=i.clampColorSample(J[u],16),n=i.clampColorSample(J[K+u],16),r=i.clampColorSample(J[2*K+u],16);break;default:throw RangeError(ft(6028,q))}N.fillStyle="rgba("+e+", "+n+", "+r+", "+s+")",N.fillRect(rt,$+tt,1,1)},rt=0;rt<s;rt++,et++)nt();j=W}}}},t}(),Lvt={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop"},Vvt={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE"},Nvt=new Fvt,zvt=new Array(123),Uvt=0;Uvt<123;++Uvt)zvt[Uvt]=64;for(var Gvt=0;Gvt<64;++Gvt)zvt["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(Gvt)]=Gvt;var Hvt={name:"Jacob__Codec__Base64",decode:function(t){var e,i,n,r,s,a,o=[],h=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");h<t.length;)e=zvt[t.charCodeAt(h++)]<<2|(r=zvt[t.charCodeAt(h++)])>>4,i=(15&r)<<4|(s=zvt[t.charCodeAt(h++)])>>2,n=(3&s)<<6|(a=zvt[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<r;i++)for(a[i]=0,n=e-1;n>=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a}},Wvt=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(Wvt.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};Wvt.gunzip=function(t){return t.constructor===Array||t.constructor,new Wvt(t).gunzip()[0][0]},Wvt.HufNode=function(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1},Wvt.LITERALS=288,Wvt.NAMEMAX=256,Wvt.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],Wvt.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],Wvt.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],Wvt.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],Wvt.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],Wvt.border=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Wvt.prototype.gunzip=function(){return this.outputArr=[],this.nextFile(),this.unzipped},Wvt.prototype.readByte=function(){return this.bits+=8,this.bytepos<this.data.length?this.data.charCodeAt(this.bytepos++):-1},Wvt.prototype.byteAlign=function(){this.bb=1},Wvt.prototype.readBit=function(){var t;return this.bits++,t=1&this.bb,this.bb>>=1,0===this.bb&&(this.bb=this.readByte(),t=1&this.bb,this.bb=this.bb>>1|128),t},Wvt.prototype.readBits=function(t){for(var e=0,i=t;i--;)e=e<<1|this.readBit();return t&&(e=Wvt.bitReverse[e]>>8-t),e},Wvt.prototype.flushBuffer=function(){this.bIdx=0},Wvt.prototype.addBuffer=function(t){this.buf32k[this.bIdx++]=t,this.outputArr.push(String.fromCharCode(t)),32768===this.bIdx&&(this.bIdx=0)},Wvt.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]++}},Wvt.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},Wvt.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},Wvt.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<e;i++)if(t[i]===r){n=i;break}}else{if(!(32768&r.b0))return r.b0;r=t[++n]}return-1},Wvt.prototype.DeflateLoop=function(){var t,e,i;do{var n,r;if(t=this.readBit(),0===(e=this.readBits(2)))for(this.byteAlign(),n=this.readByte(),n|=this.readByte()<<8,r=this.readByte(),65535&(n^~(r|=this.readByte()<<8))&&document.write("BlockLen checksum mismatch\n");n--;)s=this.readByte(),this.addBuffer(s);else if(1===e)for(;;)if((a=Wvt.bitReverse[this.readBits(7)]>>1)>23?(a=a<<1|this.readBit())>199?a=(a-=128)<<1|this.readBit():(a-=48)>143&&(a+=136):a+=256,a<256)this.addBuffer(a);else{if(256===a)break;for(a-=257,d=this.readBits(Wvt.cplext[a])+Wvt.cplens[a],a=Wvt.bitReverse[this.readBits(5)]>>3,Wvt.cpdext[a]>8?(p=this.readBits(8),p|=this.readBits(Wvt.cpdext[a]-8)<<8):p=this.readBits(Wvt.cpdext[a]),p+=Wvt.cpdist[a],a=0;a<d;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;a<l;a++)c[Wvt.border[a]]=this.readBits(3);for(d=this.distanceTree.length,i=0;i<d;i++)this.distanceTree[i]=new Wvt.HufNode;if(this.CreateTree(this.distanceTree,19,c,0))return this.flushBuffer(),1;for(o=h+u,i=0;i<o;)if((a=this.DecodeValue(this.distanceTree))<16)c[i++]=a;else if(16===a){var f;if(i+(a=3+this.readBits(2))>o)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(d=this.literalTree.length,i=0;i<d;i++)this.literalTree[i]=new Wvt.HufNode;if(this.CreateTree(this.literalTree,h,c,0))return this.flushBuffer(),1;for(d=this.literalTree.length,i=0;i<d;i++)this.distanceTree[i]=new Wvt.HufNode;var _=new Array;for(i=h;i<c.length;i++)_[i-h]=c[i];if(this.CreateTree(this.distanceTree,u,_,0))return this.flushBuffer(),1;for(;;)if((a=this.DecodeValue(this.literalTree))>=256){var d,p;if(0==(a-=256))break;for(a--,d=this.readBits(Wvt.cplext[a])+Wvt.cplens[a],a=this.DecodeValue(this.distanceTree),Wvt.cpdext[a]>8?(p=this.readBits(8),p|=this.readBits(Wvt.cpdext[a]-8)<<8):p=this.readBits(Wvt.cpdext[a]),p+=Wvt.cpdist[a];d--;)s=this.buf32k[this.bIdx-p&32767],this.addBuffer(s)}else this.addBuffer(a)}}while(!t);return this.flushBuffer(),this.byteAlign(),0},Wvt.prototype.unzipFile=function(t){var e;for(this.gunzip(),e=0;e<this.unzipped.length;e++)if(this.unzipped[e][1]===t)return this.unzipped[e][0]},Wvt.prototype.nextFile=function(){this.outputArr=[],this.modeZIP=!1;var t=[];if(t[0]=this.readByte(),t[1]=this.readByte(),120===t[0]&&218===t[1]&&(this.DeflateLoop(),this.unzipped[this.files]=[this.outputArr.join(""),"geonext.gxt"],this.files++),31===t[0]&&139===t[1]&&(this.skipdir(),this.unzipped[this.files]=[this.outputArr.join(""),"file"],this.files++),80===t[0]&&75===t[1]&&(this.modeZIP=!0,t[2]=this.readByte(),t[3]=this.readByte(),3===t[2]&&4===t[3])){t[0]=this.readByte(),t[1]=this.readByte(),this.gpflags=this.readByte(),this.gpflags|=this.readByte()<<8;var e=this.readByte();e|=this.readByte()<<8,this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte();var i=this.readByte();i|=this.readByte()<<8;var n=this.readByte();for(n|=this.readByte()<<8,s=0,this.nameBuf=[];i--;){var r=this.readByte();"/"===r|":"===r?s=0:s<Wvt.NAMEMAX-1&&(this.nameBuf[s++]=String.fromCharCode(r))}this.fileout||(this.fileout=this.nameBuf);for(var s=0;s<n;)r=this.readByte(),s++;8===e&&(this.DeflateLoop(),this.unzipped[this.files]=[this.outputArr.join(""),this.nameBuf.join("")],this.files++),this.skipdir()}},Wvt.prototype.skipdir=function(){var t,e,i=[];if(8&this.gpflags&&(i[0]=this.readByte(),i[1]=this.readByte(),i[2]=this.readByte(),i[3]=this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte()),this.modeZIP&&this.nextFile(),i[0]=this.readByte(),8!==i[0])return 0;if(this.gpflags=this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),4&this.gpflags)for(i[0]=this.readByte(),i[2]=this.readByte(),this.len=i[0]+256*i[1],t=0;t<this.len;t++)this.readByte();if(8&this.gpflags)for(t=0,this.nameBuf=[];e=this.readByte();)"7"!==e&&":"!==e||(t=0),t<Wvt.NAMEMAX-1&&(this.nameBuf[t++]=e);if(16&this.gpflags)for(;e=this.readByte(););2&this.gpflags&&(this.readByte(),this.readByte()),this.DeflateLoop(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.modeZIP&&this.nextFile()};var jvt,qvt,Xvt,Yvt,Jvt,Kvt,Qvt,Zvt,$vt,tbt,ebt,ibt,nbt,rbt,sbt,abt,obt,hbt,ubt,lbt,cbt,fbt,_bt,dbt,pbt,mbt,gbt,ybt,vbt,bbt,Sbt,wbt,xbt,Tbt,Abt,Cbt,Dbt,Bbt,Ibt,Mbt,Pbt,Ebt,Obt,kbt,Rbt,Fbt,Lbt,Vbt,Nbt,zbt,Ubt,Gbt,Hbt={name:"Jacob__Codec"};function Wbt(t){var e=t.parent,i=t.getComponent(rSt);return e&&i?Wbt(e):t.getComponentsInChildren(rSt)}Hbt.Base64=Hvt,Hbt.GZip=Wvt,Hbt.unzip=function(){return Hbt.GZip.gunzip.apply(Hbt.GZip,arguments)},Hbt.unzipBase64=function(){var t=Hbt.Base64.decode.apply(Hbt.Base64,arguments);try{return Hbt.GZip.gunzip.call(Hbt.GZip,t)}catch(e){return t.slice(7)}},Hbt.unzipBase64AsArray=function(t,e){e=e||1;var i,n,r,s=this.unzipBase64(t),a=[];for(i=0,r=s.length/e;i<r;i++)for(a[i]=0,n=e-1;n>=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a},Hbt.unzipAsArray=function(t,e){e=e||1;var i,n,r,s=this.unzip(t),a=[];for(i=0,r=s.length/e;i<r;i++)for(a[i]=0,n=e-1;n>=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a};var jbt,qbt,Xbt,Ybt,Jbt,Kbt,Qbt,Zbt,$bt,tSt,eSt,iSt=parseInt,nSt=parseFloat,rSt=t("f0",(jvt=Kh("cc.ParticleSystem2D"),qvt=Ou(kvt),Xvt=Ou(nR),Yvt=Ou(yvt),Jvt=Ou(gvt),Kvt=lu("preview"),jvt((Gbt=function(t){function e(){var e;return(e=t.call(this)||this).duration=$vt&&$vt(),e.emissionRate=tbt&&tbt(),e.life=ebt&&ebt(),e.lifeVar=ibt&&ibt(),e.angle=nbt&&nbt(),e.angleVar=rbt&&rbt(),e.startSize=sbt&&sbt(),e.startSizeVar=abt&&abt(),e.endSize=obt&&obt(),e.endSizeVar=hbt&&hbt(),e.startSpin=ubt&&ubt(),e.startSpinVar=lbt&&lbt(),e.endSpin=cbt&&cbt(),e.endSpinVar=fbt&&fbt(),e.sourcePos=_bt&&_bt(),e.posVar=dbt&&dbt(),e.emitterMode=pbt&&pbt(),e.gravity=mbt&&mbt(),e.speed=gbt&&gbt(),e.speedVar=ybt&&ybt(),e.tangentialAccel=vbt&&vbt(),e.tangentialAccelVar=bbt&&bbt(),e.radialAccel=Sbt&&Sbt(),e.radialAccelVar=wbt&&wbt(),e.rotationIsDir=xbt&&xbt(),e.startRadius=Tbt&&Tbt(),e.startRadiusVar=Abt&&Abt(),e.endRadius=Cbt&&Cbt(),e.endRadiusVar=Dbt&&Dbt(),e.rotatePerS=Bbt&&Bbt(),e.rotatePerSVar=Ibt&&Ibt(),e.aspectRatio=1,e.playOnLoad=Mbt&&Mbt(),e.autoRemoveOnFinish=Pbt&&Pbt(),e._preview=Ebt&&Ebt(),e._custom=Obt&&Obt(),e._file=kbt&&kbt(),e._spriteFrame=Rbt&&Rbt(),e._totalParticles=Fbt&&Fbt(),e._startColor=Lbt&&Lbt(),e._startColorVar=Vbt&&Vbt(),e._endColor=Nbt&&Nbt(),e._endColorVar=zbt&&zbt(),e._positionType=Ubt&&Ubt(),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 Evt(this)},i.onFocusInEditor=function(){this._focused=!0;for(var t=Wbt(this.node),e=0;e<t.length;++e)t[e]._startPreview()},i.onLostFocusInEditor=function(){this._focused=!1;for(var t=Wbt(this.node),e=0;e<t.length;++e)t[e]._stopPreview()},i._startPreview=function(){this._preview&&this.resetSystem()},i._stopPreview=function(){this._preview&&(this.resetSystem(),this.stopSystem()),this._previewTimer&&clearInterval(this._previewTimer)},i.__preload=function(){t.prototype.__preload.call(this),this._custom&&this.spriteFrame&&!this._renderSpriteFrame?this._applySpriteFrame():this._file&&(this._custom?!this._getTexture()&&this._applyFile():this._applyFile()),this.playOnLoad&&this.resetSystem()},i.destroyRenderData=function(){if(this._simulator.renderData){var e=this._assembler;e&&e.removeData&&e.removeData(this._simulator.renderData),this._simulator.renderData=null}t.prototype.destroyRenderData.call(this)},i._flushAssembler=function(){var t=e.Assembler.getAssembler(this);if(this._assembler!==t&&(this._assembler=t),this._assembler&&this._assembler.createData){var i=this._simulator,n=i.renderData;n||(n=i.renderData=this._assembler.createData(this),i.uvFilled=0,n.particleInitRenderDrawInfo(this.renderEntity),i.initDrawInfo())}},i.lateUpdate=function(t){this._simulator.finished||this._simulator.step(t)},i.addParticle=function(){},i.stopSystem=function(){this._stopped=!0,this._simulator.stop()},i.resetSystem=function(){this._stopped=!1,this._simulator.reset(),this._markForUpdateRenderData()},i.isFull=function(){return this.particleCount>=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;fT.loadAny(n,(function(e,n){e?(t.spriteFrameUuid=void 0,i._initTextureWithDictionary(t),J(e)):i.spriteFrame=n}))}else{var r=Yo(this._plistFile,t.textureFileName||"");if(t.textureFileName)fT.loadRemote(r,(function(e,n){e?(t.textureFileName=void 0,i._initTextureWithDictionary(t),J(e)):i.spriteFrame=n?nR.createWithImage(n):nR.createWithImage(mT.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=fT.assets.get(a);if(!o){var h=Hbt.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=B.document.createElement("canvas");1===u?new Rvt(h).render(l):(Nvt.parseTIFF(h,l),Nvt.reset()),o=new Hm(l),fT.assets.add(a,o)}o||at(6032,this._file.name),this.spriteFrame=o?nR.createWithImage(o):nR.createWithImage(mT.get("white-texture"))}}return!0},i._initWithDictionary=function(t){this._useFile=!0,this.totalParticles=iSt(t.maxParticles||0),this.life=nSt(t.particleLifespan||0),this.lifeVar=nSt(t.particleLifespanVariance||0);var e=t.emissionRate;this.emissionRate=e||Math.min(this.totalParticles/this.life,Number.MAX_VALUE),this.duration=nSt(t.duration||0),this._srcBlendFactor=iSt(t.blendFuncSource||2),this._dstBlendFactor=iSt(t.blendFuncDestination||4);var i=this._startColor;i.r=255*nSt(t.startColorRed||0),i.g=255*nSt(t.startColorGreen||0),i.b=255*nSt(t.startColorBlue||0),i.a=255*nSt(t.startColorAlpha||0);var n=this._startColorVar;n.r=255*nSt(t.startColorVarianceRed||0),n.g=255*nSt(t.startColorVarianceGreen||0),n.b=255*nSt(t.startColorVarianceBlue||0),n.a=255*nSt(t.startColorVarianceAlpha||0);var r=this._endColor;r.r=255*nSt(t.finishColorRed||0),r.g=255*nSt(t.finishColorGreen||0),r.b=255*nSt(t.finishColorBlue||0),r.a=255*nSt(t.finishColorAlpha||0);var s=this._endColorVar;if(s.r=255*nSt(t.finishColorVarianceRed||0),s.g=255*nSt(t.finishColorVarianceGreen||0),s.b=255*nSt(t.finishColorVarianceBlue||0),s.a=255*nSt(t.finishColorVarianceAlpha||0),this.startSize=nSt(t.startParticleSize||0),this.startSizeVar=nSt(t.startParticleSizeVariance||0),this.endSize=nSt(t.finishParticleSize||0),this.endSizeVar=nSt(t.finishParticleSizeVariance||0),this.positionType=nSt(void 0!==t.positionType?t.positionType:yvt.FREE),this.sourcePos.set(0,0),this.posVar.set(nSt(t.sourcePositionVariancex||0),nSt(t.sourcePositionVariancey||0)),this.angle=nSt(t.angle||0),this.angleVar=nSt(t.angleVariance||0),this.startSpin=nSt(t.rotationStart||0),this.startSpinVar=nSt(t.rotationStartVariance||0),this.endSpin=nSt(t.rotationEnd||0),this.endSpinVar=nSt(t.rotationEndVariance||0),this.emitterMode=iSt(t.emitterType||gvt.GRAVITY),this.emitterMode===gvt.GRAVITY){this.gravity.set(nSt(t.gravityx||0),nSt(t.gravityy||0)),this.speed=nSt(t.speed||0),this.speedVar=nSt(t.speedVariance||0),this.radialAccel=nSt(t.radialAcceleration||0),this.radialAccelVar=nSt(t.radialAccelVariance||0),this.tangentialAccel=nSt(t.tangentialAcceleration||0),this.tangentialAccelVar=nSt(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!==gvt.RADIUS)return at(6009),!1;this.startRadius=nSt(t.maxRadius||0),this.startRadiusVar=nSt(t.maxRadiusVariance||0),this.endRadius=nSt(t.minRadius||0),this.endRadiusVar=nSt(t.minRadiusVariance||0),this.rotatePerS=nSt(t.rotatePerSecond||0),this.rotatePerSVar=nSt(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!==yvt.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===yvt.RELATIVE?t.commitComp(this,this._simulator.renderData,this._renderSpriteFrame,this._assembler,this.node.parent):this.positionType===yvt.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===yvt.RELATIVE?(this._renderEntity.setRenderTransform(this.node.parent),this._renderEntity.setUseLocal(!0)):this.positionType===yvt.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}(BL),Gbt.EmitterMode=gvt,Gbt.PositionType=yvt,Gbt.DURATION_INFINITY=-1,Gbt.START_SIZE_EQUAL_TO_END_SIZE=-1,Gbt.START_RADIUS_EQUAL_TO_END_RADIUS=-1,v((Zvt=Gbt).prototype,"file",[qvt],Object.getOwnPropertyDescriptor(Zvt.prototype,"file"),Zvt.prototype),v(Zvt.prototype,"spriteFrame",[Xvt],Object.getOwnPropertyDescriptor(Zvt.prototype,"spriteFrame"),Zvt.prototype),$vt=zh(Zvt.prototype,"duration",[uu],(function(){return-1})),tbt=zh(Zvt.prototype,"emissionRate",[uu],(function(){return 10})),ebt=zh(Zvt.prototype,"life",[uu],(function(){return 1})),ibt=zh(Zvt.prototype,"lifeVar",[uu],(function(){return 0})),v(Zvt.prototype,"color",[Gu],Object.getOwnPropertyDescriptor(Zvt.prototype,"color"),Zvt.prototype),nbt=zh(Zvt.prototype,"angle",[uu],(function(){return 90})),rbt=zh(Zvt.prototype,"angleVar",[uu],(function(){return 20})),sbt=zh(Zvt.prototype,"startSize",[uu],(function(){return 50})),abt=zh(Zvt.prototype,"startSizeVar",[uu],(function(){return 0})),obt=zh(Zvt.prototype,"endSize",[uu],(function(){return 0})),hbt=zh(Zvt.prototype,"endSizeVar",[uu],(function(){return 0})),ubt=zh(Zvt.prototype,"startSpin",[uu],(function(){return 0})),lbt=zh(Zvt.prototype,"startSpinVar",[uu],(function(){return 0})),cbt=zh(Zvt.prototype,"endSpin",[uu],(function(){return 0})),fbt=zh(Zvt.prototype,"endSpinVar",[uu],(function(){return 0})),_bt=zh(Zvt.prototype,"sourcePos",[uu],(function(){return ds.ZERO.clone()})),dbt=zh(Zvt.prototype,"posVar",[uu],(function(){return ds.ZERO.clone()})),v(Zvt.prototype,"positionType",[Yvt],Object.getOwnPropertyDescriptor(Zvt.prototype,"positionType"),Zvt.prototype),pbt=zh(Zvt.prototype,"emitterMode",[uu,Jvt],(function(){return gvt.GRAVITY})),mbt=zh(Zvt.prototype,"gravity",[uu],(function(){return ds.ZERO.clone()})),gbt=zh(Zvt.prototype,"speed",[uu],(function(){return 180})),ybt=zh(Zvt.prototype,"speedVar",[uu],(function(){return 50})),vbt=zh(Zvt.prototype,"tangentialAccel",[uu],(function(){return 80})),bbt=zh(Zvt.prototype,"tangentialAccelVar",[uu],(function(){return 0})),Sbt=zh(Zvt.prototype,"radialAccel",[uu],(function(){return 0})),wbt=zh(Zvt.prototype,"radialAccelVar",[uu],(function(){return 0})),xbt=zh(Zvt.prototype,"rotationIsDir",[uu],(function(){return!1})),Tbt=zh(Zvt.prototype,"startRadius",[uu],(function(){return 0})),Abt=zh(Zvt.prototype,"startRadiusVar",[uu],(function(){return 0})),Cbt=zh(Zvt.prototype,"endRadius",[uu],(function(){return 0})),Dbt=zh(Zvt.prototype,"endRadiusVar",[uu],(function(){return 0})),Bbt=zh(Zvt.prototype,"rotatePerS",[uu],(function(){return 0})),Ibt=zh(Zvt.prototype,"rotatePerSVar",[uu],(function(){return 0})),Mbt=zh(Zvt.prototype,"playOnLoad",[uu],(function(){return!0})),Pbt=zh(Zvt.prototype,"autoRemoveOnFinish",[uu],(function(){return!1})),Ebt=zh(Zvt.prototype,"_preview",[Kvt],(function(){return!0})),Obt=zh(Zvt.prototype,"_custom",[uu],(function(){return!1})),kbt=zh(Zvt.prototype,"_file",[uu],(function(){return null})),Rbt=zh(Zvt.prototype,"_spriteFrame",[uu],(function(){return null})),Fbt=zh(Zvt.prototype,"_totalParticles",[uu],(function(){return 150})),Lbt=zh(Zvt.prototype,"_startColor",[uu],(function(){return new cr(255,255,255,255)})),Vbt=zh(Zvt.prototype,"_startColorVar",[uu],(function(){return new cr(0,0,0,0)})),Nbt=zh(Zvt.prototype,"_endColor",[uu],(function(){return new cr(255,255,255,0)})),zbt=zh(Zvt.prototype,"_endColorVar",[uu],(function(){return new cr(0,0,0,0)})),Ubt=zh(Zvt.prototype,"_positionType",[uu],(function(){return yvt.FREE})),Qvt=Zvt))||Qvt)),sSt=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}(),aSt=t("f1",(jbt=Kh("cc.MotionStreak"),qbt=Ou(Ey),jbt((eSt=function(t){function e(){var e;return(e=t.call(this)||this)._preview=Jbt&&Jbt(),e._fadeTime=Kbt&&Kbt(),e._minSeg=Qbt&&Qbt(),e._stroke=Zbt&&Zbt(),e._texture=$bt&&$bt(),e._fastMode=tSt&&tSt(),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}(BL),eSt.Point=sSt,v((Ybt=eSt).prototype,"texture",[qbt],Object.getOwnPropertyDescriptor(Ybt.prototype,"texture"),Ybt.prototype),Jbt=zh(Ybt.prototype,"_preview",[uu],(function(){return!1})),Kbt=zh(Ybt.prototype,"_fadeTime",[uu],(function(){return 1})),Qbt=zh(Ybt.prototype,"_minSeg",[uu],(function(){return 1})),Zbt=zh(Ybt.prototype,"_stroke",[uu],(function(){return 64})),$bt=zh(Ybt.prototype,"_texture",[uu],(function(){return null})),tSt=zh(Ybt.prototype,"_fastMode",[uu],(function(){return!1})),Xbt=Ybt))||Xbt)),oSt=new ds,hSt=new ds,uSt=null;function lSt(t,e){return t.x=-e.y,t.y=e.x,t}var cSt=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<t.minSeg&&(i=h)}i||(i=new sSt,o.unshift(i)),i.setPoint(s,a),i.time=t.fadeTime+e;var c,f=0;if(!(o.length<2)){var _=t.renderData;this.updateRenderDataCache(t,_);var d=t.color,p=d.r,m=d.g,g=d.b,y=d.a,v=o[1];v.distance=ds.subtract(hSt,i.point,v.point).length(),hSt.normalize(),v.setDir(hSt.x,hSt.y),i.setDir(hSt.x,hSt.y),_.dataLength=2*o.length;for(var b=_.data,S=t.fadeTime,w=!1,x=o.length-1;x>=0;x--){var T=o[x],A=T.point,C=T.dir;if(T.time-=e,T.time<0)o.splice(x,1);else{var D=T.time/S,B=o[x-1];if(!w){if(!B){o.splice(x,1);continue}A.x=B.point.x-C.x*D,A.y=B.point.y-C.y*D}w=!0,lSt(oSt,C);var I=D*y,M=f;b[M].x=A.x+oSt.x*n,b[M].y=A.y+oSt.y*n,b[M].u=1,b[M].v=D,b[M].color.set(p,m,g,I),b[M+=1].x=A.x-oSt.x*n,b[M].y=A.y-oSt.y*n,b[M].u=0,b[M].v=D,b[M].color.set(p,m,g,I),f+=2}}c=f<=2?0:3*(f-2),_.resize(f,c)}},e.updateWorldVertexAllData=function(t){for(var e=t.renderData,i=e.floatStride,n=e.data,r=e.chunk.vb,s=0;s<n.length;s++){var a=s*i;r[a+0]=n[s].x,r[a+1]=n[s].y,r[a+2]=n[s].z,r[a+3]=n[s].u,r[a+4]=n[s].v,cr.toArray(r,n[s].color,a+5)}},e.createQuadIndices=function(t,e){var i=t.renderData.chunk.meshBuffer.indexOffset;uSt=null,uSt=new Uint16Array(e);for(var n=0,r=e;n<r;n+=2){var s=0+n;uSt[i++]=s,uSt[i++]=s+2,uSt[i++]=s+1,uSt[i++]=s+1,uSt[i++]=s+2,uSt[i++]=s+3}},e.updateRenderDataCache=function(t,e){e.passDirty&&e.updatePass(t),e.nodeDirty&&e.updateNode(t),e.textureDirty&&t.texture&&(e.updateTexture(t.texture),e.material=t.getRenderMaterial(0)),e.hashDirty&&e.updateHash()},e.fillBuffers=function(t){for(var e=t.renderData,i=e.chunk,n=e.data,r=e.vertexCount,s=e.indexCount,a=i.vb,o=0,h=0;h<r;h++){var u=n[h];a[o++]=u.x,a[o++]=u.y,a[o++]=u.z,a[o++]=u.u,a[o++]=u.v,cr.toArray(a,u.color,o),o+=4}i.bufferId;for(var l=i.vertexOffset,c=i.meshBuffer,f=i.meshBuffer.iData,_=c.indexOffset,d=0,p=s;d<p;d+=2){var m=l+d;f[_++]=m,f[_++]=m+2,f[_++]=m+1,f[_++]=m+1,f[_++]=m+2,f[_++]=m+3}c.indexOffset+=e.indexCount,c.setDirty()},t}(),fSt=new cSt,_St=t("f2",{getAssembler:function(){return fSt}});aSt.Assembler=_St;var dSt=new(function(){function t(){this.maxParticleDeltaTime=0}var e=t.prototype;return e.createData=function(){return eL.add()},e.removeData=function(t){eL.remove(t)},t}()),pSt=t("f3",{getAssembler:function(){return dSt.maxParticleDeltaTime||(dSt.maxParticleDeltaTime=A.game.frameTime/1e3*2),dSt}});rSt.Assembler=pSt;var mSt=t("f6",{id:"",switchTo:function(t){var e=mSt;mSt.physicsWorld&&t!==mSt.id&&null!=mSt.backend[t]?(X("[PHYSICS2D]: switch from "+mSt.id+" to "+t+"."),e.id=t,e.wrapper=mSt.backend[t],e.physicsWorld=ySt()):(X("[PHYSICS2D]: using "+e.id+"."),e.physicsWorld=ySt())},register:function(t,e){if(X("[PHYSICS2D]: register "+t+"."),mSt.backend[t]=e,!mSt.physicsWorld||mSt.id===t){var i=mSt;i.id=t,i.wrapper=e}},wrapper:{},backend:{},physicsWorld:null,runInEditor:!0}),gSt=function(){return 0};function ySt(){return new mSt.wrapper.PhysicsWorld}var vSt={impl:null,rigidBody:null,isAwake:!1,isSleeping:!1,initialize:gSt,setType:gSt,setLinearDamping:gSt,setAngularDamping:gSt,setGravityScale:gSt,setFixedRotation:gSt,setAllowSleep:gSt,isActive:gSt,setActive:gSt,wakeUp:gSt,sleep:gSt,getMass:gSt,getInertia:gSt,getLinearVelocity:gSt,setLinearVelocity:gSt,getLinearVelocityFromWorldPoint:gSt,getAngularVelocity:gSt,setAngularVelocity:gSt,getLocalVector:gSt,getWorldVector:gSt,getLocalPoint:gSt,getWorldPoint:gSt,getLocalCenter:gSt,getWorldCenter:gSt,applyForce:gSt,applyForceToCenter:gSt,applyTorque:gSt,applyLinearImpulse:gSt,applyLinearImpulseToCenter:gSt,applyAngularImpulse:gSt,onEnable:gSt,onDisable:gSt,onDestroy:gSt},bSt={INITED:!1};function SSt(t){return bSt.INITED||(bSt.INITED=!0,bSt[1]=function(){return new mSt.wrapper.BoxShape},bSt[2]=function(){return new mSt.wrapper.CircleShape},bSt[3]=function(){return new mSt.wrapper.PolygonShape}),bSt[t]()}var wSt={INITED:!1},xSt={impl:null,initialize:gSt,apply:gSt,setDampingRatio:gSt,setFrequency:gSt,setMaxForce:gSt,setTarget:gSt,setDistance:gSt,setAngularOffset:gSt,setCorrectionFactor:gSt,setLinearOffset:gSt,setMaxLength:gSt,setMaxTorque:gSt,setLowerLimit:gSt,setUpperLimit:gSt,setMaxMotorForce:gSt,setMaxMotorTorque:gSt,setMotorSpeed:gSt,enableLimit:gSt,enableMotor:gSt,setLowerAngle:gSt,setUpperAngle:gSt};function TSt(t){return ASt(),wSt[t]()}function ASt(){if(!wSt.INITED){wSt.INITED=!0;var t="builtin"===mSt.id;wSt[2]=function(){return t?xSt:new mSt.wrapper.SpringJoint},wSt[1]=function(){return t?xSt:new mSt.wrapper.DistanceJoint},wSt[5]=function(){return t?xSt:new mSt.wrapper.FixedJoint},wSt[4]=function(){return t?xSt:new mSt.wrapper.MouseJoint},wSt[7]=function(){return t?xSt:new mSt.wrapper.RelativeJoint},wSt[6]=function(){return t?xSt:new mSt.wrapper.SliderJoint},wSt[3]=function(){return t?xSt:new mSt.wrapper.WheelJoint},wSt[8]=function(){return t?xSt:new mSt.wrapper.HingeJoint}}}function CSt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var DSt={};!function(t){function e(t,e){return void 0!==t?t:e}var i=1e37,r=1e-5,a=r*r,o=3.14159265359,h=.1,l=.008,c=2/180*o,f=.016,_=.2,d=8/180*o,m=.5*o,g=2.4674011002726646,y=-1,v=.75,b=.25,S=256,w=.01,x=2/180*o;var T=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.major=0,this.minor=0,this.revision=0,this.major=t,this.minor=e,this.revision=i}return t.prototype.toString=function(){return this.major+"."+this.minor+"."+this.revision},t}(),A=new T(2,3,2);function C(t,e){for(var i=new Array(t),n=0;n<t;++n)i[n]=e(n);return i}function D(t,e){void 0===e&&(e=0);for(var i=new Array(t),n=0;n<t;++n)i[n]=e;return i}var B=o/180,I=180/o,M=2*o,P=Math.abs;function E(t,e){return t<e?t:e}function O(t,e){return t>e?t:e}function k(t,e,i){return t<e?e:t>i?i:t}var R=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<t;i++)e[i]=arguments[i];if(e[0]instanceof Float32Array){if(2!==e[0].length)throw new Error;this.data=e[0]}else{var n="number"==typeof e[0]?e[0]:0,r="number"==typeof e[1]?e[1]:0;this.data=new Float32Array([n,r])}}var e=t.prototype;return e.Clone=function(){return new t(this.x,this.y)},e.SetZero=function(){return this.x=0,this.y=0,this},e.Set=function(t,e){return this.x=t,this.y=e,this},e.Copy=function(t){return this.x=t.x,this.y=t.y,this},e.SelfAdd=function(t){return this.x+=t.x,this.y+=t.y,this},e.SelfAddXY=function(t,e){return this.x+=t,this.y+=e,this},e.SelfSub=function(t){return this.x-=t.x,this.y-=t.y,this},e.SelfSubXY=function(t,e){return this.x-=t,this.y-=e,this},e.SelfMul=function(t){return this.x*=t,this.y*=t,this},e.SelfMulAdd=function(t,e){return this.x+=t*e.x,this.y+=t*e.y,this},e.SelfMulSub=function(t,e){return this.x-=t*e.x,this.y-=t*e.y,this},e.Dot=function(t){return this.x*t.x+this.y*t.y},e.Cross=function(t){return this.x*t.y-this.y*t.x},e.Length=function(){var t=this.x,e=this.y;return Math.sqrt(t*t+e*e)},e.LengthSquared=function(){var t=this.x,e=this.y;return t*t+e*e},e.Normalize=function(){var t=this.Length();if(t>=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=O(this.x,t.x),this.y=O(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 C(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=O(t.x,e.x),i.y=O(t.y,e.y),i},t.ClampV=function(t,e,i,n){return n.x=k(t.x,e.x,i.x),n.y=k(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;i<t;i++)e[i]=arguments[i];if(e[0]instanceof Float32Array){if(3!==e[0].length)throw new Error;this.data=e[0]}else{var n="number"==typeof e[0]?e[0]:0,r="number"==typeof e[1]?e[1]:0,s="number"==typeof e[2]?e[2]:0;this.data=new Float32Array([n,r,s])}}var e=t.prototype;return e.Clone=function(){return new t(this.x,this.y,this.z)},e.SetZero=function(){return this.x=0,this.y=0,this.z=0,this},e.SetXYZ=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},e.Copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.SelfNeg=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.SelfAdd=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},e.SelfAddXYZ=function(t,e,i){return this.x+=t,this.y+=e,this.z+=i,this},e.SelfSub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},e.SelfSubXYZ=function(t,e,i){return this.x-=t,this.y-=e,this.z-=i,this},e.SelfMul=function(t){return this.x*=t,this.y*=t,this.z*=t,this},t.DotV3V3=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},t.CrossV3V3=function(t,e,i){var n=t.x,r=t.y,s=t.z,a=e.x,o=e.y,h=e.z;return i.x=r*h-s*o,i.y=s*a-n*h,i.z=n*o-r*a,i},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}},{key:"z",get:function(){return this.data[2]},set:function(t){this.data[2]=t}}]),t}();X.ZERO=new X(0,0,0),X.s_t0=new X;var Y=function(){function t(){this.data=new Float32Array([1,0,0,1]),this.ex=new j(this.data.subarray(0,2)),this.ey=new j(this.data.subarray(2,4))}var e=t.prototype;return e.Clone=function(){return(new t).Copy(this)},t.FromVV=function(e,i){return(new t).SetVV(e,i)},t.FromSSSS=function(e,i,n,r){return(new t).SetSSSS(e,i,n,r)},t.FromAngle=function(e){return(new t).SetAngle(e)},e.SetSSSS=function(t,e,i,n){return this.ex.Set(t,i),this.ey.Set(e,n),this},e.SetVV=function(t,e){return this.ex.Copy(t),this.ey.Copy(e),this},e.SetAngle=function(t){var e=Math.cos(t),i=Math.sin(t);return this.ex.Set(e,i),this.ey.Set(-i,e),this},e.Copy=function(t){return this.ex.Copy(t.ex),this.ey.Copy(t.ey),this},e.SetIdentity=function(){return this.ex.Set(1,0),this.ey.Set(0,1),this},e.SetZero=function(){return this.ex.SetZero(),this.ey.SetZero(),this},e.GetAngle=function(){return Math.atan2(this.ex.y,this.ex.x)},e.GetInverse=function(t){var e=this.ex.x,i=this.ey.x,n=this.ex.y,r=this.ey.y,s=e*r-i*n;return 0!==s&&(s=1/s),t.ex.x=s*r,t.ey.x=-s*i,t.ex.y=-s*n,t.ey.y=s*e,t},e.Solve=function(t,e,i){var n=this.ex.x,r=this.ey.x,s=this.ex.y,a=this.ey.y,o=n*a-r*s;return 0!==o&&(o=1/o),i.x=o*(a*t-r*e),i.y=o*(n*e-s*t),i},e.SelfAbs=function(){return this.ex.SelfAbs(),this.ey.SelfAbs(),this},e.SelfInv=function(){return this.GetInverse(this),this},e.SelfAddM=function(t){return this.ex.SelfAdd(t.ex),this.ey.SelfAdd(t.ey),this},e.SelfSubM=function(t){return this.ex.SelfSub(t.ex),this.ey.SelfSub(t.ey),this},t.AbsM=function(t,e){var i=t.ex,n=t.ey;return e.ex.x=P(i.x),e.ex.y=P(i.y),e.ey.x=P(n.x),e.ey.y=P(n.y),e},t.MulMV=function(t,e,i){var n=t.ex,r=t.ey,s=e.x,a=e.y;return i.x=n.x*s+r.x*a,i.y=n.y*s+r.y*a,i},t.MulTMV=function(t,e,i){var n=t.ex,r=t.ey,s=e.x,a=e.y;return i.x=n.x*s+n.y*a,i.y=r.x*s+r.y*a,i},t.AddMM=function(t,e,i){var n=t.ex,r=t.ey,s=e.ex,a=e.ey;return i.ex.x=n.x+s.x,i.ex.y=n.y+s.y,i.ey.x=r.x+a.x,i.ey.y=r.y+a.y,i},t.MulMM=function(t,e,i){var n=t.ex.x,r=t.ex.y,s=t.ey.x,a=t.ey.y,o=e.ex.x,h=e.ex.y,u=e.ey.x,l=e.ey.y;return i.ex.x=n*o+s*h,i.ex.y=r*o+a*h,i.ey.x=n*u+s*l,i.ey.y=r*u+a*l,i},t.MulTMM=function(t,e,i){var n=t.ex.x,r=t.ex.y,s=t.ey.x,a=t.ey.y,o=e.ex.x,h=e.ex.y,u=e.ey.x,l=e.ey.y;return i.ex.x=n*o+r*h,i.ex.y=s*o+a*h,i.ey.x=n*u+r*l,i.ey.y=s*u+a*l,i},t}();Y.IDENTITY=new Y;var J=function(){function t(){this.data=new Float32Array([1,0,0,0,1,0,0,0,1]),this.ex=new X(this.data.subarray(0,3)),this.ey=new X(this.data.subarray(3,6)),this.ez=new X(this.data.subarray(6,9))}var e=t.prototype;return e.Clone=function(){return(new t).Copy(this)},e.SetVVV=function(t,e,i){return this.ex.Copy(t),this.ey.Copy(e),this.ez.Copy(i),this},e.Copy=function(t){return this.ex.Copy(t.ex),this.ey.Copy(t.ey),this.ez.Copy(t.ez),this},e.SetIdentity=function(){return this.ex.SetXYZ(1,0,0),this.ey.SetXYZ(0,1,0),this.ez.SetXYZ(0,0,1),this},e.SetZero=function(){return this.ex.SetZero(),this.ey.SetZero(),this.ez.SetZero(),this},e.SelfAddM=function(t){return this.ex.SelfAdd(t.ex),this.ey.SelfAdd(t.ey),this.ez.SelfAdd(t.ez),this},e.Solve33=function(t,e,i,n){var r=this.ex.x,s=this.ex.y,a=this.ex.z,o=this.ey.x,h=this.ey.y,u=this.ey.z,l=this.ez.x,c=this.ez.y,f=this.ez.z,_=r*(h*f-u*c)+s*(u*l-o*f)+a*(o*c-h*l);return 0!==_&&(_=1/_),n.x=_*(t*(h*f-u*c)+e*(u*l-o*f)+i*(o*c-h*l)),n.y=_*(r*(e*f-i*c)+s*(i*l-t*f)+a*(t*c-e*l)),n.z=_*(r*(h*i-u*e)+s*(u*t-o*i)+a*(o*e-h*t)),n},e.Solve22=function(t,e,i){var n=this.ex.x,r=this.ey.x,s=this.ex.y,a=this.ey.y,o=n*a-r*s;return 0!==o&&(o=1/o),i.x=o*(a*t-r*e),i.y=o*(n*e-s*t),i},e.GetInverse22=function(t){var e=this.ex.x,i=this.ey.x,n=this.ex.y,r=this.ey.y,s=e*r-i*n;0!==s&&(s=1/s),t.ex.x=s*r,t.ey.x=-s*i,t.ex.z=0,t.ex.y=-s*n,t.ey.y=s*e,t.ey.z=0,t.ez.x=0,t.ez.y=0,t.ez.z=0},e.GetSymInverse33=function(t){var e=X.DotV3V3(this.ex,X.CrossV3V3(this.ey,this.ez,X.s_t0));0!==e&&(e=1/e);var i=this.ex.x,n=this.ey.x,r=this.ez.x,s=this.ey.y,a=this.ez.y,o=this.ez.z;t.ex.x=e*(s*o-a*a),t.ex.y=e*(r*a-n*o),t.ex.z=e*(n*a-r*s),t.ey.x=t.ex.y,t.ey.y=e*(i*o-r*r),t.ey.z=e*(r*n-i*a),t.ez.x=t.ex.z,t.ez.y=t.ey.z,t.ez.z=e*(i*s-n*n)},t.MulM33V3=function(t,e,i){var n=e.x,r=e.y,s=e.z;return i.x=t.ex.x*n+t.ey.x*r+t.ez.x*s,i.y=t.ex.y*n+t.ey.y*r+t.ez.y*s,i.z=t.ex.z*n+t.ey.z*r+t.ez.z*s,i},t.MulM33XYZ=function(t,e,i,n,r){return r.x=t.ex.x*e+t.ey.x*i+t.ez.x*n,r.y=t.ex.y*e+t.ey.y*i+t.ez.y*n,r.z=t.ex.z*e+t.ey.z*i+t.ez.z*n,r},t.MulM33V2=function(t,e,i){var n=e.x,r=e.y;return i.x=t.ex.x*n+t.ey.x*r,i.y=t.ex.y*n+t.ey.y*r,i},t.MulM33XY=function(t,e,i,n){return n.x=t.ex.x*e+t.ey.x*i,n.y=t.ex.y*e+t.ey.y*i,n},t}();J.IDENTITY=new J;var K=function(){function t(t){void 0===t&&(t=0),this.s=0,this.c=1,t&&(this.s=Math.sin(t),this.c=Math.cos(t))}var e=t.prototype;return e.Clone=function(){return(new t).Copy(this)},e.Copy=function(t){return this.s=t.s,this.c=t.c,this},e.SetAngle=function(t){return this.s=Math.sin(t),this.c=Math.cos(t),this},e.SetIdentity=function(){return this.s=0,this.c=1,this},e.GetAngle=function(){return Math.atan2(this.s,this.c)},e.GetXAxis=function(t){return t.x=this.c,t.y=this.s,t},e.GetYAxis=function(t){return t.x=-this.s,t.y=this.c,t},t.MulRR=function(t,e,i){var n=t.c,r=t.s,s=e.c,a=e.s;return i.s=r*s+n*a,i.c=n*s-r*a,i},t.MulTRR=function(t,e,i){var n=t.c,r=t.s,s=e.c,a=e.s;return i.s=n*a-r*s,i.c=n*s+r*a,i},t.MulRV=function(t,e,i){var n=t.c,r=t.s,s=e.x,a=e.y;return i.x=n*s-r*a,i.y=r*s+n*a,i},t.MulTRV=function(t,e,i){var n=t.c,r=t.s,s=e.x,a=e.y;return i.x=n*s+r*a,i.y=-r*s+n*a,i},t}();K.IDENTITY=new K;var Q=function(){function t(){this.p=new j,this.q=new K}var e=t.prototype;return e.Clone=function(){return(new t).Copy(this)},e.Copy=function(t){return this.p.Copy(t.p),this.q.Copy(t.q),this},e.SetIdentity=function(){return this.p.SetZero(),this.q.SetIdentity(),this},e.SetPositionRotation=function(t,e){return this.p.Copy(t),this.q.Copy(e),this},e.SetPositionAngle=function(t,e){return this.p.Copy(t),this.q.SetAngle(e),this},e.SetPosition=function(t){return this.p.Copy(t),this},e.SetPositionXY=function(t,e){return this.p.Set(t,e),this},e.SetRotation=function(t){return this.q.Copy(t),this},e.SetRotationAngle=function(t){return this.q.SetAngle(t),this},e.GetPosition=function(){return this.p},e.GetRotation=function(){return this.q},e.GetRotationAngle=function(){return this.q.GetAngle()},e.GetAngle=function(){return this.q.GetAngle()},t.MulXV=function(t,e,i){var n=t.q.c,r=t.q.s,s=e.x,a=e.y;return i.x=n*s-r*a+t.p.x,i.y=r*s+n*a+t.p.y,i},t.MulTXV=function(t,e,i){var n=t.q.c,r=t.q.s,s=e.x-t.p.x,a=e.y-t.p.y;return i.x=n*s+r*a,i.y=-r*s+n*a,i},t.MulXX=function(t,e,i){return K.MulRR(t.q,e.q,i.q),j.AddVV(K.MulRV(t.q,e.p,i.p),t.p,i.p),i},t.MulTXX=function(t,e,i){return K.MulTRR(t.q,e.q,i.q),K.MulTRV(t.q,j.SubVV(e.p,t.p,i.p),i.p),i},t}();Q.IDENTITY=new Q;var Z,$=function(){function t(){this.localCenter=new j,this.c0=new j,this.c=new j,this.a0=0,this.a=0,this.alpha0=0}var e=t.prototype;return e.Clone=function(){return(new t).Copy(this)},e.Copy=function(t){return this.localCenter.Copy(t.localCenter),this.c0.Copy(t.c0),this.c.Copy(t.c),this.a0=t.a0,this.a=t.a,this.alpha0=t.alpha0,this},e.GetTransform=function(t,e){var i=1-e;t.p.x=i*this.c0.x+e*this.c.x,t.p.y=i*this.c0.y+e*this.c.y;var n=i*this.a0+e*this.a;return t.q.SetAngle(n),t.p.SelfSub(K.MulRV(t.q,this.localCenter,j.s_t0)),t},e.Advance=function(t){var e=(t-this.alpha0)/(1-this.alpha0),i=1-e;this.c0.x=i*this.c0.x+e*this.c.x,this.c0.y=i*this.c0.y+e*this.c.y,this.a0=i*this.a0+e*this.a,this.alpha0=t},e.Normalize=function(){var t=M*Math.floor(this.a0/M);this.a0-=t,this.a-=t},t}(),tt=function(){function t(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];if(e[0]instanceof Float32Array){if(4!==e[0].length)throw new Error;this.data=e[0]}else{var n="number"==typeof e[0]?e[0]:.5,r="number"==typeof e[1]?e[1]:.5,s="number"==typeof e[2]?e[2]:.5,a="number"==typeof e[3]?e[3]:1;this.data=new Float32Array([n,r,s,a])}}var e=t.prototype;return e.Clone=function(){return(new t).Copy(this)},e.Copy=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.IsEqual=function(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a},e.IsZero=function(){return 0===this.r&&0===this.g&&0===this.b&&0===this.a},e.Set=function(t,e,i,n){void 0===n&&(n=this.a),this.SetRGBA(t,e,i,n)},e.SetByteRGB=function(t,e,i){return this.r=t/255,this.g=e/255,this.b=i/255,this},e.SetByteRGBA=function(t,e,i,n){return this.r=t/255,this.g=e/255,this.b=i/255,this.a=n/255,this},e.SetRGB=function(t,e,i){return this.r=t,this.g=e,this.b=i,this},e.SetRGBA=function(t,e,i,n){return this.r=t,this.g=e,this.b=i,this.a=n,this},e.SelfAdd=function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a,this},e.Add=function(t,e){return e.r=this.r+t.r,e.g=this.g+t.g,e.b=this.b+t.b,e.a=this.a+t.a,e},e.SelfSub=function(t){return this.r-=t.r,this.g-=t.g,this.b-=t.b,this.a-=t.a,this},e.Sub=function(t,e){return e.r=this.r-t.r,e.g=this.g-t.g,e.b=this.b-t.b,e.a=this.a-t.a,e},e.SelfMul=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},e.Mul=function(t,e){return e.r=this.r*t,e.g=this.g*t,e.b=this.b*t,e.a=this.a*t,e},e.Mix=function(e,i){t.MixColors(this,e,i)},t.MixColors=function(t,e,i){var n=i*(e.r-t.r),r=i*(e.g-t.g),s=i*(e.b-t.b),a=i*(e.a-t.a);t.r+=n,t.g+=r,t.b+=s,t.a+=a,e.r-=n,e.g-=r,e.b-=s,e.a-=a},e.MakeStyleString=function(e){return void 0===e&&(e=this.a),t.MakeStyleString(this.r,this.g,this.b,e)},t.MakeStyleString=function(t,e,i,n){return void 0===n&&(n=1),t*=255,e*=255,i*=255,n<1?"rgba("+t+","+e+","+i+","+n+")":"rgb("+t+","+e+","+i+")"},n(t,[{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}}]),t}();tt.ZERO=new tt(0,0,0,0),tt.RED=new tt(1,0,0),tt.GREEN=new tt(0,1,0),tt.BLUE=new tt(0,0,1),(Z=t.b2DrawFlags||(t.b2DrawFlags={}))[Z.e_none=0]="e_none",Z[Z.e_shapeBit=1]="e_shapeBit",Z[Z.e_jointBit=2]="e_jointBit",Z[Z.e_aabbBit=4]="e_aabbBit",Z[Z.e_pairBit=8]="e_pairBit",Z[Z.e_centerOfMassBit=16]="e_centerOfMassBit",Z[Z.e_particleBit=32]="e_particleBit",Z[Z.e_controllerBit=64]="e_controllerBit",Z[Z.e_all=63]="e_all";var et=function(){function t(){this.m_drawFlags=0}var e=t.prototype;return e.SetFlags=function(t){this.m_drawFlags=t},e.GetFlags=function(){return this.m_drawFlags},e.AppendFlags=function(t){this.m_drawFlags|=t},e.ClearFlags=function(t){this.m_drawFlags&=~t},t}(),it=function(){function t(){this.m_start=Date.now()}var e=t.prototype;return e.Reset=function(){return this.m_start=Date.now(),this},e.GetMilliseconds=function(){return Date.now()-this.m_start},t}(),nt=function(){function t(){this.m_count=0,this.m_min_count=0,this.m_max_count=0}var e=t.prototype;return e.GetCount=function(){return this.m_count},e.GetMinCount=function(){return this.m_min_count},e.GetMaxCount=function(){return this.m_max_count},e.ResetCount=function(){var t=this.m_count;return this.m_count=0,t},e.ResetMinCount=function(){this.m_min_count=0},e.ResetMaxCount=function(){this.m_max_count=0},e.Increment=function(){this.m_count++,this.m_max_count<this.m_count&&(this.m_max_count=this.m_count)},e.Decrement=function(){this.m_count--,this.m_min_count>this.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=C(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;n<this.m_count;++n){var r=j.DotVV(this.m_vertices[n],t);r>i&&(e=n,i=r)}return e},e.GetSupportVertex=function(t){for(var e=0,i=j.DotVV(this.m_vertices[0],t),n=1;n<this.m_count;++n){var r=j.DotVV(this.m_vertices[n],t);r>i&&(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 Q,this.transformB=new Q,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;o<this.m_count;++o){var h=a[o];h.indexA=t.indexA[o],h.indexB=t.indexB[o];var u=e.GetVertex(h.indexA),l=n.GetVertex(h.indexB);Q.MulXV(i,u,h.wA),Q.MulXV(s,l,h.wB),j.SubVV(h.wB,h.wA,h.w),h.a=0}if(this.m_count>1){var c=t.metric,f=this.GetMetric();(f<.5*c||2*c<f||f<r)&&(this.m_count=0)}if(0===this.m_count){var _=a[0];_.indexA=0,_.indexB=0;var d=e.GetVertex(0),p=n.GetVertex(0);Q.MulXV(i,d,_.wA),Q.MulXV(s,p,_.wB),j.SubVV(_.wB,_.wA,_.w),_.a=1,this.m_count=1}},e.WriteCache=function(t){t.metric=this.GetMetric(),t.count=this.m_count;for(var e=this.m_vertices,i=0;i<this.m_count;++i)t.indexA[i]=e[i].indexA,t.indexB[i]=e[i].indexB},e.GetSearchDirection=function(t){switch(this.m_count){case 1:return j.NegV(this.m_v1.w,t);case 2:var e=j.SubVV(this.m_v2.w,this.m_v1.w,t);return j.CrossVV(e,j.NegV(this.m_v1.w,j.s_t0))>0?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),_=j.DotVV(i,f),d=j.DotVV(n,f),p=-_,m=j.CrossVV(r,h),g=m*j.CrossVV(i,n),y=m*j.CrossVV(n,e),v=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&&v<=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&&y<=0){var S=1/(l+c);return this.m_v1.a=l*S,this.m_v3.a=c*S,this.m_count=2,void this.m_v2.Copy(this.m_v3)}if(a<=0&&p<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v2);if(l<=0&&d<=0)return this.m_v3.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v3);if(d>0&&p>0&&g<=0){var w=1/(d+p);return this.m_v2.a=d*w,this.m_v3.a=p*w,this.m_count=2,void this.m_v1.Copy(this.m_v3)}var x=1/(g+y+v);this.m_v1.a=g*x,this.m_v2.a=y*x,this.m_v3.a=v*x,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],_t=[0,0,0],dt=new j,pt=new j,mt=new j,gt=new j,yt=new j;function vt(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,_=_t,d=0,p=0;p<20;){d=l.m_count;for(var m=0;m<d;++m)f[m]=c[m].indexA,_[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()<a)break;var y=c[l.m_count];y.indexA=s.GetSupport(K.MulTRV(h.q,j.NegV(g,j.s_t0),gt)),Q.MulXV(h,s.GetVertex(y.indexA),y.wA),y.indexB=o.GetSupport(K.MulTRV(u.q,g,yt)),Q.MulXV(u,o.GetVertex(y.indexB),y.wB),j.SubVV(y.wB,y.wA,y.w),++p,++t.b2_gjkIters;for(var v=!1,b=0;b<d;++b)if(y.indexA===f[b]&&y.indexB===_[b]){v=!0;break}if(v)break;++l.m_count}if(t.b2_gjkMaxIters=O(t.b2_gjkMaxIters,p),l.GetWitnessPoints(e.pointA,e.pointB),e.distance=j.DistanceVV(e.pointA,e.pointB),e.iterations=p,l.WriteCache(i),n.useRadii){var S=s.m_radius,w=o.m_radius;if(e.distance>S+w&&e.distance>r){e.distance-=S+w;var x=j.SubVV(e.pointB,e.pointA,mt);x.Normalize(),e.pointA.SelfMulAdd(S,x),e.pointB.SelfMulSub(w,x)}else{var T=j.MidVV(e.pointA,e.pointB,dt);e.pointA.Copy(T),e.pointB.Copy(T),e.distance=0}}}var bt,St=new j,wt=new lt,xt=new j,Tt=new j,At=new j,Ct=new j,Dt=new j,Bt=new j;(bt=t.b2ContactFeatureType||(t.b2ContactFeatureType={}))[bt.e_vertex=0]="e_vertex",bt[bt.e_face=1]="e_face";var It,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 C(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}();(It=t.b2ManifoldType||(t.b2ManifoldType={}))[It.e_unknown=-1]="e_unknown",It[It.e_circles=0]="e_circles",It[It.e_faceA=1]="e_faceA",It[It.e_faceB=2]="e_faceB";var Ot,kt=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}(),Rt=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=Q.MulXV(n,i.localPoint,e.Initialize_s_pointA),u=Q.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:K.MulRV(n.q,i.localNormal,this.normal);for(var f=Q.MulXV(n,i.localPoint,e.Initialize_s_planePoint),_=0;_<i.pointCount;++_){var d=Q.MulXV(s,i.points[_].localPoint,e.Initialize_s_clipPoint),p=r-j.DotVV(j.SubVV(d,f,j.s_t0),this.normal),m=j.AddVMulSV(d,p,this.normal,e.Initialize_s_cA),g=j.SubVMulSV(d,o,this.normal,e.Initialize_s_cB);j.MidVV(m,g,this.points[_]),this.separations[_]=j.DotVV(j.SubVV(g,m,j.s_t0),this.normal)}break;case t.b2ManifoldType.e_faceB:K.MulRV(s.q,i.localNormal,this.normal);for(var y=Q.MulXV(s,i.localPoint,e.Initialize_s_planePoint),v=0;v<i.pointCount;++v){var b=Q.MulXV(n,i.points[v].localPoint,e.Initialize_s_clipPoint),S=o-j.DotVV(j.SubVV(b,y,j.s_t0),this.normal),w=j.AddVMulSV(b,S,this.normal,e.Initialize_s_cB),x=j.SubVMulSV(b,r,this.normal,e.Initialize_s_cA);j.MidVV(x,w,this.points[v]),this.separations[v]=j.DotVV(j.SubVV(x,w,j.s_t0),this.normal)}this.normal.SelfNeg()}},e}();Rt.Initialize_s_pointA=new j,Rt.Initialize_s_pointB=new j,Rt.Initialize_s_cA=new j,Rt.Initialize_s_cB=new j,Rt.Initialize_s_planePoint=new j,Rt.Initialize_s_clipPoint=new j,(Ot=t.b2PointState||(t.b2PointState={}))[Ot.b2_nullState=0]="b2_nullState",Ot[Ot.b2_addState=1]="b2_addState",Ot[Ot.b2_persistState=2]="b2_persistState",Ot[Ot.b2_removeState=3]="b2_removeState";var Ft=function(){function t(){this.v=new j,this.id=new Pt}return t.MakeArray=function(e){return C(e,(function(){return new t}))},t.prototype.Copy=function(t){return this.v.Copy(t.v),this.id.Copy(t.id),this},t}(),Lt=function(){function t(){this.p1=new j,this.p2=new j,this.maxFraction=1}return t.prototype.Copy=function(t){return this.p1.Copy(t.p1),this.p2.Copy(t.p2),this.maxFraction=t.maxFraction,this},t}(),Vt=function(){function t(){this.normal=new j,this.fraction=0}return t.prototype.Copy=function(t){return this.normal.Copy(t.normal),this.fraction=t.fraction,this},t}(),Nt=function(){function t(){this.lowerBound=new j,this.upperBound=new j,this.m_cache_center=new j,this.m_cache_extent=new j}var e=t.prototype;return e.Copy=function(t){return this.lowerBound.Copy(t.lowerBound),this.upperBound.Copy(t.upperBound),this},e.IsValid=function(){return!(!this.lowerBound.IsValid()||!this.upperBound.IsValid()||this.upperBound.x<this.lowerBound.x||this.upperBound.y<this.lowerBound.y)},e.GetCenter=function(){return j.MidVV(this.lowerBound,this.upperBound,this.m_cache_center)},e.GetExtents=function(){return j.ExtVV(this.lowerBound,this.upperBound,this.m_cache_extent)},e.GetPerimeter=function(){return 2*(this.upperBound.x-this.lowerBound.x+(this.upperBound.y-this.lowerBound.y))},e.Combine1=function(t){return this.lowerBound.x=E(this.lowerBound.x,t.lowerBound.x),this.lowerBound.y=E(this.lowerBound.y,t.lowerBound.y),this.upperBound.x=O(this.upperBound.x,t.upperBound.x),this.upperBound.y=O(this.upperBound.y,t.upperBound.y),this},e.Combine2=function(t,e){return this.lowerBound.x=E(t.lowerBound.x,e.lowerBound.x),this.lowerBound.y=E(t.lowerBound.y,e.lowerBound.y),this.upperBound.x=O(t.upperBound.x,e.upperBound.x),this.upperBound.y=O(t.upperBound.y,e.upperBound.y),this},t.Combine=function(t,e,i){return i.Combine2(t,e),i},e.Contains=function(t){return!(this.lowerBound.x<=t.lowerBound.x||this.lowerBound.y<=t.lowerBound.y||t.upperBound.x<=this.upperBound.x||t.upperBound.y<=this.upperBound.y)},e.RayCast=function(t,e){var n=-1e37,s=i,a=e.p1.x,o=e.p1.y,h=e.p2.x-e.p1.x,u=e.p2.y-e.p1.y,l=P(h),c=P(u),f=t.normal;if(l<r){if(a<this.lowerBound.x||this.upperBound.x<a)return!1}else{var _=1/h,d=(this.lowerBound.x-a)*_,p=(this.upperBound.x-a)*_,m=-1;if(d>p){var g=d;d=p,p=g,m=1}if(d>n&&(f.x=m,f.y=0,n=d),n>(s=E(s,p)))return!1}if(c<r){if(o<this.lowerBound.y||this.upperBound.y<o)return!1}else{var y=1/u,v=(this.lowerBound.y-o)*y,b=(this.upperBound.y-o)*y,S=-1;if(v>b){var w=v;v=b,b=w,S=1}if(v>n&&(f.x=0,f.y=S,n=v),n>(s=E(s,b)))return!1}return!(n<0||e.maxFraction<n||(t.fraction=n,0))},e.TestContain=function(t){return!(t.x<this.lowerBound.x||this.upperBound.x<t.x||t.y<this.lowerBound.y||this.upperBound.y<t.y)},e.TestOverlap=function(t){return!(this.upperBound.x<t.lowerBound.x||this.upperBound.y<t.lowerBound.y||t.upperBound.x<this.lowerBound.x||t.upperBound.y<this.lowerBound.y)},t}();function zt(t,e){return!(t.upperBound.x<e.lowerBound.x||t.upperBound.y<e.lowerBound.y||e.upperBound.x<t.lowerBound.x||e.upperBound.y<t.lowerBound.y)}function Ut(e,i,n,r,s){var a=0,o=i[0],h=i[1],u=j.DotVV(n,o.v)-r,l=j.DotVV(n,h.v)-r;if(u<=0&&e[a++].Copy(o),l<=0&&e[a++].Copy(h),u*l<0){var c=u/(u-l),f=e[a].v;f.x=o.v.x+c*(h.v.x-o.v.x),f.y=o.v.y+c*(h.v.y-o.v.y);var _=e[a].id;_.cf.indexA=s,_.cf.indexB=o.id.cf.indexB,_.cf.typeA=t.b2ContactFeatureType.e_vertex,_.cf.typeB=t.b2ContactFeatureType.e_face,++a}return a}var Gt=new ot,Ht=new at,Wt=new ht;function jt(t,e,i,n,r,s){var a=Gt.Reset();a.proxyA.SetShape(t,e),a.proxyB.SetShape(i,n),a.transformA.Copy(r),a.transformB.Copy(s),a.useRadii=!0;var o=Ht.Reset();o.count=0;var h=Wt.Reset();return vt(h,o,a),h.distance<1e-4}function qt(t){if(null===t)throw new Error;return t}var Xt=function(){function t(t){void 0===t&&(t=0),this.m_id=0,this.aabb=new Nt,this._userData=null,this.parent=null,this.child1=null,this.child2=null,this.height=0,this.m_id=t}var e=t.prototype;return e.Reset=function(){this._userData=null},e.IsLeaf=function(){return null===this.child1},n(t,[{key:"userData",get:function(){if(null===this._userData)throw new Error;return this._userData},set:function(t){if(null!==this._userData)throw new Error;this._userData=t}}]),t}(),Yt=function(){function t(){this.m_root=null,this.m_freeList=null,this.m_path=0,this.m_insertionCount=0,this.m_stack=new rt(256)}var e=t.prototype;return e.Query=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.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=O(n.x,l),u.upperBound.y=O(n.y,c);var f=this.m_stack.Reset();for(f.Push(this.m_root);f.GetCount()>0;){var _=f.Pop();if(null!==_&&zt(_.aabb,u)){var d=_.aabb.GetCenter(),p=_.aabb.GetExtents();if(!(P(j.DotVV(a,j.SubVV(n,d,j.s_t0)))-j.DotVV(o,p)>0))if(_.IsLeaf()){var m=t.s_subInput;m.p1.Copy(e.p1),m.p2.Copy(e.p2),m.maxFraction=h;var g=i(m,_);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=O(n.x,l),u.upperBound.y=O(n.y,c))}else f.Push(_.child1),f.Push(_.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,_=void 0;r.IsLeaf()?(f.Combine2(i,r.aabb),c=f.GetPerimeter()+l):(f.Combine2(i,r.aabb),_=r.aabb.GetPerimeter(),c=f.GetPerimeter()-_+l);var d=void 0;if(s.IsLeaf()?(f.Combine2(i,s.aabb),d=f.GetPerimeter()+l):(f.Combine2(i,s.aabb),_=s.aabb.GetPerimeter(),d=f.GetPerimeter()-_+l),u<c&&u<d)break;n=c<d?r:s}var p=n.parent,m=this.AllocateNode();m.parent=p,m.aabb.Combine2(i,n.aabb),m.height=n.height+1,null!==p?(p.child1===n?p.child1=m:p.child2=m,m.child1=n,m.child2=e,n.parent=m,e.parent=m):(m.child1=n,m.child2=e,n.parent=m,e.parent=m,this.m_root=m);for(var g=e.parent;null!==g;){var y=qt((g=this.Balance(g)).child1),v=qt(g.child2);g.height=1+O(y.height,v.height),g.aabb.Combine2(y.aabb,v.aabb),g=g.parent}},e.RemoveLeaf=function(t){if(t!==this.m_root){var e=qt(t.parent),i=e&&e.parent,n=qt(e.child1===t?e.child2:e.child1);if(null!==i){i.child1===e?i.child1=n:i.child2=n,n.parent=i,this.FreeNode(e);for(var r=i;null!==r;){var s=qt((r=this.Balance(r)).child1),a=qt(r.child2);r.aabb.Combine2(s.aabb,a.aabb),r.height=1+O(s.height,a.height),r=r.parent}}else this.m_root=n,n.parent=null,this.FreeNode(e)}else this.m_root=null},e.Balance=function(t){if(t.IsLeaf()||t.height<2)return t;var e=qt(t.child1),i=qt(t.child2),n=i.height-e.height;if(n>1){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+O(e.height,s.height),i.height=1+O(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+O(e.height,r.height),i.height=1+O(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+O(i.height,o.height),e.height=1+O(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+O(i.height,a.height),e.height=1+O(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+O(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 O(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 Jt(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function Kt(t,e){return t<e}function Qt(t,e,i,n){void 0===i&&(i=t.length-e),void 0===n&&(n=Kt);for(var r=e,s=[],a=0;;){for(;r+1<i;i++){var o=t[r+Math.floor(Math.random()*(i-r))];s[a++]=i;for(var h=r-1;;){for(;n(t[++h],o););for(;n(o,t[--i]););if(h>=i)break;Jt(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_id<t.m_id?(n=i,r=t):(n=t,r=i),e.m_pairCount===e.m_pairBuffer.length)e.m_pairBuffer[e.m_pairCount]=new Zt(n,r);else{var s=e.m_pairBuffer[e.m_pairCount];s.proxyA=n,s.proxyB=r}return++e.m_pairCount,!0}))},n=0;n<this.m_moveCount;++n)i();this.m_moveCount=0,Qt(this.m_pairBuffer,0,this.m_pairCount,te);for(var r=0;r<this.m_pairCount;){var s=this.m_pairBuffer[r];for(t(s.proxyA.userData,s.proxyB.userData),++r;r<this.m_pairCount;){var a=this.m_pairBuffer[r];if(a.proxyA.m_id!==s.proxyA.m_id||a.proxyB.m_id!==s.proxyB.m_id)break;++r}}},e.Query=function(t,e){this.m_tree.Query(t,e)},e.QueryPoint=function(t,e){this.m_tree.QueryPoint(t,e)},e.RayCast=function(t,e){this.m_tree.RayCast(t,e)},e.GetTreeHeight=function(){return this.m_tree.GetHeight()},e.GetTreeBalance=function(){return this.m_tree.GetMaxBalance()},e.GetTreeQuality=function(){return this.m_tree.GetAreaRatio()},e.ShiftOrigin=function(t){this.m_tree.ShiftOrigin(t)},e.BufferMove=function(t){this.m_moveBuffer[this.m_moveCount]=t,++this.m_moveCount},e.UnBufferMove=function(t){var e=this.m_moveBuffer.indexOf(t);this.m_moveBuffer[e]=null},t}();function te(t,e){return t.proxyA.m_id<e.proxyA.m_id||t.proxyA.m_id===e.proxyA.m_id&&t.proxyB.m_id<e.proxyB.m_id}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;var ee,ie=new Q,ne=new Q,re=new j,se=new j,ae=new j,oe=new j,he=new j,ue=function(){this.proxyA=new st,this.proxyB=new st,this.sweepA=new $,this.sweepB=new $,this.tMax=0};(ee=t.b2TOIOutputState||(t.b2TOIOutputState={}))[ee.e_unknown=0]="e_unknown",ee[ee.e_failed=1]="e_failed",ee[ee.e_overlapped=2]="e_overlapped",ee[ee.e_touching=3]="e_touching",ee[ee.e_separated=4]="e_separated";var le,ce=function(){this.state=t.b2TOIOutputState.e_unknown,this.t=0};(le=t.b2SeparationFunctionType||(t.b2SeparationFunctionType={}))[le.e_unknown=-1]="e_unknown",le[le.e_points=0]="e_points",le[le.e_faceA=1]="e_faceA",le[le.e_faceB=2]="e_faceB";var fe=function(){function e(){this.m_sweepA=new $,this.m_sweepB=new $,this.m_type=t.b2SeparationFunctionType.e_unknown,this.m_localPoint=new j,this.m_axis=new j}var i=e.prototype;return i.Initialize=function(e,i,n,r,s,a){this.m_proxyA=i,this.m_proxyB=r;var o=e.count;this.m_sweepA.Copy(n),this.m_sweepB.Copy(s);var h=ie,u=ne;if(this.m_sweepA.GetTransform(h,a),this.m_sweepB.GetTransform(u,a),1===o){this.m_type=t.b2SeparationFunctionType.e_points;var l=this.m_proxyA.GetVertex(e.indexA[0]),c=this.m_proxyB.GetVertex(e.indexB[0]),f=Q.MulXV(h,l,re),_=Q.MulXV(u,c,se);j.SubVV(_,f,this.m_axis);var d=this.m_axis.Normalize();return this.m_localPoint.SetZero(),d}if(e.indexA[0]===e.indexA[1]){this.m_type=t.b2SeparationFunctionType.e_faceB;var p=this.m_proxyB.GetVertex(e.indexB[0]),m=this.m_proxyB.GetVertex(e.indexB[1]);j.CrossVOne(j.SubVV(m,p,j.s_t0),this.m_axis).SelfNormalize();var g=K.MulRV(u.q,this.m_axis,ae);j.MidVV(p,m,this.m_localPoint);var y=Q.MulXV(u,this.m_localPoint,se),v=this.m_proxyA.GetVertex(e.indexA[0]),b=Q.MulXV(h,v,re),S=j.DotVV(j.SubVV(b,y,j.s_t0),g);return S<0&&(this.m_axis.SelfNeg(),S=-S),S}this.m_type=t.b2SeparationFunctionType.e_faceA;var w=this.m_proxyA.GetVertex(e.indexA[0]),x=this.m_proxyA.GetVertex(e.indexA[1]);j.CrossVOne(j.SubVV(x,w,j.s_t0),this.m_axis).SelfNormalize();var T=K.MulRV(h.q,this.m_axis,ae);j.MidVV(w,x,this.m_localPoint);var A=Q.MulXV(h,this.m_localPoint,re),C=this.m_proxyB.GetVertex(e.indexB[0]),D=Q.MulXV(u,C,se),B=j.DotVV(j.SubVV(D,A,j.s_t0),T);return B<0&&(this.m_axis.SelfNeg(),B=-B),B},i.FindMinSeparation=function(e,i,n){var r=ie,s=ne;switch(this.m_sweepA.GetTransform(r,n),this.m_sweepB.GetTransform(s,n),this.m_type){case t.b2SeparationFunctionType.e_points:var a=K.MulTRV(r.q,this.m_axis,oe),o=K.MulTRV(s.q,j.NegV(this.m_axis,j.s_t0),he);e[0]=this.m_proxyA.GetSupport(a),i[0]=this.m_proxyB.GetSupport(o);var h=this.m_proxyA.GetVertex(e[0]),u=this.m_proxyB.GetVertex(i[0]),l=Q.MulXV(r,h,re),c=Q.MulXV(s,u,se);return j.DotVV(j.SubVV(c,l,j.s_t0),this.m_axis);case t.b2SeparationFunctionType.e_faceA:var f=K.MulRV(r.q,this.m_axis,ae),_=Q.MulXV(r,this.m_localPoint,re),d=K.MulTRV(s.q,j.NegV(f,j.s_t0),he);e[0]=-1,i[0]=this.m_proxyB.GetSupport(d);var p=this.m_proxyB.GetVertex(i[0]),m=Q.MulXV(s,p,se);return j.DotVV(j.SubVV(m,_,j.s_t0),f);case t.b2SeparationFunctionType.e_faceB:var g=K.MulRV(s.q,this.m_axis,ae),y=Q.MulXV(s,this.m_localPoint,se),v=K.MulTRV(r.q,j.NegV(g,j.s_t0),oe);i[0]=-1,e[0]=this.m_proxyA.GetSupport(v);var b=this.m_proxyA.GetVertex(e[0]),S=Q.MulXV(r,b,re);return j.DotVV(j.SubVV(S,y,j.s_t0),g);default:return e[0]=-1,i[0]=-1,0}},i.Evaluate=function(e,i,n){var r=ie,s=ne;switch(this.m_sweepA.GetTransform(r,n),this.m_sweepB.GetTransform(s,n),this.m_type){case t.b2SeparationFunctionType.e_points:var a=this.m_proxyA.GetVertex(e),o=this.m_proxyB.GetVertex(i),h=Q.MulXV(r,a,re),u=Q.MulXV(s,o,se);return j.DotVV(j.SubVV(u,h,j.s_t0),this.m_axis);case t.b2SeparationFunctionType.e_faceA:var l=K.MulRV(r.q,this.m_axis,ae),c=Q.MulXV(r,this.m_localPoint,re),f=this.m_proxyB.GetVertex(i),_=Q.MulXV(s,f,se);return j.DotVV(j.SubVV(_,c,j.s_t0),l);case t.b2SeparationFunctionType.e_faceB:var d=K.MulRV(s.q,this.m_axis,ae),p=Q.MulXV(s,this.m_localPoint,se),m=this.m_proxyA.GetVertex(e),g=Q.MulXV(r,m,re);return j.DotVV(j.SubVV(g,p,j.s_t0),d);default:return 0}},e}(),_e=new it,de=new at,pe=new ot,me=new ht,ge=new fe,ye=[0],ve=[0],be=new $,Se=new $;function we(e,i){var n=_e.Reset();++t.b2_toiCalls,e.state=t.b2TOIOutputState.e_unknown,e.t=i.tMax;var r=i.proxyA,s=i.proxyB,a=O(8,O(r.m_count,s.m_count)),o=be.Copy(i.sweepA),h=Se.Copy(i.sweepB);o.Normalize(),h.Normalize();var u=i.tMax,c=r.m_radius+s.m_radius,f=O(l,c-.024),_=.002,d=0,p=0,m=de;m.count=0;var g=pe;for(g.proxyA.Copy(i.proxyA),g.proxyB.Copy(i.proxyB),g.useRadii=!1;;){var y=ie,v=ne;o.GetTransform(y,d),h.GetTransform(v,d),g.transformA.Copy(y),g.transformB.Copy(v);var b=me;if(vt(b,m,g),b.distance<=0){e.state=t.b2TOIOutputState.e_overlapped,e.t=0;break}if(b.distance<f+_){e.state=t.b2TOIOutputState.e_touching,e.t=d;break}var S=ge;S.Initialize(m,r,o,s,h,d);for(var w=!1,x=u,T=0;;){var A=ye,C=ve,D=S.FindMinSeparation(A,C,x);if(D>f+_){e.state=t.b2TOIOutputState.e_separated,e.t=u,w=!0;break}if(D>f-_){d=x;break}var B=S.Evaluate(A[0],C[0],d);if(B<f-_){e.state=t.b2TOIOutputState.e_failed,e.t=d,w=!0;break}if(B<=f+_){e.state=t.b2TOIOutputState.e_touching,e.t=d,w=!0;break}for(var I=0,M=d,E=x;;){var k;k=1&I?M+(f-B)*(E-M)/(D-B):.5*(M+E),++I,++t.b2_toiRootIters;var R=S.Evaluate(A[0],C[0],k);if(P(R-f)<_){x=k;break}if(R>f?(M=k,B=R):(E=k,D=R),50===I)break}if(t.b2_toiMaxRootIters=O(t.b2_toiMaxRootIters,I),++T===a)break}if(++p,++t.b2_toiIters,w)break;if(20===p){e.state=t.b2TOIOutputState.e_failed,e.t=d;break}}t.b2_toiMaxIters=O(t.b2_toiMaxIters,p);var F=n.GetMilliseconds();t.b2_toiMaxTime=O(t.b2_toiMaxTime,F),t.b2_toiTime+=F}var xe=new j,Te=new j;function Ae(e,i,n,r,s){e.pointCount=0;var a=Q.MulXV(n,i.m_p,xe),o=Q.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 Ce=new j,De=new j,Be=new j;function Ie(e,i,n,s,a){e.pointCount=0;for(var o=Q.MulXV(a,s.m_p,Ce),h=Q.MulTXV(n,o,De),u=0,l=-1e37,c=i.m_radius+s.m_radius,f=i.m_count,_=i.m_vertices,d=i.m_normals,p=0;p<f;++p){var m=j.DotVV(d[p],j.SubVV(h,_[p],j.s_t0));if(m>c)return;m>l&&(l=m,u=p)}var g=u,y=(g+1)%f,v=_[g],b=_[y];if(l<r)return e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(d[u]),j.MidVV(v,b,e.localPoint),e.points[0].localPoint.Copy(s.m_p),void(e.points[0].id.key=0);var S=j.DotVV(j.SubVV(h,v,j.s_t0),j.SubVV(b,v,j.s_t1)),w=j.DotVV(j.SubVV(h,b,j.s_t0),j.SubVV(v,b,j.s_t1));if(S<=0){if(j.DistanceSquaredVV(h,v)>c*c)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,j.SubVV(h,v,e.localNormal).SelfNormalize(),e.localPoint.Copy(v),e.points[0].localPoint.Copy(s.m_p),e.points[0].id.key=0}else if(w<=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 x=j.MidVV(v,b,Be);if(j.DotVV(j.SubVV(h,x,j.s_t1),d[g])>c)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(d[g]).SelfNormalize(),e.localPoint.Copy(x),e.points[0].localPoint.Copy(s.m_p),e.points[0].id.key=0}}var Me=new j,Pe=new j,Ee=new j,Oe=new j;function ke(t,e,n,r,s){for(var a=t.m_vertices,o=t.m_normals,h=r.m_count,u=r.m_vertices,l=K.MulRV(e.q,o[n],Me),c=K.MulTRV(s.q,l,Pe),f=0,_=i,d=0;d<h;++d){var p=j.DotVV(u[d],c);p<_&&(_=p,f=d)}var m=Q.MulXV(e,a[n],Ee),g=Q.MulXV(s,u[f],Oe);return j.DotVV(j.SubVV(g,m,j.s_t0),l)}var Re=new j,Fe=new j;function Le(t,e,i,n,r){for(var s=e.m_count,a=e.m_normals,o=j.SubVV(Q.MulXV(r,n.m_centroid,j.s_t0),Q.MulXV(i,e.m_centroid,j.s_t1),Re),h=K.MulTRV(i.q,o,Fe),u=0,l=-1e37,c=0;c<s;++c){var f=j.DotVV(a[c],h);f>l&&(l=f,u=c)}var _=ke(e,i,u,n,r),d=(u+s-1)%s,p=ke(e,i,d,n,r),m=(u+1)%s,g=ke(e,i,m,n,r),y=0,v=0,b=0;if(p>_&&p>g)b=-1,y=d,v=p;else{if(!(g>_))return t[0]=u,_;b=1,y=m,v=g}for(;(_=ke(e,i,u=-1===b?(y+s-1)%s:(y+1)%s,n,r))>v;)y=u,v=_;return t[0]=y,v}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=K.MulTRV(o.q,K.MulRV(r.q,h[s],j.s_t0),Ve),_=0,d=i,p=0;p<u;++p){var m=j.DotVV(f,c[p]);m<d&&(d=m,_=p)}var g=_,y=(g+1)%u,v=e[0];Q.MulXV(o,l[g],v.v);var b=v.id.cf;b.indexA=s,b.indexB=g,b.typeA=t.b2ContactFeatureType.e_face,b.typeB=t.b2ContactFeatureType.e_vertex;var S=e[1];Q.MulXV(o,l[y],S.v);var w=S.id.cf;w.indexA=s,w.indexB=y,w.typeA=t.b2ContactFeatureType.e_face,w.typeB=t.b2ContactFeatureType.e_vertex}var ze=Ft.MakeArray(2),Ue=Ft.MakeArray(2),Ge=Ft.MakeArray(2),He=[0],We=[0],je=new j,qe=new j,Xe=new j,Ye=new j,Je=new j,Ke=new j,Qe=new j,Ze=new j;function $e(e,i,n,r,s){e.pointCount=0;var a=i.m_radius+r.m_radius,o=He;o[0]=0;var h=Le(o,i,n,r,s);if(!(h>a)){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,_=s,d=n,p=u[0],e.type=t.b2ManifoldType.e_faceB,m=1):(c=i,f=r,_=n,d=s,p=o[0],e.type=t.b2ManifoldType.e_faceA,m=0);var g=ze;Ne(g,c,_,p,f,d);var y=c.m_count,v=c.m_vertices,b=p,S=(p+1)%y,w=v[b],x=v[S],T=j.SubVV(x,w,je);T.Normalize();var A=j.CrossVOne(T,qe),C=j.MidVV(w,x,Xe),D=K.MulRV(_.q,T,Je),B=j.CrossVOne(D,Ye),I=Q.MulXV(_,w,Qe),M=Q.MulXV(_,x,Ze),P=j.DotVV(B,I),E=-j.DotVV(D,I)+a,O=j.DotVV(D,M)+a,k=Ue,R=Ge;if(!(Ut(k,g,j.NegV(D,Ke),E,b)<2||Ut(R,k,D,O,S)<2)){e.localNormal.Copy(A),e.localPoint.Copy(C);for(var F=0,L=0;L<2;++L){var V=R[L];if(j.DotVV(B,V.v)-P<=a){var N=e.points[F];if(Q.MulTXV(d,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=Q.MulTXV(n,Q.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,_=hi;if(_.cf.indexB=0,_.cf.typeB=t.b2ContactFeatureType.e_vertex,c<=0){var d=o,p=j.SubVV(a,d,ni);if(j.DotVV(p,p)>f*f)return;if(i.m_hasVertex0){var m=i.m_vertex0,g=o,y=j.SubVV(g,m,ri);if(j.DotVV(y,j.SubVV(g,a,j.s_t0))>0)return}return _.cf.indexA=0,_.cf.typeA=t.b2ContactFeatureType.e_vertex,e.pointCount=1,e.type=t.b2ManifoldType.e_circles,e.localNormal.SetZero(),e.localPoint.Copy(d),e.points[0].id.Copy(_),void e.points[0].localPoint.Copy(r.m_p)}if(l<=0){var v=h,b=j.SubVV(a,v,ni);if(j.DotVV(b,b)>f*f)return;if(i.m_hasVertex3){var S=i.m_vertex3,w=h,x=j.SubVV(S,w,si);if(j.DotVV(x,j.SubVV(a,w,j.s_t0))>0)return}return _.cf.indexA=1,_.cf.typeA=t.b2ContactFeatureType.e_vertex,e.pointCount=1,e.type=t.b2ManifoldType.e_circles,e.localNormal.SetZero(),e.localPoint.Copy(v),e.points[0].id.Copy(_),void e.points[0].localPoint.Copy(r.m_p)}var T=j.DotVV(u,u),A=ai;A.x=1/T*(l*o.x+c*h.x),A.y=1/T*(l*o.y+c*h.y);var C=j.SubVV(a,A,ni);if(!(j.DotVV(C,C)>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(),_.cf.indexA=0,_.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(_),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 _i=function(){function e(){this.m_polygonB=new fi,this.m_xf=new Q,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){Q.MulTXX(r,a,this.m_xf),Q.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,_=!1,d=!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),_=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),d=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())):_?(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())):d?(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?_?(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?d?(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;g<s.m_count;++g)this.m_polygonB.vertices.length<=g&&this.m_polygonB.vertices.push(new j),this.m_polygonB.normals.length<=g&&this.m_polygonB.normals.push(new j),Q.MulXV(this.m_xf,s.m_vertices[g],this.m_polygonB.vertices[g]),K.MulRV(this.m_xf.q,s.m_normals[g],this.m_polygonB.normals[g]);this.m_radius=s.m_radius+n.m_radius,i.pointCount=0;var y=this.ComputeEdgeSeparation(e.s_edgeAxis);if(y.type!==ti.e_unknown&&!(y.separation>this.m_radius)){var v=this.ComputePolygonSeparation(e.s_polygonAxis);if(!(v.type!==ti.e_unknown&&v.separation>this.m_radius)){var b;b=v.type===ti.e_unknown?y:v.separation>.98*y.separation+.001?v:y;var S=e.s_ie,w=e.s_rf;if(b.type===ti.e_edgeA){i.type=t.b2ManifoldType.e_faceA;for(var x=0,T=j.DotVV(this.m_normal,this.m_polygonB.normals[0]),A=1;A<this.m_polygonB.count;++A){var C=j.DotVV(this.m_normal,this.m_polygonB.normals[A]);C<T&&(T=C,x=A)}var D=x,B=(D+1)%this.m_polygonB.count,I=S[0];I.v.Copy(this.m_polygonB.vertices[D]),I.id.cf.indexA=0,I.id.cf.indexB=D,I.id.cf.typeA=t.b2ContactFeatureType.e_face,I.id.cf.typeB=t.b2ContactFeatureType.e_vertex;var M=S[1];M.v.Copy(this.m_polygonB.vertices[B]),M.id.cf.indexA=0,M.id.cf.indexB=B,M.id.cf.typeA=t.b2ContactFeatureType.e_face,M.id.cf.typeB=t.b2ContactFeatureType.e_vertex,this.m_front?(w.i1=0,w.i2=1,w.v1.Copy(this.m_v1),w.v2.Copy(this.m_v2),w.normal.Copy(this.m_normal1)):(w.i1=1,w.i2=0,w.v1.Copy(this.m_v2),w.v2.Copy(this.m_v1),w.normal.Copy(this.m_normal1).SelfNeg())}else{i.type=t.b2ManifoldType.e_faceB;var P=S[0];P.v.Copy(this.m_v1),P.id.cf.indexA=0,P.id.cf.indexB=b.index,P.id.cf.typeA=t.b2ContactFeatureType.e_vertex,P.id.cf.typeB=t.b2ContactFeatureType.e_face;var E=S[1];E.v.Copy(this.m_v2),E.id.cf.indexA=0,E.id.cf.indexB=b.index,E.id.cf.typeA=t.b2ContactFeatureType.e_vertex,E.id.cf.typeB=t.b2ContactFeatureType.e_face,w.i1=b.index,w.i2=(w.i1+1)%this.m_polygonB.count,w.v1.Copy(this.m_polygonB.vertices[w.i1]),w.v2.Copy(this.m_polygonB.vertices[w.i2]),w.normal.Copy(this.m_polygonB.normals[w.i1])}w.sideNormal1.Set(w.normal.y,-w.normal.x),w.sideNormal2.Copy(w.sideNormal1).SelfNeg(),w.sideOffset1=j.DotVV(w.sideNormal1,w.v1),w.sideOffset2=j.DotVV(w.sideNormal2,w.v2);var O=e.s_clipPoints1,k=e.s_clipPoints2;if(!(Ut(O,S,w.sideNormal1,w.sideOffset1,w.i1)<2||Ut(k,O,w.sideNormal2,w.sideOffset2,w.i2)<2)){b.type===ti.e_edgeA?(i.localNormal.Copy(w.normal),i.localPoint.Copy(w.v1)):(i.localNormal.Copy(s.m_normals[w.i1]),i.localPoint.Copy(s.m_vertices[w.i1]));for(var R=0,F=0;F<2;++F)if(j.DotVV(w.normal,j.SubVV(k[F].v,w.v1,j.s_t0))<=this.m_radius){var L=i.points[R];b.type===ti.e_edgeA?(Q.MulTXV(this.m_xf,k[F].v,L.localPoint),L.id.Copy(k[F].id)):(L.localPoint.Copy(k[F].v),L.id.cf.typeA=k[F].id.cf.typeB,L.id.cf.typeB=k[F].id.cf.typeA,L.id.cf.indexA=k[F].id.cf.indexB,L.id.cf.indexB=k[F].id.cf.indexA),++R}i.pointCount=R}}}},n.ComputeEdgeSeparation=function(t){var e=t;e.type=ti.e_edgeA,e.index=this.m_front?0:1,e.separation=i;for(var n=0;n<this.m_polygonB.count;++n){var r=j.DotVV(this.m_normal,j.SubVV(this.m_polygonB.vertices[n],this.m_v1,j.s_t0));r<e.separation&&(e.separation=r)}return e},n.ComputePolygonSeparation=function(t){var i=t;i.type=ti.e_unknown,i.index=-1,i.separation=-1e37;for(var n=e.s_perp.Set(-this.m_normal.y,this.m_normal.x),r=0;r<this.m_polygonB.count;++r){var s=j.NegV(this.m_polygonB.normals[r],e.s_n),a=E(j.DotVV(s,j.SubVV(this.m_polygonB.vertices[r],this.m_v1,j.s_t0)),j.DotVV(s,j.SubVV(this.m_polygonB.vertices[r],this.m_v2,j.s_t0)));if(a>this.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}();_i.s_edge1=new j,_i.s_edge0=new j,_i.s_edge2=new j,_i.s_ie=Ft.MakeArray(2),_i.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},_i.s_clipPoints1=Ft.MakeArray(2),_i.s_clipPoints2=Ft.MakeArray(2),_i.s_edgeAxis=new ci,_i.s_polygonAxis=new ci,_i.s_n=new j,_i.s_perp=new j;var di=new _i;function pi(t,e,i,n,r){di.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 yi=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}(),vi=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=Q.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=Q.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=Q.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||l<r)return!1;var f=-(u+V(c));return 0<=f&&f<=e.maxFraction*l&&(f/=l,t.fraction=f,j.AddVMulSV(a,f,h,t.normal).SelfNormalize(),!0)},n.ComputeAABB=function(t,e){var n=Q.MulXV(e,this.m_p,i.ComputeAABB_s_p);t.lowerBound.Set(n.x-this.m_radius,n.y-this.m_radius),t.upperBound.Set(n.x+this.m_radius,n.y+this.m_radius)},n.ComputeMass=function(t,e){var i=F(this.m_radius);t.mass=e*o*i,t.center.Copy(this.m_p),t.I=t.mass*(.5*i+j.DotVV(this.m_p,this.m_p))},n.SetupDistanceProxy=function(t){t.m_vertices=t.m_buffer,t.m_vertices[0].Copy(this.m_p),t.m_count=1,t.m_radius=this.m_radius},n.ComputeSubmergedArea=function(t,e,i,n){var s=Q.MulXV(i,this.m_p,new j),a=-(j.DotVV(t,s)-e);if(a<-this.m_radius+r)return 0;if(a>this.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}(yi);vi.TestPoint_s_center=new j,vi.TestPoint_s_d=new j,vi.ComputeDistance_s_center=new j,vi.RayCast_s_position=new j,vi.RayCast_s_s=new j,vi.RayCast_s_r=new j,vi.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;i<this.m_count;++i)this.m_vertices[i].Copy(t.m_vertices[i]),this.m_normals[i].Copy(t.m_normals[i]);return this},n.GetChildCount=function(){return 1},n.Set=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];if("number"==typeof e[0][0]){var n=e[0];if(n.length%2!=0)throw new Error;return this._Set((function(t){return{x:n[2*t],y:n[2*t+1]}}),n.length/2)}var r=e[0],s=e[1]||r.length;return this._Set((function(t){return r[t]}),s)},n._Set=function(t,e){if(e<3)return this.SetAsBox(1,1);for(var n=e,r=[],s=0;s<n;++s){for(var a=t(s),o=!0,h=0;h<r.length;++h)if(j.DistanceSquaredVV(a,r[h])<16e-6){o=!1;break}o&&r.push(a)}if((n=r.length)<3)return this.SetAsBox(1,1);for(var u=0,l=r[0].x,c=1;c<n;++c){var f=r[c].x;(f>l||f===l&&r[c].y<r[u].y)&&(u=c,l=f)}for(var _=[],d=0,p=u;;){_[d]=p;for(var m=0,g=1;g<n;++g)if(m!==p){var y=j.SubVV(r[m],r[_[d]],i.Set_s_r),v=j.SubVV(r[g],r[_[d]],i.Set_s_v),b=j.CrossVV(y,v);b<0&&(m=g),0===b&&v.LengthSquared()>y.LengthSquared()&&(m=g)}else m=g;if(++d,p=m,m===u)break}this.m_count=d,this.m_vertices=j.MakeArray(this.m_count),this.m_normals=j.MakeArray(this.m_count);for(var S=0;S<d;++S)this.m_vertices[S].Copy(r[_[S]]);for(var w=0;w<d;++w){var x=this.m_vertices[w],T=this.m_vertices[(w+1)%d],A=j.SubVV(T,x,j.s_t0);j.CrossVOne(A,this.m_normals[w]).SelfNormalize()}return i.ComputeCentroid(this.m_vertices,d,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 Q;r.SetPosition(i),r.SetRotationAngle(n);for(var s=0;s<this.m_count;++s)Q.MulXV(r,this.m_vertices[s],this.m_vertices[s]),K.MulRV(r.q,this.m_normals[s],this.m_normals[s])}return this},n.TestPoint=function(t,e){for(var n=Q.MulTXV(t,e,i.TestPoint_s_pLocal),r=0;r<this.m_count;++r)if(j.DotVV(this.m_normals[r],j.SubVV(n,this.m_vertices[r],j.s_t0))>0)return!1;return!0},n.ComputeDistance=function(t,e,n){for(var r=Q.MulTXV(t,e,i.ComputeDistance_s_pLocal),s=-1e37,a=i.ComputeDistance_s_normalForMaxDistance.Copy(r),o=0;o<this.m_count;++o){var h=j.DotVV(this.m_normals[o],j.SubVV(r,this.m_vertices[o],j.s_t0));h>s&&(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;c<this.m_count;++c){var f=j.SubVV(r,this.m_vertices[c],i.ComputeDistance_s_distance),_=f.LengthSquared();l>_&&(u.Copy(f),l=_)}return K.MulRV(t.q,u,n),n.Normalize(),Math.sqrt(l)}return K.MulRV(t.q,a,n),s},n.RayCast=function(t,e,n){for(var r=Q.MulTXV(n,e.p1,i.RayCast_s_p1),s=Q.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;l<this.m_count;++l){var c=j.DotVV(this.m_normals[l],j.SubVV(this.m_vertices[l],r,j.s_t0)),f=j.DotVV(this.m_normals[l],a);if(0===f){if(c<0)return!1}else f<0&&c<o*f?(o=c/f,u=l):f>0&&c<h*f&&(h=c/f);if(h<o)return!1}return u>=0&&(t.fraction=o,K.MulRV(n.q,this.m_normals[u],t.normal),!0)},n.ComputeAABB=function(t,e){for(var n=Q.MulXV(e,this.m_vertices[0],t.lowerBound),r=t.upperBound.Copy(n),s=0;s<this.m_count;++s){var a=Q.MulXV(e,this.m_vertices[s],i.ComputeAABB_s_v);j.MinV(a,n,n),j.MaxV(a,r,r)}var o=this.m_radius;n.SelfSubXY(o,o),r.SelfAddXY(o,o)},n.ComputeMass=function(t,e){for(var n=i.ComputeMass_s_center.SetZero(),r=0,s=0,a=i.ComputeMass_s_s.SetZero(),o=0;o<this.m_count;++o)a.SelfAdd(this.m_vertices[o]);a.SelfMul(1/this.m_count);for(var h=1/3,u=0;u<this.m_count;++u){var l=j.SubVV(this.m_vertices[u],a,i.ComputeMass_s_e1),c=j.SubVV(this.m_vertices[(u+1)%this.m_count],a,i.ComputeMass_s_e2),f=j.CrossVV(l,c),_=.5*f;r+=_,n.SelfAdd(j.MulSV(_*h,j.AddVV(l,c,j.s_t0),j.s_t1));var d=l.x,p=l.y,m=c.x,g=c.y;s+=.25*h*f*(d*d+m*d+m*m+p*p+g*p+g*g)}t.mass=e*r,n.SelfMul(1/r),j.AddVV(n,a,t.center),t.I=e*s,t.I+=t.mass*(j.DotVV(t.center,t.center)-j.DotVV(n,n))},n.Validate=function(){for(var t=0;t<this.m_count;++t)for(var e=t,n=(t+1)%this.m_count,r=this.m_vertices[e],s=j.SubVV(this.m_vertices[n],r,i.Validate_s_e),a=0;a<this.m_count;++a)if(a!==e&&a!==n){var o=j.SubVV(this.m_vertices[a],r,i.Validate_s_v);if(j.CrossVV(s,o)<0)return!1}return!0},n.SetupDistanceProxy=function(t){t.m_vertices=this.m_vertices,t.m_count=this.m_count,t.m_radius=this.m_radius},n.ComputeSubmergedArea=function(t,e,n,r){for(var s=K.MulTRV(n.q,t,i.ComputeSubmergedArea_s_normalL),a=e-j.DotVV(t,n.p),o=[],h=0,u=-1,l=-1,c=!1,f=0;f<this.m_count;++f){o[f]=j.DotVV(s,this.m_vertices[f])-a;var _=o[f]<-1e-5;f>0&&(_?c||(u=f-1,h++):c&&(l=f-1,h++)),c=_}switch(h){case 0:if(c){var d=i.ComputeSubmergedArea_s_md;return this.ComputeMass(d,1),Q.MulXV(n,d.center,r),d.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,y=(0-o[u])/(o[m]-o[u]),v=(0-o[l])/(o[g]-o[l]),b=i.ComputeSubmergedArea_s_intoVec.Set(this.m_vertices[u].x*(1-y)+this.m_vertices[m].x*y,this.m_vertices[u].y*(1-y)+this.m_vertices[m].y*y),S=i.ComputeSubmergedArea_s_outoVec.Set(this.m_vertices[l].x*(1-v)+this.m_vertices[g].x*v,this.m_vertices[l].y*(1-v)+this.m_vertices[g].y*v),w=0,x=i.ComputeSubmergedArea_s_center.SetZero(),T=this.m_vertices[m],A=m;A!==g;){p=(A=(A+1)%this.m_count)===g?S:this.m_vertices[A];var C=.5*((T.x-b.x)*(p.y-b.y)-(T.y-b.y)*(p.x-b.x));w+=C,x.x+=C*(b.x+T.x+p.x)/3,x.y+=C*(b.y+T.y+p.y)/3,T=p}return x.SelfMul(1/w),Q.MulXV(n,x,r),w},n.Dump=function(t){t(" const shape: b2PolygonShape = new b2PolygonShape();\n"),t(" const vs: b2Vec2[] = [];\n");for(var e=0;e<this.m_count;++e)t(" vs[%d] = new b2Vec2(%.15f, %.15f);\n",e,this.m_vertices[e].x,this.m_vertices[e].y);t(" shape.Set(vs, %d);\n",this.m_count)},i.ComputeCentroid=function(t,e,n){var r=n;r.SetZero();for(var s=0,a=i.ComputeCentroid_s_pRef.SetZero(),o=1/3,h=0;h<e;++h){var u=a,l=t[h],c=t[(h+1)%e],f=j.SubVV(l,u,i.ComputeCentroid_s_e1),_=j.SubVV(c,u,i.ComputeCentroid_s_e2),d=.5*j.CrossVV(f,_);s+=d,r.x+=d*o*(u.x+l.x+c.x),r.y+=d*o*(u.y+l.y+c.y)}return r.SelfMul(1/s),r},i}(yi);bi.Set_s_r=new j,bi.Set_s_v=new j,bi.TestPoint_s_pLocal=new j,bi.ComputeDistance_s_pLocal=new j,bi.ComputeDistance_s_normalForMaxDistance=new j,bi.ComputeDistance_s_minDistance=new j,bi.ComputeDistance_s_distance=new j,bi.RayCast_s_p1=new j,bi.RayCast_s_p2=new j,bi.RayCast_s_d=new j,bi.ComputeAABB_s_v=new j,bi.ComputeMass_s_center=new j,bi.ComputeMass_s_s=new j,bi.ComputeMass_s_e1=new j,bi.ComputeMass_s_e2=new j,bi.Validate_s_e=new j,bi.Validate_s_v=new j,bi.ComputeSubmergedArea_s_normalL=new j,bi.ComputeSubmergedArea_s_md=new gi,bi.ComputeSubmergedArea_s_intoVec=new j,bi.ComputeSubmergedArea_s_outoVec=new j,bi.ComputeSubmergedArea_s_center=new j,bi.ComputeCentroid_s_pRef=new j,bi.ComputeCentroid_s_e1=new j,bi.ComputeCentroid_s_e2=new j;var Si=function(e){function i(){var i;return(i=e.call(this,t.b2ShapeType.e_edgeShape,f)||this).m_vertex1=new j,i.m_vertex2=new j,i.m_vertex0=new j,i.m_vertex3=new j,i.m_hasVertex0=!1,i.m_hasVertex3=!1,i}s(i,e);var n=i.prototype;return n.Set=function(t,e){return this.m_vertex1.Copy(t),this.m_vertex2.Copy(e),this.m_hasVertex0=!1,this.m_hasVertex3=!1,this},n.Clone=function(){return(new i).Copy(this)},n.Copy=function(t){return e.prototype.Copy.call(this,t),this.m_vertex1.Copy(t.m_vertex1),this.m_vertex2.Copy(t.m_vertex2),this.m_vertex0.Copy(t.m_vertex0),this.m_vertex3.Copy(t.m_vertex3),this.m_hasVertex0=t.m_hasVertex0,this.m_hasVertex3=t.m_hasVertex3,this},n.GetChildCount=function(){return 1},n.TestPoint=function(){return!1},n.ComputeDistance=function(t,e,n){var r=Q.MulXV(t,this.m_vertex1,i.ComputeDistance_s_v1),s=Q.MulXV(t,this.m_vertex2,i.ComputeDistance_s_v2),a=j.SubVV(e,r,i.ComputeDistance_s_d),o=j.SubVV(s,r,i.ComputeDistance_s_s),h=j.DotVV(a,o);if(h>0){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=Q.MulTXV(n,e.p1,i.RayCast_s_p1),s=Q.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 _=c/f;if(_<0||e.maxFraction<_)return!1;var d=j.AddVMulSV(r,_,a,i.RayCast_s_q),p=j.SubVV(h,o,i.RayCast_s_r),m=j.DotVV(p,p);if(0===m)return!1;var g=j.DotVV(j.SubVV(d,o,j.s_t0),p)/m;return!(g<0||1<g||(t.fraction=_,K.MulRV(n.q,t.normal,t.normal),c>0&&t.normal.SelfNeg(),0))},n.ComputeAABB=function(t,e){var n=Q.MulXV(e,this.m_vertex1,i.ComputeAABB_s_v1),r=Q.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}(yi);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 wi=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;i<t;i++)e[i]=arguments[i];if("number"==typeof e[0][0]){var n=e[0];if(n.length%2!=0)throw new Error;return this._CreateLoop((function(t){return{x:n[2*t],y:n[2*t+1]}}),n.length/2)}var r=e[0],s=e[1]||r.length;return this._CreateLoop((function(t){return r[t]}),s)},n._CreateLoop=function(t,e){if(e<3)return this;this.m_count=e+1,this.m_vertices=j.MakeArray(this.m_count);for(var i=0;i<e;++i)this.m_vertices[i].Copy(t(i));return this.m_vertices[e].Copy(this.m_vertices[0]),this.m_prevVertex.Copy(this.m_vertices[this.m_count-2]),this.m_nextVertex.Copy(this.m_vertices[1]),this.m_hasPrevVertex=!0,this.m_hasNextVertex=!0,this},n.CreateChain=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];if("number"==typeof e[0][0]){var n=e[0];if(n.length%2!=0)throw new Error;return this._CreateChain((function(t){return{x:n[2*t],y:n[2*t+1]}}),n.length/2)}var r=e[0],s=e[1]||r.length;return this._CreateChain((function(t){return r[t]}),s)},n._CreateChain=function(t,e){this.m_count=e,this.m_vertices=j.MakeArray(e);for(var i=0;i<e;++i)this.m_vertices[i].Copy(t(i));return this.m_hasPrevVertex=!1,this.m_hasNextVertex=!1,this.m_prevVertex.SetZero(),this.m_nextVertex.SetZero(),this},n.SetPrevVertex=function(t){return this.m_prevVertex.Copy(t),this.m_hasPrevVertex=!0,this},n.SetNextVertex=function(t){return this.m_nextVertex.Copy(t),this.m_hasNextVertex=!0,this},n.Clone=function(){return(new i).Copy(this)},n.Copy=function(t){return e.prototype.Copy.call(this,t),this._CreateChain((function(e){return t.m_vertices[e]}),t.m_count),this.m_prevVertex.Copy(t.m_prevVertex),this.m_nextVertex.Copy(t.m_nextVertex),this.m_hasPrevVertex=t.m_hasPrevVertex,this.m_hasNextVertex=t.m_hasNextVertex,this},n.GetChildCount=function(){return this.m_count-1},n.GetChildEdge=function(t,e){t.m_radius=this.m_radius,t.m_vertex1.Copy(this.m_vertices[e]),t.m_vertex2.Copy(this.m_vertices[e+1]),e>0?(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),e<this.m_count-2?(t.m_vertex3.Copy(this.m_vertices[e+2]),t.m_hasVertex3=!0):(t.m_vertex3.Copy(this.m_nextVertex),t.m_hasVertex3=this.m_hasNextVertex)},n.TestPoint=function(){return!1},n.ComputeDistance=function(t,e,n,r){var s=i.ComputeDistance_s_edgeShape;return this.GetChildEdge(s,r),s.ComputeDistance(t,e,n,0)},n.RayCast=function(t,e,n,r){var s=i.RayCast_s_edgeShape;return s.m_vertex1.Copy(this.m_vertices[r]),s.m_vertex2.Copy(this.m_vertices[(r+1)%this.m_count]),s.RayCast(t,e,n,0)},n.ComputeAABB=function(t,e,n){var r=this.m_vertices[n],s=this.m_vertices[(n+1)%this.m_count],a=Q.MulXV(e,r,i.ComputeAABB_s_v1),o=Q.MulXV(e,s,i.ComputeAABB_s_v2);j.MinV(a,o,t.lowerBound),j.MaxV(a,o,t.upperBound)},n.ComputeMass=function(t){t.mass=0,t.center.SetZero(),t.I=0},n.SetupDistanceProxy=function(t,e){t.m_vertices=t.m_buffer,t.m_vertices[0].Copy(this.m_vertices[e]),e+1<this.m_count?t.m_vertices[1].Copy(this.m_vertices[e+1]):t.m_vertices[1].Copy(this.m_vertices[0]),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: b2ChainShape = new b2ChainShape();\n"),t(" const vs: b2Vec2[] = [];\n");for(var e=0;e<this.m_count;++e)t(" vs[%d] = new bVec2(%.15f, %.15f);\n",e,this.m_vertices[e].x,this.m_vertices[e].y);t(" shape.CreateChain(vs, %d);\n",this.m_count),t(" shape.m_prevVertex.Set(%.15f, %.15f);\n",this.m_prevVertex.x,this.m_prevVertex.y),t(" shape.m_nextVertex.Set(%.15f, %.15f);\n",this.m_nextVertex.x,this.m_nextVertex.y),t(" shape.m_hasPrevVertex = %s;\n",this.m_hasPrevVertex?"true":"false"),t(" shape.m_hasNextVertex = %s;\n",this.m_hasNextVertex?"true":"false")},i}(yi);wi.ComputeDistance_s_edgeShape=new Si,wi.RayCast_s_edgeShape=new Si,wi.ComputeAABB_s_v1=new j,wi.ComputeAABB_s_v2=new j;var xi=function(){function t(){this.categoryBits=1,this.maskBits=65535,this.groupIndex=0}var e=t.prototype;return e.Clone=function(){return(new t).Copy(this)},e.Copy=function(t){return this.categoryBits=t.categoryBits,this.maskBits=t.maskBits,this.groupIndex=t.groupIndex||0,this},t}();xi.DEFAULT=new xi;var Ti=function(){this.userData=null,this.friction=.2,this.restitution=0,this.density=0,this.isSensor=!1,this.filter=new xi},Ai=function(){function t(t,e){this.aabb=new Nt,this.childIndex=0,this.fixture=t,this.childIndex=e,this.fixture.m_shape.ComputeAABB(this.aabb,this.fixture.m_body.GetTransform(),e),this.treeNode=this.fixture.m_body.m_world.m_contactManager.m_broadPhase.CreateProxy(this.aabb,this)}var e=t.prototype;return e.Reset=function(){this.fixture.m_body.m_world.m_contactManager.m_broadPhase.DestroyProxy(this.treeNode)},e.Touch=function(){this.fixture.m_body.m_world.m_contactManager.m_broadPhase.TouchProxy(this.treeNode)},e.Synchronize=function(e,i,n){if(e===i)this.fixture.m_shape.ComputeAABB(this.aabb,e,this.childIndex),this.fixture.m_body.m_world.m_contactManager.m_broadPhase.MoveProxy(this.treeNode,this.aabb,n);else{var r=t.Synchronize_s_aabb1,s=t.Synchronize_s_aabb2;this.fixture.m_shape.ComputeAABB(r,e,this.childIndex),this.fixture.m_shape.ComputeAABB(s,i,this.childIndex),this.aabb.Combine2(r,s),this.fixture.m_body.m_world.m_contactManager.m_broadPhase.MoveProxy(this.treeNode,this.aabb,n)}},t}();Ai.Synchronize_s_aabb1=new Nt,Ai.Synchronize_s_aabb2=new Nt;var Ci,Di=function(){function t(t,i){this.m_density=0,this.m_next=null,this.m_friction=0,this.m_restitution=0,this.m_proxies=[],this.m_filter=new xi,this.m_isSensor=!1,this.m_userData=null,this.m_body=t,this.m_shape=i.shape.Clone(),this.m_userData=e(i.userData,null),this.m_friction=e(i.friction,.2),this.m_restitution=e(i.restitution,0),this.m_filter.Copy(e(i.filter,xi.DEFAULT)),this.m_isSensor=e(i.isSensor,!1),this.m_density=e(i.density,0)}var i=t.prototype;return i.Reset=function(){},i.GetType=function(){return this.m_shape.GetType()},i.GetShape=function(){return this.m_shape},i.SetSensor=function(t){t!==this.m_isSensor&&(this.m_body.SetAwake(!0),this.m_isSensor=t)},i.IsSensor=function(){return this.m_isSensor},i.SetFilterData=function(t){this.m_filter.Copy(t),this.Refilter()},i.GetFilterData=function(){return this.m_filter},i.Refilter=function(){for(var t=this.m_body.GetContactList();t;){var e=t.contact,i=e.GetFixtureA(),n=e.GetFixtureB();i!==this&&n!==this||e.FlagForFiltering(),t=t.next}this.TouchProxies()},i.GetBody=function(){return this.m_body},i.GetNext=function(){return this.m_next},i.GetUserData=function(){return this.m_userData},i.SetUserData=function(t){this.m_userData=t},i.TestPoint=function(t){return this.m_shape.TestPoint(this.m_body.GetTransform(),t)},i.ComputeDistance=function(t,e,i){return this.m_shape.ComputeDistance(this.m_body.GetTransform(),t,e,i)},i.RayCast=function(t,e,i){return this.m_shape.RayCast(t,e,this.m_body.GetTransform(),i)},i.GetMassData=function(t){return void 0===t&&(t=new gi),this.m_shape.ComputeMass(t,this.m_density),t},i.SetDensity=function(t){this.m_density=t},i.GetDensity=function(){return this.m_density},i.GetFriction=function(){return this.m_friction},i.SetFriction=function(t){this.m_friction=t},i.GetRestitution=function(){return this.m_restitution},i.SetRestitution=function(t){this.m_restitution=t},i.GetAABB=function(t){return this.m_proxies[t].aabb},i.Dump=function(t,e){t(" const fd: b2FixtureDef = new b2FixtureDef();\n"),t(" fd.friction = %.15f;\n",this.m_friction),t(" fd.restitution = %.15f;\n",this.m_restitution),t(" fd.density = %.15f;\n",this.m_density),t(" fd.isSensor = %s;\n",this.m_isSensor?"true":"false"),t(" fd.filter.categoryBits = %d;\n",this.m_filter.categoryBits),t(" fd.filter.maskBits = %d;\n",this.m_filter.maskBits),t(" fd.filter.groupIndex = %d;\n",this.m_filter.groupIndex),this.m_shape.Dump(t),t("\n"),t(" fd.shape = shape;\n"),t("\n"),t(" bodies[%d].CreateFixture(fd);\n",e)},i.CreateProxies=function(){if(0!==this.m_proxies.length)throw new Error;for(var t=0;t<this.m_shape.GetChildCount();++t)this.m_proxies[t]=new Ai(this,t)},i.DestroyProxies=function(){for(var t,e=p(this.m_proxies);!(t=e()).done;)t.value.Reset();this.m_proxies.length=0},i.TouchProxies=function(){for(var t,e=p(this.m_proxies);!(t=e()).done;)t.value.Touch()},i.SynchronizeProxies=function(t,e,i){for(var n,r=p(this.m_proxies);!(n=r()).done;)n.value.Synchronize(t,e,i)},n(t,[{key:"m_proxyCount",get:function(){return this.m_proxies.length}}]),t}();(Ci=t.b2BodyType||(t.b2BodyType={}))[Ci.b2_unknown=-1]="b2_unknown",Ci[Ci.b2_staticBody=0]="b2_staticBody",Ci[Ci.b2_kinematicBody=1]="b2_kinematicBody",Ci[Ci.b2_dynamicBody=2]="b2_dynamicBody";var Bi,Ii,Mi=function(){function i(i,n){this.m_type=t.b2BodyType.b2_staticBody,this.m_islandFlag=!1,this.m_awakeFlag=!1,this.m_autoSleepFlag=!1,this.m_bulletFlag=!1,this.m_fixedRotationFlag=!1,this.m_activeFlag=!1,this.m_toiFlag=!1,this.m_islandIndex=0,this.m_xf=new Q,this.m_xf0=new Q,this.m_sweep=new $,this.m_linearVelocity=new j,this.m_angularVelocity=0,this.m_force=new j,this.m_torque=0,this.m_prev=null,this.m_next=null,this.m_fixtureList=null,this.m_fixtureCount=0,this.m_jointList=null,this.m_contactList=null,this.m_mass=1,this.m_invMass=1,this.m_I=0,this.m_invI=0,this.m_linearDamping=0,this.m_angularDamping=0,this.m_gravityScale=1,this.m_sleepTime=0,this.m_userData=null,this.m_controllerList=null,this.m_controllerCount=0,this.m_bulletFlag=e(i.bullet,!1),this.m_fixedRotationFlag=e(i.fixedRotation,!1),this.m_autoSleepFlag=e(i.allowSleep,!0),this.m_awakeFlag=e(i.awake,!0),this.m_activeFlag=e(i.active,!0),this.m_world=n,this.m_xf.p.Copy(e(i.position,j.ZERO)),this.m_xf.q.SetAngle(e(i.angle,0)),this.m_xf0.Copy(this.m_xf),this.m_sweep.localCenter.SetZero(),this.m_sweep.c0.Copy(this.m_xf.p),this.m_sweep.c.Copy(this.m_xf.p),this.m_sweep.a0=this.m_sweep.a=this.m_xf.q.GetAngle(),this.m_sweep.alpha0=0,this.m_linearVelocity.Copy(e(i.linearVelocity,j.ZERO)),this.m_angularVelocity=e(i.angularVelocity,0),this.m_linearDamping=e(i.linearDamping,0),this.m_angularDamping=e(i.angularDamping,0),this.m_gravityScale=e(i.gravityScale,1),this.m_force.SetZero(),this.m_torque=0,this.m_sleepTime=0,this.m_type=e(i.type,t.b2BodyType.b2_staticBody),i.type===t.b2BodyType.b2_dynamicBody?(this.m_mass=1,this.m_invMass=1):(this.m_mass=0,this.m_invMass=0),this.m_I=0,this.m_invI=0,this.m_userData=i.userData,this.m_fixtureList=null,this.m_fixtureCount=0,this.m_controllerList=null,this.m_controllerCount=0}var n=i.prototype;return n.CreateFixture=function(t,e){return void 0===e&&(e=0),t instanceof yi?this.CreateFixtureShapeDensity(t,e):this.CreateFixtureDef(t)},n.CreateFixtureDef=function(t){if(this.m_world.IsLocked())throw new Error;var e=new Di(this,t);return this.m_activeFlag&&e.CreateProxies(),e.m_next=this.m_fixtureList,this.m_fixtureList=e,++this.m_fixtureCount,e.m_density>0&&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),Q.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),Q.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),Q.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 Q.MulXV(this.m_xf,t,e)},n.GetWorldVector=function(t,e){return K.MulRV(this.m_xf.q,t,e)},n.GetLocalPoint=function(t,e){return Q.MulTXV(this.m_xf,t,e)},n.GetLocalVector=function(t,e){return K.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),K.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),K.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),K.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 Q,Mi.SynchronizeFixtures_s_displacement=new j,(Ii=t.b2JointType||(t.b2JointType={}))[Ii.e_unknownJoint=0]="e_unknownJoint",Ii[Ii.e_revoluteJoint=1]="e_revoluteJoint",Ii[Ii.e_prismaticJoint=2]="e_prismaticJoint",Ii[Ii.e_distanceJoint=3]="e_distanceJoint",Ii[Ii.e_pulleyJoint=4]="e_pulleyJoint",Ii[Ii.e_mouseJoint=5]="e_mouseJoint",Ii[Ii.e_gearJoint=6]="e_gearJoint",Ii[Ii.e_wheelJoint=7]="e_wheelJoint",Ii[Ii.e_weldJoint=8]="e_weldJoint",Ii[Ii.e_frictionJoint=9]="e_frictionJoint",Ii[Ii.e_ropeJoint=10]="e_ropeJoint",Ii[Ii.e_motorJoint=11]="e_motorJoint",Ii[Ii.e_areaJoint=12]="e_areaJoint",(Bi=t.b2LimitState||(t.b2LimitState={}))[Bi.e_inactiveLimit=0]="e_inactiveLimit",Bi[Bi.e_atLowerLimit=1]="e_atLowerLimit",Bi[Bi.e_atUpperLimit=2]="e_atUpperLimit",Bi[Bi.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}(),Oi=function(e){this.type=t.b2JointType.e_unknownJoint,this.userData=null,this.collideConnected=!1,this.type=e},ki=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}(),Ri=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}(Oi),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 K,n.m_qB=new K,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),_=this.m_qB.SetAngle(h);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),K.MulRV(f,this.m_lalcA,this.m_rA),j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),K.MulRV(_,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 d=this.m_u.Length();d>l?this.m_u.SelfMul(1/d):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 y=d-this.m_length,v=2*o*this.m_frequencyHz,b=2*this.m_mass*this.m_dampingRatio*v,S=this.m_mass*v*v,w=t.step.dt;this.m_gamma=w*(b+w*S),this.m_gamma=0!==this.m_gamma?1/this.m_gamma:0,this.m_bias=y*w*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 x=j.MulSV(this.m_impulse,this.m_u,i.InitVelocityConstraints_s_P);r.SelfMulSub(this.m_invMassA,x),s-=this.m_invIA*j.CrossVV(this.m_rA,x),u.SelfMulAdd(this.m_invMassB,x),c+=this.m_invIB*j.CrossVV(this.m_rB,x)}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=K.MulRV(a,this.m_lalcA,this.m_rA),u=K.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=k(f,-.2,_);var d=-this.m_mass*f,p=j.MulSV(d,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)<l},i}(ki);Fi.InitVelocityConstraints_s_P=new j,Fi.SolveVelocityConstraints_s_vpA=new j,Fi.SolveVelocityConstraints_s_vpB=new j,Fi.SolveVelocityConstraints_s_P=new j,Fi.SolvePositionConstraints_s_P=new j;var Li=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_areaJoint)||this).bodies=[],i.frequencyHz=0,i.dampingRatio=0,i}return s(i,e),i.prototype.AddBody=function(t){this.bodies.push(t),1===this.bodies.length?this.bodyA=t:2===this.bodies.length&&(this.bodyB=t)},i}(Oi),Vi=function(t){function i(i){var n;(n=t.call(this,i)||this).m_frequencyHz=0,n.m_dampingRatio=0,n.m_impulse=0,n.m_targetArea=0,n.m_delta=new j,n.m_bodies=i.bodies,n.m_frequencyHz=e(i.frequencyHz,0),n.m_dampingRatio=e(i.dampingRatio,0),n.m_targetLengths=D(i.bodies.length),n.m_normals=j.MakeArray(i.bodies.length),n.m_joints=[],n.m_deltas=j.MakeArray(i.bodies.length);var r=new Ri;r.frequencyHz=n.m_frequencyHz,r.dampingRatio=n.m_dampingRatio,n.m_targetArea=0;for(var s=0;s<n.m_bodies.length;++s){var a=n.m_bodies[s],o=n.m_bodies[(s+1)%n.m_bodies.length],h=a.GetWorldCenter(),u=o.GetWorldCenter();n.m_targetLengths[s]=j.DistanceVV(h,u),n.m_targetArea+=j.CrossVV(h,u),r.Initialize(a,o,h,u),n.m_joints[s]=a.GetWorld().CreateJoint(r)}return n.m_targetArea*=.5,n}s(i,t);var n=i.prototype;return n.GetAnchorA=function(t){return t},n.GetAnchorB=function(t){return t},n.GetReactionForce=function(t,e){return e},n.GetReactionTorque=function(){return 0},n.SetFrequency=function(t){this.m_frequencyHz=t;for(var e=0;e<this.m_joints.length;++e)this.m_joints[e].SetFrequency(t)},n.GetFrequency=function(){return this.m_frequencyHz},n.SetDampingRatio=function(t){this.m_dampingRatio=t;for(var e=0;e<this.m_joints.length;++e)this.m_joints[e].SetDampingRatio(t)},n.GetDampingRatio=function(){return this.m_dampingRatio},n.Dump=function(t){t("Area joint dumping is not supported.\n")},n.InitVelocityConstraints=function(t){for(var e=0;e<this.m_bodies.length;++e){var i=this.m_bodies[(e+this.m_bodies.length-1)%this.m_bodies.length],n=this.m_bodies[(e+1)%this.m_bodies.length],r=t.positions[i.m_islandIndex].c,s=t.positions[n.m_islandIndex].c,a=this.m_deltas[e];j.SubVV(s,r,a)}if(t.step.warmStarting){this.m_impulse*=t.step.dtRatio;for(var o=0;o<this.m_bodies.length;++o){var h=this.m_bodies[o],u=t.velocities[h.m_islandIndex].v,l=this.m_deltas[o];u.x+=h.m_invMass*l.y*.5*this.m_impulse,u.y+=h.m_invMass*-l.x*.5*this.m_impulse}}else this.m_impulse=0},n.SolveVelocityConstraints=function(t){for(var e=0,i=0,n=0;n<this.m_bodies.length;++n){var r=this.m_bodies[n],s=t.velocities[r.m_islandIndex].v,a=this.m_deltas[n];e+=a.LengthSquared()/r.GetMass(),i+=j.CrossVV(s,a)}var o=-2*i/e;this.m_impulse+=o;for(var h=0;h<this.m_bodies.length;++h){var u=this.m_bodies[h],l=t.velocities[u.m_islandIndex].v,c=this.m_deltas[h];l.x+=u.m_invMass*c.y*.5*o,l.y+=u.m_invMass*-c.x*.5*o}},n.SolvePositionConstraints=function(t){for(var e=0,i=0,n=0;n<this.m_bodies.length;++n){var s=this.m_bodies[n],a=this.m_bodies[(n+1)%this.m_bodies.length],o=t.positions[s.m_islandIndex].c,h=t.positions[a.m_islandIndex].c,u=j.SubVV(h,o,this.m_delta),c=u.Length();c<r&&(c=1),this.m_normals[n].x=u.y/c,this.m_normals[n].y=-u.x/c,e+=c,i+=j.CrossVV(o,h)}i*=.5;for(var f=.5*(this.m_targetArea-i)/e,d=!0,p=0;p<this.m_bodies.length;++p){var m=this.m_bodies[p],g=t.positions[m.m_islandIndex].c,y=(p+1)%this.m_bodies.length,v=j.AddVV(this.m_normals[p],this.m_normals[y],this.m_delta);v.SelfMul(f);var b=v.LengthSquared();b>F(_)&&v.SelfMul(_/V(b)),b>F(l)&&(d=!1),g.x+=v.x,g.y+=v.y}return d},i}(ki),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}(Oi),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 K,n.m_qB=new K,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=K.MulRV(o,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var l=K.MulRV(h,this.m_lalcB,this.m_rB),c=this.m_invMassA,f=this.m_invMassB,_=this.m_invIA,d=this.m_invIB,p=this.m_K;if(p.ex.x=c+f+_*u.y*u.y+d*l.y*l.y,p.ex.y=-_*u.x*u.y-d*l.x*l.y,p.ey.x=p.ex.y,p.ey.y=c+f+_*u.x*u.x+d*l.x*l.x,p.GetInverse(this.m_linearMass),this.m_angularMass=_+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-=_*(j.CrossVV(this.m_rA,m)+this.m_angularImpulse),s.SelfMulAdd(f,m),a+=d*(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,_=this.m_angularImpulse,d=l*this.m_maxTorque;this.m_angularImpulse=k(this.m_angularImpulse+f,-d,d),n-=h*(f=this.m_angularImpulse-_),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 y=l*this.m_maxForce;this.m_linearImpulse.LengthSquared()>y*y&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.SelfMul(y)),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}(ki);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}(Oi),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 K,r.m_qB=new K,r.m_qC=new K,r.m_qD=new K,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 _=r.m_localAnchorC,d=K.MulTRV(u.q,j.AddVV(K.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,y=r.m_bodyD.m_sweep.a;if(r.m_typeB===t.b2JointType.e_revoluteJoint){var v=n.joint2;r.m_localAnchorD.Copy(v.m_localAnchorA),r.m_localAnchorB.Copy(v.m_localAnchorB),r.m_referenceAngleB=v.m_referenceAngle,r.m_localAxisD.SetZero(),a=m-y-r.m_referenceAngleB}else{var 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,w=K.MulTRV(g.q,j.AddVV(K.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(w,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,_=e.velocities[this.m_indexD].v,d=e.velocities[this.m_indexD].w,p=this.m_qA.SetAngle(i),m=this.m_qB.SetAngle(a),g=this.m_qC.SetAngle(u),y=this.m_qD.SetAngle(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 v=K.MulRV(g,this.m_localAxisC,n.InitVelocityConstraints_s_u);j.SubVV(this.m_localAnchorC,this.m_lcC,this.m_lalcC);var b=K.MulRV(g,this.m_lalcC,n.InitVelocityConstraints_s_rC);j.SubVV(this.m_localAnchorA,this.m_lcA,this.m_lalcA);var S=K.MulRV(p,this.m_lalcA,n.InitVelocityConstraints_s_rA);this.m_JvAC.Copy(v),this.m_JwC=j.CrossVV(b,v),this.m_JwA=j.CrossVV(S,v),this.m_mass+=this.m_mC+this.m_mA+this.m_iC*this.m_JwC*this.m_JwC+this.m_iA*this.m_JwA*this.m_JwA}if(this.m_typeB===t.b2JointType.e_revoluteJoint)this.m_JvBD.SetZero(),this.m_JwB=this.m_ratio,this.m_JwD=this.m_ratio,this.m_mass+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD);else{var w=K.MulRV(y,this.m_localAxisD,n.InitVelocityConstraints_s_u);j.SubVV(this.m_localAnchorD,this.m_lcD,this.m_lalcD);var x=K.MulRV(y,this.m_lalcD,n.InitVelocityConstraints_s_rD);j.SubVV(this.m_localAnchorB,this.m_lcB,this.m_lalcB);var T=K.MulRV(m,this.m_lalcB,n.InitVelocityConstraints_s_rB);j.MulSV(this.m_ratio,w,this.m_JvBD),this.m_JwD=this.m_ratio*j.CrossVV(x,w),this.m_JwB=this.m_ratio*j.CrossVV(T,w),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,_.SelfMulSub(this.m_mD*this.m_impulse,this.m_JvBD),d-=this.m_iD*this.m_impulse*this.m_JwD):this.m_impulse=0,e.velocities[this.m_indexA].w=s,e.velocities[this.m_indexB].w=h,e.velocities[this.m_indexC].w=c,e.velocities[this.m_indexD].w=d},r.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,i=t.velocities[this.m_indexA].w,n=t.velocities[this.m_indexB].v,r=t.velocities[this.m_indexB].w,s=t.velocities[this.m_indexC].v,a=t.velocities[this.m_indexC].w,o=t.velocities[this.m_indexD].v,h=t.velocities[this.m_indexD].w,u=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,_=e.positions[this.m_indexC].c,d=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),y=this.m_qB.SetAngle(f),v=this.m_qC.SetAngle(d),b=this.m_qD.SetAngle(m),S=this.m_JvAC,w=this.m_JvBD,x=0;if(this.m_typeA===t.b2JointType.e_revoluteJoint)S.SetZero(),s=1,o=1,x+=this.m_iA+this.m_iC,i=l-d-this.m_referenceAngleA;else{var T=K.MulRV(v,this.m_localAxisC,n.SolvePositionConstraints_s_u),A=K.MulRV(v,this.m_lalcC,n.SolvePositionConstraints_s_rC),C=K.MulRV(g,this.m_lalcA,n.SolvePositionConstraints_s_rA);S.Copy(T),o=j.CrossVV(A,T),s=j.CrossVV(C,T),x+=this.m_mC+this.m_mA+this.m_iC*o*o+this.m_iA*s*s;var D=this.m_lalcC,B=K.MulTRV(v,j.AddVV(C,j.SubVV(u,_,j.s_t0),j.s_t0),j.s_t0);i=j.DotVV(j.SubVV(B,D,j.s_t0),this.m_localAxisC)}if(this.m_typeB===t.b2JointType.e_revoluteJoint)w.SetZero(),a=this.m_ratio,h=this.m_ratio,x+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD),r=f-m-this.m_referenceAngleB;else{var I=K.MulRV(b,this.m_localAxisD,n.SolvePositionConstraints_s_u),M=K.MulRV(b,this.m_lalcD,n.SolvePositionConstraints_s_rD),P=K.MulRV(y,this.m_lalcB,n.SolvePositionConstraints_s_rB);j.MulSV(this.m_ratio,I,w),h=this.m_ratio*j.CrossVV(M,I),a=this.m_ratio*j.CrossVV(P,I),x+=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,O=K.MulTRV(b,j.AddVV(P,j.SubVV(c,p,j.s_t0),j.s_t0),j.s_t0);r=j.DotVV(j.SubVV(O,E,j.s_t0),this.m_localAxisD)}var k=i+this.m_ratio*r-this.m_constant,R=0;return x>0&&(R=-k/x),u.SelfMulAdd(this.m_mA*R,S),l+=this.m_iA*R*s,c.SelfMulAdd(this.m_mB*R,w),f+=this.m_iB*R*a,_.SelfMulSub(this.m_mC*R,S),d-=this.m_iC*R*o,p.SelfMulSub(this.m_mD*R,w),m-=this.m_iD*R*h,e.positions[this.m_indexA].a=l,e.positions[this.m_indexB].a=f,e.positions[this.m_indexC].a=d,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}(ki);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}(Oi),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 K,n.m_qB=new K,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=K.MulRV(u,j.SubVV(this.m_linearOffset,this.m_localCenterA,j.s_t0),this.m_rA),f=K.MulRV(l,j.NegV(this.m_localCenterB,j.s_t0),this.m_rB),_=this.m_invMassA,d=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 y=this.m_linearImpulse;n.SelfMulSub(_,y),r-=p*(j.CrossVV(c,y)+this.m_angularImpulse),o.SelfMulAdd(d,y),h+=m*(j.CrossVV(f,y)+this.m_angularImpulse)}else this.m_linearImpulse.SetZero(),this.m_angularImpulse=0;t.velocities[this.m_indexA].w=r,t.velocities[this.m_indexB].w=h},n.SolveVelocityConstraints=function(t){var 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,_=-this.m_angularMass*f,d=this.m_angularImpulse,p=l*this.m_maxTorque;this.m_angularImpulse=k(this.m_angularImpulse+_,-p,p),n-=h*(_=this.m_angularImpulse-d),s+=u*_;var m=this.m_rA,g=this.m_rB,y=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),v=Y.MulMV(this.m_linearMass,y,i.SolveVelocityConstraints_s_impulse_v2).SelfNeg(),b=i.SolveVelocityConstraints_s_oldImpulse_v2.Copy(this.m_linearImpulse);this.m_linearImpulse.SelfAdd(v);var S=l*this.m_maxForce;this.m_linearImpulse.LengthSquared()>S*S&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.SelfMul(S)),j.SubVV(this.m_linearImpulse,b,v),e.SelfMulSub(a,v),n-=h*j.CrossVV(m,v),r.SelfMulAdd(o,v),s+=u*j.CrossVV(g,v),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(){return!0},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2MotorJointDef = new b2MotorJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.linearOffset.Set(%.15f, %.15f);\n",this.m_linearOffset.x,this.m_linearOffset.y),t(" jd.angularOffset = %.15f;\n",this.m_angularOffset),t(" jd.maxForce = %.15f;\n",this.m_maxForce),t(" jd.maxTorque = %.15f;\n",this.m_maxTorque),t(" jd.correctionFactor = %.15f;\n",this.m_correctionFactor),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i}(ki);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}(Oi),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 K,n.m_lalcB=new j,n.m_K=new Y,n.m_targetA.Copy(e(i.target,j.ZERO)),Q.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),K.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}(ki);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}(Oi),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 J,r.m_K3=new J,r.m_K2=new Y,r.m_motorMass=0,r.m_qA=new K,r.m_qB=new K,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 _=K.MulRV(c,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var d=K.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,y=this.m_invIA,v=this.m_invIB;if(K.MulRV(c,this.m_localXAxisA,this.m_axis),this.m_a1=j.CrossVV(j.AddVV(p,_,j.s_t0),this.m_axis),this.m_a2=j.CrossVV(d,this.m_axis),this.m_motorMass=m+g+y*this.m_a1*this.m_a1+v*this.m_a2*this.m_a2,this.m_motorMass>0&&(this.m_motorMass=1/this.m_motorMass),K.MulRV(c,this.m_localYAxisA,this.m_perp),this.m_s1=j.CrossVV(j.AddVV(p,_,j.s_t0),this.m_perp),this.m_s2=j.CrossVV(d,this.m_perp),this.m_K.ex.x=m+g+y*this.m_s1*this.m_s1+v*this.m_s2*this.m_s2,this.m_K.ex.y=y*this.m_s1+v*this.m_s2,this.m_K.ex.z=y*this.m_s1*this.m_a1+v*this.m_s2*this.m_a2,this.m_K.ey.x=this.m_K.ex.y,this.m_K.ey.y=y+v,0===this.m_K.ey.y&&(this.m_K.ey.y=1),this.m_K.ey.z=y*this.m_a1+v*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+y*this.m_a1*this.m_a1+v*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),w=this.m_impulse.x*this.m_s1+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a1,x=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-=y*w,u.SelfMulAdd(g,S),l+=v*x}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),_=this.m_motorImpulse,d=e.step.dt*this.m_maxMotorForce;this.m_motorImpulse=k(this.m_motorImpulse+f,-d,d),f=this.m_motorImpulse-_;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 y=j.DotVV(this.m_perp,j.SubVV(s,i,j.s_t0))+this.m_s2*a-this.m_s1*r,v=a-r;if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit){var 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),w=this.m_K.Solve33(-y,-v,-b,n.SolveVelocityConstraints_s_df3);this.m_impulse.SelfAdd(w),this.m_limitState===t.b2LimitState.e_atLowerLimit?this.m_impulse.z=O(this.m_impulse.z,0):this.m_limitState===t.b2LimitState.e_atUpperLimit&&(this.m_impulse.z=E(this.m_impulse.z,0));var x=-y-(this.m_impulse.z-S.z)*this.m_K.ez.x,T=-v-(this.m_impulse.z-S.z)*this.m_K.ez.y,A=this.m_K.Solve22(x,T,n.SolveVelocityConstraints_s_f2r);A.x+=S.x,A.y+=S.y,this.m_impulse.x=A.x,this.m_impulse.y=A.y,w.x=this.m_impulse.x-S.x,w.y=this.m_impulse.y-S.y,w.z=this.m_impulse.z-S.z;var C=j.AddVV(j.MulSV(w.x,this.m_perp,j.s_t0),j.MulSV(w.z,this.m_axis,j.s_t1),n.SolveVelocityConstraints_s_P),D=w.x*this.m_s1+w.y+w.z*this.m_a1,B=w.x*this.m_s2+w.y+w.z*this.m_a2;i.SelfMulSub(o,C),r-=u*D,s.SelfMulAdd(h,C),a+=l*B}else{var I=this.m_K.Solve22(-y,-v,n.SolveVelocityConstraints_s_df2);this.m_impulse.x+=I.x,this.m_impulse.y+=I.y;var M=j.MulSV(I.x,this.m_perp,n.SolveVelocityConstraints_s_P),P=I.x*this.m_s1+I.y,R=I.x*this.m_s2+I.y;i.SelfMulSub(o,M),r-=u*P,s.SelfMulAdd(h,M),a+=l*R}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,d=this.m_invIB,p=K.MulRV(a,this.m_lalcA,this.m_rA),m=K.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),y=K.MulRV(a,this.m_localXAxisA,this.m_axis),v=j.CrossVV(j.AddVV(g,p,j.s_t0),y),b=j.CrossVV(m,y),S=K.MulRV(a,this.m_localYAxisA,this.m_perp),w=j.CrossVV(j.AddVV(g,p,j.s_t0),S),x=j.CrossVV(m,S),T=n.SolvePositionConstraints_s_impulse,A=j.DotVV(S,g),C=s-i-this.m_referenceAngle,D=P(A),B=P(C),I=!1,M=0;if(this.m_enableLimit){var E=j.DotVV(y,g);P(this.m_upperTranslation-this.m_lowerTranslation)<.016?(M=k(E,-.2,_),D=O(D,P(E)),I=!0):E<=this.m_lowerTranslation?(M=k(E-this.m_lowerTranslation+l,-.2,0),D=O(D,this.m_lowerTranslation-E),I=!0):E>=this.m_upperTranslation&&(M=k(E-this.m_upperTranslation-l,0,_),D=O(D,E-this.m_upperTranslation),I=!0)}if(I){var R=h+u+f*w*w+d*x*x,F=f*w+d*x,L=f*w*v+d*x*b,V=f+d;0===V&&(V=1);var N=f*v+d*b,z=h+u+f*v*v+d*b*b,U=this.m_K3;U.ex.SetXYZ(R,F,L),U.ey.SetXYZ(F,V,N),U.ez.SetXYZ(L,N,z),T=U.Solve33(-A,-C,-M,T)}else{var G=h+u+f*w*w+d*x*x,H=f*w+d*x,W=f+d;0===W&&(W=1);var q=this.m_K2;q.ex.Set(G,H),q.ey.Set(H,W);var X=q.Solve(-A,-C,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,y,j.s_t1),n.SolvePositionConstraints_s_P),J=T.x*w+T.y+T.z*v,Q=T.x*x+T.y+T.z*b;return e.SelfMulSub(h,Y),i-=f*J,r.SelfMulAdd(u,Y),s+=d*Q,t.positions[this.m_indexA].a=i,t.positions[this.m_indexB].a=s,D<=l&&B<=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=K.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=K.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}(ki);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 Ji=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}(Oi),Ki=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 K,n.m_qB=new K,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),K.MulRV(l,this.m_lalcA,this.m_rA),j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),K.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(),_=this.m_uB.Length();f>.08?this.m_uA.SelfMul(1/f):this.m_uA.SetZero(),_>.08?this.m_uB.SelfMul(1/_):this.m_uB.SetZero();var d=j.CrossVV(this.m_rA,this.m_uA),p=j.CrossVV(this.m_rB,this.m_uB),m=this.m_invMassA+this.m_invIA*d*d,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 y=j.MulSV(-this.m_impulse,this.m_uA,i.InitVelocityConstraints_s_PA),v=j.MulSV(-this.m_ratio*this.m_impulse,this.m_uB,i.InitVelocityConstraints_s_PB);r.SelfMulAdd(this.m_invMassA,y),s+=this.m_invIA*j.CrossVV(this.m_rA,y),h.SelfMulAdd(this.m_invMassB,v),u+=this.m_invIB*j.CrossVV(this.m_rB,v)}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=K.MulRV(a,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u=K.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),_=c.Length(),d=f.Length();_>.08?c.SelfMul(1/_):c.SetZero(),d>.08?f.SelfMul(1/d):f.SetZero();var p=j.CrossVV(h,c),m=j.CrossVV(u,f),g=this.m_invMassA+this.m_invIA*p*p,y=this.m_invMassB+this.m_invIB*m*m,v=g+this.m_ratio*this.m_ratio*y;v>0&&(v=1/v);var b=this.m_constant-_-this.m_ratio*d,S=P(b),w=-v*b,x=j.MulSV(-w,c,i.SolvePositionConstraints_s_PA),T=j.MulSV(-this.m_ratio*w,f,i.SolvePositionConstraints_s_PB);return e.SelfMulAdd(this.m_invMassA,x),n+=this.m_invIA*j.CrossVV(h,x),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,S<l},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_uB.x,e.y=t*this.m_impulse*this.m_uB.y,e},n.GetReactionTorque=function(){return 0},n.GetGroundAnchorA=function(){return this.m_groundAnchorA},n.GetGroundAnchorB=function(){return this.m_groundAnchorB},n.GetLengthA=function(){return this.m_lengthA},n.GetLengthB=function(){return this.m_lengthB},n.GetRatio=function(){return this.m_ratio},n.GetCurrentLengthA=function(){var t=this.m_bodyA.GetWorldPoint(this.m_localAnchorA,i.GetCurrentLengthA_s_p),e=this.m_groundAnchorA;return j.DistanceVV(t,e)},n.GetCurrentLengthB=function(){var t=this.m_bodyB.GetWorldPoint(this.m_localAnchorB,i.GetCurrentLengthB_s_p),e=this.m_groundAnchorB;return j.DistanceVV(t,e)},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2PulleyJointDef = new b2PulleyJointDef();\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.groundAnchorA.Set(%.15f, %.15f);\n",this.m_groundAnchorA.x,this.m_groundAnchorA.y),t(" jd.groundAnchorB.Set(%.15f, %.15f);\n",this.m_groundAnchorB.x,this.m_groundAnchorB.y),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.lengthA = %.15f;\n",this.m_lengthA),t(" jd.lengthB = %.15f;\n",this.m_lengthB),t(" jd.ratio = %.15f;\n",this.m_ratio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n.ShiftOrigin=function(t){this.m_groundAnchorA.SelfSub(t),this.m_groundAnchorB.SelfSub(t)},i}(ki);Ki.InitVelocityConstraints_s_PA=new j,Ki.InitVelocityConstraints_s_PB=new j,Ki.SolveVelocityConstraints_s_vpA=new j,Ki.SolveVelocityConstraints_s_vpB=new j,Ki.SolveVelocityConstraints_s_PA=new j,Ki.SolveVelocityConstraints_s_PB=new j,Ki.SolvePositionConstraints_s_PA=new j,Ki.SolvePositionConstraints_s_PB=new j,Ki.GetCurrentLengthA_s_p=new j,Ki.GetCurrentLengthB_s_p=new j;var Qi=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_revoluteJoint)||this).localAnchorA=new j(0,0),i.localAnchorB=new j(0,0),i.referenceAngle=0,i.enableLimit=!1,i.lowerAngle=0,i.upperAngle=0,i.enableMotor=!1,i.motorSpeed=0,i.maxMotorTorque=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),this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()},i}(Oi),Zi=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_impulse=new X,r.m_motorImpulse=0,r.m_enableMotor=!1,r.m_maxMotorTorque=0,r.m_motorSpeed=0,r.m_enableLimit=!1,r.m_referenceAngle=0,r.m_lowerAngle=0,r.m_upperAngle=0,r.m_indexA=0,r.m_indexB=0,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=new J,r.m_motorMass=0,r.m_limitState=t.b2LimitState.e_inactiveLimit,r.m_qA=new K,r.m_qB=new K,r.m_lalcA=new j,r.m_lalcB=new j,r.m_K=new Y,r.m_localAnchorA.Copy(e(n.localAnchorA,j.ZERO)),r.m_localAnchorB.Copy(e(n.localAnchorB,j.ZERO)),r.m_referenceAngle=e(n.referenceAngle,0),r.m_impulse.SetZero(),r.m_motorImpulse=0,r.m_lowerAngle=e(n.lowerAngle,0),r.m_upperAngle=e(n.upperAngle,0),r.m_maxMotorTorque=e(n.maxMotorTorque,0),r.m_motorSpeed=e(n.motorSpeed,0),r.m_enableLimit=e(n.enableLimit,!1),r.m_enableMotor=e(n.enableMotor,!1),r.m_limitState=t.b2LimitState.e_inactiveLimit,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].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=this.m_qA.SetAngle(i),l=this.m_qB.SetAngle(a);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),K.MulRV(u,this.m_lalcA,this.m_rA),j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),K.MulRV(l,this.m_lalcB,this.m_rB);var f=this.m_invMassA,_=this.m_invMassB,d=this.m_invIA,p=this.m_invIB,m=d+p===0;if(this.m_mass.ex.x=f+_+this.m_rA.y*this.m_rA.y*d+this.m_rB.y*this.m_rB.y*p,this.m_mass.ey.x=-this.m_rA.y*this.m_rA.x*d-this.m_rB.y*this.m_rB.x*p,this.m_mass.ez.x=-this.m_rA.y*d-this.m_rB.y*p,this.m_mass.ex.y=this.m_mass.ey.x,this.m_mass.ey.y=f+_+this.m_rA.x*this.m_rA.x*d+this.m_rB.x*this.m_rB.x*p,this.m_mass.ez.y=this.m_rA.x*d+this.m_rB.x*p,this.m_mass.ex.z=this.m_mass.ez.x,this.m_mass.ey.z=this.m_mass.ez.y,this.m_mass.ez.z=d+p,this.m_motorMass=d+p,this.m_motorMass>0&&(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 y=n.InitVelocityConstraints_s_P.Set(this.m_impulse.x,this.m_impulse.y);r.SelfMulSub(f,y),s-=d*(j.CrossVV(this.m_rA,y)+this.m_motorImpulse+this.m_impulse.z),o.SelfMulAdd(_,y),h+=p*(j.CrossVV(this.m_rB,y)+this.m_motorImpulse+this.m_impulse.z)}else this.m_impulse.SetZero(),this.m_motorImpulse=0;e.velocities[this.m_indexA].w=s,e.velocities[this.m_indexB].w=h},r.SolveVelocityConstraints=function(e){var i=e.velocities[this.m_indexA].v,r=e.velocities[this.m_indexA].w,s=e.velocities[this.m_indexB].v,a=e.velocities[this.m_indexB].w,o=this.m_invMassA,h=this.m_invMassB,u=this.m_invIA,l=this.m_invIB,c=u+l===0;if(this.m_enableMotor&&this.m_limitState!==t.b2LimitState.e_equalLimits&&!c){var f=a-r-this.m_motorSpeed,_=-this.m_motorMass*f,d=this.m_motorImpulse,p=e.step.dt*this.m_maxMotorTorque;this.m_motorImpulse=k(this.m_motorImpulse+_,-p,p),r-=u*(_=this.m_motorImpulse-d),a+=l*_}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,y=this.m_mass.Solve33(m.x,m.y,g,n.SolveVelocityConstraints_s_impulse_v3).SelfNeg();if(this.m_limitState===t.b2LimitState.e_equalLimits)this.m_impulse.SelfAdd(y);else if(this.m_limitState===t.b2LimitState.e_atLowerLimit)if(this.m_impulse.z+y.z<0){var v=-m.x+this.m_impulse.z*this.m_mass.ez.x,b=-m.y+this.m_impulse.z*this.m_mass.ez.y,S=this.m_mass.Solve22(v,b,n.SolveVelocityConstraints_s_reduced_v2);y.x=S.x,y.y=S.y,y.z=-this.m_impulse.z,this.m_impulse.x+=S.x,this.m_impulse.y+=S.y,this.m_impulse.z=0}else this.m_impulse.SelfAdd(y);else if(this.m_limitState===t.b2LimitState.e_atUpperLimit)if(this.m_impulse.z+y.z>0){var w=-m.x+this.m_impulse.z*this.m_mass.ez.x,x=-m.y+this.m_impulse.z*this.m_mass.ez.y,T=this.m_mass.Solve22(w,x,n.SolveVelocityConstraints_s_reduced_v2);y.x=T.x,y.y=T.y,y.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(y);var A=n.SolveVelocityConstraints_s_P.Set(y.x,y.y);i.SelfMulSub(o,A),r-=u*(j.CrossVV(this.m_rA,A)+y.z),s.SelfMulAdd(h,A),a+=l*(j.CrossVV(this.m_rB,A)+y.z)}else{var C=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(-C.x,-C.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,_=this.m_invIA+this.m_invIB===0;if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit&&!_){var p=o-s-this.m_referenceAngle,m=0;if(this.m_limitState===t.b2LimitState.e_equalLimits){var g=k(p-this.m_lowerAngle,-.13962634015955555,d);m=-this.m_motorMass*g,f=P(g)}else if(this.m_limitState===t.b2LimitState.e_atLowerLimit){var y=p-this.m_lowerAngle;f=-y,y=k(y+c,-.13962634015955555,0),m=-this.m_motorMass*y}else if(this.m_limitState===t.b2LimitState.e_atUpperLimit){var v=p-this.m_upperAngle;f=v,v=k(v-c,0,d),m=-this.m_motorMass*v}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=K.MulRV(h,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var S=K.MulRV(u,this.m_lalcB,this.m_rB),w=j.SubVV(j.AddVV(a,S,j.s_t0),j.AddVV(r,b,j.s_t1),n.SolvePositionConstraints_s_C_v2);i=w.Length();var x=this.m_invMassA,T=this.m_invMassB,A=this.m_invIA,C=this.m_invIB,D=this.m_K;D.ex.x=x+T+A*b.y*b.y+C*S.y*S.y,D.ex.y=-A*b.x*b.y-C*S.x*S.y,D.ey.x=D.ex.y,D.ey.y=x+T+A*b.x*b.x+C*S.x*S.x;var B=D.Solve(w.x,w.y,n.SolvePositionConstraints_s_impulse).SelfNeg();return r.SelfMulSub(x,B),s-=A*j.CrossVV(b,B),a.SelfMulAdd(T,B),o+=C*j.CrossVV(S,B),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}(ki);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}(Oi),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 K,r.m_qB=new K,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),_=this.m_qB.SetAngle(h);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),K.MulRV(f,this.m_lalcA,this.m_rA),j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),K.MulRV(_,this.m_lalcB,this.m_rB),this.m_u.Copy(o).SelfAdd(this.m_rB).SelfSub(i).SelfSub(this.m_rA),this.m_length=this.m_u.Length();var d=this.m_length-this.m_maxLength;if(this.m_state=d>0?t.b2LimitState.e_atUpperLimit:t.b2LimitState.e_inactiveLimit,!(this.m_length>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 y=j.MulSV(this.m_impulse,this.m_u,n.InitVelocityConstraints_s_P);s.SelfMulSub(this.m_invMassA,y),a-=this.m_invIA*j.CrossVV(this.m_rA,y),u.SelfMulAdd(this.m_invMassB,y),c+=this.m_invIB*j.CrossVV(this.m_rB,y)}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=K.MulRV(a,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u=K.MulRV(o,this.m_lalcB,this.m_rB),c=this.m_u.Copy(r).SelfAdd(u).SelfSub(e).SelfSub(h),f=c.Normalize(),d=f-this.m_maxLength;d=k(d,0,_);var p=-this.m_mass*d,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_maxLength<l},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_u,e)},r.GetReactionTorque=function(){return 0},r.GetLocalAnchorA=function(){return this.m_localAnchorA},r.GetLocalAnchorB=function(){return this.m_localAnchorB},r.SetMaxLength=function(t){this.m_maxLength=t},r.GetMaxLength=function(){return this.m_maxLength},r.GetLimitState=function(){return this.m_state},r.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2RopeJointDef = new b2RopeJointDef();\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.maxLength = %.15f;\n",this.m_maxLength),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n}(ki);tn.InitVelocityConstraints_s_P=new j,tn.SolveVelocityConstraints_s_vpA=new j,tn.SolveVelocityConstraints_s_vpB=new j,tn.SolveVelocityConstraints_s_P=new j,tn.SolvePositionConstraints_s_P=new j;var en=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_weldJoint)||this).localAnchorA=new j,i.localAnchorB=new j,i.referenceAngle=0,i.frequencyHz=0,i.dampingRatio=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),this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()},i}(Oi),nn=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_referenceAngle=0,n.m_gamma=0,n.m_impulse=new X(0,0,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_mass=new J,n.m_qA=new K,n.m_qB=new K,n.m_lalcA=new j,n.m_lalcB=new j,n.m_K=new J,n.m_frequencyHz=e(i.frequencyHz,0),n.m_dampingRatio=e(i.dampingRatio,0),n.m_localAnchorA.Copy(e(i.localAnchorA,j.ZERO)),n.m_localAnchorB.Copy(e(i.localAnchorB,j.ZERO)),n.m_referenceAngle=e(i.referenceAngle,0),n.m_impulse.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,n=t.velocities[this.m_indexA].v,r=t.velocities[this.m_indexA].w,s=t.positions[this.m_indexB].a,a=t.velocities[this.m_indexB].v,h=t.velocities[this.m_indexB].w,u=this.m_qA.SetAngle(e),l=this.m_qB.SetAngle(s);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),K.MulRV(u,this.m_lalcA,this.m_rA),j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),K.MulRV(l,this.m_lalcB,this.m_rB);var c=this.m_invMassA,f=this.m_invMassB,_=this.m_invIA,d=this.m_invIB,p=this.m_K;if(p.ex.x=c+f+this.m_rA.y*this.m_rA.y*_+this.m_rB.y*this.m_rB.y*d,p.ey.x=-this.m_rA.y*this.m_rA.x*_-this.m_rB.y*this.m_rB.x*d,p.ez.x=-this.m_rA.y*_-this.m_rB.y*d,p.ex.y=p.ey.x,p.ey.y=c+f+this.m_rA.x*this.m_rA.x*_+this.m_rB.x*this.m_rB.x*d,p.ez.y=this.m_rA.x*_+this.m_rB.x*d,p.ex.z=p.ez.x,p.ey.z=p.ez.y,p.ez.z=_+d,this.m_frequencyHz>0){p.GetInverse22(this.m_mass);var m=_+d,g=m>0?1/m:0,y=s-e-this.m_referenceAngle,v=2*o*this.m_frequencyHz,b=2*g*this.m_dampingRatio*v,S=g*v*v,w=t.step.dt;this.m_gamma=w*(b+w*S),this.m_gamma=0!==this.m_gamma?1/this.m_gamma:0,this.m_bias=y*w*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 x=i.InitVelocityConstraints_s_P.Set(this.m_impulse.x,this.m_impulse.y);n.SelfMulSub(c,x),r-=_*(j.CrossVV(this.m_rA,x)+this.m_impulse.z),a.SelfMulAdd(f,x),h+=d*(j.CrossVV(this.m_rB,x)+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),_=J.MulM33XY(this.m_mass,f.x,f.y,i.SolveVelocityConstraints_s_impulse1).SelfNeg();this.m_impulse.x+=_.x,this.m_impulse.y+=_.y;var d=_;e.SelfMulSub(a,d),n-=h*j.CrossVV(this.m_rA,d),r.SelfMulAdd(o,d),s+=u*j.CrossVV(this.m_rB,d)}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=J.MulM33XYZ(this.m_mass,p.x,p.y,m,i.SolveVelocityConstraints_s_impulse).SelfNeg();this.m_impulse.SelfAdd(g);var y=i.SolveVelocityConstraints_s_P.Set(g.x,g.y);e.SelfMulSub(a,y),n-=h*(j.CrossVV(this.m_rA,y)+g.z),r.SelfMulAdd(o,y),s+=u*(j.CrossVV(this.m_rB,y)+g.z)}t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(t){var 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,_=this.m_invIB;j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var d=K.MulRV(a,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var p,m,g=K.MulRV(o,this.m_lalcB,this.m_rB),y=this.m_K;if(y.ex.x=h+u+d.y*d.y*f+g.y*g.y*_,y.ey.x=-d.y*d.x*f-g.y*g.x*_,y.ez.x=-d.y*f-g.y*_,y.ex.y=y.ey.x,y.ey.y=h+u+d.x*d.x*f+g.x*g.x*_,y.ez.y=d.x*f+g.x*_,y.ex.z=y.ez.x,y.ey.z=y.ez.y,y.ez.z=f+_,this.m_frequencyHz>0){var v=j.SubVV(j.AddVV(r,g,j.s_t0),j.AddVV(e,d,j.s_t1),i.SolvePositionConstraints_s_C1);p=v.Length(),m=0;var b=y.Solve22(v.x,v.y,i.SolvePositionConstraints_s_P).SelfNeg();e.SelfMulSub(h,b),n-=f*j.CrossVV(d,b),r.SelfMulAdd(u,b),s+=_*j.CrossVV(g,b)}else{var S=j.SubVV(j.AddVV(r,g,j.s_t0),j.AddVV(e,d,j.s_t1),i.SolvePositionConstraints_s_C1),w=s-n-this.m_referenceAngle;p=S.Length(),m=P(w);var x=y.Solve33(S.x,S.y,w,i.SolvePositionConstraints_s_impulse).SelfNeg(),T=i.SolvePositionConstraints_s_P.Set(x.x,x.y);e.SelfMulSub(h,T),n-=f*(j.CrossVV(this.m_rA,T)+x.z),r.SelfMulAdd(u,T),s+=_*(j.CrossVV(this.m_rB,T)+x.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}(ki);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}(Oi),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 K,n.m_qB=new K,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,_=t.velocities[this.m_indexB].v,d=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=K.MulRV(p,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var y=K.MulRV(m,this.m_lalcB,this.m_rB),v=j.SubVV(j.AddVV(c,y,j.s_t0),j.AddVV(a,g,j.s_t1),i.InitVelocityConstraints_s_d);if(K.MulRV(p,this.m_localYAxisA,this.m_ay),this.m_sAy=j.CrossVV(j.AddVV(v,g,j.s_t0),this.m_ay),this.m_sBy=j.CrossVV(y,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){K.MulRV(p,this.m_localXAxisA,this.m_ax),this.m_sAx=j.CrossVV(j.AddVV(v,g,j.s_t0),this.m_ax),this.m_sBx=j.CrossVV(y,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(v,this.m_ax),w=2*o*this.m_frequencyHz,x=2*this.m_springMass*this.m_dampingRatio*w,T=this.m_springMass*w*w,A=t.step.dt;this.m_gamma=A*(x+A*T),this.m_gamma>0&&(this.m_gamma=1/this.m_gamma),this.m_bias=S*A*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 C=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,B=this.m_impulse*this.m_sBy+this.m_springImpulse*this.m_sBx+this.m_motorImpulse;u.SelfMulSub(this.m_invMassA,C),l-=this.m_invIA*D,_.SelfMulAdd(this.m_invMassB,C),d+=this.m_invIB*B}else this.m_impulse=0,this.m_springImpulse=0,this.m_motorImpulse=0;t.velocities[this.m_indexA].w=l,t.velocities[this.m_indexB].w=d},n.SolveVelocityConstraints=function(t){var 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),_=c*this.m_sAx,d=c*this.m_sBx;a.SelfMulSub(e,f),o-=r*_,h.SelfMulAdd(n,f);var p=(u+=s*d)-o-this.m_motorSpeed,m=-this.m_motorMass*p,g=this.m_motorImpulse,y=t.step.dt*this.m_maxMotorTorque;this.m_motorImpulse=k(this.m_motorImpulse+m,-y,y),o-=r*(m=this.m_motorImpulse-g),u+=s*m;var v=j.DotVV(this.m_ay,j.SubVV(h,a,j.s_t0))+this.m_sBy*u-this.m_sAy*o,b=-this.m_mass*v;this.m_impulse+=b;var S=j.MulSV(b,this.m_ay,i.SolveVelocityConstraints_s_P),w=b*this.m_sAy,x=b*this.m_sBy;a.SelfMulSub(e,S),o-=r*w,h.SelfMulAdd(n,S),u+=s*x,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=K.MulRV(a,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u,c=K.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),_=K.MulRV(a,this.m_localYAxisA,this.m_ay),d=j.CrossVV(j.AddVV(f,h,j.s_t0),_),p=j.CrossVV(c,_),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 y=j.MulSV(u,_,i.SolvePositionConstraints_s_P),v=u*d,b=u*p;return e.SelfMulSub(this.m_invMassA,y),n-=this.m_invIA*v,r.SelfMulAdd(this.m_invMassB,y),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=K.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=K.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}(ki);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 kt,this.m_toiCount=0,this.m_toi=0,this.m_friction=0,this.m_restitution=0,this.m_tangentSpeed=0,this.m_oldManifold=new kt}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 _=0;_<this.m_manifold.pointCount;++_){var d=this.m_manifold.points[_];d.normalImpulse=0,d.tangentImpulse=0;for(var p=d.id,m=0;m<this.m_oldManifold.pointCount;++m){var g=this.m_oldManifold.points[m];if(g.id.key===p.key){d.normalImpulse=g.normalImpulse,d.tangentImpulse=g.tangentImpulse;break}}}i!==n&&(o.SetAwake(!0),h.SetAwake(!0))}this.m_touchingFlag=i,!n&&i&&t&&t.BeginContact(this),n&&!i&&t&&t.EndContact(this),!a&&i&&t&&t.PreSolve(this,this.m_oldManifold)},e.ComputeTOI=function(e,i){var n=t.ComputeTOI_s_input;n.proxyA.SetShape(this.GetShapeA(),this.m_indexA),n.proxyB.SetShape(this.GetShapeB(),this.m_indexB),n.sweepA.Copy(e),n.sweepB.Copy(i),n.tMax=l;var r=t.ComputeTOI_s_output;return we(r,n),r.t},t}();un.ComputeTOI_s_input=new ue,un.ComputeTOI_s_output=new ce;var ln=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.Create=function(){return new e},e.Destroy=function(){},e.prototype.Evaluate=function(t,e,i){Ae(t,this.GetShapeA(),e,this.GetShapeB(),i)},e}(un),cn=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.Create=function(){return new e},e.Destroy=function(){},e.prototype.Evaluate=function(t,e,i){$e(t,this.GetShapeA(),e,this.GetShapeB(),i)},e}(un),fn=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.Create=function(){return new e},e.Destroy=function(){},e.prototype.Evaluate=function(t,e,i){Ie(t,this.GetShapeA(),e,this.GetShapeB(),i)},e}(un),_n=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.Create=function(){return new e},e.Destroy=function(){},e.prototype.Evaluate=function(t,e,i){ui(t,this.GetShapeA(),e,this.GetShapeB(),i)},e}(un),dn=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.Create=function(){return new e},e.Destroy=function(){},e.prototype.Evaluate=function(t,e,i){pi(t,this.GetShapeA(),e,this.GetShapeB(),i)},e}(un),pn=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.Create=function(){return new e},e.Destroy=function(){},e.prototype.Evaluate=function(t,i,n){var r=e.Evaluate_s_edge;this.GetShapeA().GetChildEdge(r,this.m_indexA),ui(t,r,i,this.GetShapeB(),n)},e}(un);pn.Evaluate_s_edge=new Si;var mn=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.Create=function(){return new e},e.Destroy=function(){},e.prototype.Evaluate=function(t,i,n){var r=e.Evaluate_s_edge;this.GetShapeA().GetChildEdge(r,this.m_indexA),pi(t,r,i,this.GetShapeB(),n)},e}(un);mn.Evaluate_s_edge=new Si;var gn=function(){this.pool=[],this.createFcn=null,this.destroyFcn=null,this.primary=!1},yn=function(){function e(){this.m_registers=[],this.InitializeRegisters()}var i=e.prototype;return i.AddType=function(t,e,i,n){var r=[];function s(){return r.pop()||t()}function a(t){r.push(t)}this.m_registers[i][n].pool=r,this.m_registers[i][n].createFcn=s,this.m_registers[i][n].destroyFcn=a,this.m_registers[i][n].primary=!0,i!==n&&(this.m_registers[n][i].pool=r,this.m_registers[n][i].createFcn=s,this.m_registers[n][i].destroyFcn=a,this.m_registers[n][i].primary=!1)},i.InitializeRegisters=function(){for(var e=0;e<t.b2ShapeType.e_shapeTypeCount;e++){this.m_registers[e]=[];for(var i=0;i<t.b2ShapeType.e_shapeTypeCount;i++)this.m_registers[e][i]=new gn}this.AddType(ln.Create,ln.Destroy,t.b2ShapeType.e_circleShape,t.b2ShapeType.e_circleShape),this.AddType(fn.Create,fn.Destroy,t.b2ShapeType.e_polygonShape,t.b2ShapeType.e_circleShape),this.AddType(cn.Create,cn.Destroy,t.b2ShapeType.e_polygonShape,t.b2ShapeType.e_polygonShape),this.AddType(_n.Create,_n.Destroy,t.b2ShapeType.e_edgeShape,t.b2ShapeType.e_circleShape),this.AddType(dn.Create,dn.Destroy,t.b2ShapeType.e_edgeShape,t.b2ShapeType.e_polygonShape),this.AddType(pn.Create,pn.Destroy,t.b2ShapeType.e_chainShape,t.b2ShapeType.e_circleShape),this.AddType(mn.Create,mn.Destroy,t.b2ShapeType.e_chainShape,t.b2ShapeType.e_polygonShape)},i.Create=function(t,e,i,n){var r=t.GetType(),s=i.GetType(),a=this.m_registers[r][s];if(a.createFcn){var o=a.createFcn();return a.primary?o.Reset(t,e,i,n):o.Reset(i,n,t,e),o}return null},i.Destroy=function(t){var e=t.m_fixtureA.GetType(),i=t.m_fixtureB.GetType(),n=this.m_registers[e][i];n.destroyFcn&&n.destroyFcn(t)},e}(),vn=function(){function t(){}var e=t.prototype;return e.SayGoodbyeJoint=function(){},e.SayGoodbyeFixture=function(){},e.SayGoodbyeParticleGroup=function(){},e.SayGoodbyeParticle=function(){},t}(),bn=function(){function e(){}var i=e.prototype;return i.ShouldCollide=function(e,i){var n=e.GetBody(),r=i.GetBody();if(r.GetType()===t.b2BodyType.b2_staticBody&&n.GetType()===t.b2BodyType.b2_staticBody)return!1;if(!r.ShouldCollideConnected(n))return!1;var s=e.GetFilterData(),a=i.GetFilterData();return s.groupIndex===a.groupIndex&&0!==s.groupIndex?s.groupIndex>0:!!(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},wn=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}();wn.b2_defaultListener=new wn;var xn=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}(),An=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=wn.b2_defaultListener,this.m_contactFactory=new yn}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 _=this.m_contactFactory.Create(i,r,n,s);null!==_&&(i=_.GetFixtureA(),n=_.GetFixtureB(),r=_.GetChildIndexA(),s=_.GetChildIndexB(),a=i.m_body,o=n.m_body,_.m_prev=null,_.m_next=this.m_contactList,null!==this.m_contactList&&(this.m_contactList.m_prev=_),this.m_contactList=_,_.m_nodeA.other=o,_.m_nodeA.prev=null,_.m_nodeA.next=a.m_contactList,null!==a.m_contactList&&(a.m_contactList.prev=_.m_nodeA),a.m_contactList=_.m_nodeA,_.m_nodeB.other=a,_.m_nodeB.prev=null,_.m_nodeB.next=o.m_contactList,null!==o.m_contactList&&(o.m_contactList.prev=_.m_nodeB),o.m_contactList=_.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 _=e;e=_.m_next,this.Destroy(_)}}else e=e.m_next}},e}(),Cn=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}(),Bn=function(){function t(){this.c=new j,this.a=0}return t.MakeArray=function(e){return C(e,(function(){return new t}))},t}(),In=function(){function t(){this.v=new j,this.w=0}return t.MakeArray=function(e){return C(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 C(e,(function(){return new t}))},t}(),On=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 C(e,(function(){return new t}))},t}(),kn=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 C(t,(function(){return new e}))},e}(),Rn=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:Q.MulXV(n,i.localPoint,a),Q.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:K.MulRV(n.q,i.localNormal,this.normal),Q.MulXV(n,i.localPoint,h),Q.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:K.MulRV(r.q,i.localNormal,this.normal),Q.MulXV(r,i.localPoint,h),Q.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=kn.MakeArray(1024),this.m_velocityConstraints=On.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.length<this.m_count)for(var e=O(2*this.m_positionConstraints.length,this.m_count);this.m_positionConstraints.length<e;)this.m_positionConstraints[this.m_positionConstraints.length]=new kn;if(this.m_velocityConstraints.length<this.m_count)for(var i=O(2*this.m_velocityConstraints.length,this.m_count);this.m_velocityConstraints.length<i;)this.m_velocityConstraints[this.m_velocityConstraints.length]=new On;this.m_positions=t.positions,this.m_velocities=t.velocities,this.m_contacts=t.contacts;for(var n=0;n<this.m_count;++n){var r=this.m_contacts[n],s=r.m_fixtureA,a=r.m_fixtureB,o=s.GetShape(),h=a.GetShape(),u=o.m_radius,l=h.m_radius,c=s.GetBody(),f=a.GetBody(),_=r.GetManifold(),d=_.pointCount,p=this.m_velocityConstraints[n];p.friction=r.m_friction,p.restitution=r.m_restitution,p.tangentSpeed=r.m_tangentSpeed,p.indexA=c.m_islandIndex,p.indexB=f.m_islandIndex,p.invMassA=c.m_invMass,p.invMassB=f.m_invMass,p.invIA=c.m_invI,p.invIB=f.m_invI,p.contactIndex=n,p.pointCount=d,p.K.SetZero(),p.normalMass.SetZero();var m=this.m_positionConstraints[n];m.indexA=c.m_islandIndex,m.indexB=f.m_islandIndex,m.invMassA=c.m_invMass,m.invMassB=f.m_invMass,m.localCenterA.Copy(c.m_sweep.localCenter),m.localCenterB.Copy(f.m_sweep.localCenter),m.invIA=c.m_invI,m.invIB=f.m_invI,m.localNormal.Copy(_.localNormal),m.localPoint.Copy(_.localPoint),m.pointCount=d,m.radiusA=u,m.radiusB=l,m.type=_.type;for(var g=0;g<d;++g){var y=_.points[g],v=p.points[g];this.m_step.warmStarting?(v.normalImpulse=this.m_step.dtRatio*y.normalImpulse,v.tangentImpulse=this.m_step.dtRatio*y.tangentImpulse):(v.normalImpulse=0,v.tangentImpulse=0),v.rA.SetZero(),v.rB.SetZero(),v.normalMass=0,v.tangentMass=0,v.velocityBias=0,m.localPoints[g].Copy(y.localPoint)}}return this},e.InitializeVelocityConstraints=function(){for(var e=t.InitializeVelocityConstraints_s_xfA,i=t.InitializeVelocityConstraints_s_xfB,n=t.InitializeVelocityConstraints_s_worldManifold,r=0;r<this.m_count;++r){var s=this.m_velocityConstraints[r],a=this.m_positionConstraints[r],o=a.radiusA,h=a.radiusB,u=this.m_contacts[s.contactIndex].GetManifold(),l=s.indexA,c=s.indexB,f=s.invMassA,_=s.invMassB,d=s.invIA,p=s.invIB,m=a.localCenterA,g=a.localCenterB,y=this.m_positions[l].c,v=this.m_positions[l].a,b=this.m_velocities[l].v,S=this.m_velocities[l].w,w=this.m_positions[c].c,x=this.m_positions[c].a,T=this.m_velocities[c].v,A=this.m_velocities[c].w;e.q.SetAngle(v),i.q.SetAngle(x),j.SubVV(y,K.MulRV(e.q,m,j.s_t0),e.p),j.SubVV(w,K.MulRV(i.q,g,j.s_t0),i.p),n.Initialize(u,e,o,i,h),s.normal.Copy(n.normal),j.CrossVOne(s.normal,s.tangent);for(var C=s.pointCount,D=0;D<C;++D){var B=s.points[D];j.SubVV(n.points[D],y,B.rA),j.SubVV(n.points[D],w,B.rB);var I=j.CrossVV(B.rA,s.normal),M=j.CrossVV(B.rB,s.normal),P=f+_+d*I*I+p*M*M;B.normalMass=P>0?1/P:0;var E=s.tangent,O=j.CrossVV(B.rA,E),k=j.CrossVV(B.rB,E),R=f+_+d*O*O+p*k*k;B.tangentMass=R>0?1/R:0,B.velocityBias=0;var F=j.DotVV(s.normal,j.SubVV(j.AddVCrossSV(T,A,B.rB,j.s_t0),j.AddVCrossSV(b,S,B.rA,j.s_t1),j.s_t0));F<-1&&(B.velocityBias+=-s.restitution*F)}s.pointCount}},e.WarmStart=function(){for(var e=t.WarmStart_s_P,i=0;i<this.m_count;++i){for(var n=this.m_velocityConstraints[i],r=n.indexA,s=n.indexB,a=n.invMassA,o=n.invIA,h=n.invMassB,u=n.invIB,l=n.pointCount,c=this.m_velocities[r].v,f=this.m_velocities[r].w,_=this.m_velocities[s].v,d=this.m_velocities[s].w,p=n.normal,m=n.tangent,g=0;g<l;++g){var y=n.points[g];j.AddVV(j.MulSV(y.normalImpulse,p,j.s_t0),j.MulSV(y.tangentImpulse,m,j.s_t1),e),f-=o*j.CrossVV(y.rA,e),c.SelfMulSub(a,e),d+=u*j.CrossVV(y.rB,e),_.SelfMulAdd(h,e)}this.m_velocities[r].w=f,this.m_velocities[s].w=d}},e.SolveVelocityConstraints=function(){var e=t.SolveVelocityConstraints_s_dv;t.SolveVelocityConstraints_s_dv1,t.SolveVelocityConstraints_s_dv2;var i=t.SolveVelocityConstraints_s_P;t.SolveVelocityConstraints_s_a,t.SolveVelocityConstraints_s_b,t.SolveVelocityConstraints_s_x,t.SolveVelocityConstraints_s_d,t.SolveVelocityConstraints_s_P1,t.SolveVelocityConstraints_s_P2,t.SolveVelocityConstraints_s_P1P2;for(var n=0;n<this.m_count;++n){for(var r=this.m_velocityConstraints[n],s=r.indexA,a=r.indexB,o=r.invMassA,h=r.invIA,u=r.invMassB,l=r.invIB,c=r.pointCount,f=this.m_velocities[s].v,_=this.m_velocities[s].w,d=this.m_velocities[a].v,p=this.m_velocities[a].w,m=r.normal,g=r.tangent,y=r.friction,v=0;v<c;++v){var b=r.points[v];j.SubVV(j.AddVCrossSV(d,p,b.rB,j.s_t0),j.AddVCrossSV(f,_,b.rA,j.s_t1),e);var S=j.DotVV(e,g)-r.tangentSpeed,w=b.tangentMass*-S,x=y*b.normalImpulse,T=k(b.tangentImpulse+w,-x,x);w=T-b.tangentImpulse,b.tangentImpulse=T,j.MulSV(w,g,i),f.SelfMulSub(o,i),_-=h*j.CrossVV(b.rA,i),d.SelfMulAdd(u,i),p+=l*j.CrossVV(b.rB,i)}r.pointCount;for(var A=0;A<c;++A){var C=r.points[A];j.SubVV(j.AddVCrossSV(d,p,C.rB,j.s_t0),j.AddVCrossSV(f,_,C.rA,j.s_t1),e);var D=j.DotVV(e,m),B=-C.normalMass*(D-C.velocityBias),I=O(C.normalImpulse+B,0);B=I-C.normalImpulse,C.normalImpulse=I,j.MulSV(B,m,i),f.SelfMulSub(o,i),_-=h*j.CrossVV(C.rA,i),d.SelfMulAdd(u,i),p+=l*j.CrossVV(C.rB,i)}this.m_velocities[s].w=_,this.m_velocities[a].w=p}},e.StoreImpulses=function(){for(var t=0;t<this.m_count;++t)for(var e=this.m_velocityConstraints[t],i=this.m_contacts[e.contactIndex].GetManifold(),n=0;n<e.pointCount;++n)i.points[n].normalImpulse=e.points[n].normalImpulse,i.points[n].tangentImpulse=e.points[n].tangentImpulse},e.SolvePositionConstraints=function(){for(var e=t.SolvePositionConstraints_s_xfA,i=t.SolvePositionConstraints_s_xfB,n=t.SolvePositionConstraints_s_psm,r=t.SolvePositionConstraints_s_rA,s=t.SolvePositionConstraints_s_rB,a=t.SolvePositionConstraints_s_P,o=0,h=0;h<this.m_count;++h){for(var u=this.m_positionConstraints[h],c=u.indexA,f=u.indexB,_=u.localCenterA,d=u.invMassA,p=u.invIA,m=u.localCenterB,g=u.invMassB,y=u.invIB,v=u.pointCount,b=this.m_positions[c].c,S=this.m_positions[c].a,w=this.m_positions[f].c,x=this.m_positions[f].a,T=0;T<v;++T){e.q.SetAngle(S),i.q.SetAngle(x),j.SubVV(b,K.MulRV(e.q,_,j.s_t0),e.p),j.SubVV(w,K.MulRV(i.q,m,j.s_t0),i.p),n.Initialize(u,e,i,T);var A=n.normal,C=n.point,D=n.separation;j.SubVV(C,b,r),j.SubVV(C,w,s),o=E(o,D);var B=k(.2*(D+l),-.2,0),I=j.CrossVV(r,A),M=j.CrossVV(s,A),P=d+g+p*I*I+y*M*M,O=P>0?-B/P:0;j.MulSV(O,A,a),b.SelfMulSub(d,a),S-=p*j.CrossVV(r,a),w.SelfMulAdd(g,a),x+=y*j.CrossVV(s,a)}this.m_positions[c].a=S,this.m_positions[f].a=x}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;c<this.m_count;++c){var f=this.m_positionConstraints[c],_=f.indexA,d=f.indexB,p=f.localCenterA,m=f.localCenterB,g=f.pointCount,y=0,v=0;_!==e&&_!==i||(y=f.invMassA,v=f.invIA);var b=0,S=0;d!==e&&d!==i||(b=f.invMassB,S=f.invIB);for(var w=this.m_positions[_].c,x=this.m_positions[_].a,T=this.m_positions[d].c,A=this.m_positions[d].a,C=0;C<g;++C){n.q.SetAngle(x),r.q.SetAngle(A),j.SubVV(w,K.MulRV(n.q,p,j.s_t0),n.p),j.SubVV(T,K.MulRV(r.q,m,j.s_t0),r.p),s.Initialize(f,n,r,C);var D=s.normal,B=s.point,I=s.separation;j.SubVV(B,w,a),j.SubVV(B,T,o),u=E(u,I);var M=k(.75*(I+l),-.2,0),P=j.CrossVV(a,D),O=j.CrossVV(o,D),R=y+b+v*P*P+S*O*O,F=R>0?-M/R:0;j.MulSV(F,D,h),w.SelfMulSub(y,h),x-=v*j.CrossVV(a,h),T.SelfMulAdd(b,h),A+=S*j.CrossVV(o,h)}this.m_positions[_].a=x,this.m_positions[d].a=A}return u>=-.012},t}();Ln.InitializeVelocityConstraints_s_xfA=new Q,Ln.InitializeVelocityConstraints_s_xfB=new Q,Ln.InitializeVelocityConstraints_s_worldManifold=new Rt,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 Q,Ln.SolvePositionConstraints_s_xfB=new Q,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 Q,Ln.SolveTOIPositionConstraints_s_xfB=new Q,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=Bn.MakeArray(1024),this.m_velocities=In.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.length<t)for(var r=O(2*this.m_positions.length,t);this.m_positions.length<r;)this.m_positions[this.m_positions.length]=new Bn;if(this.m_velocities.length<t)for(var s=O(2*this.m_velocities.length,t);this.m_velocities.length<s;)this.m_velocities[this.m_velocities.length]=new In},n.Clear=function(){this.m_bodyCount=0,this.m_contactCount=0,this.m_jointCount=0},n.AddBody=function(t){t.m_islandIndex=this.m_bodyCount,this.m_bodies[this.m_bodyCount++]=t},n.AddContact=function(t){this.m_contacts[this.m_contactCount++]=t},n.AddJoint=function(t){this.m_joints[this.m_jointCount++]=t},n.Solve=function(n,r,s,a){for(var o=e.s_timer.Reset(),h=r.dt,u=0;u<this.m_bodyCount;++u){var l=this.m_bodies[u];this.m_positions[u].c.Copy(l.m_sweep.c);var c=l.m_sweep.a,f=this.m_velocities[u].v.Copy(l.m_linearVelocity),_=l.m_angularVelocity;l.m_sweep.c0.Copy(l.m_sweep.c),l.m_sweep.a0=l.m_sweep.a,l.m_type===t.b2BodyType.b2_dynamicBody&&(f.x+=h*(l.m_gravityScale*s.x+l.m_invMass*l.m_force.x),f.y+=h*(l.m_gravityScale*s.y+l.m_invMass*l.m_force.y),_+=h*l.m_invI*l.m_torque,f.SelfMul(1/(1+h*l.m_linearDamping)),_*=1/(1+h*l.m_angularDamping)),this.m_positions[u].a=c,this.m_velocities[u].w=_}o.Reset();var d=e.s_solverData;d.step.Copy(r),d.positions=this.m_positions,d.velocities=this.m_velocities;var p=e.s_contactSolverDef;p.step.Copy(r),p.contacts=this.m_contacts,p.count=this.m_contactCount,p.positions=this.m_positions,p.velocities=this.m_velocities;var y=e.s_contactSolver.Initialize(p);y.InitializeVelocityConstraints(),r.warmStarting&&y.WarmStart();for(var v=0;v<this.m_jointCount;++v)this.m_joints[v].InitVelocityConstraints(d);n.solveInit=o.GetMilliseconds(),o.Reset();for(var b=0;b<r.velocityIterations;++b){for(var S=0;S<this.m_jointCount;++S)this.m_joints[S].SolveVelocityConstraints(d);y.SolveVelocityConstraints()}y.StoreImpulses(),n.solveVelocity=o.GetMilliseconds();for(var w=0;w<this.m_bodyCount;++w){var x=this.m_positions[w].c,T=this.m_positions[w].a,A=this.m_velocities[w].v,C=this.m_velocities[w].w,D=j.MulSV(h,A,e.s_translation);if(j.DotVV(D,D)>4){var B=2/D.Length();A.SelfMul(B)}var I=h*C;I*I>g&&(C*=m/P(I)),x.x+=h*A.x,x.y+=h*A.y,T+=h*C,this.m_positions[w].a=T,this.m_velocities[w].w=C}o.Reset();for(var M=!1,O=0;O<r.positionIterations;++O){for(var k=y.SolvePositionConstraints(),R=!0,F=0;F<this.m_jointCount;++F){var L=this.m_joints[F].SolvePositionConstraints(d);R=R&&L}if(k&&R){M=!0;break}}for(var V=0;V<this.m_bodyCount;++V){var N=this.m_bodies[V];N.m_sweep.c.Copy(this.m_positions[V].c),N.m_sweep.a=this.m_positions[V].a,N.m_linearVelocity.Copy(this.m_velocities[V].v),N.m_angularVelocity=this.m_velocities[V].w,N.SynchronizeTransform()}if(n.solvePosition=o.GetMilliseconds(),this.Report(y.m_velocityConstraints),a){for(var z=i,U=0;U<this.m_bodyCount;++U){var G=this.m_bodies[U];G.GetType()!==t.b2BodyType.b2_staticBody&&(!G.m_autoSleepFlag||G.m_angularVelocity*G.m_angularVelocity>.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;H<this.m_bodyCount;++H)this.m_bodies[H].SetAwake(!1)}},n.SolveTOI=function(t,i,n){for(var r=0;r<this.m_bodyCount;++r){var s=this.m_bodies[r];this.m_positions[r].c.Copy(s.m_sweep.c),this.m_positions[r].a=s.m_sweep.a,this.m_velocities[r].v.Copy(s.m_linearVelocity),this.m_velocities[r].w=s.m_angularVelocity}var a=e.s_contactSolverDef;a.contacts=this.m_contacts,a.count=this.m_contactCount,a.step.Copy(t),a.positions=this.m_positions,a.velocities=this.m_velocities;for(var o=e.s_contactSolver.Initialize(a),h=0;h<t.positionIterations&&!o.SolveTOIPositionConstraints(i,n);++h);this.m_bodies[i].m_sweep.c0.Copy(this.m_positions[i].c),this.m_bodies[i].m_sweep.a0=this.m_positions[i].a,this.m_bodies[n].m_sweep.c0.Copy(this.m_positions[n].c),this.m_bodies[n].m_sweep.a0=this.m_positions[n].a,o.InitializeVelocityConstraints();for(var u=0;u<t.velocityIterations;++u)o.SolveVelocityConstraints();for(var l=t.dt,c=0;c<this.m_bodyCount;++c){var f=this.m_positions[c].c,_=this.m_positions[c].a,d=this.m_velocities[c].v,p=this.m_velocities[c].w,y=j.MulSV(l,d,e.s_translation);if(j.DotVV(y,y)>4){var v=2/y.Length();d.SelfMul(v)}var b=l*p;b*b>g&&(p*=m/P(b)),f.SelfMulAdd(l,d),_+=l*p,this.m_positions[c].a=_,this.m_velocities[c].w=p;var S=this.m_bodies[c];S.m_sweep.c.Copy(f),S.m_sweep.a=_,S.m_linearVelocity.Copy(d),S.m_angularVelocity=p,S.SynchronizeTransform()}this.Report(o.m_velocityConstraints)},n.Report=function(t){if(null!==this.m_listener)for(var i=0;i<this.m_contactCount;++i){var n=this.m_contacts[i];if(n){var r=t[i],s=e.s_impulse;s.count=r.pointCount;for(var a=0;a<r.pointCount;++a)s.normalImpulses[a]=r.points[a].normalImpulse,s.tangentImpulses[a]=r.points[a].tangentImpulse;this.m_listener.PostSolve(n,s)}}},e}();Nn.s_timer=new it,Nn.s_solverData=new Mn,Nn.s_contactSolverDef=new Rn,Nn.s_contactSolver=new Ln,Nn.s_translation=new j,Nn.s_impulse=new Sn,(Vn=t.b2ParticleFlag||(t.b2ParticleFlag={}))[Vn.b2_waterParticle=0]="b2_waterParticle",Vn[Vn.b2_zombieParticle=2]="b2_zombieParticle",Vn[Vn.b2_wallParticle=4]="b2_wallParticle",Vn[Vn.b2_springParticle=8]="b2_springParticle",Vn[Vn.b2_elasticParticle=16]="b2_elasticParticle",Vn[Vn.b2_viscousParticle=32]="b2_viscousParticle",Vn[Vn.b2_powderParticle=64]="b2_powderParticle",Vn[Vn.b2_tensileParticle=128]="b2_tensileParticle",Vn[Vn.b2_colorMixingParticle=256]="b2_colorMixingParticle",Vn[Vn.b2_destructionListenerParticle=512]="b2_destructionListenerParticle",Vn[Vn.b2_barrierParticle=1024]="b2_barrierParticle",Vn[Vn.b2_staticPressureParticle=2048]="b2_staticPressureParticle",Vn[Vn.b2_reactiveParticle=4096]="b2_reactiveParticle",Vn[Vn.b2_repulsiveParticle=8192]="b2_repulsiveParticle",Vn[Vn.b2_fixtureContactListenerParticle=16384]="b2_fixtureContactListenerParticle",Vn[Vn.b2_particleContactListenerParticle=32768]="b2_particleContactListenerParticle",Vn[Vn.b2_fixtureContactFilterParticle=65536]="b2_fixtureContactFilterParticle",Vn[Vn.b2_particleContactFilterParticle=131072]="b2_particleContactFilterParticle";var zn=function(){this.flags=0,this.position=new j,this.velocity=new j,this.color=new tt(0,0,0,0),this.lifetime=0,this.userData=null,this.group=null};function Un(t,e,i){return k(Math.ceil(Math.sqrt(t/(.01*e))*i),1,8)}var Gn,Hn=function(){function t(){this.m_index=y}var e=t.prototype;return e.GetIndex=function(){return this.m_index},e.SetIndex=function(t){this.m_index=t},t}();(Gn=t.b2ParticleGroupFlag||(t.b2ParticleGroupFlag={}))[Gn.b2_solidParticleGroup=1]="b2_solidParticleGroup",Gn[Gn.b2_rigidParticleGroup=2]="b2_rigidParticleGroup",Gn[Gn.b2_particleGroupCanBeEmpty=4]="b2_particleGroupCanBeEmpty",Gn[Gn.b2_particleGroupWillBeDestroyed=8]="b2_particleGroupWillBeDestroyed",Gn[Gn.b2_particleGroupNeedsUpdateDepth=16]="b2_particleGroupNeedsUpdateDepth",Gn[Gn.b2_particleGroupInternalMask=24]="b2_particleGroupInternalMask";var Wn=function(){this.flags=0,this.groupFlags=0,this.position=new j,this.angle=0,this.linearVelocity=new j,this.angularVelocity=0,this.color=new tt,this.strength=1,this.shapeCount=0,this.stride=0,this.particleCount=0,this.lifetime=0,this.userData=null,this.group=null},jn=function(){function e(t){this.m_firstIndex=0,this.m_lastIndex=0,this.m_groupFlags=0,this.m_strength=1,this.m_prev=null,this.m_next=null,this.m_timestamp=-1,this.m_mass=0,this.m_inertia=0,this.m_center=new j,this.m_linearVelocity=new j,this.m_angularVelocity=0,this.m_transform=new Q,this.m_userData=null,this.m_system=t}var i=e.prototype;return i.GetNext=function(){return this.m_next},i.GetParticleSystem=function(){return this.m_system},i.GetParticleCount=function(){return this.m_lastIndex-this.m_firstIndex},i.GetBufferIndex=function(){return this.m_firstIndex},i.ContainsParticle=function(t){return this.m_firstIndex<=t&&t<this.m_lastIndex},i.GetAllParticleFlags=function(){if(!this.m_system.m_flagsBuffer.data)throw new Error;for(var t=0,e=this.m_firstIndex;e<this.m_lastIndex;e++)t|=this.m_system.m_flagsBuffer.data[e];return t},i.GetGroupFlags=function(){return this.m_groupFlags},i.SetGroupFlags=function(e){e|=this.m_groupFlags&t.b2ParticleGroupFlag.b2_particleGroupInternalMask,this.m_system.SetGroupFlags(this,e)},i.GetMass=function(){return this.UpdateStatistics(),this.m_mass},i.GetInertia=function(){return this.UpdateStatistics(),this.m_inertia},i.GetCenter=function(){return this.UpdateStatistics(),this.m_center},i.GetLinearVelocity=function(){return this.UpdateStatistics(),this.m_linearVelocity},i.GetAngularVelocity=function(){return this.UpdateStatistics(),this.m_angularVelocity},i.GetTransform=function(){return this.m_transform},i.GetPosition=function(){return this.m_transform.p},i.GetAngle=function(){return this.m_transform.q.GetAngle()},i.GetLinearVelocityFromWorldPoint=function(t,i){var n=e.GetLinearVelocityFromWorldPoint_s_t0;return this.UpdateStatistics(),j.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,j.SubVV(t,this.m_center,n),i)},i.GetUserData=function(){return this.m_userData},i.SetUserData=function(t){this.m_userData=t},i.ApplyForce=function(t){this.m_system.ApplyForce(this.m_firstIndex,this.m_lastIndex,t)},i.ApplyLinearImpulse=function(t){this.m_system.ApplyLinearImpulse(this.m_firstIndex,this.m_lastIndex,t)},i.DestroyParticles=function(t){if(this.m_system.m_world.IsLocked())throw new Error;for(var e=this.m_firstIndex;e<this.m_lastIndex;e++)this.m_system.DestroyParticle(e,t)},i.UpdateStatistics=function(){if(!this.m_system.m_positionBuffer.data)throw new Error;if(!this.m_system.m_velocityBuffer.data)throw new Error;var t=new j,e=new j;if(this.m_timestamp!==this.m_system.m_timestamp){var i=this.m_system.GetParticleMass();this.m_mass=i*(this.m_lastIndex-this.m_firstIndex),this.m_center.SetZero(),this.m_linearVelocity.SetZero();for(var n=this.m_firstIndex;n<this.m_lastIndex;n++)this.m_center.SelfMulAdd(i,this.m_system.m_positionBuffer.data[n]),this.m_linearVelocity.SelfMulAdd(i,this.m_system.m_velocityBuffer.data[n]);if(this.m_mass>0){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;s<this.m_lastIndex;s++)j.SubVV(this.m_system.m_positionBuffer.data[s],this.m_center,t),j.SubVV(this.m_system.m_velocityBuffer.data[s],this.m_linearVelocity,e),this.m_inertia+=i*j.DotVV(t,t),this.m_angularVelocity+=i*j.CrossVV(t,e);this.m_inertia>0&&(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<this.m_back;e++)this.m_buffer[e-this.m_front]=this.m_buffer[e];this.m_back-=this.m_front,this.m_front=0}this.m_buffer[this.m_back]=t,this.m_back++},e.Pop=function(){this.m_buffer[this.m_front]=null,this.m_front++},e.Empty=function(){return this.m_front===this.m_back},e.Front=function(){var t=this.m_buffer[this.m_front];if(!t)throw new Error;return t},n(t,[{key:"m_capacity",get:function(){return this.m_buffer.length}}]),t}(),Xn=function(){function t(t){this.m_generatorCapacity=0,this.m_generatorCount=0,this.m_countX=0,this.m_countY=0,this.m_diagram=[],this.m_generatorBuffer=C(t,(function(){return new Yn})),this.m_generatorCapacity=t}var e=t.prototype;return e.AddGenerator=function(t,e,i){var n=this.m_generatorBuffer[this.m_generatorCount++];n.center.Copy(t),n.tag=e,n.necessary=i},e.Generate=function(t,e){for(var i=1/t,n=new j(1e37,1e37),r=new j(-1e37,-1e37),s=0,a=0;a<this.m_generatorCount;a++){var o=this.m_generatorBuffer[a];o.necessary&&(j.MinV(n,o.center,n),j.MaxV(r,o.center,r),++s)}if(0===s)return this.m_countX=0,void(this.m_countY=0);n.x-=e,n.y-=e,r.x+=e,r.y+=e,this.m_countX=1+Math.floor(i*(r.x-n.x)),this.m_countY=1+Math.floor(i*(r.y-n.y)),this.m_diagram=[];for(var h=new qn(4*this.m_countX*this.m_countY),u=0;u<this.m_generatorCount;u++){var l=this.m_generatorBuffer[u];l.center.SelfSub(n).SelfMul(i);var c=Math.floor(l.center.x),f=Math.floor(l.center.y);c>=0&&f>=0&&c<this.m_countX&&f<this.m_countY&&h.Push(new Jn(c,f,c+f*this.m_countX,l))}for(;!h.Empty();){var _=h.Front(),d=_.m_x,p=_.m_y,m=_.m_i,g=_.m_generator;h.Pop(),this.m_diagram[m]||(this.m_diagram[m]=g,d>0&&h.Push(new Jn(d-1,p,m-1,g)),p>0&&h.Push(new Jn(d,p-1,m-this.m_countX,g)),d<this.m_countX-1&&h.Push(new Jn(d+1,p,m+1,g)),p<this.m_countY-1&&h.Push(new Jn(d,p+1,m+this.m_countX,g)))}for(var y=0;y<this.m_countY;y++)for(var v=0;v<this.m_countX-1;v++){var b=v+y*this.m_countX,S=this.m_diagram[b],w=this.m_diagram[b+1];S!==w&&(h.Push(new Jn(v,y,b,w)),h.Push(new Jn(v+1,y,b+1,S)))}for(var x=0;x<this.m_countY-1;x++)for(var T=0;T<this.m_countX;T++){var A=T+x*this.m_countX,C=this.m_diagram[A],D=this.m_diagram[A+this.m_countX];C!==D&&(h.Push(new Jn(T,x,A,D)),h.Push(new Jn(T,x+1,A+this.m_countX,C)))}for(;!h.Empty();){var B=h.Front(),I=B.m_x,M=B.m_y,P=B.m_i,E=B.m_generator;h.Pop();var O=this.m_diagram[P],k=E;if(O!==k){var R=O.center.x-I,F=O.center.y-M,L=k.center.x-I,V=k.center.y-M;R*R+F*F>L*L+V*V&&(this.m_diagram[P]=k,I>0&&h.Push(new Jn(I-1,M,P-1,k)),M>0&&h.Push(new Jn(I,M-1,P-this.m_countX,k)),I<this.m_countX-1&&h.Push(new Jn(I+1,M,P+1,k)),M<this.m_countY-1&&h.Push(new Jn(I,M+1,P+this.m_countX,k)))}}},e.GetNodes=function(t){for(var e=0;e<this.m_countY-1;e++)for(var i=0;i<this.m_countX-1;i++){var n=i+e*this.m_countX,r=this.m_diagram[n],s=this.m_diagram[n+1],a=this.m_diagram[n+this.m_countX],o=this.m_diagram[n+1+this.m_countX];s!==a&&(r!==s&&r!==a&&(r.necessary||s.necessary||a.necessary)&&t(r.tag,s.tag,a.tag),o!==s&&o!==a&&(r.necessary||s.necessary||a.necessary)&&t(s.tag,o.tag,a.tag))}},t}(),Yn=function(){this.center=new j,this.tag=0,this.necessary=!1},Jn=function(t,e,i,n){this.m_x=t,this.m_y=e,this.m_i=i,this.m_generator=n};function Kn(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function Qn(t,e){return t<e}function Zn(t,e,i,n){void 0===i&&(i=t.length-e),void 0===n&&(n=Qn);for(var r=e,s=[],a=0;;){for(;r+1<i;i++){var o=t[r+Math.floor(Math.random()*(i-r))];s[a++]=i;for(var h=r-1;;){for(;n(t[++h],o););for(;n(o,t[--i]););if(h>=i)break;Kn(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=Qn),Zn(t,e,i,n)}function tr(t,e,i){void 0===i&&(i=t.length);for(var n=0,r=0;r<i;++r)e(t[r])||(r!==n?Kn(t,n++,r):++n);return n}function er(t,e,i,n,r){for(var s=i-e;s>0;){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;)Kn(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])||Kn(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<t;++e)this.data[e]=this.allocator();this.capacity=t}},e.Grow=function(){var t=this.capacity?2*this.capacity:S;this.Reserve(t)},e.Free=function(){0!==this.data.length&&(this.data=[],this.capacity=0,this.count=0)},e.Shorten=function(){},e.Data=function(){return this.data},e.GetCount=function(){return this.count},e.SetCount=function(t){this.count=t},e.GetCapacity=function(){return this.capacity},e.RemoveIf=function(t){this.count=tr(this.data,t,this.count)},e.Unique=function(t){this.count=rr(this.data,0,this.count,t)},t}(),ar=function(t){function e(e){var i;return(i=t.call(this)||this).m_system=e,i}s(e,t);var i=e.prototype;return i.ShouldQueryParticleSystem=function(){return!1},i.ReportFixture=function(t){if(t.IsSensor())return!0;for(var e=t.GetShape().GetChildCount(),i=0;i<e;i++)for(var n=t.GetAABB(i),r=this.m_system.GetInsideBoundsEnumerator(n),s=void 0;(s=r.GetNext())>=0;)this.ReportFixtureAndParticle(t,i,s);return!0},i.ReportParticle=function(){return!1},i.ReportFixtureAndParticle=function(){},e}(xn),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 _r,this.m_flagsBuffer=new _r,this.m_positionBuffer=new _r,this.m_velocityBuffer=new _r,this.m_forceBuffer=[],this.m_weightBuffer=[],this.m_staticPressureBuffer=[],this.m_accumulationBuffer=[],this.m_accumulation2Buffer=[],this.m_depthBuffer=[],this.m_colorBuffer=new _r,this.m_groupBuffer=[],this.m_userDataBuffer=new _r,this.m_stuckThreshold=0,this.m_lastBodyContactStepBuffer=new _r,this.m_bodyContactCountBuffer=new _r,this.m_consecutiveContactStepsBuffer=new _r,this.m_stuckParticleBuffer=new sr((function(){return 0})),this.m_proxyBuffer=new sr((function(){return new dr})),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 _r,this.m_indexByExpirationTimeBuffer=new _r,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<<n.yShift)+(n.xScale*t+n.xOffset>>>0)>>>0},n.computeRelativeTag=function(t,e,i){return t+(i<<n.yShift)+(e<<n.xShift)>>>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 y;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_firstIndex<h.m_lastIndex?(this.RotateBuffer(h.m_firstIndex,h.m_lastIndex,n),h.m_lastIndex=n+1):(h.m_firstIndex=n,h.m_lastIndex=n+1)),this.SetParticleFlags(n,e(t.flags,0)),n},r.GetParticleHandleFromIndex=function(t){this.m_handleIndexBuffer.data=this.RequestBuffer(this.m_handleIndexBuffer.data);var e=this.m_handleIndexBuffer.data[t];return e||((e=new Hn).SetIndex(t),this.m_handleIndexBuffer.data[t]=e,e)},r.DestroyParticle=function(e,i){void 0===i&&(i=!1);var n=t.b2ParticleFlag.b2_zombieParticle;i&&(n|=t.b2ParticleFlag.b2_destructionListenerParticle),this.SetParticleFlags(e,this.m_flagsBuffer.data[e]|n)},r.DestroyOldestParticle=function(t,e){void 0===e&&(e=!1);var i=this.GetParticleCount(),n=this.m_indexByExpirationTimeBuffer.data[i-(t+1)],r=this.m_indexByExpirationTimeBuffer.data[t];this.DestroyParticle(this.m_expirationTimeBuffer.data[n]>0?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;o<a;o++){var h=t.positionData[o];this.CreateParticleForGroup(t,r,h)}var u=this.m_count,l=new jn(this);l.m_firstIndex=s,l.m_lastIndex=u,l.m_strength=e(t.strength,1),l.m_userData=t.userData,l.m_transform.Copy(r),l.m_prev=null,l.m_next=this.m_groupList,this.m_groupList&&(this.m_groupList.m_prev=l),this.m_groupList=l,++this.m_groupCount;for(var c=s;c<u;c++)this.m_groupBuffer[c]=l;this.SetGroupFlags(l,e(t.groupFlags,0));var f=new br;return this.UpdateContacts(!0),this.UpdatePairsAndTriads(s,u,f),t.group&&(this.JoinParticleGroups(t.group,l),l=t.group),l},r.JoinParticleGroups=function(t,e){if(this.m_world.IsLocked())throw new Error;this.RotateBuffer(e.m_firstIndex,e.m_lastIndex,this.m_count),this.RotateBuffer(t.m_firstIndex,t.m_lastIndex,e.m_firstIndex);var i=new wr(e.m_firstIndex);this.UpdateContacts(!0),this.UpdatePairsAndTriads(t.m_firstIndex,e.m_lastIndex,i);for(var n=e.m_firstIndex;n<e.m_lastIndex;n++)this.m_groupBuffer[n]=t;var r=t.m_groupFlags|e.m_groupFlags;this.SetGroupFlags(t,r),t.m_lastIndex=e.m_lastIndex,e.m_firstIndex=e.m_lastIndex,this.DestroyParticleGroup(e)},r.SplitParticleGroup=function(t){this.UpdateContacts(!0);var e=C(t.GetParticleCount(),(function(){return new mr}));n.InitializeParticleLists(t,e),this.MergeParticleListsInContact(t,e);var i=n.FindLongestParticleList(t,e);this.MergeZombieParticleListNodes(t,e,i),this.CreateParticleGroupsFromParticleList(t,e,i),this.UpdatePairsAndTriadsWithParticleList(t,e)},r.GetParticleGroupList=function(){return this.m_groupList},r.GetParticleGroupCount=function(){return this.m_groupCount},r.GetParticleCount=function(){return this.m_count},r.GetMaxParticleCount=function(){return this.m_def.maxCount},r.SetMaxParticleCount=function(t){this.m_def.maxCount=t},r.GetAllParticleFlags=function(){return this.m_allParticleFlags},r.GetAllGroupFlags=function(){return this.m_allGroupFlags},r.SetPaused=function(t){this.m_paused=t},r.GetPaused=function(){return this.m_paused},r.SetDensity=function(t){this.m_def.density=t,this.m_inverseDensity=1/this.m_def.density},r.GetDensity=function(){return this.m_def.density},r.SetGravityScale=function(t){this.m_def.gravityScale=t},r.GetGravityScale=function(){return this.m_def.gravityScale},r.SetDamping=function(t){this.m_def.dampingStrength=t},r.GetDamping=function(){return this.m_def.dampingStrength},r.SetStaticPressureIterations=function(t){this.m_def.staticPressureIterations=t},r.GetStaticPressureIterations=function(){return this.m_def.staticPressureIterations},r.SetRadius=function(t){this.m_particleDiameter=2*t,this.m_squaredDiameter=this.m_particleDiameter*this.m_particleDiameter,this.m_inverseDiameter=1/this.m_particleDiameter},r.GetRadius=function(){return this.m_particleDiameter/2},r.GetPositionBuffer=function(){return this.m_positionBuffer.data},r.GetVelocityBuffer=function(){return this.m_velocityBuffer.data},r.GetColorBuffer=function(){return this.m_colorBuffer.data=this.RequestBuffer(this.m_colorBuffer.data),this.m_colorBuffer.data},r.GetGroupBuffer=function(){return this.m_groupBuffer},r.GetWeightBuffer=function(){return this.m_weightBuffer},r.GetUserDataBuffer=function(){return this.m_userDataBuffer.data=this.RequestBuffer(this.m_userDataBuffer.data),this.m_userDataBuffer.data},r.GetFlagsBuffer=function(){return this.m_flagsBuffer.data},r.SetParticleFlags=function(e,i){this.m_flagsBuffer.data[e]&~i&&(this.m_needsUpdateAllParticleFlags=!0),~this.m_allParticleFlags&i&&(i&t.b2ParticleFlag.b2_tensileParticle&&(this.m_accumulation2Buffer=this.RequestBuffer(this.m_accumulation2Buffer)),i&t.b2ParticleFlag.b2_colorMixingParticle&&(this.m_colorBuffer.data=this.RequestBuffer(this.m_colorBuffer.data)),this.m_allParticleFlags|=i),this.m_flagsBuffer.data[e]=i},r.GetParticleFlags=function(t){return this.m_flagsBuffer.data[t]},r.SetFlagsBuffer=function(t){this.SetUserOverridableBuffer(this.m_flagsBuffer,t)},r.SetPositionBuffer=function(t){if(t instanceof Float32Array){if(t.length%2!=0)throw new Error;for(var e=t.length/2,i=new Array(e),n=0;n<e;++n)i[n]=new j(t.subarray(2*n,2*n+2));t=i}this.SetUserOverridableBuffer(this.m_positionBuffer,t)},r.SetVelocityBuffer=function(t){if(t instanceof Float32Array){if(t.length%2!=0)throw new Error;for(var e=t.length/2,i=new Array(e),n=0;n<e;++n)i[n]=new j(t.subarray(2*n,2*n+2));t=i}this.SetUserOverridableBuffer(this.m_velocityBuffer,t)},r.SetColorBuffer=function(t){if(t instanceof Float32Array){if(t.length%4!=0)throw new Error;for(var e=t.length/4,i=new Array(e),n=0;n<e;++n)i[n]=new tt(t.subarray(4*n,4*n+4));t=i}this.SetUserOverridableBuffer(this.m_colorBuffer,t)},r.SetUserDataBuffer=function(t){this.SetUserOverridableBuffer(this.m_userDataBuffer,t)},r.GetContacts=function(){return this.m_contactBuffer.data},r.GetContactCount=function(){return this.m_contactBuffer.count},r.GetBodyContacts=function(){return this.m_bodyContactBuffer.data},r.GetBodyContactCount=function(){return this.m_bodyContactBuffer.count},r.GetPairs=function(){return this.m_pairBuffer.data},r.GetPairCount=function(){return this.m_pairBuffer.count},r.GetTriads=function(){return this.m_triadBuffer.data},r.GetTriadCount=function(){return this.m_triadBuffer.count},r.SetStuckThreshold=function(t){this.m_stuckThreshold=t,t>0&&(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;r<this.m_contactBuffer.count;r++){var s=this.m_contactBuffer.data[r],a=s.indexA,o=s.indexB,h=s.normal,u=j.SubVV(e[o],e[a],t),l=j.DotVV(u,h);l<0&&(i+=l*l)}return.5*this.GetParticleMass()*i},r.SetStrictContactCheck=function(t){this.m_def.strictContactCheck=t},r.GetStrictContactCheck=function(){return this.m_def.strictContactCheck},r.SetParticleLifetime=function(t,e){var i=null===this.m_indexByExpirationTimeBuffer.data;if(this.m_expirationTimeBuffer.data=this.RequestBuffer(this.m_expirationTimeBuffer.data),this.m_indexByExpirationTimeBuffer.data=this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data),i)for(var n=this.GetParticleCount(),r=0;r<n;++r)this.m_indexByExpirationTimeBuffer.data[r]=r;var s=e/this.m_def.lifetimeGranularity,a=s>0?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<e;a++)n[a].SelfAdd(s)},n.IsSignificantForce=function(t){return 0!==t.x||0!==t.y},r.ParticleApplyForce=function(t,e){n.IsSignificantForce(e)&&this.ForceCanBeApplied(this.m_flagsBuffer.data[t])&&(this.PrepareForceBuffer(),this.m_forceBuffer[t].SelfAdd(e))},r.ApplyForce=function(t,e,i){var r=(new j).Copy(i).SelfMul(1/(e-t));if(n.IsSignificantForce(r)){this.PrepareForceBuffer();for(var s=t;s<e;s++)this.m_forceBuffer[s].SelfAdd(r)}},r.GetNext=function(){return this.m_next},r.QueryAABB=function(t,e){if(0!==this.m_proxyBuffer.count)for(var i=this.m_proxyBuffer.count,r=er(this.m_proxyBuffer.data,0,i,n.computeTag(this.m_inverseDiameter*e.lowerBound.x,this.m_inverseDiameter*e.lowerBound.y),dr.CompareProxyTag),s=ir(this.m_proxyBuffer.data,r,i,n.computeTag(this.m_inverseDiameter*e.upperBound.x,this.m_inverseDiameter*e.upperBound.y),dr.CompareTagProxy),a=this.m_positionBuffer.data,o=r;o<s;++o){var h=this.m_proxyBuffer.data[o].index,u=a[h];if(e.lowerBound.x<u.x&&u.x<e.upperBound.x&&e.lowerBound.y<u.y&&u.y<e.upperBound.y&&!t.ReportParticle(this,h))break}},r.QueryShapeAABB=function(t,e,i,r){void 0===r&&(r=0);var s=n.QueryShapeAABB_s_aabb;e.ComputeAABB(s,i,r),this.QueryAABB(t,s)},r.QueryPointAABB=function(t,e,i){void 0===i&&(i=l);var r=n.QueryPointAABB_s_aabb;r.lowerBound.Set(e.x-i,e.y-i),r.upperBound.Set(e.x+i,e.y+i),this.QueryAABB(t,r)},r.RayCast=function(t,e,i){var r=n.RayCast_s_aabb,s=n.RayCast_s_p,a=n.RayCast_s_v,o=n.RayCast_s_n,h=n.RayCast_s_point;if(0!==this.m_proxyBuffer.count){var u=this.m_positionBuffer.data,l=r;j.MinV(e,i,l.lowerBound),j.MaxV(e,i,l.upperBound);for(var c,f=1,_=j.SubVV(i,e,a),d=j.DotVV(_,_),p=this.GetInsideBoundsEnumerator(l);(c=p.GetNext())>=0;){var m=j.SubVV(e,u[c],s),g=j.DotVV(m,_),y=g*g-d*(j.DotVV(m,m)-this.m_squaredDiameter);if(y>=0){var v=V(y),b=(-g-v)/d;if(b>f)continue;if(b<0&&((b=(-g+v)/d)<0||b>f))continue;var S=j.AddVMulSV(m,b,_,o);if(S.Normalize(),(f=E(f,t.ReportParticle(this,c,j.AddVMulSV(e,b,_,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;n<e;n++){var r=i[n];j.MinV(t.lowerBound,r,t.lowerBound),j.MaxV(t.upperBound,r,t.upperBound)}t.lowerBound.x-=this.m_particleDiameter,t.lowerBound.y-=this.m_particleDiameter,t.upperBound.x+=this.m_particleDiameter,t.upperBound.y+=this.m_particleDiameter},r.FreeBuffer=function(t){null!==t&&(t.length=0)},r.FreeUserOverridableBuffer=function(t){0===t.userSuppliedCapacity&&this.FreeBuffer(t.data,this.m_internalAllocatedCapacity)},r.ReallocateBuffer3=function(t,e,i){if(i<=e)throw new Error;var n=t?t.slice():[];return n.length=i,n},r.ReallocateBuffer5=function(t,e,i,n,r){if(n<=i)throw new Error;if(e&&!(n<=e))throw new Error;return r&&!t||e||(t=this.ReallocateBuffer3(t,i,n)),t},r.ReallocateBuffer4=function(t,e,i,n){return this.ReallocateBuffer5(t.data,t.userSuppliedCapacity,e,i,n)},r.RequestBuffer=function(t){return t||(0===this.m_internalAllocatedCapacity&&this.ReallocateInternalAllocatedBuffers(S),(t=[]).length=this.m_internalAllocatedCapacity),t},r.ReallocateHandleBuffers=function(t){this.m_handleIndexBuffer.data=this.ReallocateBuffer4(this.m_handleIndexBuffer,this.m_internalAllocatedCapacity,t,!0)},r.ReallocateInternalAllocatedBuffers=function(t){function e(t,e){return e&&t>e?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_internalAllocatedCapacity<t){this.ReallocateHandleBuffers(t),this.m_flagsBuffer.data=this.ReallocateBuffer4(this.m_flagsBuffer,this.m_internalAllocatedCapacity,t,!1);var i=this.m_stuckThreshold>0;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),Q.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<c;f++){var _=null;i.GetType()===t.b2ShapeType.e_edgeShape?_=i:(_=a,i.GetChildEdge(_,f));for(var d=j.SubVV(_.m_vertex2,_.m_vertex1,o),p=d.Length();l<p;){var m=j.AddVMulSV(_.m_vertex1,l/p,d,h);this.CreateParticleForGroup(r,s,m),l+=u}l-=p}},r.CreateParticlesFillShapeForGroup=function(t,i,r){var s=n.CreateParticlesFillShapeForGroup_s_aabb,a=n.CreateParticlesFillShapeForGroup_s_p,o=e(i.stride,0);0===o&&(o=this.GetParticleStride());var h=Q.IDENTITY,u=s;t.ComputeAABB(u,h,0);for(var l=Math.floor(u.lowerBound.y/o)*o;l<u.upperBound.y;l+=o)for(var c=Math.floor(u.lowerBound.x/o)*o;c<u.upperBound.x;c+=o){var f=a.Set(c,l);t.TestPoint(h,f)&&this.CreateParticleForGroup(i,r,f)}},r.CreateParticlesWithShapeForGroup=function(e,i,n){switch(e.GetType()){case t.b2ShapeType.e_edgeShape:case t.b2ShapeType.e_chainShape:this.CreateParticlesStrokeShapeForGroup(e,i,n);break;case t.b2ShapeType.e_polygonShape:case t.b2ShapeType.e_circleShape:this.CreateParticlesFillShapeForGroup(e,i,n)}},r.CreateParticlesWithShapesForGroup=function(t,e,i,n){var r=new xr(t,e);this.CreateParticlesFillShapeForGroup(r,i,n)},r.CloneParticle=function(t,e){var i=new zn;i.flags=this.m_flagsBuffer.data[t],i.position.Copy(this.m_positionBuffer.data[t]),i.velocity.Copy(this.m_velocityBuffer.data[t]),this.m_colorBuffer.data&&i.color.Copy(this.m_colorBuffer.data[t]),this.m_userDataBuffer.data&&(i.userData=this.m_userDataBuffer.data[t]),i.group=e;var n=this.CreateParticle(i);if(this.m_handleIndexBuffer.data){var r=this.m_handleIndexBuffer.data[t];r&&r.SetIndex(n),this.m_handleIndexBuffer.data[n]=r,this.m_handleIndexBuffer.data[t]=null}return this.m_lastBodyContactStepBuffer.data&&(this.m_lastBodyContactStepBuffer.data[n]=this.m_lastBodyContactStepBuffer.data[t]),this.m_bodyContactCountBuffer.data&&(this.m_bodyContactCountBuffer.data[n]=this.m_bodyContactCountBuffer.data[t]),this.m_consecutiveContactStepsBuffer.data&&(this.m_consecutiveContactStepsBuffer.data[n]=this.m_consecutiveContactStepsBuffer.data[t]),this.m_hasForce&&this.m_forceBuffer[n].Copy(this.m_forceBuffer[t]),this.m_staticPressureBuffer&&(this.m_staticPressureBuffer[n]=this.m_staticPressureBuffer[t]),this.m_depthBuffer&&(this.m_depthBuffer[n]=this.m_depthBuffer[t]),this.m_expirationTimeBuffer.data&&(this.m_expirationTimeBuffer.data[n]=this.m_expirationTimeBuffer.data[t]),n},r.DestroyParticlesInGroup=function(t,e){void 0===e&&(e=!1);for(var i=t.m_firstIndex;i<t.m_lastIndex;i++)this.DestroyParticle(i,e)},r.DestroyParticleGroup=function(t){this.m_world.m_destructionListener&&this.m_world.m_destructionListener.SayGoodbyeParticleGroup(t),this.SetGroupFlags(t,0);for(var e=t.m_firstIndex;e<t.m_lastIndex;e++)this.m_groupBuffer[e]=null;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_groupList&&(this.m_groupList=t.m_next),--this.m_groupCount},n.ParticleCanBeConnected=function(e,i){return!!(e&(t.b2ParticleFlag.b2_wallParticle|t.b2ParticleFlag.b2_springParticle|t.b2ParticleFlag.b2_elasticParticle))||null!==i&&!!(i.GetGroupFlags()&t.b2ParticleGroupFlag.b2_rigidParticleGroup)},r.UpdatePairsAndTriads=function(e,i,r){for(var s=n.UpdatePairsAndTriads_s_dab,a=n.UpdatePairsAndTriads_s_dbc,o=n.UpdatePairsAndTriads_s_dca,h=this.m_positionBuffer.data,u=0,l=e;l<i;l++)u|=this.m_flagsBuffer.data[l];if(u&n.k_pairFlags)for(var c=0;c<this.m_contactBuffer.count;c++){var f=this.m_contactBuffer.data[c],_=f.indexA,d=f.indexB,p=this.m_flagsBuffer.data[_],m=this.m_flagsBuffer.data[d],g=this.m_groupBuffer[_],y=this.m_groupBuffer[d];if(_>=e&&_<i&&d>=e&&d<i&&!((p|m)&t.b2ParticleFlag.b2_zombieParticle)&&(p|m)&n.k_pairFlags&&(r.IsNecessary(_)||r.IsNecessary(d))&&n.ParticleCanBeConnected(p,g)&&n.ParticleCanBeConnected(m,y)&&r.ShouldCreatePair(_,d)){var v=this.m_pairBuffer.data[this.m_pairBuffer.Append()];v.indexA=_,v.indexB=d,v.flags=f.flags,v.strength=E(g?g.m_strength:1,y?y.m_strength:1),v.distance=j.DistanceVV(h[_],h[d])}$n(this.m_pairBuffer.data,0,this.m_pairBuffer.count,n.ComparePairIndices),this.m_pairBuffer.Unique(n.MatchPairIndices)}if(u&n.k_triadFlags){for(var b=new Xn(i-e),S=e;S<i;S++){var w=this.m_flagsBuffer.data[S],x=this.m_groupBuffer[S];w&t.b2ParticleFlag.b2_zombieParticle||!n.ParticleCanBeConnected(w,x)||b.AddGenerator(h[S],S,r.IsNecessary(S))}var T=this.GetParticleStride();b.Generate(T/2,2*T);var A=this;b.GetNodes((function(t,e,i){var u=A.m_flagsBuffer.data[t],l=A.m_flagsBuffer.data[e],c=A.m_flagsBuffer.data[i];if((u|l|c)&n.k_triadFlags&&r.ShouldCreateTriad(t,e,i)){var f=h[t],_=h[e],d=h[i],p=j.SubVV(f,_,s),m=j.SubVV(_,d,a),g=j.SubVV(d,f,o),y=4*A.m_squaredDiameter;if(j.DotVV(p,p)>y||j.DotVV(m,m)>y||j.DotVV(g,g)>y)return;var v=A.m_groupBuffer[t],b=A.m_groupBuffer[e],S=A.m_groupBuffer[i],w=A.m_triadBuffer.data[A.m_triadBuffer.Append()];w.indexA=t,w.indexB=e,w.indexC=i,w.flags=u|l|c,w.strength=E(E(v?v.m_strength:1,b?b.m_strength:1),S?S.m_strength:1);var x=(f.x+_.x+d.x)/3,T=(f.y+_.y+d.y)/3;w.pa.x=f.x-x,w.pa.y=f.y-T,w.pb.x=_.x-x,w.pb.y=_.y-T,w.pc.x=d.x-x,w.pc.y=d.y-T,w.ka=-j.DotVV(g,p),w.kb=-j.DotVV(p,m),w.kc=-j.DotVV(m,g),w.s=j.CrossVV(f,_)+j.CrossVV(_,d)+j.CrossVV(d,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;i<this.m_count;i++)this.m_flagsBuffer.data[i]&=~t.b2ParticleFlag.b2_reactiveParticle;this.m_allParticleFlags&=~t.b2ParticleFlag.b2_reactiveParticle},n.ComparePairIndices=function(t,e){var i=t.indexA-e.indexA;return 0!==i?i<0:t.indexB<e.indexB},n.MatchPairIndices=function(t,e){return t.indexA===e.indexA&&t.indexB===e.indexB},n.CompareTriadIndices=function(t,e){var i=t.indexA-e.indexA;if(0!==i)return i<0;var n=t.indexB-e.indexB;return 0!==n?n<0:t.indexC<e.indexC},n.MatchTriadIndices=function(t,e){return t.indexA===e.indexA&&t.indexB===e.indexB&&t.indexC===e.indexC},n.InitializeParticleLists=function(t,e){for(var i=t.GetBufferIndex(),n=t.GetParticleCount(),r=0;r<n;r++){var s=e[r];s.list=s,s.next=null,s.count=1,s.index=r+i}},r.MergeParticleListsInContact=function(t,e){for(var i=t.GetBufferIndex(),r=0;r<this.m_contactBuffer.count;r++){var s=this.m_contactBuffer.data[r],a=s.indexA,o=s.indexB;if(t.ContainsParticle(a)&&t.ContainsParticle(o)){var h=e[a-i].list,u=e[o-i].list;if(h!==u){if(h.count<u.count){var l=h;h=u,u=l}n.MergeParticleLists(h,u)}}}},n.MergeParticleLists=function(t,e){for(var i=e;;){i.list=t;var n=i.next;if(!n){i.next=t.next;break}i=n}t.next=e,t.count+=e.count,e.count=0},n.FindLongestParticleList=function(t,e){for(var i=t.GetParticleCount(),n=e[0],r=0;r<i;r++){var s=e[r];n.count<s.count&&(n=s)}return n},r.MergeZombieParticleListNodes=function(e,i,r){for(var s=e.GetParticleCount(),a=0;a<s;a++){var o=i[a];o!==r&&this.m_flagsBuffer.data[o.index]&t.b2ParticleFlag.b2_zombieParticle&&n.MergeParticleListAndNode(r,o)}},n.MergeParticleListAndNode=function(t,e){e.list=t,e.next=t.next,t.next=e,t.count++,e.count=0},r.CreateParticleGroupsFromParticleList=function(e,i,n){var r=e.GetParticleCount(),s=new Wn;s.groupFlags=e.GetGroupFlags(),s.userData=e.GetUserData();for(var a=0;a<r;a++){var o=i[a];if(o.count&&o!==n)for(var h=this.CreateParticleGroup(s),u=o;u;u=u.next){var l=u.index,c=this.CloneParticle(l,h);this.m_flagsBuffer.data[l]|=t.b2ParticleFlag.b2_zombieParticle,u.index=c}}},r.UpdatePairsAndTriadsWithParticleList=function(t,e){for(var i=t.GetBufferIndex(),n=0;n<this.m_pairBuffer.count;n++){var r=this.m_pairBuffer.data[n],s=r.indexA,a=r.indexB;t.ContainsParticle(s)&&(r.indexA=e[s-i].index),t.ContainsParticle(a)&&(r.indexB=e[a-i].index)}for(var o=0;o<this.m_triadBuffer.count;o++){var h=this.m_triadBuffer.data[o],u=h.indexA,l=h.indexB,c=h.indexC;t.ContainsParticle(u)&&(h.indexA=e[u-i].index),t.ContainsParticle(l)&&(h.indexB=e[l-i].index),t.ContainsParticle(c)&&(h.indexC=e[c-i].index)}},r.ComputeDepth=function(){for(var e=[],n=0,r=0;r<this.m_contactBuffer.count;r++){var s=this.m_contactBuffer.data[r],a=s.indexA,o=s.indexB,h=this.m_groupBuffer[a],u=this.m_groupBuffer[o];h&&h===u&&h.m_groupFlags&t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth&&(e[n++]=s)}for(var l=[],c=0,f=this.m_groupList;f;f=f.GetNext())if(f.m_groupFlags&t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth){l[c++]=f,this.SetGroupFlags(f,f.m_groupFlags&~t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth);for(var _=f.m_firstIndex;_<f.m_lastIndex;_++)this.m_accumulationBuffer[_]=0}for(var d=0;d<n;d++){var p=e[d],m=p.indexA,g=p.indexB,y=p.weight;this.m_accumulationBuffer[m]+=y,this.m_accumulationBuffer[g]+=y}for(var v=0;v<c;v++)for(var b=l[v],S=b.m_firstIndex;S<b.m_lastIndex;S++){var w=this.m_accumulationBuffer[S];this.m_depthBuffer[S]=w<.8?0:i}for(var x=0|V(this.m_count),T=0;T<x;T++){for(var A=!1,C=0;C<n;C++){var D=e[C],B=D.indexA,I=D.indexB,M=1-D.weight,P=this.m_depthBuffer[B],E=this.m_depthBuffer[I],O=E+M,k=P+M;P>O&&(this.m_depthBuffer[B]=O,A=!0),E>k&&(this.m_depthBuffer[I]=k,A=!0)}if(!A)break}for(var R=0;R<c;R++)for(var F=l[R],L=F.m_firstIndex;L<F.m_lastIndex;L++)this.m_depthBuffer[L]<i?this.m_depthBuffer[L]*=this.m_particleDiameter:this.m_depthBuffer[L]=0},r.GetInsideBoundsEnumerator=function(t){var e=n.computeTag(this.m_inverseDiameter*t.lowerBound.x-1,this.m_inverseDiameter*t.lowerBound.y-1),i=n.computeTag(this.m_inverseDiameter*t.upperBound.x+1,this.m_inverseDiameter*t.upperBound.y+1),r=this.m_proxyBuffer.count,s=er(this.m_proxyBuffer.data,0,r,e,dr.CompareProxyTag),a=ir(this.m_proxyBuffer.data,0,r,i,dr.CompareTagProxy);return new pr(this,e,i,s,a)},r.UpdateAllParticleFlags=function(){this.m_allParticleFlags=0;for(var t=0;t<this.m_count;t++)this.m_allParticleFlags|=this.m_flagsBuffer.data[t];this.m_needsUpdateAllParticleFlags=!1},r.UpdateAllGroupFlags=function(){this.m_allGroupFlags=0;for(var t=this.m_groupList;t;t=t.GetNext())this.m_allGroupFlags|=t.m_groupFlags;this.m_needsUpdateAllGroupFlags=!1},r.AddContact=function(t,e){var i=this.m_flagsBuffer.data,r=this.m_positionBuffer.data,s=j.SubVV(r[e],r[t],n.AddContact_s_d),a=j.DotVV(s,s);if(0<a&&a<this.m_squaredDiameter){var o=L(a),h=this.m_contactBuffer.data[this.m_contactBuffer.Append()];h.indexA=t,h.indexB=e,h.flags=i[t]|i[e],h.weight=1-a*o*this.m_inverseDiameter,h.normal.x=o*s.x,h.normal.y=o*s.y}},r.FindContacts_Reference=function(){var t=this.m_proxyBuffer.count;this.m_contactBuffer.count=0;for(var e=0,i=0;e<t;e++){for(var r=n.computeRelativeTag(this.m_proxyBuffer.data[e].tag,1,0),s=e+1;s<t&&!(r<this.m_proxyBuffer.data[s].tag);s++)this.AddContact(this.m_proxyBuffer.data[e].index,this.m_proxyBuffer.data[s].index,this.m_contactBuffer);for(var a=n.computeRelativeTag(this.m_proxyBuffer.data[e].tag,-1,1);i<t&&!(a<=this.m_proxyBuffer.data[i].tag);i++);for(var o=n.computeRelativeTag(this.m_proxyBuffer.data[e].tag,1,1),h=i;h<t&&!(o<this.m_proxyBuffer.data[h].tag);h++)this.AddContact(this.m_proxyBuffer.data[e].index,this.m_proxyBuffer.data[h].index,this.m_contactBuffer)}},r.FindContacts=function(t){this.FindContacts_Reference(t)},r.UpdateProxies_Reference=function(){for(var t=this.m_positionBuffer.data,e=this.m_inverseDiameter,i=0;i<this.m_proxyBuffer.count;++i){var r=this.m_proxyBuffer.data[i],s=t[r.index];r.tag=n.computeTag(e*s.x,e*s.y)}},r.UpdateProxies=function(t){this.UpdateProxies_Reference(t)},r.SortProxies=function(){Zn(this.m_proxyBuffer.data,0,this.m_proxyBuffer.count,dr.CompareProxyProxy)},r.FilterContacts=function(){var e=this.GetParticleContactFilter();if(null!==e){var i=this;this.m_contactBuffer.RemoveIf((function(n){return!!(n.flags&t.b2ParticleFlag.b2_particleContactFilterParticle)&&!e.ShouldCollideParticleParticle(i,n.indexA,n.indexB)}))}},r.NotifyContactListenerPreContact=function(t){if(null!==this.GetParticleContactListener())throw t.Initialize(this.m_contactBuffer,this.m_flagsBuffer),new Error},r.NotifyContactListenerPostContact=function(){var t=this.GetParticleContactListener();if(null!==t){for(var e=0;e<this.m_contactBuffer.count;++e){var i=this.m_contactBuffer.data[e];t.BeginContactParticleParticle(this,i)}throw new Error}},n.b2ParticleContactIsZombie=function(e){return(e.flags&t.b2ParticleFlag.b2_zombieParticle)===t.b2ParticleFlag.b2_zombieParticle},r.UpdateContacts=function(t){this.UpdateProxies(this.m_proxyBuffer),this.SortProxies(this.m_proxyBuffer);var e=new vr;this.NotifyContactListenerPreContact(e),this.FindContacts(this.m_contactBuffer),this.FilterContacts(this.m_contactBuffer),this.NotifyContactListenerPostContact(e),t&&this.m_contactBuffer.RemoveIf(n.b2ParticleContactIsZombie)},r.NotifyBodyContactListenerPreContact=function(t){if(null!==this.GetFixtureContactListener())throw t.Initialize(this.m_bodyContactBuffer,this.m_flagsBuffer),new Error},r.NotifyBodyContactListenerPostContact=function(){var t=this.GetFixtureContactListener();if(null!==t){for(var e=0;e<this.m_bodyContactBuffer.count;e++){var i=this.m_bodyContactBuffer.data[e];t.BeginContactFixtureParticle(this,i)}throw new Error}},r.UpdateBodyContacts=function(){var t=n.UpdateBodyContacts_s_aabb,e=new yr;if(this.NotifyBodyContactListenerPreContact(e),this.m_stuckThreshold>0)for(var i=this.GetParticleCount(),r=0;r<i;r++)this.m_bodyContactCountBuffer.data[r]=0,this.m_timestamp>this.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 Ar(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_iterationIndex<e.particleIterations;this.m_iterationIndex++){++this.m_timestamp;var r=i.Copy(e);r.dt/=e.particleIterations,r.inv_dt*=e.particleIterations,this.UpdateContacts(!1),this.UpdateBodyContacts(),this.ComputeWeight(),this.m_allGroupFlags&t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth&&this.ComputeDepth(),this.m_allParticleFlags&t.b2ParticleFlag.b2_reactiveParticle&&this.UpdatePairsAndTriadsWithReactiveParticles(),this.m_hasForce&&this.SolveForce(r),this.m_allParticleFlags&t.b2ParticleFlag.b2_viscousParticle&&this.SolveViscous(),this.m_allParticleFlags&t.b2ParticleFlag.b2_repulsiveParticle&&this.SolveRepulsive(r),this.m_allParticleFlags&t.b2ParticleFlag.b2_powderParticle&&this.SolvePowder(r),this.m_allParticleFlags&t.b2ParticleFlag.b2_tensileParticle&&this.SolveTensile(r),this.m_allGroupFlags&t.b2ParticleGroupFlag.b2_solidParticleGroup&&this.SolveSolid(r),this.m_allParticleFlags&t.b2ParticleFlag.b2_colorMixingParticle&&this.SolveColorMixing(),this.SolveGravity(r),this.m_allParticleFlags&t.b2ParticleFlag.b2_staticPressureParticle&&this.SolveStaticPressure(r),this.SolvePressure(r),this.SolveDamping(r),this.m_allParticleFlags&n.k_extraDampingFlags&&this.SolveExtraDamping(),this.m_allParticleFlags&t.b2ParticleFlag.b2_elasticParticle&&this.SolveElastic(r),this.m_allParticleFlags&t.b2ParticleFlag.b2_springParticle&&this.SolveSpring(r),this.LimitVelocity(r),this.m_allGroupFlags&t.b2ParticleGroupFlag.b2_rigidParticleGroup&&this.SolveRigidDamping(),this.m_allParticleFlags&t.b2ParticleFlag.b2_barrierParticle&&this.SolveBarrier(r),this.SolveCollision(r),this.m_allGroupFlags&t.b2ParticleGroupFlag.b2_rigidParticleGroup&&this.SolveRigid(r),this.m_allParticleFlags&t.b2ParticleFlag.b2_wallParticle&&this.SolveWall();for(var s=0;s<this.m_count;s++)this.m_positionBuffer.data[s].SelfMulAdd(r.dt,this.m_velocityBuffer.data[s])}},r.SolveCollision=function(t){var e=n.SolveCollision_s_aabb,i=this.m_positionBuffer.data,r=this.m_velocityBuffer.data,s=e;s.lowerBound.x=1e37,s.lowerBound.y=1e37,s.upperBound.x=-1e37,s.upperBound.y=-1e37;for(var a=0;a<this.m_count;a++){var o=r[a],h=i[a],u=h.x+t.dt*o.x,l=h.y+t.dt*o.y;s.lowerBound.x=E(s.lowerBound.x,E(h.x,u)),s.lowerBound.y=E(s.lowerBound.y,E(h.y,l)),s.upperBound.x=O(s.upperBound.x,O(h.x,u)),s.upperBound.y=O(s.upperBound.y,O(h.y,l))}null===this.SolveCollision_callback&&(this.SolveCollision_callback=new Cr(this,t));var c=this.SolveCollision_callback;c.m_step=t,this.m_world.QueryAABB(c,s)},r.LimitVelocity=function(t){for(var e=this.m_velocityBuffer.data,i=this.GetCriticalVelocitySquared(t),n=0;n<this.m_count;n++){var r=e[n],s=j.DotVV(r,r);s>i&&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<this.m_count;s++)i[s].SelfAdd(r)},r.SolveBarrier=function(e){for(var i=n.SolveBarrier_s_aabb,r=n.SolveBarrier_s_va,s=n.SolveBarrier_s_vb,a=n.SolveBarrier_s_pba,o=n.SolveBarrier_s_vba,h=n.SolveBarrier_s_vc,u=n.SolveBarrier_s_pca,l=n.SolveBarrier_s_vca,c=n.SolveBarrier_s_qba,f=n.SolveBarrier_s_qca,_=n.SolveBarrier_s_dv,d=n.SolveBarrier_s_f,p=this.m_positionBuffer.data,m=this.m_velocityBuffer.data,g=0;g<this.m_count;g++)this.m_flagsBuffer.data[g]&n.k_barrierWallFlags&&m[g].SetZero();for(var y=2.5*e.dt,v=this.GetParticleMass(),b=0;b<this.m_pairBuffer.count;b++){var S=this.m_pairBuffer.data[b];if(S.flags&t.b2ParticleFlag.b2_barrierParticle){var w=S.indexA,x=S.indexB,T=p[w],A=p[x],C=i;j.MinV(T,A,C.lowerBound),j.MaxV(T,A,C.upperBound);for(var D=this.m_groupBuffer[w],B=this.m_groupBuffer[x],I=this.GetLinearVelocity(D,w,T,r),M=this.GetLinearVelocity(B,x,A,s),P=j.SubVV(A,T,a),E=j.SubVV(M,I,o),O=this.GetInsideBoundsEnumerator(C),k=void 0;(k=O.GetNext())>=0;){var R=p[k],F=this.m_groupBuffer[k];if(D!==F&&B!==F){var L=this.GetLinearVelocity(F,k,R,h),N=j.SubVV(R,T,u),z=j.SubVV(L,I,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<y))continue;if(j.AddVMulSV(P,q,E,X),j.AddVMulSV(N,q,z,Y),!((W=j.DotVV(X,Y)/j.DotVV(X,X))>=0&&W<=1))continue}else{var J=G*G-4*H*U;if(J<0)continue;var K=V(J),Q=(-G-K)/(2*U),Z=(-G+K)/(2*U);if(Q>Z){var $=Q;Q=Z,Z=$}if(q=Q,j.AddVMulSV(P,q,E,X),j.AddVMulSV(N,q,z,Y),W=j.DotVV(X,Y)/j.DotVV(X,X),!(q>=0&&q<y&&W>=0&&W<=1)){if(!((q=Z)>=0&&q<y))continue;if(j.AddVMulSV(P,q,E,X),j.AddVMulSV(N,q,z,Y),!((W=j.DotVV(X,Y)/j.DotVV(X,X))>=0&&W<=1))continue}}var tt=_;tt.x=I.x+W*E.x-L.x,tt.y=I.y+W*E.y-L.y;var et=j.MulSV(v,tt,d);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(R,F.GetCenter(),j.s_t0),et)/nt)}else m[k].SelfAdd(tt);this.ParticleApplyForce(k,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;a<this.m_def.staticPressureIterations;a++){for(var o=0;o<this.m_count;o++)this.m_accumulationBuffer[o]=0;for(var h=0;h<this.m_contactBuffer.count;h++){var u=this.m_contactBuffer.data[h];if(u.flags&t.b2ParticleFlag.b2_staticPressureParticle){var l=u.indexA,c=u.indexB,f=u.weight;this.m_accumulationBuffer[l]+=f*this.m_staticPressureBuffer[c],this.m_accumulationBuffer[c]+=f*this.m_staticPressureBuffer[l]}}for(var _=0;_<this.m_count;_++){var d=this.m_weightBuffer[_];if(this.m_flagsBuffer.data[_]&t.b2ParticleFlag.b2_staticPressureParticle){var p=(this.m_accumulationBuffer[_]+n*(d-1))/(d+s);this.m_staticPressureBuffer[_]=k(p,0,r)}else this.m_staticPressureBuffer[_]=0}}},r.ComputeWeight=function(){for(var t=0;t<this.m_count;t++)this.m_weightBuffer[t]=0;for(var e=0;e<this.m_bodyContactBuffer.count;e++){var i=this.m_bodyContactBuffer.data[e],n=i.index,r=i.weight;this.m_weightBuffer[n]+=r}for(var s=0;s<this.m_contactBuffer.count;s++){var a=this.m_contactBuffer.data[s],o=a.indexA,h=a.indexB,u=a.weight;this.m_weightBuffer[o]+=u,this.m_weightBuffer[h]+=u}},r.SolvePressure=function(e){for(var i=n.SolvePressure_s_f,r=this.m_positionBuffer.data,s=this.m_velocityBuffer.data,a=this.GetCriticalPressure(e),o=this.m_def.pressureStrength*a,h=b*a,u=0;u<this.m_count;u++){var l=o*O(0,this.m_weightBuffer[u]-1);this.m_accumulationBuffer[u]=E(l,h)}if(this.m_allParticleFlags&n.k_noPressureFlags)for(var c=0;c<this.m_count;c++)this.m_flagsBuffer.data[c]&n.k_noPressureFlags&&(this.m_accumulationBuffer[c]=0);if(this.m_allParticleFlags&t.b2ParticleFlag.b2_staticPressureParticle)for(var f=0;f<this.m_count;f++)this.m_flagsBuffer.data[f]&t.b2ParticleFlag.b2_staticPressureParticle&&(this.m_accumulationBuffer[f]+=this.m_staticPressureBuffer[f]);for(var _=e.dt/(this.m_def.density*this.m_particleDiameter),d=this.GetParticleInvMass(),p=0;p<this.m_bodyContactBuffer.count;p++){var m=this.m_bodyContactBuffer.data[p],g=m.index,y=m.body,v=m.weight,S=m.mass,w=m.normal,x=r[g],T=this.m_accumulationBuffer[g]+o*v,A=j.MulSV(_*v*S*T,w,i);s[g].SelfMulSub(d,A),y.ApplyLinearImpulse(A,x,!0)}for(var C=0;C<this.m_contactBuffer.count;C++){var D=this.m_contactBuffer.data[C],B=D.indexA,I=D.indexB,M=D.weight,P=D.normal,k=this.m_accumulationBuffer[B]+this.m_accumulationBuffer[I],R=j.MulSV(_*M*k,P,i);s[B].SelfSub(R),s[I].SelfAdd(R)}},r.SolveDamping=function(t){for(var e=n.SolveDamping_s_v,i=n.SolveDamping_s_f,r=this.m_positionBuffer.data,s=this.m_velocityBuffer.data,a=this.m_def.dampingStrength,o=1/this.GetCriticalVelocity(t),h=this.GetParticleInvMass(),u=0;u<this.m_bodyContactBuffer.count;u++){var l=this.m_bodyContactBuffer.data[u],c=l.index,f=l.body,_=l.weight,d=l.mass,p=l.normal,m=r[c],g=j.SubVV(f.GetLinearVelocityFromWorldPoint(m,j.s_t0),s[c],e),y=j.DotVV(g,p);if(y<0){var v=O(a*_,E(-o*y,.5)),b=j.MulSV(v*d*y,p,i);s[c].SelfMulAdd(h,b),f.ApplyLinearImpulse(b.SelfNeg(),m,!0)}}for(var S=0;S<this.m_contactBuffer.count;S++){var w=this.m_contactBuffer.data[S],x=w.indexA,T=w.indexB,A=w.weight,C=w.normal,D=j.SubVV(s[T],s[x],e),B=j.DotVV(D,C);if(B<0){var I=O(a*A,E(-o*B,.5)),M=j.MulSV(I*B,C,i);s[x].SelfAdd(M),s[T].SelfSub(M)}}},r.SolveRigidDamping=function(){for(var t=n.SolveRigidDamping_s_t0,e=n.SolveRigidDamping_s_t1,i=n.SolveRigidDamping_s_p,r=n.SolveRigidDamping_s_v,s=[0],a=[0],o=[0],h=[0],u=[0],l=[0],c=this.m_positionBuffer.data,f=this.m_def.dampingStrength,_=0;_<this.m_bodyContactBuffer.count;_++){var d=this.m_bodyContactBuffer.data[_],p=d.index,m=this.m_groupBuffer[p];if(m&&this.IsRigidGroup(m)){var g=d.body,y=d.normal,v=d.weight,b=c[p],S=j.SubVV(g.GetLinearVelocityFromWorldPoint(b,t),m.GetLinearVelocityFromWorldPoint(b,e),r),w=j.DotVV(S,y);if(w<0){this.InitDampingParameterWithRigidGroupOrParticle(s,a,o,!0,m,p,b,y),this.InitDampingParameter(h,u,l,g.GetMass(),g.GetInertia()-g.GetMass()*g.GetLocalCenter().LengthSquared(),g.GetWorldCenter(),b,y);var x=f*E(v,1)*this.ComputeDampingImpulse(s[0],a[0],o[0],h[0],u[0],l[0],w);this.ApplyDamping(s[0],a[0],o[0],!0,m,p,x,y),g.ApplyLinearImpulse(j.MulSV(-x,y,j.s_t0),b,!0)}}}for(var T=0;T<this.m_contactBuffer.count;T++){var A=this.m_contactBuffer.data[T],C=A.indexA,D=A.indexB,B=A.normal,I=A.weight,M=this.m_groupBuffer[C],P=this.m_groupBuffer[D],O=this.IsRigidGroup(M),k=this.IsRigidGroup(P);if(M!==P&&(O||k)){var R=j.MidVV(c[C],c[D],i),F=j.SubVV(this.GetLinearVelocity(P,D,R,t),this.GetLinearVelocity(M,C,R,e),r),L=j.DotVV(F,B);if(L<0){this.InitDampingParameterWithRigidGroupOrParticle(s,a,o,O,M,C,R,B),this.InitDampingParameterWithRigidGroupOrParticle(h,u,l,k,P,D,R,B);var V=f*I*this.ComputeDampingImpulse(s[0],a[0],o[0],h[0],u[0],l[0],L);this.ApplyDamping(s[0],a[0],o[0],O,M,C,V,B),this.ApplyDamping(h[0],u[0],l[0],k,P,D,-V,B)}}}},r.SolveExtraDamping=function(){for(var t=n.SolveExtraDamping_s_v,e=n.SolveExtraDamping_s_f,i=this.m_velocityBuffer.data,r=this.m_positionBuffer.data,s=this.GetParticleInvMass(),a=0;a<this.m_bodyContactBuffer.count;a++){var o=this.m_bodyContactBuffer.data[a],h=o.index;if(this.m_flagsBuffer.data[h]&n.k_extraDampingFlags){var u=o.body,l=o.mass,c=o.normal,f=r[h],_=j.SubVV(u.GetLinearVelocityFromWorldPoint(f,j.s_t0),i[h],t),d=j.DotVV(_,c);if(d<0){var p=j.MulSV(.5*l*d,c,e);i[h].SelfMulAdd(s,p),u.ApplyLinearImpulse(p.SelfNeg(),f,!0)}}}},r.SolveWall=function(){for(var e=this.m_velocityBuffer.data,i=0;i<this.m_count;i++)this.m_flagsBuffer.data[i]&t.b2ParticleFlag.b2_wallParticle&&e[i].SetZero()},r.SolveRigid=function(e){for(var i=n.SolveRigid_s_position,r=n.SolveRigid_s_rotation,s=n.SolveRigid_s_transform,a=n.SolveRigid_s_velocityTransform,o=this.m_positionBuffer.data,h=this.m_velocityBuffer.data,u=this.m_groupList;u;u=u.GetNext())if(u.m_groupFlags&t.b2ParticleGroupFlag.b2_rigidParticleGroup){u.UpdateStatistics();var l=r;l.SetAngle(e.dt*u.m_angularVelocity);var c=j.AddVV(u.m_center,j.SubVV(j.MulSV(e.dt,u.m_linearVelocity,j.s_t0),K.MulRV(l,u.m_center,j.s_t1),j.s_t0),i),f=s;f.SetPositionRotation(c,l),Q.MulXX(f,u.m_transform,u.m_transform);var _=a;_.p.x=e.inv_dt*f.p.x,_.p.y=e.inv_dt*f.p.y,_.q.s=e.inv_dt*f.q.s,_.q.c=e.inv_dt*(f.q.c-1);for(var d=u.m_firstIndex;d<u.m_lastIndex;d++)Q.MulXV(_,o[d],h[d])}},r.SolveElastic=function(e){for(var i=n.SolveElastic_s_pa,r=n.SolveElastic_s_pb,s=n.SolveElastic_s_pc,a=n.SolveElastic_s_r,o=n.SolveElastic_s_t0,h=this.m_positionBuffer.data,u=this.m_velocityBuffer.data,l=e.inv_dt*this.m_def.elasticStrength,c=0;c<this.m_triadBuffer.count;c++){var f=this.m_triadBuffer.data[c];if(f.flags&t.b2ParticleFlag.b2_elasticParticle){var _=f.indexA,d=f.indexB,p=f.indexC,m=f.pa,g=f.pb,y=f.pc,v=i.Copy(h[_]),b=r.Copy(h[d]),S=s.Copy(h[p]),w=u[_],x=u[d],T=u[p];v.SelfMulAdd(e.dt,w),b.SelfMulAdd(e.dt,x),S.SelfMulAdd(e.dt,T);var A=(v.x+b.x+S.x)/3,C=(v.y+b.y+S.y)/3;v.x-=A,v.y-=C,b.x-=A,b.y-=C,S.x-=A,S.y-=C;var D=a;D.s=j.CrossVV(m,v)+j.CrossVV(g,b)+j.CrossVV(y,S),D.c=j.DotVV(m,v)+j.DotVV(g,b)+j.DotVV(y,S);var B=L(D.s*D.s+D.c*D.c);isFinite(B)||(B=198177537e11),D.s*=B,D.c*=B;var I=l*f.strength;K.MulRV(D,m,o),j.SubVV(o,v,o),j.MulSV(I,o,o),w.SelfAdd(o),K.MulRV(D,g,o),j.SubVV(o,b,o),j.MulSV(I,o,o),x.SelfAdd(o),K.MulRV(D,y,o),j.SubVV(o,S,o),j.MulSV(I,o,o),T.SelfAdd(o)}}},r.SolveSpring=function(e){for(var i=n.SolveSpring_s_pa,r=n.SolveSpring_s_pb,s=n.SolveSpring_s_d,a=n.SolveSpring_s_f,o=this.m_positionBuffer.data,h=this.m_velocityBuffer.data,u=e.inv_dt*this.m_def.springStrength,l=0;l<this.m_pairBuffer.count;l++){var c=this.m_pairBuffer.data[l];if(c.flags&t.b2ParticleFlag.b2_springParticle){var f=c.indexA,_=c.indexB,d=i.Copy(o[f]),p=r.Copy(o[_]),m=h[f],g=h[_];d.SelfMulAdd(e.dt,m),p.SelfMulAdd(e.dt,g);var y=j.SubVV(p,d,s),v=c.distance,b=y.Length(),S=u*c.strength,w=j.MulSV(S*(v-b)/b,y,a);m.SelfSub(w),g.SelfAdd(w)}}},r.SolveTensile=function(e){for(var i=n.SolveTensile_s_weightedNormal,r=n.SolveTensile_s_s,s=n.SolveTensile_s_f,a=this.m_velocityBuffer.data,o=0;o<this.m_count;o++)this.m_accumulation2Buffer[o]=new j,this.m_accumulation2Buffer[o].SetZero();for(var h=0;h<this.m_contactBuffer.count;h++){var u=this.m_contactBuffer.data[h];if(u.flags&t.b2ParticleFlag.b2_tensileParticle){var l=u.indexA,c=u.indexB,f=u.weight,_=u.normal,d=j.MulSV((1-f)*f,_,i);this.m_accumulation2Buffer[l].SelfSub(d),this.m_accumulation2Buffer[c].SelfAdd(d)}}for(var p=this.GetCriticalVelocity(e),m=this.m_def.surfaceTensionPressureStrength*p,g=this.m_def.surfaceTensionNormalStrength*p,y=.5*p,v=0;v<this.m_contactBuffer.count;v++){var b=this.m_contactBuffer.data[v];if(b.flags&t.b2ParticleFlag.b2_tensileParticle){var S=b.indexA,w=b.indexB,x=b.weight,T=b.normal,A=this.m_weightBuffer[S]+this.m_weightBuffer[w],C=j.SubVV(this.m_accumulation2Buffer[w],this.m_accumulation2Buffer[S],r),D=E(m*(A-2)+g*j.DotVV(C,T),y)*x,B=j.MulSV(D,T,s);a[S].SelfSub(B),a[w].SelfAdd(B)}}},r.SolveViscous=function(){for(var e=n.SolveViscous_s_v,i=n.SolveViscous_s_f,r=this.m_positionBuffer.data,s=this.m_velocityBuffer.data,a=this.m_def.viscousStrength,o=this.GetParticleInvMass(),h=0;h<this.m_bodyContactBuffer.count;h++){var u=this.m_bodyContactBuffer.data[h],l=u.index;if(this.m_flagsBuffer.data[l]&t.b2ParticleFlag.b2_viscousParticle){var c=u.body,f=u.weight,_=u.mass,d=r[l],p=j.SubVV(c.GetLinearVelocityFromWorldPoint(d,j.s_t0),s[l],e),m=j.MulSV(a*_*f,p,i);s[l].SelfMulAdd(o,m),c.ApplyLinearImpulse(m.SelfNeg(),d,!0)}}for(var g=0;g<this.m_contactBuffer.count;g++){var y=this.m_contactBuffer.data[g];if(y.flags&t.b2ParticleFlag.b2_viscousParticle){var v=y.indexA,b=y.indexB,S=y.weight,w=j.SubVV(s[b],s[v],e),x=j.MulSV(a*S,w,i);s[v].SelfAdd(x),s[b].SelfSub(x)}}},r.SolveRepulsive=function(e){for(var i=n.SolveRepulsive_s_f,r=this.m_velocityBuffer.data,s=this.m_def.repulsiveStrength*this.GetCriticalVelocity(e),a=0;a<this.m_contactBuffer.count;a++){var o=this.m_contactBuffer.data[a];if(o.flags&t.b2ParticleFlag.b2_repulsiveParticle){var h=o.indexA,u=o.indexB;if(this.m_groupBuffer[h]!==this.m_groupBuffer[u]){var l=o.weight,c=o.normal,f=j.MulSV(s*l,c,i);r[h].SelfSub(f),r[u].SelfAdd(f)}}}},r.SolvePowder=function(e){for(var i=n.SolvePowder_s_f,r=this.m_positionBuffer.data,s=this.m_velocityBuffer.data,a=this.m_def.powderStrength*this.GetCriticalVelocity(e),o=.25,h=this.GetParticleInvMass(),u=0;u<this.m_bodyContactBuffer.count;u++){var l=this.m_bodyContactBuffer.data[u],c=l.index;if(this.m_flagsBuffer.data[c]&t.b2ParticleFlag.b2_powderParticle){var f=l.weight;if(f>o){var _=l.body,d=l.mass,p=r[c],m=l.normal,g=j.MulSV(a*d*(f-o),m,i);s[c].SelfMulSub(h,g),_.ApplyLinearImpulse(g,p,!0)}}}for(var y=0;y<this.m_contactBuffer.count;y++){var v=this.m_contactBuffer.data[y];if(v.flags&t.b2ParticleFlag.b2_powderParticle){var b=v.weight;if(b>o){var S=v.indexA,w=v.indexB,x=v.normal,T=j.MulSV(a*(b-o),x,i);s[S].SelfSub(T),s[w].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<this.m_contactBuffer.count;s++){var a=this.m_contactBuffer.data[s],o=a.indexA,h=a.indexB;if(this.m_groupBuffer[o]!==this.m_groupBuffer[h]){var u=a.weight,l=a.normal,c=this.m_depthBuffer[o]+this.m_depthBuffer[h],f=j.MulSV(r*c*u,l,e);i[o].SelfSub(f),i[h].SelfAdd(f)}}},r.SolveForce=function(t){for(var e=this.m_velocityBuffer.data,i=t.dt*this.GetParticleInvMass(),n=0;n<this.m_count;n++)e[n].SelfMulAdd(i,this.m_forceBuffer[n]);this.m_hasForce=!1},r.SolveColorMixing=function(){var e=.5*this.m_def.colorMixingStrength;if(e)for(var i=0;i<this.m_contactBuffer.count;i++){var n=this.m_contactBuffer.data[i],r=n.indexA,s=n.indexB;if(this.m_flagsBuffer.data[r]&this.m_flagsBuffer.data[s]&t.b2ParticleFlag.b2_colorMixingParticle){var a=this.m_colorBuffer.data[r],o=this.m_colorBuffer.data[s];tt.MixColors(a,o,e)}}},r.SolveZombie=function(){for(var e=0,i=[],n=0;n<this.m_count;n++)i[n]=y;for(var r=0,s=0;s<this.m_count;s++){var a=this.m_flagsBuffer.data[s];if(a&t.b2ParticleFlag.b2_zombieParticle){var o=this.m_world.m_destructionListener;if(a&t.b2ParticleFlag.b2_destructionListenerParticle&&o&&o.SayGoodbyeParticle(this,s),this.m_handleIndexBuffer.data){var h=this.m_handleIndexBuffer.data[s];h&&(h.SetIndex(y),this.m_handleIndexBuffer.data[s]=null)}i[s]=y}else{if(i[s]=e,s!==e){if(this.m_handleIndexBuffer.data){var u=this.m_handleIndexBuffer.data[s];u&&u.SetIndex(e),this.m_handleIndexBuffer.data[e]=u}this.m_flagsBuffer.data[e]=this.m_flagsBuffer.data[s],this.m_lastBodyContactStepBuffer.data&&(this.m_lastBodyContactStepBuffer.data[e]=this.m_lastBodyContactStepBuffer.data[s]),this.m_bodyContactCountBuffer.data&&(this.m_bodyContactCountBuffer.data[e]=this.m_bodyContactCountBuffer.data[s]),this.m_consecutiveContactStepsBuffer.data&&(this.m_consecutiveContactStepsBuffer.data[e]=this.m_consecutiveContactStepsBuffer.data[s]),this.m_positionBuffer.data[e].Copy(this.m_positionBuffer.data[s]),this.m_velocityBuffer.data[e].Copy(this.m_velocityBuffer.data[s]),this.m_groupBuffer[e]=this.m_groupBuffer[s],this.m_hasForce&&this.m_forceBuffer[e].Copy(this.m_forceBuffer[s]),this.m_staticPressureBuffer&&(this.m_staticPressureBuffer[e]=this.m_staticPressureBuffer[s]),this.m_depthBuffer&&(this.m_depthBuffer[e]=this.m_depthBuffer[s]),this.m_colorBuffer.data&&this.m_colorBuffer.data[e].Copy(this.m_colorBuffer.data[s]),this.m_userDataBuffer.data&&(this.m_userDataBuffer.data[e]=this.m_userDataBuffer.data[s]),this.m_expirationTimeBuffer.data&&(this.m_expirationTimeBuffer.data[e]=this.m_expirationTimeBuffer.data[s])}e++,r|=a}}for(var l={IsProxyInvalid:function(t){return t.index<0},IsContactInvalid:function(t){return t.indexA<0||t.indexB<0},IsBodyContactInvalid:function(t){return t.index<0},IsPairInvalid:function(t){return t.indexA<0||t.indexB<0},IsTriadInvalid:function(t){return t.indexA<0||t.indexB<0||t.indexC<0}},c=0;c<this.m_proxyBuffer.count;c++){var f=this.m_proxyBuffer.data[c];f.index=i[f.index]}this.m_proxyBuffer.RemoveIf(l.IsProxyInvalid);for(var _=0;_<this.m_contactBuffer.count;_++){var d=this.m_contactBuffer.data[_];d.indexA=i[d.indexA],d.indexB=i[d.indexB]}this.m_contactBuffer.RemoveIf(l.IsContactInvalid);for(var p=0;p<this.m_bodyContactBuffer.count;p++){var m=this.m_bodyContactBuffer.data[p];m.index=i[m.index]}this.m_bodyContactBuffer.RemoveIf(l.IsBodyContactInvalid);for(var g=0;g<this.m_pairBuffer.count;g++){var v=this.m_pairBuffer.data[g];v.indexA=i[v.indexA],v.indexB=i[v.indexB]}this.m_pairBuffer.RemoveIf(l.IsPairInvalid);for(var b=0;b<this.m_triadBuffer.count;b++){var S=this.m_triadBuffer.data[b];S.indexA=i[S.indexA],S.indexB=i[S.indexB],S.indexC=i[S.indexC]}if(this.m_triadBuffer.RemoveIf(l.IsTriadInvalid),this.m_indexByExpirationTimeBuffer.data)for(var w=0,x=0;x<this.m_count;x++){var T=i[this.m_indexByExpirationTimeBuffer.data[x]];T!==y&&(this.m_indexByExpirationTimeBuffer.data[w++]=T)}for(var A=this.m_groupList;A;A=A.GetNext()){for(var C=e,D=0,B=!1,I=A.m_firstIndex;I<A.m_lastIndex;I++){var M=i[I];M>=0?(C=E(C,M),D=O(D,M+1)):B=!0}C<D?(A.m_firstIndex=C,A.m_lastIndex=D,B&&A.m_groupFlags&t.b2ParticleGroupFlag.b2_solidParticleGroup&&this.SetGroupFlags(A,A.m_groupFlags|t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth)):(A.m_firstIndex=0,A.m_lastIndex=0,A.m_groupFlags&t.b2ParticleGroupFlag.b2_particleGroupCanBeEmpty||this.SetGroupFlags(A,A.m_groupFlags|t.b2ParticleGroupFlag.b2_particleGroupWillBeDestroyed))}this.m_count=e,this.m_allParticleFlags=r,this.m_needsUpdateAllParticleFlags=!1;for(var P=this.m_groupList;P;){var k=P.GetNext();P.m_groupFlags&t.b2ParticleGroupFlag.b2_particleGroupWillBeDestroyed&&this.DestroyParticleGroup(P),P=k}},r.SolveLifetimes=function(t){this.m_timeElapsed=this.LifetimeToExpirationTime(t.dt);var e=this.GetQuantizedTimeElapsed(),i=this.m_expirationTimeBuffer.data,n=this.m_indexByExpirationTimeBuffer.data,r=this.GetParticleCount();this.m_expirationTimeBufferRequiresSorting&&(Zn(n,0,r,(function(t,e){var n=i[t],r=i[e],s=n<=0;return s===r<=0?n>r:s})),this.m_expirationTimeBufferRequiresSorting=!1);for(var s=r-1;s>=0;--s){var a=n[s],o=i[a];if(e<o||o<=0)break;this.DestroyParticle(a)}},r.RotateBuffer=function(t,e,i){if(t!==e&&e!==i){if(nr(this.m_flagsBuffer.data,t,e,i),this.m_lastBodyContactStepBuffer.data&&nr(this.m_lastBodyContactStepBuffer.data,t,e,i),this.m_bodyContactCountBuffer.data&&nr(this.m_bodyContactCountBuffer.data,t,e,i),this.m_consecutiveContactStepsBuffer.data&&nr(this.m_consecutiveContactStepsBuffer.data,t,e,i),nr(this.m_positionBuffer.data,t,e,i),nr(this.m_velocityBuffer.data,t,e,i),nr(this.m_groupBuffer,t,e,i),this.m_hasForce&&nr(this.m_forceBuffer,t,e,i),this.m_staticPressureBuffer&&nr(this.m_staticPressureBuffer,t,e,i),this.m_depthBuffer&&nr(this.m_depthBuffer,t,e,i),this.m_colorBuffer.data&&nr(this.m_colorBuffer.data,t,e,i),this.m_userDataBuffer.data&&nr(this.m_userDataBuffer.data,t,e,i),this.m_handleIndexBuffer.data){nr(this.m_handleIndexBuffer.data,t,e,i);for(var n=t;n<i;++n){var r=this.m_handleIndexBuffer.data[n];r&&r.SetIndex(v(r.GetIndex()))}}if(this.m_expirationTimeBuffer.data){nr(this.m_expirationTimeBuffer.data,t,e,i);for(var s=this.GetParticleCount(),a=this.m_indexByExpirationTimeBuffer.data,o=0;o<s;++o)a[o]=v(a[o])}for(var h=0;h<this.m_proxyBuffer.count;h++){var u=this.m_proxyBuffer.data[h];u.index=v(u.index)}for(var l=0;l<this.m_contactBuffer.count;l++){var c=this.m_contactBuffer.data[l];c.indexA=v(c.indexA),c.indexB=v(c.indexB)}for(var f=0;f<this.m_bodyContactBuffer.count;f++){var _=this.m_bodyContactBuffer.data[f];_.index=v(_.index)}for(var d=0;d<this.m_pairBuffer.count;d++){var p=this.m_pairBuffer.data[d];p.indexA=v(p.indexA),p.indexB=v(p.indexB)}for(var m=0;m<this.m_triadBuffer.count;m++){var g=this.m_triadBuffer.data[m];g.indexA=v(g.indexA),g.indexB=v(g.indexB),g.indexC=v(g.indexC)}for(var y=this.m_groupList;y;y=y.GetNext())y.m_firstIndex=v(y.m_firstIndex),y.m_lastIndex=v(y.m_lastIndex-1)+1}function v(n){return n<t?n:n<e?n+i-e:n<i?n+t-e:n}},r.GetCriticalVelocity=function(t){return this.m_particleDiameter*t.inv_dt},r.GetCriticalVelocitySquared=function(t){var e=this.GetCriticalVelocity(t);return e*e},r.GetCriticalPressure=function(t){return this.m_def.density*this.GetCriticalVelocitySquared(t)},r.GetParticleStride=function(){return v*this.m_particleDiameter},r.GetParticleMass=function(){var t=this.GetParticleStride();return this.m_def.density*t*t},r.GetParticleInvMass=function(){var t=1.3333333333333333*this.m_inverseDiameter;return this.m_inverseDensity*t*t},r.GetFixtureContactFilter=function(){return this.m_allParticleFlags&t.b2ParticleFlag.b2_fixtureContactFilterParticle?this.m_world.m_contactManager.m_contactFilter:null},r.GetParticleContactFilter=function(){return this.m_allParticleFlags&t.b2ParticleFlag.b2_particleContactFilterParticle?this.m_world.m_contactManager.m_contactFilter:null},r.GetFixtureContactListener=function(){return this.m_allParticleFlags&t.b2ParticleFlag.b2_fixtureContactListenerParticle?this.m_world.m_contactManager.m_contactListener:null},r.GetParticleContactListener=function(){return this.m_allParticleFlags&t.b2ParticleFlag.b2_particleContactListenerParticle?this.m_world.m_contactManager.m_contactListener:null},r.SetUserOverridableBuffer=function(t,e){t.data=e,t.userSuppliedCapacity=e.length},r.SetGroupFlags=function(e,i){var n=e.m_groupFlags;(n^i)&t.b2ParticleGroupFlag.b2_solidParticleGroup&&(i|=t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth),n&~i&&(this.m_needsUpdateAllGroupFlags=!0),~this.m_allGroupFlags&i&&(i&t.b2ParticleGroupFlag.b2_solidParticleGroup&&(this.m_depthBuffer=this.RequestBuffer(this.m_depthBuffer)),this.m_allGroupFlags|=i),e.m_groupFlags=i},n.BodyContactCompare=function(t,e){return t.index===e.index?t.weight>e.weight:t.index<e.index},r.RemoveSpuriousBodyContacts=function(){Zn(this.m_bodyContactBuffer.data,0,this.m_bodyContactBuffer.count,n.BodyContactCompare);var t=n.RemoveSpuriousBodyContacts_s_n,e=n.RemoveSpuriousBodyContacts_s_pos,i=n.RemoveSpuriousBodyContacts_s_normal,r=this,s=-1,a=0;this.m_bodyContactBuffer.count=tr(this.m_bodyContactBuffer.data,(function(n){if(n.index!==s&&(a=0,s=n.index),a++>3)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;c<u;c++){var f=i;if(n.fixture.ComputeDistance(h,f,c)<l)return!1}return!0}return!1}),this.m_bodyContactBuffer.count)},r.DetectStuckParticle=function(t){this.m_stuckThreshold<=0||(++this.m_bodyContactCountBuffer.data[t],2===this.m_bodyContactCountBuffer.data[t]&&(++this.m_consecutiveContactStepsBuffer.data[t],this.m_consecutiveContactStepsBuffer.data[t]>this.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&&t<this.GetParticleCount()&&t!==y},r.GetQuantizedTimeElapsed=function(){return Math.floor(this.m_timeElapsed/4294967296)},r.LifetimeToExpirationTime=function(t){return this.m_timeElapsed+Math.floor(t/this.m_def.lifetimeGranularity*4294967296)},r.ForceCanBeApplied=function(e){return!(e&t.b2ParticleFlag.b2_wallParticle)},r.PrepareForceBuffer=function(){if(!this.m_hasForce){for(var t=0;t<this.m_count;t++)this.m_forceBuffer[t].SetZero();this.m_hasForce=!0}},r.IsRigidGroup=function(e){return null!==e&&!!(e.m_groupFlags&t.b2ParticleGroupFlag.b2_rigidParticleGroup)},r.GetLinearVelocity=function(t,e,i,n){return t&&this.IsRigidGroup(t)?t.GetLinearVelocityFromWorldPoint(i,n):n.Copy(this.m_velocityBuffer.data[e])},r.InitDampingParameter=function(t,e,i,n,r,s,a,o){t[0]=n>0?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<<fr.yTruncBits-1,fr.yShift=fr.tagBits-fr.yTruncBits,fr.xShift=fr.tagBits-fr.yTruncBits-fr.xTruncBits,fr.xScale=1<<fr.xShift,fr.xOffset=fr.xScale*(1<<fr.xTruncBits-1),fr.yMask=(1<<fr.yTruncBits)-1<<fr.yShift,fr.xMask=~fr.yMask,fr.DestroyParticlesInShape_s_aabb=new Nt,fr.CreateParticleGroup_s_transform=new Q,fr.ComputeCollisionEnergy_s_v=new j,fr.QueryShapeAABB_s_aabb=new Nt,fr.QueryPointAABB_s_aabb=new Nt,fr.RayCast_s_aabb=new Nt,fr.RayCast_s_p=new j,fr.RayCast_s_v=new j,fr.RayCast_s_n=new j,fr.RayCast_s_point=new j,fr.k_pairFlags=t.b2ParticleFlag.b2_springParticle,fr.k_triadFlags=t.b2ParticleFlag.b2_elasticParticle,fr.k_noPressureFlags=t.b2ParticleFlag.b2_powderParticle|t.b2ParticleFlag.b2_tensileParticle,fr.k_extraDampingFlags=t.b2ParticleFlag.b2_staticPressureParticle,fr.k_barrierWallFlags=t.b2ParticleFlag.b2_barrierParticle|t.b2ParticleFlag.b2_wallParticle,fr.CreateParticlesStrokeShapeForGroup_s_edge=new Si,fr.CreateParticlesStrokeShapeForGroup_s_d=new j,fr.CreateParticlesStrokeShapeForGroup_s_p=new j,fr.CreateParticlesFillShapeForGroup_s_aabb=new Nt,fr.CreateParticlesFillShapeForGroup_s_p=new j,fr.UpdatePairsAndTriads_s_dab=new j,fr.UpdatePairsAndTriads_s_dbc=new j,fr.UpdatePairsAndTriads_s_dca=new j,fr.AddContact_s_d=new j,fr.UpdateBodyContacts_s_aabb=new Nt,fr.Solve_s_subStep=new Dn,fr.SolveCollision_s_aabb=new Nt,fr.SolveGravity_s_gravity=new j,fr.SolveBarrier_s_aabb=new Nt,fr.SolveBarrier_s_va=new j,fr.SolveBarrier_s_vb=new j,fr.SolveBarrier_s_pba=new j,fr.SolveBarrier_s_vba=new j,fr.SolveBarrier_s_vc=new j,fr.SolveBarrier_s_pca=new j,fr.SolveBarrier_s_vca=new j,fr.SolveBarrier_s_qba=new j,fr.SolveBarrier_s_qca=new j,fr.SolveBarrier_s_dv=new j,fr.SolveBarrier_s_f=new j,fr.SolvePressure_s_f=new j,fr.SolveDamping_s_v=new j,fr.SolveDamping_s_f=new j,fr.SolveRigidDamping_s_t0=new j,fr.SolveRigidDamping_s_t1=new j,fr.SolveRigidDamping_s_p=new j,fr.SolveRigidDamping_s_v=new j,fr.SolveExtraDamping_s_v=new j,fr.SolveExtraDamping_s_f=new j,fr.SolveRigid_s_position=new j,fr.SolveRigid_s_rotation=new K,fr.SolveRigid_s_transform=new Q,fr.SolveRigid_s_velocityTransform=new Q,fr.SolveElastic_s_pa=new j,fr.SolveElastic_s_pb=new j,fr.SolveElastic_s_pc=new j,fr.SolveElastic_s_r=new K,fr.SolveElastic_s_t0=new j,fr.SolveSpring_s_pa=new j,fr.SolveSpring_s_pb=new j,fr.SolveSpring_s_d=new j,fr.SolveSpring_s_f=new j,fr.SolveTensile_s_weightedNormal=new j,fr.SolveTensile_s_s=new j,fr.SolveTensile_s_f=new j,fr.SolveViscous_s_v=new j,fr.SolveViscous_s_f=new j,fr.SolveRepulsive_s_f=new j,fr.SolvePowder_s_f=new j,fr.SolveSolid_s_f=new j,fr.RemoveSpuriousBodyContacts_s_n=new j,fr.RemoveSpuriousBodyContacts_s_pos=new j,fr.RemoveSpuriousBodyContacts_s_normal=new j;var _r=function(){function t(){this._data=null,this.userSuppliedCapacity=0}return n(t,[{key:"data",get:function(){return this._data},set:function(t){this._data=t}}]),t}(),dr=function(){function t(){this.index=y,this.tag=0}return t.CompareProxyProxy=function(t,e){return t.tag<e.tag},t.CompareTagProxy=function(t,e){return t<e.tag},t.CompareProxyTag=function(t,e){return t.tag<e},t}(),pr=function(){function t(t,e,i,n,r){this.m_system=t,this.m_xLower=(e&fr.xMask)>>>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<this.m_last;){var t=(this.m_system.m_proxyBuffer.data[this.m_first].tag&fr.xMask)>>>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 y},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}(),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 y},e}(gr),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 y},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}(xn),wr=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 t<this.m_threshold&&this.m_threshold<=e||e<this.m_threshold&&this.m_threshold<=t},i.ShouldCreateTriad=function(t,e,i){return(t<this.m_threshold||e<this.m_threshold||i<this.m_threshold)&&(this.m_threshold<=t||this.m_threshold<=e||this.m_threshold<=i)},e}(br),xr=function(e){function i(i,n){var r;return void 0===n&&(n=i.length),(r=e.call(this,t.b2ShapeType.e_unknown,0)||this).m_shapeCount=0,r.m_shapes=i,r.m_shapeCount=n,r}s(i,e);var n=i.prototype;return n.Clone=function(){throw new Error},n.GetChildCount=function(){return 1},n.TestPoint=function(t,e){for(var i=0;i<this.m_shapeCount;i++)if(this.m_shapes[i].TestPoint(t,e))return!0;return!1},n.ComputeDistance=function(){return 0},n.RayCast=function(){return!1},n.ComputeAABB=function(t,e){var i=new Nt;t.lowerBound.x=1e37,t.lowerBound.y=1e37,t.upperBound.x=-1e37,t.upperBound.y=-1e37;for(var n=0;n<this.m_shapeCount;n++)for(var r=this.m_shapes[n].GetChildCount(),s=0;s<r;s++){var a=i;this.m_shapes[n].ComputeAABB(a,e,s),t.Combine1(a)}},n.ComputeMass=function(){},n.SetupDistanceProxy=function(){},n.ComputeSubmergedArea=function(){return 0},n.Dump=function(){},i}(yi),Tr=function(e){function i(t){var i;return(i=e.call(this)||this).m_flagsBuffer=t,i}return s(i,e),i.prototype.IsNecessary=function(e){return!!(this.m_flagsBuffer.data[e]&t.b2ParticleFlag.b2_reactiveParticle)},i}(br),Ar=function(e){function i(t,i){var n;return void 0===i&&(i=null),(n=e.call(this,t)||this).m_contactFilter=null,n.m_contactFilter=i,n}s(i,e);var n=i.prototype;return n.ShouldCollideFixtureParticle=function(e,i,n){return!(this.m_contactFilter&&this.m_system.GetFlagsBuffer()[n]&t.b2ParticleFlag.b2_fixtureContactFilterParticle)||this.m_contactFilter.ShouldCollideFixtureParticle(e,this.m_system,n)},n.ReportFixtureAndParticle=function(e,n,r){var s=i.ReportFixtureAndParticle_s_n,a=i.ReportFixtureAndParticle_s_rp,o=this.m_system.m_positionBuffer.data[r],h=s,u=e.ComputeDistance(o,h,n);if(u<this.m_system.m_particleDiameter&&this.ShouldCollideFixtureParticle(e,this.m_system,r)){var l=e.GetBody(),c=l.GetWorldCenter(),f=l.GetMass(),_=l.GetInertia()-f*l.GetLocalCenter().LengthSquared(),d=f>0?1/f:0,p=_>0?1/_:0,m=this.m_system.m_flagsBuffer.data[r]&t.b2ParticleFlag.b2_wallParticle?0:this.m_system.GetParticleInvMass(),g=j.SubVV(o,c,a),y=j.CrossVV(g,h),v=m+d+p*y*y,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=v>0?1/v:0,this.m_system.DetectStuckParticle(r)}},i}(ar);Ar.ReportFixtureAndParticle_s_n=new j,Ar.ReportFixtureAndParticle_s_rp=new j;var Cr=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(),_=this.m_system.m_positionBuffer.data[r],d=this.m_system.m_velocityBuffer.data[r],p=a,m=o;if(0===this.m_system.m_iterationIndex){var g=Q.MulTXV(f.m_xf0,_,s);e.GetShape().GetType()===t.b2ShapeType.e_circleShape&&(g.SelfSub(f.GetLocalCenter()),K.MulRV(f.m_xf0.q,g,g),K.MulTRV(f.m_xf.q,g,g),g.SelfAdd(f.GetLocalCenter())),Q.MulXV(f.m_xf,g,m.p1)}else m.p1.Copy(_);if(j.AddVMulSV(_,this.m_step.dt,d,m.p2),m.maxFraction=1,e.RayCast(p,m,n)){var y=p.normal,v=h;v.x=(1-p.fraction)*m.p1.x+p.fraction*m.p2.x+l*y.x,v.y=(1-p.fraction)*m.p1.y+p.fraction*m.p2.y+l*y.y;var b=u;b.x=this.m_step.inv_dt*(v.x-_.x),b.y=this.m_step.inv_dt*(v.y-_.y),this.m_system.m_velocityBuffer.data[r].Copy(b);var S=c;S.x=this.m_step.inv_dt*this.m_system.GetParticleMass()*(d.x-b.x),S.y=this.m_step.inv_dt*this.m_system.GetParticleMass()*(d.y-b.y),this.m_system.ParticleApplyForce(r,S)}},n.ReportParticle=function(){return!1},i}(ar);Cr.ReportFixtureAndParticle_s_p1=new j,Cr.ReportFixtureAndParticle_s_output=new Vt,Cr.ReportFixtureAndParticle_s_input=new Lt,Cr.ReportFixtureAndParticle_s_p=new j,Cr.ReportFixtureAndParticle_s_v=new j,Cr.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 An,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 Cn,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 Ki(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;f<c.m_proxyCount;++f){var _=c.m_proxies[f].treeNode.aabb;u[0].Set(_.lowerBound.x,_.lowerBound.y),u[1].Set(_.upperBound.x,_.lowerBound.y),u[2].Set(_.upperBound.x,_.upperBound.y),u[3].Set(_.lowerBound.x,_.upperBound.y),this.m_debugDraw.DrawPolygon(u,4,n)}}if(i&t.b2DrawFlags.e_centerOfMassBit)for(var d=this.m_bodyList;d;d=d.m_next){var p=e.DrawDebugData_s_xf;p.q.Copy(d.m_xf.q),p.p.Copy(d.GetWorldCenter()),this.m_debugDraw.DrawTransform(p)}if(i&t.b2DrawFlags.e_controllerBit)for(var m=this.m_controllerList;m;m=m.m_next)m.Draw(this.m_debugDraw)}},n.QueryAABB=function(){(arguments.length<=0?void 0:arguments[0])instanceof xn?this._QueryAABB(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1]):this._QueryAABB(null,arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1])},n._QueryAABB=function(t,e,i){if(this.m_contactManager.m_broadPhase.Query(e,(function(e){var n=e.userData.fixture;return t?t.ReportFixture(n):!i||i(n)})),t instanceof xn)for(var n=this.m_particleSystemList;n;n=n.m_next)t.ShouldQueryParticleSystem(n)&&n.QueryAABB(t,e)},n.QueryAllAABB=function(t,e){return void 0===e&&(e=[]),this.QueryAABB(t,(function(t){return e.push(t),!0})),e},n.QueryPointAABB=function(){(arguments.length<=0?void 0:arguments[0])instanceof xn?this._QueryPointAABB(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1]):this._QueryPointAABB(null,arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1])},n._QueryPointAABB=function(t,e,i){if(this.m_contactManager.m_broadPhase.QueryPoint(e,(function(e){var n=e.userData.fixture;return t?t.ReportFixture(n):!i||i(n)})),t instanceof xn)for(var n=this.m_particleSystemList;n;n=n.m_next)t.ShouldQueryParticleSystem(n)&&n.QueryPointAABB(t,e)},n.QueryAllPointAABB=function(t,e){return void 0===e&&(e=[]),this.QueryPointAABB(t,(function(t){return e.push(t),!0})),e},n.QueryFixtureShape=function(){(arguments.length<=0?void 0:arguments[0])instanceof xn?this._QueryFixtureShape(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2],arguments.length<=3?void 0:arguments[3]):this._QueryFixtureShape(null,arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2],arguments.length<=3?void 0:arguments[3])},n._QueryFixtureShape=function(t,i,n,r,s){var a=e.QueryFixtureShape_s_aabb;if(i.ComputeAABB(a,r,n),this.m_contactManager.m_broadPhase.Query(a,(function(e){var a=e.userData,o=a.fixture;if(jt(i,n,o.GetShape(),a.childIndex,r,o.GetBody().GetTransform())){if(t)return t.ReportFixture(o);if(s)return s(o)}return!0})),t instanceof xn)for(var o=this.m_particleSystemList;o;o=o.m_next)t.ShouldQueryParticleSystem(o)&&o.QueryAABB(t,a)},n.QueryAllFixtureShape=function(t,e,i,n){return void 0===n&&(n=[]),this.QueryFixtureShape(t,e,i,(function(t){return n.push(t),!0})),n},n.QueryFixturePoint=function(){(arguments.length<=0?void 0:arguments[0])instanceof xn?this._QueryFixturePoint(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1]):this._QueryFixturePoint(null,arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1])},n._QueryFixturePoint=function(t,e,i){if(this.m_contactManager.m_broadPhase.QueryPoint(e,(function(n){var r=n.userData.fixture;if(r.TestPoint(e)){if(t)return t.ReportFixture(r);if(i)return i(r)}return!0})),t)for(var n=this.m_particleSystemList;n;n=n.m_next)t.ShouldQueryParticleSystem(n)&&n.QueryPointAABB(t,e)},n.QueryAllFixturePoint=function(t,e){return void 0===e&&(e=[]),this.QueryFixturePoint(t,(function(t){return e.push(t),!0})),e},n.RayCast=function(){(arguments.length<=0?void 0:arguments[0])instanceof Tn?this._RayCast(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2]):this._RayCast(null,arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])},n._RayCast=function(t,i,n,r){var s=e.RayCast_s_input;if(s.maxFraction=1,s.p1.Copy(i),s.p2.Copy(n),this.m_contactManager.m_broadPhase.RayCast(s,(function(s,a){var o=a.userData,h=o.fixture,u=o.childIndex,l=e.RayCast_s_output;if(h.RayCast(l,s,u)){var c=l.fraction,f=e.RayCast_s_point;if(f.Set((1-c)*i.x+c*n.x,(1-c)*i.y+c*n.y),t)return t.ReportFixture(h,f,l.normal,c);if(r)return r(h,f,l.normal,c)}return s.maxFraction})),t)for(var a=this.m_particleSystemList;a;a=a.m_next)t.ShouldQueryParticleSystem(a)&&a.RayCast(t,i,n)},n.RayCastOne=function(t,e){var i=null,n=1;return this.RayCast(t,e,(function(t,e,r,s){return s<n&&(n=s,i=t),n})),i},n.RayCastAll=function(t,e,i){return void 0===i&&(i=[]),this.RayCast(t,e,(function(t){return i.push(t),1})),i},n.GetBodyList=function(){return this.m_bodyList},n.GetJointList=function(){return this.m_jointList},n.GetParticleSystemList=function(){return this.m_particleSystemList},n.GetContactList=function(){return this.m_contactManager.m_contactList},n.SetAllowSleeping=function(t){if(t!==this.m_allowSleep&&(this.m_allowSleep=t,!this.m_allowSleep))for(var e=this.m_bodyList;e;e=e.m_next)e.SetAwake(!0)},n.GetAllowSleeping=function(){return this.m_allowSleep},n.SetWarmStarting=function(t){this.m_warmStarting=t},n.GetWarmStarting=function(){return this.m_warmStarting},n.SetContinuousPhysics=function(t){this.m_continuousPhysics=t},n.GetContinuousPhysics=function(){return this.m_continuousPhysics},n.SetSubStepping=function(t){this.m_subStepping=t},n.GetSubStepping=function(){return this.m_subStepping},n.GetProxyCount=function(){return this.m_contactManager.m_broadPhase.GetProxyCount()},n.GetBodyCount=function(){return this.m_bodyCount},n.GetJointCount=function(){return this.m_jointCount},n.GetContactCount=function(){return this.m_contactManager.m_contactCount},n.GetTreeHeight=function(){return this.m_contactManager.m_broadPhase.GetTreeHeight()},n.GetTreeBalance=function(){return this.m_contactManager.m_broadPhase.GetTreeBalance()},n.GetTreeQuality=function(){return this.m_contactManager.m_broadPhase.GetTreeQuality()},n.SetGravity=function(t,e){if(void 0===e&&(e=!0),!j.IsEqualToV(this.m_gravity,t)&&(this.m_gravity.Copy(t),e))for(var i=this.m_bodyList;i;i=i.m_next)i.SetAwake(!0)},n.GetGravity=function(){return this.m_gravity},n.IsLocked=function(){return this.m_locked},n.SetAutoClearForces=function(t){this.m_clearForces=t},n.GetAutoClearForces=function(){return this.m_clearForces},n.ShiftOrigin=function(t){if(this.IsLocked())throw new Error;for(var e=this.m_bodyList;e;e=e.m_next)e.m_xf.p.SelfSub(t),e.m_sweep.c0.SelfSub(t),e.m_sweep.c.SelfSub(t);for(var i=this.m_jointList;i;i=i.m_next)i.ShiftOrigin(t);this.m_contactManager.m_broadPhase.ShiftOrigin(t)},n.GetContactManager=function(){return this.m_contactManager},n.GetProfile=function(){return this.m_profile},n.Dump=function(e){if(!this.m_locked){e("const g: b2Vec2 = new b2Vec2(%.15f, %.15f);\n",this.m_gravity.x,this.m_gravity.y),e("this.m_world.SetGravity(g);\n"),e("const bodies: b2Body[] = [];\n"),e("const joints: b2Joint[] = [];\n");for(var i=0,n=this.m_bodyList;n;n=n.m_next)n.m_islandIndex=i,n.Dump(e),++i;i=0;for(var r=this.m_jointList;r;r=r.m_next)r.m_index=i,++i;for(var s=this.m_jointList;s;s=s.m_next)s.m_type!==t.b2JointType.e_gearJoint&&(e("{\n"),s.Dump(e),e("}\n"));for(var a=this.m_jointList;a;a=a.m_next)a.m_type===t.b2JointType.e_gearJoint&&(e("{\n"),a.Dump(e),e("}\n"))}},n.DrawJoint=function(i){if(null!==this.m_debugDraw){var n=i.GetBodyA(),r=i.GetBodyB(),s=n.m_xf,a=r.m_xf,o=s.p,h=a.p,u=i.GetAnchorA(e.DrawJoint_s_p1),l=i.GetAnchorB(e.DrawJoint_s_p2),c=e.DrawJoint_s_color.SetRGB(.5,.8,.8);switch(i.m_type){case t.b2JointType.e_distanceJoint:this.m_debugDraw.DrawSegment(u,l,c);break;case t.b2JointType.e_pulleyJoint:var f=i,_=f.GetGroundAnchorA(),d=f.GetGroundAnchorB();this.m_debugDraw.DrawSegment(_,u,c),this.m_debugDraw.DrawSegment(d,l,c),this.m_debugDraw.DrawSegment(_,d,c);break;case t.b2JointType.e_mouseJoint:var p=e.DrawJoint_s_c;p.Set(0,1,0),this.m_debugDraw.DrawPoint(u,4,p),this.m_debugDraw.DrawPoint(l,4,p),p.Set(.8,.8,.8),this.m_debugDraw.DrawSegment(u,l,p);break;default:this.m_debugDraw.DrawSegment(o,u,c),this.m_debugDraw.DrawSegment(u,l,c),this.m_debugDraw.DrawSegment(h,l,c)}}},n.DrawShape=function(i,n){if(null!==this.m_debugDraw){var r=i.GetShape();switch(r.m_type){case t.b2ShapeType.e_circleShape:var s=r,a=s.m_p,o=s.m_radius,h=j.UNITX;this.m_debugDraw.DrawSolidCircle(a,o,h,n);break;case t.b2ShapeType.e_edgeShape:var u=r,l=u.m_vertex1,c=u.m_vertex2;this.m_debugDraw.DrawSegment(l,c,n);break;case t.b2ShapeType.e_chainShape:var f=r,_=f.m_count,d=f.m_vertices,p=e.DrawShape_s_ghostColor.SetRGBA(.75*n.r,.75*n.g,.75*n.b,n.a),m=d[0];if(this.m_debugDraw.DrawPoint(m,4,n),f.m_hasPrevVertex){var g=f.m_prevVertex;this.m_debugDraw.DrawSegment(g,m,p),this.m_debugDraw.DrawCircle(g,.1,p)}for(var y=1;y<_;++y){var v=d[y];this.m_debugDraw.DrawSegment(m,v,n),this.m_debugDraw.DrawPoint(v,4,n),m=v}if(f.m_hasNextVertex){var b=f.m_nextVertex;this.m_debugDraw.DrawSegment(b,m,p),this.m_debugDraw.DrawCircle(b,.1,p)}break;case t.b2ShapeType.e_polygonShape:var S=r,w=S.m_count,x=S.m_vertices;this.m_debugDraw.DrawSolidPolygon(x,w,n)}}},n.Solve=function(e){for(var i=this.m_bodyList;i;i=i.m_next)i.m_xf0.Copy(i.m_xf);for(var n=this.m_controllerList;n;n=n.m_next)n.Step(e);this.m_profile.solveInit=0,this.m_profile.solveVelocity=0,this.m_profile.solvePosition=0;var r=this.m_island;r.Initialize(this.m_bodyCount,this.m_contactManager.m_contactCount,this.m_jointCount,this.m_contactManager.m_contactListener);for(var s=this.m_bodyList;s;s=s.m_next)s.m_islandFlag=!1;for(var a=this.m_contactManager.m_contactList;a;a=a.m_next)a.m_islandFlag=!1;for(var o=this.m_jointList;o;o=o.m_next)o.m_islandFlag=!1;for(var h=this.s_stack,u=this.m_bodyList;u;u=u.m_next)if(!u.m_islandFlag&&u.IsAwake()&&u.IsActive()&&u.GetType()!==t.b2BodyType.b2_staticBody){r.Clear();var l=0;for(h[l++]=u,u.m_islandFlag=!0;l>0;){var c=h[--l];if(!c)throw new Error;if(r.AddBody(c),c.m_awakeFlag=!0,c.GetType()!==t.b2BodyType.b2_staticBody){for(var f=c.m_contactList;f;f=f.next){var _=f.contact;if(!_.m_islandFlag&&_.IsEnabled()&&_.IsTouching()){var d=_.m_fixtureA.m_isSensor,p=_.m_fixtureB.m_isSensor;if(!d&&!p){r.AddContact(_),_.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 y=g.other;y.IsActive()&&(r.AddJoint(g.joint),g.joint.m_islandFlag=!0,y.m_islandFlag||(h[l++]=y,y.m_islandFlag=!0))}}}var v=new Cn;r.Solve(v,e,this.m_gravity,this.m_allowSleep),this.m_profile.solveInit+=v.solveInit,this.m_profile.solveVelocity+=v.solveVelocity,this.m_profile.solvePosition+=v.solvePosition;for(var b=0;b<r.m_bodyCount;++b){var S=r.m_bodies[b];S.GetType()===t.b2BodyType.b2_staticBody&&(S.m_islandFlag=!1)}}for(var w=0;w<h.length&&h[w];++w)h[w]=null;for(var x=new it,T=this.m_bodyList;T;T=T.m_next)T.m_islandFlag&&T.GetType()!==t.b2BodyType.b2_staticBody&&T.SynchronizeFixtures();this.m_contactManager.FindNewContacts(),this.m_profile.broadphase=x.GetMilliseconds()},n.SolveTOI=function(i){var n=this.m_island;if(n.Initialize(64,32,0,this.m_contactManager.m_contactListener),this.m_stepComplete){for(var r=this.m_bodyList;r;r=r.m_next)r.m_islandFlag=!1,r.m_sweep.alpha0=0;for(var s=this.m_contactManager.m_contactList;s;s=s.m_next)s.m_toiFlag=!1,s.m_islandFlag=!1,s.m_toiCount=0,s.m_toi=1}for(;;){for(var a=null,o=1,h=this.m_contactManager.m_contactList;h;h=h.m_next)if(h.IsEnabled()&&!(h.m_toiCount>8)){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(),_=c.GetBody(),d=f.m_type,p=_.m_type,m=f.IsAwake()&&d!==t.b2BodyType.b2_staticBody,g=_.IsAwake()&&p!==t.b2BodyType.b2_staticBody;if(!m&&!g)continue;var y=f.IsBullet()||d!==t.b2BodyType.b2_dynamicBody,v=_.IsBullet()||p!==t.b2BodyType.b2_dynamicBody;if(!y&&!v)continue;var b=f.m_sweep.alpha0;f.m_sweep.alpha0<_.m_sweep.alpha0?(b=_.m_sweep.alpha0,f.m_sweep.Advance(b)):_.m_sweep.alpha0<f.m_sweep.alpha0&&(b=f.m_sweep.alpha0,_.m_sweep.Advance(b));var S=h.GetChildIndexA(),w=h.GetChildIndexB(),x=e.SolveTOI_s_toi_input;x.proxyA.SetShape(l.GetShape(),S),x.proxyB.SetShape(c.GetShape(),w),x.sweepA.Copy(f.m_sweep),x.sweepB.Copy(_.m_sweep),x.tMax=1;var T=e.SolveTOI_s_toi_output;we(T,x);var A=T.t;u=T.state===t.b2TOIOutputState.e_touching?E(b+(1-b)*A,1):1,h.m_toi=u,h.m_toiFlag=!0}u<o&&(a=h,o=u)}if(null===a||.9999<o){this.m_stepComplete=!0;break}var C=a.GetFixtureA(),D=a.GetFixtureB(),B=C.GetBody(),I=D.GetBody(),M=e.SolveTOI_s_backup1.Copy(B.m_sweep),P=e.SolveTOI_s_backup2.Copy(I.m_sweep);if(B.Advance(o),I.Advance(o),a.Update(this.m_contactManager.m_contactListener),a.m_toiFlag=!1,++a.m_toiCount,a.IsEnabled()&&a.IsTouching()){B.SetAwake(!0),I.SetAwake(!0),n.Clear(),n.AddBody(B),n.AddBody(I),n.AddContact(a),B.m_islandFlag=!0,I.m_islandFlag=!0,a.m_islandFlag=!0;for(var O=0;O<2;++O){var k=0===O?B:I;if(k.m_type===t.b2BodyType.b2_dynamicBody)for(var R=k.m_contactList;R&&n.m_bodyCount!==n.m_bodyCapacity&&n.m_contactCount!==n.m_contactCapacity;R=R.next){var F=R.contact;if(!F.m_islandFlag){var L=R.other;if(L.m_type!==t.b2BodyType.b2_dynamicBody||k.IsBullet()||L.IsBullet()){var V=F.m_fixtureA.m_isSensor,N=F.m_fixtureB.m_isSensor;if(!V&&!N){var z=e.SolveTOI_s_backup.Copy(L.m_sweep);L.m_islandFlag||L.Advance(o),F.Update(this.m_contactManager.m_contactListener),F.IsEnabled()&&F.IsTouching()?(F.m_islandFlag=!0,n.AddContact(F),L.m_islandFlag||(L.m_islandFlag=!0,L.m_type!==t.b2BodyType.b2_staticBody&&L.SetAwake(!0),n.AddBody(L))):(L.m_sweep.Copy(z),L.SynchronizeTransform())}}}}}var U=e.SolveTOI_s_subStep;U.dt=(1-o)*i.dt,U.inv_dt=1/U.dt,U.dtRatio=1,U.positionIterations=20,U.velocityIterations=i.velocityIterations,U.particleIterations=i.particleIterations,U.warmStarting=!1,n.SolveTOI(U,B.m_islandIndex,I.m_islandIndex);for(var G=0;G<n.m_bodyCount;++G){var H=n.m_bodies[G];if(H.m_islandFlag=!1,H.m_type===t.b2BodyType.b2_dynamicBody){H.SynchronizeFixtures();for(var W=H.m_contactList;W;W=W.next)W.contact.m_toiFlag=!1,W.contact.m_islandFlag=!1}}if(this.m_contactManager.FindNewContacts(),this.m_subStepping){this.m_stepComplete=!1;break}}else a.SetEnabled(!1),B.m_sweep.Copy(M),I.m_sweep.Copy(P),B.SynchronizeTransform(),I.SynchronizeTransform()}},n.AddController=function(t){return t.m_next=this.m_controllerList,t.m_prev=null,this.m_controllerList&&(this.m_controllerList.m_prev=t),this.m_controllerList=t,++this.m_controllerCount,t},n.RemoveController=function(t){return t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),this.m_controllerList===t&&(this.m_controllerList=t.m_next),--this.m_controllerCount,t.m_prev=null,t.m_next=null,t},e}();Dr.Step_s_step=new Dn,Dr.Step_s_stepTimer=new it,Dr.Step_s_timer=new it,Dr.DrawDebugData_s_color=new tt(0,0,0),Dr.DrawDebugData_s_vs=j.MakeArray(4),Dr.DrawDebugData_s_xf=new Q,Dr.QueryFixtureShape_s_aabb=new Nt,Dr.RayCast_s_input=new Lt,Dr.RayCast_s_output=new Vt,Dr.RayCast_s_point=new j,Dr.DrawJoint_s_p1=new j,Dr.DrawJoint_s_p2=new j,Dr.DrawJoint_s_color=new tt(.5,.8,.8),Dr.DrawJoint_s_c=new tt,Dr.DrawShape_s_ghostColor=new tt,Dr.SolveTOI_s_subStep=new Dn,Dr.SolveTOI_s_backup=new $,Dr.SolveTOI_s_backup1=new $,Dr.SolveTOI_s_backup2=new $,Dr.SolveTOI_s_toi_input=new ue,Dr.SolveTOI_s_toi_output=new ce;var Br=function(t,e){this.prevBody=null,this.nextBody=null,this.prevController=null,this.nextController=null,this.controller=t,this.body=e},Ir=function(){function t(){this.m_bodyList=null,this.m_bodyCount=0,this.m_prev=null,this.m_next=null}var e=t.prototype;return e.GetNext=function(){return this.m_next},e.GetPrev=function(){return this.m_prev},e.GetBodyList=function(){return this.m_bodyList},e.AddBody=function(t){var e=new Br(this,t);e.nextBody=this.m_bodyList,e.prevBody=null,this.m_bodyList&&(this.m_bodyList.prevBody=e),this.m_bodyList=e,++this.m_bodyCount,e.nextController=t.m_controllerList,e.prevController=null,t.m_controllerList&&(t.m_controllerList.prevController=e),t.m_controllerList=e,++t.m_controllerCount},e.RemoveBody=function(t){if(this.m_bodyCount<=0)throw new Error;for(var e=this.m_bodyList;e&&e.body!==t;)e=e.nextBody;if(null===e)throw new Error;e.prevBody&&(e.prevBody.nextBody=e.nextBody),e.nextBody&&(e.nextBody.prevBody=e.prevBody),this.m_bodyList===e&&(this.m_bodyList=e.nextBody),--this.m_bodyCount,e.nextController&&(e.nextController.prevController=e.prevController),e.prevController&&(e.prevController.nextController=e.nextController),t.m_controllerList===e&&(t.m_controllerList=e.nextController),--t.m_controllerCount},e.Clear=function(){for(;this.m_bodyList;)this.RemoveBody(this.m_bodyList.body);this.m_bodyCount=0},t}(),Mr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).normal=new j(0,1),e.offset=0,e.density=0,e.velocity=new j(0,0),e.linearDrag=0,e.angularDrag=0,e.useDensity=!1,e.useWorldGravity=!0,e.gravity=new j(0,0),e}s(e,t);var i=e.prototype;return i.Step=function(){if(this.m_bodyList){this.useWorldGravity&&this.gravity.Copy(this.m_bodyList.body.GetWorld().GetGravity());for(var t=this.m_bodyList;t;t=t.nextBody){var e=t.body;if(e.IsAwake()){for(var i=new j,n=new j,s=0,a=0,o=e.GetFixtureList();o;o=o.m_next){var h=new j,u=o.GetShape().ComputeSubmergedArea(this.normal,this.offset,e.GetTransform(),h);s+=u,i.x+=u*h.x,i.y+=u*h.y;var l;a+=u*(l=this.useDensity?o.GetDensity():1),n.x+=u*h.x*l,n.y+=u*h.y*l}if(i.x/=s,i.y/=s,n.x/=a,n.y/=a,!(s<r)){var c=this.gravity.Clone().SelfNeg();c.SelfMul(this.density*s),e.ApplyForce(c,n);var f=e.GetLinearVelocityFromWorldPoint(i,new j);f.SelfSub(this.velocity),f.SelfMul(-this.linearDrag*s),e.ApplyForce(f,i),e.ApplyTorque(-e.GetInertia()/e.GetMass()*s*e.GetAngularVelocity()*this.angularDrag)}}}}},i.Draw=function(t){var e=100,i=new j,n=new j;i.x=this.normal.x*this.offset+this.normal.y*e,i.y=this.normal.y*this.offset-this.normal.x*e,n.x=this.normal.x*this.offset-this.normal.y*e,n.y=this.normal.y*this.offset+this.normal.x*e;var r=new tt(0,0,.8);t.DrawSegment(i,n,r)},e}(Ir),Pr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).A=new j(0,0),e}s(e,t);var i=e.prototype;return i.Step=function(t){for(var i=j.MulSV(t.dt,this.A,e.Step_s_dtA),n=this.m_bodyList;n;n=n.nextBody){var r=n.body;r.IsAwake()&&r.SetLinearVelocity(j.AddVV(r.GetLinearVelocity(),i,j.s_t0))}},i.Draw=function(){},e}(Ir);Pr.Step_s_dtA=new j;var Er=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).F=new j(0,0),e}s(e,t);var i=e.prototype;return i.Step=function(){for(var t=this.m_bodyList;t;t=t.nextBody){var e=t.body;e.IsAwake()&&e.ApplyForce(this.F,e.GetWorldCenter())}},i.Draw=function(){},e}(Ir),Or=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).G=1,e.invSqr=!0,e}s(e,t);var i=e.prototype;return i.Step=function(){if(this.invSqr)for(var t=this.m_bodyList;t;t=t.nextBody)for(var i=t.body,n=i.GetWorldCenter(),s=i.GetMass(),a=this.m_bodyList;a&&a!==t;a=a.nextBody){var o=a.body,h=o.GetWorldCenter(),u=o.GetMass(),l=h.x-n.x,c=h.y-n.y,f=l*l+c*c;if(!(f<r)){var _=e.Step_s_f.Set(l,c);_.SelfMul(this.G/f/V(f)*s*u),i.IsAwake()&&i.ApplyForce(_,n),o.IsAwake()&&o.ApplyForce(_.SelfMul(-1),h)}}else for(var d=this.m_bodyList;d;d=d.nextBody)for(var p=d.body,m=p.GetWorldCenter(),g=p.GetMass(),y=this.m_bodyList;y&&y!==d;y=y.nextBody){var v=y.body,b=v.GetWorldCenter(),S=v.GetMass(),w=b.x-m.x,x=b.y-m.y,T=w*w+x*x;if(!(T<r)){var A=e.Step_s_f.Set(w,x);A.SelfMul(this.G/T*g*S),p.IsAwake()&&p.ApplyForce(A,m),v.IsAwake()&&v.ApplyForce(A.SelfMul(-1),b)}}},i.Draw=function(){},e}(Ir);Or.Step_s_f=new j;var kr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).T=new Y,e.maxTimestep=0,e}s(e,t);var i=e.prototype;return i.Step=function(t){var i=t.dt;if(!(i<=r)){i>this.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/O(t,e):0},e}(Ir);kr.Step_s_damping=new j;var Rr=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;e<this.m_count;++e){this.m_ps[e].Copy(t.vertices[e]),this.m_p0s[e].Copy(t.vertices[e]),this.m_vs[e].SetZero();var i=t.masses[e];this.m_ims[e]=i>0?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;s<n;++s){var a=this.m_ps[s],o=this.m_ps[s+1];this.m_Ls[s]=j.DistanceVV(a,o)}for(var h=0;h<r;++h){var u=this.m_ps[h],l=this.m_ps[h+1],c=this.m_ps[h+2],f=j.SubVV(l,u,j.s_t0),_=j.SubVV(c,l,j.s_t1),d=j.CrossVV(f,_),p=j.DotVV(f,_);this.m_as[h]=W(d,p)}this.m_gravity.Copy(t.gravity),this.m_damping=t.damping,this.m_k2=t.k2,this.m_k3=t.k3},e.Step=function(t,e){if(0!==t){for(var i=Math.exp(-t*this.m_damping),n=0;n<this.m_count;++n)this.m_p0s[n].Copy(this.m_ps[n]),this.m_ims[n]>0&&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;r<e;++r)this.SolveC2(),this.SolveC3(),this.SolveC2();for(var s=1/t,a=0;a<this.m_count;++a)j.MulSV(s,j.SubVV(this.m_ps[a],this.m_p0s[a],j.s_t0),this.m_vs[a])}},e.SolveC2=function(){for(var e=this.m_count-1,i=0;i<e;++i){var n=this.m_ps[i],r=this.m_ps[i+1],s=j.SubVV(r,n,t.s_d),a=s.Normalize(),o=this.m_ims[i],h=this.m_ims[i+1];if(o+h!==0){var u=o/(o+h),l=h/(o+h);n.SelfMulSub(this.m_k2*u*(this.m_Ls[i]-a),s),r.SelfMulAdd(this.m_k2*l*(this.m_Ls[i]-a),s)}}},e.SetAngle=function(t){for(var e=this.m_count-2,i=0;i<e;++i)this.m_as[i]=t},e.SolveC3=function(){for(var e=this.m_count-2,i=0;i<e;++i){var n=this.m_ps[i],r=this.m_ps[i+1],s=this.m_ps[i+2],a=this.m_ims[i],h=this.m_ims[i+1],u=this.m_ims[i+2],l=j.SubVV(r,n,t.s_d1),c=j.SubVV(s,r,t.s_d2),f=l.LengthSquared(),_=c.LengthSquared();if(f*_!=0){var d=j.CrossVV(l,c),p=j.DotVV(l,c),m=W(d,p),g=j.MulSV(-1/f,l.SelfSkew(),t.s_Jd1),y=j.MulSV(1/_,c.SelfSkew(),t.s_Jd2),v=j.NegV(g,t.s_J1),b=j.SubVV(g,y,t.s_J2),S=y,w=a*j.DotVV(v,v)+h*j.DotVV(b,b)+u*j.DotVV(S,S);if(0!==w){w=1/w;for(var x=m-this.m_as[i];x>o;)x=(m-=2*o)-this.m_as[i];for(;x<-3.14159265359;)x=(m+=2*o)-this.m_as[i];var T=-this.m_k3*w*x;n.SelfMulAdd(a*T,v),r.SelfMulAdd(h*T,b),s.SelfMulAdd(u*T,S)}}}},e.Draw=function(t){for(var e=new tt(.4,.5,.7),i=0;i<this.m_count-1;++i)t.DrawSegment(this.m_ps[i],this.m_ps[i+1],e)},t}();Rr.s_d=new j,Rr.s_d1=new j,Rr.s_d2=new j,Rr.s_Jd1=new j,Rr.s_Jd2=new j,Rr.s_J1=new j,Rr.s_J2=new j,t.b2AABB=Nt,t.b2Abs=P,t.b2Acos=G,t.b2Alloc=function(){return null},t.b2AreaJoint=Vi,t.b2AreaJointDef=Li,t.b2Asin=H,t.b2Assert=function(t){if(!t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];throw u(Error,i)}},t.b2Atan2=W,t.b2BlockAllocator=function(){},t.b2Body=Mi,t.b2BodyDef=function(){this.type=t.b2BodyType.b2_staticBody,this.position=new j(0,0),this.angle=0,this.linearVelocity=new j(0,0),this.angularVelocity=0,this.linearDamping=0,this.angularDamping=0,this.allowSleep=!0,this.awake=!0,this.fixedRotation=!1,this.bullet=!1,this.active=!0,this.userData=null,this.gravityScale=1},t.b2BroadPhase=$t,t.b2BuoyancyController=Mr,t.b2CalculateParticleIterations=Un,t.b2ChainAndCircleContact=pn,t.b2ChainAndPolygonContact=mn,t.b2ChainShape=wi,t.b2CircleContact=ln,t.b2CircleShape=vi,t.b2Clamp=k,t.b2ClipSegmentToLine=Ut,t.b2ClipVertex=Ft,t.b2CollideCircles=Ae,t.b2CollideEdgeAndCircle=ui,t.b2CollideEdgeAndPolygon=pi,t.b2CollidePolygonAndCircle=Ie,t.b2CollidePolygons=$e,t.b2Color=tt,t.b2ConstantAccelController=Pr,t.b2ConstantForceController=Er,t.b2Contact=un,t.b2ContactEdge=hn,t.b2ContactFactory=yn,t.b2ContactFeature=Mt,t.b2ContactFilter=bn,t.b2ContactID=Pt,t.b2ContactImpulse=Sn,t.b2ContactListener=wn,t.b2ContactManager=An,t.b2ContactPositionConstraint=kn,t.b2ContactRegister=gn,t.b2ContactSolver=Ln,t.b2ContactSolverDef=Rn,t.b2ContactVelocityConstraint=On,t.b2Controller=Ir,t.b2ControllerEdge=Br,t.b2Cos=z,t.b2Counter=nt,t.b2DegToRad=function(t){return t*B},t.b2DestructionListener=vn,t.b2Distance=vt,t.b2DistanceInput=ot,t.b2DistanceJoint=Fi,t.b2DistanceJointDef=Ri,t.b2DistanceOutput=ht,t.b2DistanceProxy=st,t.b2Draw=et,t.b2DynamicTree=Yt,t.b2EdgeAndCircleContact=_n,t.b2EdgeAndPolygonContact=dn,t.b2EdgeShape=Si,t.b2Filter=xi,t.b2Fixture=Di,t.b2FixtureDef=Ti,t.b2FixtureParticleQueryCallback=ar,t.b2FixtureProxy=Ai,t.b2Free=function(){},t.b2FrictionJoint=zi,t.b2FrictionJointDef=Ni,t.b2GearJoint=Gi,t.b2GearJointDef=Ui,t.b2GetPointStates=function(e,i,n,r){var s;for(s=0;s<n.pointCount;++s){var a=n.points[s].id.key;e[s]=t.b2PointState.b2_removeState;for(var o=0,h=r.pointCount;o<h;++o)if(r.points[o].id.key===a){e[s]=t.b2PointState.b2_persistState;break}}for(;s<2;++s)e[s]=t.b2PointState.b2_nullState;for(s=0;s<r.pointCount;++s){var u=r.points[s].id.key;i[s]=t.b2PointState.b2_addState;for(var l=0,c=n.pointCount;l<c;++l)if(n.points[l].id.key===u){i[s]=t.b2PointState.b2_persistState;break}}for(;s<2;++s)i[s]=t.b2PointState.b2_nullState},t.b2GravityController=Or,t.b2GrowableBuffer=sr,t.b2GrowableStack=rt,t.b2InvSqrt=L,t.b2IsPowerOfTwo=function(t){return t>0&&!(t&t-1)},t.b2IsValid=R,t.b2Island=Nn,t.b2Jacobian=Pi,t.b2Joint=ki,t.b2JointDef=Oi,t.b2JointEdge=Ei,t.b2Log=function(){},t.b2MakeArray=C,t.b2MakeNullArray=function(t){for(var e=new Array(t),i=0;i<t;++i)e[i]=null;return e},t.b2MakeNumberArray=D,t.b2Manifold=kt,t.b2ManifoldPoint=Et,t.b2MassData=gi,t.b2Mat22=Y,t.b2Mat33=J,t.b2Max=O,t.b2Maybe=e,t.b2Min=E,t.b2MixFriction=an,t.b2MixRestitution=on,t.b2MotorJoint=Wi,t.b2MotorJointDef=Hi,t.b2MouseJoint=qi,t.b2MouseJointDef=ji,t.b2NextPowerOfTwo=function(t){return t|=t>>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=vr,t.b2ParticleSystem=fr,t.b2ParticleSystemDef=cr,t.b2ParticleSystem_CompositeShape=xr,t.b2ParticleSystem_ConnectionFilter=br,t.b2ParticleSystem_DestroyParticlesInShapeCallback=Sr,t.b2ParticleSystem_FixedSetAllocator=gr,t.b2ParticleSystem_FixtureParticle=function(t,e){this.second=y,this.first=t,this.second=e},t.b2ParticleSystem_FixtureParticleSet=yr,t.b2ParticleSystem_InsideBoundsEnumerator=pr,t.b2ParticleSystem_JoinParticleGroupsFilter=wr,t.b2ParticleSystem_ParticleListNode=mr,t.b2ParticleSystem_ParticlePair=function(t,e){this.first=y,this.second=y,this.first=t,this.second=e},t.b2ParticleSystem_Proxy=dr,t.b2ParticleSystem_ReactiveFilter=Tr,t.b2ParticleSystem_SolveCollisionCallback=Cr,t.b2ParticleSystem_UpdateBodyContactsCallback=Ar,t.b2ParticleSystem_UserOverridableBuffer=_r,t.b2ParticleTriad=lr,t.b2PolygonAndCircleContact=fn,t.b2PolygonContact=cn,t.b2PolygonShape=bi,t.b2Position=Bn,t.b2PositionSolverManifold=Fn,t.b2Pow=N,t.b2PrismaticJoint=Yi,t.b2PrismaticJointDef=Xi,t.b2Profile=Cn,t.b2PulleyJoint=Ki,t.b2PulleyJointDef=Ji,t.b2QueryCallback=xn,t.b2RadToDeg=function(t){return t*I},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=Qi,t.b2Rope=Rr,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=K,t.b2SeparationFunction=fe,t.b2Shape=yi,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=O(i.m_radius,f)+O(n.m_radius,f),s=e.transformA,a=e.transformB,o=e.translationB,h=St.Set(0,0),u=0,l=wt;l.m_count=0;for(var c=l.m_vertices,_=i.GetSupport(K.MulTRV(s.q,j.NegV(o,j.s_t1),j.s_t0)),d=Q.MulXV(s,i.GetVertex(_),xt),p=n.GetSupport(K.MulTRV(a.q,o,j.s_t0)),m=Q.MulXV(a,n.GetVertex(p),Tt),g=j.SubVV(d,m,At),y=O(f,r-f),v=0;v<20&&P(g.Length()-y)>.004;){t.iterations+=1,_=i.GetSupport(K.MulTRV(s.q,j.NegV(g,j.s_t1),j.s_t0)),d=Q.MulXV(s,i.GetVertex(_),xt),p=n.GetSupport(K.MulTRV(a.q,g,j.s_t0)),m=Q.MulXV(a,n.GetVertex(p),Tt);var b=j.SubVV(d,m,Ct);g.Normalize();var S=j.DotVV(g,b),w=j.DotVV(g,o);if(S-y>u*w){if(w<=0)return!1;if((u=(S-y)/w)>1)return!1;h.Copy(g).SelfNeg(),l.m_count=0}var x=c[l.m_count];switch(x.indexA=p,x.wA.Copy(m).SelfMulAdd(u,o),x.indexB=_,x.wB.Copy(d),x.w.Copy(x.wB).SelfSub(x.wA),x.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),++v}var T=Dt,A=Bt;return l.GetWitnessPoints(T,A),g.LengthSquared()>0&&(h.Copy(g).SelfNeg(),h.Normalize()),t.normal.Copy(h),t.lambda=u,t.iterations=v,!0},t.b2ShapeCastInput=function(){this.proxyA=new st,this.proxyB=new st,this.transformA=new Q,this.transformB=new Q,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=kr,t.b2TestOverlapAABB=zt,t.b2TestOverlapShape=jt,t.b2TimeOfImpact=we,t.b2TimeStep=Dn,t.b2Timer=it,t.b2Transform=Q,t.b2TreeNode=Xt,t.b2Vec2=j,t.b2Vec2_zero=q,t.b2Vec3=X,t.b2Velocity=In,t.b2VelocityConstraintPoint=En,t.b2Version=T,t.b2WeldJoint=nn,t.b2WeldJointDef=en,t.b2WheelJoint=sn,t.b2WheelJointDef=rn,t.b2World=Dr,t.b2WorldManifold=Rt,t.b2_180_over_pi=I,t.b2_aabbExtension=h,t.b2_aabbMultiplier=2,t.b2_angularSleepTolerance=x,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=y,t.b2_linearSleepTolerance=w,t.b2_linearSlop=l,t.b2_maxAngularCorrection=d,t.b2_maxFloat=i,t.b2_maxLinearCorrection=_,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=v,t.b2_pi=o,t.b2_pi_over_180=B,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=A,t.g_blockSolve=Pn,Object.defineProperty(t,"__esModule",{value:!0})}(DSt);var BSt=DSt;CSt(BSt);var ISt=BSt,MSt={};for(var PSt in ISt)-1===PSt.indexOf("b2_")&&(MSt[PSt.replace("b2","")]=ISt[PSt]);var ESt=CSt(MSt),OSt=t("f7",{Static:0,Kinematic:1,Dynamic:2,Animated:3});Ee(OSt),Ee(t("f8",{None:0,BOX:1,CIRCLE:2,POLYGON:3})),Ee(t("f9",{None:0,DISTANCE:1,SPRING:2,WHEEL:3,MOUSE:4,FIXED:5,SLIDER:6,RELATIVE:7,HINGE:8}));var kSt=t("fa",{DEFAULT:1});Ee(kSt),t("fb",kSt),t("fc",{Closest:0,Any:1,AllClosest:2,All:3});var RSt=t("fd",{None:"none-contact",BEGIN_CONTACT:"begin-contact",END_CONTACT:"end-contact",PRE_SOLVE:"pre-solve",POST_SOLVE:"post-solve"}),FSt=(t("fe",{None:0,Shape:1,Joint:2,Aabb:4,Pair:8,CenterOfMass:16,Particle:32,Controller:64,All:63}),t("ff",32)),LSt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._contactFixtures=[],e._BeginContact=null,e._EndContact=null,e._PreSolve=null,e._PostSolve=null,e}s(e,t);var i=e.prototype;return i.setBeginContact=function(t){this._BeginContact=t},i.setEndContact=function(t){this._EndContact=t},i.setPreSolve=function(t){this._PreSolve=t},i.setPostSolve=function(t){this._PostSolve=t},i.BeginContact=function(t){if(this._BeginContact){var e=t.GetFixtureA(),i=t.GetFixtureB(),n=this._contactFixtures;t._shouldReport=!1,-1===n.indexOf(e)&&-1===n.indexOf(i)||(t._shouldReport=!0,this._BeginContact(t))}},i.EndContact=function(t){this._EndContact&&t._shouldReport&&(t._shouldReport=!1,this._EndContact(t))},i.PreSolve=function(t,e){this._PreSolve&&t._shouldReport&&this._PreSolve(t,e)},i.PostSolve=function(t,e){this._PostSolve&&t._shouldReport&&this._PostSolve(t,e)},i.registerContactFixture=function(t){this._contactFixtures.push(t)},i.unregisterContactFixture=function(t){Se(this._contactFixtures,t)},e}(ESt.ContactListener),VSt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._point=new ESt.Vec2,e._isPoint=!1,e._fixtures=[],e}s(e,t);var i=e.prototype;return i.init=function(t){t?(this._isPoint=!0,this._point.x=t.x,this._point.y=t.y):this._isPoint=!1,this._fixtures.length=0},i.ReportFixture=function(t){return this._isPoint?t.TestPoint(this._point)&&this._fixtures.push(t):this._fixtures.push(t),!0},i.getFixture=function(){return this._fixtures[0]},i.getFixtures=function(){return this._fixtures},e}(ESt.QueryCallback),NSt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._type=0,e._fixtures=[],e._points=[],e._normals=[],e._fractions=[],e._mask=4294967295,e}s(e,t);var i=e.prototype;return i.init=function(t,e){this._type=t,this._mask=e,this._fixtures.length=0,this._points.length=0,this._normals.length=0,this._fractions.length=0},i.ReportFixture=function(t,e,i,n){return t.GetFilterData().categoryBits&this._mask?0===this._type?(this._fixtures[0]=t,this._points[0]=e,this._normals[0]=i,this._fractions[0]=n,n):(this._fixtures.push(t),this._points.push(new ds(e.x,e.y)),this._normals.push(new ds(i.x,i.y)),this._fractions.push(n),1===this._type?0:this._type>=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}(ESt.RayCastCallback);function zSt(t,e){var i=e.length;return e[t<0?i- -t%i:t%i]}function USt(t,e,i){for(var n=[];e<t;)e+=i.length;for(;t<=e;++t)n.push(zSt(t,i));return n}function GSt(t,e,i){if(HSt(t,i)){if(qSt(zSt(t,i),zSt(t-1,i),zSt(e,i))&&XSt(zSt(t,i),zSt(t+1,i),zSt(e,i)))return!1}else if(XSt(zSt(t,i),zSt(t+1,i),zSt(e,i))||qSt(zSt(t,i),zSt(t-1,i),zSt(e,i)))return!1;if(HSt(e,i)){if(qSt(zSt(e,i),zSt(e-1,i),zSt(t,i))&&XSt(zSt(e,i),zSt(e+1,i),zSt(t,i)))return!1}else if(XSt(zSt(e,i),zSt(e+1,i),zSt(t,i))||qSt(zSt(e,i),zSt(e-1,i),zSt(t,i)))return!1;for(var n=0;n<i.length;++n)if((n+1)%i.length!=t&&n!=t&&(n+1)%i.length!=e&&n!=e){var r=new ds;if($St(zSt(t,i),zSt(e,i),zSt(n,i),zSt(n+1,i),r))return!1}return!0}function HSt(t,e){return WSt(t,e)}function WSt(t,e,i){if(void 0===i){var n=t,r=e;t=zSt(n-1,r),e=zSt(n,r),void 0===t&&(t=e),void 0===(i=zSt(n+1,r))&&(i=e)}return twt(t,e,i)<0}function jSt(t,e,i){return twt(t,e,i)>0}function qSt(t,e,i){return twt(t,e,i)>=0}function XSt(t,e,i){return twt(t,e,i)<=0}function YSt(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function JSt(t){KSt(t)||t.reverse()}function KSt(t){return t.length<3||QSt(t)>0}function QSt(t){var e,i=0;for(e=0;e<t.length;e++){var n=(e+1)%t.length;i+=t[e].x*t[n].y,i-=t[e].y*t[n].x}return i/2}function ZSt(t,e,i,n){var r,s=new ds,a=e.y-t.y,o=t.x-e.x,h=a*t.x+o*t.y,u=n.y-i.y,l=i.x-n.x,c=u*i.x+l*i.y,f=a*l-u*o;return r=f,Math.abs(r-0)<=1e-6||(s.x=(l*h-o*c)/f,s.y=(a*c-u*h)/f),s}function $St(t,e,i,n,r){if(t==i||t==n||e==i||e==n)return!1;var s=t.x,a=t.y,o=e.x,h=e.y,u=i.x,l=i.y,c=n.x,f=n.y;if(Math.max(s,o)<Math.min(u,c)||Math.max(u,c)<Math.min(s,o))return!1;if(Math.max(a,h)<Math.min(l,f)||Math.max(l,f)<Math.min(a,h))return!1;var _=(c-u)*(a-l)-(f-l)*(s-u),d=(o-s)*(a-l)-(h-a)*(s-u),p=(f-l)*(o-s)-(c-u)*(h-a);return!(Math.abs(p)<1e-6)&&(d/=p,(_/=p)>0&&_<1&&d>0&&d<1&&(r.x=s+_*(o-s),r.y=a+_*(h-a),!0))}function twt(t,e,i){return t.x*(e.y-i.y)+e.x*(i.y-t.y)+i.x*(t.y-e.y)}var ewt=Object.freeze({__proto__:null,ConvexPartition:function t(e){JSt(e);for(var i,n,r,s=[],a=0,o=0,h=0,u=new ds,l=new ds,c=0,f=0,_=0;_<e.length;++_)if(HSt(_,e)){o=h=1e8;for(var d=0;d<e.length;++d)jSt(zSt(_-1,e),zSt(_,e),zSt(d,e))&&XSt(zSt(_-1,e),zSt(_,e),zSt(d-1,e))&&(i=ZSt(zSt(_-1,e),zSt(_,e),zSt(d,e),zSt(d-1,e)),WSt(zSt(_+1,e),zSt(_,e),i)&&(a=YSt(zSt(_,e),i))<o&&(o=a,u=i,c=d)),jSt(zSt(_+1,e),zSt(_,e),zSt(d+1,e))&&XSt(zSt(_+1,e),zSt(_,e),zSt(d,e))&&(i=ZSt(zSt(_+1,e),zSt(_,e),zSt(d,e),zSt(d+1,e)),jSt(zSt(_-1,e),zSt(_,e),i)&&(a=YSt(zSt(_,e),i))<h&&(h=a,f=d,l=i));if(c==(f+1)%e.length){var p=u.add(l).multiplyScalar(.5);(n=USt(_,f,e)).push(p),(r=USt(c,_,e)).push(p)}else{for(var m=0,g=c;f<c;)f+=e.length;for(var y=c;y<=f;++y)if(GSt(_,y,e)){var v=1/(YSt(zSt(_,e),zSt(y,e))+1);HSt(y,e)?XSt(zSt(y-1,e),zSt(y,e),zSt(_,e))&&qSt(zSt(y+1,e),zSt(y,e),zSt(_,e))?v+=3:v+=2:v+=1,v>m&&(g=y,m=v)}n=USt(_,g,e),r=USt(g,_,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:JSt,IsCounterClockWise:KSt});function iwt(t){hwt(t);for(var e=!0,i=0,n=t.length;i<n;++i)if(!swt(t[(i+n-1)%n],t[i],t[(i+1)%n])){e=!1;break}if(e)return[t];var r=[],s=cwt(t);if(!s)return null;for(;s.length;){for(var a=s.splice(0,1)[0],o=0,h=a.length;o<h;++o){for(var u=a[o],l=a[(o+1)%h],c=null,f=0;f<s.length;++f){for(var _=s[f],d=0;d<3;++d){var p=_[d];if(awt(u,_[(d+1)%3])&&awt(l,p)){c=_[(d+2)%3];break}}if(c)break}if(c&&!(rwt(a[(o+h-1)%h],u,c)>0||rwt(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 nwt=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 rwt(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function swt(t,e,i){return rwt(t,e,i)<0}function awt(t,e){return t.x===e.x&&t.y===e.y}function owt(t){for(var e=0,i=0,n=t.length;i<n;++i){var r=t[i],s=t[(i+1)%n];e+=(s.x-r.x)*(s.y+r.y)}return e>0}function hwt(t){owt(t)&&t.reverse()}function uwt(t,e){if(t.shouldUpdate){t.shouldUpdate=!1;var i=t.prev.point,n=t.point,r=t.next.point;t.isConvex=swt(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;c<f;++c){var _=e[c];if(_.isActive&&_!==t){var d=_.point;if(!(awt(i,d)||awt(n,d)||awt(r,d))){var p=rwt(i,d,n),m=rwt(n,d,r),g=rwt(r,d,i);if(p>0&&m>0&&g>0){t.isEar=!1;break}if(0===p&&m>=0&&g>=0&&(rwt(i,_.prev.point,n)>0||rwt(i,_.next.point,n)>0)){t.isEar=!1;break}if(0===m&&p>=0&&g>=0&&(rwt(n,_.prev.point,r)>0||rwt(n,_.next.point,r)>0)){t.isEar=!1;break}if(0===g&&p>=0&&m>=0&&(rwt(r,_.prev.point,i)>0||rwt(r,_.next.point,i)>0)){t.isEar=!1;break}}}}}else t.isEar=!1}}function lwt(t){for(var e=t,i=t;;)if(awt(e.point,e.next.point)||0===rwt(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 cwt(t){if(hwt(t),t.length<4)return[t];for(var e=t.length,i=[],n=[],r=0;r<e;++r){var s=new nwt;s.isActive=!0,s.isConvex=!1,s.isEar=!1,s.point=t[r],s.angleCos=0,s.shouldUpdate=!0,s.index=r,i.push(s)}for(var a=0;a<e;++a){var o=i[a];o.prev=i[(a+e-1)%e],o.next=i[(a+1)%e]}i.forEach((function(t){return uwt(t,i)}));for(var h=0;h<e-3;++h){for(var u=void 0,l=0;l<e;++l){var c=i[l];c.isActive&&c.isEar&&(u?c.angleCos>u.angleCos&&(u=c):u=c)}if(!u){for(var f=0;f<e;++f){var _=i[f];if(_.isActive){var d=_.prev.point,p=_.point,m=_.next.point;if(Math.abs(rwt(d,p,m))>1e-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,lwt(u.next),h===e-4)break;for(var g=0;g<e;++g)uwt(i[g],i)}for(var y=0;y<e;++y){var v=i[y];if(v.isActive){v.prev.isActive=!1,v.next.isActive=!1;var b=v.prev.point,S=v.point,w=v.next.point;Math.abs(rwt(b,S,w))>1e-5&&n.push([b,S,w])}}return n}var fwt=Object.freeze({__proto__:null,ConvexPartition:iwt}),_wt=function(t){if(1===t){for(var e=this,i=function(t){var i="_"+(1<<t);e[i]=0,e.updateArray=[],Object.defineProperty(e,1<<t,{get:function(){return this[i]},set:function(e){this[i]!==e&&(this[i]=e,this.updateArray.indexOf(t)<0&&this.updateArray.push(t))}})},n=0;n<32;n++)i(n);this._1=1}else{for(var r=0;r<32;r++)this[""+(1<<r)]=0;this[1]=1}},dwt=null;A.internal.PhysicsGroup2D=kSt;var pwt=t("fg",function(t){function e(){var e,i,n,r,s;(s=t.call(this)||this).velocityIterations=10,s.positionIterations=10,s.collisionMatrix=new _wt,s._enable=!0,s._allowSleep=!0,s._maxSubSteps=1,s._fixedTimeStep=1/60,s._autoSimulation=!0,s._accumulator=0,s._steping=!1,s._gravity=new ds(0,-10*FSt),s._delayEvents=[];var a=ze.querySettings("physics","gravity");a&&(ds.copy(s._gravity,a),s._gravity.multiplyScalar(FSt)),s._allowSleep=null!==(e=ze.querySettings("physics","allowSleep"))&&void 0!==e?e:s._allowSleep,s._fixedTimeStep=null!==(i=ze.querySettings("physics","fixedTimeStep"))&&void 0!==i?i:s._fixedTimeStep,s._maxSubSteps=null!==(n=ze.querySettings("physics","maxSubSteps"))&&void 0!==n?n:s._maxSubSteps,s._autoSimulation=null!==(r=ze.querySettings("physics","autoSimulation"))&&void 0!==r?r:s._autoSimulation;var o=ze.querySettings("physics","collisionMatrix");if(o)for(var h in o){var u=parseInt(h),l=1<<parseInt(h);s.collisionMatrix[""+l]=o[u]}var c=ze.querySettings("physics","collisionGroups");return c&&c instanceof Array&&(c.forEach((function(t){kSt[t.name]=1<<t.index})),Ee.update(kSt)),mSt.physicsWorld=ySt(),s.gravity=s._gravity,s.allowSleep=s._allowSleep,s}s(e,t);var i=e.prototype;return i.postUpdate=function(t){if(this._enable&&this._autoSimulation){YE.emit("director_before_physics"),this.physicsWorld.syncSceneToPhysics(),this._steping=!0;var e=this._fixedTimeStep,i=this.velocityIterations,n=this.positionIterations;this._accumulator+=t;for(var r=0;r++<this._maxSubSteps&&this._accumulator>e;)this.physicsWorld.step(e,i,n),this._accumulator-=e;for(var s=this._delayEvents,a=0,o=s.length;a<o;a++){var h=s[a];h.func.call(h.target)}s.length=0,this.physicsWorld.syncPhysicsToScene(),this.debugDrawFlags&&this.physicsWorld.drawDebug(),this._steping=!1,YE.emit("director_after_physics")}},i._callAfterStep=function(t,e){this._steping?this._delayEvents.push({target:t,func:e}):e.call(t)},i.resetAccumulator=function(t){void 0===t&&(t=0),this._accumulator=t},i.step=function(t){this.physicsWorld.step(t,this.velocityIterations,this.positionIterations)},i.raycast=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=4294967295),this.physicsWorld.raycast(t,e,i,n)},i.testPoint=function(t){return this.physicsWorld.testPoint(t)},i.testAABB=function(t){return this.physicsWorld.testAABB(t)},e.constructAndRegister=function(){YE.registerSystem(e.ID,e.instance,0)},n(e,[{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.setAllowSleep(t)}},{key:"gravity",get:function(){return this._gravity},set:function(t){this._gravity.set(t),this.physicsWorld.setGravity(new ds(t.x/FSt,t.y/FSt))}},{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:"autoSimulation",get:function(){return this._autoSimulation},set:function(t){this._autoSimulation=t}},{key:"debugDrawFlags",get:function(){return this.physicsWorld.debugDrawFlags},set:function(t){this.physicsWorld.debugDrawFlags=t}},{key:"physicsWorld",get:function(){return mSt.physicsWorld}},{key:"stepping",get:function(){return this._steping}}],[{key:"PHYSICS_NONE",get:function(){return!mSt.id}},{key:"PHYSICS_BUILTIN",get:function(){return"builtin"===mSt.id}},{key:"PHYSICS_BOX2D",get:function(){return"box2d"===mSt.id}},{key:"PHYSICS_BOX2D_WASM",get:function(){return"box2d-wasm"===mSt.id}},{key:"PhysicsGroup",get:function(){return kSt}},{key:"instance",get:function(){return dwt||(dwt=new e),dwt}}]),e}(Bo(Ff)));pwt.ID="PHYSICS_2D",YE.once("director_init",(function(){pwt.constructAndRegister()})),t("fh",{Circles:0,FaceA:1,FaceB:2});var mwt=t("fX",{DYNAMIC:1,STATIC:2,KINEMATIC:4});Ee(mwt);var gwt=t("fW",{X_AXIS:0,Y_AXIS:1,Z_AXIS:2});Ee(gwt);var ywt={X:0,Y:1,Z:2,SWING1:3,SWING2:4,TWIST:5};Ee(ywt);var vwt={VERTEX:1,LINE:2,TRIANGLE:3,TETRAHEDRON:4};Ee(vwt);var bwt=t("fY",{BOX:0,SPHERE:1,CAPSULE:2,CYLINDER:3,CONE:4,MESH:5,PLANE:6,SIMPLEX:7,TERRAIN:8});Ee(bwt);var Swt={POINT_TO_POINT:0,HINGE:1,FIXED:2,CONFIGURABLE:3};Ee(Swt);var wwt={FREE:0,LIMITED:1,LOCKED:2};Ee(wwt);var xwt={DISABLED:0,SERVO:1,INDUCTION:2};Ee(xwt);var Twt={BOX:0,CAPSULE:1};Ee(Twt);var Awt={DEFAULT:1};Ee(Awt);var Cwt,Dwt,Bwt,Iwt,Mwt,Pwt,Ewt,Owt,kwt,Rwt,Fwt,Lwt,Vwt,Nwt,zwt,Uwt,Gwt,Hwt,Wwt,jwt,qwt,Xwt,Ywt,Jwt,Kwt=t("fZ",{NONE:0,WIRE_FRAME:1,CONSTRAINT:2,AABB:4});Ee(Kwt);var Qwt,Zwt,$wt,txt,ext,ixt,nxt,rxt,sxt,axt,oxt,hxt,uxt,lxt,cxt,fxt,_xt,dxt,pxt,mxt,gxt,yxt,vxt,bxt,Sxt,wxt,xxt,Txt,Axt,Cxt,Dxt,Bxt,Ixt,Mxt,Pxt,Ext,Oxt,kxt,Rxt,Fxt,Lxt,Vxt,Nxt,zxt,Uxt,Gxt,Hxt,Wxt,jxt,qxt,Xxt,Yxt,Jxt,Kxt,Qxt,Zxt,$xt,tTt,eTt,iTt,nTt,rTt,sTt,aTt,oTt,hTt,uTt,lTt,cTt,fTt,_Tt,dTt,pTt,mTt,gTt,yTt,vTt,bTt,STt,wTt,xTt,TTt,ATt,CTt,DTt,BTt,ITt,MTt,PTt,ETt,OTt,kTt,RTt,FTt,LTt,VTt,NTt,zTt,UTt,GTt,HTt,WTt,jTt,qTt,XTt,YTt,JTt,KTt,QTt,ZTt,$Tt,tAt,eAt,iAt,nAt,rAt,sAt,aAt,oAt,hAt,uAt,lAt,cAt,fAt,_At,dAt,pAt,mAt,gAt,yAt,vAt,bAt,SAt,wAt,xAt,TAt,AAt,CAt,DAt,BAt,IAt=Ou,MAt=t("fi",(Cwt=Kh("cc.RigidBody2D"),Dwt=IAt(Awt),Bwt=IAt(OSt),Iwt=IAt(fi),Mwt=IAt(ci),Pwt=IAt(ci),Ewt=IAt(ci),Owt=IAt(ds),kwt=IAt(ci),Rwt=IAt(fi),Cwt((Lwt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).enabledContactListener=Vwt&&Vwt(),e.bullet=Nwt&&Nwt(),e.awakeOnLoad=zwt&&zwt(),e._body=null,e._group=Uwt&&Uwt(),e._type=Gwt&&Gwt(),e._allowSleep=Hwt&&Hwt(),e._gravityScale=Wwt&&Wwt(),e._linearDamping=jwt&&jwt(),e._angularDamping=qwt&&qwt(),e._linearVelocity=Xwt&&Xwt(),e._angularVelocity=Ywt&&Ywt(),e._fixedRotation=Jwt&&Jwt(),e}s(e,t);var i=e.prototype;return i.isAwake=function(){return!!this._body&&this._body.isAwake},i.wakeUp=function(){this._body&&this._body.wakeUp()},i.sleep=function(){this._body&&this._body.sleep()},i.getMass=function(){return this._body?this._body.getMass():0},i.applyForce=function(t,e,i){this._body&&this._body.applyForce(t,e,i)},i.applyForceToCenter=function(t,e){this._body&&this._body.applyForceToCenter(t,e)},i.applyTorque=function(t,e){this._body&&this._body.applyTorque(t,e)},i.applyLinearImpulse=function(t,e,i){this._body&&this._body.applyLinearImpulse(t,e,i)},i.applyLinearImpulseToCenter=function(t,e){this._body&&this._body.applyLinearImpulseToCenter(t,e)},i.applyAngularImpulse=function(t,e){this._body&&this._body.applyAngularImpulse(t,e)},i.getLinearVelocityFromWorldPoint=function(t,e){return this._body?this._body.getLinearVelocityFromWorldPoint(t,e):e},i.getLocalVector=function(t,e){return this._body?this._body.getLocalVector(t,e):e},i.getWorldVector=function(t,e){return this._body?this._body.getWorldVector(t,e):e},i.getLocalPoint=function(t,e){return this._body?this._body.getLocalPoint(t,e):e},i.getWorldPoint=function(t,e){return this._body?this._body.getWorldPoint(t,e):e},i.getLocalCenter=function(t){return this._body?this._body.getLocalCenter(t):t},i.getWorldCenter=function(t){return this._body?this._body.getWorldCenter(t):t},i.getInertia=function(){return this._body?this._body.getInertia():0},i.onLoad=function(){this._body="builtin"===mSt.id?vSt:new mSt.wrapper.RigidBody,this._body.initialize(this)},i.onEnable=function(){this._body&&this._body.onEnable()},i.onDisable=function(){this._body&&this._body.onDisable()},i.onDestroy=function(){this._body&&this._body.onDestroy()},n(e,[{key:"group",get:function(){return this._group},set:function(t){this._group=t}},{key:"type",get:function(){return this._type},set:function(t){this._type=t,this._body&&(3===t?this._body.setType(1):this._body.setType(t))}},{key:"allowSleep",get:function(){return this._allowSleep},set:function(t){this._allowSleep=t,this._body&&this._body.setAllowSleep(t)}},{key:"gravityScale",get:function(){return this._gravityScale},set:function(t){this._gravityScale=t,this._body&&this._body.setGravityScale(t)}},{key:"linearDamping",get:function(){return this._linearDamping},set:function(t){this._linearDamping=t,this._body&&this._body.setLinearDamping(t)}},{key:"angularDamping",get:function(){return this._angularDamping},set:function(t){this._angularDamping=t,this._body&&this._body.setAngularDamping(t)}},{key:"linearVelocity",get:function(){return this._body&&this._body.getLinearVelocity(this._linearVelocity),this._linearVelocity},set:function(t){this._linearVelocity=t,this._body&&this._body.setLinearVelocity(t)}},{key:"angularVelocity",get:function(){return this._body&&(this._angularVelocity=this._body.getAngularVelocity()),this._angularVelocity},set:function(t){this._angularVelocity=t,this._body&&this._body.setAngularVelocity(t)}},{key:"fixedRotation",get:function(){return this._fixedRotation},set:function(t){this._fixedRotation=t,this._body&&this._body.setFixedRotation(t)}},{key:"impl",get:function(){return this._body}}]),e}(yg),v(Lwt.prototype,"group",[Dwt],Object.getOwnPropertyDescriptor(Lwt.prototype,"group"),Lwt.prototype),Vwt=zh(Lwt.prototype,"enabledContactListener",[uu],(function(){return!1})),Nwt=zh(Lwt.prototype,"bullet",[uu],(function(){return!1})),v(Lwt.prototype,"type",[Bwt],Object.getOwnPropertyDescriptor(Lwt.prototype,"type"),Lwt.prototype),v(Lwt.prototype,"allowSleep",[Iwt],Object.getOwnPropertyDescriptor(Lwt.prototype,"allowSleep"),Lwt.prototype),v(Lwt.prototype,"gravityScale",[Mwt],Object.getOwnPropertyDescriptor(Lwt.prototype,"gravityScale"),Lwt.prototype),v(Lwt.prototype,"linearDamping",[Pwt],Object.getOwnPropertyDescriptor(Lwt.prototype,"linearDamping"),Lwt.prototype),v(Lwt.prototype,"angularDamping",[Ewt],Object.getOwnPropertyDescriptor(Lwt.prototype,"angularDamping"),Lwt.prototype),v(Lwt.prototype,"linearVelocity",[Owt],Object.getOwnPropertyDescriptor(Lwt.prototype,"linearVelocity"),Lwt.prototype),v(Lwt.prototype,"angularVelocity",[kwt],Object.getOwnPropertyDescriptor(Lwt.prototype,"angularVelocity"),Lwt.prototype),v(Lwt.prototype,"fixedRotation",[Rwt],Object.getOwnPropertyDescriptor(Lwt.prototype,"fixedRotation"),Lwt.prototype),zwt=zh(Lwt.prototype,"awakeOnLoad",[uu],(function(){return!0})),Uwt=zh(Lwt.prototype,"_group",[uu],(function(){return 1})),Gwt=zh(Lwt.prototype,"_type",[uu],(function(){return 2})),Hwt=zh(Lwt.prototype,"_allowSleep",[uu],(function(){return!0})),Wwt=zh(Lwt.prototype,"_gravityScale",[uu],(function(){return 1})),jwt=zh(Lwt.prototype,"_linearDamping",[uu],(function(){return 0})),qwt=zh(Lwt.prototype,"_angularDamping",[uu],(function(){return 0})),Xwt=zh(Lwt.prototype,"_linearVelocity",[uu],(function(){return new ds})),Ywt=zh(Lwt.prototype,"_angularVelocity",[uu],(function(){return 0})),Jwt=zh(Lwt.prototype,"_fixedRotation",[uu],(function(){return!1})),Fwt=Lwt))||Fwt)),PAt=Ou,EAt=t("fj",(Qwt=Kh("cc.Collider2D"),Zwt=PAt(ci),$wt=PAt(Awt),txt=PAt(ci),ext=PAt(fi),ixt=PAt(ci),nxt=PAt(ci),rxt=PAt(ds),Qwt((axt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).editing=!1,e.tag=oxt&&oxt(),e.TYPE=0,e._shape=null,e._body=null,e._group=hxt&&hxt(),e._density=uxt&&uxt(),e._sensor=lxt&&lxt(),e._friction=cxt&&cxt(),e._restitution=fxt&&fxt(),e._offset=_xt&&_xt(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._shape=SSt(this.TYPE),this._shape.initialize(this),this._shape.onLoad&&this._shape.onLoad(),this._body=this.getComponent(MAt)},i.onEnable=function(){this._shape&&this._shape.onEnable()},i.onDisable=function(){this._shape&&this._shape.onDisable&&this._shape.onDisable()},i.onDestroy=function(){this._shape&&this._shape.onDestroy&&this._shape.onDestroy()},i.apply=function(){this._shape&&this._shape.apply&&this._shape.apply()},n(e,[{key:"group",get:function(){return this._group},set:function(t){this._group=t,this._shape&&this._shape.onGroupChanged&&this._shape.onGroupChanged()}},{key:"density",get:function(){return this._density},set:function(t){this._density=t}},{key:"sensor",get:function(){return this._sensor},set:function(t){this._sensor=t}},{key:"friction",get:function(){return this._friction},set:function(t){this._friction=t}},{key:"restitution",get:function(){return this._restitution},set:function(t){this._restitution=t}},{key:"offset",get:function(){return this._offset},set:function(t){this._offset=t}},{key:"body",get:function(){return this._body}},{key:"impl",get:function(){return this._shape}},{key:"worldAABB",get:function(){return this._shape?this._shape.worldAABB:new bs}}]),e}(Bo(yg)),oxt=zh(axt.prototype,"tag",[Zwt,uu],(function(){return 0})),v(axt.prototype,"group",[$wt],Object.getOwnPropertyDescriptor(axt.prototype,"group"),axt.prototype),v(axt.prototype,"density",[txt],Object.getOwnPropertyDescriptor(axt.prototype,"density"),axt.prototype),v(axt.prototype,"sensor",[ext],Object.getOwnPropertyDescriptor(axt.prototype,"sensor"),axt.prototype),v(axt.prototype,"friction",[ixt],Object.getOwnPropertyDescriptor(axt.prototype,"friction"),axt.prototype),v(axt.prototype,"restitution",[nxt],Object.getOwnPropertyDescriptor(axt.prototype,"restitution"),axt.prototype),v(axt.prototype,"offset",[rxt],Object.getOwnPropertyDescriptor(axt.prototype,"offset"),axt.prototype),hxt=zh(axt.prototype,"_group",[uu],(function(){return 1})),uxt=zh(axt.prototype,"_density",[uu],(function(){return 1})),lxt=zh(axt.prototype,"_sensor",[uu],(function(){return!1})),cxt=zh(axt.prototype,"_friction",[uu],(function(){return.2})),fxt=zh(axt.prototype,"_restitution",[uu],(function(){return 0})),_xt=zh(axt.prototype,"_offset",[uu],(function(){return new ds})),sxt=axt))||sxt)),OAt=(t("fk",(dxt=Kh("cc.BoxCollider2D"),pxt=Ou(ms),dxt((gxt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._size=yxt&&yxt(),e.TYPE=1,e}return s(e,t),n(e,[{key:"size",get:function(){return this._size},set:function(t){this._size=t}},{key:"worldPoints",get:function(){return this._shape?this._shape.worldPoints:[]}}]),e}(EAt),yxt=zh(gxt.prototype,"_size",[uu],(function(){return new ms(1,1)})),v(gxt.prototype,"size",[pxt],Object.getOwnPropertyDescriptor(gxt.prototype,"size"),gxt.prototype),mxt=gxt))||mxt)),t("fl",(vxt=Kh("cc.CircleCollider2D"),bxt=Ou(ci),vxt((wxt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._radius=xxt&&xxt(),e.TYPE=2,e}return s(e,t),n(e,[{key:"radius",get:function(){return this._radius},set:function(t){this._radius=t<0?0:t}},{key:"worldPosition",get:function(){return this._shape?this._shape.worldPosition:new ds}},{key:"worldRadius",get:function(){return this._shape?this._shape.worldRadius:0}}]),e}(EAt),xxt=zh(wxt.prototype,"_radius",[uu],(function(){return 1})),v(wxt.prototype,"radius",[bxt],Object.getOwnPropertyDescriptor(wxt.prototype,"radius"),wxt.prototype),Sxt=wxt))||Sxt)),t("fm",(Txt=Kh("cc.PolygonCollider2D"),Axt=Ou(ci),Cxt=Ou([ds]),Txt((Bxt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).threshold=Ixt&&Ixt(),e._points=Mxt&&Mxt(),e.TYPE=3,e}return s(e,t),n(e,[{key:"points",get:function(){return this._points},set:function(t){this._points=t}},{key:"worldPoints",get:function(){return this._shape?this._shape.worldPoints:[]}}]),e}(EAt),Ixt=zh(Bxt.prototype,"threshold",[Axt],(function(){return 1})),Mxt=zh(Bxt.prototype,"_points",[uu],(function(){return[new ds(-1,-1),new ds(1,-1),new ds(1,1),new ds(-1,1)]})),v(Bxt.prototype,"points",[Cxt],Object.getOwnPropertyDescriptor(Bxt.prototype,"points"),Bxt.prototype),Dxt=Bxt))||Dxt)),Ou),kAt=t("fn",(Pxt=Kh("cc.Joint2D"),Ext=OAt(MAt),Pxt((kxt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).anchor=Rxt&&Rxt(),e.connectedAnchor=Fxt&&Fxt(),e.collideConnected=Lxt&&Lxt(),e.connectedBody=Vxt&&Vxt(),e._body=null,e._joint=null,e.TYPE=0,e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._joint=TSt(this.TYPE),this._joint.initialize(this),this._body=this.getComponent(MAt)},i.onEnable=function(){this._joint&&this._joint.onEnable&&this._joint.onEnable()},i.onDisable=function(){this._joint&&this._joint.onDisable&&this._joint.onDisable()},i.start=function(){this._joint&&this._joint.start&&this._joint.start()},i.onDestroy=function(){this._joint&&this._joint.onDestroy&&this._joint.onDestroy()},i.apply=function(){this._joint&&this._joint.apply&&this._joint.apply()},n(e,[{key:"body",get:function(){return this._body}},{key:"impl",get:function(){return this._joint}}]),e}(yg),Rxt=zh(kxt.prototype,"anchor",[uu],(function(){return new ds})),Fxt=zh(kxt.prototype,"connectedAnchor",[uu],(function(){return new ds})),Lxt=zh(kxt.prototype,"collideConnected",[uu],(function(){return!1})),Vxt=zh(kxt.prototype,"connectedBody",[Ext,uu],(function(){return null})),Oxt=kxt))||Oxt)),RAt=(t("fo",(Nxt=Kh("cc.DistanceJoint2D"),zxt=Ou(ci),Uxt=Ou(fi),Nxt((Hxt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).TYPE=1,e._maxLength=Wxt&&Wxt(),e._autoCalcDistance=jxt&&jxt(),e}return s(e,t),n(e,[{key:"maxLength",get:function(){return this._autoCalcDistance?this.connectedBody?ir.distance(this.node.worldPosition,this.connectedBody.node.worldPosition):ir.len(this.node.worldPosition):this._maxLength},set:function(t){this._maxLength=t,this._joint&&this._joint.setMaxLength(t)}},{key:"autoCalcDistance",get:function(){return this._autoCalcDistance},set:function(t){this._autoCalcDistance=t}}]),e}(kAt),v(Hxt.prototype,"maxLength",[zxt],Object.getOwnPropertyDescriptor(Hxt.prototype,"maxLength"),Hxt.prototype),v(Hxt.prototype,"autoCalcDistance",[Uxt],Object.getOwnPropertyDescriptor(Hxt.prototype,"autoCalcDistance"),Hxt.prototype),Wxt=zh(Hxt.prototype,"_maxLength",[uu],(function(){return 5})),jxt=zh(Hxt.prototype,"_autoCalcDistance",[uu],(function(){return!0})),Gxt=Hxt))||Gxt)),t("fp",(qxt=Kh("cc.SpringJoint2D"),Xxt=Ou(ci),Yxt=Ou(ci),Jxt=Ou(ci),Kxt=Ou(fi),qxt((Zxt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).TYPE=2,e._frequency=$xt&&$xt(),e._dampingRatio=tTt&&tTt(),e._distance=eTt&&eTt(),e._autoCalcDistance=iTt&&iTt(),e}return s(e,t),n(e,[{key:"frequency",get:function(){return this._frequency},set:function(t){this._frequency=t,this._joint&&this._joint.setFrequency(t)}},{key:"dampingRatio",get:function(){return this._dampingRatio},set:function(t){this._dampingRatio=t,this._joint&&this._joint.setDampingRatio(t)}},{key:"distance",get:function(){return this._autoCalcDistance?this.connectedBody?ir.distance(this.node.worldPosition,this.connectedBody.node.worldPosition):ir.len(this.node.worldPosition):this._distance},set:function(t){this._distance=t,this._joint&&this._joint.setDistance(t)}},{key:"autoCalcDistance",get:function(){return this._autoCalcDistance},set:function(t){this._autoCalcDistance=t}}]),e}(kAt),v(Zxt.prototype,"frequency",[Xxt],Object.getOwnPropertyDescriptor(Zxt.prototype,"frequency"),Zxt.prototype),v(Zxt.prototype,"dampingRatio",[Yxt],Object.getOwnPropertyDescriptor(Zxt.prototype,"dampingRatio"),Zxt.prototype),v(Zxt.prototype,"distance",[Jxt],Object.getOwnPropertyDescriptor(Zxt.prototype,"distance"),Zxt.prototype),v(Zxt.prototype,"autoCalcDistance",[Kxt],Object.getOwnPropertyDescriptor(Zxt.prototype,"autoCalcDistance"),Zxt.prototype),$xt=zh(Zxt.prototype,"_frequency",[uu],(function(){return 5})),tTt=zh(Zxt.prototype,"_dampingRatio",[uu],(function(){return.7})),eTt=zh(Zxt.prototype,"_distance",[uu],(function(){return 10})),iTt=zh(Zxt.prototype,"_autoCalcDistance",[uu],(function(){return!0})),Qxt=Zxt))||Qxt)),t("fq",(nTt=Kh("cc.MouseJoint2D"),rTt=Ou(ci),sTt=Ou(ci),aTt=Ou(ci),nTt((hTt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).TYPE=4,e._maxForce=uTt&&uTt(),e._dampingRatio=lTt&&lTt(),e._frequency=cTt&&cTt(),e._target=new ds,e}return s(e,t),e.prototype.update=function(t){this._joint.update(t)},n(e,[{key:"target",get:function(){return this._target},set:function(t){this._target=t,this._joint&&this._joint.setTarget(t)}},{key:"frequency",get:function(){return this._frequency},set:function(t){this._frequency=t,this._joint&&this._joint.setFrequency(t)}},{key:"dampingRatio",get:function(){return this._dampingRatio},set:function(t){this._dampingRatio=t,this._joint&&this._joint.setDampingRatio(t)}},{key:"maxForce",get:function(){return this._maxForce},set:function(t){this._maxForce=t,this._joint&&this._joint.setMaxForce(t)}}]),e}(kAt),v(hTt.prototype,"frequency",[rTt],Object.getOwnPropertyDescriptor(hTt.prototype,"frequency"),hTt.prototype),v(hTt.prototype,"dampingRatio",[sTt],Object.getOwnPropertyDescriptor(hTt.prototype,"dampingRatio"),hTt.prototype),v(hTt.prototype,"maxForce",[aTt],Object.getOwnPropertyDescriptor(hTt.prototype,"maxForce"),hTt.prototype),uTt=zh(hTt.prototype,"_maxForce",[uu],(function(){return 1e3})),lTt=zh(hTt.prototype,"_dampingRatio",[uu],(function(){return.7})),cTt=zh(hTt.prototype,"_frequency",[uu],(function(){return 5})),oTt=hTt))||oTt)),new ir),FAt=new ir,LAt=(t("fr",(fTt=Kh("cc.RelativeJoint2D"),_Tt=Ou(ci),dTt=Ou(ci),pTt=Ou(ci),mTt=Ou(ds),gTt=Ou(ci),yTt=Ou(fi),fTt((bTt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).TYPE=7,e._maxForce=STt&&STt(),e._maxTorque=wTt&&wTt(),e._correctionFactor=xTt&&xTt(),e._angularOffset=TTt&&TTt(),e._linearOffset=ATt&&ATt(),e._autoCalcOffset=CTt&&CTt(),e}return s(e,t),n(e,[{key:"maxForce",get:function(){return this._maxForce},set:function(t){this._maxForce=t,this._joint&&this._joint.setMaxForce(t)}},{key:"maxTorque",get:function(){return this._maxTorque},set:function(t){this._maxTorque=t,this._joint&&this._joint.setMaxTorque(t)}},{key:"correctionFactor",get:function(){return this._correctionFactor},set:function(t){this._correctionFactor=t,this._joint&&this._joint.setCorrectionFactor(t)}},{key:"linearOffset",get:function(){return this._autoCalcOffset?this.connectedBody?ds.subtract(this._linearOffset,this.connectedBody.node.worldPosition,this.node.worldPosition):ds.subtract(this._linearOffset,new ds(0,0),this.node.worldPosition):this._linearOffset},set:function(t){this._linearOffset.set(t),this._joint&&this._joint.setLinearOffset(t)}},{key:"angularOffset",get:function(){return this._autoCalcOffset&&(kr.toEuler(RAt,this.node.worldRotation),this.connectedBody?kr.toEuler(FAt,this.connectedBody.node.worldRotation):kr.toEuler(FAt,new kr),this._angularOffset=FAt.z-RAt.z),this._angularOffset},set:function(t){this._angularOffset=t,this._joint&&this._joint.setAngularOffset(t)}},{key:"autoCalcOffset",get:function(){return this._autoCalcOffset},set:function(t){this._autoCalcOffset=t}}]),e}(kAt),v(bTt.prototype,"maxForce",[_Tt],Object.getOwnPropertyDescriptor(bTt.prototype,"maxForce"),bTt.prototype),v(bTt.prototype,"maxTorque",[dTt],Object.getOwnPropertyDescriptor(bTt.prototype,"maxTorque"),bTt.prototype),v(bTt.prototype,"correctionFactor",[pTt],Object.getOwnPropertyDescriptor(bTt.prototype,"correctionFactor"),bTt.prototype),v(bTt.prototype,"linearOffset",[mTt],Object.getOwnPropertyDescriptor(bTt.prototype,"linearOffset"),bTt.prototype),v(bTt.prototype,"angularOffset",[gTt],Object.getOwnPropertyDescriptor(bTt.prototype,"angularOffset"),bTt.prototype),v(bTt.prototype,"autoCalcOffset",[yTt],Object.getOwnPropertyDescriptor(bTt.prototype,"autoCalcOffset"),bTt.prototype),STt=zh(bTt.prototype,"_maxForce",[uu],(function(){return 5})),wTt=zh(bTt.prototype,"_maxTorque",[uu],(function(){return.7})),xTt=zh(bTt.prototype,"_correctionFactor",[uu],(function(){return.3})),TTt=zh(bTt.prototype,"_angularOffset",[uu],(function(){return 0})),ATt=zh(bTt.prototype,"_linearOffset",[uu],(function(){return new ds})),CTt=zh(bTt.prototype,"_autoCalcOffset",[uu],(function(){return!0})),vTt=bTt))||vTt)),new ds);t("fs",(DTt=Kh("cc.SliderJoint2D"),BTt=Ou(ci),ITt=Ou(fi),MTt=Ou(fi),PTt=Ou(ci),ETt=Ou(ci),OTt=Ou(fi),kTt=Ou(ci),RTt=Ou(ci),DTt((LTt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).TYPE=6,e._angle=VTt&&VTt(),e._autoCalcAngle=NTt&&NTt(),e._enableMotor=zTt&&zTt(),e._maxMotorForce=UTt&&UTt(),e._motorSpeed=GTt&>t(),e._enableLimit=HTt&&HTt(),e._lowerLimit=WTt&&WTt(),e._upperLimit=jTt&&jTt(),e}return s(e,t),n(e,[{key:"angle",get:function(){return this._autoCalcAngle&&(this.connectedBody?ds.subtract(LAt,this.connectedBody.node.worldPosition,this.node.worldPosition):ds.subtract(LAt,new ds(0,0),this.node.worldPosition),this._angle=rn(Math.atan2(LAt.y,LAt.x))),this._angle},set:function(t){this._angle=t}},{key:"autoCalcAngle",get:function(){return this._autoCalcAngle},set:function(t){this._autoCalcAngle=t}},{key:"enableMotor",get:function(){return this._enableMotor},set:function(t){this._enableMotor=t}},{key:"maxMotorForce",get:function(){return this._maxMotorForce},set:function(t){this._maxMotorForce=t,this._joint&&this._joint.setMaxMotorForce(t)}},{key:"motorSpeed",get:function(){return this._motorSpeed},set:function(t){this._motorSpeed=t,this._joint&&this._joint.setMotorSpeed(t)}},{key:"enableLimit",get:function(){return this._enableLimit},set:function(t){this._enableLimit=t}},{key:"lowerLimit",get:function(){return this._lowerLimit},set:function(t){this._lowerLimit=t,this._joint&&this._joint.setLowerLimit(t)}},{key:"upperLimit",get:function(){return this._upperLimit},set:function(t){this._upperLimit=t,this._joint&&this._joint.setUpperLimit(t)}}]),e}(kAt),v(LTt.prototype,"angle",[BTt],Object.getOwnPropertyDescriptor(LTt.prototype,"angle"),LTt.prototype),v(LTt.prototype,"autoCalcAngle",[ITt],Object.getOwnPropertyDescriptor(LTt.prototype,"autoCalcAngle"),LTt.prototype),v(LTt.prototype,"enableMotor",[MTt],Object.getOwnPropertyDescriptor(LTt.prototype,"enableMotor"),LTt.prototype),v(LTt.prototype,"maxMotorForce",[PTt],Object.getOwnPropertyDescriptor(LTt.prototype,"maxMotorForce"),LTt.prototype),v(LTt.prototype,"motorSpeed",[ETt],Object.getOwnPropertyDescriptor(LTt.prototype,"motorSpeed"),LTt.prototype),v(LTt.prototype,"enableLimit",[OTt],Object.getOwnPropertyDescriptor(LTt.prototype,"enableLimit"),LTt.prototype),v(LTt.prototype,"lowerLimit",[kTt],Object.getOwnPropertyDescriptor(LTt.prototype,"lowerLimit"),LTt.prototype),v(LTt.prototype,"upperLimit",[RTt],Object.getOwnPropertyDescriptor(LTt.prototype,"upperLimit"),LTt.prototype),VTt=zh(LTt.prototype,"_angle",[uu],(function(){return 0})),NTt=zh(LTt.prototype,"_autoCalcAngle",[uu],(function(){return!0})),zTt=zh(LTt.prototype,"_enableMotor",[uu],(function(){return!1})),UTt=zh(LTt.prototype,"_maxMotorForce",[uu],(function(){return 1e3})),GTt=zh(LTt.prototype,"_motorSpeed",[uu],(function(){return 1e3})),HTt=zh(LTt.prototype,"_enableLimit",[uu],(function(){return!1})),WTt=zh(LTt.prototype,"_lowerLimit",[uu],(function(){return 0})),jTt=zh(LTt.prototype,"_upperLimit",[uu],(function(){return 0})),FTt=LTt))||FTt)),t("ft",(qTt=Kh("cc.FixedJoint2D"),XTt=Ou(ci),YTt=Ou(ci),qTt((KTt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).TYPE=5,e._frequency=QTt&&QTt(),e._dampingRatio=ZTt&&ZTt(),e}return s(e,t),n(e,[{key:"frequency",get:function(){return this._frequency},set:function(t){this._frequency=t,this._joint&&this._joint.setFrequency(t)}},{key:"dampingRatio",get:function(){return this._dampingRatio},set:function(t){this._dampingRatio=t,this._joint&&this._joint.setDampingRatio(t)}}]),e}(kAt),v(KTt.prototype,"frequency",[XTt],Object.getOwnPropertyDescriptor(KTt.prototype,"frequency"),KTt.prototype),v(KTt.prototype,"dampingRatio",[YTt],Object.getOwnPropertyDescriptor(KTt.prototype,"dampingRatio"),KTt.prototype),QTt=zh(KTt.prototype,"_frequency",[uu],(function(){return.7})),ZTt=zh(KTt.prototype,"_dampingRatio",[uu],(function(){return.5})),JTt=KTt))||JTt)),t("fu",($Tt=Kh("cc.WheelJoint2D"),tAt=Ou(ci),eAt=Ou(fi),iAt=Ou(ci),nAt=Ou(ci),rAt=Ou(ci),sAt=Ou(ci),$Tt((oAt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).TYPE=3,e._angle=hAt&&hAt(),e._enableMotor=uAt&&uAt(),e._maxMotorTorque=lAt&&lAt(),e._motorSpeed=cAt&&cAt(),e._frequency=fAt&&fAt(),e._dampingRatio=_At&&_At(),e}return s(e,t),n(e,[{key:"angle",get:function(){return this._angle},set:function(t){this._angle=t}},{key:"enableMotor",get:function(){return this._enableMotor},set:function(t){this._enableMotor=t,this._joint&&this._joint.enableMotor(t)}},{key:"maxMotorTorque",get:function(){return this._maxMotorTorque},set:function(t){this._maxMotorTorque=t,this._joint&&this._joint.setMaxMotorTorque(t)}},{key:"motorSpeed",get:function(){return this._motorSpeed},set:function(t){this._motorSpeed=t,this._joint&&this._joint.setMotorSpeed(t)}},{key:"frequency",get:function(){return this._frequency},set:function(t){this._frequency=t,this._joint&&this._joint.setFrequency(t)}},{key:"dampingRatio",get:function(){return this._dampingRatio},set:function(t){this._dampingRatio=t,this._joint&&this._joint.setDampingRatio(t)}}]),e}(kAt),v(oAt.prototype,"angle",[tAt],Object.getOwnPropertyDescriptor(oAt.prototype,"angle"),oAt.prototype),v(oAt.prototype,"enableMotor",[eAt],Object.getOwnPropertyDescriptor(oAt.prototype,"enableMotor"),oAt.prototype),v(oAt.prototype,"maxMotorTorque",[iAt],Object.getOwnPropertyDescriptor(oAt.prototype,"maxMotorTorque"),oAt.prototype),v(oAt.prototype,"motorSpeed",[nAt],Object.getOwnPropertyDescriptor(oAt.prototype,"motorSpeed"),oAt.prototype),v(oAt.prototype,"frequency",[rAt],Object.getOwnPropertyDescriptor(oAt.prototype,"frequency"),oAt.prototype),v(oAt.prototype,"dampingRatio",[sAt],Object.getOwnPropertyDescriptor(oAt.prototype,"dampingRatio"),oAt.prototype),hAt=zh(oAt.prototype,"_angle",[uu],(function(){return 90})),uAt=zh(oAt.prototype,"_enableMotor",[uu],(function(){return!1})),lAt=zh(oAt.prototype,"_maxMotorTorque",[uu],(function(){return 1e3})),cAt=zh(oAt.prototype,"_motorSpeed",[uu],(function(){return 0})),fAt=zh(oAt.prototype,"_frequency",[uu],(function(){return 5})),_At=zh(oAt.prototype,"_dampingRatio",[uu],(function(){return.7})),aAt=oAt))||aAt)),t("fv",(dAt=Kh("cc.HingeJoint2D"),pAt=Ou(fi),mAt=Ou(ci),gAt=Ou(ci),yAt=Ou(fi),vAt=Ou(ci),bAt=Ou(ci),dAt((wAt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).TYPE=8,e._enableLimit=xAt&&xAt(),e._lowerAngle=TAt&&TAt(),e._upperAngle=AAt&&AAt(),e._enableMotor=CAt&&CAt(),e._maxMotorTorque=DAt&&DAt(),e._motorSpeed=BAt&&BAt(),e}return s(e,t),n(e,[{key:"enableLimit",get:function(){return this._enableLimit},set:function(t){this._enableLimit=t}},{key:"lowerAngle",get:function(){return this._lowerAngle},set:function(t){this._lowerAngle=t,this._joint&&this._joint.setLowerAngle(t)}},{key:"upperAngle",get:function(){return this._upperAngle},set:function(t){this._upperAngle=t,this._joint&&this._joint.setUpperAngle(t)}},{key:"enableMotor",get:function(){return this._enableMotor},set:function(t){this._enableMotor=t,this._joint&&this._joint.enableMotor(t)}},{key:"maxMotorTorque",get:function(){return this._maxMotorTorque},set:function(t){this._maxMotorTorque=t,this._joint&&this._joint.setMaxMotorTorque(t)}},{key:"motorSpeed",get:function(){return this._motorSpeed},set:function(t){this._motorSpeed=t,this._joint&&this._joint.setMotorSpeed(t)}}]),e}(kAt),v(wAt.prototype,"enableLimit",[pAt],Object.getOwnPropertyDescriptor(wAt.prototype,"enableLimit"),wAt.prototype),v(wAt.prototype,"lowerAngle",[mAt],Object.getOwnPropertyDescriptor(wAt.prototype,"lowerAngle"),wAt.prototype),v(wAt.prototype,"upperAngle",[gAt],Object.getOwnPropertyDescriptor(wAt.prototype,"upperAngle"),wAt.prototype),v(wAt.prototype,"enableMotor",[yAt],Object.getOwnPropertyDescriptor(wAt.prototype,"enableMotor"),wAt.prototype),v(wAt.prototype,"maxMotorTorque",[vAt],Object.getOwnPropertyDescriptor(wAt.prototype,"maxMotorTorque"),wAt.prototype),v(wAt.prototype,"motorSpeed",[bAt],Object.getOwnPropertyDescriptor(wAt.prototype,"motorSpeed"),wAt.prototype),xAt=zh(wAt.prototype,"_enableLimit",[uu],(function(){return!1})),TAt=zh(wAt.prototype,"_lowerAngle",[uu],(function(){return 0})),AAt=zh(wAt.prototype,"_upperAngle",[uu],(function(){return 0})),CAt=zh(wAt.prototype,"_enableMotor",[uu],(function(){return!1})),DAt=zh(wAt.prototype,"_maxMotorTorque",[uu],(function(){return 1e3})),BAt=zh(wAt.prototype,"_motorSpeed",[uu],(function(){return 0})),SAt=wAt))||SAt)),t("f5",{PolygonSeparator:ewt,PolygonPartition:fwt}),A.internal.physics2d={selector:mSt};var VAt=[],NAt=[new ds,new ds],zAt=new ESt.WorldManifold,UAt={points:[],separations:[],normal:new ds},GAt=function(){this.localPoint=new ds,this.normalImpulse=0,this.tangentImpulse=0},HAt=[new GAt,new GAt],WAt={type:0,localPoint:new ds,localNormal:new ds,points:[]},jAt={normalImpulses:[],tangentImpulses:[]},qAt=function(){function t(){this.colliderA=null,this.colliderB=null,this.disabled=!1,this.disabledOnce=!1,this._impulse=null,this._inverted=!1,this._b2contact=null}t.get=function(e){var i=VAt.pop();return i||(i=new t),i.init(e),i},t.put=function(t){var e=t.m_userData;e&&(VAt.push(e),e.reset())};var e=t.prototype;return e._setImpulse=function(t){this._impulse=t},e.init=function(t){this.colliderA=t.m_fixtureA.m_userData.collider,this.colliderB=t.m_fixtureB.m_userData.collider,this.disabled=!1,this.disabledOnce=!1,this._impulse=null,this._inverted=!1,this._b2contact=t,t.m_userData=this},e.reset=function(){this.setTangentSpeed(0),this.resetFriction(),this.resetRestitution(),this.colliderA=null,this.colliderB=null,this.disabled=!1,this._impulse=null,this._b2contact.m_userData=null,this._b2contact=null},e.getWorldManifold=function(){var t=UAt.points,e=UAt.separations,i=UAt.normal;this._b2contact.GetWorldManifold(zAt);var n=zAt.points,r=zAt.separations,s=this._b2contact.GetManifold().pointCount;t.length=e.length=s;for(var a=0;a<s;a++){var o=NAt[a];o.x=n[a].x*FSt,o.y=n[a].y*FSt,t[a]=o,e[a]=r[a]*FSt}return i.x=zAt.normal.x,i.y=zAt.normal.y,this._inverted&&(i.x*=-1,i.y*=-1),UAt},e.getManifold=function(){for(var t=WAt.points,e=WAt.localNormal,i=WAt.localPoint,n=this._b2contact.GetManifold(),r=n.points,s=t.length=n.pointCount,a=0;a<s;a++){var o=HAt[a],h=r[a];o.localPoint.x=h.localPoint.x*FSt,o.localPoint.y=h.localPoint.y*FSt,o.normalImpulse=h.normalImpulse*FSt,o.tangentImpulse=h.tangentImpulse,t[a]=o}return i.x=n.localPoint.x*FSt,i.y=n.localPoint.y*FSt,e.x=n.localNormal.x,e.y=n.localNormal.y,WAt.type=n.type,this._inverted&&(e.x*=-1,e.y*=-1),WAt},e.getImpulse=function(){var t=this._impulse;if(!t)return null;for(var e=jAt.normalImpulses,i=jAt.tangentImpulses,n=t.count,r=0;r<n;r++)e[r]=t.normalImpulses[r]*FSt,i[r]=t.tangentImpulses[r];return i.length=e.length=n,jAt},e.emit=function(t){var e,i,n=this.colliderA,r=this.colliderB,s=null==n||null==(e=n.body)?void 0:e.enabledContactListener,a=null==r||null==(i=r.body)?void 0:i.enabledContactListener;s&&n.emit(t,n,r,this),a&&r.emit(t,r,n,this),(s||a)&&pwt.instance.emit(t,n,r,this),(this.disabled||this.disabledOnce)&&(this.setEnabled(!1),this.disabledOnce=!1)},e.setEnabled=function(t){this._b2contact.SetEnabled(t)},e.isTouching=function(){return this._b2contact.IsTouching()},e.setTangentSpeed=function(t){this._b2contact.SetTangentSpeed(t)},e.getTangentSpeed=function(){return this._b2contact.GetTangentSpeed()},e.setFriction=function(t){this._b2contact.SetFriction(t)},e.getFriction=function(){return this._b2contact.GetFriction()},e.resetFriction=function(){return this._b2contact.ResetFriction()},e.setRestitution=function(t){this._b2contact.SetRestitution(t)},e.getRestitution=function(){return this._b2contact.GetRestitution()},e.resetRestitution=function(){return this._b2contact.ResetRestitution()},t}(),XAt=new ESt.Vec2,YAt=new cr,JAt=cr.GREEN,KAt=cr.RED,QAt=function(t){function e(e){var i;return(i=t.call(this)||this)._drawer=null,i._xf=new ESt.Transform,i._dxf=new ESt.Transform,i._drawer=e,i}s(e,t);var i=e.prototype;return i._DrawPolygon=function(t,e){for(var i=this._drawer,n=0;n<e;n++){ESt.Transform.MulXV(this._xf,t[n],XAt);var r=XAt.x*FSt,s=XAt.y*FSt;0===n?i.moveTo(r,s):i.lineTo(r,s)}i.close()},i.DrawPolygon=function(t,e,i){this._applyStrokeColor(i),this._DrawPolygon(t,e),this._drawer.stroke()},i.DrawSolidPolygon=function(t,e,i){this._applyFillColor(i),this._DrawPolygon(t,e),this._drawer.fill(),this._drawer.stroke()},i._DrawCircle=function(t,e){ESt.Transform.MulXV(this._xf,t,XAt),this._drawer.circle(XAt.x*FSt,XAt.y*FSt,e*FSt)},i.DrawCircle=function(t,e,i){this._applyStrokeColor(i),this._DrawCircle(t,e),this._drawer.stroke()},i.DrawSolidCircle=function(t,e,i,n){this._applyFillColor(n),this._DrawCircle(t,e),this._drawer.fill()},i.DrawSegment=function(t,e,i){var n=this._drawer;if(t.x===e.x&&t.y===e.y)return this._applyFillColor(i),this._DrawCircle(t,2/FSt),void n.fill();this._applyStrokeColor(i),ESt.Transform.MulXV(this._xf,t,XAt),n.moveTo(XAt.x*FSt,XAt.y*FSt),ESt.Transform.MulXV(this._xf,e,XAt),n.lineTo(XAt.x*FSt,XAt.y*FSt),n.stroke()},i.DrawTransform=function(t){var e=this._drawer;e.strokeColor=KAt,XAt.x=XAt.y=0,ESt.Transform.MulXV(t,XAt,XAt),e.moveTo(XAt.x*FSt,XAt.y*FSt),XAt.x=1,XAt.y=0,ESt.Transform.MulXV(t,XAt,XAt),e.lineTo(XAt.x*FSt,XAt.y*FSt),e.stroke(),e.strokeColor=JAt,XAt.x=XAt.y=0,ESt.Transform.MulXV(t,XAt,XAt),e.moveTo(XAt.x*FSt,XAt.y*FSt),XAt.x=0,XAt.y=1,ESt.Transform.MulXV(t,XAt,XAt),e.lineTo(XAt.x*FSt,XAt.y*FSt),e.stroke()},i.DrawPoint=function(){},i.DrawParticles=function(){},i._applyStrokeColor=function(t){this._drawer.strokeColor=YAt.set(255*t.r,255*t.g,255*t.b,150)},i._applyFillColor=function(t){this._drawer.fillColor=YAt.set(255*t.r,255*t.g,255*t.b,150)},i.PushTransform=function(t){this._xf=t},i.PopTransform=function(){this._xf=this._dxf},e}(ESt.Draw),ZAt=new ir,$At=new ds,tCt=new ds,eCt=new ESt.BodyDef,iCt=new ESt.AABB,nCt=[],rCt=function(){function t(){this._world=void 0,this._bodies=[],this._animatedBodies=[],this._rotationAxis=new ir,this._physicsGroundBody=void 0,this._contactListener=void 0,this._aabbQueryCallback=void 0,this._raycastQueryCallback=void 0,this._debugGraphics=null,this._b2DebugDrawer=null,this._debugDrawFlags=0,this._world=new ESt.World(new ESt.Vec2(0,-10));var t=new ESt.BodyDef;this._physicsGroundBody=this._world.CreateBody(t);var e=new LSt;e.setBeginContact(this._onBeginContact),e.setEndContact(this._onEndContact),e.setPreSolve(this._onPreSolve),e.setPostSolve(this._onPostSolve),this._world.SetContactListener(e),this._contactListener=e,this._aabbQueryCallback=new VSt,this._raycastQueryCallback=new NSt}var e=t.prototype;return e._checkDebugDrawValid=function(){if(!this._debugGraphics||!this._debugGraphics.isValid){var t=GP("Canvas");if(!t){var e=YE.getScene();if(!e)return;(t=new eb("Canvas")).addComponent("cc.Canvas"),t.parent=e}var i=new eb("PHYSICS_2D_DEBUG_DRAW");i.hideFlags|=8,i.parent=t,i.worldPosition=ir.ZERO,i.layer=Ly.Enum.UI_2D;try{this._debugGraphics=i.addComponent("cc.Graphics"),this._debugGraphics.lineWidth=3;var n=new QAt(this._debugGraphics);this._b2DebugDrawer=n,this._world.SetDebugDraw(n)}catch(t){ht(4501,t.message),i.destroy(),i=null}}if(this._debugGraphics){var r=this._debugGraphics.node.parent;this._debugGraphics.node.setSiblingIndex(r.children.length-1)}this._b2DebugDrawer&&this._b2DebugDrawer.SetFlags(this.debugDrawFlags)},e.setGravity=function(t){this._world.SetGravity(t)},e.setAllowSleep=function(){this._world.SetAllowSleeping(!0)},e.step=function(t,e,i){void 0===e&&(e=10),void 0===i&&(i=10);for(var n=this._animatedBodies,r=0,s=n.length;r<s;r++)n[r].animate(t);this._world.Step(t,e,i)},e.raycast=function(t,e,i,n){if(t.equals(e))return[];i=i||0,$At.x=t.x/FSt,$At.y=t.y/FSt,tCt.x=e.x/FSt,tCt.y=e.y/FSt;var r=this._raycastQueryCallback;r.init(i,n),this._world.RayCast(r,$At,tCt);var s=r.getFixtures();if(s.length>0){for(var a=r.getPoints(),o=r.getNormals(),h=r.getFractions(),u=[],l=0,c=s.length;l<c;l++){var f=s[l],_=f.m_userData,d=_.collider;if(2===i){for(var p=void 0,m=0;m<u.length;m++)u[m].collider===d&&(p=u[m]);if(p){h[l]<p.fraction&&(p.fixtureIndex=_.getFixtureIndex(f),p.point.x=a[l].x*FSt,p.point.y=a[l].y*FSt,p.normal.x=o[l].x,p.normal.y=o[l].y,p.fraction=h[l]);continue}}u.push({collider:d,fixtureIndex:_.getFixtureIndex(f),point:new ds(a[l].x*FSt,a[l].y*FSt),normal:new ds(o[l].x,o[l].y),fraction:h[l]})}return u}return[]},e.syncPhysicsToScene=function(){for(var t=this._bodies,e=0,i=t.length;e<i;e++){var n=t[e],r=n.rigidBody;if(3!==r.type){var s=r.node,a=n.impl,o=a.GetPosition();ZAt.x=o.x*FSt,ZAt.y=o.y*FSt,ZAt.z=0,s.worldPosition=ZAt;var h=rn(a.GetAngle());s.setWorldRotationFromEuler(0,0,h)}else n.resetVelocity()}},e.syncSceneToPhysics=function(){for(var t=this._bodies,e=0;e<t.length;e++)t[e].syncSceneToPhysics()},e.addBody=function(t){if(!this._bodies.includes(t)){var e=eCt,i=t.rigidBody;e.allowSleep=i.allowSleep,e.gravityScale=i.gravityScale,e.linearDamping=i.linearDamping,e.angularDamping=i.angularDamping,e.fixedRotation=i.fixedRotation,e.bullet=i.bullet;var n=i.node,r=n.worldPosition;e.position.Set(r.x/FSt,r.y/FSt),ZAt.z=kr.getAxisAngle(this._rotationAxis,n.worldRotation),this._rotationAxis.z<0&&(ZAt.z=2*Math.PI-ZAt.z),e.angle=ZAt.z,e.awake=i.awakeOnLoad,3===i.type?(e.type=1,this._animatedBodies.push(t),t._animatedPos.set(e.position.x,e.position.y),t._animatedAngle=e.angle):e.type=i.type;var s=i,a=s._linearVelocity;e.linearVelocity.Set(a.x,a.y),e.angularVelocity=s._angularVelocity;var o=this._world.CreateBody(e);o.m_userData=t,t._imp=o,this._bodies.push(t)}},e.removeBody=function(t){this._bodies.includes(t)&&(t.impl&&(t.impl.m_userData=null,this._world.DestroyBody(t.impl),t._imp=null),Se(this._bodies,t),3===t.rigidBody.type&&Se(this._animatedBodies,t))},e._updateBodyType=function(t){var e=this._animatedBodies;if(3!==t.rigidBody.type)Se(e,t);else{if(e.includes(t))return;e.push(t)}},e.registerContactFixture=function(t){this._contactListener.registerContactFixture(t)},e.unregisterContactFixture=function(t){this._contactListener.unregisterContactFixture(t)},e.testPoint=function(t){var e=$At.x=t.x/FSt,i=$At.y=t.y/FSt,n=.2/FSt;iCt.lowerBound.x=e-n,iCt.lowerBound.y=i-n,iCt.upperBound.x=e+n,iCt.upperBound.y=i+n;var r=this._aabbQueryCallback;r.init($At),this._world.QueryAABB(r,iCt);var s=r.getFixtures();nCt.length=0;for(var a=0;a<s.length;a++){var o=s[a].m_userData.collider;nCt.includes(o)||nCt.push(o)}return nCt},e.testAABB=function(t){iCt.lowerBound.x=t.xMin/FSt,iCt.lowerBound.y=t.yMin/FSt,iCt.upperBound.x=t.xMax/FSt,iCt.upperBound.y=t.yMax/FSt;var e=this._aabbQueryCallback;e.init(),this._world.QueryAABB(e,iCt);var i=e.getFixtures();nCt.length=0;for(var n=0;n<i.length;n++){var r=i[n].m_userData.collider;nCt.includes(r)||nCt.push(r)}return nCt},e.drawDebug=function(){this._checkDebugDrawValid(),this._debugGraphics&&(this._debugGraphics.clear(),this._world.DrawDebugData())},e._onBeginContact=function(t){qAt.get(t).emit(RSt.BEGIN_CONTACT)},e._onEndContact=function(t){var e=t.m_userData;e&&(e.emit(RSt.END_CONTACT),qAt.put(t))},e._onPreSolve=function(t){var e=t.m_userData;e&&e.emit(RSt.PRE_SOLVE)},e._onPostSolve=function(t,e){var i=t.m_userData;i&&(i._setImpulse(e),i.emit(RSt.POST_SOLVE),i._setImpulse(null))},n(t,[{key:"impl",get:function(){return this._world}},{key:"groundBodyImpl",get:function(){return this._physicsGroundBody}},{key:"debugDrawFlags",get:function(){return this._debugDrawFlags},set:function(t){t||this._debugGraphics&&(this._debugGraphics.node.parent=null),this._debugDrawFlags=t}}]),t}(),sCt=new ir,aCt=new ESt.Vec2,oCt=function(){function t(){this._animatedPos=new ds,this._animatedAngle=0,this._body=null,this._rigidBody=void 0,this._inited=!1}var e=t.prototype;return e.initialize=function(t){this._rigidBody=t,pwt.instance._callAfterStep(this,this._init)},e.onDestroy=function(){pwt.instance._callAfterStep(this,this._destroy)},e.onEnable=function(){this.setActive(!0)},e.onDisable=function(){this.setActive(!1)},e.nodeTransformChanged=function(t){if(!pwt.instance.stepping){if(4&t)for(var e=this.rigidBody.getComponents(EAt),i=0;i<e.length;i++)e[i].apply();1&t&&this.syncPositionToPhysics(!0),2&t&&this.syncRotationToPhysics(!0)}},e._init=function(){this._inited||(pwt.instance.physicsWorld.addBody(this),this.setActive(!1),this._inited=!0)},e._destroy=function(){this._inited&&(pwt.instance.physicsWorld.removeBody(this),this._inited=!1)},e.animate=function(t){var e=this._body;if(e){var i=e.GetPosition();e.SetAwake(!0);var n=1/t;aCt.x=(this._animatedPos.x-i.x)*n,aCt.y=(this._animatedPos.y-i.y)*n,e.SetLinearVelocity(aCt);var r=e.GetAngle()%Ji;r>Math.PI&&(r-=Ji);var s=(this._animatedAngle-r)*n;this._animatedAngle<-Yi&&r>Yi&&(s=(this._animatedAngle+Ji-r)*n),this._animatedAngle>Yi&&r<-Yi&&(s=(this._animatedAngle-Ji-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/FSt,i.y=n.y/FSt,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=sCt;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){pwt.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 aCt.Set(t.x/FSt,t.y/FSt),this._body.GetLinearVelocityFromWorldPoint(aCt,e),e.x*=FSt,e.y*=FSt,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,aCt.Set(t.x/FSt,t.y/FSt),this._body.GetLocalVector(aCt,e),e.x*=FSt,e.y*=FSt,e},e.getWorldVector=function(t,e){return aCt.Set(t.x/FSt,t.y/FSt),this._body.GetWorldVector(aCt,e),e.x*=FSt,e.y*=FSt,e},e.getLocalPoint=function(t,e){return e=e||new ds,aCt.Set(t.x/FSt,t.y/FSt),this._body.GetLocalPoint(aCt,e),e.x*=FSt,e.y*=FSt,e},e.getWorldPoint=function(t,e){return e=e||new ds,aCt.Set(t.x/FSt,t.y/FSt),this._body.GetWorldPoint(aCt,e),e.x*=FSt,e.y*=FSt,e},e.getLocalCenter=function(t){t=t||new ds;var e=this._body.GetLocalCenter();return t.x=e.x*FSt,t.y=e.y*FSt,t},e.getWorldCenter=function(t){t=t||new ds;var e=this._body.GetWorldCenter();return t.x=e.x*FSt,t.y=e.y*FSt,t},e.getInertia=function(){return this._body.GetInertia()},e.applyForce=function(t,e,i){this._body&&(aCt.Set(e.x/FSt,e.y/FSt),this._body.ApplyForce(t,aCt,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&&(aCt.Set(e.x/FSt,e.y/FSt),this._body.ApplyLinearImpulse(t,aCt,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}(),hCt=new ESt.Filter,uCt=new ESt.Vec2,lCt=new ESt.Vec2;function cCt(t){var e=t.collider;return e.body?hCt.categoryBits=1===e.group?e.body.group:e.group:hCt.categoryBits=e.group,hCt.maskBits=pwt.instance.collisionMatrix[hCt.categoryBits],hCt}var fCt,_Ct=function(){function t(){this._shapes=[],this._fixtures=[],this._collider=null,this._body=null,this._inited=!1,this._rect=new bs}var e=t.prototype;return e.initialize=function(t){this._collider=t},e.onLoad=function(){},e.onEnable=function(){pwt.instance._callAfterStep(this,this._init)},e.onDisable=function(){pwt.instance._callAfterStep(this,this._destroy)},e.start=function(){},e.onGroupChanged=function(){var t=cCt(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(MAt);n&&n.impl&&n.impl.impl?this._body=n.impl.impl:(this._body=pwt.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=cCt(this),a=0;a<r.length;a++){var o=r[a],h={density:t.density,isSensor:t.sensor,friction:t.friction,restitution:t.restitution,shape:o,filter:s},u=this._body.CreateFixture(h);u.m_userData=this,null!=n&&n.enabledContactListener&&pwt.instance.physicsWorld.registerContactFixture(u),this._shapes.push(o),this._fixtures.push(u)}this._inited=!0}},e._destroy=function(){if(this._inited){for(var t=this._fixtures,e=this._body,i=t.length-1;i>=0;i--){var n=t[i];n.m_userData=null,pwt.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;a<s.length;a++)for(var o=s[a],h=o.GetShape().GetChildCount(),u=0;u<h;u++){if(uCt.Copy(o.GetAABB(u).lowerBound),lCt.Copy(o.GetAABB(u).upperBound),2===o.GetShape().m_type){var l=o.GetShape().m_radius;uCt.SelfAddXY(l,l),lCt.SelfSubXY(l,l)}uCt.x<e&&(e=uCt.x),uCt.y<i&&(i=uCt.y),lCt.x>n&&(n=lCt.x),lCt.y>r&&(r=lCt.y)}e*=FSt,i*=FSt,n*=FSt,r*=FSt;var c=this._rect;return c.x=e,c.y=i,c.width=n-e,c.height=r-i,c}}]),t}(),dCt=new bs,pCt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._worldPoints=[new ds,new ds,new ds,new ds],e}return s(e,t),e.prototype._createShapes=function(t,e,i,n){t=Math.abs(t),e=Math.abs(e);var r=this.collider,s=r.size.width/2/FSt*t,a=r.size.height/2/FSt*e,o=(i+r.offset.x*t)/FSt,h=(n+r.offset.y*e)/FSt,u=new ESt.PolygonShape;return u.SetAsBox(s,a,new ESt.Vec2(o,h),0),[u]},n(e,[{key:"worldPoints",get:function(){var t=dCt,e=this.collider,i=e.size,n=e.offset;t.x=n.x-i.width/2,t.y=n.y-i.height/2,t.width=i.width,t.height=i.height;var r=this._worldPoints,s=r[0],a=r[1],o=r[2],h=r[3];return t.transformMat4ToPoints(e.node.worldMatrix,s,a,o,h),r}}]),e}(_Ct),mCt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._worldPosition=new ds,e}return s(e,t),e.prototype._createShapes=function(t,e,i,n){t=Math.abs(t),e=Math.abs(e);var r=this.collider,s=(i+r.offset.x*t)/FSt,a=(n+r.offset.y*e)/FSt,o=new ESt.CircleShape;return o.m_radius=r.radius/FSt*t,o.m_p.Set(s,a),[o]},n(e,[{key:"worldRadius",get:function(){return this._shapes[0].m_radius*FSt}},{key:"worldPosition",get:function(){var t=this._shapes[0].m_p;return this._worldPosition.set(t.x*FSt,t.y*FSt)}}]),e}(_Ct),gCt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._worldPoints=[],e}return s(e,t),e.prototype._createShapes=function(t,e,i,n){var r=[],s=this.collider,a=s.points;a.length>0&&a[0].equals(a[a.length-1])&&(a.length-=1);var o=iwt(a);if(!o)return it(16408,s.node.name),r;for(var h=s.offset,u=0;u<o.length;u++){for(var l=o[u],c=null,f=[],_=null,d=0,p=l.length;d<p;d++){c||(c=new ESt.PolygonShape);var m=l[d],g=(i+(m.x+h.x)*t)/FSt,y=(n+(m.y+h.y)*e)/FSt,v=new ESt.Vec2(g,y);f.push(v),_||(_=v),f.length===ESt.maxPolygonVertices&&(c.Set(f,f.length),r.push(c),c=null,d<p-1&&(f=[_,f[f.length-1]]))}c&&(c.Set(f,f.length),r.push(c))}return r},n(e,[{key:"worldPoints",get:function(){for(var t=this.collider,e=t.points,i=this._worldPoints,n=t.node.worldMatrix,r=0;r<e.length;r++)i[r]||(i[r]=new ds),ds.transformMat4(i[r],e[r],n);return i.length=e.length,this._worldPoints}}]),e}(_Ct),yCt=function(){function t(){this._b2joint=null,this._jointComp=null,this._body=null,this._inited=!1}var e=t.prototype;return e.initialize=function(t){this._jointComp=t},e.onEnable=function(){pwt.instance._callAfterStep(this,this._init)},e.onDisable=function(){pwt.instance._callAfterStep(this,this._destroy)},e.start=function(){pwt.instance._callAfterStep(this,this._init)},e.apply=function(){pwt.instance._callAfterStep(this,this._destroy),this.comp.enabledInHierarchy&&pwt.instance._callAfterStep(this,this._init)},e._init=function(){if(!this._inited){var t=this._jointComp;if(t.isValid){this._body=t.getComponent(MAt);var e=this._createJointDef();if(e){e.bodyA=this._body.impl.impl;var i=t.connectedBody;i&&!i.enabledInHierarchy||(e.bodyB=i?i.impl.impl:pwt.instance.physicsWorld.groundBodyImpl,e.collideConnected=t.collideConnected,this._b2joint=pwt.instance.physicsWorld.impl.CreateJoint(e),this._inited=!0)}}}},e._destroy=function(){this._inited&&(pwt.instance.physicsWorld.impl.DestroyJoint(this._b2joint),this._b2joint=null,this._inited=!1)},e._createJointDef=function(){return null},e.isValid=function(){return this._b2joint&&this._body&&this._body.impl&&this._jointComp},n(t,[{key:"impl",get:function(){return this._b2joint}},{key:"comp",get:function(){return this._jointComp}},{key:"body",get:function(){return this._body}}]),t}(),vCt=new ESt.Vec2,bCt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._touchPoint=new ds,e._isTouched=!1,e}s(e,t);var i=e.prototype;return i.setTarget=function(t){this._b2joint&&(vCt.x=t.x/FSt,vCt.y=t.y/FSt,this._b2joint.SetTarget(vCt))},i.setDampingRatio=function(t){this._b2joint&&this._b2joint.SetDampingRatio(t)},i.setFrequency=function(t){this._b2joint&&this._b2joint.SetFrequency(t)},i.setMaxForce=function(t){this._b2joint&&this._b2joint.SetMaxForce(t)},i._createJointDef=function(){var t=new ESt.MouseJointDef,e=this._jointComp;return t.target.Set(this._touchPoint.x/FSt,this._touchPoint.y/FSt),t.maxForce=e.maxForce,t.dampingRatio=e.dampingRatio,t.frequencyHz=e.frequency,t},i.start=function(){},i.onEnable=function(){this._enableTouch(!0)},i.onDisable=function(){t.prototype.onDisable.call(this),this._enableTouch(!1)},i._enableTouch=function(t){var e=GP("Canvas");if(e){var i=t?e.on:e.off;i.call(e,"touch-start",this.onTouchBegan,this),i.call(e,"touch-move",this.onTouchMove,this),i.call(e,"touch-end",this.onTouchEnd,this),i.call(e,"touch-cancel",this.onTouchEnd,this)}},i.onTouchBegan=function(t){this._isTouched=!0;var e=this._touchPoint.set(t.getUILocation()),i=pwt.instance.physicsWorld.testPoint(e);if(!(i.length<=0)){var n=i[0].body;n.wakeUp();var r=this._jointComp;r.connectedBody=n,this._init(),this.setMaxForce(r.maxForce*n.getMass()),this.setTarget(e)}},i.onTouchMove=function(t){this._touchPoint=t.getUILocation()},i.onTouchEnd=function(){this._destroy(),this._isTouched=!1},i.update=function(){this._isTouched&&this.isValid()&&this.setTarget(this._touchPoint)},e}(yCt),SCt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setMaxLength=function(t){this._b2joint&&this._b2joint.SetMaxLength(t)},i._createJointDef=function(){var t=this._jointComp,e=new ESt.RopeJointDef;return e.localAnchorA.Set(t.anchor.x/FSt,t.anchor.y/FSt),e.localAnchorB.Set(t.connectedAnchor.x/FSt,t.connectedAnchor.y/FSt),e.maxLength=t.maxLength/FSt,e},e}(yCt),wCt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setDampingRatio=function(t){this._b2joint&&this._b2joint.SetDampingRatio(t)},i.setFrequency=function(t){this._b2joint&&this._b2joint.SetFrequency(t)},i.setDistance=function(t){this._b2joint&&this._b2joint.SetLength(t)},i._createJointDef=function(){var t=this._jointComp,e=new ESt.DistanceJointDef;return e.localAnchorA.Set(t.anchor.x/FSt,t.anchor.y/FSt),e.localAnchorB.Set(t.connectedAnchor.x/FSt,t.connectedAnchor.y/FSt),e.length=t.distance/FSt,e.dampingRatio=t.dampingRatio,e.frequencyHz=t.frequency,e},e}(yCt),xCt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setMaxForce=function(t){this._b2joint&&this._b2joint.SetMaxForce(t)},i.setAngularOffset=function(t){this._b2joint&&this._b2joint.SetAngularOffset(nn(t))},i.setLinearOffset=function(t){this._b2joint&&this._b2joint.SetLinearOffset(new ESt.Vec2(t.x/FSt,t.y/FSt))},i.setCorrectionFactor=function(t){this._b2joint&&(this._b2joint.m_correctionFactor=t)},i.setMaxTorque=function(t){this._b2joint&&this._b2joint.SetMaxTorque(t)},i._createJointDef=function(){var t=this._jointComp,e=new ESt.MotorJointDef;return e.linearOffset.Set(t.linearOffset.x/FSt,t.linearOffset.y/FSt),e.angularOffset=nn(t.angularOffset),e.maxForce=t.maxForce,e.maxTorque=t.maxTorque,e.correctionFactor=t.correctionFactor,e},e}(yCt),TCt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.enableLimit=function(t){this._b2joint&&this._b2joint.EnableLimit(t)},i.setLowerLimit=function(){this.updateLimits()},i.setUpperLimit=function(){this.updateLimits()},i.updateLimits=function(){if(this._b2joint){var t=this._jointComp;this._b2joint.SetLimits(t.lowerLimit/FSt,t.upperLimit/FSt)}},i.enableMotor=function(t){this._b2joint&&this._b2joint.EnableMotor(t)},i.setMaxMotorForce=function(t){this._b2joint&&this._b2joint.SetMaxMotorForce(t)},i.setMotorSpeed=function(t){this._b2joint&&this._b2joint.SetMotorSpeed(t)},i._createJointDef=function(){var t=this._jointComp,e=new ESt.PrismaticJointDef;e.localAnchorA.Set(t.anchor.x/FSt,t.anchor.y/FSt),e.localAnchorB.Set(t.connectedAnchor.x/FSt,t.connectedAnchor.y/FSt);var i=nn(t.angle);return e.localAxisA.Set(Math.cos(i),Math.sin(i)),e.referenceAngle=0,e.enableLimit=t.enableLimit,e.lowerTranslation=t.lowerLimit/FSt,e.upperTranslation=t.upperLimit/FSt,e.enableMotor=t.enableMotor,e.maxMotorForce=t.maxMotorForce,e.motorSpeed=t.motorSpeed,e},e}(yCt),ACt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setFrequency=function(t){this._b2joint&&this._b2joint.SetFrequency(t)},i.setDampingRatio=function(t){this._b2joint&&this._b2joint.SetDampingRatio(t)},i._createJointDef=function(){var t=this._jointComp,e=new ESt.WeldJointDef;return e.localAnchorA.Set(t.anchor.x/FSt,t.anchor.y/FSt),e.localAnchorB.Set(t.connectedAnchor.x/FSt,t.connectedAnchor.y/FSt),e.referenceAngle=0,e.frequencyHz=t.frequency,e.dampingRatio=t.dampingRatio,e},e}(yCt),CCt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setDampingRatio=function(t){this._b2joint&&this._b2joint.SetSpringDampingRatio(t)},i.setFrequency=function(t){this._b2joint&&this._b2joint.SetSpringFrequencyHz(t)},i.enableMotor=function(t){this._b2joint&&this._b2joint.EnableMotor(t)},i.setMaxMotorTorque=function(t){this._b2joint&&this._b2joint.SetMaxMotorTorque(t)},i.setMotorSpeed=function(t){this._b2joint&&this._b2joint.SetMotorSpeed(t)},i._createJointDef=function(){var t=this._jointComp,e=new ESt.WheelJointDef;e.localAnchorA.Set(t.anchor.x/FSt,t.anchor.y/FSt),e.localAnchorB.Set(t.connectedAnchor.x/FSt,t.connectedAnchor.y/FSt);var i=nn(t.angle);return e.localAxisA.Set(Math.cos(i),Math.sin(i)),e.maxMotorTorque=t.maxMotorTorque,e.motorSpeed=nn(t.motorSpeed),e.enableMotor=t.enableMotor,e.dampingRatio=t.dampingRatio,e.frequencyHz=t.frequency,e},e}(yCt),DCt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.enableLimit=function(t){this._b2joint&&this._b2joint.EnableLimit(t)},i.setLowerAngle=function(){this.updateLimits()},i.setUpperAngle=function(){this.updateLimits()},i.updateLimits=function(){if(this._b2joint){var t=this._jointComp;this._b2joint.SetLimits(nn(t.lowerAngle),nn(t.upperAngle))}},i.enableMotor=function(t){this._b2joint&&this._b2joint.EnableMotor(t)},i.setMaxMotorTorque=function(t){this._b2joint&&this._b2joint.SetMaxMotorTorque(t)},i.setMotorSpeed=function(t){this._b2joint&&this._b2joint.SetMotorSpeed(t)},i._createJointDef=function(){var t=this._jointComp,e=new ESt.RevoluteJointDef;return e.localAnchorA.Set(t.anchor.x/FSt,t.anchor.y/FSt),e.localAnchorB.Set(t.connectedAnchor.x/FSt,t.connectedAnchor.y/FSt),e.enableMotor=t.enableMotor,e.maxMotorTorque=t.maxMotorTorque,e.motorSpeed=nn(t.motorSpeed),e.enableLimit=t.enableLimit,e.lowerAngle=nn(t.lowerAngle),e.upperAngle=nn(t.upperAngle),e},e}(yCt);function BCt(t){A._global.CC_PHYSICS_BUILTIN="builtin"===t,A._global.CC_PHYSICS_CANNON="cannon.js"===t,A._global.CC_PHYSICS_AMMO="bullet"===t}XO.once(qO.EVENT_PRE_SUBSYSTEM_INIT,(function(){mSt.register("box2d",{PhysicsWorld:rCt,RigidBody:oCt,BoxShape:pCt,CircleShape:mCt,PolygonShape:gCt,MouseJoint:bCt,DistanceJoint:SCt,SpringJoint:wCt,RelativeJoint:xCt,SliderJoint:TCt,FixedJoint:ACt,WheelJoint:CCt,HingeJoint:DCt})}));var ICt={id:"",switchTo:function(t){if(ICt.runInEditor){var e=ICt;if(ICt.physicsWorld&&t!==ICt.id&&null!=ICt.backend[t]?(ICt.physicsWorld.destroy(),X("[PHYSICS]: switch from "+ICt.id+" to "+t+"."),BCt(t),e.id=t,e.wrapper=ICt.backend[t],e.physicsWorld=RCt()):(X("[PHYSICS]: using "+t+"."),e.physicsWorld=RCt()),fCt){var i=e.physicsWorld;i.setGravity(fCt.gravity),i.setAllowSleep(fCt.allowSleep)}}},register:function(t,e){if(X("[PHYSICS]: register "+t+"."),ICt.backend[t]=e,!ICt.physicsWorld||ICt.id===t){BCt(t);var i=ICt;i.id=t,i.wrapper=e}},wrapper:{},backend:{},physicsWorld:null,runInEditor:!0};function MCt(t){if(fCt||(fCt=t),ICt.runInEditor&&!ICt.physicsWorld){X("[PHYSICS]: using "+ICt.id+".");var e=ICt.physicsWorld=RCt();e.setGravity(fCt.gravity),e.setAllowSleep(fCt.allowSleep)}}var PCt=function(){return 0},ECt={impl:null,debugDrawFlags:0,debugDrawConstraintSize:0,setGravity:PCt,setAllowSleep:PCt,setDefaultMaterial:PCt,step:PCt,syncAfterEvents:PCt,syncSceneToPhysics:PCt,raycast:PCt,raycastClosest:PCt,sweepBox:PCt,sweepBoxClosest:PCt,sweepSphere:PCt,sweepSphereClosest:PCt,sweepCapsule:PCt,sweepCapsuleClosest:PCt,emitEvents:PCt,destroy:PCt},OCt={World:0,RigidBody:1,BoxCollider:2,SphereCollider:3,CapsuleCollider:4,MeshCollider:5,CylinderCollider:6,ConeCollider:7,TerrainCollider:8,SimplexCollider:9,PlaneCollider:10,PointToPointConstraint:11,HingeConstraint:12,FixedConstraint:13,ConfigurableConstraint:14,BoxCharacterController:15,CapsuleCharacterController:16};function kCt(t,e){return null==t&&(ICt.id?Y(ICt.id+" physics does not support "+OCt[e]):ht(9600),!0)}function RCt(){return kCt(ICt.wrapper.PhysicsWorld,0)?ECt:new ICt.wrapper.PhysicsWorld}var FCt={impl:null,rigidBody:null,isAwake:!1,isSleepy:!1,isSleeping:!1,initialize:PCt,onEnable:PCt,onDisable:PCt,onDestroy:PCt,setType:PCt,setMass:PCt,setLinearDamping:PCt,setAngularDamping:PCt,useGravity:PCt,setLinearFactor:PCt,setAngularFactor:PCt,setAllowSleep:PCt,wakeUp:PCt,sleep:PCt,clearState:PCt,clearForces:PCt,clearVelocity:PCt,setSleepThreshold:PCt,getSleepThreshold:PCt,getLinearVelocity:PCt,setLinearVelocity:PCt,getAngularVelocity:PCt,setAngularVelocity:PCt,applyForce:PCt,applyLocalForce:PCt,applyImpulse:PCt,applyLocalImpulse:PCt,applyTorque:PCt,applyLocalTorque:PCt,setGroup:PCt,getGroup:PCt,addGroup:PCt,removeGroup:PCt,setMask:PCt,getMask:PCt,addMask:PCt,removeMask:PCt,isUsingCCD:PCt,useCCD:PCt},LCt={INITED:!1},VCt={impl:null,collider:null,attachedRigidBody:null,initialize:PCt,onLoad:PCt,onEnable:PCt,onDisable:PCt,onDestroy:PCt,setGroup:PCt,getGroup:PCt,addGroup:PCt,removeGroup:PCt,setMask:PCt,getMask:PCt,addMask:PCt,removeMask:PCt,setMaterial:PCt,setAsTrigger:PCt,setCenter:PCt,getAABB:PCt,getBoundingSphere:PCt,updateSize:PCt,updateRadius:PCt,setRadius:PCt,setCylinderHeight:PCt,setDirection:PCt,setHeight:PCt,setShapeType:PCt,setVertices:PCt,setMesh:PCt,setTerrain:PCt,setNormal:PCt,setConstant:PCt,updateEventListener:PCt};function NCt(t){return LCt.INITED||(LCt.INITED=!0,LCt[0]=function(){return kCt(ICt.wrapper.BoxShape,2)?VCt:new ICt.wrapper.BoxShape},LCt[1]=function(){return kCt(ICt.wrapper.SphereShape,3)?VCt:new ICt.wrapper.SphereShape},LCt[2]=function(){return kCt(ICt.wrapper.CapsuleShape,4)?VCt:new ICt.wrapper.CapsuleShape},LCt[3]=function(){return kCt(ICt.wrapper.CylinderShape,6)?VCt:new ICt.wrapper.CylinderShape},LCt[4]=function(){return kCt(ICt.wrapper.ConeShape,7)?VCt:new ICt.wrapper.ConeShape},LCt[5]=function(){return kCt(ICt.wrapper.TrimeshShape,5)?VCt:new ICt.wrapper.TrimeshShape},LCt[8]=function(){return kCt(ICt.wrapper.TerrainShape,8)?VCt:new ICt.wrapper.TerrainShape},LCt[7]=function(){return kCt(ICt.wrapper.SimplexShape,9)?VCt:new ICt.wrapper.SimplexShape},LCt[6]=function(){return kCt(ICt.wrapper.PlaneShape,10)?VCt:new ICt.wrapper.PlaneShape}),LCt[t]()}var zCt={INITED:!1},UCt={impl:null,initialize:PCt,onLoad:PCt,onEnable:PCt,onDisable:PCt,onDestroy:PCt,setEnableCollision:PCt,setConnectedBody:PCt,setPivotA:PCt,setPivotB:PCt,setAxis:PCt,setSecondaryAxis:PCt,setBreakForce:PCt,setBreakTorque:PCt,setConstraintMode:PCt,setLinearLimit:PCt,setAngularExtent:PCt,setLinearSoftConstraint:PCt,setLinearStiffness:PCt,setLinearDamping:PCt,setLinearRestitution:PCt,setSwingSoftConstraint:PCt,setTwistSoftConstraint:PCt,setSwingStiffness:PCt,setSwingDamping:PCt,setSwingRestitution:PCt,setTwistStiffness:PCt,setTwistDamping:PCt,setTwistRestitution:PCt,setDriverMode:PCt,setLinearMotorTarget:PCt,setLinearMotorVelocity:PCt,setLinearMotorForceLimit:PCt,setAngularMotorTarget:PCt,setAngularMotorVelocity:PCt,setAngularMotorForceLimit:PCt,setAutoPivotB:PCt,setLimitEnabled:PCt,setLowerLimit:PCt,setUpperLimit:PCt,setMotorEnabled:PCt,setMotorVelocity:PCt,setMotorForceLimit:PCt};function GCt(t){return zCt.INITED||(zCt.INITED=!0,zCt[0]=function(){return kCt(ICt.wrapper.PointToPointConstraint,11)?UCt:new ICt.wrapper.PointToPointConstraint},zCt[1]=function(){return kCt(ICt.wrapper.HingeConstraint,12)?UCt:new ICt.wrapper.HingeConstraint},zCt[2]=function(){return kCt(ICt.wrapper.FixedConstraint,13)?UCt:new ICt.wrapper.FixedConstraint},zCt[3]=function(){return kCt(ICt.wrapper.ConfigurableConstraint,14)?UCt:new ICt.wrapper.ConfigurableConstraint}),zCt[t]()}var HCt={INITED:!1},WCt={initialize:PCt,onLoad:PCt,onEnable:PCt,onDisable:PCt,onDestroy:PCt,onGround:PCt,getPosition:PCt,setPosition:PCt,setStepOffset:PCt,setSlopeLimit:PCt,setContactOffset:PCt,setDetectCollisions:PCt,setOverlapRecovery:PCt,setGroup:PCt,getGroup:PCt,addGroup:PCt,removeGroup:PCt,setMask:PCt,getMask:PCt,addMask:PCt,removeMask:PCt,move:PCt,syncPhysicsToScene:PCt,updateEventListener:PCt,setHalfHeight:PCt,setHalfSideExtent:PCt,setHalfForwardExtent:PCt,setRadius:PCt,setHeight:PCt};function jCt(t){return HCt.INITED||(HCt.INITED=!0,HCt[0]=function(){return kCt(ICt.wrapper.BoxCharacterController,15)?WCt:new ICt.wrapper.BoxCharacterController},HCt[1]=function(){return kCt(ICt.wrapper.CapsuleCharacterController,16)?WCt:new ICt.wrapper.CapsuleCharacterController}),HCt[t]()}var qCt={},XCt={BODY_CACHE_NAME:"body",CCT_CACHE_NAME:"cct"};XO.onPostInfrastructureInitDelegate.add((function(){return uk().then((function(){return hh.hasFeature(hh.Feature.WASM)?Promise.all([e.import("./bullet.release.wasm-Dtn486IH.js").then((function(t){return t.b})),e.import("./bullet.release.wasm-vGDNSL-o.js")]).then((function(t){var e,i,n=t[0].default,r=t[1].default;return e=n,i=r,new Promise((function(t,n){var r=function(t){return"[bullet]: bullet wasm lib load failed: "+t};e({instantiateWasm:function(t,e){ok(i,t).then((function(t){e(t.instance,t.module)})).catch((function(t){return n(r(t))}))}}).then((function(t){X("[bullet]:bullet wasm lib loaded."),qCt=t,globalThis.Bullet=qCt})).then(t).catch((function(t){return n(r(t))}))}))})):e.import("./bullet.release.asm-qL04xUM0.js").then((function(t){return t.b})).then((function(t){var e;return null!=(e=t.default)?e().then((function(t){X("[bullet]:bullet asm lib loaded."),qCt=t})):new Promise((function(t){t()}))}))})).catch((function(t){J(t)}))}));var YCt={type:"onTriggerEnter",selfCollider:null,otherCollider:null,impl:null},JCt={type:"onCollisionEnter",selfCollider:null,otherCollider:null,contacts:[],impl:null},KCt={type:"onControllerTriggerEnter",collider:null,characterController:null,impl:null},QCt=function(){function t(){this.BT_TRANSFORM_0=qCt.Transform_new(),this.BT_TRANSFORM_1=qCt.Transform_new(),this.BT_V3_0=qCt.Vec3_new(0,0,0),this.BT_V3_1=qCt.Vec3_new(0,0,0),this.BT_V3_2=qCt.Vec3_new(0,0,0),this.BT_QUAT_0=qCt.Quat_new(0,0,0,1)}return t.setWrapper=function(t,e,i){this.ROOT[e]||(this.ROOT[e]={}),this.ROOT[e][t]=i},t.delWrapper=function(t,e){delete this.ROOT[e][t]},t.getWrapper=function(t,e){return this.ROOT[e][t]},t.isNotEmptyShape=function(t){return t!==qCt.EmptyShape_static()},n(t,null,[{key:"instance",get:function(){return null==t._instance&&(t._instance=new t),t._instance}}]),t}();QCt._instance=void 0,QCt.ROOT={},QCt.world=null;var ZCt=new ir,$Ct=new ir,tDt=new ir,eDt=new kr,iDt=new kr,nDt=new Kr;new Kr;var rDt,sDt,aDt,oDt,hDt,uDt,lDt,cDt,fDt,_Dt,dDt,pDt,mDt=new cr;function gDt(t,e){return qCt.Vec3_set(t,e.x,e.y,e.z),t}function yDt(t,e){var i=qCt.HEAPF32.subarray(e/4,e/4+3);return t.x=i[0],t.y=i[1],t.z=i[2],t}function vDt(t,e){return qCt.Quat_set(t,e.x,e.y,e.z,e.w),t}function bDt(t,e){var i=qCt.HEAPF32.subarray(e/4,e/4+4);return t.x=i[0],t.y=i[1],t.z=i[2],t.w=i[3],t}function SDt(t,e){for(var i=e.renderingSubMeshes.length,n=0;n<i;n++){var r=e.renderingSubMeshes[n],s=r.geometricInfo;if(s){var a=r.primitiveMode,o=s.positions,h=s.indices,u=QCt.instance.BT_V3_0,l=QCt.instance.BT_V3_1,c=QCt.instance.BT_V3_2;if(7===a)for(var f=h.length,_=0;_<f;_+=3){var d=3*h[_],p=3*h[_+1],m=3*h[_+2];qCt.Vec3_set(u,o[d],o[d+1],o[d+2]),qCt.Vec3_set(l,o[p],o[p+1],o[p+2]),qCt.Vec3_set(c,o[m],o[m+1],o[m+2]),qCt.TriangleMesh_addTriangle(t,u,l,c,!1)}else if(8===a)for(var g=h.length-2,y=0,v=0;v<g;v+=1){var b=3*h[v-y],S=3*h[v+y+1],w=3*h[v+2];y=~y,qCt.Vec3_set(u,o[b],o[b+1],o[b+2]),qCt.Vec3_set(l,o[S],o[S+1],o[S+2]),qCt.Vec3_set(c,o[w],o[w+1],o[w+2]),qCt.TriangleMesh_addTriangle(t,u,l,c,!1)}else if(9===a){var x=h.length-1,T=3*h[0];qCt.Vec3_set(u,o[T],o[T+1],o[T+2]);for(var A=1;A<x;A+=1){var C=3*h[A],D=3*h[A+1];qCt.Vec3_set(l,o[C],o[C+1],o[C+2]),qCt.Vec3_set(c,o[D],o[D+1],o[D+2]),qCt.TriangleMesh_addTriangle(t,u,l,c,!1)}}}}return t}function wDt(t,e){return t*e}XCt.CACHE=QCt;var xDt=t("fC",(rDt=Kh("cc.PhysicsMaterial"),sDt=Ou(ci),aDt=Ou(ci),oDt=Ou(ci),hDt=Ou(ci),rDt((pDt=function(t){function e(){var i;return(i=t.call(this)||this).id=void 0,i._friction=cDt&&cDt(),i._rollingFriction=fDt&&fDt(),i._spinningFriction=_Dt&&_Dt(),i._restitution=dDt&&dDt(),e.allMaterials.push(f(i)),i.id=e._idCounter++,i._uuid||(i._uuid="pm_"+i.id),i}s(e,t);var i=e.prototype;return i.clone=function(){var t=new e;return t._friction=this._friction,t._restitution=this._restitution,t._rollingFriction=this._rollingFriction,t._spinningFriction=this._spinningFriction,t},i.destroy=function(){if(t.prototype.destroy.call(this)){var i=e.allMaterials.indexOf(this);return i>=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){Qi(this._friction,t)||(this._friction=t,this.emit(e.EVENT_UPDATE))}},{key:"rollingFriction",get:function(){return this._rollingFriction},set:function(t){Qi(this._rollingFriction,t)||(this._rollingFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"spinningFriction",get:function(){return this._spinningFriction},set:function(t){Qi(this._spinningFriction,t)||(this._spinningFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"restitution",get:function(){return this._restitution},set:function(t){Qi(this._restitution,t)||(this._restitution=t,this.emit(e.EVENT_UPDATE))}}]),e}(Cm),pDt.allMaterials=[],pDt.EVENT_UPDATE="event_update",pDt._idCounter=0,v((lDt=pDt).prototype,"friction",[sDt],Object.getOwnPropertyDescriptor(lDt.prototype,"friction"),lDt.prototype),v(lDt.prototype,"rollingFriction",[aDt],Object.getOwnPropertyDescriptor(lDt.prototype,"rollingFriction"),lDt.prototype),v(lDt.prototype,"spinningFriction",[oDt],Object.getOwnPropertyDescriptor(lDt.prototype,"spinningFriction"),lDt.prototype),v(lDt.prototype,"restitution",[hDt],Object.getOwnPropertyDescriptor(lDt.prototype,"restitution"),lDt.prototype),cDt=zh(lDt.prototype,"_friction",[uu],(function(){return.6})),fDt=zh(lDt.prototype,"_rollingFriction",[uu],(function(){return 0})),_Dt=zh(lDt.prototype,"_spinningFriction",[uu],(function(){return 0})),dDt=zh(lDt.prototype,"_restitution",[uu],(function(){return 0})),uDt=lDt))||uDt)),TDt=t("fD",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}()),ADt=t("fE",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._id=0,e}s(e,t);var i=e.prototype;return i._assign=function(e,i,n,r,s){void 0===s&&(s=0),t.prototype._assign.call(this,e,i,n,r),this._id=s},i.clone=function(){var t=new e;return ir.copy(t._hitPoint,this._hitPoint),ir.copy(t._hitNormal,this._hitNormal),t._distance=this._distance,t._collider=this._collider,t._id=this._id,t},n(e,[{key:"id",get:function(){return this._id}}]),e}(TDt));A.internal.PhysicsGroup=Awt;var CDt,DDt,BDt,IDt,MDt,PDt,EDt,ODt,kDt,RDt,FDt,LDt,VDt,NDt,zDt,UDt,GDt=ze.querySettings.bind(ze),HDt=t("fy",function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this).raycastClosestResult=new TDt,e.raycastResults=[],e.lineStripCastClosestResult=new ADt,e.lineStripCastResults=[],e.sweepCastClosestResult=new TDt,e.sweepCastResults=[],e.collisionMatrix=new _wt(1),e.minVolumeSize=1e-5,e.useNodeChains=!1,e._enable=!0,e._allowSleep=!0,e._maxSubSteps=1,e._subStepCount=0,e._fixedTimeStep=1/60,e._autoSimulation=!0,e._accumulator=0,e._sleepThreshold=.1,e._gravity=new ir(0,-10,0),e._material=void 0,e.raycastOptions={group:-1,mask:-1,queryTrigger:!0,maxDistance:1e7},e.raycastResultPool=new uo((function(){return new TDt}),1),e.sweepResultPool=new uo((function(){return new TDt}),1),e}return e.setDefaultPhysicsMaterial=function(t){this._material=t,this.physicsWorld.setDefaultMaterial(this._material),this._material.on(xDt.EVENT_UPDATE,this._updateMaterial,this)},e.initDefaultMaterial=function(){var t=this;if(null!=this._material)return Promise.resolve();var e=mT.get("default-physics-material");if(!e)return ht(9642),Promise.resolve();var i=GDt("physics","defaultMaterial");return i?new Promise((function(t,e){fT.loadAny(i,(function(i,n){return!i&&n instanceof xDt?t(n):e(i)}))})).then((function(e){t.setDefaultPhysicsMaterial(e)})).catch((function(n){Y(n),at(9643,i),t.setDefaultPhysicsMaterial(e)})):(this.setDefaultPhysicsMaterial(e),Promise.resolve())},e.postUpdate=function(t){if(this.physicsWorld)if(this._enable){if(this._autoSimulation){for(this._subStepCount=0,this._accumulator+=t,YE.emit("director_before_physics");this._subStepCount<this._maxSubSteps;){if(!(this._accumulator>=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++}YE.emit("director_after_physics")}}else this.physicsWorld.syncSceneToPhysics()},e.resetConfiguration=function(t){var e=t?t.allowSleep:GDt("physics","allowSleep");"boolean"==typeof e&&(this._allowSleep=e);var i=t?t.fixedTimeStep:GDt("physics","fixedTimeStep");"number"==typeof i&&(this._fixedTimeStep=i);var n=t?t.maxSubSteps:GDt("physics","maxSubSteps");"number"==typeof n&&(this._maxSubSteps=n);var r=t?t.sleepThreshold:GDt("physics","sleepThreshold");"number"==typeof r&&(this._sleepThreshold=r);var s=t?t.autoSimulation:GDt("physics","autoSimulation");"boolean"==typeof s&&(this.autoSimulation=s);var a=t?t.gravity:GDt("physics","gravity");a&&ir.copy(this._gravity,a);var o=t?t.collisionMatrix:GDt("physics","collisionMatrix");if(o)for(var h in o)this.collisionMatrix[""+(1<<parseInt(h))]=o[h];var u=t?t.collisionGroups:GDt("physics","collisionGroups");u&&u instanceof Array&&(u.forEach((function(t){Awt[t.name]=1<<t.index})),Ee.update(Awt)),this.physicsWorld&&(this.physicsWorld.setGravity(this._gravity),this.physicsWorld.setAllowSleep(this._allowSleep))},e.resetAccumulator=function(t){void 0===t&&(t=0),this._accumulator=t},e.step=function(t,e,i){this.physicsWorld&&this.physicsWorld.step(t,e,i)},e.syncSceneToPhysics=function(){this.physicsWorld&&this.physicsWorld.syncSceneToPhysics()},e.emitEvents=function(){this.physicsWorld&&this.physicsWorld.emitEvents()},e.raycast=function(t,e,i,n){return void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),!!this.physicsWorld&&(this.raycastResultPool.reset(),this.raycastResults.length=0,this.raycastOptions.mask=e>>>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 Vs,a=1;a<t.length&&!(r>i);++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;c<this.raycastResults.length;c++){var f=this.raycastResults[c];if(0!==c||!ir.equals(o,f.hitPoint)){var _=new ADt;_._assign(f.hitPoint,f.distance,f.collider,f.hitNormal,a-1),this.lineStripCastResults.push(_)}}}return this.lineStripCastResults.length>0},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 Vs,a=!1,o=1;o<t.length&&!(r>i);++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,_=new ADt;_._assign(f.hitPoint,f.distance,f.collider,f.hitNormal,o-1),this.lineStripCastClosestResult=_;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&&XO.onPostProjectInitDelegate.add(t.initDefaultMaterial.bind(t))}},i.constructAndRegisterManually=function(){return Promise.resolve()},i.doConstructAndRegister=function(){var t;if(null!==(t=GDt("physics","enabled"))&&void 0!==t&&!t)return null;if(!i._instance){var e=new i;i._instance=e,e.resetConfiguration(),MCt(e),YE.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 ICt.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!ICt.id}},{key:"PHYSICS_BUILTIN",get:function(){return"builtin"===ICt.id}},{key:"PHYSICS_CANNON",get:function(){return"cannon.js"===ICt.id}},{key:"PHYSICS_BULLET",get:function(){return"bullet"===ICt.id}},{key:"PHYSICS_PHYSX",get:function(){return"physx"===ICt.id}},{key:"PhysicsGroup",get:function(){return Awt}},{key:"instance",get:function(){return i._instance}}]),i}(Ff));HDt.ID="PHYSICS",HDt._instance=null,YE.once("director_init",(function(){HDt.constructAndRegister()}));var WDt,jDt,qDt,XDt,YDt,JDt,KDt,QDt,ZDt,$Dt,tBt,eBt=t("fz",(CDt=Kh("cc.RigidBody"),DDt=Zh(-1),BDt=Ou(HDt.PhysicsGroup),IDt=Ou(mwt),CDt(MDt=$h(MDt=DDt((UDt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._body=null,e._group=EDt&&EDt(),e._type=ODt&&ODt(),e._mass=kDt&&kDt(),e._allowSleep=RDt&&RDt(),e._linearDamping=FDt&&FDt(),e._angularDamping=LDt&&LDt(),e._useGravity=VDt&&VDt(),e._linearFactor=NDt&&NDt(),e._angularFactor=zDt&&zDt(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){ICt.runInEditor&&(this._body=kCt(ICt.wrapper.RigidBody,1)?FCt:new ICt.wrapper.RigidBody,this._body.initialize(this))},i.onEnable=function(){this._body&&this._body.onEnable()},i.onDisable=function(){this._body&&this._body.onDisable()},i.onDestroy=function(){this._body&&this._body.onDestroy()},i.applyForce=function(t,e){this._isInitialized&&this._body.applyForce(t,e)},i.applyLocalForce=function(t,e){this._isInitialized&&this._body.applyLocalForce(t,e)},i.applyImpulse=function(t,e){this._isInitialized&&this._body.applyImpulse(t,e)},i.applyLocalImpulse=function(t,e){this._isInitialized&&this._body.applyLocalImpulse(t,e)},i.applyTorque=function(t){this._isInitialized&&this._body.applyTorque(t)},i.applyLocalTorque=function(t){this._isInitialized&&this._body.applyLocalTorque(t)},i.wakeUp=function(){this._isInitialized&&this._body.wakeUp()},i.sleep=function(){this._isInitialized&&this._body.sleep()},i.clearState=function(){this._isInitialized&&this._body.clearState()},i.clearForces=function(){this._isInitialized&&this._body.clearForces()},i.clearVelocity=function(){this._isInitialized&&this._body.clearVelocity()},i.getLinearVelocity=function(t){this._isInitialized&&this._body.getLinearVelocity(t)},i.setLinearVelocity=function(t){this._isInitialized&&this._body.setLinearVelocity(t)},i.getAngularVelocity=function(t){this._isInitialized&&this._body.getAngularVelocity(t)},i.setAngularVelocity=function(t){this._isInitialized&&this._body.setAngularVelocity(t)},i.getGroup=function(){return this._isInitialized?this._body.getGroup():0},i.setGroup=function(t){this._isInitialized&&this._body.setGroup(t)},i.addGroup=function(t){this._isInitialized&&this._body.addGroup(t)},i.removeGroup=function(t){this._isInitialized&&this._body.removeGroup(t)},i.getMask=function(){return this._isInitialized?this._body.getMask():0},i.setMask=function(t){this._isInitialized&&this._body.setMask(t)},i.addMask=function(t){this._isInitialized&&this._body.addMask(t)},i.removeMask=function(t){this._isInitialized&&this._body.removeMask(t)},n(e,[{key:"group",get:function(){return this._group},set:function(t){this._group=t,this._body&&this._body.getGroup()!==t&&this._body.setGroup(t)}},{key:"type",get:function(){return this._type},set:function(t){this._type!==t&&(this._type=t,this._body&&this._body.setType(t))}},{key:"mass",get:function(){return this._mass},set:function(t){this._mass!==t&&(t=t<=0?1e-4:t,this._mass=t,this._body&&this._body.setMass(t))}},{key:"allowSleep",get:function(){return this._allowSleep},set:function(t){this._allowSleep=t,this._body&&this._body.setAllowSleep(t)}},{key:"linearDamping",get:function(){return this._linearDamping},set:function(t){this._linearDamping=t,this._body&&this._body.setLinearDamping(t)}},{key:"angularDamping",get:function(){return this._angularDamping},set:function(t){this._angularDamping=t,this._body&&this._body.setAngularDamping(t)}},{key:"useGravity",get:function(){return this._useGravity},set:function(t){this._useGravity=t,this._body&&this._body.useGravity(t)}},{key:"linearFactor",get:function(){return this._linearFactor},set:function(t){ir.copy(this._linearFactor,t),this._body&&this._body.setLinearFactor(this._linearFactor)}},{key:"angularFactor",get:function(){return this._angularFactor},set:function(t){ir.copy(this._angularFactor,t),this._body&&this._body.setAngularFactor(this._angularFactor)}},{key:"sleepThreshold",get:function(){return this._isInitialized?this._body.getSleepThreshold():.1},set:function(t){this._isInitialized&&this._body.setSleepThreshold(t)}},{key:"useCCD",get:function(){return!!this._isInitialized&&this._body.isUsingCCD()},set:function(t){this._isInitialized&&this._body.useCCD(t)}},{key:"isAwake",get:function(){return!!this._isInitialized&&this._body.isAwake}},{key:"isSleepy",get:function(){return!!this._isInitialized&&this._body.isSleepy}},{key:"isSleeping",get:function(){return!!this._isInitialized&&this._body.isSleeping}},{key:"isStatic",get:function(){return 2===this._type},set:function(t){t&&this.isStatic||!t&&!this.isStatic||(this.type=t?2:1)}},{key:"isDynamic",get:function(){return 1===this._type},set:function(t){t&&this.isDynamic||!t&&!this.isDynamic||(this.type=t?1:4)}},{key:"isKinematic",get:function(){return 4===this._type},set:function(t){t&&this.isKinematic||!t&&!this.isKinematic||(this.type=t?4:1)}},{key:"body",get:function(){return this._body}},{key:"_isInitialized",get:function(){var t=null===this._body;return t&&J("[Physics]: This component has not been call onLoad yet, please make sure the node has been added to the scene."),!t}}]),e}(yg),UDt.Type=mwt,v((PDt=UDt).prototype,"group",[BDt],Object.getOwnPropertyDescriptor(PDt.prototype,"group"),PDt.prototype),v(PDt.prototype,"type",[IDt],Object.getOwnPropertyDescriptor(PDt.prototype,"type"),PDt.prototype),EDt=zh(PDt.prototype,"_group",[uu],(function(){return 1})),ODt=zh(PDt.prototype,"_type",[uu],(function(){return 1})),kDt=zh(PDt.prototype,"_mass",[uu],(function(){return 1})),RDt=zh(PDt.prototype,"_allowSleep",[uu],(function(){return!0})),FDt=zh(PDt.prototype,"_linearDamping",[uu],(function(){return.1})),LDt=zh(PDt.prototype,"_angularDamping",[uu],(function(){return.1})),VDt=zh(PDt.prototype,"_useGravity",[uu],(function(){return!0})),NDt=zh(PDt.prototype,"_linearFactor",[uu],(function(){return new ir(1,1,1)})),zDt=zh(PDt.prototype,"_angularFactor",[uu],(function(){return new ir(1,1,1)})),MDt=PDt))||MDt)||MDt)||MDt));eBt||t("fz",eBt={});var iBt,nBt,rBt,sBt,aBt,oBt=t("fF",(WDt=Kh("cc.Collider"),jDt=Ou(eBt),qDt=Ou(xDt),XDt=Ou(ir),YDt=Ou(xDt),WDt((tBt=function(t){function e(e){var i;return(i=t.call(this)||this).type=void 0,i._shape=null,i._aabb=null,i._boundingSphere=null,i._isSharedMaterial=!0,i._needTriggerEvent=!1,i._needCollisionEvent=!1,i._material=QDt&&QDt(),i._isTrigger=ZDt&&ZDt(),i._center=$Dt&&$Dt(),i.type=e,i}s(e,t);var i=e.prototype;return i.on=function(e,i,n,r){var s=t.prototype.on.call(this,e,i,n,r);return this._updateNeedEvent(e),s},i.off=function(e,i,n){t.prototype.off.call(this,e,i,n),this._updateNeedEvent()},i.once=function(e,i,n){var r=t.prototype.once.call(this,e,i,n);return this._updateNeedEvent(e),r},i.removeAll=function(e){t.prototype.removeAll.call(this,e),this._updateNeedEvent()},i.getGroup=function(){return this._isInitialized?this._shape.getGroup():0},i.setGroup=function(t){this._isInitialized&&this._shape.setGroup(t)},i.addGroup=function(t){this._isInitialized&&this._shape.addGroup(t)},i.removeGroup=function(t){this._isInitialized&&this._shape.removeGroup(t)},i.getMask=function(){return this._isInitialized?this._shape.getMask():0},i.setMask=function(t){this._isInitialized&&this._shape.setMask(t)},i.addMask=function(t){this._isInitialized&&this._shape.addMask(t)},i.removeMask=function(t){this._isInitialized&&this._shape.removeMask(t)},i.onLoad=function(){ICt.runInEditor&&(this.sharedMaterial=this._material,this._shape=NCt(this.type),this._shape.initialize(this),this._shape.onLoad())},i.onEnable=function(){this._shape&&this._shape.onEnable()},i.onDisable=function(){this._shape&&this._shape.onDisable()},i.onDestroy=function(){this._shape&&(this._needTriggerEvent=!1,this._needCollisionEvent=!1,this._shape.updateEventListener(),this._material&&this._material.off(xDt.EVENT_UPDATE,this._updateMaterial,this),this._shape.onDestroy()),this._boundingSphere&&this._boundingSphere.destroy()},i._updateMaterial=function(){this._shape&&this._shape.setMaterial(this._material)},i._updateNeedEvent=function(t){this.isValid&&(void 0!==t?("onCollisionEnter"!==t&&"onCollisionStay"!==t&&"onCollisionExit"!==t||(this._needCollisionEvent=!0),"onTriggerEnter"!==t&&"onTriggerStay"!==t&&"onTriggerExit"!==t&&"onControllerTriggerEnter"!==t&&"onControllerTriggerStay"!==t&&"onControllerTriggerExit"!==t||(this._needTriggerEvent=!0)):(this.hasEventListener("onTriggerEnter")||this.hasEventListener("onTriggerStay")||this.hasEventListener("onTriggerExit")||this.hasEventListener("onControllerTriggerEnter")||this.hasEventListener("onControllerTriggerStay")||this.hasEventListener("onControllerTriggerExit")||(this._needTriggerEvent=!1),this.hasEventListener("onCollisionEnter")||this.hasEventListener("onCollisionStay")||this.hasEventListener("onCollisionExit")||(this._needCollisionEvent=!1)),this._shape&&this._shape.updateEventListener())},n(e,[{key:"attachedRigidBody",get:function(){return t=this.node,(e=t.getComponent(eBt))&&e.isValid?e:null;var t,e}},{key:"sharedMaterial",get:function(){return this._material},set:function(t){this.material=t}},{key:"material",get:function(){return this._isSharedMaterial&&this._material&&(this._material.off(xDt.EVENT_UPDATE,this._updateMaterial,this),this._material=this._material.clone(),this._material.on(xDt.EVENT_UPDATE,this._updateMaterial,this),this._isSharedMaterial=!1),this._material},set:function(t){this._shape?(t&&this._material?this._material.id!==t.id&&(this._material.off(xDt.EVENT_UPDATE,this._updateMaterial,this),t.on(xDt.EVENT_UPDATE,this._updateMaterial,this),this._isSharedMaterial=!1,this._material=t):t&&!this._material?(t.on(xDt.EVENT_UPDATE,this._updateMaterial,this),this._material=t):!t&&this._material&&(this._material.off(xDt.EVENT_UPDATE,this._updateMaterial,this),this._material=t),this._updateMaterial()):this._material=t}},{key:"isTrigger",get:function(){return this._isTrigger},set:function(t){this._isTrigger=t,this._shape&&this._shape.setAsTrigger(this._isTrigger)}},{key:"center",get:function(){return this._center},set:function(t){ir.copy(this._center,t),this._shape&&this._shape.setCenter(this._center)}},{key:"shape",get:function(){return this._shape}},{key:"worldBounds",get:function(){return null==this._aabb&&(this._aabb=new gh),this._shape&&this._shape.getAABB(this._aabb),this._aabb}},{key:"boundingSphere",get:function(){return null==this._boundingSphere&&(this._boundingSphere=new Js),this._shape&&this._shape.getBoundingSphere(this._boundingSphere),this._boundingSphere}},{key:"needTriggerEvent",get:function(){return this._needTriggerEvent}},{key:"needCollisionEvent",get:function(){return this._needCollisionEvent}},{key:"_isInitialized",get:function(){var t=null===this._shape;return t&&J("[Physics]: This component has not been call onLoad yet, please make sure the node has been added to the scene."),!t}}]),e}(Bo(yg)),tBt.Type=bwt,tBt.Axis=gwt,v((KDt=tBt).prototype,"attachedRigidBody",[jDt],Object.getOwnPropertyDescriptor(KDt.prototype,"attachedRigidBody"),KDt.prototype),v(KDt.prototype,"sharedMaterial",[qDt],Object.getOwnPropertyDescriptor(KDt.prototype,"sharedMaterial"),KDt.prototype),v(KDt.prototype,"center",[XDt],Object.getOwnPropertyDescriptor(KDt.prototype,"center"),KDt.prototype),QDt=zh(KDt.prototype,"_material",[YDt],(function(){return null})),ZDt=zh(KDt.prototype,"_isTrigger",[uu],(function(){return!1})),$Dt=zh(KDt.prototype,"_center",[uu],(function(){return new ir})),JDt=KDt))||JDt));oBt||t("fF",oBt={});var hBt,uBt,lBt,cBt,fBt,_Bt,dBt,pBt,mBt,gBt,yBt,vBt,bBt,SBt,wBt,xBt,TBt,ABt,CBt,DBt,BBt,IBt,MBt,PBt,EBt,OBt,kBt,RBt,FBt,LBt,VBt,NBt,zBt,UBt,GBt,HBt,WBt,jBt,qBt,XBt,YBt,JBt,KBt,QBt,ZBt,$Bt,tIt,eIt,iIt,nIt,rIt,sIt,aIt,oIt,hIt,uIt,lIt,cIt,fIt,_It,dIt,pIt,mIt,gIt,yIt,vIt,bIt=t("fG",(iBt=Kh("cc.BoxCollider"),nBt=Ou(ir),iBt((sBt=function(t){function e(){var e;return(e=t.call(this,0)||this)._size=aBt&&aBt(),e}return s(e,t),n(e,[{key:"size",get:function(){return this._size},set:function(t){ir.strictEquals(this._size,t)||(ir.copy(this._size,t),TK(this._size),this._shape&&this.shape.updateSize())}},{key:"shape",get:function(){return this._shape}}]),e}(oBt),v(sBt.prototype,"size",[nBt],Object.getOwnPropertyDescriptor(sBt.prototype,"size"),sBt.prototype),aBt=zh(sBt.prototype,"_size",[uu],(function(){return new ir(1,1,1)})),rBt=sBt))||rBt)),SIt=t("fH",Kh("cc.SphereCollider")((uBt=function(t){function e(){var e;return(e=t.call(this,1)||this)._radius=lBt&&lBt(),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.updateRadius())}},{key:"shape",get:function(){return this._shape}}]),e}(oBt),lBt=zh(uBt.prototype,"_radius",[uu],(function(){return.5})),hBt=uBt))||hBt),wIt=t("fI",(cBt=Kh("cc.CapsuleCollider"),fBt=Ou(gwt),cBt((dBt=function(t){function e(){var e;return(e=t.call(this,2)||this)._radius=pBt&&pBt(),e._cylinderHeight=mBt&&mBt(),e._direction=gBt&&gBt(),e}s(e,t);var i=e.prototype;return i._getRadiusScale=function(){if(null==this.node)return 1;var t=this.node.worldScale;return 1===this._direction?Math.abs(gn(t.x,t.z)):0===this._direction?Math.abs(gn(t.y,t.z)):Math.abs(gn(t.x,t.y))},i._getHeightScale=function(){if(null==this.node)return 1;var t=this.node.worldScale;return 1===this._direction?Math.abs(t.y):0===this._direction?Math.abs(t.x):Math.abs(t.z)},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:"cylinderHeight",get:function(){return this._cylinderHeight},set:function(t){this._cylinderHeight!==t&&(this._cylinderHeight=Math.abs(t),this._shape&&this.shape.setCylinderHeight(t))}},{key:"direction",get:function(){return this._direction},set:function(t){(t=Math.floor(t))<0||t>2||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}(oBt),v(dBt.prototype,"direction",[fBt],Object.getOwnPropertyDescriptor(dBt.prototype,"direction"),dBt.prototype),pBt=zh(dBt.prototype,"_radius",[uu],(function(){return.5})),mBt=zh(dBt.prototype,"_cylinderHeight",[uu],(function(){return 1})),gBt=zh(dBt.prototype,"_direction",[uu],(function(){return 1})),_Bt=dBt))||_Bt)),xIt=t("fK",(yBt=Kh("cc.CylinderCollider"),vBt=Ou(gwt),yBt((SBt=function(t){function e(){var e;return(e=t.call(this,3)||this)._radius=wBt&&wBt(),e._height=xBt&&xBt(),e._direction=TBt&&TBt(),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}(oBt),v(SBt.prototype,"direction",[vBt],Object.getOwnPropertyDescriptor(SBt.prototype,"direction"),SBt.prototype),wBt=zh(SBt.prototype,"_radius",[uu],(function(){return.5})),xBt=zh(SBt.prototype,"_height",[uu],(function(){return 2})),TBt=zh(SBt.prototype,"_direction",[uu],(function(){return 1})),bBt=SBt))||bBt)),TIt=t("fL",(ABt=Kh("cc.ConeCollider"),CBt=Ou(gwt),ABt((BBt=function(t){function e(){var e;return(e=t.call(this,4)||this)._radius=IBt&&IBt(),e._height=MBt&&MBt(),e._direction=PBt&&PBt(),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}(oBt),v(BBt.prototype,"direction",[CBt],Object.getOwnPropertyDescriptor(BBt.prototype,"direction"),BBt.prototype),IBt=zh(BBt.prototype,"_radius",[uu],(function(){return.5})),MBt=zh(BBt.prototype,"_height",[uu],(function(){return 1})),PBt=zh(BBt.prototype,"_direction",[uu],(function(){return 1})),DBt=BBt))||DBt)),AIt=t("fJ",(EBt=Kh("cc.MeshCollider"),OBt=Ou(Pk),EBt((RBt=function(t){function e(){var e;return(e=t.call(this,5)||this)._mesh=FBt&&FBt(),e._convex=LBt&&LBt(),e}return s(e,t),e.prototype.onEnable=function(){if(t.prototype.onEnable.call(this),this.node){var e=this.node.getComponent(eBt);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}(oBt),v(RBt.prototype,"mesh",[OBt],Object.getOwnPropertyDescriptor(RBt.prototype,"mesh"),RBt.prototype),FBt=zh(RBt.prototype,"_mesh",[uu],(function(){return null})),LBt=zh(RBt.prototype,"_convex",[uu],(function(){return!1})),kBt=RBt))||kBt)),CIt=t("fB",Kh("cc.ConstantForce")(VBt=Qh(eBt)(VBt=$h((NBt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._rigidBody=null,e._force=zBt&&zBt(),e._localForce=UBt&&UBt(),e._torque=GBt&&GBt(),e._localTorque=HBt&&HBt(),e._mask=0,e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._rigidBody=this.node.getComponent(eBt),this._maskUpdate(this._force,1),this._maskUpdate(this._localForce,2),this._maskUpdate(this._torque,4),this._maskUpdate(this._localTorque,8)},i.lateUpdate=function(){null!=this._rigidBody&&0!==this._mask&&(1&this._mask&&this._rigidBody.applyForce(this._force),2&this._mask&&this._rigidBody.applyLocalForce(this.localForce),4&this._mask&&this._rigidBody.applyTorque(this._torque),8&this._mask&&this._rigidBody.applyLocalTorque(this._localTorque))},i._maskUpdate=function(t,e){t.strictEquals(ir.ZERO)?this._mask&=~e:this._mask|=e},n(e,[{key:"force",get:function(){return this._force},set:function(t){ir.copy(this._force,t),this._maskUpdate(this._force,1)}},{key:"localForce",get:function(){return this._localForce},set:function(t){ir.copy(this._localForce,t),this._maskUpdate(this.localForce,2)}},{key:"torque",get:function(){return this._torque},set:function(t){ir.copy(this._torque,t),this._maskUpdate(this._torque,4)}},{key:"localTorque",get:function(){return this._localTorque},set:function(t){ir.copy(this._localTorque,t),this._maskUpdate(this._localTorque,8)}}]),e}(yg),zBt=zh(NBt.prototype,"_force",[uu],(function(){return new ir})),UBt=zh(NBt.prototype,"_localForce",[uu],(function(){return new ir})),GBt=zh(NBt.prototype,"_torque",[uu],(function(){return new ir})),HBt=zh(NBt.prototype,"_localTorque",[uu],(function(){return new ir})),VBt=NBt))||VBt)||VBt)||VBt),DIt=(t("ge",4),t("gf",4)),BIt=t("gg",256),IIt=t("gh",32),MIt=t("gi",33),PIt=t("gj",8),EIt=t("gk",32768),OIt=t("gl",1/128),kIt=t("gm",1/512),RIt=t("gn",-32768*OIt),FIt=t("go",(65535-EIt)*OIt),LIt=(t("gp",0),t("gq",1),t("gr",2),t("gs",3),t("gt",16842753)),VIt=t("gu",16842754),NIt=t("gv",16842755),zIt=t("gw",16842756),UIt=t("gx",16842757),GIt=t("gy",16842758),HIt=t("gz",16842759),WIt=t("gA",16842760),jIt=t("gB",16843025),qIt=function(){function t(){this.length=0,this.buffer=new Uint8Array(2048),this._buffView=new DataView(this.buffer.buffer),this._seekPos=0}var e=t.prototype;return e.reserve=function(t){if(!(this.buffer.byteLength>t)){for(var e=this.buffer.byteLength;e<t;)e+=e;for(var i=new Uint8Array(e),n=0;n<this.length;++n)i[n]=this.buffer[n];this.buffer=i,this._buffView=new DataView(this.buffer.buffer)}},e.assign=function(t){this.buffer=t,this.length=t.length,this._seekPos=t.byteOffset,this._buffView=new DataView(t.buffer)},e.writeInt8=function(t){this.reserve(this.length+1),this._buffView.setInt8(this.length,t),this.length+=1},e.writeInt16=function(t){this.reserve(this.length+2),this._buffView.setInt16(this.length,t,!0),this.length+=2},e.writeInt32=function(t){this.reserve(this.length+4),this._buffView.setInt32(this.length,t,!0),this.length+=4},e.writeIntArray=function(t){this.reserve(this.length+4*t.length);for(var e=0;e<t.length;++e)this._buffView.setInt32(this.length+4*e,t[e],!0);this.length+=4*t.length},e.writeFloat=function(t){this.reserve(this.length+4),this._buffView.setFloat32(this.length,t,!0),this.length+=4},e.writeFloatArray=function(t){this.reserve(this.length+4*t.length);for(var e=0;e<t.length;++e)this._buffView.setFloat32(this.length+4*e,t[e],!0);this.length+=4*t.length},e.writeDouble=function(t){this.reserve(this.length+8),this._buffView.setFloat64(this.length,t,!0),this.length+=8},e.writeDoubleArray=function(t){this.reserve(this.length+8*t.length);for(var e=0;e<t.length;++e)this._buffView.setFloat64(this.length+8*e,t[e],!0);this.length+=8*t.length},e.writeString=function(t){this.reserve(this.length+t.length+4),this._buffView.setInt32(this.length,t.length,!0);for(var e=0;e<t.length;++e)this._buffView.setInt8(this.length+4+e,t.charCodeAt(e));this.length+=t.length+4},e.readInt8=function(){var t=this._buffView.getInt8(this._seekPos);return this._seekPos+=1,t},e.readInt16=function(){var t=this._buffView.getInt16(this._seekPos,!0);return this._seekPos+=2,t},e.readInt=function(){var t=this._buffView.getInt32(this._seekPos,!0);return this._seekPos+=4,t},e.readIntArray=function(t){for(var e=0;e<t.length;++e)t[e]=this._buffView.getInt32(this._seekPos+4*e,!0);return this._seekPos+=4*t.length,t},e.readFloat=function(){var t=this._buffView.getFloat32(this._seekPos,!0);return this._seekPos+=4,t},e.readFloatArray=function(t){for(var e=0;e<t.length;++e)t[e]=this._buffView.getFloat32(this._seekPos+4*e,!0);return this._seekPos+=4*t.length,t},e.readDouble=function(){var t=this._buffView.getFloat64(this._seekPos,!0);return this._seekPos+=8,t},e.readDoubleArray=function(t){for(var e=0;e<t.length;++e)t[e]=this._buffView.getFloat64(this._seekPos+4*e,!0);return this._seekPos+=8*t.length,t},e.readString=function(){for(var t=this.readInt(),e="",i=0;i<t;++i)e+=String.fromCharCode(this.readInt8());return e},t}(),XIt=t("gC",Kh("cc.TerrainLayerInfo")((jBt=function(){this.slot=qBt&&qBt(),this.tileSize=XBt&&XBt(),this.detailMap=YBt&&YBt(),this.normalMap=JBt&&JBt(),this.roughness=KBt&&KBt(),this.metallic=QBt&&QBt()},qBt=zh(jBt.prototype,"slot",[uu],(function(){return 0})),XBt=zh(jBt.prototype,"tileSize",[uu],(function(){return 1})),YBt=zh(jBt.prototype,"detailMap",[uu],(function(){return null})),JBt=zh(jBt.prototype,"normalMap",[uu],(function(){return null})),KBt=zh(jBt.prototype,"roughness",[uu],(function(){return 1})),QBt=zh(jBt.prototype,"metallic",[uu],(function(){return 0})),WBt=jBt))||WBt),YIt=t("gD",Kh("cc.TerrainLayerBinaryInfo")(ZBt=function(){this.slot=0,this.tileSize=1,this.roughness=1,this.metallic=0,this.detailMapId="",this.normalMapId=""})||ZBt),JIt=t("gE",Kh("cc.TerrainAsset")((tIt=function(t){function e(){var e;return(e=t.call(this)||this)._version=0,e._data=null,e._tileSize=1,e._blockCount=[1,1],e._weightMapSize=128,e._lightMapSize=128,e._heights=new Uint16Array,e._normals=new Float32Array,e._weights=new Uint8Array,e._layerBuffer=[-1,-1,-1,-1],e._layerBinaryInfos=[],e._layerInfos=eIt&&eIt(),e}s(e,t);var i=e.prototype;return i.getLayer=function(t,e,i){var n=4*(e*this.blockCount[0]+t)+i;return t<this.blockCount[0]&&e<this.blockCount[1]&&n<this._layerBuffer.length?this._layerBuffer[n]:-1},i.getHeight=function(t,e){var i=this._blockCount[0]*IIt+1;return(this._heights[e*i+t]-EIt)*OIt},i.getVertexCountI=function(){return this._blockCount.length<1?0:this._blockCount[0]*IIt+1},i.getVertexCountJ=function(){return this._blockCount.length<2?0:this._blockCount[1]*IIt+1},i._setNativeData=function(t){this._data=t},i._loadNativeData=function(t){if(!t||0===t.length)return!1;var e=new qIt;if(e.assign(t),this._version=e.readInt(),this._version===jIt)return!0;if(this._version!==LIt&&this._version!==VIt&&this._version!==NIt&&this._version!==zIt&&this._version!==UIt&&this._version!==GIt&&this._version!==HIt&&this._version!==WIt)return!1;this._version>=HIt?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<this.heights.length;++n)this.heights[n]=e.readInt16();if(this._version<WIt)for(var r=0;r<this.heights.length;++r){var s=(this._heights[r]-EIt)*kIt,a=EIt+s/OIt;this.heights[r]=a}if(this._version>=GIt){var o=e.readInt();this.normals=new Float32Array(o);for(var h=0;h<this.normals.length;++h)this.normals[h]=e.readFloat()}var u=e.readInt();this.weights=new Uint8Array(u);for(var l=0;l<this.weights.length;++l)this.weights[l]=e.readInt8();if(this._version>=VIt){var c=e.readInt();this.layerBuffer=new Array(c);for(var f=0;f<this.layerBuffer.length;++f)this.layerBuffer[f]=e.readInt16()}if(this._version>=NIt){var _=e.readInt();this._layerBinaryInfos=new Array(_);for(var d=0;d<this._layerBinaryInfos.length;++d)this._layerBinaryInfos[d]=new YIt,this._layerBinaryInfos[d].slot=e.readInt(),this._version>=HIt?this._layerBinaryInfos[d].tileSize=e.readDouble():this._layerBinaryInfos[d].tileSize=e.readFloat(),this._layerBinaryInfos[d].detailMapId=e.readString(),this._version>=zIt&&(this._layerBinaryInfos[d].normalMapId=e.readString(),this._version>=HIt?(this._layerBinaryInfos[d].roughness=e.readDouble(),this._layerBinaryInfos[d].metallic=e.readDouble()):(this._layerBinaryInfos[d].roughness=e.readFloat(),this._layerBinaryInfos[d].metallic=e.readFloat()))}return!0},i._exportNativeData=function(){var t=new qIt;t.writeInt32(WIt),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<this.heights.length;++e)t.writeInt16(this.heights[e]);t.writeInt32(this.normals.length);for(var i=0;i<this.normals.length;++i)t.writeFloat(this.normals[i]);t.writeInt32(this.weights.length);for(var n=0;n<this.weights.length;++n)t.writeInt8(this.weights[n]);t.writeInt32(this.layerBuffer.length);for(var r=0;r<this.layerBuffer.length;++r)t.writeInt16(this.layerBuffer[r]);var s=[];s.length=this.layerInfos.length;for(var a=0;a<s.length;++a){var o=this.layerInfos[a],h=new YIt;h.slot=a,h.tileSize=o.tileSize,h.detailMapId=o.detailMap?o.detailMap._uuid:"",h.normalMapId=o.normalMap?o.normalMap._uuid:"",h.metallic=o.metallic,h.roughness=o.roughness,s[a]=h}t.writeInt32(s.length);for(var u=0;u<s.length;++u)t.writeInt32(s[u].slot),t.writeDouble(s[u].tileSize),t.writeString(s[u].detailMapId),t.writeString(s[u].normalMapId),t.writeDouble(s[u].roughness),t.writeDouble(s[u].metallic);return t.buffer},i._exportDefaultNativeData=function(){var t=new qIt;return t.writeInt32(jIt),t.buffer},n(e,[{key:"_nativeAsset",get:function(){return this._data.buffer},set:function(t){this._data&&this._data.byteLength===t.byteLength?this._data.set(new Uint8Array(t)):this._data=new Uint8Array(t),this._loadNativeData(this._data)}},{key:"version",get:function(){return this._version}},{key:"tileSize",get:function(){return this._tileSize},set:function(t){this._tileSize=t}},{key:"blockCount",get:function(){return this._blockCount},set:function(t){this._blockCount=t}},{key:"lightMapSize",get:function(){return this._lightMapSize},set:function(t){this._lightMapSize=t}},{key:"weightMapSize",get:function(){return this._weightMapSize},set:function(t){this._weightMapSize=t}},{key:"heights",get:function(){return this._heights},set:function(t){this._heights=t}},{key:"normals",get:function(){return this._normals},set:function(t){this._normals=t}},{key:"weights",get:function(){return this._weights},set:function(t){this._weights=t}},{key:"layerBuffer",get:function(){return this._layerBuffer},set:function(t){this._layerBuffer=t}},{key:"layerInfos",get:function(){return this._layerInfos},set:function(t){this._layerInfos=t}},{key:"layerBinaryInfos",get:function(){return this._layerBinaryInfos}}]),e}(Cm),eIt=zh(tIt.prototype,"_layerInfos",[uu],(function(){return[]})),$Bt=tIt))||$Bt),KIt=t("fM",(iIt=Kh("cc.TerrainCollider"),nIt=Ou(JIt),iIt((sIt=function(t){function e(){var e;return(e=t.call(this,8)||this)._terrain=aIt&&aIt(),e}return s(e,t),e.prototype.onEnable=function(){if(t.prototype.onEnable.call(this),this.node){var e=this.node.getComponent(eBt);e&&e.isValid&&1===e.type&&at(9630,this.node.name)}},n(e,[{key:"terrain",get:function(){return this._terrain},set:function(t){this._terrain=t,this._shape&&this.shape.setTerrain(this._terrain)}},{key:"shape",get:function(){return this._shape}}]),e}(oBt),v(sIt.prototype,"terrain",[nIt],Object.getOwnPropertyDescriptor(sIt.prototype,"terrain"),sIt.prototype),aIt=zh(sIt.prototype,"_terrain",[uu],(function(){return null})),rIt=sIt))||rIt)),QIt=t("fN",(oIt=Kh("cc.SimplexCollider"),hIt=Ou(vwt),oIt((_It=function(t){function e(){var e;return(e=t.call(this,7)||this)._shapeType=cIt&&cIt(),e._vertices=fIt&&fIt(),e}return s(e,t),e.prototype.updateVertices=function(){this._shape&&this.shape.setVertices(this._vertices)},n(e,[{key:"shapeType",get:function(){return this._shapeType},set:function(t){this._shapeType=t,this._shape&&this.shape.setShapeType(t)}},{key:"vertex0",get:function(){return this._vertices[0]},set:function(t){ir.copy(this._vertices[0],t),this.updateVertices()}},{key:"vertex1",get:function(){return this._vertices[1]},set:function(t){ir.copy(this._vertices[1],t),this.updateVertices()}},{key:"vertex2",get:function(){return this._vertices[2]},set:function(t){ir.copy(this._vertices[2],t),this.updateVertices()}},{key:"vertex3",get:function(){return this._vertices[3]},set:function(t){ir.copy(this._vertices[3],t),this.updateVertices()}},{key:"shape",get:function(){return this._shape}},{key:"vertices",get:function(){return this._vertices}}]),e}(oBt),_It.ESimplexType=vwt,v((lIt=_It).prototype,"shapeType",[hIt],Object.getOwnPropertyDescriptor(lIt.prototype,"shapeType"),lIt.prototype),cIt=zh(lIt.prototype,"_shapeType",[uu],(function(){return 4})),fIt=zh(lIt.prototype,"_vertices",[uu],(function(){return[new ir(0,0,0),new ir(0,0,1),new ir(1,0,0),new ir(0,1,0)]})),uIt=lIt))||uIt));QIt||t("fN",QIt={});var ZIt,$It,tMt,eMt,iMt,nMt,rMt,sMt,aMt,oMt,hMt,uMt,lMt,cMt,fMt,_Mt,dMt,pMt,mMt,gMt,yMt,vMt,bMt,SMt,wMt,xMt,TMt,AMt,CMt,DMt,BMt,IMt,MMt,PMt,EMt,OMt,kMt,RMt,FMt,LMt,VMt,NMt,zMt,UMt,GMt,HMt,WMt,jMt,qMt,XMt,YMt,JMt,KMt,QMt,ZMt,$Mt,tPt=t("fO",(dIt=Kh("cc.PlaneCollider"),pIt=Ou(ir),dIt((gIt=function(t){function e(){var e;return(e=t.call(this,6)||this)._normal=yIt&&yIt(),e._constant=vIt&&vIt(),e}return s(e,t),e.prototype.onEnable=function(){if(t.prototype.onEnable.call(this),this.node){var e=this.node.getComponent(eBt);e&&e.isValid&&1===e.type&&at(9630,this.node.name)}},n(e,[{key:"normal",get:function(){return this._normal},set:function(t){ir.strictEquals(this._normal,t)||(ir.copy(this._normal,t),this._shape&&this.shape.setNormal(this._normal))}},{key:"constant",get:function(){return this._constant},set:function(t){this._constant!==t&&(this._constant=t,this._shape&&this.shape.setConstant(this._constant))}},{key:"shape",get:function(){return this._shape}}]),e}(oBt),v(gIt.prototype,"normal",[pIt],Object.getOwnPropertyDescriptor(gIt.prototype,"normal"),gIt.prototype),yIt=zh(gIt.prototype,"_normal",[uu],(function(){return new ir(0,1,0)})),vIt=zh(gIt.prototype,"_constant",[uu],(function(){return 0})),mIt=gIt))||mIt)),ePt=t("fP",(ZIt=Kh("cc.Constraint"),$It=Qh(eBt),tMt=Ou(eBt),eMt=Ou(eBt),iMt=Ou(eBt),ZIt(nMt=$It((oMt=function(t){function e(e){var i;return(i=t.call(this)||this).TYPE=void 0,i._enableCollision=sMt&&sMt(),i._connectedBody=aMt&&aMt(),i._constraint=null,i.TYPE=e,i}s(e,t);var i=e.prototype;return i.onLoad=function(){ICt.runInEditor&&(this._constraint=GCt(this.TYPE),this._constraint.initialize(this))},i.onEnable=function(){this._constraint&&this._constraint.onEnable()},i.onDisable=function(){this._constraint&&this._constraint.onDisable()},i.onDestroy=function(){this._constraint&&this._constraint.onDestroy()},n(e,[{key:"attachedBody",get:function(){return this.getComponent(eBt)}},{key:"connectedBody",get:function(){return this._connectedBody},set:function(t){this._connectedBody=t,this._constraint&&this._constraint.setConnectedBody(t)}},{key:"enableCollision",get:function(){return this._enableCollision},set:function(t){this._enableCollision=t,this._constraint&&this._constraint.setEnableCollision(t)}}]),e}(Bo(yg)),oMt.Type=Swt,v((rMt=oMt).prototype,"attachedBody",[tMt],Object.getOwnPropertyDescriptor(rMt.prototype,"attachedBody"),rMt.prototype),v(rMt.prototype,"connectedBody",[eMt],Object.getOwnPropertyDescriptor(rMt.prototype,"connectedBody"),rMt.prototype),sMt=zh(rMt.prototype,"_enableCollision",[uu],(function(){return!0})),aMt=zh(rMt.prototype,"_connectedBody",[iMt],(function(){return null})),nMt=rMt))||nMt)||nMt));ePt||t("fP",ePt={});var iPt,nPt,rPt,sPt,aPt,oPt,hPt,uPt,lPt,cPt,fPt,_Pt,dPt,pPt,mPt,gPt,yPt,vPt,bPt,SPt,wPt,xPt,TPt,APt,CPt,DPt,BPt,IPt,MPt,PPt,EPt,OPt,kPt,RPt,FPt,LPt,VPt,NPt,zPt,UPt,GPt,HPt,WPt,jPt,qPt,XPt,YPt,JPt,KPt,QPt,ZPt,$Pt,tEt,eEt,iEt,nEt,rEt,sEt,aEt,oEt,hEt,uEt,lEt,cEt,fEt,_Et,dEt,pEt,mEt,gEt,yEt,vEt,bEt,SEt,wEt,xEt,TEt,AEt,CEt,DEt,BEt,IEt,MEt,PEt,EEt,OEt,kEt,REt,FEt,LEt,VEt,NEt,zEt,UEt,GEt,HEt,WEt,jEt,qEt,XEt,YEt,JEt,KEt,QEt,ZEt,$Et,tOt,eOt,iOt,nOt,rOt,sOt,aOt,oOt,hOt,uOt,lOt,cOt,fOt,_Ot,dOt,pOt,mOt,gOt,yOt,vOt,bOt,SOt,wOt,xOt,TOt,AOt,COt,DOt,BOt,IOt,MOt,POt,EOt,OOt,kOt,ROt,FOt,LOt,VOt,NOt,zOt,UOt,GOt,HOt,WOt,jOt,qOt=(hMt=Kh("cc.HingeLimitData"),uMt=lu("enabled"),lMt=lu("upperLimit"),cMt=lu("lowerLimit"),fMt=Ou(fi),_Mt=Ou(ci),dMt=Ou(ci),hMt((mMt=function(){function t(){this._enabled=gMt&&gMt(),this._upperLimit=yMt&&yMt(),this._lowerLimit=vMt&&vMt()}return n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"upperLimit",get:function(){return this._upperLimit},set:function(t){this._upperLimit=t}},{key:"lowerLimit",get:function(){return this._lowerLimit},set:function(t){this._lowerLimit=t}}]),t}(),gMt=zh(mMt.prototype,"_enabled",[uu,uMt],(function(){return!1})),yMt=zh(mMt.prototype,"_upperLimit",[uu,lMt],(function(){return Number.MAX_VALUE})),vMt=zh(mMt.prototype,"_lowerLimit",[uu,cMt],(function(){return-Number.MAX_VALUE})),v(mMt.prototype,"enabled",[fMt],Object.getOwnPropertyDescriptor(mMt.prototype,"enabled"),mMt.prototype),v(mMt.prototype,"upperLimit",[_Mt],Object.getOwnPropertyDescriptor(mMt.prototype,"upperLimit"),mMt.prototype),v(mMt.prototype,"lowerLimit",[dMt],Object.getOwnPropertyDescriptor(mMt.prototype,"lowerLimit"),mMt.prototype),pMt=mMt))||pMt),XOt=(bMt=Kh("cc.HingeMotorData"),SMt=lu("enabled"),wMt=lu("motorVelocity"),xMt=lu("motorForceLimit"),TMt=Ou(fi),AMt=Ou(ci),CMt=Ou(ci),bMt((BMt=function(){function t(){this._enabled=IMt&&IMt(),this._motorVelocity=MMt&&MMt(),this._motorForceLimit=PMt&&PMt()}return n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"motorVelocity",get:function(){return this._motorVelocity},set:function(t){this._motorVelocity=t}},{key:"motorForceLimit",get:function(){return this._motorForceLimit},set:function(t){this._motorForceLimit=t}}]),t}(),IMt=zh(BMt.prototype,"_enabled",[uu,SMt],(function(){return!1})),MMt=zh(BMt.prototype,"_motorVelocity",[uu,wMt],(function(){return 0})),PMt=zh(BMt.prototype,"_motorForceLimit",[uu,xMt],(function(){return 0})),v(BMt.prototype,"enabled",[TMt],Object.getOwnPropertyDescriptor(BMt.prototype,"enabled"),BMt.prototype),v(BMt.prototype,"motorVelocity",[AMt],Object.getOwnPropertyDescriptor(BMt.prototype,"motorVelocity"),BMt.prototype),v(BMt.prototype,"motorForceLimit",[CMt],Object.getOwnPropertyDescriptor(BMt.prototype,"motorForceLimit"),BMt.prototype),DMt=BMt))||DMt),YOt=t("fQ",(EMt=Kh("cc.HingeConstraint"),OMt=Ou(ir),kMt=Ou(ir),RMt=Ou(ir),FMt=Ou(fi),LMt=Ou(ci),VMt=Ou(ci),NMt=Ou(fi),zMt=Ou(ci),UMt=Ou(ci),GMt=lu("axisA"),HMt=lu("pivotA"),WMt=lu("pivotB"),jMt=lu("limitData"),qMt=lu("motorData"),EMt((YMt=function(t){function e(){var e;return(e=t.call(this,1)||this)._axis=JMt&&JMt(),e._pivotA=KMt&&KMt(),e._pivotB=QMt&&QMt(),e._limitData=ZMt&&ZMt(),e._motorData=$Mt&&$Mt(),e}return s(e,t),n(e,[{key:"pivotA",get:function(){return this._pivotA},set:function(t){ir.copy(this._pivotA,t),this.constraint.setPivotA(this._pivotA)}},{key:"pivotB",get:function(){return this._pivotB},set:function(t){ir.copy(this._pivotB,t),this.constraint.setPivotB(this._pivotB)}},{key:"axis",get:function(){return this._axis},set:function(t){ir.copy(this._axis,t),this.constraint.setAxis(this._axis)}},{key:"limitEnabled",get:function(){return this._limitData.enabled},set:function(t){this._limitData.enabled=t,this.constraint.setLimitEnabled(t)}},{key:"upperLimit",get:function(){return this._limitData.upperLimit},set:function(t){this._limitData.upperLimit=t,this.constraint.setUpperLimit(t)}},{key:"lowerLimit",get:function(){return this._limitData.lowerLimit},set:function(t){this._limitData.lowerLimit=t,this.constraint.setLowerLimit(t)}},{key:"motorEnabled",get:function(){return this._motorData.enabled},set:function(t){this._motorData.enabled=t,this.constraint.setMotorEnabled(t)}},{key:"motorVelocity",get:function(){return this._motorData.motorVelocity},set:function(t){this._motorData.motorVelocity=t,this.constraint.setMotorVelocity(t)}},{key:"motorForceLimit",get:function(){return this._motorData.motorForceLimit},set:function(t){this._motorData.motorForceLimit=t,this.constraint.setMotorForceLimit(t)}},{key:"constraint",get:function(){return this._constraint}}]),e}(ePt),v(YMt.prototype,"pivotA",[OMt],Object.getOwnPropertyDescriptor(YMt.prototype,"pivotA"),YMt.prototype),v(YMt.prototype,"pivotB",[kMt],Object.getOwnPropertyDescriptor(YMt.prototype,"pivotB"),YMt.prototype),v(YMt.prototype,"axis",[RMt],Object.getOwnPropertyDescriptor(YMt.prototype,"axis"),YMt.prototype),v(YMt.prototype,"limitEnabled",[FMt],Object.getOwnPropertyDescriptor(YMt.prototype,"limitEnabled"),YMt.prototype),v(YMt.prototype,"upperLimit",[LMt],Object.getOwnPropertyDescriptor(YMt.prototype,"upperLimit"),YMt.prototype),v(YMt.prototype,"lowerLimit",[VMt],Object.getOwnPropertyDescriptor(YMt.prototype,"lowerLimit"),YMt.prototype),v(YMt.prototype,"motorEnabled",[NMt],Object.getOwnPropertyDescriptor(YMt.prototype,"motorEnabled"),YMt.prototype),v(YMt.prototype,"motorVelocity",[zMt],Object.getOwnPropertyDescriptor(YMt.prototype,"motorVelocity"),YMt.prototype),v(YMt.prototype,"motorForceLimit",[UMt],Object.getOwnPropertyDescriptor(YMt.prototype,"motorForceLimit"),YMt.prototype),JMt=zh(YMt.prototype,"_axis",[uu,GMt],(function(){return new ir})),KMt=zh(YMt.prototype,"_pivotA",[uu,HMt],(function(){return new ir})),QMt=zh(YMt.prototype,"_pivotB",[uu,WMt],(function(){return new ir})),ZMt=zh(YMt.prototype,"_limitData",[uu,jMt],(function(){return new qOt})),$Mt=zh(YMt.prototype,"_motorData",[uu,qMt],(function(){return new XOt})),XMt=YMt))||XMt)),JOt=t("fS",(iPt=Kh("cc.FixedConstraint"),nPt=Ou(ci),rPt=Ou(ci),sPt=lu("breakForce"),aPt=lu("breakTorque"),iPt((hPt=function(t){function e(){var e;return(e=t.call(this,2)||this)._breakForce=uPt&&uPt(),e._breakTorque=lPt&&lPt(),e}return s(e,t),n(e,[{key:"breakForce",get:function(){return this._breakForce},set:function(t){this._breakForce=t,this.constraint.setBreakForce(t)}},{key:"breakTorque",get:function(){return this._breakTorque},set:function(t){this._breakTorque=t,this.constraint.setBreakTorque(t)}},{key:"constraint",get:function(){return this._constraint}}]),e}(ePt),v(hPt.prototype,"breakForce",[nPt],Object.getOwnPropertyDescriptor(hPt.prototype,"breakForce"),hPt.prototype),v(hPt.prototype,"breakTorque",[rPt],Object.getOwnPropertyDescriptor(hPt.prototype,"breakTorque"),hPt.prototype),uPt=zh(hPt.prototype,"_breakForce",[uu,sPt],(function(){return 1e8})),lPt=zh(hPt.prototype,"_breakTorque",[uu,aPt],(function(){return 1e8})),oPt=hPt))||oPt)),KOt=(cPt=Kh("cc.LinearLimitSettings"),fPt=Ou(wwt),_Pt=Ou(wwt),dPt=Ou(wwt),pPt=Ou(ir),mPt=Ou(ir),gPt=Ou(ci),yPt=Ou(fi),vPt=Ou(ci),bPt=Ou(ci),cPt((wPt=function(){function t(t){this._xMotion=xPt&&xPt(),this._yMotion=TPt&&TPt(),this._zMotion=APt&&APt(),this._upper=CPt&&CPt(),this._lower=DPt&&DPt(),this._enableSoftConstraint=BPt&&BPt(),this._bounciness=IPt&&IPt(),this._stiffness=MPt&&MPt(),this._damping=PPt&&PPt(),this._impl=void 0,this._impl=t}return n(t,[{key:"xMotion",get:function(){return this._xMotion},set:function(t){this._xMotion=t,this._impl.setConstraintMode(0,t)}},{key:"yMotion",get:function(){return this._yMotion},set:function(t){this._yMotion=t,this._impl.setConstraintMode(1,t)}},{key:"zMotion",get:function(){return this._zMotion},set:function(t){this._zMotion=t,this._impl.setConstraintMode(2,t)}},{key:"upper",get:function(){return this._upper},set:function(t){ir.copy(this._upper,t);var e=this.lower;this._impl.setLinearLimit(0,e.x,t.x),this._impl.setLinearLimit(1,e.y,t.y),this._impl.setLinearLimit(2,e.z,t.z)}},{key:"lower",get:function(){return this._lower},set:function(t){ir.copy(this._lower,t);var e=this.upper;this._impl.setLinearLimit(0,t.x,e.x),this._impl.setLinearLimit(1,t.y,e.y),this._impl.setLinearLimit(2,t.z,e.z)}},{key:"restitution",get:function(){return this._bounciness},set:function(t){this._bounciness=t,this._impl.setLinearRestitution(t)}},{key:"enableSoftConstraint",get:function(){return this._enableSoftConstraint},set:function(t){this._enableSoftConstraint=t,this._impl.setLinearSoftConstraint(t)}},{key:"stiffness",get:function(){return this._stiffness},set:function(t){this._stiffness=t,this._impl.setLinearStiffness(t)}},{key:"damping",get:function(){return this._damping},set:function(t){this._damping=t,this._impl.setLinearDamping(t)}},{key:"impl",set:function(t){this._impl=t}}]),t}(),v(wPt.prototype,"xMotion",[fPt],Object.getOwnPropertyDescriptor(wPt.prototype,"xMotion"),wPt.prototype),v(wPt.prototype,"yMotion",[_Pt],Object.getOwnPropertyDescriptor(wPt.prototype,"yMotion"),wPt.prototype),v(wPt.prototype,"zMotion",[dPt],Object.getOwnPropertyDescriptor(wPt.prototype,"zMotion"),wPt.prototype),v(wPt.prototype,"upper",[pPt],Object.getOwnPropertyDescriptor(wPt.prototype,"upper"),wPt.prototype),v(wPt.prototype,"lower",[mPt],Object.getOwnPropertyDescriptor(wPt.prototype,"lower"),wPt.prototype),v(wPt.prototype,"restitution",[gPt],Object.getOwnPropertyDescriptor(wPt.prototype,"restitution"),wPt.prototype),v(wPt.prototype,"enableSoftConstraint",[yPt],Object.getOwnPropertyDescriptor(wPt.prototype,"enableSoftConstraint"),wPt.prototype),v(wPt.prototype,"stiffness",[vPt],Object.getOwnPropertyDescriptor(wPt.prototype,"stiffness"),wPt.prototype),v(wPt.prototype,"damping",[bPt],Object.getOwnPropertyDescriptor(wPt.prototype,"damping"),wPt.prototype),xPt=zh(wPt.prototype,"_xMotion",[uu],(function(){return 0})),TPt=zh(wPt.prototype,"_yMotion",[uu],(function(){return 0})),APt=zh(wPt.prototype,"_zMotion",[uu],(function(){return 0})),CPt=zh(wPt.prototype,"_upper",[uu],(function(){return new ir})),DPt=zh(wPt.prototype,"_lower",[uu],(function(){return new ir})),BPt=zh(wPt.prototype,"_enableSoftConstraint",[uu],(function(){return!1})),IPt=zh(wPt.prototype,"_bounciness",[uu],(function(){return 0})),MPt=zh(wPt.prototype,"_stiffness",[uu],(function(){return 0})),PPt=zh(wPt.prototype,"_damping",[uu],(function(){return 0})),SPt=wPt))||SPt),QOt=(EPt=Kh("cc.AngularLimitSettings"),OPt=Ou(wwt),kPt=Ou(wwt),RPt=Ou(wwt),FPt=Ou(ci),LPt=Ou(ci),VPt=Ou(ci),NPt=Ou(ci),zPt=Ou(ci),UPt=Ou(fi),GPt=Ou(ci),HPt=Ou(ci),WPt=Ou(fi),jPt=Ou(ci),qPt=Ou(ci),EPt((YPt=function(){function t(t){this._swing1Motion=JPt&&JPt(),this._swing2Motion=KPt&&KPt(),this._twistMotion=QPt&&QPt(),this._twistExtent=ZPt&&ZPt(),this._swingExtent1=$Pt&&$Pt(),this._swingExtent2=tEt&&tEt(),this._enableSoftConstraintSwing=eEt&&eEt(),this._swingBounciness=iEt&&iEt(),this._swingStiffness=nEt&&nEt(),this._swingDamping=rEt&&rEt(),this._enableSoftConstraintTwist=sEt&&sEt(),this._twistBounciness=aEt&&aEt(),this._twistStiffness=oEt&&oEt(),this._twistDamping=hEt&&hEt(),this._impl=void 0,this._impl=t}return n(t,[{key:"twistMotion",get:function(){return this._twistMotion},set:function(t){this._twistMotion=t,this._impl.setConstraintMode(3,t)}},{key:"swingMotion1",get:function(){return this._swing1Motion},set:function(t){this._swing1Motion=t,this._impl.setConstraintMode(4,t)}},{key:"swingMotion2",get:function(){return this._swing2Motion},set:function(t){this._swing2Motion=t,this._impl.setConstraintMode(5,t)}},{key:"twistExtent",get:function(){return this._twistExtent},set:function(t){this._twistExtent=t,this._impl.setAngularExtent(t,this.swingExtent1,this.swingExtent2)}},{key:"swingExtent1",get:function(){return this._swingExtent1},set:function(t){this._swingExtent1=t,this._impl.setAngularExtent(this.twistExtent,t,this.swingExtent2)}},{key:"swingExtent2",get:function(){return this._swingExtent2},set:function(t){this._swingExtent2=t,this._impl.setAngularExtent(this.twistExtent,this.swingExtent1,t)}},{key:"twistRestitution",get:function(){return this._twistBounciness},set:function(t){this._twistBounciness=t,this._impl.setTwistRestitution(t)}},{key:"swingRestitution",get:function(){return this._swingBounciness},set:function(t){this._swingBounciness=t,this._impl.setSwingRestitution(t)}},{key:"enableSoftConstraintTwist",get:function(){return this._enableSoftConstraintTwist},set:function(t){this._enableSoftConstraintTwist=t,this._impl.setTwistSoftConstraint(t)}},{key:"twistStiffness",get:function(){return this._twistStiffness},set:function(t){this._twistStiffness=t,this._impl.setTwistStiffness(t)}},{key:"twistDamping",get:function(){return this._twistDamping},set:function(t){this._twistDamping=t,this._impl.setTwistDamping(t)}},{key:"enableSoftConstraintSwing",get:function(){return this._enableSoftConstraintSwing},set:function(t){this._enableSoftConstraintSwing=t,this._impl.setSwingSoftConstraint(t)}},{key:"swingStiffness",get:function(){return this._swingStiffness},set:function(t){this._swingStiffness=t,this._impl.setSwingStiffness(t)}},{key:"swingDamping",get:function(){return this._swingDamping},set:function(t){this._swingDamping=t,this._impl.setSwingDamping(t)}},{key:"impl",set:function(t){this._impl=t}}]),t}(),v(YPt.prototype,"twistMotion",[OPt],Object.getOwnPropertyDescriptor(YPt.prototype,"twistMotion"),YPt.prototype),v(YPt.prototype,"swingMotion1",[kPt],Object.getOwnPropertyDescriptor(YPt.prototype,"swingMotion1"),YPt.prototype),v(YPt.prototype,"swingMotion2",[RPt],Object.getOwnPropertyDescriptor(YPt.prototype,"swingMotion2"),YPt.prototype),v(YPt.prototype,"twistExtent",[FPt],Object.getOwnPropertyDescriptor(YPt.prototype,"twistExtent"),YPt.prototype),v(YPt.prototype,"swingExtent1",[LPt],Object.getOwnPropertyDescriptor(YPt.prototype,"swingExtent1"),YPt.prototype),v(YPt.prototype,"swingExtent2",[VPt],Object.getOwnPropertyDescriptor(YPt.prototype,"swingExtent2"),YPt.prototype),v(YPt.prototype,"twistRestitution",[NPt],Object.getOwnPropertyDescriptor(YPt.prototype,"twistRestitution"),YPt.prototype),v(YPt.prototype,"swingRestitution",[zPt],Object.getOwnPropertyDescriptor(YPt.prototype,"swingRestitution"),YPt.prototype),v(YPt.prototype,"enableSoftConstraintTwist",[UPt],Object.getOwnPropertyDescriptor(YPt.prototype,"enableSoftConstraintTwist"),YPt.prototype),v(YPt.prototype,"twistStiffness",[GPt],Object.getOwnPropertyDescriptor(YPt.prototype,"twistStiffness"),YPt.prototype),v(YPt.prototype,"twistDamping",[HPt],Object.getOwnPropertyDescriptor(YPt.prototype,"twistDamping"),YPt.prototype),v(YPt.prototype,"enableSoftConstraintSwing",[WPt],Object.getOwnPropertyDescriptor(YPt.prototype,"enableSoftConstraintSwing"),YPt.prototype),v(YPt.prototype,"swingStiffness",[jPt],Object.getOwnPropertyDescriptor(YPt.prototype,"swingStiffness"),YPt.prototype),v(YPt.prototype,"swingDamping",[qPt],Object.getOwnPropertyDescriptor(YPt.prototype,"swingDamping"),YPt.prototype),JPt=zh(YPt.prototype,"_swing1Motion",[uu],(function(){return 0})),KPt=zh(YPt.prototype,"_swing2Motion",[uu],(function(){return 0})),QPt=zh(YPt.prototype,"_twistMotion",[uu],(function(){return 0})),ZPt=zh(YPt.prototype,"_twistExtent",[uu],(function(){return 0})),$Pt=zh(YPt.prototype,"_swingExtent1",[uu],(function(){return 0})),tEt=zh(YPt.prototype,"_swingExtent2",[uu],(function(){return 0})),eEt=zh(YPt.prototype,"_enableSoftConstraintSwing",[uu],(function(){return!1})),iEt=zh(YPt.prototype,"_swingBounciness",[uu],(function(){return 0})),nEt=zh(YPt.prototype,"_swingStiffness",[uu],(function(){return 0})),rEt=zh(YPt.prototype,"_swingDamping",[uu],(function(){return 0})),sEt=zh(YPt.prototype,"_enableSoftConstraintTwist",[uu],(function(){return!1})),aEt=zh(YPt.prototype,"_twistBounciness",[uu],(function(){return 0})),oEt=zh(YPt.prototype,"_twistStiffness",[uu],(function(){return 0})),hEt=zh(YPt.prototype,"_twistDamping",[uu],(function(){return 0})),XPt=YPt))||XPt),ZOt=(uEt=Kh("cc.LinearDriverSettings"),lEt=Ou(xwt),cEt=Ou(xwt),fEt=Ou(xwt),_Et=Ou(ir),dEt=Ou(ir),pEt=Ou(ci),uEt((gEt=function(){function t(t){this._target=yEt&&yEt(),this._velocity=vEt&&vEt(),this._xDrive=bEt&&bEt(),this._yDrive=SEt&&SEt(),this._zDrive=wEt&&wEt(),this._strength=xEt&&xEt(),this._impl=void 0,this._impl=t}return n(t,[{key:"xDrive",get:function(){return this._xDrive},set:function(t){this._xDrive=t,this._impl.setDriverMode(0,t)}},{key:"yDrive",get:function(){return this._yDrive},set:function(t){this._yDrive=t,this._impl.setDriverMode(1,t)}},{key:"zDrive",get:function(){return this._zDrive},set:function(t){this._zDrive=t,this._impl.setDriverMode(2,t)}},{key:"targetPosition",get:function(){return this._target},set:function(t){ir.copy(this._target,t),this._impl.setLinearMotorTarget(t)}},{key:"targetVelocity",get:function(){return this._velocity},set:function(t){ir.copy(this._velocity,t),this._impl.setLinearMotorVelocity(t)}},{key:"strength",get:function(){return this._strength},set:function(t){this._strength=t,this._impl.setLinearMotorForceLimit(t)}},{key:"impl",set:function(t){this._impl=t}}]),t}(),v(gEt.prototype,"xDrive",[lEt],Object.getOwnPropertyDescriptor(gEt.prototype,"xDrive"),gEt.prototype),v(gEt.prototype,"yDrive",[cEt],Object.getOwnPropertyDescriptor(gEt.prototype,"yDrive"),gEt.prototype),v(gEt.prototype,"zDrive",[fEt],Object.getOwnPropertyDescriptor(gEt.prototype,"zDrive"),gEt.prototype),v(gEt.prototype,"targetPosition",[_Et],Object.getOwnPropertyDescriptor(gEt.prototype,"targetPosition"),gEt.prototype),v(gEt.prototype,"targetVelocity",[dEt],Object.getOwnPropertyDescriptor(gEt.prototype,"targetVelocity"),gEt.prototype),v(gEt.prototype,"strength",[pEt],Object.getOwnPropertyDescriptor(gEt.prototype,"strength"),gEt.prototype),yEt=zh(gEt.prototype,"_target",[uu],(function(){return new ir})),vEt=zh(gEt.prototype,"_velocity",[uu],(function(){return new ir})),bEt=zh(gEt.prototype,"_xDrive",[uu],(function(){return 0})),SEt=zh(gEt.prototype,"_yDrive",[uu],(function(){return 0})),wEt=zh(gEt.prototype,"_zDrive",[uu],(function(){return 0})),xEt=zh(gEt.prototype,"_strength",[uu],(function(){return 0})),mEt=gEt))||mEt),$Ot=(TEt=Kh("cc.AngularDriverSettings"),AEt=Ou(xwt),CEt=Ou(xwt),DEt=Ou(xwt),BEt=Ou(ir),IEt=Ou(ir),MEt=Ou(ci),TEt((EEt=function(){function t(t){this._swingDrive1=OEt&&OEt(),this._swingDrive2=kEt&&kEt(),this._twistDrive=REt&&REt(),this._targetOrientation=FEt&&FEt(),this._targetVelocity=LEt&&LEt(),this._strength=VEt&&VEt(),this._impl=void 0,this._impl=t}return n(t,[{key:"twistDrive",get:function(){return this._twistDrive},set:function(t){this._twistDrive=t,this._impl.setDriverMode(3,t)}},{key:"swingDrive1",get:function(){return this._swingDrive1},set:function(t){this._swingDrive1=t,this._impl.setDriverMode(4,t)}},{key:"swingDrive2",get:function(){return this._swingDrive2},set:function(t){this._swingDrive2=t,this._impl.setDriverMode(5,t)}},{key:"targetOrientation",get:function(){return this._targetOrientation},set:function(t){ir.copy(this._targetOrientation,t),this._impl.setAngularMotorTarget(t)}},{key:"targetVelocity",get:function(){return this._targetVelocity},set:function(t){ir.copy(this._targetVelocity,t),this._impl.setAngularMotorVelocity(t)}},{key:"strength",get:function(){return this._strength},set:function(t){this._strength=t,this._impl.setAngularMotorForceLimit(t)}},{key:"impl",set:function(t){this._impl=t}}]),t}(),v(EEt.prototype,"twistDrive",[AEt],Object.getOwnPropertyDescriptor(EEt.prototype,"twistDrive"),EEt.prototype),v(EEt.prototype,"swingDrive1",[CEt],Object.getOwnPropertyDescriptor(EEt.prototype,"swingDrive1"),EEt.prototype),v(EEt.prototype,"swingDrive2",[DEt],Object.getOwnPropertyDescriptor(EEt.prototype,"swingDrive2"),EEt.prototype),v(EEt.prototype,"targetOrientation",[BEt],Object.getOwnPropertyDescriptor(EEt.prototype,"targetOrientation"),EEt.prototype),v(EEt.prototype,"targetVelocity",[IEt],Object.getOwnPropertyDescriptor(EEt.prototype,"targetVelocity"),EEt.prototype),v(EEt.prototype,"strength",[MEt],Object.getOwnPropertyDescriptor(EEt.prototype,"strength"),EEt.prototype),OEt=zh(EEt.prototype,"_swingDrive1",[uu],(function(){return 0})),kEt=zh(EEt.prototype,"_swingDrive2",[uu],(function(){return 0})),REt=zh(EEt.prototype,"_twistDrive",[uu],(function(){return 0})),FEt=zh(EEt.prototype,"_targetOrientation",[uu],(function(){return new ir})),LEt=zh(EEt.prototype,"_targetVelocity",[uu],(function(){return new ir})),VEt=zh(EEt.prototype,"_strength",[uu],(function(){return 0})),PEt=EEt))||PEt),tkt=t("fR",(NEt=Kh("cc.ConfigurableConstraint"),zEt=Ou(ir),UEt=Ou(ir),GEt=Ou(ir),HEt=Ou(ir),WEt=Ou(fi),jEt=Ou(ci),qEt=Ou(ci),XEt=Ou(KOt),YEt=Ou(QOt),JEt=Ou(ZOt),KEt=Ou($Ot),QEt=lu("linearLimitSettings"),ZEt=lu("angularLimitSettings"),$Et=lu("linearDriverSettings"),tOt=lu("angularDriverSettings"),NEt((iOt=function(t){function e(){var e;return(e=t.call(this,3)||this)._breakForce=nOt&&nOt(),e._breakTorque=rOt&&rOt(),e._linearLimitSettings=sOt&&sOt(),e._angularLimitSettings=aOt&&aOt(),e._linearDriverSettings=oOt&&oOt(),e._angularDriverSettings=hOt&&hOt(),e._pivotA=uOt&&uOt(),e._pivotB=lOt&&lOt(),e._autoPivotB=cOt&&cOt(),e._axis=fOt&&fOt(),e._secondaryAxis=_Ot&&_Ot(),e._linearLimitSettings=new KOt(e.constraint),e._angularLimitSettings=new QOt(e.constraint),e._linearDriverSettings=new ZOt(e.constraint),e._angularDriverSettings=new $Ot(e.constraint),e}return s(e,t),e.prototype.onLoad=function(){t.prototype.onLoad.call(this),this.linearLimitSettings.impl=this.constraint,this.angularLimitSettings.impl=this.constraint,this.linearDriverSettings.impl=this.constraint,this.angularDriverSettings.impl=this.constraint},n(e,[{key:"axis",get:function(){return this._axis},set:function(t){ir.copy(this._axis,t),this.constraint.setAxis(this._axis)}},{key:"secondaryAxis",get:function(){return this._secondaryAxis},set:function(t){ir.copy(this._secondaryAxis,t),this.constraint.setSecondaryAxis(this._secondaryAxis)}},{key:"pivotA",get:function(){return this._pivotA},set:function(t){ir.copy(this._pivotA,t),this.constraint.setPivotA(this._pivotA)}},{key:"pivotB",get:function(){return this._pivotB},set:function(t){ir.copy(this._pivotB,t),this.constraint.setPivotB(this._pivotB)}},{key:"autoPivotB",get:function(){return this._autoPivotB},set:function(t){this._autoPivotB=t,this.constraint.setAutoPivotB(this._autoPivotB)}},{key:"breakForce",get:function(){return this._breakForce},set:function(t){this._breakForce=t,this.constraint.setBreakForce(t)}},{key:"breakTorque",get:function(){return this._breakTorque},set:function(t){this._breakTorque=t,this.constraint.setBreakTorque(t)}},{key:"linearLimitSettings",get:function(){return this._linearLimitSettings},set:function(t){this._linearLimitSettings=t;var e=this.constraint;e.setConstraintMode(0,t.xMotion),e.setConstraintMode(1,t.yMotion),e.setConstraintMode(2,t.zMotion);var i=t.upper,n=t.lower;e.setLinearLimit(0,n.x,i.x),e.setLinearLimit(1,n.y,i.y),e.setLinearLimit(2,n.z,i.z),e.setLinearSoftConstraint(t.enableSoftConstraint),e.setLinearDamping(t.damping),e.setLinearStiffness(t.stiffness),e.setLinearRestitution(t.restitution)}},{key:"angularLimitSettings",get:function(){return this._angularLimitSettings},set:function(t){this._angularLimitSettings=t;var e=this.constraint;e.setConstraintMode(3,t.twistMotion),e.setConstraintMode(4,t.swingMotion1),e.setConstraintMode(5,t.swingMotion2),e.setAngularExtent(t.twistExtent,t.swingExtent1,t.swingExtent2),e.setTwistRestitution(t.twistRestitution),e.setSwingRestitution(t.swingRestitution),e.setTwistSoftConstraint(t.enableSoftConstraintTwist),e.setSwingSoftConstraint(t.enableSoftConstraintSwing),e.setTwistDamping(t.twistDamping),e.setSwingDamping(t.swingDamping),e.setTwistStiffness(t.twistStiffness),e.setSwingStiffness(t.swingStiffness)}},{key:"linearDriverSettings",get:function(){return this._linearDriverSettings},set:function(t){this._linearDriverSettings=t;var e=this.constraint;e.setDriverMode(0,t.xDrive),e.setDriverMode(1,t.yDrive),e.setDriverMode(2,t.zDrive),e.setLinearMotorTarget(t.targetPosition),e.setLinearMotorVelocity(t.targetVelocity),e.setLinearMotorForceLimit(t.strength)}},{key:"angularDriverSettings",get:function(){return this._angularDriverSettings},set:function(t){this._angularDriverSettings=t;var e=this.constraint;e.setDriverMode(3,t.twistDrive),e.setDriverMode(4,t.swingDrive1),e.setDriverMode(5,t.swingDrive2),e.setAngularMotorTarget(t.targetOrientation),e.setAngularMotorVelocity(t.targetVelocity),e.setAngularMotorForceLimit(t.strength)}},{key:"constraint",get:function(){return this._constraint}}]),e}(ePt),v(iOt.prototype,"axis",[zEt],Object.getOwnPropertyDescriptor(iOt.prototype,"axis"),iOt.prototype),v(iOt.prototype,"secondaryAxis",[UEt],Object.getOwnPropertyDescriptor(iOt.prototype,"secondaryAxis"),iOt.prototype),v(iOt.prototype,"pivotA",[GEt],Object.getOwnPropertyDescriptor(iOt.prototype,"pivotA"),iOt.prototype),v(iOt.prototype,"pivotB",[HEt],Object.getOwnPropertyDescriptor(iOt.prototype,"pivotB"),iOt.prototype),v(iOt.prototype,"autoPivotB",[WEt],Object.getOwnPropertyDescriptor(iOt.prototype,"autoPivotB"),iOt.prototype),v(iOt.prototype,"breakForce",[jEt],Object.getOwnPropertyDescriptor(iOt.prototype,"breakForce"),iOt.prototype),v(iOt.prototype,"breakTorque",[qEt],Object.getOwnPropertyDescriptor(iOt.prototype,"breakTorque"),iOt.prototype),v(iOt.prototype,"linearLimitSettings",[XEt],Object.getOwnPropertyDescriptor(iOt.prototype,"linearLimitSettings"),iOt.prototype),v(iOt.prototype,"angularLimitSettings",[YEt],Object.getOwnPropertyDescriptor(iOt.prototype,"angularLimitSettings"),iOt.prototype),v(iOt.prototype,"linearDriverSettings",[JEt],Object.getOwnPropertyDescriptor(iOt.prototype,"linearDriverSettings"),iOt.prototype),v(iOt.prototype,"angularDriverSettings",[KEt],Object.getOwnPropertyDescriptor(iOt.prototype,"angularDriverSettings"),iOt.prototype),nOt=zh(iOt.prototype,"_breakForce",[uu],(function(){return 1e8})),rOt=zh(iOt.prototype,"_breakTorque",[uu],(function(){return 1e8})),sOt=zh(iOt.prototype,"_linearLimitSettings",[uu,QEt],null),aOt=zh(iOt.prototype,"_angularLimitSettings",[uu,ZEt],null),oOt=zh(iOt.prototype,"_linearDriverSettings",[uu,$Et],null),hOt=zh(iOt.prototype,"_angularDriverSettings",[uu,tOt],null),uOt=zh(iOt.prototype,"_pivotA",[uu],(function(){return new ir})),lOt=zh(iOt.prototype,"_pivotB",[uu],(function(){return new ir})),cOt=zh(iOt.prototype,"_autoPivotB",[uu],(function(){return!1})),fOt=zh(iOt.prototype,"_axis",[uu],(function(){return new ir(0,1,0)})),_Ot=zh(iOt.prototype,"_secondaryAxis",[uu],(function(){return new ir(1,0,0)})),eOt=iOt))||eOt)),ekt=t("fT",(dOt=Kh("cc.PointToPointConstraint"),pOt=Ou(ir),mOt=Ou(ir),dOt((yOt=function(t){function e(){var e;return(e=t.call(this,0)||this)._pivotA=vOt&&vOt(),e._pivotB=bOt&&bOt(),e}return s(e,t),n(e,[{key:"pivotA",get:function(){return this._pivotA},set:function(t){ir.copy(this._pivotA,t),this.constraint.setPivotA(this._pivotA)}},{key:"pivotB",get:function(){return this._pivotB},set:function(t){ir.copy(this._pivotB,t),this.constraint.setPivotB(this._pivotB)}},{key:"constraint",get:function(){return this._constraint}}]),e}(ePt),v(yOt.prototype,"pivotA",[pOt],Object.getOwnPropertyDescriptor(yOt.prototype,"pivotA"),yOt.prototype),v(yOt.prototype,"pivotB",[mOt],Object.getOwnPropertyDescriptor(yOt.prototype,"pivotB"),yOt.prototype),vOt=zh(yOt.prototype,"_pivotA",[uu],(function(){return new ir})),bOt=zh(yOt.prototype,"_pivotB",[uu],(function(){return new ir})),gOt=yOt))||gOt)),ikt=t("fA",(SOt=Kh("cc.CharacterController"),wOt=Ou(HDt.PhysicsGroup),xOt=Ou(ci),TOt=Ou(ci),AOt=Ou(ci),COt=Ou(ci),DOt=Ou(ir),SOt(BOt=$h((IOt=function(t){function e(e){var i;return(i=t.call(this)||this).type=void 0,i._cct=null,i._group=MOt&&MOt(),i._minMoveDistance=POt&&POt(),i._stepOffset=EOt&&EOt(),i._slopeLimit=OOt&&OOt(),i._skinWidth=kOt&&kOt(),i._center=ROt&&ROt(),i._initialized=!1,i._prevPos=new ir,i._currentPos=new ir,i._velocity=new ir,i._centerWorldPosition=new ir,i._needCollisionEvent=!1,i._needTriggerEvent=!1,i.type=e,i}s(e,t);var i=e.prototype;return i.onLoad=function(){ICt.runInEditor&&(this._cct=jCt(this.type),this._initialized=this._cct.initialize(this),this._cct.onLoad())},i.onEnable=function(){this._cct&&this._cct.onEnable()},i.onDisable=function(){this._cct&&this._cct.onDisable()},i.onDestroy=function(){this._cct&&(this._needCollisionEvent=!1,this._needTriggerEvent=!1,this._cct.updateEventListener(),this._cct.onDestroy(),this._cct=null)},i.move=function(t){if(this._isInitialized){this._prevPos.set(this.centerWorldPosition);var e=HDt.instance.fixedTimeStep;this._cct.move(t,this._minMoveDistance,e),this._currentPos.set(this.centerWorldPosition),this._velocity=this._currentPos.subtract(this._prevPos).multiplyScalar(1/e),this._cct.syncPhysicsToScene()}},i.on=function(e,i,n,r){var s=t.prototype.on.call(this,e,i,n,r);return this._updateNeedEvent(e),s},i.off=function(e,i,n){t.prototype.off.call(this,e,i,n),this._updateNeedEvent()},i.once=function(e,i,n){var r=t.prototype.once.call(this,e,i,n);return this._updateNeedEvent(e),r},i.getGroup=function(){return this._isInitialized?this._cct.getGroup():0},i.setGroup=function(t){this._isInitialized&&this._cct.setGroup(t)},i.addGroup=function(t){this._isInitialized&&this._cct.addGroup(t)},i.removeGroup=function(t){this._isInitialized&&this._cct.removeGroup(t)},i.getMask=function(){return this._isInitialized?this._cct.getMask():0},i.setMask=function(t){this._isInitialized&&this._cct.setMask(t)},i.addMask=function(t){this._isInitialized&&this._cct.addMask(t)},i.removeMask=function(t){this._isInitialized&&this._cct.removeMask(t)},i._updateNeedEvent=function(t){this.isValid&&(void 0!==t?("onControllerColliderHit"===t&&(this._needCollisionEvent=!0),"onControllerTriggerEnter"!==t&&"onControllerTriggerStay"!==t&&"onControllerTriggerExit"!==t||(this._needTriggerEvent=!0)):(this.hasEventListener("onControllerColliderHit")||(this._needCollisionEvent=!1),this.hasEventListener("onControllerTriggerEnter")||this.hasEventListener("onControllerTriggerStay")||this.hasEventListener("onControllerTriggerExit")||(this._needTriggerEvent=!1)),this._cct&&this._cct.updateEventListener())},n(e,[{key:"group",get:function(){return this._group},set:function(t){this._group=t,this._cct&&this._cct.getGroup()!==t&&this._cct.setGroup(t)}},{key:"minMoveDistance",get:function(){return this._minMoveDistance},set:function(t){this._minMoveDistance!==t&&(this._minMoveDistance=Math.abs(t))}},{key:"stepOffset",get:function(){return this._stepOffset},set:function(t){this._stepOffset!==t&&(this._stepOffset=Math.abs(t),this._cct&&this._cct.setStepOffset(t))}},{key:"slopeLimit",get:function(){return this._slopeLimit},set:function(t){this._slopeLimit!==t&&(this._slopeLimit=Math.abs(t),this._cct&&this._cct.setSlopeLimit(t))}},{key:"skinWidth",get:function(){return this._skinWidth},set:function(t){this._skinWidth!==t&&(this._skinWidth=Math.abs(t),this._cct&&this._cct.setContactOffset(Math.max(1e-4,t)))}},{key:"center",get:function(){return this._center},set:function(t){ir.equals(this._center,t)||ir.copy(this._center,t)}},{key:"_isInitialized",get:function(){return!(null===this._cct||!this._initialized)}},{key:"centerWorldPosition",get:function(){return this._isInitialized&&this._cct.getPosition(this._centerWorldPosition),this._centerWorldPosition},set:function(t){this._isInitialized&&this._cct.setPosition(t)}},{key:"velocity",get:function(){return this._velocity}},{key:"isGrounded",get:function(){return this._cct.onGround()}},{key:"needCollisionEvent",get:function(){return this._needCollisionEvent}},{key:"needTriggerEvent",get:function(){return this._needTriggerEvent}}]),e}(Bo(yg)),v(IOt.prototype,"group",[wOt],Object.getOwnPropertyDescriptor(IOt.prototype,"group"),IOt.prototype),v(IOt.prototype,"minMoveDistance",[xOt],Object.getOwnPropertyDescriptor(IOt.prototype,"minMoveDistance"),IOt.prototype),v(IOt.prototype,"stepOffset",[TOt],Object.getOwnPropertyDescriptor(IOt.prototype,"stepOffset"),IOt.prototype),v(IOt.prototype,"slopeLimit",[AOt],Object.getOwnPropertyDescriptor(IOt.prototype,"slopeLimit"),IOt.prototype),v(IOt.prototype,"skinWidth",[COt],Object.getOwnPropertyDescriptor(IOt.prototype,"skinWidth"),IOt.prototype),v(IOt.prototype,"center",[DOt],Object.getOwnPropertyDescriptor(IOt.prototype,"center"),IOt.prototype),MOt=zh(IOt.prototype,"_group",[uu],(function(){return 1})),POt=zh(IOt.prototype,"_minMoveDistance",[uu],(function(){return.001})),EOt=zh(IOt.prototype,"_stepOffset",[uu],(function(){return.5})),OOt=zh(IOt.prototype,"_slopeLimit",[uu],(function(){return 45})),kOt=zh(IOt.prototype,"_skinWidth",[uu],(function(){return.01})),ROt=zh(IOt.prototype,"_center",[uu],(function(){return new ir})),BOt=IOt))||BOt)||BOt));new ir(0,0,0);var nkt,rkt,skt,akt,okt,hkt,ukt,lkt,ckt=t("fV",(FOt=Kh("cc.BoxCharacterController"),LOt=Zh(-1),VOt=Ou(ci),NOt=Ou(ci),zOt=Ou(ci),FOt(UOt=LOt((GOt=function(t){function e(){var e;return(e=t.call(this,0)||this)._halfHeight=HOt&&HOt(),e._halfSideExtent=WOt&&WOt(),e._halfForwardExtent=jOt&&jOt(),e}return s(e,t),n(e,[{key:"halfHeight",get:function(){return this._halfHeight},set:function(t){this._halfHeight!==t&&(this._halfHeight=Math.abs(t),this._cct&&this._cct.setHalfHeight(t))}},{key:"halfSideExtent",get:function(){return this._halfSideExtent},set:function(t){this._halfSideExtent!==t&&(this._halfSideExtent=Math.abs(t),this._cct&&this._cct.setHalfSideExtent(t))}},{key:"halfForwardExtent",get:function(){return this._halfForwardExtent},set:function(t){this._halfForwardExtent!==t&&(this._halfForwardExtent=Math.abs(t),this._cct&&this._cct.setHalfForwardExtent(t))}}]),e}(ikt),v(GOt.prototype,"halfHeight",[VOt],Object.getOwnPropertyDescriptor(GOt.prototype,"halfHeight"),GOt.prototype),v(GOt.prototype,"halfSideExtent",[NOt],Object.getOwnPropertyDescriptor(GOt.prototype,"halfSideExtent"),GOt.prototype),v(GOt.prototype,"halfForwardExtent",[zOt],Object.getOwnPropertyDescriptor(GOt.prototype,"halfForwardExtent"),GOt.prototype),HOt=zh(GOt.prototype,"_halfHeight",[uu],(function(){return.5})),WOt=zh(GOt.prototype,"_halfSideExtent",[uu],(function(){return.5})),jOt=zh(GOt.prototype,"_halfForwardExtent",[uu],(function(){return.5})),UOt=GOt))||UOt)||UOt));new ir(0,0,0);var fkt=t("fU",(nkt=Kh("cc.CapsuleCharacterController"),rkt=Zh(-1),skt=Ou(ci),akt=Ou(ci),nkt(okt=rkt((hkt=function(t){function e(){var e;return(e=t.call(this,1)||this)._radius=ukt&&ukt(),e._height=lkt&&lkt(),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._cct&&this._cct.setRadius(t))}},{key:"height",get:function(){return this._height},set:function(t){this._height!==t&&(this._height=Math.abs(t),this._cct&&this._cct.setHeight(t))}}]),e}(ikt),v(hkt.prototype,"radius",[skt],Object.getOwnPropertyDescriptor(hkt.prototype,"radius"),hkt.prototype),v(hkt.prototype,"height",[akt],Object.getOwnPropertyDescriptor(hkt.prototype,"height"),hkt.prototype),ukt=zh(hkt.prototype,"_radius",[uu],(function(){return.5})),lkt=zh(hkt.prototype,"_height",[uu],(function(){return 1})),okt=hkt))||okt)||okt)),_kt=function(){this.worldPosition=new ir,this.worldNormal=new ir,this.motionDirection=new ir,this.motionLength=0};A.PhysicsSystem=HDt,A.PhysicsMaterial=xDt,A.PhysicsRayResult=TDt,A.ConstantForce=CIt;var dkt=Object.freeze({__proto__:null,BoxCharacterController:ckt,BoxCollider:bIt,CapsuleCharacterController:fkt,CapsuleCollider:wIt,CharacterController:ikt,CharacterControllerContact:_kt,get Collider(){return oBt},ConeCollider:TIt,ConfigurableConstraint:tkt,ConstantForce:CIt,get Constraint(){return ePt},CylinderCollider:xIt,EAxisDirection:gwt,ECharacterControllerType:Twt,EColliderType:bwt,EConstraintMode:wwt,EConstraintType:Swt,ED6Axis:ywt,EDriverMode:xwt,EPhysicsDrawFlags:Kwt,ERigidBodyType:mwt,ESimplexType:vwt,FixedConstraint:JOt,HingeConstraint:YOt,MeshCollider:AIt,PhysicsGroup:Awt,PhysicsLineStripCastResult:ADt,PhysicsMaterial:xDt,PhysicsRayResult:TDt,PhysicsSystem:HDt,PlaneCollider:tPt,PointToPointConstraint:ekt,get RigidBody(){return eBt},get SimplexCollider(){return QIt},SphereCollider:SIt,TerrainCollider:KIt,selector:ICt,utils:YK});t("fx",dkt),pt(HDt,"PhysicsSystem",[{name:"ins",newName:"instance"},{name:"PHYSICS_AMMO",newName:"PHYSICS_BULLET"}]),pt(HDt.prototype,"PhysicsSystem.prototype",[{name:"deltaTime",newName:"fixedTimeStep"},{name:"maxSubStep",newName:"maxSubSteps"}]),mt(HDt.prototype,"PhysicsSystem.prototype",[{name:"useFixedTime"},{name:"useCollisionMatrix"},{name:"updateCollisionMatrix"},{name:"resetCollisionMatrix"},{name:"isCollisionGroup"},{name:"setCollisionGroup"}]),pt(oBt.prototype,"Collider.prototype",[{name:"attachedRigidbody",newName:"attachedRigidBody"},{name:"TYPE",newName:"type"}]),pt(oBt,"Collider",[{name:"EColliderType",newName:"Type"},{name:"EAxisDirection",newName:"Axis"}]),pt(ePt,"Constraint",[{name:"EConstraintType",newName:"Type"}]),pt(bIt.prototype,"BoxCollider.prototype",[{name:"boxShape",newName:"shape"}]),pt(SIt.prototype,"SphereCollider.prototype",[{name:"sphereShape",newName:"shape"}]),pt(wIt.prototype,"CapsuleCollider.prototype",[{name:"capsuleShape",newName:"shape"}]),pt(eBt.prototype,"RigidBody.prototype",[{name:"rigidBody",newName:"body"}]),pt(eBt,"RigidBody",[{name:"ERigidBodyType",newName:"Type"}]),mt(eBt.prototype,"RigidBody.prototype",[{name:"fixedRotation"}]),A.RigidBodyComponent=eBt,le(eBt,"cc.RigidBodyComponent"),A.ColliderComponent=oBt,le(oBt,"cc.ColliderComponent"),A.BoxColliderComponent=bIt,le(bIt,"cc.BoxColliderComponent"),A.SphereColliderComponent=SIt,le(SIt,"cc.SphereColliderComponent"),le(wIt,"cc.CapsuleColliderComponent"),le(AIt,"cc.MeshColliderComponent"),le(xIt,"cc.CylinderColliderComponent"),A.PhysicMaterial=xDt,le(xDt,"cc.PhysicMaterial"),A.physics=dkt;var pkt=ZCt,mkt=$Ct,gkt=function(){var t=e.prototype;function e(){this.id=void 0,this._isEnabled=!1,this._isUsingCCD=!1,this._sharedBody=void 0,this._rigidBody=void 0,this.id=e.idCounter++}return t.setMass=function(t){this._rigidBody.isDynamic&&(qCt.RigidBody_setMass(this.impl,t),this._wakeUpIfSleep(),this._sharedBody.dirty|=1)},t.setType=function(t){this._sharedBody.setType(t)},t.setLinearDamping=function(){qCt.RigidBody_setDamping(this.impl,this._rigidBody.linearDamping,this._rigidBody.angularDamping)},t.setAngularDamping=function(){qCt.RigidBody_setDamping(this.impl,this._rigidBody.linearDamping,this._rigidBody.angularDamping)},t.useGravity=function(t){if(this._rigidBody.isDynamic){var e=qCt.RigidBody_getFlags(this.impl);t?e&=-2:(qCt.RigidBody_setGravity(this.impl,gDt(QCt.instance.BT_V3_0,ir.ZERO)),e|=1),qCt.RigidBody_setFlags(this.impl,e),this._wakeUpIfSleep(),this._sharedBody.dirty|=1}},t.useCCD=function(t){qCt.CollisionObject_setCcdMotionThreshold(this.impl,t?.01:0),qCt.CollisionObject_setCcdSweptSphereRadius(this.impl,t?.1:0),this._isUsingCCD=t},t.isUsingCCD=function(){return this._isUsingCCD},t.setLinearFactor=function(t){qCt.RigidBody_setLinearFactor(this.impl,gDt(QCt.instance.BT_V3_0,t)),this._wakeUpIfSleep()},t.setAngularFactor=function(t){qCt.RigidBody_setAngularFactor(this.impl,gDt(QCt.instance.BT_V3_0,t)),this._wakeUpIfSleep()},t.setAllowSleep=function(t){this._rigidBody.isDynamic&&(t?qCt.CollisionObject_forceActivationState(this.impl,1):qCt.CollisionObject_forceActivationState(this.impl,4),this._wakeUpIfSleep())},t.clearState=function(){qCt.RigidBody_clearState(this.impl)},t.clearVelocity=function(){this.setLinearVelocity(ir.ZERO),this.setAngularVelocity(ir.ZERO)},t.clearForces=function(){qCt.RigidBody_clearForces(this.impl)},t.initialize=function(t){this._rigidBody=t,this._sharedBody=HDt.instance.physicsWorld.getSharedBody(this._rigidBody.node,this),this._sharedBody.reference=!0},t.onEnable=function(){this._isEnabled=!0,this.setMass(this._rigidBody.mass),this.setAllowSleep(this._rigidBody.allowSleep),this.setLinearDamping(this._rigidBody.linearDamping),this.setAngularDamping(this._rigidBody.angularDamping),this.setLinearFactor(this._rigidBody.linearFactor),this.setAngularFactor(this._rigidBody.angularFactor),this.useGravity(this._rigidBody.useGravity),this._sharedBody.bodyEnabled=!0},t.onDisable=function(){this._isEnabled=!1,this._sharedBody.bodyEnabled=!1},t.onDestroy=function(){this._sharedBody.reference=!1,this._rigidBody=null,this._sharedBody=null},t.wakeUp=function(t){void 0===t&&(t=!0),qCt.CollisionObject_activate(this.impl,t)},t.sleep=function(){var t=qCt.CollisionObject_getActivationState(this.impl);4!==t&&5!==t&&qCt.CollisionObject_forceActivationState(this.impl,2)},t.setSleepThreshold=function(t){this._wakeUpIfSleep(),qCt.RigidBody_setSleepingThresholds(this.impl,t,t)},t.getSleepThreshold=function(){return qCt.RigidBody_getLinearSleepingThreshold(this.impl)},t.getLinearVelocity=function(t){return yDt(t,qCt.RigidBody_getLinearVelocity(this.impl))},t.setLinearVelocity=function(t){this._wakeUpIfSleep(),gDt(qCt.RigidBody_getLinearVelocity(this.impl),t)},t.getAngularVelocity=function(t){return yDt(t,qCt.RigidBody_getAngularVelocity(this.impl))},t.setAngularVelocity=function(t){this._wakeUpIfSleep(),gDt(qCt.RigidBody_getAngularVelocity(this.impl),t)},t.applyLocalForce=function(t,e){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep();var i=this._sharedBody.node.worldRotation,n=ir.transformQuat(pkt,t,i),r=e?ir.transformQuat(mkt,e,i):ir.ZERO;qCt.RigidBody_applyForce(this.impl,gDt(QCt.instance.BT_V3_0,n),gDt(QCt.instance.BT_V3_1,r))},t.applyLocalTorque=function(t){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep(),ir.transformQuat(pkt,t,this._sharedBody.node.worldRotation),qCt.RigidBody_applyTorque(this.impl,gDt(QCt.instance.BT_V3_0,pkt))},t.applyLocalImpulse=function(t,e){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep();var i=this._sharedBody.node.worldRotation,n=ir.transformQuat(pkt,t,i),r=e?ir.transformQuat(mkt,e,i):ir.ZERO;qCt.RigidBody_applyImpulse(this.impl,gDt(QCt.instance.BT_V3_0,n),gDt(QCt.instance.BT_V3_1,r))},t.applyForce=function(t,e){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep();var i=e||ir.ZERO;qCt.RigidBody_applyForce(this.impl,gDt(QCt.instance.BT_V3_0,t),gDt(QCt.instance.BT_V3_1,i))},t.applyTorque=function(t){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep(),qCt.RigidBody_applyTorque(this.impl,gDt(QCt.instance.BT_V3_0,t))},t.applyImpulse=function(t,e){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep();var i=e||ir.ZERO;qCt.RigidBody_applyImpulse(this.impl,gDt(QCt.instance.BT_V3_0,t),gDt(QCt.instance.BT_V3_1,i))},t.getGroup=function(){return this._sharedBody.collisionFilterGroup},t.setGroup=function(t){this._sharedBody.collisionFilterGroup=t},t.addGroup=function(t){this._sharedBody.collisionFilterGroup|=t},t.removeGroup=function(t){this._sharedBody.collisionFilterGroup&=~t},t.getMask=function(){return this._sharedBody.collisionFilterMask},t.setMask=function(t){this._sharedBody.collisionFilterMask=t},t.addMask=function(t){this._sharedBody.collisionFilterMask|=t},t.removeMask=function(t){this._sharedBody.collisionFilterMask&=~t},t._wakeUpIfSleep=function(){this.isAwake||qCt.CollisionObject_activate(this.impl,!0)},n(e,[{key:"isAwake",get:function(){var t=qCt.CollisionObject_getActivationState(this.impl);return 1===t||4===t}},{key:"isSleepy",get:function(){return 3===qCt.CollisionObject_getActivationState(this.impl)}},{key:"isSleeping",get:function(){return 2===qCt.CollisionObject_getActivationState(this.impl)}},{key:"impl",get:function(){return this._sharedBody.body}},{key:"rigidBody",get:function(){return this._rigidBody}},{key:"sharedBody",get:function(){return this._sharedBody}},{key:"isEnabled",get:function(){return this._isEnabled}}]),e}();gkt.idCounter=0;var ykt={syncPhysicsToGraphics:function(t){XCt.CACHE.getWrapper(t,XCt.BODY_CACHE_NAME).syncPhysicsToGraphics()},onShapeHitExt:function(t,e){XCt.CACHE.getWrapper(e,XCt.CCT_CACHE_NAME).onShapeHitExt(t)},onDebugDrawLine:function(t,e,i){var n=XCt.CACHE.world;n&&n.onDebugDrawLine(t,e,i)},clearLines:function(){var t=XCt.CACHE.world;t&&t.onClearLines()},flushLines:function(){}},vkt=ZCt,bkt=eDt,Skt=0,wkt=function(){function t(e,i){this.id=void 0,this.node=void 0,this.wrappedWorld=void 0,this.wrappedJoints0=[],this.wrappedJoints1=[],this.dirty=0,this._collisionFilterGroup=1,this._collisionFilterMask=-1,this.ref=0,this.bodyIndex=-1,this.ghostIndex=-1,this._bodyStruct=void 0,this._ghostStruct=void 0,this._wrappedBody=null,this.id=t.idCounter++,this.wrappedWorld=i,this.node=e}t.getSharedBody=function(e,i,n){var r,s=e.uuid;if(t.sharedBodesMap.has(s))r=t.sharedBodesMap.get(s);else{r=new t(e,i);var a=HDt.instance.collisionMatrix[1];r._collisionFilterGroup=1,r._collisionFilterMask=a,t.sharedBodesMap.set(e.uuid,r)}if(n){r._wrappedBody=n;var o=n.rigidBody.group,h=HDt.instance.collisionMatrix[o];r._collisionFilterGroup=o,r._collisionFilterMask=h}return r};var e=t.prototype;return e._instantiateBodyStruct=function(){if(!this._bodyStruct){var t=0;this._wrappedBody&&this._wrappedBody.rigidBody.enabled&&this._wrappedBody.rigidBody.isDynamic&&(t=this._wrappedBody.rigidBody.mass);var e=QCt.instance.BT_TRANSFORM_0,i=QCt.instance.BT_QUAT_0;gDt(qCt.Transform_getOrigin(e),this.node.worldPosition),vDt(i,this.node.worldRotation),qCt.Transform_setRotation(e,i);var n=qCt.MotionState.implement(ykt).$$.ptr;qCt.ccMotionState_setup(n,this.id,e);var r=qCt.RigidBody_new(t,n),s=HDt.instance.sleepThreshold;qCt.RigidBody_setSleepingThresholds(r,s,s),this._bodyStruct={id:Skt++,body:r,motionState:n,compound:qCt.ccCompoundShape_new(),wrappedShapes:[],useCompound:!1},QCt.setWrapper(this.id,XCt.BODY_CACHE_NAME,this),this._ghostStruct&&qCt.CollisionObject_setIgnoreCollisionCheck(this.ghost,this.body,!0),this._wrappedBody&&this.setBodyType(this._wrappedBody.rigidBody.type)}},e._instantiateGhostStruct=function(){if(!this._ghostStruct){var t=qCt.CollisionObject_new(),e=qCt.ccCompoundShape_new();qCt.CollisionObject_setCollisionShape(t,e),qCt.CollisionObject_setCollisionFlags(t,5),this._ghostStruct={id:Skt++,ghost:t,compound:e,wrappedShapes:[]},this._bodyStruct&&qCt.CollisionObject_setIgnoreCollisionCheck(this.body,this.ghost,!0),this._wrappedBody&&this.setGhostType(this._wrappedBody.rigidBody.type)}},e.setType=function(t){this.setBodyType(t),this.setGhostType(t)},e.setBodyType=function(t){if(this._bodyStruct&&this._wrappedBody){var e=this._bodyStruct.body,i=this._wrappedBody,n=i.rigidBody,r=qCt.CollisionObject_getCollisionFlags(e),s=QCt.instance.BT_V3_0;switch(t){case 1:r&=-3,r&=-2,qCt.CollisionObject_setCollisionFlags(e,r),i.setMass(n.mass),i.useGravity(n.useGravity),i.setAllowSleep(n.allowSleep);break;case 4:qCt.Vec3_set(s,0,0,0),qCt.RigidBody_setMassProps(e,0,s),r|=2,r&=-2,qCt.CollisionObject_setCollisionFlags(e,r),qCt.CollisionObject_forceActivationState(e,4);break;default:qCt.Vec3_set(s,0,0,0),qCt.RigidBody_setMassProps(e,0,s),r|=1,r&=-3,qCt.CollisionObject_setCollisionFlags(e,r),qCt.CollisionObject_forceActivationState(e,2)}this.dirty|=1}},e.setGhostType=function(t){if(this._ghostStruct){var e=this._ghostStruct.ghost,i=qCt.CollisionObject_getCollisionFlags(e);switch(t){case 1:case 4:i&=-2,i|=2,qCt.CollisionObject_setCollisionFlags(e,i),qCt.CollisionObject_forceActivationState(e,4);break;default:i&=-3,i|=1,qCt.CollisionObject_setCollisionFlags(e,i),qCt.CollisionObject_forceActivationState(e,2)}this.dirty|=2}},e.addShape=function(t,e){function i(t,e){qCt.CollisionObject_setCollisionShape(t.body,e),t.dirty|=1,t._wrappedBody&&t._wrappedBody.isEnabled&&t._wrappedBody.setMass(t._wrappedBody.rigidBody.mass)}if(e)this.ghostStruct.wrappedShapes.indexOf(t)<0&&(this.ghostStruct.wrappedShapes.push(t),t.setCompound(this.ghostCompoundShape),this.ghostEnabled=!0);else if(this.bodyStruct.wrappedShapes.indexOf(t)<0){if(this.bodyStruct.wrappedShapes.push(t),this.bodyStruct.useCompound)t.setCompound(this.bodyCompoundShape);else{var n=this.bodyStruct.wrappedShapes.length;if(1!==n||t.needCompound()){this.bodyStruct.useCompound=!0;for(var r=0;r<n;r++)this.bodyStruct.wrappedShapes[r].setCompound(this.bodyCompoundShape);i(this,this.bodyStruct.compound)}else i(this,t.impl)}this.bodyEnabled=!0}},e.removeShape=function(t,e){if(e){var i=this.ghostStruct.wrappedShapes.indexOf(t);i>=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):qCt.CollisionObject_setCollisionShape(this.body,qCt.EmptyShape_static()),qCt.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=QCt.instance.BT_QUAT_0,e=qCt.CollisionObject_getWorldTransform(this.body);if(vDt(t,this.node.worldRotation),gDt(qCt.Transform_getOrigin(e),this.node.worldPosition),qCt.Transform_setRotation(e,t),4&this.node.hasChangedFlags&&this.syncBodyScale(),qCt.CollisionObject_isKinematicObject(this.body)){var i=qCt.RigidBody_getMotionState(this.body);i&&qCt.MotionState_setWorldTransform(i,e)}else this.isBodySleeping()&&qCt.CollisionObject_activate(this.body,!1)}},e.syncPhysicsToScene=function(){qCt.CollisionObject_isStaticOrKinematicObject(this.body)||this.syncPhysicsToGraphics()},e.syncPhysicsToGraphics=function(){if(!this.isBodySleeping()){var t=QCt.instance.BT_QUAT_0,e=QCt.instance.BT_TRANSFORM_0;qCt.RigidBody_getWorldTransform(this.body,e);var i=qCt.Transform_getRotationAndOrigin(e,t);if(this.node.worldRotation=bDt(bkt,t),this.node.worldPosition=yDt(vkt,i),this._ghostStruct){var n=qCt.CollisionObject_getWorldTransform(this.ghost);gDt(qCt.Transform_getOrigin(n),this.node.worldPosition),vDt(t,this.node.worldRotation),qCt.Transform_setRotation(n,t)}}},e.syncSceneToGhost=function(){if(this.node.hasChangedFlags){var t=QCt.instance.BT_QUAT_0,e=qCt.CollisionObject_getWorldTransform(this.ghost);gDt(qCt.Transform_getOrigin(e),this.node.worldPosition),vDt(t,this.node.worldRotation),qCt.Transform_setRotation(e,t),4&this.node.hasChangedFlags&&this.syncGhostScale(),qCt.CollisionObject_activate(this.ghost,!1)}},e.syncInitialBody=function(){var t=QCt.instance.BT_QUAT_0,e=qCt.CollisionObject_getWorldTransform(this.body);gDt(qCt.Transform_getOrigin(e),this.node.worldPosition),vDt(t,this.node.worldRotation),qCt.Transform_setRotation(e,t),this.syncBodyScale(),qCt.CollisionObject_activate(this.body,!1)},e.syncInitialGhost=function(){var t=QCt.instance.BT_QUAT_0,e=qCt.CollisionObject_getWorldTransform(this.ghost);gDt(qCt.Transform_getOrigin(e),this.node.worldPosition),vDt(t,this.node.worldRotation),qCt.Transform_setRotation(e,t),this.syncGhostScale(),qCt.CollisionObject_activate(this.body,!1)},e.syncBodyScale=function(){for(var t=0;t<this.bodyStruct.wrappedShapes.length;t++)this.bodyStruct.wrappedShapes[t].updateScale();for(var e=0;e<this.wrappedJoints0.length;e++)this.wrappedJoints0[e].updateScale0();for(var i=0;i<this.wrappedJoints1.length;i++)this.wrappedJoints1[i].updateScale1()},e.syncGhostScale=function(){for(var t=0;t<this.ghostStruct.wrappedShapes.length;t++)this.ghostStruct.wrappedShapes[t].updateScale()},e.updateBodyByReAdd=function(){this.bodyIndex>=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;QCt.delWrapper(this.id,XCt.BODY_CACHE_NAME),qCt._safe_delete(e.motionState,3),qCt._safe_delete(e.compound,5),qCt._safe_delete(e.body,4),this._bodyStruct=null}if(this._ghostStruct){var i=this._ghostStruct;qCt._safe_delete(i.compound,5),qCt._safe_delete(i.ghost,4),this._ghostStruct=null}},e.isBodySleeping=function(){return qCt.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)&&(qCt.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}();wkt.idCounter=0,wkt.sharedBodesMap=new Map;var xkt=ZCt,Tkt={},Akt=function(){function t(){this.id=t.idCounter++,this._isEnabled=!1,this._isTrigger=!1,this._isInitialized=!1,this._impl=0,this._compound=0,this.quat=qCt.Quat_new(0,0,0,1),this.transform=qCt.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?HDt.instance.defaultMaterial:t;if(!this._isTrigger&&this._isEnabled)if(this._compound){Tkt[e._uuid]||(Tkt[e._uuid]=qCt.ccMaterial_new());var i=Tkt[e._uuid];qCt.ccMaterial_set(i,e.restitution,e.friction,e.rollingFriction,e.spinningFriction),qCt.CollisionShape_setMaterial(this._impl,i)}else qCt.CollisionObject_setMaterial(this._sharedBody.body,e.restitution,e.friction,e.rollingFriction,e.spinningFriction)},e.setCenter=function(t){ir.copy(xkt,t),xkt.multiply(this._collider.node.worldScale),gDt(qCt.Transform_getOrigin(this.transform),xkt),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=QCt.instance.BT_TRANSFORM_0;qCt.Transform_setIdentity(e),qCt.Transform_setRotation(e,vDt(QCt.instance.BT_QUAT_0,this._collider.node.worldRotation));var i=QCt.instance.BT_V3_0,n=QCt.instance.BT_V3_1;qCt.CollisionShape_getAabb(this._impl,e,i,n),t.halfExtents.x=(qCt.Vec3_x(n)-qCt.Vec3_x(i))/2,t.halfExtents.y=(qCt.Vec3_y(n)-qCt.Vec3_y(i))/2,t.halfExtents.z=(qCt.Vec3_z(n)-qCt.Vec3_z(i))/2,ir.add(t.center,this._collider.node.worldPosition,this._collider.center)},e.getBoundingSphere=function(t){t.radius=qCt.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=HDt.instance.physicsWorld.getSharedBody(this._collider.node),this._sharedBody.reference=!0,this.onComponentSet(),this.setWrapper()},e.setWrapper=function(){QCt.isNotEmptyShape(this._impl)&&(qCt.CollisionShape_setUserPointer(this._impl,this._impl),QCt.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,qCt._safe_delete(this.quat,1),qCt._safe_delete(this.transform,2),this._compound&&qCt._safe_delete(this._compound,5),QCt.isNotEmptyShape(this._impl)&&(qCt._safe_delete(this._impl,5),QCt.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&&qCt.CompoundShape_removeChildShape(this._compound,this._impl),t&&qCt.CompoundShape_addChildShape(t,this.transform,this._impl),this._compound=t},e.updateScale=function(){this.setCenter(this._collider.center)},e.updateCompoundTransform=function(){this._compound?qCt.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}();Akt.TYPE="shape",Akt.idCounter=0;var Ckt=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}(),Dkt=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}(),Bkt=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&&yDt(t,qCt.ManifoldPoint_get_m_localPointA(this.impl))},e.getLocalPointOnB=function(t){this.impl&&yDt(t,qCt.ManifoldPoint_get_m_localPointB(this.impl))},e.getWorldPointOnA=function(t){this.impl&&yDt(t,qCt.ManifoldPoint_get_m_positionWorldOnA(this.impl))},e.getWorldPointOnB=function(t){this.impl&&yDt(t,qCt.ManifoldPoint_get_m_positionWorldOnB(this.impl))},e.getLocalNormalOnA=function(t){if(this.impl){var e=QCt.instance.BT_QUAT_0,i=qCt.PersistentManifold_getBody0(this.event.impl),n=qCt.CollisionObject_getWorldTransform(i);qCt.Transform_getRotation(n,e);var r=eDt;bDt(r,e),kr.conjugate(r,r),yDt(t,qCt.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=QCt.instance.BT_QUAT_0,i=qCt.PersistentManifold_getBody1(this.event.impl),n=qCt.CollisionObject_getWorldTransform(i);qCt.Transform_getRotation(n,e);var r=eDt;bDt(r,e),kr.conjugate(r,r),yDt(t,qCt.ManifoldPoint_get_m_normalWorldOnB(this.impl)),ir.transformQuat(t,t,r)}},e.getWorldNormalOnA=function(t){this.impl&&(yDt(t,qCt.ManifoldPoint_get_m_normalWorldOnB(this.impl)),this.isBodyA||ir.negate(t,t))},e.getWorldNormalOnB=function(t){this.impl&&yDt(t,qCt.ManifoldPoint_get_m_normalWorldOnB(this.impl))},n(t,[{key:"isBodyA",get:function(){return this.event.selfCollider.shape.sharedBody.body===qCt.PersistentManifold_getBody0(this.event.impl)}}]),t}(),Ikt=[],Mkt=ZCt,Pkt=$Ct,Ekt=tDt,Okt=mDt,kkt=new _kt,Rkt=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 Ckt,this.characterControllerArrayMat=new Ckt,this.collisionArrayMat=new Ckt,this.contactsDic=new Dkt,this.oldContactsDic=new Dkt,this.cctShapeEventDic=new Dkt,this.cctContactsDic=new Dkt,this.cctOldContactsDic=new Dkt,XCt.CACHE.world=this,this._broadphase=qCt.DbvtBroadphase_new(),this._dispatcher=qCt.CollisionDispatcher_new(),this._solver=qCt.SequentialImpulseConstraintSolver_new(),this._world=qCt.ccDiscreteDynamicsWorld_new(this._dispatcher,this._broadphase,this._solver);var t=qCt.DebugDraw.implement(ykt);this._debugDraw=t.$$.ptr,qCt.CollisionWorld_setDebugDrawer(this._world,this._debugDraw),qCt.DebugDraw_setDebugMode(this._debugDraw,0),qCt.DebugDraw_setAABBColor(this._debugDraw,0,1,1),qCt.DebugDraw_setActiveObjectColor(this._debugDraw,1,0,1),qCt.DebugDraw_setDeactiveObjectColor(this._debugDraw,1,0,1),qCt.DebugDraw_setWantsDeactivationObjectColor(this._debugDraw,1,0,1),qCt.DebugDraw_setDisabledDeactivationObjectColor(this._debugDraw,1,0,1),qCt.DebugDraw_setDisabledSimulationObjectColor(this._debugDraw,1,0,1),qCt.DebugDraw_setConstraintLimitColor(this._debugDraw,.5,.5,.5)}return t.setDefaultMaterial=function(){},t.setAllowSleep=function(t){qCt.ccDiscreteDynamicsWorld_setAllowSleep(this._world,t)},t.setGravity=function(t){qCt.DynamicsWorld_setGravity(this._world,gDt(QCt.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<this.ghosts.length;e++)for(var i=this.ghosts[e].ghostStruct.wrappedShapes,n=0;n<i.length;n++){var r=i[n].collider;if(r.needCollisionEvent||r.needTriggerEvent)return void(this._needEmitEvents=!0)}for(var s=0;s<this.bodies.length;s++)for(var a=this.bodies[s].bodyStruct.wrappedShapes,o=0;o<a.length;o++){var h=a[o].collider;if(h.needCollisionEvent||h.needTriggerEvent)return void(this._needEmitEvents=!0)}}},t.updateNeedEmitCCTEvents=function(t){if(this.ccts)if(t)this._needEmitCCTEvents=!0;else{this._needEmitCCTEvents=!1;for(var e=this.ccts,i=e.length,n=0;n<i;n++)if(e[n].characterController.needCollisionEvent)return void(this._needEmitCCTEvents=!0)}},t.destroy=function(){(this.constraints.length||this.bodies.length||this.ccts.length)&&J("You should destroy all physics component first."),qCt._safe_delete(this._world,12),qCt._safe_delete(this._broadphase,10),qCt._safe_delete(this._dispatcher,9),qCt._safe_delete(this._solver,11),qCt._safe_delete(this._debugDraw,14),this.bodies=null,this.ghosts=null,this.ccts=null,this.constraints=null,this.triggerArrayMat=null,this.characterControllerArrayMat=null,this.collisionArrayMat=null,this.contactsDic=null,this.oldContactsDic=null,this.cctShapeEventDic=null,this.cctShapeEventPool=null,Ikt.length=0},t.step=function(t,e,i){void 0===i&&(i=0),(this.bodies.length||this.ghosts.length)&&(void 0===e&&(e=t),qCt.DynamicsWorld_stepSimulation(this._world,e,i,t),qCt.CollisionWorld_debugDrawWorld(this._world))},t.syncSceneToPhysics=function(){for(var t=this.ghosts.length-1;t>=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(Mkt,e.maxDistance);var r=gDt(QCt.instance.BT_V3_0,Mkt),s=gDt(QCt.instance.BT_V3_1,t.o),a=qCt.ccAllRayCallback_static();if(qCt.ccAllRayCallback_reset(a,s,r,e.mask>>>0,e.queryTrigger),qCt.ccAllRayCallback_setFlags(a,4),qCt.CollisionWorld_rayTest(this._world,s,r,a),qCt.RayCallback_hasHit(a)){for(var o=qCt.ccAllRayCallback_getHitPointWorld(a),h=qCt.ccAllRayCallback_getHitNormalWorld(a),u=qCt.ccAllRayCallback_getCollisionShapePtrs(a),l=qCt.ccAllRayCallback_getClosestHitFraction(a),c=0,f=qCt.int_array_size(u);c<f;c++){yDt(Mkt,qCt.Vec3_array_at(o,c)),yDt(Pkt,qCt.Vec3_array_at(h,c));var _=QCt.getWrapper(qCt.int_array_at(u,c),Akt.TYPE),d=i.add();n.push(d),d._assign(Mkt,ir.distance(t.o,Mkt),_.collider,Pkt,l)}return!0}return!1},t.raycastClosest=function(t,e,i){t.computeHit(Mkt,e.maxDistance);var n=gDt(QCt.instance.BT_V3_0,Mkt),r=gDt(QCt.instance.BT_V3_1,t.o),s=qCt.ccClosestRayCallback_static();if(qCt.ccClosestRayCallback_reset(s,r,n,e.mask>>>0,e.queryTrigger),qCt.ccClosestRayCallback_setFlags(s,4),qCt.CollisionWorld_rayTest(this._world,r,n,s),qCt.RayCallback_hasHit(s)){yDt(Mkt,qCt.ccClosestRayCallback_getHitPointWorld(s)),yDt(Pkt,qCt.ccClosestRayCallback_getHitNormalWorld(s));var a=QCt.getWrapper(qCt.ccClosestRayCallback_getCollisionShapePtr(s),Akt.TYPE),o=qCt.ccClosestConvexCallback_getClosestHitFraction(s);return i._assign(Mkt,ir.distance(t.o,Mkt),a.collider,Pkt,o),!0}return!1},t.sweepBox=function(t,i,n,r,s,a){var o=QCt.instance.BT_V3_0;return gDt(o,i),e._sweepBoxGeometry||(e._sweepBoxGeometry=qCt.BoxShape_new(o)),qCt.BoxShape_setUnscaledHalfExtents(e._sweepBoxGeometry,o),this.sweep(t,e._sweepBoxGeometry,n,r,s,a)},t.sweepBoxClosest=function(t,i,n,r,s){var a=QCt.instance.BT_V3_0;return gDt(a,i),e._sweepBoxGeometry||(e._sweepBoxGeometry=qCt.BoxShape_new(a)),qCt.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=qCt.SphereShape_new(i)),qCt.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=qCt.SphereShape_new(i)),qCt.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=qCt.CapsuleShape_new(i,n)),qCt.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=qCt.CapsuleShape_new(i,n)),qCt.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=QCt.instance.BT_TRANSFORM_0,o=QCt.instance.BT_TRANSFORM_1,h=QCt.instance.BT_QUAT_0;gDt(qCt.Transform_getOrigin(a),t.o),vDt(h,i),qCt.Transform_setRotation(a,h),t.computeHit(Mkt,n.maxDistance),gDt(qCt.Transform_getOrigin(o),Mkt),vDt(h,i),qCt.Transform_setRotation(o,h);var u=qCt.ccAllConvexCallback_static();if(qCt.ccAllConvexCallback_reset(u,a,o,n.mask>>>0,n.queryTrigger),qCt.CollisionWorld_convexSweepTest(this._world,e,a,o,u,0),qCt.ConvexCallback_hasHit(u)){for(var l=qCt.ccAllConvexCallback_getHitPointWorld(u),c=qCt.ccAllConvexCallback_getHitNormalWorld(u),f=qCt.ccAllConvexCallback_getCollisionShapePtrs(u),_=qCt.ccAllConvexCallback_getClosestHitFraction(u),d=0,p=qCt.int_array_size(f);d<p;d++){yDt(Mkt,qCt.Vec3_array_at(l,d)),yDt(Pkt,qCt.Vec3_array_at(c,d));var m=QCt.getWrapper(qCt.int_array_at(f,d),Akt.TYPE),g=r.add();s.push(g),g._assign(Mkt,ir.distance(t.o,Mkt),m.collider,Pkt,_)}return!0}return!1},t.sweepClosest=function(t,e,i,n,r){var s=QCt.instance.BT_TRANSFORM_0,a=QCt.instance.BT_TRANSFORM_1,o=QCt.instance.BT_QUAT_0;gDt(qCt.Transform_getOrigin(s),t.o),vDt(o,i),qCt.Transform_setRotation(s,o),t.computeHit(Mkt,n.maxDistance),gDt(qCt.Transform_getOrigin(a),Mkt),vDt(o,i),qCt.Transform_setRotation(a,o);var h=qCt.ccClosestConvexCallback_static();if(qCt.ccClosestConvexCallback_reset(h,s,a,n.mask>>>0,n.queryTrigger),qCt.CollisionWorld_convexSweepTest(this._world,e,s,a,h,0),qCt.ConvexCallback_hasHit(h)){yDt(Mkt,qCt.ccClosestConvexCallback_getHitPointWorld(h)),yDt(Pkt,qCt.ccClosestConvexCallback_getHitNormalWorld(h));var u=QCt.getWrapper(qCt.ccClosestConvexCallback_getCollisionShapePtr(h),Akt.TYPE),l=qCt.ccClosestConvexCallback_getClosestHitFraction(h);return r._assign(Mkt,ir.distance(t.o,Mkt),u.collider,Pkt,l),!0}return!1},t.getSharedBody=function(t,e){return wkt.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;qCt.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),qCt.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;qCt.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),qCt.CollisionWorld_removeCollisionObject(this._world,t.ghost))},t.addCCT=function(t){if(this.ccts.indexOf(t)<0){this.ccts.push(t);var e=qCt.CharacterController_getGhostObject(t.impl),i=t.getGroup(),n=t.getMask();qCt.CollisionWorld_addCollisionObject(this._world,e,i>>>0,n>>>0),qCt.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=qCt.CharacterController_getGhostObject(t.impl);qCt.CollisionWorld_removeCollisionObject(this._world,i),qCt.DynamicsWorld_removeAction(this._world,t.impl)}},t.addConstraint=function(t){var e=this.constraints.indexOf(t);e<0&&(this.constraints.push(t),qCt.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),qCt.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--;){Ikt.push.apply(Ikt,JCt.contacts),JCt.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)?YCt.type="onTriggerStay":(YCt.type="onTriggerEnter",this.triggerArrayMat.set(n.id,r.id,!0)),YCt.impl=i.impl,YCt.selfCollider=s,YCt.otherCollider=a,s.emit(YCt.type,YCt),YCt.selfCollider=a,YCt.otherCollider=s,a.emit(YCt.type,YCt),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)?JCt.type="onCollisionStay":(JCt.type="onCollisionEnter",this.collisionArrayMat.set(n.id,r.id,!0));for(var u=0;u<i.contacts.length;u++){var l=i.contacts[u];if(Ikt.length>0){var c=Ikt.pop();c.impl=l,JCt.contacts.push(c)}else{var f=new Bkt(JCt);f.impl=l,JCt.contacts.push(f)}}JCt.impl=i.impl,JCt.selfCollider=s,JCt.otherCollider=a,s.emit(JCt.type,JCt),JCt.selfCollider=a,JCt.otherCollider=s,a.emit(JCt.type,JCt),this._needSyncAfterEvents=!0}null==this.oldContactsDic.get(n.id,r.id)&&this.oldContactsDic.set(n.id,r.id,i)}}for(var _=this.oldContactsDic.getLength();_--;){var d=this.oldContactsDic.getKeyByIndex(_),p=this.oldContactsDic.getDataByKey(d),m=p.shape0,g=p.shape1,y=m.collider,v=g.collider;if(y&&v){var b=y.isTrigger||v.isTrigger;null==this.contactsDic.getDataByKey(d)&&(b?this.triggerArrayMat.get(m.id,g.id)&&(YCt.type="onTriggerExit",YCt.selfCollider=y,YCt.otherCollider=v,y.emit(YCt.type,YCt),YCt.selfCollider=v,YCt.otherCollider=y,v.emit(YCt.type,YCt),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)&&(Ikt.push.apply(Ikt,JCt.contacts),JCt.contacts.length=0,JCt.type="onCollisionExit",JCt.selfCollider=y,JCt.otherCollider=v,y.emit(JCt.type,JCt),JCt.selfCollider=v,JCt.otherCollider=y,v.emit(JCt.type,JCt),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)?KCt.type="onControllerTriggerStay":(KCt.type="onControllerTriggerEnter",this.characterControllerArrayMat.set(n.id,r.id,!0)),KCt.impl=i.impl,KCt.collider=s,KCt.characterController=a,s.emit(KCt.type,KCt),KCt.collider=s,KCt.characterController=a,a.emit(KCt.type,KCt),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,_=c.characterController;if(f&&_){var d=f.isTrigger;null==this.cctContactsDic.getDataByKey(h)&&d&&this.characterControllerArrayMat.get(l.id,c.id)&&(KCt.type="onControllerTriggerExit",KCt.collider=f,KCt.characterController=_,f.emit(KCt.type,KCt),KCt.collider=f,KCt.characterController=_,_.emit(KCt.type,KCt),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;kkt.controller=r.characterController,kkt.collider=s.collider,kkt.worldPosition.set(a.x,a.y,a.z),kkt.worldNormal.set(o.x,o.y,o.z),kkt.motionDirection.set(h.x,h.y,h.z),kkt.motionLength=u,null==(e=kkt.controller)||e.emit("onControllerColliderHit",kkt),this._needSyncAfterEvents=!0}this.cctShapeEventDic.reset()},t.gatherConatactData=function(){for(var t=qCt.Dispatcher_getNumManifolds(this._dispatcher),e=0;e<t;e++)for(var i=qCt.Dispatcher_getManifoldByIndexInternal(this._dispatcher,e),n=qCt.PersistentManifold_getNumContacts(i),r=0;r<n;r++){var s=qCt.PersistentManifold_getContactPoint(i,r),a=qCt.ManifoldPoint_getShape0(s),o=qCt.ManifoldPoint_getShape1(s),h=!1;if(!h){var u=QCt.getWrapper(a,Akt.TYPE),l=QCt.getWrapper(o,Akt.TYPE);if(u&&l&&(h=!0,u.collider.needTriggerEvent||l.collider.needTriggerEvent||u.collider.needCollisionEvent||l.collider.needCollisionEvent)){var c=this.contactsDic.get(u.id,l.id);c||(c=this.contactsDic.set(u.id,l.id,{shape0:u,shape1:l,contacts:[],impl:i})),c.contacts.push(s)}}if(!h){var f=QCt.getWrapper(a,Akt.TYPE),_=QCt.getWrapper(o,XCt.CCT_CACHE_NAME);if(f&&_&&(h=!0,f.collider.needTriggerEvent)){var d=this.cctContactsDic.get(f.id,_.id);d||(d=this.cctContactsDic.set(f.id,_.id,{shape:f,cct:_,contacts:[],impl:i})),d.contacts.push(s),h=!0}}if(!h){var p=QCt.getWrapper(a,XCt.CCT_CACHE_NAME),m=QCt.getWrapper(o,Akt.TYPE);if(m&&p&&(h=!0,m.collider.needTriggerEvent)){var g=this.cctContactsDic.get(m.id,p.id);g||(g=this.cctContactsDic.set(m.id,p.id,{shape:m,cct:p,contacts:[],impl:i})),g.contacts.push(s),h=!0}}}},t._setDebugDrawMode=function(){var t=0;1&this._debugDrawFlags&&(t|=1),2&this._debugDrawFlags&&(t|=2048,t|=4096),4&this._debugDrawFlags&&(t|=2),qCt.DebugDraw_setDebugMode(this._debugDraw,t)},t._getDebugRenderer=function(){var t,e=null==(t=YE.root.mainWindow)?void 0:t.cameras;return e?0===e.length?null:e[0]?(e[0].initGeometryRenderer(),e[0].geometryRenderer):null:null},t.onDebugDrawLine=function(t,e,i){var n=this._getDebugRenderer();n&&this._debugLineCount<this._MAX_DEBUG_LINE_COUNT&&(this._debugLineCount++,yDt(Mkt,t),yDt(Pkt,e),yDt(Ekt,i),Okt.set(255*Ekt.x,255*Ekt.y,255*Ekt.z,255),n.addLine(Mkt,Pkt,Okt))},t.onClearLines=function(){this._debugLineCount=0},n(e,[{key:"impl",get:function(){return this._world}},{key:"debugDrawFlags",get:function(){return this._debugDrawFlags},set:function(t){this._debugDrawFlags=t,this._debugDraw&&this._setDebugDrawMode()}},{key:"debugDrawConstraintSize",get:function(){return this._debugConstraintSize},set:function(t){this._debugConstraintSize=t;for(var e=0;e<this.constraints.length;e++)this.constraints[e].updateDebugDrawSize()}}]),e}();Rkt._sweepBoxGeometry=void 0,Rkt._sweepSphereGeometry=void 0,Rkt._sweepCapsuleGeometry=void 0;var Fkt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.updateSize=function(){var t=QCt.instance.BT_V3_0;gDt(t,this.getMinUnscaledHalfExtents(xK)),qCt.BoxShape_setUnscaledHalfExtents(this.impl,t),this.updateCompoundTransform()},i.onComponentSet=function(){var t=QCt.instance.BT_V3_0;gDt(t,this.getMinUnscaledHalfExtents(xK)),this._impl=qCt.BoxShape_new(t),this.updateScale()},i.updateScale=function(){t.prototype.updateScale.call(this);var e=QCt.instance.BT_V3_0;qCt.CollisionShape_setLocalScaling(this._impl,gDt(e,this.getMinScale(xK))),this.updateCompoundTransform()},i.getMinUnscaledHalfExtents=function(t){var e=this.collider.size,i=TK(xK.set(this._collider.node.worldScale)),n=HDt.instance.minVolumeSize,r=e.x/2,s=e.y/2,a=e.z/2,o=r*i.x<n?n/i.x:r,h=s*i.y<n?n/i.y:s,u=a*i.z<n?n/i.z:a;return t.set(o,h,u),t},i.getMinScale=function(t){var e=this.collider.size,i=TK(xK.set(this._collider.node.worldScale)),n=HDt.instance.minVolumeSize,r=e.x/2,s=e.y/2,a=e.z/2,o=r*i.x<n?n/r:i.x,h=s*i.y<n?n/s:i.y,u=a*i.z<n?n/a:i.z;return t.set(o,h,u),t},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Akt),Lkt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.updateRadius=function(){qCt.SphereShape_setUnscaledRadius(this.impl,this.getMinUnscaledRadius()),this.updateCompoundTransform()},i.onComponentSet=function(){this._impl=qCt.SphereShape_new(this.getMinUnscaledRadius()),this.updateScale()},i.updateScale=function(){t.prototype.updateScale.call(this);var e=this.getMinScale();ZCt.set(e,e,e);var i=QCt.instance.BT_V3_0;qCt.CollisionShape_setLocalScaling(this._impl,gDt(i,ZCt)),this.updateCompoundTransform()},i.getMinUnscaledRadius=function(){var t=this.collider.radius,e=Math.abs(mn(this._collider.node.worldScale)),i=HDt.instance.minVolumeSize;return e*t<i?i/e:t},i.getMinScale=function(){var t=this.collider.radius,e=Math.abs(mn(this._collider.node.worldScale)),i=HDt.instance.minVolumeSize;return e*t<i?i/t:e},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Akt),Vkt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setCylinderHeight=function(){this.updateProperties(this.collider.radius,this.collider.cylinderHeight,this.collider.direction,this._collider.node.worldScale)},i.setDirection=function(){this.updateProperties(this.collider.radius,this.collider.cylinderHeight,this.collider.direction,this._collider.node.worldScale)},i.setRadius=function(){this.updateProperties(this.collider.radius,this.collider.cylinderHeight,this.collider.direction,this._collider.node.worldScale)},i.onComponentSet=function(){this._impl=qCt.CapsuleShape_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?(r=t*Math.abs(gn(a.x,a.z)),s=e/2*Math.abs(a.y)):0===o?(r=t*Math.abs(gn(a.y,a.z)),s=e/2*Math.abs(a.x)):(r=t*Math.abs(gn(a.x,a.y)),s=e/2*Math.abs(a.z)),qCt.CapsuleShape_updateProp(this._impl,r,s,o),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Akt),Nkt=function(){function t(t,e){this.key=void 0,this.ref=0,this.bulletBvhTriangleMeshShapePtr=void 0,this.btTriangleMeshPtr=0,this.reference=!0,this.key=t,this.btTriangleMeshPtr=qCt.TriangleMesh_new(),SDt(this.btTriangleMeshPtr,e),this.bulletBvhTriangleMeshShapePtr=qCt.BvhTriangleMeshShape_new(this.btTriangleMeshPtr,!0,!0)}return t.getBulletBvhTriangleMeshShape=function(e,i){var n;return t.BulletBvhTriangleMeshShapeMap.has(e)?(n=t.BulletBvhTriangleMeshShapeMap.get(e)).reference=!0:(n=new t(e,i),t.BulletBvhTriangleMeshShapeMap.set(e,n)),n},t.prototype.destroy=function(){this.bulletBvhTriangleMeshShapePtr&&qCt._safe_delete(this.bulletBvhTriangleMeshShapePtr,5),this.btTriangleMeshPtr&&qCt._safe_delete(this.btTriangleMeshPtr,8),t.BulletBvhTriangleMeshShapeMap.delete(this.key)},n(t,[{key:"reference",set:function(t){t?this.ref++:this.ref--,0===this.ref&&this.destroy()}}]),t}();Nkt.BulletBvhTriangleMeshShapeMap=new Map;var zkt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).btBVHMeshShape=null,e.refBtTriangleMesh=0,e}s(e,t);var i=e.prototype;return i.setMesh=function(t){if(this._isInitialized){this._impl&&QCt.isNotEmptyShape(this._impl)&&(this._compound&&qCt.CompoundShape_removeChildShape(this._compound,this._impl),qCt._safe_delete(this._impl,5),QCt.delWrapper(this._impl,Akt.TYPE),this._impl=0);var e=t;if(e&&e.renderingSubMeshes.length>0){if(this.collider.convex){var i=this._getBtTriangleMesh(e);this._impl=qCt.ConvexTriangleMeshShape_new(i)}else this.btBVHMeshShape=Nkt.getBulletBvhTriangleMeshShape(e.hash,e),this._impl=qCt.ScaledBvhTriangleMeshShape_new(this.btBVHMeshShape.bulletBvhTriangleMeshShapePtr,1,1,1);var n=QCt.instance.BT_V3_0;gDt(n,this._collider.node.worldScale),qCt.CollisionShape_setLocalScaling(this._impl,n),qCt.CollisionShape_setMargin(this._impl,.01),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=qCt.EmptyShape_static()}},i.onComponentSet=function(){this.setMesh(this.collider.mesh)},i.onDestroy=function(){this.collider.convex?this.refBtTriangleMesh&&qCt._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=QCt.instance.BT_V3_0;gDt(e,this._collider.node.worldScale),qCt.CollisionShape_setLocalScaling(this._impl,e),this.updateCompoundTransform()},i._getBtTriangleMesh=function(t){return this.refBtTriangleMesh=qCt.TriangleMesh_new(),SDt(this.refBtTriangleMesh,t),this.refBtTriangleMesh},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Akt),Ukt=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=QCt.instance.BT_V3_0;qCt.Vec3_set(t,.5,1,.5),this._impl=qCt.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))),qCt.CylinderShape_updateProp(this._impl,r,s/2,o),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Akt),Gkt=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=qCt.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))),qCt.ConeShape_setRadius(this._impl,r),qCt.ConeShape_setHeight(this._impl,s),qCt.ConeShape_setConeUpIndex(this._impl,o);var h=QCt.instance.BT_V3_0;qCt.Vec3_set(h,1,1,1),qCt.CollisionShape_setLocalScaling(this._impl,h),this.updateCompoundTransform()},n(e,[{key:"impl",get:function(){return this._impl}},{key:"collider",get:function(){return this._collider}}]),e}(Akt),Hkt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._bufPtr=0,e._tileSize=0,e._localOffset=new ir,e}s(e,t);var i=e.prototype;return i.setTerrain=function(t){if(this._isInitialized)if(this._impl&&QCt.isNotEmptyShape(this._impl))Y("[Physics][Bullet]: change the terrain asset after initialization is not support.");else{var e=t;if(e){this._tileSize=e.tileSize;var i=e.getVertexCountI(),n=e.getVertexCountJ();this._bufPtr=qCt._malloc(4*i*n);for(var r=0,s=Number.MAX_SAFE_INTEGER,a=Number.MIN_SAFE_INTEGER,o=0;o<n;o++)for(var h=0;h<i;h++){var u=e.getHeight(h,o);qCt._write_f32(this._bufPtr+r,u),s>u&&(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=qCt.TerrainShape_new(i,n,this._bufPtr,1,s,a);var l=QCt.instance.BT_V3_0;qCt.Vec3_set(l,this._tileSize,1,this._tileSize),qCt.CollisionShape_setLocalScaling(this._impl,l),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=qCt.EmptyShape_static()}},i.onComponentSet=function(){this.setTerrain(this.collider.terrain)},i.onDestroy=function(){this._bufPtr&&qCt._free(this._bufPtr),t.prototype.onDestroy.call(this)},i.setCenter=function(t){ir.copy(ZCt,t),ZCt.add(this._localOffset),gDt(qCt.Transform_getOrigin(this.transform),ZCt),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Akt),Wkt=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=qCt.SimplexShape_new();for(var t=this.collider.shapeType,e=this.collider.vertices,i=QCt.instance.BT_V3_0,n=0;n<t;n++)qCt.SimplexShape_addVertex(this._impl,gDt(i,e[n]));qCt.CollisionShape_setLocalScaling(this._impl,gDt(i,this._collider.node.worldScale))},i.onLoad=function(){t.prototype.onLoad.call(this),this.collider.updateVertices()},i.updateScale=function(){t.prototype.updateScale.call(this);var e=QCt.instance.BT_V3_0;qCt.CollisionShape_setLocalScaling(this._impl,gDt(e,this._collider.node.worldScale))},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Akt),jkt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setNormal=function(t){gDt(qCt.StaticPlaneShape_getPlaneNormal(this.impl),t),this.updateCompoundTransform()},i.setConstant=function(t){qCt.StaticPlaneShape_setPlaneConstant(this.impl,t),this.updateCompoundTransform()},i.updateScale=function(){t.prototype.updateScale.call(this);var e=QCt.instance.BT_V3_0;gDt(e,this._collider.node.worldScale),qCt.CollisionShape_setLocalScaling(this._impl,e),this.updateCompoundTransform()},i.onComponentSet=function(){var t=QCt.instance.BT_V3_0;gDt(t,this.collider.normal),this._impl=qCt.StaticPlaneShape_new(t,this.collider.constant),this.updateScale()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Akt),qkt=function(){function t(){this.dirty=0,this.index=-1,this._impl=0,this._com=void 0,this._rigidBody=void 0,this._connectedBody=null,this._collided=!1}var e=t.prototype;return e.setConnectedBody=function(t){if(this._connectedBody!==t){var e=this._connectedBody;e&&e.body.sharedBody.removeJoint(this,1);var i=this._rigidBody.body.sharedBody;i.removeJoint(this,0),this._impl&&(i.wrappedWorld.removeConstraint(this),qCt._safe_delete(this._impl,13)),this._connectedBody=t;var n=this._connectedBody;this.onComponentSet(),this.setEnableCollision(this._collided),i.wrappedWorld.addConstraint(this),i.addJoint(this,0),n&&n.body.sharedBody.addJoint(this,1)}},e.setEnableCollision=function(t){this._collided!==t&&(this._collided=t,this.updateByReAdd())},e.updateByReAdd=function(){if(this._rigidBody&&this.index>=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=HDt.instance.physicsWorld.debugDrawConstraintSize;qCt.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(){qCt._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}(),Xkt=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=QCt.instance.BT_V3_0;ir.multiply(ZCt,t.node.worldScale,t.pivotA),gDt(e,ZCt),qCt.P2PConstraint_setPivotA(this._impl,e),t.connectedBody||this.setPivotB(t.pivotB)},i.setPivotB=function(){var t=this.constraint,e=this._rigidBody.node,i=QCt.instance.BT_V3_0,n=t.connectedBody;n?(ir.multiply(ZCt,n.node.worldScale,t.pivotB),gDt(i,ZCt)):(ir.multiply(ZCt,e.worldScale,t.pivotA),ir.transformQuat(ZCt,ZCt,e.worldRotation),ir.add(ZCt,ZCt,e.worldPosition),gDt(i,ZCt)),qCt.P2PConstraint_setPivotB(this._impl,i)},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:qCt.TypedConstraint_getFixedBody(),n=QCt.instance.BT_V3_0,r=QCt.instance.BT_V3_1;this._impl=qCt.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}(qkt),Ykt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setBreakForce=function(t){qCt.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:qCt.TypedConstraint_getFixedBody(),n=QCt.instance.BT_TRANSFORM_0,r=QCt.instance.BT_TRANSFORM_1;this._impl=qCt.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=ZCt,n=eDt,r=QCt.instance.BT_TRANSFORM_0,s=QCt.instance.BT_TRANSFORM_1,a=QCt.instance.BT_QUAT_0,o=nDt;if(Kr.fromRT(o,e.node.worldRotation,e.node.worldPosition),Kr.invert(o,o),Kr.getRotation(n,o),Kr.getTranslation(i,o),gDt(qCt.Transform_getOrigin(r),i),vDt(a,n),qCt.Transform_setRotation(r,a),t){var h=t.body.sharedBody;Kr.fromRT(o,h.node.worldRotation,h.node.worldPosition),Kr.invert(o,o),Kr.getRotation(n,o),Kr.getTranslation(i,o),gDt(qCt.Transform_getOrigin(s),i),vDt(a,n),qCt.Transform_setRotation(s,a)}else qCt.Transform_setIdentity(s);qCt.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}(qkt),Jkt=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?qCt.HingeConstraint_setLimit(this._impl,nn(this.constraint.lowerLimit),nn(this.constraint.upperLimit),.9,.3,1):qCt.HingeConstraint_setLimit(this._impl,1,0,.9,.3,1)},i.setLowerLimit=function(){this.constraint.limitEnabled&&qCt.HingeConstraint_setLimit(this._impl,nn(this.constraint.lowerLimit),nn(this.constraint.upperLimit),.9,.3,1)},i.setUpperLimit=function(){this.constraint.limitEnabled&&qCt.HingeConstraint_setLimit(this._impl,nn(this.constraint.lowerLimit),nn(this.constraint.upperLimit),.9,.3,1)},i.setMotorEnabled=function(t){qCt.HingeConstraint_enableMotor(this._impl,t);var e=-this.constraint.motorVelocity/60,i=wDt(this.constraint.motorForceLimit,HDt.instance.fixedTimeStep);qCt.HingeConstraint_setMotorVelocity(this._impl,e),qCt.HingeConstraint_setMaxMotorImpulse(this._impl,i)},i.setMotorVelocity=function(t){if(this.constraint.motorEnabled){var e=-t/60;qCt.HingeConstraint_setMotorVelocity(this._impl,e)}},i.setMotorForceLimit=function(t){if(this.constraint.motorEnabled){var e=wDt(t,HDt.instance.fixedTimeStep);qCt.HingeConstraint_setMaxMotorImpulse(this._impl,e)}},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:qCt.TypedConstraint_getFixedBody(),n=QCt.instance.BT_TRANSFORM_0,r=QCt.instance.BT_TRANSFORM_1;this._impl=qCt.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=ZCt,n=eDt,r=iDt,s=QCt.instance.BT_TRANSFORM_0;ir.multiply(i,e.worldScale,t.pivotA),gDt(qCt.Transform_getOrigin(s),i);var a=QCt.instance.BT_QUAT_0;ir.normalize(i,t.axis),kr.rotationTo(r,ir.UNIT_Z,i),vDt(a,r),qCt.Transform_setRotation(s,a);var o=QCt.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)),gDt(qCt.Transform_getOrigin(o),i),vDt(a,r),qCt.Transform_setRotation(o,a),qCt.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}(qkt),Kkt=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:qCt.Generic6DofSpring2Constraint_setLimit(this._impl,e,0,0);break;case 1:qCt.Generic6DofSpring2Constraint_setLimit(this._impl,e,i,n);break;case 0:qCt.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:J("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){qCt.Generic6DofSpring2Constraint_enableSpring(this._impl,4,t),qCt.Generic6DofSpring2Constraint_enableSpring(this._impl,5,t)},i.setTwistSoftConstraint=function(t){qCt.Generic6DofSpring2Constraint_enableSpring(this._impl,3,t)},i.setLinearSoftConstraint=function(t){qCt.Generic6DofSpring2Constraint_enableSpring(this._impl,0,t),qCt.Generic6DofSpring2Constraint_enableSpring(this._impl,1,t),qCt.Generic6DofSpring2Constraint_enableSpring(this._impl,2,t)},i.setLinearStiffness=function(t){qCt.Generic6DofSpring2Constraint_setStiffness(this._impl,0,t),qCt.Generic6DofSpring2Constraint_setStiffness(this._impl,1,t),qCt.Generic6DofSpring2Constraint_setStiffness(this._impl,2,t)},i.setLinearDamping=function(t){qCt.Generic6DofSpring2Constraint_setDamping(this._impl,0,t),qCt.Generic6DofSpring2Constraint_setDamping(this._impl,1,t),qCt.Generic6DofSpring2Constraint_setDamping(this._impl,2,t)},i.setLinearRestitution=function(t){qCt.Generic6DofSpring2Constraint_setBounce(this._impl,0,t),qCt.Generic6DofSpring2Constraint_setBounce(this._impl,1,t),qCt.Generic6DofSpring2Constraint_setBounce(this._impl,2,t)},i.setSwingStiffness=function(t){qCt.Generic6DofSpring2Constraint_setStiffness(this._impl,4,t),qCt.Generic6DofSpring2Constraint_setStiffness(this._impl,5,t)},i.setSwingDamping=function(t){qCt.Generic6DofSpring2Constraint_setDamping(this._impl,4,t),qCt.Generic6DofSpring2Constraint_setDamping(this._impl,5,t)},i.setSwingRestitution=function(t){qCt.Generic6DofSpring2Constraint_setBounce(this._impl,4,t),qCt.Generic6DofSpring2Constraint_setBounce(this._impl,5,t)},i.setTwistStiffness=function(t){qCt.Generic6DofSpring2Constraint_setStiffness(this._impl,3,t)},i.setTwistDamping=function(t){qCt.Generic6DofSpring2Constraint_setDamping(this._impl,3,t)},i.setTwistRestitution=function(t){qCt.Generic6DofSpring2Constraint_setBounce(this._impl,3,t)},i.setDriverMode=function(t,e){0===e?qCt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!1):1===e?(qCt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!0),qCt.Generic6DofSpring2Constraint_setServo(this._impl,t,!0)):2===e&&(qCt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!0),qCt.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;qCt.Generic6DofSpring2Constraint_setServoTarget(this._impl,i,n),1===e?t>2?qCt.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,-n*o*.1):qCt.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,n*o*.1):2===e&&qCt.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){qCt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,0,t),qCt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,1,t),qCt.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){qCt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,3,t),qCt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,4,t),qCt.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=wDt(Math.max(this.constraint.breakForce,this.constraint.breakTorque),HDt.instance.fixedTimeStep);qCt.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.setBreakTorque=function(){var t=wDt(Math.max(this.constraint.breakForce,this.constraint.breakTorque),HDt.instance.fixedTimeStep);qCt.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t&&t.body.impl||qCt.TypedConstraint_getFixedBody(),n=QCt.instance.BT_TRANSFORM_0,r=QCt.instance.BT_TRANSFORM_1;this._impl=qCt.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=ZCt,n=eDt,r=iDt,s=QCt.instance.BT_TRANSFORM_0;ir.multiply(i,e.worldScale,t.pivotA),gDt(qCt.Transform_getOrigin(s),i);var a=QCt.instance.BT_QUAT_0,o=t.axis,h=t.secondaryAxis,u=ir.cross($Ct,o,h);Kr.set(nDt,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),vDt(a,n),qCt.Transform_setRotation(s,a);var l=QCt.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)),gDt(qCt.Transform_getOrigin(l),i),vDt(a,n),qCt.Transform_setRotation(l,a),qCt.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}(qkt),Qkt=new ir(0,0,0),Zkt=new ir(0,0,0);new ir(0,0,0);var $kt=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=HDt.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=HDt.instance.collisionMatrix[e];return this._collisionFilterGroup=e,this._collisionFilterMask=i,this.onComponentSet(),0!==this._impl||(J("[Physics]: Initialize BulletCharacterController failed"),!1)},e.setWrapper=function(){QCt.setWrapper(this._impl,XCt.CCT_CACHE_NAME,this);var t=qCt.CharacterController_getCollisionShape(this.impl);QCt.setWrapper(t,XCt.CCT_CACHE_NAME,this)},e.onEnable=function(){this._isEnabled=!0,this._impl||this.onComponentSet(),this.setDetectCollisions(!1),this.setOverlapRecovery(!0),HDt.instance.physicsWorld.addCCT(this),this.setWrapper()},e.onDisable=function(){this._isEnabled=!1,this.wrappedWorld.removeCCT(this),this.onDestroy()},e.onDestroy=function(){qCt._safe_delete(this._impl,6),QCt.delWrapper(this._impl,XCt.CCT_CACHE_NAME),this._impl=0},e.onLoad=function(){},e.getPosition=function(t){this._impl&&yDt(t,qCt.CharacterController_getPosition(this.impl))},e.setPosition=function(t){this._impl&&(gDt(qCt.CharacterController_getPosition(this.impl),t),this.syncPhysicsToScene())},e.setContactOffset=function(t){this._impl&&qCt.CharacterController_setContactOffset(this._impl,t)},e.setStepOffset=function(t){this._impl&&qCt.CharacterController_setStepOffset(this._impl,t)},e.setSlopeLimit=function(t){this._impl&&qCt.CharacterController_setSlopeLimit(this._impl,ei(t))},e.setDetectCollisions=function(t){this._impl&&qCt.CharacterController_setCollision(this.impl,t)},e.setOverlapRecovery=function(t){this._impl&&qCt.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(Qkt,t.worldPosition,this.scaledCenter),this.setPosition(Qkt)))},e.syncPhysicsToScene=function(){this.getPosition(Qkt),Qkt.subtract(this.scaledCenter),this._comp.node.setWorldPosition(Qkt)},e.syncScale=function(){this.updateScale()},e.move=function(t,e,i){if(this._isEnabled){var n=QCt.instance.BT_V3_0;qCt.Vec3_set(n,t.x,t.y,t.z),this._btCollisionFlags=qCt.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&&(HDt.instance.physicsWorld.removeCCT(this),HDt.instance.physicsWorld.addCCT(this),this._dirty=!1)},e.onShapeHitExt=function(t){var e=qCt.ControllerShapeHit_getHitShape(t),i=HDt.instance.physicsWorld;i.cctShapeEventDic.get(this.impl,e);var n=new ir;yDt(n,qCt.ControllerHit_getHitWorldPos(t));var r=new ir;yDt(r,qCt.ControllerHit_getHitWorldNormal(t));var s=new ir;yDt(s,qCt.ControllerHit_getHitMotionDir(t));var a=qCt.ControllerHit_getHitMotionLength(t),o=QCt.getWrapper(e,Akt.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(Zkt,this._comp.center,this._comp.node.worldScale),Zkt}}]),t}();$kt.idCounter=0;var tRt,eRt,iRt,nRt,rRt,sRt,aRt,oRt=new ir(0,0,0),hRt=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(oRt),oRt.add(this.scaledCenter);var t=QCt.instance.BT_V3_0;qCt.Vec3_set(t,oRt.x,oRt.y,oRt.z);var e=ir.UNIT_Y,i=QCt.instance.BT_V3_1;qCt.Vec3_set(i,e.x,e.y,e.z);var n=qCt.ControllerHitReport.implement(ykt).$$.ptr,r=HDt.instance.physicsWorld,s=qCt.CapsuleCharacterControllerDesc_new(ei(this.component.slopeLimit),this.component.stepOffset,this.component.skinWidth,i,t,n,this.component.radius,this.component.height);this._impl=qCt.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);qCt.CapsuleCharacterController_setRadius(this.impl,e),qCt.CapsuleCharacterController_setHeight(this.impl,i),this._dirty=!0},n(e,[{key:"component",get:function(){return this._comp}}]),e}($kt),uRt=new ir(0,0,0),lRt=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(uRt),uRt.add(this.scaledCenter);var t=QCt.instance.BT_V3_0;qCt.Vec3_set(t,uRt.x,uRt.y,uRt.z);var e=ir.UNIT_Y,i=QCt.instance.BT_V3_1;qCt.Vec3_set(i,e.x,e.y,e.z);var n=qCt.ControllerHitReport.implement(ykt).$$.ptr,r=HDt.instance.physicsWorld,s=qCt.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=qCt.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;qCt.BoxCharacterController_setHalfSideExtent(this.impl,this.component.halfSideExtent*t.x),qCt.BoxCharacterController_setHalfHeight(this.impl,this.component.halfHeight*t.y),qCt.BoxCharacterController_setHalfForwardExtent(this.impl,this.component.halfForwardExtent*t.z),this._dirty=!0},n(e,[{key:"component",get:function(){return this._comp}}]),e}($kt);XO.once(qO.EVENT_PRE_SUBSYSTEM_INIT,(function(){ICt.register("bullet",{PhysicsWorld:Rkt,RigidBody:gkt,BoxShape:Fkt,SphereShape:Lkt,CapsuleShape:Vkt,TrimeshShape:zkt,CylinderShape:Ukt,ConeShape:Gkt,TerrainShape:Hkt,SimplexShape:Wkt,PlaneShape:jkt,PointToPointConstraint:Xkt,HingeConstraint:Jkt,FixedConstraint:Ykt,ConfigurableConstraint:Kkt,BoxCharacterController:lRt,CapsuleCharacterController:hRt})}));var cRt={BOX:0,SPHERE:1,CYLINDER:2,CONE:3,CAPSULE:4,TORUS:5,PLANE:6,QUAD:7};Ee(cRt);var fRt=t("f$",(tRt=Kh("cc.Primitive"),eRt=Ou(cRt),tRt((aRt=function(t){function e(e){var i;return void 0===e&&(e=0),(i=t.call(this)||this).type=rRt&&rRt(),i.info=sRt&&sRt(),i.type=e,i}return s(e,t),e.prototype.onLoaded=function(){Gk((0,wK[cRt[this.type].toLowerCase()])(this.info),this)},e}(Pk),aRt.PrimitiveType=cRt,rRt=zh((nRt=aRt).prototype,"type",[eRt],(function(){return 0})),sRt=zh(nRt.prototype,"info",[uu],(function(){return{}})),iRt=nRt))||iRt));A.Primitive=fRt,C.primitives=wK;var _Rt,dRt=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._value<this._opts.below||void 0!==this._opts.over&&this._value>this._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}(),pRt=Kh("cc.PerfCounter")(_Rt=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}(dRt))||_Rt,mRt="0123456789. ",gRt=500,yRt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,".":10},vRt={fps:{desc:"Framerate (FPS)",below:30,average:gRt,isInteger:!0},draws:{desc:"Draw call",isInteger:!0},frame:{desc:"Frame time (ms)",min:0,max:50,average:gRt},instances:{desc:"Instance Count",isInteger:!0},tricount:{desc:"Triangle",isInteger:!0},logic:{desc:"Game Logic (ms)",min:0,max:50,average:gRt,color:"#080"},physics:{desc:"Physics (ms)",min:0,max:50,average:gRt},render:{desc:"Renderer (ms)",min:0,max:50,average:gRt,color:"#f90"},present:{desc:"Present (ms)",min:0,max:50,average:gRt,color:"#f90"},textureMemory:{desc:"GFX Texture Mem(M)"},bufferMemory:{desc:"GFX Buffer Mem(M)"}},bRt=t("g0",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 id,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(vRt).length+1),e._wordHeight=0,e._eachNumWidth=0,e._totalLines=0,e.lastTime=0,e._canvas=B.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),YE.off("director_before_update",this.beforeUpdate,this),YE.off("director_after_update",this.afterUpdate,this),YE.off("director_before_physics",this.beforePhysics,this),YE.off("director_after_physics",this.afterPhysics,this),YE.off("director_before_draw",this.beforeDraw,this),YE.off("director_after_render",this.afterRender,this),YE.off("director_after_draw",this.afterPresent,this),this._showFPS=!1,YE.root.pipeline.profiler=null,A.game.config.showFPS=!1)},i.showStats=function(){if(!this._showFPS){if(!this._device){var t=A.director.root;this._device=Wp.gfxDevice,this._swapchain=t.mainWindow.swapchain}this.generateCanvas(),this.generateStats(),A.game.once(A.Game.EVENT_ENGINE_INITED,this.generateNode,this),A.game.on(A.Game.EVENT_RESTART,this.generateNode,this),this._rootNode&&(this._rootNode.active=!0),YE.on("director_before_update",this.beforeUpdate,this),YE.on("director_after_update",this.afterUpdate,this),YE.on("director_before_physics",this.beforePhysics,this),YE.on("director_after_physics",this.afterPhysics,this),YE.on("director_before_draw",this.beforeDraw,this),YE.on("director_after_render",this.afterRender,this),YE.on("director_after_draw",this.afterPresent,this),this._showFPS=!0,this._canvasDone=!0,this._statsDone=!0,A.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 dd(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 vRt){var n=vRt[i];this._ctx.fillText(n.desc,0,e*this._lineHeight),n.counter=new pRt(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(mRt[r]).width;this._eachNumWidth=Math.max(this._eachNumWidth,s)}for(var a=0;a<12;++a)this._ctx.fillText(mRt[a],a*this._eachNumWidth,this._totalLines*this._lineHeight);this._eachNumWidth/=this._canvas.width,this._profilerStats=vRt,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 eb("PROFILER_NODE"),this._rootNode._objFlags=1032,XO.addPersistRootNode(this._rootNode);var t=new eb("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<this._totalLines;l++)for(var c=0;c<8;c++){a.push(n+c*s,e-l*i,0),a.push(n+(c+1)*s,e-l*i,0),a.push(n+(c+1)*s,e-(l+1)*i,0),a.push(n+c*s,e-(l+1)*i,0),u=4*(8*l+c+1),o.push(0+u,2+u,1+u,0+u,3+u,2+u);var f=8*l+c,_=Math.floor(f/4),d=f-4*_;h.push(0,this._wordHeight,_,d),h.push(this._eachNumWidth,this._wordHeight,_,d),h.push(this._eachNumWidth,1,_,d),h.push(0,1,_,d)}this._meshRenderer=t.addComponent(mj),this._meshRenderer.mesh=Gk({positions:a,indices:o,colors:h});var p=new GT;p.initialize({effectName:"util/profiler"});var m=this.pass=p.passes[0],g=m.getBinding("mainTexture"),y=m.getBinding("digits"),v=m.getBinding("offset");m.bindTexture(g,this._texture),this.digitsData=m.blocks[y],this.offsetData=m.blocks[v],this.offsetData[3]=-1,this._meshRenderer.material=p,this._meshRenderer.node.layer=Ly.Enum.PROFILER,this._inited=!0}},i.beforeUpdate=function(){if(this._profilerStats){var t=performance.now();this._profilerStats.frame.counter.start(t),this._profilerStats.logic.counter.start(t)}},i.afterUpdate=function(){if(this._profilerStats){var t=performance.now();YE.isPaused()?this._profilerStats.frame.counter.start(t):this._profilerStats.logic.counter.end(t)}},i.beforePhysics=function(){if(this._profilerStats){var t=performance.now();this._profilerStats.physics.counter.start(t)}},i.afterPhysics=function(){if(this._profilerStats){var t=performance.now();this._profilerStats.physics.counter.end(t)}},i.beforeDraw=function(){if(this._profilerStats&&this._inited){var t=this._swapchain.surfaceTransform,e=this._device.capabilities.clipSpaceSignY;if(t!==this.offsetData[3]){var i=Hr[t],n=-.9*e;this.offsetData[0]=-.9*i[0]+n*i[2],this.offsetData[1]=-.9*i[1]+n*i[3],this.offsetData[2]=this._eachNumWidth,this.offsetData[3]=t}this.pass.setRootBufferDirty(!0),this._meshRenderer.model?YE.root.pipeline.profiler=this._meshRenderer.model:YE.root.pipeline.profiler=null;var r=performance.now();this._profilerStats.render.counter.start(r)}},i.afterRender=function(){if(this._profilerStats&&this._inited){var t=performance.now();this._profilerStats.render.counter.end(t),this._profilerStats.present.counter.start(t)}},i.afterPresent=function(){if(this._profilerStats&&this._inited){var t=performance.now();if(this._profilerStats.frame.counter.end(t),this._profilerStats.fps.counter.frame(t),this._profilerStats.present.counter.end(t),!(t-this.lastTime<gRt)){this.lastTime=t;var e=this._device;this._profilerStats.draws.counter.value=e.numDrawCalls,this._profilerStats.instances.counter.value=e.numInstances,this._profilerStats.bufferMemory.counter.value=e.memoryStatus.bufferSize/1048576,this._profilerStats.textureMemory.counter.value=e.memoryStatus.textureSize/1048576,this._profilerStats.tricount.counter.value=e.numTris;var i=0,n=this.digitsData;for(var r in this._profilerStats){var s=this._profilerStats[r];s.counter.sample(t);for(var a=s.counter.human().toString(),o=7;o>=0;o--){var h=8*i+o,u=a[a.length-(8-o)],l=yRt[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}(Ff)),SRt=t("g1",new bRt);YE.registerSystem("profiler",SRt,0),A.profiler=SRt;var wRt=function(){function t(t){this.jointTexturePool=void 0,this.jointAnimationInfo=void 0,this.jointTexturePool=new wY(t),this.jointAnimationInfo=new xY(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}();A.internal.DataPoolManager=wRt;var xRt,TRt,ARt,CRt,DRt,BRt,IRt,MRt,PRt,ERt,ORt,kRt,RRt,FRt,LRt,VRt=new Kr,NRt=new Kr,zRt=t("g3",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=A.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=oY.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;i<t.length;++i){var n=t[i],r=e.getChildByPath(n.path);if(n.target){for(var s=oY.getOrExtract(this.clip),a=n.path,o=s.joints[a],h=r,u=void 0;!o;){var l=a.lastIndexOf("/");if(a=a.substring(0,l),o=s.joints[a],h&&(u||(u=Kr.identity(NRt)),Kr.fromRTS(VRt,h.rotation,h.position,h.scale),Kr.multiply(u,VRt,u),h=h.parent),l<0)break}for(var c=o&&o.transforms,f=s.frames,_=[],d=0;d<f;d++){var p;p=c&&u?Kr.multiply(VRt,c[d],u):c?c[d]:u||new Kr;var m={pos:new ir,rot:new kr,scale:new ir};Kr.toSRT(p,m.rot,m.pos,m.scale),_.push(m)}this._sockets.push({target:n.target,frames:_})}}},i._sampleCurvesBaked=function(t){var e=t/this.duration,i=this._animInfo,n=this.clip;i.currentClip!==n&&(this._animInfoMgr.switchClip(this._animInfo,n),this._parent.getUsers().forEach((function(t){t.uploadAnimation(n)})),i.data[0]=-1);var r=e*this._frames+.5|0;if(r!==i.data[0]){i.data[0]=r,i.dirty=!0;for(var s=0;s<this._sockets.length;++s){var a=this._sockets[s],o=a.target,h=a.frames[r],u=h.pos,l=h.rot,c=h.scale;o.setRTS(l,u,c)}}},e}(pQ)),URt=t("g4",(xRt=Kh("cc.SkeletalAnimation.Socket"),TRt=Ou(eb),xRt((CRt=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),this.path=DRt&&DRt(),this.target=BRt&&BRt(),this.path=t,this.target=e},DRt=zh(CRt.prototype,"path",[uu],(function(){return""})),BRt=zh(CRt.prototype,"target",[TRt],(function(){return null})),ARt=CRt))||ARt));le(URt,"cc.SkeletalAnimationComponent.Socket");var GRt=new Kr,HRt=new Kr;function WRt(t,e,i){void 0===e&&(e=""),void 0===i&&(i=[]);for(var n=0;n<t.children.length;n++){var r=t.children[n];if(r){var s=e?e+"/"+r.name:r.name;i.push(s),WRt(r,s,i)}}return i}var jRt,qRt=t("g5",(IRt=Kh("cc.SkeletalAnimation"),MRt=Zh(99),PRt=Ou([URt]),ERt=Ou([URt]),IRt(ORt=MRt((LRt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._useBakedAnimation=RRt&&RRt(),e._sockets=FRt&&FRt(),e._users=new Set,e._currentBakedState=null,e}s(e,t);var i=e.prototype;return i.onLoad=function(){t.prototype.onLoad.call(this);for(var e=this.node.getComponentsInChildren(bJ),i=0;i<e.length;++i){var n=e[i];n.skinningRoot===this.node&&this.notifySkinnedMeshAdded(n)}},i.onDestroy=function(){t.prototype.onDestroy.call(this),A.director.root.dataPoolManager.jointAnimationInfo.destroy(this.node.uuid),lQ().removeSockets(this.node,this._sockets),this._removeAllUsers()},i.onEnable=function(){var e;t.prototype.onEnable.call(this),null==(e=this._currentBakedState)||e.resume()},i.onDisable=function(){var e;t.prototype.onDisable.call(this),null==(e=this._currentBakedState)||e.pause()},i.start=function(){this.sockets=this._sockets,this._applyBakeFlagChange(),t.prototype.start.call(this)},i.pause=function(){var e;this._useBakedEffectively?null==(e=this._currentBakedState)||e.pause():t.prototype.pause.call(this)},i.resume=function(){var e;this._useBakedEffectively?null==(e=this._currentBakedState)||e.resume():t.prototype.resume.call(this)},i.stop=function(){this._useBakedEffectively?this._currentBakedState&&(this._currentBakedState.stop(),this._currentBakedState=null):t.prototype.stop.call(this)},i.querySockets=function(){var t=this._defaultClip&&Object.keys(oY.getOrExtract(this._defaultClip).joints).sort().reduce((function(t,e){return e.startsWith(t[t.length-1]+"/")||t.push(e),t}),[])||[];if(!t.length)return["please specify a valid default animation clip first"];for(var e=[],i=0;i<t.length;i++){var n=t[i],r=this.node.getChildByPath(n);r&&(e.push(n),WRt(r,n,e))}return e},i.rebuildSocketAnimations=function(){var t=this;for(var e in this._sockets.forEach((function(e){var i=t.node.getChildByPath(e.path),n=e.target;i&&n&&(n.name=e.path.substring(e.path.lastIndexOf("/")+1)+" Socket",n.parent=t.node,uY(i,t.node,GRt),Kr.fromRTS(HRt,n.rotation,n.position,n.scale),Kr.equals(HRt,GRt)||(n.matrix=GRt))})),this._nameToState)this._nameToState[e].rebuildSocketCurves(this._sockets)},i.createSocket=function(t){var e=this._sockets.find((function(e){return e.path===t}));if(e)return e.target;if(!this.node.getChildByPath(t))return Y("illegal socket path"),null;var i=new eb;return i.parent=this.node,this._sockets.push(new URt(t,i)),this.rebuildSocketAnimations(),i},i.notifySkinnedMeshAdded=function(t){var e=this._useBakedEffectively,i=t.associatedAnimation;if(i&&i._users.delete(t),t.associatedAnimation=this,t.setUseBakedAnimation(e,!0),e){var n=this._currentBakedState;n&&t.uploadAnimation(n.clip)}this._users.add(t)},i.notifySkinnedMeshRemoved=function(t){t.associatedAnimation===this||t.associatedAnimation,t.setUseBakedAnimation(!1),t.associatedAnimation=null,this._users.delete(t)},i.getUsers=function(){return this._users},i._createState=function(t,e){return new zRt(t,e)},i._doCreateState=function(e,i){var n=t.prototype._doCreateState.call(this,e,i);return n.rebuildSocketCurves(this._sockets),n},i.doPlayOrCrossFade=function(e,i){if(this._useBakedEffectively){this._currentBakedState&&this._currentBakedState.stop();var n=e;this._currentBakedState=n,n.play()}else t.prototype.doPlayOrCrossFade.call(this,e,i)},i._removeAllUsers=function(){var t=this;Array.from(this._users).forEach((function(e){t.notifySkinnedMeshRemoved(e)}))},i._applyBakeFlagChange=function(){var t=this._useBakedEffectively;for(var e in this._nameToState)this._nameToState[e].setUseBaked(t);this._users.forEach((function(e){e.setUseBakedAnimation(t)})),t?lQ().removeSockets(this.node,this._sockets):(lQ().addSockets(this.node,this._sockets),this._currentBakedState=null)},n(e,[{key:"sockets",get:function(){return this._sockets},set:function(t){if(!this._useBakedEffectively){var e=lQ();e.removeSockets(this.node,this._sockets),e.addSockets(this.node,t)}this._sockets=t,this.rebuildSocketAnimations()}},{key:"useBakedAnimation",get:function(){return this._useBakedAnimation},set:function(t){this._useBakedAnimation=t,this._applyBakeFlagChange()}},{key:"_useBakedEffectively",get:function(){return this._useBakedAnimation}}]),e}(het),LRt.Socket=URt,v((kRt=LRt).prototype,"sockets",[PRt],Object.getOwnPropertyDescriptor(kRt.prototype,"sockets"),kRt.prototype),RRt=zh(kRt.prototype,"_useBakedAnimation",[uu],(function(){return!0})),FRt=zh(kRt.prototype,"_sockets",[ERt],(function(){return[]})),ORt=kRt))||ORt)||ORt));A.SkeletalAnimationComponent=qRt,le(qRt,"cc.SkeletalAnimationComponent"),function(t,e){function i(t){for(var e in t)t[t[e]]=e}var n=t.MixBlend={setup:0,first:1,replace:2,add:3};i(n),i(n=t.MixDirection={mixIn:0,mixOut:1}),i(n=t.TimelineType={rotate:0,translate:1,scale:2,shear:3,attachment:4,color:5,deform:6,event:7,drawOrder:8,ikConstraint:9,transformConstraint:10,pathConstraintPosition:11,pathConstraintSpacing:12,pathConstraintMix:13,twoColor:14}),i(n=t.EventType={start:0,interrupt:1,end:2,dispose:3,complete:4,event:5}),i(n=t.BlendMode={Normal:0,Additive:1,Multiply:2,Screen:3}),i(n=t.TransformMode={Normal:0,OnlyTranslation:1,NoRotationOrReflection:2,NoScale:3,NoScaleOrReflection:4}),i(n=t.PositionMode={Fixed:0,Percent:1}),i(n=t.SpacingMode={Length:0,Fixed:1,Percent:2}),i(n=t.RotateMode={Tangent:0,Chain:1,ChainScale:2}),i(n=t.TextureFilter={Nearest:9728,Linear:9729,MipMap:9987,MipMapNearestNearest:9984,MipMapLinearNearest:9985,MipMapNearestLinear:9986,MipMapLinearLinear:9987}),i(n=t.TextureWrap={MirroredRepeat:33648,ClampToEdge:33071,Repeat:10497}),i(n=t.AttachmentType={Region:0,BoundingBox:1,Mesh:2,LinkedMesh:3,Path:4,Point:5,Clipping:6}),n=null;var r=3.1415927,s=2*r,a=180/r,o=a,h=r/180,u=h;t.MathUtils=(e=function(){function t(){}return t.clamp=function(t,e,i){return t<e?e:t>i?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)}(jRt||(jRt={}));var XRt=jRt;function YRt(t,e){return t?e===t.length?t:e<t.length?t.slice(0,e):new Array(e):new Array(e)}function JRt(t,e,i){var n="_"+i;Object.defineProperty(t,i,{get:function(){var t=e.call(this),i=t.size(),r=this[n];r=YRt(r,i);for(var s=0;s<i;s++)r[s]=t.get(s);return this[n]=r,r}})}function KRt(t,e,i){var n="_"+i;Object.defineProperty(t,i,{get:function(){var t=e.call(this),i=t.size(),r=this[n];r=YRt(r,i);for(var s=0;s<i;s++){var a=t.get(s),o=a.size(),h=r[s];h=YRt(h,o);for(var u=0;u<o;u++)h[u]=a.get(u);r[s]=h}return this[n]=r,r}})}function QRt(t,e,i){var n="_"+i;Object.defineProperty(t,i,{value:function(){var t=e.call(this),i=t.size(),r=this[n];r=YRt(r,i);for(var s=0;s<i;s++)r[s]=t.get(s);return this[n]=r,r}})}function ZRt(t){for(var e in XRt.wasmUtil=t.SpineWasmUtil,XRt.wasmUtil.wasm=t,XRt.wasmUtil.spineWasmInit(),t){var i=t[e];XRt[e]||(XRt[e]=i)}}function $Rt(){var t=XRt.PathConstraintData.prototype;JRt(t,t.getBones,"bones")}function tFt(){var t=XRt.VertexAttachment.prototype;JRt(t,t.getBones,"bones"),JRt(t,t.getVertices,"vertices");var e=t.computeWorldVertices,i=new XRt.SPVectorFloat;Object.defineProperty(t,"computeWorldVertices",{value:function(t,n,r,s,a,o){var h=s.length;i.resize(h,0);for(var u=0;u<h;u++)i.set(u,s[u]);e.call(this,t,n,r,i,a,o);for(var l=0;l<h;l++)s[l]=i.get(l)}})}function eFt(){var t=XRt.MeshAttachment.prototype;JRt(t,t.getRegionUVs,"regionUVs"),JRt(t,t.getUVs,"uvs"),JRt(t,t.getTriangles,"triangles"),JRt(t,t.getEdges,"edges")}function iFt(){var t=XRt.PathAttachment.prototype;JRt(t,t.getLengths,"lengths")}function nFt(){var t=XRt.RegionAttachment.prototype;JRt(t,t.getOffset,"offset");var e=t.getUVs,i=t.setUVs,n="_uvs";Object.defineProperty(t,"uvs",{get:function(){var i=e.call(this),r=i.size(),s=t[n];s=YRt(s,r);for(var a=0;a<r;a++)s[a]=i.get(a);return t[n]=s,s},set:function(t){i.call(this,t[0],t[1],t[2],t[3],1===t[4])}});var r=t.computeWorldVertices,s=new XRt.SPVectorFloat;Object.defineProperty(t,"computeWorldVertices",{value:function(t,e,i,n){var a=e.length;s.resize(a,0);for(var o=0;o<a;o++)s.set(o,e[o]);r.call(this,t,s,i,n);for(var h=0;h<a;h++)e[h]=s.get(h)}})}function rFt(){var t=XRt.IkConstraint.prototype;JRt(t,t.getBones,"bones")}function sFt(){var t=XRt.PathConstraint.prototype;JRt(t,t.getBones,"bones")}function aFt(){var t=XRt.TransformConstraintData.prototype;JRt(t,t.getBones,"bones")}function oFt(){var t=XRt.TransformConstraint.prototype;JRt(t,t.getBones,"bones")}function hFt(){var t=XRt.Bone.prototype;JRt(t,t.getChildren,"children")}function uFt(){var t=XRt.Slot.prototype;JRt(t,t.getDeform,"deform")}function lFt(){var t=XRt.Skin.prototype;JRt(t,t.getBones,"bones"),JRt(t,t.getAttachments,"attachments"),JRt(t,t.getConstraints,"constraints"),QRt(t,t.getAttachments,"getAttachments");var e=t.getAttachmentsForSlot;Object.defineProperty(t,"getAttachmentsForSlot",{value:function(t,i){var n=e.call(this,t),r=n.size();i.length=r;for(var s=0;s<r;s++)i[s]=n.get(s);n.delete()}});var i=t.findNamesForSlot;Object.defineProperty(t,"findNamesForSlot",{value:function(t,e){var n=i.call(this,t),r=n.size();e.length=r;for(var s=0;s<r;s++)e[s]=n.get(s);n.delete()}})}function cFt(){var t=XRt.SkinEntry.prototype;[["name",t.getName],["attachment",t.getAttachment]].forEach((function(e){Nt(t,e[0],e[1])}))}function fFt(){var t=XRt.SkeletonData.prototype;JRt(t,t.getBones,"bones"),JRt(t,t.getSlots,"slots"),JRt(t,t.getSkins,"skins"),JRt(t,t.getAnimations,"animations"),JRt(t,t.getEvents,"events"),JRt(t,t.getIkConstraints,"ikConstraints"),JRt(t,t.getTransformConstraints,"transformConstraints"),JRt(t,t.getPathConstraints,"pathConstraints")}function _Ft(){var t=XRt.RotateTimeline.prototype;JRt(t,t.getFrames,"frames")}function dFt(){var t=XRt.ColorTimeline.prototype;JRt(t,t.getFrames,"frames")}function pFt(){var t=XRt.AttachmentTimeline.prototype;JRt(t,t.getFrames,"frames"),JRt(t,t.getAttachmentNames,"attachmentNames")}function mFt(){var t=XRt.DeformTimeline.prototype;JRt(t,t.getFrames,"frames"),KRt(t,t.getFrameVertices,"frameVertices")}function gFt(){var t=XRt.EventTimeline.prototype;JRt(t,t.getFrames,"frames"),JRt(t,t.getEvents,"events")}function yFt(){var t=XRt.DrawOrderTimeline.prototype;JRt(t,t.getFrames,"frames")}function vFt(){var t=XRt.AnimationState.prototype;JRt(t,t.getTracks,"tracks")}function bFt(){var t=XRt.Animation.prototype;JRt(t,t.getTimelines,"timelines")}function SFt(){var t=XRt.Skeleton.prototype;JRt(t,t.getBones,"bones"),JRt(t,t.getSlots,"slots"),JRt(t,t.getDrawOrder,"drawOrder"),JRt(t,t.getIkConstraints,"ikConstraints"),JRt(t,t.getTransformConstraints,"transformConstraints"),JRt(t,t.getPathConstraints,"pathConstraints"),JRt(t,t.getUpdateCacheList,"_updateCache")}var wFt=null,xFt=[];xFt.push((function(t){var e;ZRt(t),JRt(e=XRt.IkConstraintData.prototype,e.getBones,"bones"),$Rt(),eFt(),iFt(),nFt(),tFt(),rFt(),sFt(),aFt(),oFt(),hFt(),uFt(),lFt(),cFt(),fFt(),_Ft(),dFt(),pFt(),mFt(),gFt(),yFt(),vFt(),bFt(),SFt()})),XO.onPostInfrastructureInitDelegate.add((function(){return uk().then((function(){return hh.hasFeature(hh.Feature.WASM)?Promise.all([e.import("./spine.wasm-B3rDcmnV.js"),e.import("./spine-B64FaKrv.js")]).then((function(t){return e=t[0].default,i=t[1].default,new Promise((function(t,n){var r=function(t){return"[Spine]: Spine wasm load failed: "+t};e({instantiateWasm:function(t,e){ok(i,t).then((function(t){e(t.instance,t.module)})).catch((function(t){return n(r(t))}))}}).then((function(t){wFt=t,xFt.forEach((function(t){t(wFt)}))})).then(t).catch((function(t){return n(r(t))}))}));var e,i})):Promise.all([e.import("./spine.asm-CuMHFj9t.js"),e.import("./spine.js-BXJrVNao.js")]).then((function(t){return e=t[0].default,i=t[1].default,new Promise((function(t,n){hk(i).then((function(t){var i={};return i.buffer=new ArrayBuffer(33554432),e({wasmMemory:i,memoryInitializerRequest:{response:t,status:200}}).then((function(t){wFt=t,xFt.forEach((function(t){t(wFt)}))}))})).then(t).catch(n)}));var e,i}))})).catch((function(t){J(t)}))}));var TFt,AFt=0,CFt=0,DFt=function(){function t(){this.start=void 0,this.interrupt=void 0,this.end=void 0,this.dispose=void 0,this.complete=void 0,this.event=void 0}return t.getListeners=function(e,i){if(!e.listener){e.listener=new t;var n=++CFt;i.setTrackEntryListener(n,e),t._trackSet.set(n,e)}return e.listener},t.emitListener=function(e,i,n,r){var s=t._listenerSet.get(e);if(s)switch(r){case XRt.EventType.event:s.event&&s.event(i,n);break;case XRt.EventType.start:s.start&&s.start(i);break;case XRt.EventType.interrupt:s.interrupt&&s.interrupt(i);break;case XRt.EventType.end:s.end&&s.end(i);break;case XRt.EventType.dispose:s.dispose&&s.dispose(i);break;case XRt.EventType.complete:s.complete&&s.complete(i);break;default:Y("emitListener doesn't handled",r)}},t.emitTrackEntryListener=function(t,e,i,n){var r=this._trackSet.get(t);if(r)switch(n){case XRt.EventType.start:r.listener.start&&r.listener.start(e);break;case XRt.EventType.interrupt:r.listener.interrupt&&r.listener.interrupt(e);break;case XRt.EventType.end:r.listener.end&&r.listener.end(e);break;case XRt.EventType.dispose:r.listener.dispose&&r.listener.dispose(e),this._trackSet.delete(t),r.listener=null;break;case XRt.EventType.complete:r.listener.complete&&r.listener.complete(e);break;case XRt.EventType.event:r.listener.event&&r.listener.event(e,i);break;default:Y("TrackEntry doesn't handled",n)}},t.addListener=function(e){var i=++AFt;return t._listenerSet.set(i,e),i},t.removeListener=function(e){t._listenerSet.delete(e)},t}();DFt._listenerSet=new Map,DFt._trackSet=new Map,globalThis.TrackEntryListeners=DFt;var BFt=1/60;kF(MF);var IFt,MFt,PFt,EFt,OFt,kFt,RFt,FFt,LFt,VFt,NFt=kF(EF),zFt=function(){this.a=0,this.b=0,this.c=0,this.d=0,this.worldX=0,this.worldY=0},UFt=function(){this.vCount=0,this.iCount=0,this.vData=null,this.iData=null,this.meshes=[]},GFt=function(){this.iCount=0,this.blendMode=0,this.textureID=0},HFt=function(){function t(t){this._instance=null,this._state=null,this._skeletonData=null,this._skeleton=null,this._privateMode=!1,this._curIndex=-1,this._isCompleted=!1,this._maxFrameIdex=0,this._frameIdx=-1,this._inited=!1,this._invalid=!0,this._enableCacheAttachedInfo=!1,this._skeletonInfo=null,this._animationName=null,this.isCompleted=!1,this.totalTime=0,this.frames=[],this._privateMode=!1,this._inited=!1,this._invalid=!0,this._instance=new XRt.SkeletonInstance,this._instance.isCache=!0,this._skeletonData=t,this._skeleton=this._instance.initSkeleton(t),this._instance.setUseTint(!0)}var e=t.prototype;return e.init=function(t,e){this._inited=!0,this._animationName=e,this._skeletonInfo=t},e.setSkin=function(t){this._skeleton&&this._skeleton.setSkinByName(t),this._instance.setSkin(t)},e.setAnimation=function(t){var e=this._skeletonData.animations,i=null;e.forEach((function(e){e.name===t&&(i=e)})),i?(this._maxFrameIdex=Math.floor(i.duration/BFt),this._maxFrameIdex<=0&&(this._maxFrameIdex=1),this._instance.setAnimation(0,t,!1)):Y("find no animation named "+t+" !!!")},e.updateToFrame=function(t){if(this._inited&&(this.begin(),this.needToUpdate(t)))do{this._frameIdx++,this.totalTime+=BFt,this._instance.updateAnimation(BFt);var e=this._instance.updateRenderData();this.updateRenderData(this._frameIdx,e),this._frameIdx>=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=NFt/4,s=new Uint8Array(4*r*i),a=new Uint16Array(n),o=XRt.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 UFt;f.vCount=i,f.iCount=n,f.vData=s,f.iData=a;for(var _=e.getData(),d=e.getTextures(),p=_.size(),m=0;m<p;m+=5){var g=new GFt;g.iCount=_.get(m+3),g.blendMode=_.get(m+4),g.textureID=d.get(m/5),f.meshes.push(g)}var y=this._skeleton.bones,v=[];y.forEach((function(t){var e=new zFt;e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.worldX=t.worldX,e.worldY=t.worldY,v.push(e)})),this.frames[t]={model:f,boneInfos:v}},e.begin=function(){if(this._invalid){var t=this._skeletonInfo,e=null==t?void 0:t.curAnimationCache;e&&e!==this&&(this._privateMode?e.invalidAllFrame():e.updateToFrame(0));var i=null==t?void 0:t.listener;this._instance.setAnimation(0,this._animationName,!1),this.bind(i),t.curAnimationCache=this,this._frameIdx=-1,this.isCompleted=!1,this.totalTime=0,this._invalid=!1}},e.end=function(){this.needToUpdate()||(this._skeletonInfo.curAnimationCache=null,this.frames.length=this._frameIdx+1,this.isCompleted=!0,this.unbind(this._skeletonInfo.listener))},e.bind=function(t){var e=this;t.complete=function(t){t&&t.animation.name===e._animationName&&(e.isCompleted=!0)}},e.unbind=function(t){t.complete=null},e.needToUpdate=function(t){return!this.isCompleted&&this.totalTime<30&&(void 0===t||this._frameIdx<t)},e.isInited=function(){return this._inited},e.isInvalid=function(){return this._invalid},e.invalidAllFrame=function(){this.isCompleted=!1,this._invalid=!0},e.enableCacheAttachedInfo=function(){this._enableCacheAttachedInfo||(this._enableCacheAttachedInfo=!0,this.invalidAllFrame())},e.clear=function(){this._inited=!1,this.invalidAllFrame()},e.destroy=function(){this._instance&&(this._instance.destroy(),this._instance=null)},n(t,[{key:"skeleton",get:function(){return this._skeleton}}]),t}(),WFt=function(){function t(){this._privateMode=void 0,this._skeletonCache=void 0,this._animationPool=void 0,this._sharedCacheMap=new Map,this._privateMode=!1,this._animationPool={},this._skeletonCache={}}var e=t.prototype;return e.enablePrivateMode=function(){this._privateMode=!0},e.clear=function(){this._animationPool={},this._skeletonCache={}},e.invalidAnimationCache=function(t){var e=this._skeletonCache[t];if(e&&e.skeleton){var i=e.animationsCache;for(var n in i)i[n].invalidAllFrame()}},e.destroySkeleton=function(t){var e=this;if(!this._privateMode){var i=this._sharedCacheMap.get(t);if(i){if((i-=1)>0)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&&XRt.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 XRt.Skeleton(i),s=new DFt;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 HFt(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&&XRt.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}();TFt=WFt,WFt.FrameTime=BFt,WFt.sharedCache=new TFt;var jFt=(IFt=Kh("sp.SkeletonData"),MFt=Ou([Ey]),PFt=Ou([_i]),IFt((OFt=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonJson=kFt&&kFt(),e.textures=RFt&&RFt(),e.textureNames=FFt&&FFt(),e.scale=LFt&&LFt(),e._atlasText=VFt&&VFt(),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 eb(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||J(this.name+" no textures found!"),null;var e=this.mergedUUID(),i=XRt.wasmUtil.querySpineSkeletonDataByUUID(e);if(i)this._skeletonCache=i;else{for(var n=this.textures.length,r=[],s=0;s<n;++s){var a=this.textures[s];r.push(a.uuid||a.getId())}if(this._skeletonJson)this._skeletonCache=XRt.wasmUtil.createSpineSkeletonDataWithJson(this.skeletonJsonStr,this._atlasText,this.textureNames,r),XRt.wasmUtil.registerSpineSkeletonDataWithUUID(this._skeletonCache,e);else{var o=new Uint8Array(this._nativeAsset),h=o.length,u=XRt.wasmUtil.createStoreMemory(h);XRt.wasmUtil.wasm.HEAPU8.subarray(u,u+h).set(o),this._skeletonCache=XRt.wasmUtil.createSpineSkeletonDataWithBinary(h,this._atlasText,this.textureNames,r),XRt.wasmUtil.registerSpineSkeletonDataWithUUID(this._skeletonCache,e),XRt.wasmUtil.freeStoreMemory()}}return this._skeletonCache},i.getSkinsEnum=function(){if(this._skinsEnum)return this._skinsEnum;var t=this.getRuntimeData(!0);if(t){for(var e=t.skins,i={},n=0;n<e.length;n++)i[e[n].name]=n;return this._skinsEnum=Ee(i)}return null},i.getAnimsEnum=function(){if(this._animsEnum&&Object.keys(this._animsEnum).length>1)return this._animsEnum;var t=this.getRuntimeData(!0);if(t){for(var e={"<None>":0},i=t.animations,n=0;n<i.length;n++)e[i[n].name]=n+1;return this._animsEnum=Ee(e)}return null},i.mergedUUID=function(){var t=[this._atlasText].concat(this.textures.map((function(t){return t.getId()}))).join("");return""+this._uuid+qf(t,668)},i.destroy=function(){return WFt.sharedCache.destroyCachedAnimations(this._uuid),XRt.wasmUtil.destroySpineSkeletonDataWithUUID(this.mergedUUID()),t.prototype.destroy.call(this)},n(e,[{key:"skeletonJsonStr",get:function(){return this._skeletonJson?JSON.stringify(this._skeletonJson):""}},{key:"skeletonJson",get:function(){return this._skeletonJson},set:function(t){this.reset(),this._skeletonJson="string"==typeof t?JSON.parse(t):t,!this._uuid&&t.skeleton&&(this._uuid=t.skeleton.hash)}},{key:"atlasText",get:function(){return this._atlasText},set:function(t){this._atlasText=t,this.reset()}},{key:"_nativeAsset",get:function(){return this._buffer},set:function(t){this._buffer=t,this.reset()}}]),e}(Cm),kFt=zh(OFt.prototype,"_skeletonJson",[uu],(function(){return null})),RFt=zh(OFt.prototype,"textures",[uu,MFt],(function(){return[]})),FFt=zh(OFt.prototype,"textureNames",[uu,PFt],(function(){return[]})),LFt=zh(OFt.prototype,"scale",[uu],(function(){return 1})),VFt=zh(OFt.prototype,"_atlasText",[uu],(function(){return""})),EFt=OFt))||EFt);C.internal.SpineSkeletonData=jFt;var qFt=function(t){function e(){var e;return(e=t.call(this)||this)._skeletons=new Set,e}s(e,t),e.getInstance=function(){return e._instance||(e._instance=new e,YE.registerSystem(e.ID,e._instance,200)),e._instance};var i=e.prototype;return i.add=function(t){t&&(this._skeletons.has(t)||this._skeletons.add(t))},i.remove=function(t){t&&this._skeletons.has(t)&&this._skeletons.delete(t)},i.postUpdate=function(t){this._skeletons&&this._skeletons.forEach((function(e){e.updateAnimation(t)}))},i.prepareRenderData=function(){this._skeletons&&this._skeletons.forEach((function(t){t._markForUpdateRenderData()}))},e}(Ff);qFt.ID="SKELETON",qFt._instance=void 0,C.internal.SpineSkeletonSystem=qFt;var XFt,YFt,JFt,KFt,QFt,ZFt,$Ft,tLt,eLt,iLt,nLt,rLt,sLt,aLt,oLt,hLt,uLt,lLt,cLt,fLt,_Lt,dLt,pLt,mLt,gLt,yLt,vLt,bLt,SLt,wLt,xLt=new Kr,TLt=function(){function t(){this._isInitialized=!1,this._skeletonBones=null,this._socketNodes=null,this._keysToDelete=[],this._isInitialized=!1}var e=t.prototype;return e.init=function(t){var e;this._isInitialized=!1,t&&0!==(null==(e=t.socketNodes)?void 0:e.size)&&(this._skeletonBones=t._skeleton.bones,!this._skeletonBones||this._skeletonBones.length<1||(this._socketNodes=t.socketNodes,!this._socketNodes||this._socketNodes.size<=0||(this._isInitialized=!0,this._syncAttachedNode())))},e.updateSkeletonBones=function(t){this._skeletonBones=t},e.reset=function(){this._isInitialized=!1,this._skeletonBones=null,this._socketNodes=null,this._keysToDelete.length=0},e._syncAttachedNode=function(){if(this._isInitialized){for(var t,e=this._socketNodes,i=p(e);!(t=i()).done;){var n=t.value,r=n[0],s=n[1];if(s&&s.isValid){var a=this._skeletonBones[r];a&&this.matrixHandle(s,a)}else this._keysToDelete.push(r)}if(!(this._keysToDelete.length<=0)){for(var o,h=p(this._keysToDelete);!(o=h()).done;){var u=o.value;e.delete(u)}this._keysToDelete.length=0}}},e.matrixHandle=function(t,e){var i=xLt;i.m00=e.a,i.m01=e.c,i.m04=e.b,i.m05=e.d,i.m12=e.worldX,i.m13=e.worldY,t.matrix=xLt},t}(),ALt={UNSET:-1,REALTIME:0,SHARED_CACHE:1,PRIVATE_CACHE:2};Re(ALt);var CLt=ALt,DLt={default:0};Re(DLt);var BLt={"<None>":0};Re(BLt);var ILt=BLt,MLt=(XFt=Kh("sp.Skeleton.SpineSocket"),YFt=Ou(eb),XFt((KFt=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),this.path=QFt&&QFt(),this.target=ZFt&&ZFt(),this.path=t,this.target=e},QFt=zh(KFt.prototype,"path",[uu],(function(){return""})),ZFt=zh(KFt.prototype,"target",[YFt,uu],(function(){return null})),JFt=KFt))||JFt);le(MLt,"sp.Skeleton.SpineSocket");var PLt=($Ft=Kh("sp.Skeleton"),tLt=Ou(jFt),eLt=Ou(DLt),iLt=Ou(BLt),nLt=Ou(ALt),rLt=Ou([MLt]),sLt=Ou(GT),$Ft((wLt=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonData=hLt&&hLt(),e.defaultSkin=uLt&&uLt(),e.defaultAnimation=lLt&&lLt(),e._premultipliedAlpha=cLt&&cLt(),e._timeScale=fLt&&fLt(),e._preCacheMode=_Lt&&_Lt(),e._cacheMode=dLt&&dLt(),e._sockets=pLt&&pLt(),e._useTint=mLt&&mLt(),e._debugMesh=gLt&&gLt(),e._debugBones=yLt&&yLt(),e._debugSlots=vLt&&vLt(),e._enableBatch=bLt&&bLt(),e._runtimeData=null,e._skeleton=null,e._instance=null,e._state=null,e._textures=[],e._skeletonInfo=null,e._animationName="",e._skinName="",e._drawList=new uo((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=SLt&&SLt(),e._useVertexOpacity=!0,e._startEntry={animation:{name:""},trackIndex:0},e._endEntry={animation:{name:""},trackIndex:0},e._startSlotIndex=-1,e._endSlotIndex=-1,e._instance=new XRt.SkeletonInstance,e._instance.dtRate=1*e._timeScale,e._instance.isCache=e.isAnimationCached(),e.attachUtil=new TLt,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(),qFt.getInstance().add(this)},i.onDisable=function(){t.prototype.onDisable.call(this),this._instance&&(this._instance.enable=!1),qFt.getInstance().remove(this)},i.onDestroy=function(){var e;this._eventListenerID>0&&(DFt.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,qFt.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=WFt.sharedCache:2===this._cacheMode?(this._skeletonCache=new WFt,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=WFt.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<this._drawList.length;o++){var h=this._drawList.data[o];h.texture&&t.commitMiddleware(this,s,a+h.indexOffset,h.indexCount,h.texture,h.material,this._enableBatch),e+=h.indexCount}var u=i.indices.subarray(0,e);r.appendIndices(n.bufferId,u),r.getMeshBuffer(n.bufferId).setDirty()}},i.requestDrawData=function(t,e,i,n){var r=this._drawList.add();r.material=t;var s,a,o=fT.assets.get(e);return o||(o=null==(s=this.skeletonData)?void 0:s.textures.find((function(t){return t.uuid===e||t.getId()===e})))||(o=null==(a=this._slotTextures)?void 0:a.get(e)),r.texture=o,r.indexOffset=i,r.indexCount=n,r},i._updateBuiltinMaterial=function(){return mT.get("default-spine-material")},i.updateMaterial=function(){var t;t=this._customMaterial?this._customMaterial:this._updateBuiltinMaterial(),this.setSharedMaterial(t,0),this._cleanMaterialCache()},i.getMaterialTemplate=function(){return null!==this.customMaterial?this.customMaterial:(this.material||this.updateMaterial(),this.material)},i._cleanMaterialCache=function(){for(var t in this._materialCache)this._materialCache[t].destroy();this._materialCache={}},i.getMaterialForBlendAndTint=function(t,e,i){var n=i+"/"+t+"/"+e,r=this._materialCache[n];if(r)return r;if(this._customMaterialInstance)r=this._customMaterialInstance;else{var s=this.getMaterialTemplate();r=new QT({parent:s,subModelIdx:0,owner:this})}this._materialCache[n]=r,r.overridePipelineStates({blendState:{blendColor:cr.WHITE,targets:[{blendEq:0,blendAlphaEq:0,blendSrc:t,blendDst:e,blendSrcAlpha:t,blendDstAlpha:e}]}});var a=!1;1===i&&(a=!0);var o=!this._enableBatch;return r.recompileShaders({TWO_COLORED:a,USE_LOCAL:o}),r},i._updateAnimEnum=function(){var t;t=this.skeletonData?this.skeletonData.getAnimsEnum():BLt,this._enumAnimations=Ee({}),Object.assign(this._enumAnimations,t),Ee.update(this._enumAnimations),Ti(this,"_animationIndex",this._enumAnimations)},i._updateSkinEnum=function(){var t;t=this.skeletonData?this.skeletonData.getSkinsEnum():DLt,this._enumSkins=Ee({}),Object.assign(this._enumSkins,t),Ee.update(this._enumSkins),Ti(this,"_defaultSkinIndex",this._enumSkins)},i._refreshInspector=function(){},i.destroyRenderData=function(){this._drawList.reset(),t.prototype.destroyRenderData.call(this)},i.createRenderEntity=function(){var t=new DL(1);return t.setUseLocal(!0),t},i.markForUpdateRenderData=function(e){void 0===e&&(e=!0),t.prototype._markForUpdateRenderData.call(this,e),this._debugRenderer&&this._debugRenderer._markForUpdateRenderData(e)},i.syncAttachedNode=function(){this.attachUtil._syncAttachedNode()},i.isAnimationCached=function(){return 0!==this._cacheMode},i.setAnimationCacheMode=function(t){this._preCacheMode!==t&&(this._cacheMode=t,this._preCacheMode=t,this._instance&&(this._instance.isCache=this.isAnimationCached()),this._updateSkeletonData(),this._markForUpdateRenderData())},i.setToSetupPose=function(){this._skeleton&&this._skeleton.setToSetupPose()},i.setBonesToSetupPose=function(){this._skeleton&&this._skeleton.setBonesToSetupPose()},i.setSlotsToSetupPose=function(){this._skeleton&&this._skeleton.setSlotsToSetupPose()},i.invalidAnimationCache=function(){this.isAnimationCached()&&this._skeletonCache&&this._skeletonCache.invalidAnimationCache(this._skeletonData.uuid)},i.findBone=function(t){return this._skeleton?this._skeleton.findBone(t):null},i.findSlot=function(t){return this._skeleton?this._skeleton.findSlot(t):null},i.setMix=function(t,e,i){this.isAnimationCached()?at(16415):this._state&&this._instance.setMix(t,e,i)},i.clearTracks=function(){this.isAnimationCached()?at(16416):this._state&&(this._state.clearTracks(),this.setToSetupPose())},i.clearTrack=function(t){this.isAnimationCached()?at(16417):this._state&&this._state.clearTrack(t)},i.updateWorldTransform=function(){this.isAnimationCached()&&this._skeleton&&this._skeleton.updateWorldTransform()},i._verifySockets=function(t){for(var e=0,i=t.length;e<i;e++){var n=t[e].target;!n||n.parent&&n.parent===this.node||J("Target node "+n.name+" is expected to be a direct child of "+this.node.name)}var r=new Map;t.forEach((function(t){t.target&&(r.get(t.target)?J("Target node "+t.target.name+" has existed."):r.set(t.target,!0))}))},i._updateSocketBindings=function(){if(this._skeleton){this._socketNodes.clear();for(var t=0,e=this._sockets.length;t<e;t++){var i=this._sockets[t];if(i.path&&i.target){var n=this._cachedSockets.get(i.path);if(!n){J("Skeleton data does not contain path "+i.path);continue}this._socketNodes.set(n,i.target)}}}},i._indexBoneSockets=function(){if(this._skeleton){this._cachedSockets.clear();for(var t=this._skeleton.bones,e=function e(i){return null==i.parent?i.data.name||"<Unamed>":e(t[i.parent.data.index])+"/"+i.data.name},i=0,n=t.length;i<n;i++){var r=t[i].data,s=e(t[i]);this._cachedSockets.set(s,r.index)}}},i.querySockets=function(){return this._skeleton?(0===this._cachedSockets.size&&this._indexBoneSockets(),this._cachedSockets.size>0?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 eb("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 DFt,this._eventListenerID=DFt.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){DFt.getListeners(t,this._instance).start=e},i.setTrackInterruptListener=function(t,e){DFt.getListeners(t,this._instance).interrupt=e},i.setTrackEndListener=function(t,e){DFt.getListeners(t,this._instance).end=e},i.setTrackDisposeListener=function(t,e){DFt.getListeners(t,this._instance).dispose=e},i.setTrackCompleteListener=function(t,e){DFt.getListeners(t,this._instance).complete=function(t){var i=Math.floor(t.trackTime/t.animationEnd);e(t,i)}},i.setTrackEventListener=function(t,e){DFt.getListeners(t,this._instance).event=e},i.getDebugShapes=function(){return this._instance.getDebugShapes()},i.setSlotTexture=function(t,e,i){if(this.isAnimationCached())J("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 J("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()):J(this.name+" skin enums are invalid")}else J(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):J(this.name+" animation enums are invalid")}else J(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 QT(t)}return this._customMaterialInstance}}]),e}(BL),wLt.SpineSocket=MLt,wLt.AnimationCacheMode=ALt,hLt=zh((oLt=wLt).prototype,"_skeletonData",[uu],(function(){return null})),uLt=zh(oLt.prototype,"defaultSkin",[uu],(function(){return""})),lLt=zh(oLt.prototype,"defaultAnimation",[uu],(function(){return""})),cLt=zh(oLt.prototype,"_premultipliedAlpha",[uu],(function(){return!0})),fLt=zh(oLt.prototype,"_timeScale",[uu],(function(){return 1})),_Lt=zh(oLt.prototype,"_preCacheMode",[uu],(function(){return-1})),dLt=zh(oLt.prototype,"_cacheMode",[uu],(function(){return 0})),pLt=zh(oLt.prototype,"_sockets",[uu],(function(){return[]})),mLt=zh(oLt.prototype,"_useTint",[uu],(function(){return!1})),gLt=zh(oLt.prototype,"_debugMesh",[uu],(function(){return!1})),yLt=zh(oLt.prototype,"_debugBones",[uu],(function(){return!1})),vLt=zh(oLt.prototype,"_debugSlots",[uu],(function(){return!1})),bLt=zh(oLt.prototype,"_enableBatch",[uu],(function(){return!1})),v(oLt.prototype,"skeletonData",[tLt],Object.getOwnPropertyDescriptor(oLt.prototype,"skeletonData"),oLt.prototype),v(oLt.prototype,"_defaultSkinIndex",[eLt],Object.getOwnPropertyDescriptor(oLt.prototype,"_defaultSkinIndex"),oLt.prototype),v(oLt.prototype,"_animationIndex",[iLt],Object.getOwnPropertyDescriptor(oLt.prototype,"_animationIndex"),oLt.prototype),v(oLt.prototype,"defaultCacheMode",[nLt],Object.getOwnPropertyDescriptor(oLt.prototype,"defaultCacheMode"),oLt.prototype),SLt=zh(oLt.prototype,"loop",[uu],(function(){return!0})),v(oLt.prototype,"sockets",[rLt],Object.getOwnPropertyDescriptor(oLt.prototype,"sockets"),oLt.prototype),v(oLt.prototype,"customMaterial",[Gu,sLt],Object.getOwnPropertyDescriptor(oLt.prototype,"customMaterial"),oLt.prototype),aLt=oLt))||aLt);C.internal.SpineSkeleton=PLt;var ELt,OLt,kLt,RLt,FLt=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 XRt.JitterEffect(t,e),this._vertexEffect},e.initSwirlWithPow=function(t,e){return this._effectType="swirl",this._interpolation=new XRt.Pow(e),this._vertexEffect=new XRt.SwirlEffect(t,this._interpolation),this._vertexEffect},e.initSwirlWithPowOut=function(t,e){return this._effectType="swirl",this._interpolation=new XRt.PowOut(e),this._vertexEffect=new XRt.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}(),LLt=new cr(0,0,255,255),VLt=new cr(255,0,0,255),NLt=new cr(0,255,0,255),zLt=new cr(255,255,0,255),ULt=null,GLt=null,HLt=!1,WLt=!1,jLt=kF(MF),qLt=kF(EF),XLt=new ir(0,0,0);function YLt(t,e){var i,n;switch(t){case 1:i=HLt?1:2,n=1;break;case 2:i=7,n=4;break;case 3:i=HLt?1:2,n=8;break;default:i=HLt?1:2,n=4}return e.getMaterialForBlendAndTint(i,n,WLt?1:0)}var JLt=function(){function t(){this.vCount=32767}var e=t.prototype;return e.ensureAccessor=function(t){var e=t?GLt:ULt;if(!e){var i=YE.root.device,n=YE.root.batcher2D,r=t?EF:MF;t?(e=GLt=new NF(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINETINT",36),GLt)):(e=ULt=new NF(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINE",36),ULt))}return e},e.createData=function(t){var e=t.renderData;if(!e){var i=t.useTint||t.isAnimationCached(),n=this.ensureAccessor(i);e=tL.add(i?EF:MF,n)}return e},e.updateRenderData=function(t){var e;t._skeleton&&t.node.active&&null!=(e=t.skeletonData)&&e.isValid&&QLt(t)},t}(),KLt=new JLt;function QLt(t){if(t.drawList.reset(),0!==t.color.a){t._updateColor(),HLt=t.premultipliedAlpha,WLt=t.useTint||t.isAnimationCached(),t.isAnimationCached()?$Lt(t):ZLt(t);var e=t.renderData,i=WLt?GLt:ULt;t.syncAttachedNode(),(e.vertexCount>0||e.indexCount>0)&&i.getMeshBuffer(e.chunk.bufferId).setDirty()}}function ZLt(t){var e,i,n=(t.useTint?qLt:jLt)/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=XRt.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 _=o.chunk.vertexOffset,d=0;d<a;d++)c[d]+=_;for(var p=r.getData(),m=r.getTextures(),g=p.size(),y=0,v=0,b=0;b<g;b+=5){v=p.get(b+3);var S=YLt(p.get(b+4),t);t.requestDrawData(S,m.get(b/5),y,v),y+=v}if(t.enableBatch)for(var w=t.node.worldMatrix,x=0,T=0;T<s;T++)x=T*n,XLt.x=h[x],XLt.y=h[x+1],XLt.z=0,XLt.transformMat4(w),h[x]=XLt.x,h[x+1]=XLt.y,h[x+2]=XLt.z;var A=t._debugRenderer,C=t._skeleton;if(A&&(t.debugBones||t.debugSlots||t.debugMesh)){A.clear();for(var D=t.getDebugShapes(),B=D.size(),I=0;I<B;I++){var M=D.get(I);if(0===M.type&&t.debugSlots){A.strokeColor=LLt;var P=M.vOffset*n,E=M.vCount*n;A.moveTo(h[P],h[P+1]);for(var O=P+n,k=P+E;O<k;O+=n)A.lineTo(h[O],h[O+1]);A.close(),A.stroke()}else if(1===M.type&&t.debugMesh){A.strokeColor=zLt;for(var R=M.iCount,F=M.iOffset,L=F,V=F+R;L<V;L+=3){var N=c[L]*n,z=c[L+1]*n,U=c[L+2]*n;A.moveTo(h[N],h[N+1]),A.lineTo(h[z],h[z+1]),A.lineTo(h[U],h[U+1]),A.close(),A.stroke()}}}if(t.debugBones){A.strokeColor=VLt,A.fillColor=LLt;for(var G=0,H=C.bones.length;G<H;G++){var W=C.bones[G],j=W.data.length*W.a+W.worldX,q=W.data.length*W.c+W.worldY;A.moveTo(W.worldX,W.worldY),A.lineTo(j,q),A.stroke(),A.circle(W.worldX,W.worldY,1.5*Math.PI),A.fill(),0===G&&(A.fillColor=NLt)}}}}}function $Lt(t){var e=t.updateRenderData();if(e){var i=e.vCount,n=e.iCount;if(!(i<1||n<1)){var r=t.renderData;r.vertexCount===i&&r.indexCount===n||(r.resize(i,n),r.indices=new Uint16Array(n));var s=r.chunk.vb,a=new Uint8Array(s.buffer,s.byteOffset,4*s.length);a.set(e.vData);var o=t.color,h=t.node._uiProps.opacity;if(1-h>Ki||4294967295!==cr.toUint32(o)||HLt){ELt=o.r/255,OLt=o.g/255,kLt=o.b/255,RLt=h;for(var u=0;u<i;u++){var l=u*qLt+20,c=a[l],f=a[l+1],_=a[l+2],d=a[l+3]*RLt,p=HLt?d/255:1;a[l]=Math.floor(p*c*ELt),a[l+1]=Math.floor(p*f*OLt),a[l+2]=Math.floor(p*_*kLt),a[l+3]=Math.floor(d),a[l+4]=Math.floor(a[l+4]*ELt),a[l+5]=Math.floor(a[l+5]*OLt),a[l+6]=Math.floor(a[l+6]*kLt),a[l+7]=HLt?255:0}}var m=r.indices;m.set(e.iData);for(var g=r.chunk.vertexOffset,y=0;y<n;y++)m[y]+=g;for(var v=e.meshes,b=v.length,S=0,w=0,x=0;x<b;x++){var T=v[x],A=YLt(T.blendMode,t),C=T.textureID;w=T.iCount,t.requestDrawData(A,C,S,w),S+=w}var D=qLt/4;if(t.enableBatch)for(var B=t.node.worldMatrix,I=0,M=0;M<i;M++)I=M*D,XLt.x=s[I],XLt.y=s[I+1],XLt.z=0,XLt.transformMat4(B),s[I]=XLt.x,s[I+1]=XLt.y,s[I+2]=XLt.z}}}C.internal.SpineAssembler=KLt;var tVt={getAssembler:function(){return KLt}};PLt.Assembler=tVt;var eVt={REGION:0,BOUNDING_BOX:1,MESH:2,SKINNED_MESH:3};Re(eVt);var iVt={START:0,INTERRUPT:1,END:2,DISPOSE:3,COMPLETE:4,EVENT:5};function nVt(){return Promise.resolve()}Re(iVt),t("g6",Object.freeze({__proto__:null,ATTACHMENT_TYPE:eVt,AnimationCacheMode:CLt,AnimationEventType:iVt,DefaultAnimsEnum:ILt,DefaultSkinsEnum:DLt,SPINE_VERSION:"3.8",Skeleton:PLt,SkeletonData:jFt,SpineAnimationCacheMode:ALt,SpineDefaultAnimsEnum:BLt,SpineMaterialType:{COLORED_TEXTURED:0,TWO_COLORED:1},SpineSocket:MLt,VertexEffectDelegate:FLt,isBinaryCompatible:function(){return!1},isJsonCompatible:function(){return!1},loadWasmModuleSpine:nVt,simpleSpineAssembler:tVt,spine:XRt,timeScale:1})),t("g8",function(){function t(t,e){this.data=new Uint16Array,this.w=0,this.h=0,this.w=t,this.h=e,this.data=new Uint16Array(t*e);for(var i=0;i<t*e;++i)this.data[i]=0}var e=t.prototype;return e.set=function(t,e,i){this.data[e*this.w+t]=i},e.get=function(t,e){return this.data[e*this.w+t]},e.getClamp=function(t,e){return t=$i(t,0,this.w-1),e=$i(e,0,this.h-1),this.get(t,e)},e.getAt=function(t,e){var i=t,n=e,r=Math.floor(i),s=Math.floor(n),a=r+1,o=s+1,h=i-r,u=n-s;r=$i(r,0,this.w-1),s=$i(s,0,this.h-1),a=$i(a,0,this.w-1),o=$i(o,0,this.h-1);var l=this.get(r,s),c=this.get(a,s),f=this.get(r,o),_=this.get(a,o),d=.5*(c+f);return h+u<=1?_=d+(d-l):l=d+(d-_),(l*(1-h)+c*h)*(1-u)+(f*(1-h)+_*h)*u},t}());var rVt,sVt,aVt,oVt,hVt,uVt,lVt,cVt,fVt,_Vt,dVt,pVt,mVt,gVt,yVt,vVt,bVt,SVt,wVt,xVt,TVt,AVt,CVt,DVt,BVt,IVt,MVt,PVt,EVt,OVt,kVt,RVt,FVt,LVt,VVt,NVt,zVt,UVt,GVt=33,HVt=1e14,WVt=function(){function t(){this.level=0,this.north=0,this.south=0,this.west=0,this.east=0}return t.prototype.equals=function(t){return this.level===t.level&&this.north===t.north&&this.south===t.south&&this.west===t.west&&this.east===t.east},t}(),jVt=function(){this.size=0,this.indices=null},qVt=function(){this.key=new WVt,this.start=0,this.size=0,this.buffer=null,this.primCount=0},XVt=function(){function t(){this._bodyIndexPool=void 0,this._connecterIndexPool=void 0,this._indexMap=[],this._indexBuffer=new Uint16Array,this._bodyIndexPool=new Array(4);for(var e=0;e<4;++e)this._bodyIndexPool[e]=new jVt;this._connecterIndexPool=new Array(64);for(var i=0;i<4;++i)for(var n=0;n<4;++n)for(var r=0;r<4;++r)this._connecterIndexPool[t.mapIndex(i,n,r)]=new jVt;for(var s=0;s<4;++s)this._genBodyIndex(s);for(var a=0;a<4;++a)for(var o=0;o<4;++o)this._genConnecterIndexNorth(a,o),this._genConnecterIndexSouth(a,o),this._genConnecterIndexWest(a,o),this._genConnecterIndexEast(a,o);for(var h=0;h<4;++h)for(var u=0;u<4;++u)if(!(u<h))for(var l=0;l<4;++l)if(!(l<h))for(var c=0;c<4;++c)if(!(c<h))for(var f=0;f<4;++f)if(!(f<h)){var _=new WVt;_.level=h,_.north=u,_.south=l,_.west=c,_.east=f,this._genIndexData(_)}}t.mapIndex=function(t,e,i){return 16*t+4*e+i};var e=t.prototype;return e.getIndexData=function(t){for(var e=0;e<this._indexMap.length;++e)if(this._indexMap[e].key.equals(t))return this._indexMap[e];return null},e._genBodyIndex=function(t){var e=1<<t,i=32>>t,n=0;if(t<3&&(i-=2,n=e*GVt+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+GVt*e,u=0;u<i;++u){for(var l=0;l<i;++l)a[s++]=h+l*e,a[s++]=h+(l+1)*e,a[s++]=o+l*e,a[s++]=h+(l+1)*e,a[s++]=o+(l+1)*e,a[s++]=o+l*e;o+=GVt*e,h+=GVt*e}this._bodyIndexPool[t].size=s,this._bodyIndexPool[t].indices=a}},e._genConnecterIndexNorth=function(e,i){var n=t.mapIndex(e,i,0);if(i<e||3===e)return this._connecterIndexPool[n].size=0,void(this._connecterIndexPool[n].indices=null);var r=1<<e,s=1<<i,a=32>>e,o=0,h=new Uint16Array(2*a+2);h[o++]=0,h[o++]=0;for(var u=1;u<a;++u){var l=u*r,c=r*GVt+l,f=(r-r)*GVt+l/s*s;h[o++]=c,h[o++]=f}h[o++]=32,h[o++]=32,this._connecterIndexPool[n].size=o,this._connecterIndexPool[n].indices=h},e._genConnecterIndexSouth=function(e,i){var n=t.mapIndex(e,i,1);if(i<e||3===e)return this._connecterIndexPool[n].size=0,void(this._connecterIndexPool[n].indices=null);var r=1<<e,s=1<<i,a=32>>e,o=0,h=new Uint16Array(2*a+2);h[o++]=1056,h[o++]=1056;for(var u=1;u<a;++u){var l=u*r,c=32-r,f=(c+r)*GVt+l/s*s,_=c*GVt+l;h[o++]=f,h[o++]=_}h[o++]=1088,h[o++]=1088,this._connecterIndexPool[n].size=o,this._connecterIndexPool[n].indices=h},e._genConnecterIndexWest=function(e,i){var n=t.mapIndex(e,i,2);if(i<e||3===e)return this._connecterIndexPool[n].size=0,void(this._connecterIndexPool[n].indices=null);var r=1<<e,s=1<<i,a=32>>e,o=0,h=new Uint16Array(2*a+2);h[o++]=0,h[o++]=0;for(var u=1;u<a;++u){var l=u*r/s*s*GVt+0,c=u*r*GVt+r;h[o++]=l,h[o++]=c}h[o++]=1056,h[o++]=1056,this._connecterIndexPool[n].size=o,this._connecterIndexPool[n].indices=h},e._genConnecterIndexEast=function(e,i){var n=t.mapIndex(e,i,3);if(i<e||3===e)return this._connecterIndexPool[n].size=0,void(this._connecterIndexPool[n].indices=null);var r=1<<e,s=1<<i,a=32>>e,o=0,h=new Uint16Array(2*a+2);h[o++]=32,h[o++]=32;for(var u=1;u<a;++u){var l=u*r*GVt+(32-r),c=u*r/s*s*GVt+32;h[o++]=l,h[o++]=c}h[o++]=1088,h[o++]=1088,this._connecterIndexPool[n].size=o,this._connecterIndexPool[n].indices=h},e._getConnenterIndex=function(e,i,n){return this._connecterIndexPool[t.mapIndex(e,i,n)]},e._genIndexData=function(t){var e=this.getIndexData(t);if(null!=e)return e;var i=this._bodyIndexPool[t.level],n=this._getConnenterIndex(t.level,t.north,0),r=this._getConnenterIndex(t.level,t.south,1),s=this._getConnenterIndex(t.level,t.west,2),a=this._getConnenterIndex(t.level,t.east,3);if((e=new qVt).size=0,e.primCount=0,null!=i.indices&&(e.size+=i.size),n.indices&&(e.size+=3*(n.size-2)),r.indices&&(e.size+=3*(r.size-2)),s.indices&&(e.size+=3*(s.size-2)),a.indices&&(e.size+=3*(a.size-2)),0===e.size)return null;var o=0;if(e.buffer=new Uint16Array(e.size),e.key.level=t.level,e.key.east=t.east,e.key.west=t.west,e.key.north=t.north,e.key.south=t.south,i.indices)for(var h=0;h<i.size;++h)e.buffer[o++]=i.indices[h];if(n.indices)for(var u=0;u<n.size-2;u+=2){var l=n.indices[u+0],c=n.indices[u+1],f=n.indices[u+2],_=n.indices[u+3];e.buffer[o++]=l,e.buffer[o++]=f,e.buffer[o++]=c,e.buffer[o++]=f,e.buffer[o++]=_,e.buffer[o++]=c}if(r.indices)for(var d=0;d<r.size-2;d+=2){var p=r.indices[d+0],m=r.indices[d+1],g=r.indices[d+2],y=r.indices[d+3];e.buffer[o++]=p,e.buffer[o++]=g,e.buffer[o++]=m,e.buffer[o++]=g,e.buffer[o++]=y,e.buffer[o++]=m}if(s.indices)for(var v=0;v<s.size-2;v+=2){var b=s.indices[v+0],S=s.indices[v+1],w=s.indices[v+2],x=s.indices[v+3];e.buffer[o++]=b,e.buffer[o++]=w,e.buffer[o++]=S,e.buffer[o++]=w,e.buffer[o++]=x,e.buffer[o++]=S}if(a.indices)for(var T=0;T<a.size-2;T+=2){var A=a.indices[T+0],C=a.indices[T+1],D=a.indices[T+2],B=a.indices[T+3];e.buffer[o++]=A,e.buffer[o++]=D,e.buffer[o++]=C,e.buffer[o++]=D,e.buffer[o++]=B,e.buffer[o++]=C}e.primCount=o/3,e.start=this._indexBuffer.length,this._indexMap.push(e);var I=new Uint16Array(e.start+e.size);return I.set(this._indexBuffer,0),I.set(e.buffer,e.start),this._indexBuffer=I,e},t}(),YVt=t("g9",Kh("cc.TerrainInfo")((sVt=function(){function t(){this.tileSize=aVt&&aVt(),this.blockCount=oVt&&oVt(),this.weightMapSize=hVt&&hVt(),this.lightMapSize=uVt&&uVt()}return n(t,[{key:"size",get:function(){var t=new ms(0,0);return t.width=this.blockCount[0]*IIt*this.tileSize,t.height=this.blockCount[1]*IIt*this.tileSize,t}},{key:"tileCount",get:function(){var t=[0,0];return t[0]=this.blockCount[0]*IIt,t[1]=this.blockCount[1]*IIt,t}},{key:"vertexCount",get:function(){var t=this.tileCount;return t[0]+=1,t[1]+=1,t}}]),t}(),aVt=zh(sVt.prototype,"tileSize",[uu],(function(){return 1})),oVt=zh(sVt.prototype,"blockCount",[uu],(function(){return[1,1]})),hVt=zh(sVt.prototype,"weightMapSize",[uu],(function(){return 128})),uVt=zh(sVt.prototype,"lightMapSize",[uu],(function(){return 128})),rVt=sVt))||rVt),JVt=t("ga",Kh("cc.TerrainLayer")((cVt=function(){this.detailMap=fVt&&fVt(),this.normalMap=_Vt&&_Vt(),this.tileSize=dVt&&dVt(),this.metallic=pVt&&pVt(),this.roughness=mVt&&mVt()},fVt=zh(cVt.prototype,"detailMap",[uu],(function(){return null})),_Vt=zh(cVt.prototype,"normalMap",[uu],(function(){return null})),dVt=zh(cVt.prototype,"tileSize",[uu],(function(){return 1})),pVt=zh(cVt.prototype,"metallic",[uu],(function(){return 0})),mVt=zh(cVt.prototype,"roughness",[uu],(function(){return 1})),lVt=cVt))||lVt),KVt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._model=null,e._meshData=null,e._brushPass=null,e._brushMaterial=null,e._currentMaterial=null,e._currentMaterialLayers=0,e._lightmap=null,e}s(e,t);var i=e.prototype;return i.destroy=function(){return null!=this._model&&(C.director.root.destroyModel(this._model),this._model=null),t.prototype.destroy.call(this)},i._destroyModel=function(){null!=this._model&&(C.director.root.destroyModel(this._model),this._model=null),null!=this._meshData&&(this._meshData.destroy(),this._meshData=null)},i._invalidMaterial=function(){null!=this._currentMaterial&&(this._clearMaterials(),this._brushPass=null,this._currentMaterial=null,null!=this._model&&(this._model.enabled=!1))},i._updateMaterial=function(t,e){if(null==this._meshData||null==this._model)return!1;var i=t.getMaxLayer();if(null==this._currentMaterial||i!==this._currentMaterialLayers){if(this._currentMaterial=new GT,this._currentMaterial.initialize({effectAsset:t.getTerrain().getEffectAsset(),defines:t._getMaterialDefines(i)}),null!==this._brushMaterial){var n=new GT;n.copy(this._brushMaterial),this._brushPass=null,null!==n.passes&&n.passes.length>0&&(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===Uy.Static&&this._lightmap?this._onUpdateReceiveDirLight(i,!0):this._onUpdateReceiveDirLight(i))}}},i._getBuiltinMaterial=function(){return mT.get("missing-material")},e}(HU),QVt=t("gb",Kh("cc.TerrainBlockLightmapInfo")((yVt=function(){this.texture=vVt&&vVt(),this.UOff=bVt&&bVt(),this.VOff=SVt&&SVt(),this.UScale=wVt&&wVt(),this.VScale=xVt&&xVt()},vVt=zh(yVt.prototype,"texture",[uu],(function(){return null})),bVt=zh(yVt.prototype,"UOff",[uu],(function(){return 0})),SVt=zh(yVt.prototype,"VOff",[uu],(function(){return 0})),wVt=zh(yVt.prototype,"UScale",[uu],(function(){return 0})),xVt=zh(yVt.prototype,"VScale",[uu],(function(){return 0})),gVt=yVt))||gVt),ZVt=t("gc",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 WVt,this._errorMetrics=[0,0,0,0],this._LevelDistances=[HVt,HVt,HVt,HVt],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 eb("TerrainBlock"),this._node.setParent(this._terrain.node),this._node.hideFlags|=1032,this._node.layer=this._terrain.node.layer,this._renderable=this._node.addComponent(KVt)}var e=t.prototype;return e.build=function(){var t=YE.root.device,e=new Float32Array(PIt*MIt*MIt);this._buildVertexData(e);var i=t.createBuffer(new ud(10,1,4*PIt*MIt*MIt,4*PIt));i.update(e),this._buildBoundingBox();var n=[new Cd("a_position",32),new Cd("a_normal",32),new Cd("a_texCoord",21)];this._renderable._meshData=new sO([i],n,7,this._terrain._getSharedIndexBuffer(),null,!1),this._renderable._model=C.director.root.createModel(KM),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=mT.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",mT.get("default-texture")),t&&r.setProperty("normalMap0",mT.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]),_=this._terrain.getLayer(this.layers[1]),d=this._terrain.getLayer(this.layers[2]);null!==f&&(a.x=1/f.tileSize,o.x=f.roughness,h.x=f.metallic),null!==_&&(a.y=1/_.tileSize,o.y=_.roughness,h.y=_.metallic),null!==d&&(a.z=1/d.tileSize,o.z=d.roughness,h.z=d.metallic),r.setProperty("weightMap",this._weightMap),r.setProperty("detailMap0",i(f)),r.setProperty("detailMap1",i(_)),r.setProperty("detailMap2",i(d)),t&&(r.setProperty("normalMap0",n(f)),r.setProperty("normalMap1",n(_)),r.setProperty("normalMap2",n(d)))}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]),y=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!==y&&(a.w=1/y.tileSize,o.w=y.roughness,h.w=y.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(y)),t&&(r.setProperty("normalMap0",n(p)),r.setProperty("normalMap1",n(m)),r.setProperty("normalMap2",n(g)),r.setProperty("normalMap3",n(y)))}r.setProperty("UVScale",a),e&&(r.setProperty("roughness",o),r.setProperty("metallic",h))}},e._buildLodInfo=function(){var t=new Float32Array(PIt*MIt*MIt);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 bs;return t.x=this._index[0]*IIt,t.y=this._index[1]*IIt,t.width=IIt,t.height=IIt,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(PIt*MIt*MIt);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 Ey,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;i<this._terrain.weightMapSize;++i)for(var n=0;n<this._terrain.weightMapSize;++n){var r=this._index[0]*this._terrain.weightMapSize+n,s=this._index[1]*this._terrain.weightMapSize+i,a=this._terrain.getWeight(r,s);t[4*e+0]=Math.floor(255*a.x),t[4*e+1]=Math.floor(255*a.y),t[4*e+2]=Math.floor(255*a.z),t[4*e+3]=Math.floor(255*a.w),e+=1}this._weightMap.uploadData(t)}else null!=this._weightMap&&(this._weightMap.destroy(),this._weightMap=null)},e._updateLightmap=function(t){this._lightmapInfo=t,this._invalidMaterial()},e._updateLod=function(){var t=new WVt;if(t.level=this._lodLevel,t.north=this._lodLevel,t.south=this._lodLevel,t.west=this._lodLevel,t.east=this._lodLevel,this._index[0]>0){var e=this.getTerrain().getBlock(this._index[0]-1,this._index[1]);t.west=e._lodLevel,t.west<this._lodLevel&&(t.west=this._lodLevel)}if(this._index[0]<this._terrain.info.blockCount[0]-1){var i=this.getTerrain().getBlock(this._index[0]+1,this._index[1]);t.east=i._lodLevel,t.east<this._lodLevel&&(t.east=this._lodLevel)}if(this._index[1]>0){var n=this.getTerrain().getBlock(this._index[0],this._index[1]-1);t.north=n._lodLevel,t.north<this._lodLevel&&(t.north=this._lodLevel)}if(this._index[1]<this._terrain.info.blockCount[1]-1){var r=this.getTerrain().getBlock(this._index[0],this._index[1]+1);t.south=r._lodLevel,t.south<this._lodLevel&&(t.south=this._lodLevel)}this._lodKey.equals(t)||(this._lodKey=t,this._updateIndexBuffer())},e._resetLod=function(){var t=new WVt;t.level=0,t.north=0,t.south=0,t.west=0,t.east=0,this._lodKey.equals(t)||(this._lodKey=t,this._updateIndexBuffer())},e._updateIndexBuffer=function(){if(null!==this._renderable._meshData&&null!==this._renderable._model&&0!==this._renderable._model.subModels.length){var t=this._terrain._getIndexData(this._lodKey);if(null!==t){var e=this._renderable._model.subModels[0];e.inputAssembler.firstIndex=t.start,e.inputAssembler.indexCount=t.size}}},e._getHeight=function(t,e,i){return i[(MIt*e+t)*PIt+1]},e._updateLodBuffer=function(t){this._lodLevel=0,this._lodKey=new WVt,this._calcErrorMetrics(t),this._calcLevelDistances(t)},e._calcErrorMetrics=function(t){this._errorMetrics[0]=0;for(var e=1;e<4;++e)this._errorMetrics[e]=this._calcErrorMetric(e,t);for(var i=2;i<4;++i)this._errorMetrics[i]=Math.max(this._errorMetrics[i],this._errorMetrics[i-1])},e._calcErrorMetric=function(t,e){for(var i=0,n=1<<t,r=MIt,s=MIt,a=r-1>>t,o=s-1>>t,h=0;h<s;h+=n)for(var u=0;u<a;++u){var l=u*n,c=l+n,f=(c+l)/2,_=this._getHeight(l,h,e),d=this._getHeight(c,h,e),p=this._getHeight(f,h,e),m=(_+d)/2,g=Math.abs(p-m);i=Math.max(i,g)}for(var y=0;y<r;y+=n)for(var v=0;v<o;++v){var b=v*n,S=b+n,w=(b+S)/2,x=this._getHeight(y,b,e),T=this._getHeight(y,S,e),A=this._getHeight(y,w,e),C=(x+T)/2,D=Math.abs(A-C);i=Math.max(i,D)}for(var B=0;B<o;++B)for(var I=B*n,M=I+n,P=(I+M)/2,E=0;E<a;++E){var O=E*n,k=O+n,R=(O+k)/2,F=this._getHeight(O,I,e),L=this._getHeight(k,M,e),V=this._getHeight(R,P,e),N=(F+L)/2,z=Math.abs(V-N);i=Math.max(i,z)}return i},e._calcLevelDistances=function(){for(var t=1;t<4;++t){var e=96*this._errorMetrics[t];this._LevelDistances[t]=e}},e._buildVertexData=function(t){for(var e=0,i=0;i<MIt;++i)for(var n=0;n<MIt;++n){var r=this._index[0]*IIt+n,s=this._index[1]*IIt+i,a=this._terrain.getPosition(r,s),o=this._terrain.getNormal(r,s),h=new ds(n/IIt,i/IIt);t[e++]=a.x,t[e++]=a.y,t[e++]=a.z,t[e++]=o.x,t[e++]=o.y,t[e++]=o.z,t[e++]=h.x,t[e++]=h.y}},e._buildBoundingBox=function(){this._bbMin.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._bbMax.set(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE);for(var t=0;t<MIt;++t)for(var e=0;e<MIt;++e){var i=this._index[0]*IIt+e,n=this._index[1]*IIt+t,r=this._terrain.getPosition(i,n);ir.min(this._bbMin,this._bbMin,r),ir.max(this._bbMax,this._bbMax,r)}},n(t,[{key:"valid",get:function(){if(null===this._terrain)return!1;for(var t=this._terrain.getBlocks(),e=0;e<t.length;++e)if(t[e]===this)return!0;return!1}},{key:"material",get:function(){return this._renderable?this._renderable._currentMaterial:null}},{key:"layers",get:function(){return this._terrain.getBlockLayers(this._index[0],this._index[1])}},{key:"weightmap",get:function(){return this._weightMap}},{key:"lightmap",get:function(){return this._lightmapInfo?this._lightmapInfo.texture:null}},{key:"lightmapUVParam",get:function(){return null!=this._lightmapInfo?new Vn(this._lightmapInfo.UOff,this._lightmapInfo.VOff,this._lightmapInfo.UScale,this._lightmapInfo.VScale):new Vn(0,0,0,0)}},{key:"visible",get:function(){return null!==this._renderable._model&&null!==this._renderable._model.scene},set:function(t){null!==this._renderable._model&&(t?null!=this._terrain.node&&null!=this._terrain.node.scene&&null!=this._terrain.node.scene.renderScene&&null==this._renderable._model.scene&&this._terrain.node.scene.renderScene.addModel(this._renderable._model):null!==this._renderable._model.scene&&this._renderable._model.scene.removeModel(this._renderable._model))}}]),t}()),$Vt=(t("gd",(TVt=Kh("cc.Terrain"),AVt=Ou(JIt),CVt=Ou(Rw),DVt=Ou(QVt),BVt=Ou(ci),IVt=Ou(JIt),MVt=Ou(Rw),PVt=Ou(YVt),TVt(EVt=$h((OVt=function(t){function e(){var e;(e=t.call(this)||this).__asset=kVt&&kVt(),e._effectAsset=RVt&&RVt(),e._lightmapInfos=FVt&&FVt(),e._receiveShadow=LVt&&LVt(),e._useNormalmap=VVt&&VVt(),e._usePBR=NVt&&NVt(),e._lodEnable=zVt&&zVt(),e._lodBias=UVt&&UVt(),e._buitinAsset=null,e._tileSize=1,e._blockCount=[1,1],e._weightMapSize=128,e._lightMapSize=128,e._heights=new Uint16Array,e._weights=new Uint8Array,e._normals=new Float32Array,e._layerList=[],e._layerBuffer=[],e._blocks=[],e._lod=null,e._sharedIndexBuffer=null,e._sharedLodIndexBuffer=null;for(var i=0;i<BIt;++i)e._layerList.push(null);return e}s(e,t);var i=e.prototype;return i.build=function(t){return this._tileSize=t.tileSize,this._blockCount[0]=t.blockCount[0],this._blockCount[1]=t.blockCount[1],this._weightMapSize=t.weightMapSize,this._lightMapSize=t.lightMapSize,this._buildImp()},i.rebuild=function(t){for(var e=0;e<this._blocks.length;++e)this._blocks[e].destroy();this._blocks=[],this._resetLightmap(!1),this._rebuildLayerBuffer(t);var i=this._rebuildHeights(t);this._rebuildWeights(t),this._tileSize=t.tileSize,this._blockCount[0]=t.blockCount[0],this._blockCount[1]=t.blockCount[1],this._weightMapSize=t.weightMapSize,this._lightMapSize=t.lightMapSize,i&&(this._normals=new Float32Array(3*this.heights.length),this._buildNormals());for(var n=0;n<this._blockCount[1];++n)for(var r=0;r<this._blockCount[0];++r)this._blocks.push(new ZVt(this,r,n));for(var s=0;s<this._blocks.length;++s)this._blocks[s].build()},i.importHeightField=function(t,e){for(var i=0,n=0;n<this.vertexCount[1];++n)for(var r=0;r<this.vertexCount[0];++r){var s=r/this.tileCount[0],a=n/this.tileCount[1],o=t.getAt(s*t.w,a*t.h)*e;this._heights[i++]=o}this._buildNormals();for(var h=0;h<this._blocks.length;++h)this._blocks[h]._updateHeight()},i.exportHeightField=function(t,e){for(var i=0,n=0;n<t.h;++n)for(var r=0;r<t.w;++r){var s=r/(t.w-1),a=n/(t.h-1),o=s*this.size.width,h=a*this.size.height,u=this.getHeightAt(o,h);null!=u&&(t.data[i++]=u*e)}},i.exportAsset=function(){var t=new JIt;t.tileSize=this.tileSize,t.blockCount=this.blockCount,t.lightMapSize=this.lightMapSize,t.weightMapSize=this.weightMapSize,t.heights=this.heights,t.weights=this.weights,t.layerBuffer=new Array(4*this._blocks.length);for(var e=0;e<this._blocks.length;++e)t.layerBuffer[4*e+0]=this._blocks[e].layers[0],t.layerBuffer[4*e+1]=this._blocks[e].layers[1],t.layerBuffer[4*e+2]=this._blocks[e].layers[2],t.layerBuffer[4*e+3]=this._blocks[e].layers[3];return this.exportLayerListToAsset(t),t},i.exportLayerListToAsset=function(t){t.layerInfos.length=0;for(var e=0;e<this._layerList.length;++e){var i=this._layerList[e];if(i&&i.detailMap&&bo(i.detailMap)){var n=new XIt;n.slot=e,n.tileSize=i.tileSize,n.detailMap=i.detailMap,n.normalMap=i.normalMap,n.metallic=i.metallic,n.roughness=i.roughness,t.layerInfos.push(n)}}},i.getEffectAsset=function(){return null===this._effectAsset?C.EffectAsset.get("1d08ef62-a503-4ce2-8b9a-46c90873f7d3"):this._effectAsset},i.onEnable=function(){0===this._blocks.length&&this._buildImp();for(var t=0;t<this._blocks.length;++t)this._blocks[t].visible=!0;C.director.root.pipelineEvent.on("render-camera-begin",this.onUpdateFromCamera,this)},i.onDisable=function(){C.director.root.pipelineEvent.off("render-camera-begin",this.onUpdateFromCamera,this);for(var t=0;t<this._blocks.length;++t)this._blocks[t].visible=!1},i.onDestroy=function(){for(var t=0;t<this._blocks.length;++t)this._blocks[t].destroy();this._blocks=[];for(var e=0;e<this._layerList.length;++e)this._layerList[e]=null;null!=this._sharedIndexBuffer&&this._sharedIndexBuffer.destroy(),null!=this._sharedLodIndexBuffer&&this._sharedLodIndexBuffer.destroy()},i.onRestore=function(){this.onEnable(),this._buildImp(!0)},i.update=function(){for(var t=0;t<this._blocks.length;++t)this._blocks[t].update()},i.onUpdateFromCamera=function(t){if(this.lodEnable&&null!=this._sharedLodIndexBuffer&&t.scene===this._getRenderScene()){for(var e=0;e<this._blocks.length;++e)this._blocks[e]._updateLevel(t.position);for(var i=0;i<this._blocks.length;++i)this._blocks[i]._updateLod()}},i.addLayer=function(t){for(var e=0;e<this._layerList.length;++e){var i;if(null===this._layerList[e]||this._layerList[e]&&null===(null==(i=this._layerList[e])?void 0:i.detailMap))return this._layerList[e]=t,this._asset&&this.exportLayerListToAsset(this._asset),e}return-1},i.setLayer=function(t,e){this._layerList[t]=e,this._asset&&this.exportLayerListToAsset(this._asset)},i.removeLayer=function(t){this._layerList[t]=null,this._asset&&this.exportLayerListToAsset(this._asset)},i.getLayer=function(t){return-1===t?null:this._layerList[t]},i.getPosition=function(t,e){var i=t*this._tileSize,n=e*this._tileSize;return nr(i,this.getHeight(t,e),n)},i.getHeightField=function(){return this._heights},i.setHeight=function(t,e,i){i=$i(i,RIt,FIt),this._heights[e*this.vertexCount[0]+t]=EIt+i/OIt},i.getHeight=function(t,e){return(this._heights[e*this.vertexCount[0]+t]-EIt)*OIt},i.getHeightClamp=function(t,e){return t=$i(t,0,this.vertexCount[0]-1),e=$i(e,0,this.vertexCount[1]-1),this.getHeight(t,e)},i.getHeightAt=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.getHeight(r,s),c=this.getHeight(a,s),f=this.getHeight(r,o),_=this.getHeight(a,o),d=.5*(c+f);return h+u<=1?_=d+(d-l):l=d+(d-_),(l*(1-h)+c*h)*(1-u)+(f*(1-h)+_*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),_=this.getNormal(a,o),d=nr();ir.add(d,c,f).multiplyScalar(.5),h+u<=1?(_.set(d),_.subtract(l),_.add(d)):(l.set(d),l.subtract(_),l.add(d));var p=nr(),m=nr(),g=nr();return ir.lerp(p,l,c,h),ir.lerp(m,f,_,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),_=this.getWeight(h,o),d=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,y=new Vn,v=new Vn;return Vn.lerp(g,f,_,l),Vn.lerp(y,d,p,l),Vn.lerp(v,g,y,c),v},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)*DIt;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)*DIt;return this._layerBuffer[n+i]},i.setBlockLayer=function(t,e,i,n){var r=(e*this._blockCount[0]+t)*DIt;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=Wp.gfxDevice;if(null!==this._lod){var e=t.createBuffer(new ud(6,1,2*this._lod._indexBuffer.length,2));return e.update(this._lod._indexBuffer),e}for(var i=new Uint16Array(IIt*IIt*6),n=0,r=0;r<IIt;++r)for(var s=0;s<IIt;++s){var a=r*MIt+s,o=r*MIt+s+1,h=(r+1)*MIt+s,u=(r+1)*MIt+s+1;i[n++]=a,i[n++]=h,i[n++]=o,i[n++]=o,i[n++]=h,i[n++]=u}var l=t.createBuffer(new ud(6,1,2*i.length,2));return l.update(i),l},i._getSharedIndexBuffer=function(){return null!==this._sharedLodIndexBuffer?this._sharedLodIndexBuffer:null!==this._sharedIndexBuffer?this._sharedIndexBuffer:(this.lodEnable&&null===this._lod&&(this._lod=new XVt),null!==this._lod?(this._sharedLodIndexBuffer=this._createSharedIndexBuffer(),this._sharedLodIndexBuffer):(this._sharedIndexBuffer=this._createSharedIndexBuffer(),this._sharedIndexBuffer))},i._getIndexData=function(t){return null!==this._sharedLodIndexBuffer&&null!==this._lod?this._lod.getIndexData(t):null},i._resetLightmap=function(t){if(this._lightmapInfos.length=0,t)for(var e=0;e<this._blockCount[0]*this._blockCount[1];++e)this._lightmapInfos.push(new QVt)},i._updateLightmap=function(t,e,i,n,r,s){if(e){if(0===this._lightmapInfos.length)for(var a=0;a<this._blockCount[0]*this._blockCount[1];++a)this._lightmapInfos.push(new QVt)}else if(0===this._lightmapInfos.length)return;this._lightmapInfos[t].texture=e,this._lightmapInfos[t].UOff=i,this._lightmapInfos[t].VOff=n,this._lightmapInfos[t].UScale=r,this._lightmapInfos[t].VScale=s,this._blocks[t]._updateLightmap(this._lightmapInfos[t])},i._getLightmapInfo=function(t,e){var i=e*this._blockCount[0]+t;return i<this._lightmapInfos.length?this._lightmapInfos[i]:null},i._calcNormal=function(t,e){var i,n,r=1,s=this.getPosition(t,e);t<this.vertexCount[0]-1?i=this.getPosition(t+1,e):(r*=-1,i=this.getPosition(t-1,e)),e<this.vertexCount[1]-1?n=this.getPosition(t,e+1):(r*=-1,n=this.getPosition(t,e-1)),i.subtract(s),n.subtract(s);var a=nr();return a.set(n),a.cross(i),a.multiplyScalar(r),a.normalize(),a},i._buildNormals=function(){for(var t=0,e=0;e<this.vertexCount[1];++e)for(var i=0;i<this.vertexCount[0];++i){var n=this._calcNormal(i,e);this._normals[3*t+0]=n.x,this._normals[3*t+1]=n.y,this._normals[3*t+2]=n.z,t+=1}},i._buildImp=function(t){var e=this;if(void 0===t&&(t=!1),!this.valid){var i=this.__asset;if(this._buitinAsset!==i&&(this._buitinAsset=i),!t&&null!==i){this._tileSize=i.tileSize,this._blockCount=i.blockCount,this._weightMapSize=i.weightMapSize,this._lightMapSize=i.lightMapSize,this._heights=i.heights,this._normals=i.normals,this._weights=i.weights,this._layerBuffer=i.layerBuffer;for(var n=0;n<this._layerList.length;++n)this._layerList[n]=null;if(i.version<UIt)for(var r=function(){var t=new JVt,n=i.layerBinaryInfos[s];t.tileSize=n.tileSize,C.assetManager.loadAny(n.detailMapId,(function(e,i){t.detailMap=i})),""!==n.normalMapId&&C.assetManager.loadAny(n.normalMapId,(function(e,i){t.normalMap=i})),t.roughness=n.roughness,t.metallic=n.metallic,e._layerList[n.slot]=t},s=0;s<i.layerBinaryInfos.length;++s)r();else for(var a=0;a<i.layerInfos.length;++a){var o=new JVt,h=i.layerInfos[a];o.tileSize=h.tileSize,o.detailMap=h.detailMap,o.normalMap=h.normalMap,o.roughness=h.roughness,o.metallic=h.metallic,this._layerList[h.slot]=o}}if(0!==this._blockCount[0]&&0!==this._blockCount[1]){var u=this.vertexCount[0]*this.vertexCount[1];if(null===this._heights||this._heights.length!==u){this._heights=new Uint16Array(u),this._normals=new Float32Array(3*u);for(var l=0;l<u;++l)this._heights[l]=EIt,this._normals[3*l+0]=0,this._normals[3*l+1]=1,this._normals[3*l+2]=0;i&&(i.heights=this._heights,i.normals=this._normals)}null!==this._normals&&this._normals.length===3*u||(this._normals=new Float32Array(3*u),this._buildNormals());var c=this.blockCount[0]*this.blockCount[1]*DIt;if(null===this._layerBuffer||this._layerBuffer.length!==c){this._layerBuffer=new Array(c);for(var f=0;f<c;++f)this._layerBuffer[f]=-1;i&&(i.layerBuffer=this._layerBuffer)}var _=this._weightMapSize*this._blockCount[0],d=this._weightMapSize*this._blockCount[1];if(this._weights.length!==_*d*4){this._weights=new Uint8Array(_*d*4);for(var p=0;p<_*d;++p)this._weights[4*p+0]=255,this._weights[4*p+1]=0,this._weights[4*p+2]=0,this._weights[4*p+3]=0;i&&(i.weights=this._weights)}for(var m=0;m<this._blockCount[1];++m)for(var g=0;g<this._blockCount[0];++g)this._blocks.push(new ZVt(this,g,m));for(var y=0;y<this._blocks.length;++y)this._blocks[y].build()}}},i._rebuildHeights=function(t){if(this.vertexCount[0]===t.vertexCount[0]&&this.vertexCount[1]===t.vertexCount[1])return!1;for(var e=new Uint16Array(t.vertexCount[0]*t.vertexCount[1]),i=0;i<e.length;++i)e[i]=EIt;for(var n=Math.min(this.vertexCount[0],t.vertexCount[0]),r=Math.min(this.vertexCount[1],t.vertexCount[1]),s=0;s<r;++s)for(var a=0;a<n;++a){var o=s*t.vertexCount[0]+a,h=s*this.vertexCount[0]+a;e[o]=this._heights[h]}return this._heights=e,!0},i._rebuildLayerBuffer=function(t){if(this.blockCount[0]===t.blockCount[0]&&this.blockCount[1]===t.blockCount[1])return!1;var e=[];e.length=t.blockCount[0]*t.blockCount[1]*DIt;for(var i=0;i<e.length;++i)e[i]=-1;for(var n=Math.min(this.blockCount[0],t.blockCount[0]),r=Math.min(this.blockCount[1],t.blockCount[1]),s=0;s<r;++s)for(var a=0;a<n;++a)for(var o=s*t.blockCount[0]+a,h=s*this.blockCount[0]+a,u=0;u<DIt;++u)e[o*DIt+u]=this._layerBuffer[h*DIt+u];return this._layerBuffer=e,!0},i._rebuildWeights=function(t){var e=this,i=this._weightMapSize,n=this._weightMapSize*this._blockCount[0],r=this._weightMapSize*this._blockCount[1],s=t.weightMapSize*t.blockCount[0],a=t.weightMapSize*t.blockCount[1];if(s===n&&a===r)return!1;for(var o=new Uint8Array(s*a*4),h=0;h<s*a;++h)o[4*h+0]=255,o[4*h+1]=0,o[4*h+2]=0,o[4*h+3]=0;for(var u=Math.min(t.blockCount[0],this._blockCount[0]),l=Math.min(t.blockCount[1],this._blockCount[1]),c=function(t,e,i){var r=e*n+t,s=new Vn;return s.x=i[4*r+0]/255,s.y=i[4*r+1]/255,s.z=i[4*r+2]/255,s.w=i[4*r+3]/255,s},f=function(t,n,r,s){var a=Math.floor(t),o=Math.floor(n),h=Math.min(a+1,i-1),u=Math.min(o+1,i-1),l=t-a,f=n-o,_=c(a+r,o+s,e._weights),d=c(h+r,o+s,e._weights),p=c(a+r,u+s,e._weights),m=c(h+r,u+s,e._weights),g=new Vn;Vn.add(g,d,p).multiplyScalar(.5),l+f<=1?(m.set(g),m.subtract(_),m.add(g)):(_.set(g),_.subtract(m),_.add(g));var y=new Vn,v=new Vn,b=new Vn;return Vn.lerp(y,_,d,l),Vn.lerp(v,p,m,l),Vn.lerp(b,y,v,f),b},_=0;_<l;++_)for(var d=0;d<u;++d)for(var p=d*i,m=_*i,g=0;g<t.weightMapSize;++g)for(var y=0;y<t.weightMapSize;++y){var v=void 0;v=t.weightMapSize===i?c(y+p,g+m,this._weights):f(y/(t.weightMapSize-1)*(i-1),g/(t.weightMapSize-1)*(i-1),p,m,this._weights);var b=d*t.weightMapSize+y,S=(_*t.weightMapSize+g)*s+b;o[4*S+0]=255*v.x,o[4*S+1]=255*v.y,o[4*S+2]=255*v.z,o[4*S+3]=255*v.w}return this._weights=o,!0},n(e,[{key:"_asset",get:function(){return this.__asset},set:function(t){if(this.__asset=t,this._buitinAsset!==this.__asset){this._buitinAsset=this.__asset;for(var e=0;e<this._blocks.length;++e)this._blocks[e].destroy();if(this._blocks=[],null===this.__asset){this._effectAsset=null,this._lightmapInfos=[],this._receiveShadow=!1,this._useNormalmap=!1,this._usePBR=!1,this._tileSize=1,this._blockCount=[1,1],this._weightMapSize=128,this._lightMapSize=128,this._heights=new Uint16Array,this._weights=new Uint8Array,this._normals=new Float32Array,this._layerBuffer=[],this._blocks=[],this._layerList=[];for(var i=0;i<BIt;++i)this._layerList.push(null)}Wp.gfxDevice&&this._buildImp()}}},{key:"effectAsset",get:function(){return this._effectAsset},set:function(t){if(this._effectAsset!==t){this._effectAsset=t;for(var e=0;e<this._blocks.length;++e)this._blocks[e]._invalidMaterial()}}},{key:"receiveShadow",get:function(){return this._receiveShadow},set:function(t){this._receiveShadow=t;for(var e=0;e<this._blocks.length;e++)this._blocks[e]._invalidMaterial()}},{key:"useNormalMap",get:function(){return this._useNormalmap},set:function(t){this._useNormalmap=t;for(var e=0;e<this._blocks.length;e++)this._blocks[e]._invalidMaterial()}},{key:"usePBR",get:function(){return this._usePBR},set:function(t){this._usePBR=t;for(var e=0;e<this._blocks.length;e++)this._blocks[e]._invalidMaterial()}},{key:"lodEnable",get:function(){return this._lodEnable},set:function(t){if(this._lodEnable=t,this._lodEnable&&null===this._lod){this._lod=new XVt,null===this._sharedLodIndexBuffer&&(this._sharedLodIndexBuffer=this._createSharedIndexBuffer());for(var e=0;e<this._blocks.length;++e)this._blocks[e].destroy();this._blocks=[];for(var i=0;i<this._blockCount[1];++i)for(var n=0;n<this._blockCount[0];++n)this._blocks.push(new ZVt(this,n,i));for(var r=0;r<this._blocks.length;++r)this._blocks[r].build()}if(!this._lodEnable)for(var s=0;s<this._blocks.length;s++)this._blocks[s]._resetLod()}},{key:"LodBias",get:function(){return this._lodBias},set:function(t){this._lodBias=t}},{key:"size",get:function(){var t=new ms(0,0);return t.width=this.blockCount[0]*IIt*this.tileSize,t.height=this.blockCount[1]*IIt*this.tileSize,t}},{key:"tileSize",get:function(){return this._tileSize}},{key:"tileCount",get:function(){return[this.blockCount[0]*IIt,this.blockCount[1]*IIt]}},{key:"vertexCount",get:function(){var t=this.tileCount;return t[0]+=1,t[1]+=1,t}},{key:"blockCount",get:function(){return this._blockCount}},{key:"lightMapSize",get:function(){return this._lightMapSize}},{key:"weightMapSize",get:function(){return this._weightMapSize}},{key:"heights",get:function(){return this._heights}},{key:"weights",get:function(){return this._weights}},{key:"valid",get:function(){return this._blocks.length>0}},{key:"info",get:function(){var t=new YVt;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}(yg),kVt=zh(OVt.prototype,"__asset",[AVt,uu],(function(){return null})),RVt=zh(OVt.prototype,"_effectAsset",[CVt,uu],(function(){return null})),FVt=zh(OVt.prototype,"_lightmapInfos",[DVt,uu],(function(){return[]})),LVt=zh(OVt.prototype,"_receiveShadow",[uu],(function(){return!1})),VVt=zh(OVt.prototype,"_useNormalmap",[uu],(function(){return!1})),NVt=zh(OVt.prototype,"_usePBR",[uu],(function(){return!1})),zVt=zh(OVt.prototype,"_lodEnable",[uu],(function(){return!1})),UVt=zh(OVt.prototype,"_lodBias",[BVt,uu],(function(){return 0})),v(OVt.prototype,"_asset",[IVt],Object.getOwnPropertyDescriptor(OVt.prototype,"_asset"),OVt.prototype),v(OVt.prototype,"effectAsset",[MVt],Object.getOwnPropertyDescriptor(OVt.prototype,"effectAsset"),OVt.prototype),v(OVt.prototype,"info",[PVt],Object.getOwnPropertyDescriptor(OVt.prototype,"info"),OVt.prototype),EVt=OVt))||EVt)||EVt)),{ORTHO:0,HEX:1,ISO:2});Re($Vt);var tNt={NONE:0,MAP:1,LAYER:2,OBJECTGROUP:3,OBJECT:4,TILE:5};Re(tNt);var eNt={HORIZONTAL:2147483648,VERTICAL:1073741824,DIAGONAL:536870912,FLIPPED_ALL:4026531840,FLIPPED_MASK:268435455};Re(eNt);var iNt={STAGGERAXIS_X:0,STAGGERAXIS_Y:1};Re(iNt);var nNt={STAGGERINDEX_ODD:0,STAGGERINDEX_EVEN:1};Re(nNt);var rNt={RightDown:0,RightUp:1,LeftDown:2,LeftUp:3};Re(rNt);var sNt={RECT:0,ELLIPSE:1,POLYGON:2,POLYLINE:3,IMAGE:4,TEXT:5};Re(sNt);var aNt=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 ms(0,0),this.tileOffset=new ds(0,0),this._tileSize=new ms(0,0),this.collection=!1}return t.prototype.rectForGID=function(t,e){var i=e||new bs(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}(),oNt=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}(),hNt=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}();hNt.ATTRIB_NONE=1,hNt.ATTRIB_BASE64=2,hNt.ATTRIB_GZIP=4,hNt.ATTRIB_ZLIB=8;var uNt=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 lNt(t){if(t.length%4!=0)return null;for(var e=t.length/4,i=window.Uint32Array?new Uint32Array(e):[],n=0;n<e;n++){var r=4*n;i[n]=t[r]+256*t[r+1]+65536*t[r+2]+t[r+3]*(1<<24)}return i}function cNt(t){var e=LV.HorizontalAlign;switch(t){case"center":return e.CENTER;case"right":return e.RIGHT;default:return e.LEFT}}function fNt(t){var e=LV.VerticalAlign;switch(t){case"center":return e.CENTER;case"bottom":return e.BOTTOM;default:return e.TOP}}function _Nt(t){if(!t)return new cr(0,0,0,255);if(8===(t=-1!==t.indexOf("#")?t.substring(1):t).length){var e=parseInt(t.substr(0,2),16)||255,i=parseInt(t.substr(2,2),16)||0,n=parseInt(t.substr(4,2),16)||0,r=parseInt(t.substr(6,2),16)||0;return new cr(i,n,r,e)}var s=parseInt(t.substr(0,2),16)||0,a=parseInt(t.substr(2,2),16)||0,o=parseInt(t.substr(4,2),16)||0;return new cr(s,a,o,255)}function dNt(t,e){for(var i=[],n=Array.from(t.getElementsByTagName("properties")).filter((function(e){return e.parentNode===t})),r=0;r<n.length;++r)for(var s=n[r].getElementsByTagName("property"),a=0;a<s.length;++a)i.push(s[a]);e=e||{};for(var o=0;o<i.length;o++){var h=i[o],u=h.getAttribute("name"),l=h.getAttribute("type")||"string",c=h.getAttribute("value");"int"===l?c=parseInt(c):"float"===l?c=parseFloat(c):"bool"===l?c="true"===c:"color"===l&&(c=_Nt(c)),e[u]=c}return e}var pNt,mNt,gNt,yNt,vNt,bNt,SNt,wNt,xNt,TNt,ANt,CNt,DNt,BNt=function(){function t(t,e,i,n,r){this.properties={},this.orientation=null,this.parentElement=null,this.parentGID=0,this.layerAttrs=0,this.storingCharacters=!1,this.currentString=null,this.renderOrder=0,this._supportVersion=[1,4,0],this._objectGroups=[],this._allChildren=[],this._mapSize=new ms(0,0),this._tileSize=new ms(0,0),this._layers=[],this._tilesets=[],this._imageLayers=[],this._tileProperties=new Map,this._tileAnimations={},this._tsxContentMap=null,this._spriteFrameMap=null,this._spfSizeMap={},this._staggerAxis=null,this._staggerIndex=null,this._hexSideLength=0,this._imageLayerSPF=null,this.initWithXML(t,e,i,n,r)}var e=t.prototype;return e.getOrientation=function(){return this.orientation},e.setOrientation=function(t){this.orientation=t},e.getStaggerAxis=function(){return this._staggerAxis},e.setStaggerAxis=function(t){this._staggerAxis=t},e.getStaggerIndex=function(){return this._staggerIndex},e.setStaggerIndex=function(t){this._staggerIndex=t},e.getHexSideLength=function(){return this._hexSideLength},e.setHexSideLength=function(t){this._hexSideLength=t},e.getMapSize=function(){return new ms(this._mapSize.width,this._mapSize.height)},e.setMapSize=function(t){this._mapSize.width=t.width,this._mapSize.height=t.height},e.getTileSize=function(){return new ms(this._tileSize.width,this._tileSize.height)},e.setTileSize=function(t){this._tileSize.width=t.width,this._tileSize.height=t.height},e.getLayers=function(){return this._layers},e.setLayers=function(t){this._allChildren.push(t),this._layers.push(t)},e.getImageLayers=function(){return this._imageLayers},e.setImageLayers=function(t){this._allChildren.push(t),this._imageLayers.push(t)},e.getTilesets=function(){return this._tilesets},e.setTilesets=function(t){this._tilesets.push(t)},e.getObjectGroups=function(){return this._objectGroups},e.setObjectGroups=function(t){this._allChildren.push(t),this._objectGroups.push(t)},e.getAllChildren=function(){return this._allChildren},e.getParentElement=function(){return this.parentElement},e.setParentElement=function(t){this.parentElement=t},e.getParentGID=function(){return this.parentGID},e.setParentGID=function(t){this.parentGID=t},e.getLayerAttribs=function(){return this.layerAttrs},e.setLayerAttribs=function(t){this.layerAttrs=t},e.getStoringCharacters=function(){return this.storingCharacters},e.setStoringCharacters=function(t){this.storingCharacters=t},e.getProperties=function(){return this.properties},e.setProperties=function(t){this.properties=t},e.initWithXML=function(t,e,i,n,r){return this._tilesets.length=0,this._layers.length=0,this._imageLayers.length=0,this._tsxContentMap=e,this._spriteFrameMap=i,this._imageLayerSPF=r,this._spfSizeMap=n,this._objectGroups.length=0,this._allChildren.length=0,this.properties={},this._tileProperties=new Map,this._tileAnimations=new Map,this.currentString="",this.storingCharacters=!1,this.layerAttrs=hNt.ATTRIB_NONE,this.parentElement=null,this.parseXMLString(t)},e.parseXMLString=function(e,i){var n,r=(new Yx).parse(e).documentElement,s=r.getAttribute("orientation"),a=r.getAttribute("staggeraxis"),o=r.getAttribute("staggerindex"),h=r.getAttribute("hexsidelength"),u=r.getAttribute("renderorder"),l=r.getAttribute("version")||"1.0.0";if("map"===r.nodeName){var c=l.split("."),f=this._supportVersion;for(n=0;n<f.length;n++){var _=parseInt(c[n])||0;if(f[n]<_){it(7216,l);break}}"orthogonal"===s?this.orientation=0:"isometric"===s?this.orientation=2:"hexagonal"===s?this.orientation=1:null!==s&&it(7217,s),this.renderOrder="right-up"===u?1:"left-up"===u?3:"left-down"===u?2:0,"x"===a?this.setStaggerAxis(0):"y"===a&&this.setStaggerAxis(1),"odd"===o?this.setStaggerIndex(0):"even"===o&&this.setStaggerIndex(1),h&&this.setHexSideLength(parseFloat(h));var d=new ms(0,0);d.width=parseFloat(r.getAttribute("width")),d.height=parseFloat(r.getAttribute("height")),this.setMapSize(d),(d=new ms(0,0)).width=parseFloat(r.getAttribute("tilewidth")),d.height=parseFloat(r.getAttribute("tileheight")),this.setTileSize(d),this.properties=dNt(r)}var p=r.getElementsByTagName("tileset");for("map"!==r.nodeName&&(p=[]).push(r),n=0;n<p.length;n++){var m=p[n],g=m.getAttribute("source");if(g){var y=parseInt(m.getAttribute("firstgid")),v=this._tsxContentMap[g];v&&this.parseXMLString(v,y)}else{var b=m.getElementsByTagName("image"),S=b.length>1,w=b[0],x=w.getAttribute("source");x=x.replace(/\\/g,"/");var T=m.getElementsByTagName("tile"),A=T&&T.length||1,C=null,D=m.getAttribute("name")||"",B=parseInt(m.getAttribute("spacing"))||0,I=parseInt(m.getAttribute("margin"))||0,M=i||parseInt(m.getAttribute("firstgid"))||0,P=new ms(0,0);P.width=parseFloat(m.getAttribute("tilewidth")),P.height=parseFloat(m.getAttribute("tileheight"));var E=m.getElementsByTagName("tileoffset")[0],O=0,k=0;E&&(O=parseFloat(E.getAttribute("x"))||0,k=parseFloat(E.getAttribute("y"))||0);for(var R=null,F=0;F<A;F++){var L=b[F]?b[F]:w;if(L){var V=L.getAttribute("source");if(V=V.replace(/\\/g,"/"),!R||S){if((R=new aNt).name=D,R.firstGid=268435455&M,R.tileOffset.x=O,R.tileOffset.y=k,R.collection=S,!S&&(R.imageName=V,R.imageSize.width=parseFloat(L.getAttribute("width"))||0,R.imageSize.height=parseFloat(L.getAttribute("height"))||0,R.sourceImage=this._spriteFrameMap[V],!R.sourceImage)){var N=t.getNameWithPostfix(V);if(R.imageName=N,R.sourceImage=this._spriteFrameMap[N],!R.sourceImage){var z=t.getShortName(V);R.imageName=z,R.sourceImage=this._spriteFrameMap[z],R.sourceImage||(J("[error]: "+z+" not find in ["+Object.keys(this._spriteFrameMap).join(", ")+"]"),ht(7221,V),Y("Please try asset type of "+V+" to 'sprite-frame'"))}}R.spacing=B,R.margin=I,R._tileSize.width=P.width,R._tileSize.height=P.height,this.setTilesets(R)}if(C=T&&T[F]){this.parentGID=M+(parseInt(C.getAttribute("id"))||0);var U=C.getElementsByTagName("image");C.hasAttribute("x")&&C.hasAttribute("y")&&(R.imageOffset=new ds(parseFloat(C.getAttribute("x"))||0,parseFloat(C.getAttribute("y"))||0));var G=C.hasAttribute("width")&&C.hasAttribute("height");if(G&&(R._tileSize.width=parseFloat(C.getAttribute("width"))||0,R._tileSize.height=parseFloat(C.getAttribute("height"))||0),U&&U.length>0){var H=U[0],W=H.getAttribute("source");if(W=W.replace(/\\/g,"/"),R.imageName=W,R.imageSize.width=parseFloat(H.getAttribute("width"))||0,R.imageSize.height=parseFloat(H.getAttribute("height"))||0,G||(R._tileSize.width=R.imageSize.width,R._tileSize.height=R.imageSize.height),R.sourceImage=this._spriteFrameMap[W],!R.sourceImage){var j=t.getNameWithPostfix(W);if(R.imageName=j,R.sourceImage=this._spriteFrameMap[j],!R.sourceImage){var q=t.getShortName(W);R.imageName=q,R.sourceImage=this._spriteFrameMap[q],R.sourceImage||(ht(7221,W),Y("Please try asset type of "+W+" to 'sprite-frame'"))}}R.firstGid=268435455&this.parentGID}var X=(268435455&this.parentGID)>>>0;this._tileProperties.set(X,dNt(C));var K=C.getElementsByTagName("animation");if(K&&K.length>0){var Q=K[0].getElementsByTagName("frame"),Z={frames:[],dt:0,frameIdx:0};this._tileAnimations.set(X,Z);for(var $=Z.frames,tt=0;tt<Q.length;tt++){var et=Q[tt],nt=M+(parseInt(et.getAttribute("tileid"))||0),rt=parseFloat(et.getAttribute("duration"))||0;$.push({tileid:nt,duration:rt/1e3,grid:null})}}}}}}}var st=r.childNodes;for(n=0;n<st.length;n++){var at=st[n];if(!this._shouldIgnoreNode(at)){if("imagelayer"===at.nodeName){var ot=this._parseImageLayer(at);ot&&this.setImageLayers(ot)}if("layer"===at.nodeName){var ut=this._parseLayer(at);this.setLayers(ut)}if("objectgroup"===at.nodeName){var lt=this._parseObjectGroup(at);this.setObjectGroups(lt)}}}return r},e._shouldIgnoreNode=function(t){return 3===t.nodeType||8===t.nodeType||4===t.nodeType},e._parseImageLayer=function(t){var e=t.getElementsByTagName("image");if(!e||0===e.length)return null;var i=new uNt;i.name=t.getAttribute("name"),i.offset.x=parseFloat(t.getAttribute("offsetx"))||0,i.offset.y=parseFloat(t.getAttribute("offsety"))||0;var n=t.getAttribute("visible");i.visible=!("0"===n);var r=t.getAttribute("opacity");i.opacity=r?Math.round(255*parseFloat(r)):255;var s=t.getAttribute("tintcolor");i.tintColor=s?_Nt(s):null;var a=e[0],o=a.getAttribute("source");return i.sourceImage=this._imageLayerSPF[o],i.width=parseInt(a.getAttribute("width"))||0,i.height=parseInt(a.getAttribute("height"))||0,i.trans=_Nt(a.getAttribute("trans")),i.sourceImage?i:(ht(7221,o),Y("Please try asset type of "+o+" to 'sprite-frame'"),null)},e._parseLayer=function(t){var e=t.getElementsByTagName("data")[0],i=new hNt;i.name=t.getAttribute("name");var n=new ms(0,0);n.width=parseFloat(t.getAttribute("width")),n.height=parseFloat(t.getAttribute("height")),i.layerSize=n;var r=t.getAttribute("visible");i.visible=!("0"===r);var s=t.getAttribute("opacity");i.opacity=s?Math.round(255*parseFloat(s)):255,i.offset=new ds(parseFloat(t.getAttribute("offsetx"))||0,parseFloat(t.getAttribute("offsety"))||0);var a=t.getAttribute("tintcolor");i.tintColor=a?_Nt(a):null;for(var o="",h=0;h<e.childNodes.length;h++)o+=e.childNodes[h].nodeValue;o=o.trim();var u,l=e.getAttribute("compression"),c=e.getAttribute("encoding");if(l&&"gzip"!==l&&"zlib"!==l)return it(7218),null;switch(l){case"gzip":u=Hbt.unzipBase64AsArray(o,4);break;case"zlib":u=lNt(new gk.Inflate(Hbt.Base64.decodeAsArray(o,1)).decompress());break;case null:case"":if("base64"===c)u=Hbt.Base64.decodeAsArray(o,4);else if("csv"===c){u=[];for(var f=o.split(","),_=0;_<f.length;_++)u.push(parseInt(f[_]))}else{var d=e.getElementsByTagName("tile");u=[];for(var p=0;p<d.length;p++)u.push(parseInt(d[p].getAttribute("gid")))}break;default:this.layerAttrs===hNt.ATTRIB_NONE&&it(7219)}return u&&(i.tiles=new Uint32Array(u)),i.properties=dNt(t),i},e._parseObjectGroup=function(t){var e=new oNt;e.name=t.getAttribute("name")||"",e.offset=new ds(parseFloat(t.getAttribute("offsetx")),parseFloat(t.getAttribute("offsety")));var i=t.getAttribute("opacity");e.opacity=i?Math.round(255*parseFloat(i)):255;var n=t.getAttribute("tintcolor");e.tintColor=n?_Nt(n):null;var r=t.getAttribute("visible");r&&0===parseInt(r)&&(e.visible=!1);var s=t.getAttribute("color");s&&e.color.fromHEX(s);var a=t.getAttribute("draworder");a&&(e.draworder=a),e.setProperties(dNt(t));var o=t.getElementsByTagName("object");if(o){for(var h=0;h<o.length;h++){var u=o[h],l={};l.id=u.getAttribute("id")||h,l.name=u.getAttribute("name")||"",l.width=parseFloat(u.getAttribute("width"))||0,l.height=parseFloat(u.getAttribute("height"))||0,l.x=parseFloat(u.getAttribute("x"))||0,l.y=parseFloat(u.getAttribute("y"))||0,l.rotation=parseFloat(u.getAttribute("rotation"))||0,l.properties=dNt(u);var c=u.getAttribute("visible");l.visible=!(c&&0===parseInt(c));var f=u.getElementsByTagName("text");if(f&&f.length>0){var _=f[0];l.type=5,l.wrap="1"===_.getAttribute("wrap"),l.color=_Nt(_.getAttribute("color")),l.halign=cNt(_.getAttribute("halign")),l.valign=fNt(_.getAttribute("valign")),l.pixelsize=parseInt(_.getAttribute("pixelsize"))||16,l.text=_.childNodes[0].nodeValue}var d=u.getAttribute("gid");d&&(l.gid=parseInt(d),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 y=u.getElementsByTagName("polyline");if(y&&y.length>0){l.type=3;var v=y[0].getAttribute("points");v&&(l.polylinePoints=this._parsePointsString(v))}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;n<i.length;n++){var r=i[n].split(",");e.push({x:parseFloat(r[0]),y:parseFloat(r[1])})}return e},e.setTileAnimations=function(t){this._tileAnimations=t},e.getTileAnimations=function(){return this._tileAnimations},e.getTileProperties=function(){return this._tileProperties},e.setTileProperties=function(t){this._tileProperties=t},e.getCurrentString=function(){return this.currentString},e.setCurrentString=function(t){this.currentString=t},t.getNameWithPostfix=function(t){var e=(t=t.replace(/\\/g,"/")).lastIndexOf("/")+1,i=t.length;return t.substring(e,i)},t.getShortName=function(t){var e=(t=t.replace(/\\/g,"/")).lastIndexOf("/")+1,i=t.lastIndexOf(".");return i=i<0?t.length:i,t.substring(e,i)},n(t,[{key:"mapSize",get:function(){return this._mapSize}},{key:"tileSize",get:function(){return this._tileSize}},{key:"mapWidth",get:function(){return this._mapSize.width},set:function(t){this._mapSize.width=t}},{key:"mapHeight",get:function(){return this._mapSize.height},set:function(t){this._mapSize.height=t}},{key:"tileWidth",get:function(){return this._tileSize.width},set:function(t){this._tileSize.width=t}},{key:"tileHeight",get:function(){return this._tileSize.height},set:function(t){this._tileSize.height=t}}]),t}(),INt=t("gK",(pNt=Kh("cc.TiledTile"),mNt=Qh(lL),gNt=Ou(li),yNt=Ou(li),vNt=Ou(li),bNt=Ou(li),SNt=Ou(li),pNt(wNt=mNt((xNt=function(t){function e(){var e;return(e=t.call(this)||this)._layer=null,e._x=TNt&&TNt(),e._y=ANt&&ANt(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){var t=this.node.parent;this._layer=t.getComponent("cc.TiledLayer"),this.node.on("transform-changed",this._updatePosition,this),this.node.on("size-changed",this._updatePosition,this),this._resetTile(),this.updateInfo()},i.onDisable=function(){this._resetTile(),this.node.off("transform-changed",this._updatePosition,this),this.node.off("size-changed",this._updatePosition,this)},i._resetTile=function(){this._layer&&this._layer.getTiledTileAt(this._x,this._y)===this&&this._layer.setTiledTileAt(this._x,this._y,null)},i.updateInfo=function(){if(this._layer){var t=this._x,e=this._y;if(this._layer.getTiledTileAt(t,e))Y("There is already a TiledTile at [%s, %s]",t,e);else{var i=this._layer.getPositionAt(t,e);this.node.setPosition(i.x,i.y),this._layer.setTiledTileAt(t,e,this),this._layer._markForUpdateRenderData()}}},i._updatePosition=function(){this._layer._markForUpdateRenderData()},n(e,[{key:"x",get:function(){return this._x},set:function(t){t!==this._x&&(this._layer&&this._layer.isInvalidPosition(t,this._y)?Y("Invalid x, the valid value is between [%s] ~ [%s]",0,this._layer.layerSize.width):(this._resetTile(),this._x=t,this.updateInfo()))}},{key:"y",get:function(){return this._y},set:function(t){t!==this._y&&(this._layer&&this._layer.isInvalidPosition(this._x,t)?Y("Invalid y, the valid value is between [%s] ~ [%s]",0,this._layer.layerSize.height):(this._resetTile(),this._y=t,this.updateInfo()))}},{key:"grid",get:function(){return this._layer?this._layer.getTileGIDAt(this._x,this._y):0},set:function(t){this._layer&&this._layer.setTileGIDAt(t,this._x,this._y)}}]),e}(yg),TNt=zh(xNt.prototype,"_x",[gNt],(function(){return 0})),ANt=zh(xNt.prototype,"_y",[yNt],(function(){return 0})),v(xNt.prototype,"x",[vNt],Object.getOwnPropertyDescriptor(xNt.prototype,"x"),xNt.prototype),v(xNt.prototype,"y",[bNt],Object.getOwnPropertyDescriptor(xNt.prototype,"y"),xNt.prototype),v(xNt.prototype,"grid",[SNt],Object.getOwnPropertyDescriptor(xNt.prototype,"grid"),xNt.prototype),wNt=xNt))||wNt)||wNt)),MNt=!1;function PNt(t){MNt=t}function ENt(t,e,i){var n=i||t.sourceImage,r=n.texture,s=t.collection;if(!t.imageSize.width||!t.imageSize.height){var a=t.sourceImage;t.imageSize.width=a.width,t.imageSize.height=a.height}var o=t.imageSize.width,h=t.imageSize.height,u=t._tileSize.width,l=t._tileSize.height,c=n.width,f=n.height,_=t.spacing,d=t.margin,p=1;if(!s){var m=Math.floor((o-2*d+_)/(u+_)),g=Math.floor((h-2*d+_)/(l+_));p=Math.max(1,g*m)}for(var y=t.firstGid,v=null,b=!!e.get(y),S=t.firstGid+p,w=y;w<S&&(b&&!e.get(w)&&(b=!1),b||!e.get(w));++w){if(v={tileset:t,x:0,y:0,width:u,height:l,t:0,l:0,r:0,b:0,cx:0,cy:0,offsetX:0,offsetY:0,rotated:!1,gid:w,spriteFrame:n,texture:r},t.rectForGID(w,v),!i||p>1||t.imageOffset)if(i){v._name=i.name;var x=i.unbiasUV[0],T=i.rotated?i.unbiasUV[1]:i.unbiasUV[5];MNt?(v.l=x+(v.x+.5)/c,v.t=T+(v.y+.5)/f,v.r=x+(v.x+v.width-.5)/c,v.b=T+(v.y+v.height-.5)/f):(v.l=x+v.x/c,v.t=T+v.y/f,v.r=x+(v.x+v.width)/c,v.b=T+(v.y+v.height)/f),v._rect=new bs(v.x,v.y,v.width,v.height)}else v.l=v.x/c,v.t=v.y/f,v.r=(v.x+v.width)/c,v.b=(v.y+v.height)/f,v._rect=new bs(v.x,v.y,v.width,v.height);else i.rotated?(v._rotated=!0,v._name=i.name,v._rect=i.getRect(),v.l=i.unbiasUV[0],v.t=i.unbiasUV[1],v.r=i.unbiasUV[4],v.b=i.unbiasUV[3]):(v._name=i.name,v._rect=i.getRect(),v.l=i.unbiasUV[0],v.t=i.unbiasUV[5],v.r=i.unbiasUV[2],v.b=i.unbiasUV[1]);v.cx=(v.l+v.r)/2,v.cy=(v.t+v.b)/2,e.set(w,v)}}var ONt=new Kr,kNt=new ds,RNt=new ir,FNt=new ir,LNt={row:0,col:0};function VNt(t){return"subNodes"in t}for(var NNt,zNt,UNt,GNt,HNt,WNt,jNt,qNt,XNt,YNt,JNt,KNt,QNt,ZNt,$Nt,tzt,ezt,izt,nzt,rzt,szt,azt,ozt,hzt,uzt,lzt,czt,fzt,_zt,dzt,pzt,mzt,gzt=t("gH",Kh("cc.TiledUserNodeData")(CNt=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}(yg))||CNt),yzt=t("gI",Kh("cc.TiledLayer")(DNt=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 QF,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(gzt);return e?(at(7242),!1):(e=t.addComponent(gzt),t.parent=this.node,this._userNodeMap[t.uuid]=e,e._row=-1,e._col=-1,e._tiledLayer=this,this._nodeLocalPosToLayerPos(t.getPosition(),kNt),this._positionToRowCol(kNt.x,kNt.y,LNt),this._addUserNodeToGrid(e,LNt),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(gzt);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(),kNt),this._positionToRowCol(kNt.x,kNt.y,LNt),this._addUserNodeToGrid(e,LNt),this._updateCullingOffsetByUserNode(e.node)}},e._updateCullingOffsetByUserNode=function(t){var e=t._getUITransformComp().contentSize;this._topOffset<e.height&&(this._topOffset=e.height),this._downOffset<e.height&&(this._downOffset=e.height),this._leftOffset<e.width&&(this._leftOffset=e.width),this._rightOffset<e.width&&(this._rightOffset=e.width)},e._userNodeSizeChange=function(){var t=this.node,e=this._tiledLayer;e._updateCullingOffsetByUserNode(t),e._userNodeDirty=!0,e._markForUpdateRenderData()},e._userNodePosChange=function(){var t=this,e=t.node,i=t._tiledLayer;i._nodeLocalPosToLayerPos(e.getPosition(),kNt),i._positionToRowCol(kNt.x,kNt.y,LNt),i._limitInLayer(LNt),LNt.row===t._row&&LNt.col===t._col||(i._removeUserNodeFromGrid(t),i._addUserNodeToGrid(t,LNt))},e._removeUserNodeFromGrid=function(t){var e=t._row,i=t._col,n=t._index,r=this._userNodeGrid[e],s=r&&r[i];s&&(r.count--,s.count--,s.list[n]=null,s.count<=0&&(s.list.length=0,s.count=0)),t._row=-1,t._col=-1,t._index=-1,this._userNodeDirty=!0,this._markForUpdateRenderData()},e._limitInLayer=function(t){var e=t.row,i=t.col;e<0&&(t.row=0),e>this._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=YE.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<s;o++){if(r>=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<this._tilesets[0].firstGid?it(7239,t):(n=n||0,this._updateTileForGID((r|n)>>>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,LNt),LNt.row-=r,LNt.col-=r,LNt.row=LNt.row>0?LNt.row:0,LNt.col=LNt.col>0?LNt.col:0,LNt.row===c.row&&LNt.col===c.col||(c.row=LNt.row,c.col=LNt.col,this._cullingDirty=!0),u<0||l<0?(LNt.row=-1,LNt.col=-1):(this._positionToRowCol(u,l,LNt),LNt.row++,LNt.col++),LNt.row===f.row&&LNt.col===f.col||(f.row=LNt.row,f.col=LNt.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(),Kr.invert(ONt,this.node.getWorldMatrix());var t=this._reinstallCamera();t&&(RNt.x=0,RNt.y=0,RNt.z=0,FNt.x=t.width,FNt.y=t.height,FNt.z=0,t.screenToWorld(RNt,RNt),t.screenToWorld(FNt,FNt),ir.transformMat4(RNt,RNt,ONt),ir.transformMat4(FNt,FNt,ONt),this.updateViewPort(RNt.x,RNt.y,FNt.x-RNt.x,FNt.y-RNt.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,_=.5*c,d=this._layerSize.height,p=this._layerSize.width,m=this.texGrids,g=0,y=0;1===n&&(s=this._staggerAxis,a=this._diffX1,o=this._diffY1,h=this._odd_even);var v,b,S,w=0,x=0,T=0,A=0,C=e*p+t;v=(268435455&r[C])>>>0;var D=m.get(v);if(D){switch(this._animations.get(v)&&(this._hasAniGrid=this._hasAniGrid||!0),n){case 0:g=(w=t)*l,y=(x=d-e-1)*c;break;case 2:g=f*(w=d+t-e-1),y=_*(x=d+p-t-e-2);break;case 1:g=t*(l-a)+(1===s&&e%2==1?f*h:0),y=(d-e-1)*(c-o)+(0===s&&t%2==1?_*-h:0),w=t,x=d-e-1}var B=i[x]=i[x]||{minCol:0,maxCol:0},I=B[w]=B[w]||{left:0,bottom:0,index:0};B.minCol>w&&(B.minCol=w),B.maxCol<w&&(B.maxCol=w),u.row<x&&(u.row=x,2===n&&(u.row+=1)),u.col<w&&(u.col=w,2===n&&(u.col+=1));var M=D.tileset.tileOffset;g+=this._offset.x+M.x+D.offsetX,y+=this._offset.y-M.y-D.offsetY,T=(T=-M.y+D.tileset._tileSize.height-c)<0?0:T,b=M.y<0?0:M.y,S=-M.x<0?0:-M.x,A=(A=M.x+D.tileset._tileSize.width-l)<0?0:A,this._rightOffset<S&&(this._rightOffset=S),this._leftOffset<A&&(this._leftOffset=A),this._topOffset<b&&(this._topOffset=b),this._downOffset<T&&(this._downOffset=T),I.left=g,I.bottom=y,I.index=C,this._cullingDirty=!0}}},e._updateVertices=function(){if(this.vertices.length=0,this.tiles){var t=this._rightTop;t.row=-1,t.col=-1;var e=this._layerSize.height,i=this._layerSize.width;this._topOffset=0,this._downOffset=0,this._leftOffset=0,this._rightOffset=0,this._hasAniGrid=!1;for(var n=0;n<e;++n)for(var r=0;r<i;++r)this._updateVertex(r,n);this._verticesDirty=!1}},e.getTiledTileAt=function(t,e,i){if(this.isInvalidPosition(t,e))throw new Error("TiledLayer.getTiledTileAt: invalid position");if(!this.tiles)return it(7236),null;var n=Math.floor(t)+Math.floor(e)*this._layerSize.width,r=this.tiledTiles[n];if(!r&&i){var s=new eb;return(r=s.addComponent(INt))._x=t,r._y=e,r._layer=this,r.updateInfo(),s.parent=this.node,r}return r},e.setTiledTileAt=function(t,e,i){if(this.isInvalidPosition(t,e))throw new Error("TiledLayer.setTiledTileAt: invalid position");if(!this.tiles)return it(7236),null;var n=Math.floor(t)+Math.floor(e)*this._layerSize.width;return this.tiledTiles[n]=i,this._cullingDirty=!0,this._hasTiledNodeGrid=!!i||this.tiledTiles.some((function(t){return!!t})),i},e.getTexture=function(t){return t=t||0,this._textures&&t>=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;n<t.length;n++){var r=t[n];r&&(e[n]=r.sourceImage)}for(var s=0,a=t.length;s<a;++s){var o=t[s];o&&ENt(o,i,o.sourceImage)}this._prepareToRender()},e.init=function(t,e,i,n,r){var s=this;s._cullingDirty=!0,s._layerInfo=t,s._mapInfo=e;var a=t.layerSize;s._layerName=t.name,s.tiles=t.tiles,s._properties=t.properties,s._layerSize=a,s._minGID=t.minGID,s._maxGID=t.maxGID,s._opacity=t.opacity,t.tintColor&&(s._tintColor=t.tintColor),s.renderOrder=e.renderOrder,s._staggerAxis=e.getStaggerAxis(),s._staggerIndex=e.getStaggerIndex(),s._hexSideLength=e.getHexSideLength(),s._animations=e.getTileAnimations(),s._tilesets=i,s._textures=n,s.texGrids=r,s._layerOrientation=e.orientation,s._mapTileSize=e.getTileSize();var o=s._mapTileSize.width,h=s._mapTileSize.height,u=s._layerSize.width,l=s._layerSize.height,c=s.node._getUITransformComp();if(1===s._layerOrientation){var f=0,_=0,d=-2&o,p=-2&h;s._odd_even=0===s._staggerIndex?1:-1,0===s._staggerAxis?(s._diffX1=(d-s._hexSideLength)/2,s._diffY1=0,f=(s._diffX1+s._hexSideLength)*u+s._diffX1,_=p*l+p/2):(s._diffX1=0,s._diffY1=(p-s._hexSideLength)/2,f=d*u+d/2,_=(s._diffY1+s._hexSideLength)*l+s._diffY1),c.setContentSize(f,_)}else if(2===s._layerOrientation){var m=u+l;c.setContentSize(.5*o*m,.5*h*m)}else c.setContentSize(u*o,l*h);s._offset=new ds(t.offset.x,-t.offset.y),s._useAutomaticVertexZ=!1,s._vertexZvalue=0,s._syncAnchorPoint(),s._prepareToRender()},e._prepareToRender=function(){this._updateVertices(),this._updateAllUserNode()},e.requestTiledRenderData=function(){for(var t=this._tiledDataArray;t.length>0&&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(VNt(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&&tL.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<this._tiledDataArray.length;e++){this._tiledDataArrayIdx=e;var i=this._tiledDataArray[e];if(i.subNodes)i.subNodes.forEach((function(e){e&&t.walk(e.node)}));else{var n=i;n.texture&&t.commitComp(this,n.renderData,n.texture,this._assembler,null)}}this.node._static=!0},e.createRenderEntity=function(){return new DL(2)},e.fillIndicesBuffer=function(t,e){var i=t.chunk.meshBuffer.iData,n=t.chunk.meshBuffer.indexOffset;e.setIndexOffset(n);for(var r=t.chunk.vertexOffset,s=t.vertexCount/4,a=0;a<s;a+=1)i[n]=r,i[n+1]=r+1,i[n+2]=r+2,i[n+3]=r+2,i[n+4]=r+1,i[n+5]=r+3,n+=6,r+=4;t.chunk.meshBuffer.indexOffset=n,e.setIBCount(6*s)},e.prepareDrawData=function(){var t=this;this._drawInfoList.length=0;var e=this.renderEntity;e.clearDynamicRenderDrawInfos();var i=this._tiledDataArray,n=0;i.forEach((function(i){if(VNt(i))i.subNodes.forEach((function(i){if(i){t._drawInfoList[n]||(t._drawInfoList[n]=new QF);var r=t._drawInfoList[n];r.setDrawInfoType(3),r.setSubNode(i.node),e.setDynamicRenderDrawInfo(r,n),n++}}));else{var r=i;if(r.texture){t._drawInfoList[n]||(t._drawInfoList[n]=new QF);var s=t._drawInfoList[n];r.renderData.fillDrawInfoAttributes(s),s.setTexture(r.texture.getGFXTexture()),s.setSampler(r.texture.getGFXSampler()),s.setMaterial(t.getRenderMaterial(0)),t.fillIndicesBuffer(r.renderData,s),e.setDynamicRenderDrawInfo(s,n),n++}}}))},n(i,[{key:"cullingRect",get:function(){return this._cullingRect}},{key:"rightTop",get:function(){return this._rightTop}},{key:"layerSize",get:function(){return this._layerSize}},{key:"tiledDataArray",get:function(){return this._tiledDataArray}},{key:"leftDownToCenterX",get:function(){return this._leftDownToCenterX}},{key:"leftDownToCenterY",get:function(){return this._leftDownToCenterY}},{key:"enableCulling",get:function(){return this._enableCulling},set:function(t){this._enableCulling!==t&&(this._enableCulling=t,this._cullingDirty=!0,this._markForUpdateRenderData())}}]),i}(BL))||DNt),vzt=t("gJ",(NNt=Kh("cc.TiledObjectGroup"),zNt=Qh(lL),UNt=Ou(fi),NNt(GNt=zNt((HNt=function(t){function e(){var e;return(e=t.call(this)||this)._premultiplyAlpha=!1,e._groupName=void 0,e._positionOffset=void 0,e._mapInfo=void 0,e._properties=void 0,e._offset=void 0,e._opacity=void 0,e._tintColor=null,e._animations=void 0,e._hasAniObj=void 0,e._texGrids=void 0,e.aniObjects=void 0,e._objects=[],e}s(e,t);var i=e.prototype;return i.getPositionOffset=function(){return this._positionOffset},i.getProperties=function(){return this._properties},i.getGroupName=function(){return this._groupName},i.getProperty=function(t){return this._properties[t.toString()]},i.getObject=function(t){for(var e=0,i=this._objects.length;e<i;e++){var n=this._objects[e];if(n&&n.name===t)return n}return null},i.getObjects=function(){return this._objects},i._init=function(t,e,i){this._groupName=t.name,this._positionOffset=t.offset,this._mapInfo=e,this._properties=t.getProperties(),this._offset=new ds(t.offset.x,-t.offset.y),this._opacity=t.opacity,t.tintColor&&(this._tintColor=t.tintColor),this._texGrids=i,this._animations=e.getTileAnimations(),this.aniObjects=[],this._hasAniObj=!1;var n=e.mapSize,r=e.tileSize,s=0,a=0,o=new cr,h=2===e.orientation;if(1===e.orientation)0===e.getStaggerAxis()?(a=r.height*(n.height+.5),s=(r.width+e.getHexSideLength())*Math.floor(n.width/2)+r.width*(n.width%2)):(s=r.width*(n.width+.5),a=(r.height+e.getHexSideLength())*Math.floor(n.height/2)+r.height*(n.height%2));else if(h){var u=n.width+n.height;s=.5*r.width*u,a=.5*r.height*u}else s=n.width*r.width,a=n.height*r.height;var l=this.node._getUITransformComp();l.setContentSize(s,a);for(var c=s*l.anchorX,f=a*(1-l.anchorY),_=t.objects,d={},p=0,m=_.length;p<m;p++){var g=_[p],y=g.type;g.offset=new ds(g.x,g.y);var v=g.points||g.polylinePoints;if(v)for(var b=0;b<v.length;b++)v[b].y*=-1;if(h){var S=g.x/r.height,w=g.y/r.height;g.x=.5*r.width*(n.height+S-w),g.y=.5*r.height*(n.width+n.height-S-w)}else g.y=a-g.y;if(5===y){var x="text"+g.id;d[x]=!0;var T=this.node.getChildByName(x);T||(T=new eb),T.setRotationFromEuler(0,0,-g.rotation),T.setPosition(g.x-c,g.y-f),T.name=x,T.parent=this.node,T.setSiblingIndex(p),T.layer=this.node.layer;var A=T.getComponent(LV);A||(A=T.addComponent(LV));var C=T._getUITransformComp();T.active=g.visible,C.anchorX=0,C.anchorY=1,this._tintColor?(o.set(this._tintColor),o.a*=this._opacity/255,A.color.set(o)):A.color.a*=this._opacity/255,A.overflow=2,A.lineHeight=g.height,A.string=g.text,A.horizontalAlign=g.halign,A.verticalAlign=g.valign,A.fontSize=g.pixelsize,C.setContentSize(g.width,g.height)}else if(4===y){var D=g.gid,B=(268435455&D)>>>0,I=i.get(B);if(!I)continue;var M=I.tileset,P="img"+g.id;d[P]=!0;var E=this.node.getChildByName(P);g.width=g.width||I.width,g.height=g.height||I.height,E&&1024&E._objFlags&&(E.removeFromParent(),E.hideFlags|=8,E.destroy(),E=null),E||(E=new eb),this._animations.get(B)&&(this.aniObjects.push({object:g,imgNode:E,gridGID:B}),this._hasAniObj=!0);var O=M.tileOffset.x,k=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 R=E.getComponent(GV);R||(R=E.addComponent(GV));var F=E._getUITransformComp();h?(F.anchorX=.5+O/g.width,F.anchorY=k/g.height):(F.anchorX=O/g.width,F.anchorY=k/g.height),this._tintColor?(o.set(this._tintColor),o.a*=this._opacity/255,R.color.set(o)):R.color.a*=this._opacity/255,R.sizeMode=0;var L=this._premultiplyAlpha?1:2;R.srcBlendFactor!==L&&(R.srcBlendFactor=L,R.material&&R._updateBlendFunc());var V=I.spriteFrame;V=V?V.clone():new nR,(2147483648&D)>>>0&&(V.flipUVX=!V.flipUVX),(1073741824&D)>>>0&&(V.flipUVY=!V.flipUVY),V.rotated=I._rotated,V.rect=I._rect,R.spriteFrame=V,F.setContentSize(g.width,g.height),R._markForUpdateRenderData()}}this._objects=_;for(var N=this.node.children,z=/^(?:img|text)\d+$/,U=0,G=N.length;U<G;U++){var H=N[U],W=H.name;z.test(W)&&!d[W]&&H.destroy()}},i.update=function(){if(this._hasAniObj)for(var t=this.aniObjects,e=this._texGrids,i=2===this._mapInfo.orientation,n=0,r=t.length;n<r;n++){var s=t[n],a=s.gridGID,o=e.get(a);if(o){var h=o.tileset,u=s.object,l=s.imgNode,c=h.tileOffset.x,f=h.tileOffset.y,_=l._getUITransformComp();i?(_.anchorX=.5+c/u.width,_.anchorY=f/u.height):(_.anchorX=c/u.width,_.anchorY=f/u.height);var d=l.getComponent(GV),p=d.spriteFrame;p.rotated=o._rotated,p.rect=o._rect,d.spriteFrame=p,d._markForUpdateRenderData()}}},n(e,[{key:"premultiplyAlpha",get:function(){return this._premultiplyAlpha},set:function(t){this._premultiplyAlpha=t}},{key:"offset",get:function(){return this._offset}}]),e}(yg),v(HNt.prototype,"premultiplyAlpha",[UNt],Object.getOwnPropertyDescriptor(HNt.prototype,"premultiplyAlpha"),HNt.prototype),GNt=HNt))||GNt)||GNt)),bzt=t("gG",(WNt=Kh("cc.TiledMapAsset"),jNt=Ou([kx]),qNt=Ou([_i]),XNt=Ou([nR]),YNt=Ou([nR]),JNt=Ou([_i]),KNt=Ou([_i]),QNt=Ou([ms]),WNt(($Nt=function(t){function e(){var e;return(e=t.call(this)||this).tmxXmlStr=tzt&&tzt(),e.tsxFiles=ezt&&ezt(),e.tsxFileNames=izt&&izt(),e.spriteFrames=nzt&&nzt(),e.imageLayerSpriteFrame=rzt&&rzt(),e.imageLayerSpriteFrameNames=szt&&szt(),e.spriteFrameNames=azt&&azt(),e.spriteFrameSizes=ozt&&ozt(),e}return s(e,t),e}(Cm),tzt=zh($Nt.prototype,"tmxXmlStr",[uu],(function(){return""})),ezt=zh($Nt.prototype,"tsxFiles",[uu,jNt],(function(){return[]})),izt=zh($Nt.prototype,"tsxFileNames",[uu,qNt],(function(){return[]})),nzt=zh($Nt.prototype,"spriteFrames",[uu,XNt],(function(){return[]})),rzt=zh($Nt.prototype,"imageLayerSpriteFrame",[uu,YNt],(function(){return[]})),szt=zh($Nt.prototype,"imageLayerSpriteFrameNames",[uu,JNt],(function(){return[]})),azt=zh($Nt.prototype,"spriteFrameNames",[uu,KNt],(function(){return[]})),ozt=zh($Nt.prototype,"spriteFrameSizes",[uu,QNt],(function(){return[]})),ZNt=$Nt))||ZNt)),Szt=(t("gF",(hzt=Kh("cc.TiledMap"),uzt=Qh(lL),lzt=Ou(bzt),hzt(czt=uzt((mzt=function(t){function e(){var e;return(e=t.call(this)||this)._texGrids=new Map,e._textures=[],e._tilesets=[],e._animations=new Map,e._imageLayers=[],e._layers=[],e._groups=[],e._images=[],e._properties={},e._tileProperties=new Map,e._mapInfo=null,e._mapSize=new ms(0,0),e._tileSize=new ms(0,0),e._mapOrientation=0,e._isApplied=!1,e._tmxFile=_zt&&_zt(),e._enableCulling=dzt&&dzt(),e.cleanupImageCache=pzt&&pzt(),e}s(e,t);var i=e.prototype;return i.getMapSize=function(){return this._mapSize},i.getTileSize=function(){return this._tileSize},i.getMapOrientation=function(){return this._mapOrientation},i.getObjectGroups=function(){return this._groups},i.getObjectGroup=function(t){for(var e=this._groups,i=0,n=e.length;i<n;i++){var r=e[i];if(r&&r.getGroupName()===t)return r}return null},i.getProperties=function(){return this._properties},i.getLayers=function(){return this._layers},i.getLayer=function(t){for(var e=this._layers,i=0,n=e.length;i<n;i++){var r=e[i];if(r&&r.getLayerName()===t)return r}return null},i._changeLayer=function(t,e){for(var i=this._layers,n=0,r=i.length;n<r;n++){var s=i[n];if(s&&s.getLayerName()===t)return void(i[n]=e)}},i.getProperty=function(t){return this._properties[t.toString()]},i.getPropertiesForGID=function(t){return this._tileProperties.get(t)},i.enableTexelOffset=function(t){PNt(t)},i.__preload=function(){this._tmxFile&&!1===this._isApplied&&(this._applyFile(),this._isApplied=!0)},i.onEnable=function(){this.node.on("anchor-changed",this._syncAnchorPoint,this)},i.onDisable=function(){this.node.off("anchor-changed",this._syncAnchorPoint,this)},i._applyFile=function(){var t=[],e={},i=this._tmxFile;if(i){for(var n=i.spriteFrameNames,r=i.spriteFrameSizes,s=i.spriteFrames,a={},o={},h=0;h<n.length;++h){var u=n[h];o[u]=r[h],t[h]=s[h];var l=t[h];l&&(e[l.name]=l,a[u]=l)}var c={},f=i.imageLayerSpriteFrame;n=i.imageLayerSpriteFrameNames;for(var _=0;_<f.length;++_)c[n[_]]=f[_];for(var d=i.tsxFileNames,p=i.tsxFiles,m={},g=0;g<d.length;++g)d[g].length>0&&(m[d[g]]=p[g].text);var y=new BNt(i.tmxXmlStr,m,a,o,c),v=y.getTilesets();v&&0!==v.length||it(7241),this._buildWithMapInfo(y)}else this._releaseMapInfo()},i._releaseMapInfo=function(){for(var t=this._layers,e=0,i=t.length;e<i;e++){var n,r;null==(n=t[e].node.parent)||n.off("size-changed",t[e].updateCulling,t[e]),null==(r=t[e].node.parent)||r.off("transform-changed",t[e].updateCulling,t[e]),t[e].node.removeFromParent(),t[e].node.destroy()}t.length=0;for(var s=this._groups,a=0,o=s.length;a<o;a++)s[a].node.removeFromParent(),s[a].node.destroy();s.length=0;for(var h=this._images,u=0,l=h.length;u<l;u++)h[u].removeFromParent(),h[u].destroy();h.length=0},i._syncAnchorPoint=function(){var t,e,i=this.node._getUITransformComp().anchorPoint,n=this.node._getUITransformComp().width*i.x,r=this.node._getUITransformComp().height*(1-i.y);for(t=0,e=this._layers.length;t<e;t++)this._layers[t].node._getUITransformComp().setAnchorPoint(i);for(t=0,e=this._groups.length;t<e;t++){var s=this._groups[t],a=s.node._getUITransformComp();a.anchorX=.5,a.anchorY=.5;var o=s.offset.x-n+a.width*a.anchorX,h=s.offset.y+r-a.height*a.anchorY;s.node.setPosition(o,h)}for(t=0,e=this._images.length;t<e;t++){var u=this._images[t]._getUITransformComp();u.anchorX=.5,u.anchorY=.5;var l=this._images[t]._offset.x-n+u.width*u.anchorX,c=this._images[t]._offset.y+r-u.height*u.anchorY;this._images[t].setPosition(l,c)}},i._fillAniGrids=function(t,e){for(var i,n=p(e.keys());!(i=n()).done;){var r=i.value,s=e.get(r);if(s)for(var a=s.frames,o=0;o<a.length;o++){var h=a[o];h.grid=t.get(h.tileid)}}},i._buildLayerAndGroup=function(){var t=this._tilesets,e=this._texGrids,i=this._animations;e.clear();for(var n=0,r=t.length;n<r;++n){var s=t[n];s&&(s.sourceImage?ENt(s,e,s.sourceImage):at(16406,n))}this._fillAniGrids(e,i);for(var a=this._layers,o=this._groups,h=this._images,u={},l=0,c=a.length;l<c;l++)u[a[l].node.name]=!0;for(var f=0,_=o.length;f<_;f++)u[o[f].node.name]=!0;for(var d=0,p=h.length;d<p;d++)u[h[d].name]=!0;a=this._layers=[],o=this._groups=[],h=this._images=[];var m=this._mapInfo,g=this.node,y=m.getAllChildren(),v=this._textures,b=0,S=0;if(y&&y.length>0)for(var w=0,x=y.length;w<x;w++){var T=y[w],A=T.name,C=this.node.getChildByName(A);if(u[A]=!1,C||((C=new eb).name=A,C.layer=g.layer,g.addChild(C)),C.setSiblingIndex(w),C.active=T.visible,T instanceof hNt){var D=C.getComponent(yzt);D||(D=C.addComponent(yzt)),D.init(T,m,t,v,e),D.enableCulling=this._enableCulling,T.ownTiles=!1,a.push(D)}else if(T instanceof oNt){var B=C.getComponent(vzt);B||(B=C.addComponent(vzt)),B._init(T,m,e),o.push(B)}else if(T instanceof uNt){var I=T.sourceImage;C.layerInfo=T,C._offset=new ds(T.offset.x,-T.offset.y);var M=C.getComponent(GV);M||(M=C.addComponent(GV)),M.color.a*=T.opacity,M.spriteFrame=I;var P=I.width,E=I.height;I.original&&(P=I.originalSize.width,E=I.originalSize.height),C._getUITransformComp().setContentSize(P,E),h.push(C)}b=Math.max(b,C._getUITransformComp().width),S=Math.max(S,C._getUITransformComp().height)}for(var O=g.children,k=0,R=O.length;k<R;k++){var F=O[k];u[F.name]&&F.destroy()}this.node._getUITransformComp().setContentSize(b,S),this._syncAnchorPoint()},i._buildWithMapInfo=function(t){var e=this;this._mapInfo=t,this._mapSize=t.getMapSize(),this._tileSize=t.getTileSize(),this._mapOrientation=t.orientation,this._properties=t.properties,this._tileProperties=t.getTileProperties(),this._imageLayers=t.getImageLayers(),this._animations=t.getTileAnimations(),this._tilesets=t.getTilesets();var i=this._tilesets;this._textures.length=0;for(var n=[],r=0,s=i.length;r<s;++r){var a=i[r];a&&a.sourceImage&&(this._textures[r]=a.sourceImage,n.push(a.sourceImage))}for(var o=0;o<this._imageLayers.length;o++){var h=this._imageLayers[o];h&&h.sourceImage&&n.push(h.sourceImage)}this._buildLayerAndGroup(),this.cleanupImageCache&&this._textures.forEach((function(t){e.doCleanupImageCache(t)}))},i.doCleanupImageCache=function(t){t._image instanceof HTMLImageElement?t._image.src="":hh.hasFeature(hh.Feature.IMAGE_BITMAP)&&t._image instanceof ImageBitmap&&t._image.close&&t._image.close(),t._image=null},i.lateUpdate=function(t){for(var e,i=this._animations,n=this._texGrids,r=p(i.keys());!(e=r()).done;){var s=e.value,a=i.get(s),o=a.frames,h=o[a.frameIdx];a.dt+=t,h.duration<a.dt&&(a.dt=0,a.frameIdx++,a.frameIdx>=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<c;l++){var f=u[l];(f.hasAnimation()||f.node.hasChangedFlags)&&f._markForUpdateRenderData()}},n(e,[{key:"tmxAsset",get:function(){return this._tmxFile},set:function(t){this._tmxFile!==t&&(this._tmxFile=t,this._applyFile(),this._isApplied=!0)}},{key:"enableCulling",get:function(){return this._enableCulling},set:function(t){this._enableCulling=t;for(var e=this._layers,i=0;i<e.length;++i)e[i].enableCulling=t}}]),e}(yg),mzt.Orientation=$Vt,mzt.Property=tNt,mzt.TileFlag=eNt,mzt.StaggerAxis=iNt,mzt.StaggerIndex=nNt,mzt.TMXObjectType=sNt,mzt.RenderOrder=rNt,_zt=zh((fzt=mzt).prototype,"_tmxFile",[uu],(function(){return null})),v(fzt.prototype,"tmxAsset",[lzt],Object.getOwnPropertyDescriptor(fzt.prototype,"tmxAsset"),fzt.prototype),dzt=zh(fzt.prototype,"_enableCulling",[uu],(function(){return!0})),pzt=zh(fzt.prototype,"cleanupImageCache",[uu],(function(){return!0})),czt=fzt))||czt)||czt)),Math.ceil(10922.5)),wzt=[],xzt=0;xzt<4;xzt++)wzt.push(new ir);var Tzt,Azt,Czt,Dzt=new Kr,Bzt=new ir,Izt={row:0,col:0},Mzt={x:0,y:0},Pzt={x:0,y:0},Ezt={x:0,y:0},Ozt={x:0,y:0},kzt=0,Rzt=0,Fzt=0,Lzt=0,Vzt=null,Nzt=null,zzt=function(){function t(){}var e=t.prototype;return e.ensureAccessor=function(){if(!Nzt){var t=YE.root.device;YE.root.batcher2D,Nzt=new NF(t,IF),YE.on("director_before_draw",(function(){Nzt.reset()}))}},e.createData=function(){return null},e.fillBuffers=function(t){if(t&&0!==t.tiledDataArray.length){for(var e=t.tiledDataArray[t._tiledDataArrayIdx].renderData,i=e.chunk.meshBuffer.iData,n=e.chunk.meshBuffer.indexOffset,r=e.chunk.vertexOffset,s=e.vertexCount/4,a=0;a<s;a+=1)i[n]=r,i[n+1]=r+1,i[n+2]=r+2,i[n+3]=r+2,i[n+4]=r+1,i[n+5]=r+3,n+=6,r+=4;e.chunk.meshBuffer.indexOffset=n}},e.updateRenderData=function(t){if(t.updateCulling(),Rzt=t.leftDownToCenterX,Fzt=t.leftDownToCenterY,t.colorChanged||t.isCullingDirty()||t.isUserNodeDirty()||t.hasAnimation()||t.hasTiledNode()||t.node.hasChangedFlags){var e,i;if(t.colorChanged=!1,t.destroyRenderData(),t.enableCulling){var n=t.cullingRect;e=n.leftDown,i=n.rightTop}else e=Izt,i=t.rightTop;switch(t.renderOrder){case 0:Wzt(e,i,-1,1,t);break;case 2:Wzt(e,i,-1,-1,t);break;case 1:Wzt(e,i,1,1,t);break;default:Wzt(e,i,1,-1,t)}t.setCullingDirty(!1),t.setUserNodeDirty(!1)}},e.updateColor=function(t){var e=t.color,i=new Float32Array(4);i[0]=e.r/255,i[1]=e.g/255,i[2]=e.b/255,i[3]=e.a/255;for(var n=t.tiledDataArray,r=0;r<n.length;r++){var s=n[r];if(s.renderData)for(var a=s.renderData,o=a.vData,h=a.vertexStart,u=a.vertexCount;h<u;h++)o.set(i,9*h+5)}},t}(),Uzt=new zzt;function Gzt(t,e){var i;t._rotated?(Mzt.x=t.r,Mzt.y=t.t,Pzt.x=t.l,Pzt.y=t.t,Ezt.x=t.r,Ezt.y=t.b,Ozt.x=t.l,Ozt.y=t.b):(Mzt.x=t.l,Mzt.y=t.t,Pzt.x=t.l,Pzt.y=t.b,Ezt.x=t.r,Ezt.y=t.t,Ozt.x=t.r,Ozt.y=t.b),(536870912&e)>>>0&&(i=Pzt,Pzt=Ezt,Ezt=i),(2147483648&e)>>>0&&(i=Mzt,Mzt=Ezt,Ezt=i,i=Pzt,Pzt=Ozt,Ozt=i),(1073741824&e)>>>0&&(i=Mzt,Mzt=Pzt,Pzt=i,i=Ezt,Ezt=Ozt,Ozt=i)}function Hzt(){if(!(Lzt<1)&&Vzt){var t=4*Lzt,e=6*Lzt,i=Azt.requestTiledRenderData();i.renderData=tL.add(IF),i.texture=Vzt;var n=i.renderData;n.resize(t,e),n.chunk.vb.set(Tzt.subarray(0,9*t),0),Lzt=0,Vzt=null}}function Wzt(t,e,i,n,r){if(!(e.row<0||e.col<0)){Azt=r;var s=r.node.worldMatrix;kzt=0;var a,o,h,u,l,c,f,_,d,p=r.tiledTiles,m=r.texGrids,g=r.tiles,y=18,v=27,b=r.vertices,S=0,w=0,x=0,T=0,A=0,C=0,D=!0;Czt=Gzt;var B=new Float32Array(4);B[0]=r.color.r/255,B[1]=r.color.g/255,B[2]=r.color.b/255,B[3]=r.color.a/255,-1===i?(u=e.row,l=t.row):(u=t.row,l=e.row);var I=Math.abs(t.row-e.row)+1,M=Math.abs(e.col-t.col)+1;Tzt=new Float32Array(I*M*36),Lzt=0;for(var P=Tzt;(l-u)*i>=0;u+=i)for(a=b[u],C=r.getNodesCountByRow(u),D=a&&0===C,1===n?(o=D&&t.col<a.minCol?a.minCol:t.col,h=D&&e.col>a.maxCol?a.maxCol:e.col):(o=D&&e.col>a.maxCol?a.maxCol:e.col,h=D&&t.col<a.minCol?a.minCol:t.col);(h-o)*n>=0;o+=n){if(c=a&&a[o],C>0){Hzt();var E=r.requestSubNodesData(),O=r.getNodesByRowCol(u,o);O&&O.count>0&&(E.subNodes=O.list)}c&&(S=g[c.index],(_=m.get((268435455&S)>>>0))&&(Vzt!==_.texture&&(Hzt(),Vzt=_.texture),f=_.tileset._tileSize,w=c.left-Rzt,x=c.bottom-Fzt,T=w+f.width,A=x+f.height,d=p[c.index],kzt=36*Lzt,d?d.node.active&&jzt(d.node,B,P,w,T,A,x):(wzt[0].x=w,wzt[0].y=A,wzt[1].x=w,wzt[1].y=x,wzt[2].x=T,wzt[2].y=A,wzt[3].x=T,wzt[3].y=x,wzt[0].transformMat4(s),P[kzt]=wzt[0].x,P[kzt+1]=wzt[0].y,P[kzt+2]=wzt[0].z,wzt[1].transformMat4(s),P[kzt+9]=wzt[1].x,P[kzt+9+1]=wzt[1].y,P[kzt+9+2]=wzt[1].z,wzt[2].transformMat4(s),P[kzt+y]=wzt[2].x,P[kzt+y+1]=wzt[2].y,P[kzt+y+2]=wzt[2].z,wzt[3].transformMat4(s),P[kzt+v]=wzt[3].x,P[kzt+v+1]=wzt[3].y,P[kzt+v+2]=wzt[3].z,P.set(B,kzt+5),P.set(B,kzt+9+5),P.set(B,kzt+y+5),P.set(B,kzt+v+5)),Czt(_,S),P[kzt+3]=Mzt.x,P[kzt+4]=Mzt.y,P[kzt+9+3]=Pzt.x,P[kzt+9+4]=Pzt.y,P[kzt+y+3]=Ezt.x,P[kzt+y+4]=Ezt.y,P[kzt+v+3]=Ozt.x,P[kzt+v+4]=Ozt.y,++Lzt>=Szt&&Hzt()))}Hzt()}}function jzt(t,e,i,n,r,s,a){t.updateWorldTransform(),Kr.fromRTS(Dzt,t.rotation,t.position,t.scale),ir.set(Bzt,-(n+Rzt),-(a+Fzt),0),Kr.transform(Dzt,Dzt,Bzt),Kr.multiply(Dzt,t.parent.worldMatrix,Dzt);var o=Dzt,h=o.m12,u=o.m13,l=o.m00,c=o.m01,f=o.m04,_=o.m05;1===l&&0===c&&0===f&&1===_?(i[kzt]=n+h,i[kzt+1]=s+u,i[kzt+9]=n+h,i[kzt+9+1]=a+u,i[kzt+18]=r+h,i[kzt+18+1]=s+u,i[kzt+27]=r+h,i[kzt+27+1]=a+u):(i[kzt]=n*l+s*f+h,i[kzt+1]=n*c+s*_+u,i[kzt+9]=n*l+a*f+h,i[kzt+9+1]=n*c+a*_+u,i[kzt+18]=r*l+s*f+h,i[kzt+18+1]=r*c+s*_+u,i[kzt+27]=r*l+a*f+h,i[kzt+27+1]=r*c+a*_+u),i.set(e,kzt+5),i.set(e,kzt+9+5),i.set(e,kzt+18+5),i.set(e,kzt+27+5)}var qzt=t("gL",{getAssembler:function(){return Uzt}});yzt.Assembler=qzt;var Xzt=new ir,Yzt=new ir;function Jzt(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=Tf.create(t)).addKnot(r);var h=null;a&&o&&(h=Yzt,ir.subtract(h,r,e[e.length-1]));for(var u=0,l=e.length;u<l;++u){var c=o?e[l-1-u]:e[u];a?o?u>0&&i.addKnot(ir.copy(Xzt,h).add(c)):i.addKnot(ir.copy(Xzt,r).add(c)):i.addKnot(c)}a&&o&&i.addKnot(s)},onComplete:function(){i=null},onStop:function(){i=null},legacyProgress:!1}}var Kzt=Object.freeze({__proto__:null,bezier:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return Jzt(1,e)},catmullRom:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return Jzt(2,e)}});t("gM",Kzt);var Qzt=function(){this.actions=[],this.target=null,this.actionIndex=0,this.currentAction=null,this.paused=!1,this.lock=!1},Zzt=function(){function t(){this._hashTargets=new Map,this._arrayTargets=[],this._currentTarget=void 0,this._elementPool=[]}var e=t.prototype;return e._getElement=function(t,e){var i=this._elementPool.pop();return i||(i=new Qzt),i.target=t,i.paused=!!e,i},e._putElement=function(t){t.actions.length=0,t.actionIndex=0,t.currentAction=null,t.paused=!1,t.target=null,t.lock=!1,this._elementPool.push(t)},e._onNodeActiveChanged=function(t,e){e?this.resumeTarget(t):this.pauseTarget(t)},e._onNodeDestroy=function(t){this._removeAllActionsFromTarget(t,!1)},e._registerNodeEvent=function(t){t.isValid&&(t.on("active-changed",this._onNodeActiveChanged,this),t.on("node-destroyed",this._onNodeDestroy,this))},e._unregisterNodeEvent=function(t){t.isValid&&(t.off("active-changed",this._onNodeActiveChanged,this),t.off("node-destroyed",this._onNodeDestroy,this))},e.addAction=function(t,e,i){if(t&&e){var n=this._hashTargets.get(e);n?n.actions||(n.actions=[]):(n=this._getElement(e,i),this._hashTargets.set(e,n),this._arrayTargets.push(n)),0===n.actions.length&&e instanceof eb&&this._registerNodeEvent(e),n.target=e,n.actions.push(t),t.startWithTarget(e)}else ht(1e3)},e.removeAllActions=function(){for(var t=this._arrayTargets,e=0;e<t.length;e++){var i=t[e];i&&(i.target instanceof eb&&this._unregisterNodeEvent(i.target),this._putElement(i))}this._arrayTargets.length=0,this._hashTargets=new Map},e.removeAllActionsFromTarget=function(t){this._removeAllActionsFromTarget(t,!0)},e._removeAllActionsFromTarget=function(t,e){if(null!=t){var i=this._hashTargets.get(t);i&&(e&&t instanceof eb&&this._unregisterNodeEvent(t),i.actions.length=0,this._deleteHashElement(i))}},e.removeAction=function(t){if(null!=t){var e=t.getOriginalTarget(),i=this._hashTargets.get(e);if(i)for(var n=0;n<i.actions.length;n++)if(i.actions[n]===t){i.actions.splice(n,1),i.actionIndex>=n&&i.actionIndex--;break}}},e._removeActionByTag=function(t,e,i){for(var n=0,r=e.actions.length;n<r;++n){var s=e.actions[n];if(s&&s.getTag()===t){if(i&&s.getOriginalTarget()!==i)continue;this._removeActionAtIndex(n,e);break}}},e._removeAllActionsByTag=function(t,e,i){for(var n=e.actions.length-1;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<i.actions.length;++n){var r=i.actions[n];if(r&&r.getTag()===t)return r}it(1005,t)}return null},e.getNumberOfRunningActionsInTarget=function(t){var e=this._hashTargets.get(t);return e&&e.actions?e.actions.length:0},e.pauseTarget=function(t){var e=this._hashTargets.get(t);e&&(e.paused=!0)},e.resumeTarget=function(t){var e=this._hashTargets.get(t);e&&(e.paused=!1)},e.pauseAllRunningActions=function(){for(var t=[],e=this._arrayTargets,i=0;i<e.length;i++){var n=e[i];n&&!n.paused&&(n.paused=!0,n.target&&t.push(n.target))}return t},e.resumeTargets=function(t){if(t)for(var e=0;e<t.length;e++)t[e]&&this.resumeTarget(t[e])},e.pauseTargets=function(t){if(t)for(var e=0;e<t.length;e++)t[e]&&this.pauseTarget(t[e])},e.isActionRunning=function(t){var e=this._hashTargets.get(t.getOriginalTarget()),i=-1;return e&&(i=e.actions.indexOf(t)),-1!==i},e._removeActionAtIndex=function(t,e){e.actions.splice(t,1),e.actionIndex>=t&&e.actionIndex--,0===e.actions.length&&(e.target instanceof eb&&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<r;n++)if(i[n]===t){i.splice(n,1);break}this._putElement(t),e=!0}return e},e.update=function(t){for(var e,i=this._arrayTargets,n=0;n<i.length;n++){this._currentTarget=i[n];var r=(e=this._currentTarget).target;if(!vo(r)||r.isValid){if(!e.paused&&e.actions){for(e.lock=!0,e.actionIndex=0;e.actionIndex<e.actions.length;e.actionIndex++)if(e.currentAction=e.actions[e.actionIndex],e.currentAction){if(e.currentAction.step(t),e.currentAction&&e.currentAction.isDone()){e.currentAction.stop();var s=e.currentAction;e.currentAction=null,this.removeAction(s)}e.currentAction=null}e.lock=!1}0===e.actions.length&&(r instanceof eb&&this._unregisterNodeEvent(r),this._deleteHashElement(e)&&n--)}else this.removeAllActionsFromTarget(r),n--}},t}(),$zt=t("gN",function(t){function e(){var e;return(e=t.call(this)||this).actionMgr=new Zzt,e}return s(e,t),e.prototype.update=function(t){this.actionMgr.update(t)},n(e,[{key:"ActionManager",get:function(){return this.actionMgr}}]),e}(Ff));$zt.ID="TWEEN",$zt.instance=void 0,YE.on("director_init",(function(){var t=new $zt;$zt.instance=t,YE.registerSystem($zt.ID,t,100)}));var tUt=function(t){function e(){var e;return(e=t.call(this)||this)._duration=0,e}s(e,t);var i=e.prototype;return i.getDurationScaled=function(){return this._duration},i.getDuration=function(){return this._duration},i.setDuration=function(t){this._duration=t},e}(function(){function t(){this.originalTarget=null,this.target=null,this._owner=null,this.tag=-1,this._id=void 0,this._paused=!1}var e=t.prototype;return e.isDone=function(){return!0},e.startWithTarget=function(t){this.originalTarget=t,this.target=t},e.stop=function(){this.target=null},e.getTarget=function(){return this.target},e.setTarget=function(t){this.target=t},e.getOriginalTarget=function(){return this.originalTarget},e.setOriginalTarget=function(t){this.originalTarget=t},e._getWorkerTarget=function(){var t,e=null==(t=this._owner)?void 0:t.getTarget();return null!=e?e:this.target},e.getTag=function(){return this.tag},e.setTag=function(t){this.tag=t},e.setId=function(t){this._id=t},e.getId=function(){return this._id},e.setPaused=function(t){this._paused=t},t}()),eUt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.isDone=function(){return!0},i.step=function(){this.update(1)},i.update=function(){},i.reverse=function(){return this.clone()},i.isUnknownDuration=function(){return!1},e}(tUt),iUt=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(CL),i=0;i<e.length;++i)e[i].enabled=!0},i.reverse=function(){return new nUt},i.clone=function(){var t=new e;return t._id=this._id,t},i.toString=function(){return"<Show>"},e}(eUt),nUt=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(CL),i=0;i<e.length;++i)e[i].enabled=!1},i.reverse=function(){return new iUt},i.clone=function(){var t=new e;return t._id=this._id,t},i.toString=function(){return"<Hide>"},e}(eUt);!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(CL),i=0;i<e.length;++i){var n=e[i];n.enabled=!n.enabled}},i.reverse=function(){return new e},i.clone=function(){var t=new e;return t._id=this._id,t},i.toString=function(){return"<ToggleVisibility>"}}(eUt);var rUt=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"<RemoveSelf>"},e}(eUt);function sUt(t){return new rUt(t)}var aUt=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"<CallFunc>"},e}(eUt);function oUt(t,e,i){return new aUt(t,e,i)}var hUt=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}(tUt),uUt=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}(tUt);function lUt(t,e){var i=new cUt;return i.initWithTwoActions(t,e),i}var cUt=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 hUt);var n=e.length-1;if(n>=0&&null==e[n]&&it(1015),n>=0){for(var r=e[0],s=1;s<n;s++)e[s]&&(r=lUt(r,e[s]));i.initWithTwoActions(r,e[n])}return i}s(e,t);var i=e.prototype;return i.initWithTwoActions=function(t,e){if(!t||!e)return ht(1025),!1;var i=t.getDurationScaled()+e.getDurationScaled();return this.initWithDuration(i),this._actions[0]=t,this._actions[1]=e,!0},i.clone=function(){var t=new e;return t._id=this._id,t._speed=this._speed,this._cloneDecoration(t),t.initWithTwoActions(this._actions[0].clone(),this._actions[1].clone()),t},i.startWithTarget=function(e){t.prototype.startWithTarget.call(this,e),0!==this._actions.length&&(this._split=this._actions[0].getDurationScaled()/this._duration,this._last=-1)},i.stop=function(){0!==this._actions.length&&(-1!==this._last&&this._actions[this._last].stop(),t.prototype.stop.call(this))},i.update=function(t){var e=this._actions;if(0!==e.length){var i=0,n=0,r=this._split,s=this._last;if(t<r){if(i=0!==r?t/r:1,0===n&&1===s&&this._reversed){var a=e[1];if(a.update(0),a.isUnknownDuration())return;a.stop()}}else{var o=e[0];if(n=1,i=1===r?1:(t-r)/(1-r),-1===s){if(o.startWithTarget(this.target),o.update(1),o.isUnknownDuration())return;o.stop()}if(0===s){if(o.update(1),o.isUnknownDuration())return;o.stop()}}var h=e[n];s===n&&h.isDone()||(s!==n&&h.startWithTarget(this.target),h.update(i>1?i%1:i),this._last=n)}},i.reverse=function(){var t=lUt(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 yUt?i.updateOwner(t):i._owner||(i._owner=t)}},i.findAction=function(t){for(var i=0,n=this._actions.length;i<n;++i){var r=this._actions[i];if(r.getId()===t)return r;if((r instanceof e||r instanceof yUt)&&(r=r.findAction(t))&&r.getId()===t)return r}return null},i.isUnknownDuration=function(){if(0===this._actions.length)return!1;var t=this._actions[0],e=this._actions[1];return this._last<1?t.isUnknownDuration():e.isUnknownDuration()},i.toString=function(){return"<Sequence>"},e}(uUt);function fUt(t){return new cUt(t)}var _Ut=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 eUt&&(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._total<n;){if(e.update(1),e.isUnknownDuration())return;this._total++,e.stop(),e.startWithTarget(this.target),r+=e.getDurationScaled()/i,this._nextDt=r>1?1:r}if(t>=1&&this._total<n){if(e.update(1),e.isUnknownDuration())return;this._total++}this._actionInstant||(this._total===n?e.stop():e.update(t-(r-e.getDurationScaled()/i)))}else e.update(t*n%1)},i.isDone=function(){return this._total===this._times},i.reverse=function(){var t=new e(this._innerAction?this._innerAction.reverse():void 0,this._times);return this._cloneDecoration(t),t},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"<Repeat>"},e}(uUt);function dUt(t,e){return new _Ut(t,e)}var pUt=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"<RepeatForever>"},e}(uUt);function mUt(t){return new pUt(t)}function gUt(t,e){var i=new yUt;return i.initWithTwoActions(t,e),i}var yUt=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 hUt);var n=e.length-1;if(n>=0&&null==e[n]&&it(1015),n>=0){for(var r=e[0],s=1;s<n;s++)e[s]&&(r=gUt(r,e[s]));i.initWithTwoActions(r,e[n])}return i}s(e,t);var i=e.prototype;return i.initWithTwoActions=function(t,e){if(!t||!e)return ht(1027),!1;var i=!1,n=t.getDurationScaled(),r=e.getDurationScaled();return this.initWithDuration(Math.max(n,r))&&(this._one=t,this._two=e,n>r?this._two=lUt(e,bUt(n-r)):n<r&&(this._one=lUt(t,bUt(r-n))),i=!0),i},i.clone=function(){var t=new e;return t._id=this._id,t._speed=this._speed,this._cloneDecoration(t),this._one&&this._two&&t.initWithTwoActions(this._one.clone(),this._two.clone()),t},i.startWithTarget=function(e){t.prototype.startWithTarget.call(this,e),this._one&&this._one.startWithTarget(e),this._two&&this._two.startWithTarget(e)},i.stop=function(){this._one&&this._one.stop(),this._two&&this._two.stop(),t.prototype.stop.call(this)},i.update=function(t){this._one&&(this._finished&&!this._one.isUnknownDuration()||this._one.update(t)),this._two&&(this._finished&&!this._two.isUnknownDuration()||this._two.update(t)),this._finished=1===t},i.reverse=function(){if(this._one&&this._two){var t=gUt(this._one.reverse(),this._two.reverse());return this._cloneDecoration(t),t}return this},i.updateOwner=function(t){if(this._one&&this._two){this._two._owner||(this._two._owner=t);var i=this._one;i instanceof e||i instanceof cUt?i.updateOwner(t):i._owner||(i._owner=t)}},i.findAction=function(t){var i=this._one,n=this._two,r=null,s=function(i){if(i.getId()===t)return i;if(i instanceof cUt||i instanceof e){var n=i.findAction(t);if(n)return n}return null};return i&&(r=s(i))||n&&(r=s(n))?r:null},i.isUnknownDuration=function(){var t=this._one,e=this._two;if(null==t||null==e)return!1;var i=t.isUnknownDuration(),n=e.isUnknownDuration();if(i||n){if(i&&n)return!0;if(this._finished)return!0}return!1},i.toString=function(){return"<Spawn>"},e}(uUt),vUt=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"<DelayTime>"},e}(uUt);function bUt(t){return new vUt(t)}var SUt=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"<ReverseTime>"},e}(uUt);function wUt(t){return new SUt(t)}var xUt=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"<ActionCustomUpdate>"},e}(uUt),TUt=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=A.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"<ActionUnknownDuration>"},e}(tUt);function AUt(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 CUt(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 DUt=t("gO",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(CUt(n),n.easing&&"string"==typeof n.easing&&(n.easing=AUt(n.easing)),n.progress||(n.progress=r.progress),n.easing&&"string"==typeof n.easing){var s=n.easing;n.easing=Hl[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=Hl[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;l<c;++l){var f=u[l];isNaN(t[f])||(e.start[f]=t[f],e.current[f]=t[f],e.end[f]=n?s?t[f]-a[f]:t[f]+a[f]:a[f])}}else{var _=e.clone;if(!_)return at(16383,o),e.valid=!1,0;var d=e.add,p=e.sub;if(n&&(d||(at(16384,o),e.valid=!1),s&&!p&&(at(16385,o),e.valid=!1),!e.valid))return 0;e.start=_(t),e.current=_(t),e.end=n?s?p(t,a):d(t,a):_(a)}else if("string"==typeof t){var m=e.convert,g=function(t){if("number"==typeof t)return t;var e=t;return m&&(e=m(t)),"number"!=typeof e&&(e=Number(e),Number.isNaN(e))?(at(16386,""+t),null):e},y=g(a),v=g(t);if(null==y||null==v)return e.valid=!1,0;e.start=v,e.current=t,e.end=n?s?v-y:v+y:y}e.onStart&&e.onStart({relative:n,reversed:s,start:e.start,end:e.end})};for(var o in r)a();this._opts.onStart&&this._opts.onStart(i)}},i.stop=function(){var e=this._props;for(var i in e){var n=e[i];n.valid&&n.onStop&&n.onStop()}t.prototype.stop.call(this)},i.update=function(t){var e=this._getWorkerTarget();if(e&&this._opts){var i=this._props,n=this._opts,r=t;"function"==typeof n.easing&&(r=n.easing(t));var s=n.progress;for(var a in i){var o=i[a];if(o.valid){var h=o.easing?o.easing(t):r,u=o.progress?o.progress:s,l=o.start,c=o.end,f=o.current;if("number"==typeof f)o.current=u(l,c,o.current,h);else if("object"==typeof l)if(o.legacyProgress)for(var _=o.keys,d=0,p=_.length;d<p;++d){var m=_[d];o.current[m]=u(l[m],c[m],o.current[m],h)}else o.current=u(l,c,o.current,h);else if("string"==typeof f){var g,y=u(l,c,o.current,h);if("number"==typeof y)y=y.toFixed(null!==(g=o.toFixed)&&void 0!==g?g:0);else if("string"!=typeof y){at(16387);continue}o.current=y}e[a]=o.current,1===t&&o.onComplete&&o.onComplete()}}n.onUpdate&&n.onUpdate(e,t),1===t&&n.onComplete&&n.onComplete(e)}},i.progress=function(t,e,i,n){return t+(e-t)*n},i.isUnknownDuration=function(){return!1},n(e,[{key:"relative",get:function(){return!!this._opts.relative}}]),e}(uUt)),BUt=function(t){function e(e){var i;return(i=t.call(this)||this)._props=void 0,i._props={},e&&i.init(e),i}s(e,t);var i=e.prototype;return i.init=function(t){for(var e in t)this._props[e]=t[e];return!0},i.update=function(){var t=this._props,e=this._getWorkerTarget();for(var i in t)e[i]=t[i]},i.clone=function(){var t=new e;return t._id=this._id,t.init(this._props),t},i.isUnknownDuration=function(){return!1},e}(eUt);function IUt(){return $zt.instance.ActionManager}var MUt,PUt,EUt,OUt,kUt,RUt,FUt,LUt,VUt,NUt,zUt,UUt,GUt,HUt,WUt,jUt,qUt,XUt,YUt,JUt,KUt,QUt,ZUt,$Ut,tGt,eGt,iGt,nGt=t("gP",function(){function t(t){this._actions=[],this._finalAction=null,this._target=null,this._tag=-1,this._timeScale=1,this._target=void 0===t?null:t}var e=t.prototype;return e.tag=function(t){return this._tag=t,this},e.id=function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return this._actions.length>0&&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=rGt(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;n<r;++n){if((i=e[n]).getId()===t)return i;if((i instanceof cUt||i instanceof yUt)&&(i=i.findAction(t)))return i}return null},e.insertAction=function(t){var e=t.clone();return this.updateOwnerForAction(e),this._actions.push(e),this},e.updateOwnerForAction=function(t){t&&(t instanceof cUt||t instanceof yUt?t.updateOwner(this):t._owner||(t._owner=this))},e.target=function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return this._target=t,this})),e.getTarget=function(){return this._target},e.start=function(t){if(void 0===t&&(t=0),!this._target)return at(16392),this;this._finalAction&&IUt().removeAction(this._finalAction);var e=this._unionForStart();return this._finalAction=e,e?(e.setTag(this._tag),e.setSpeed(this._timeScale),e.setStartTime(t),e.setPaused(!1),IUt().addAction(e,this._target,!1)):at(16393),this},e.stop=function(){return this._finalAction&&(this._finalAction.stop(),IUt().removeAction(this._finalAction),this._finalAction=null),this},e.pause=function(){return this._finalAction?this._finalAction.setPaused(!0):at(16389),this},e.resume=function(){return this._finalAction?this._finalAction.setPaused(!1):at(16390),this},e.clone=function(t){var e=this._union(!1),i=rGt(null!=t?t:this._target);return i._timeScale=this._timeScale,e?i.insertAction(e):i},e.union=function(t){var e,i=this;if(void 0===t)return e=i._union(!1),i._actions.length=0,e&&i._actions.push(e),this;var n=this._actions,r=n.findIndex((function(e){return e.getId()===t}));if(n.length>1){var s=n.splice(r);1===s.length?n.push(s[0]):n.push(fUt(s))}return this},e.to=function(t,e,i){var n=i||Object.create(null);n.relative=!1;var r=new DUt(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 DUt(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;r<i;r++)n[r-2]=arguments[r];var s=new xUt(t,e,n);return this._actions.push(s),this},e.updateUntil=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];var r=new TUt(t,i);return this._actions.push(r),this},e.set=function(t){var e=new BUt(t);return this._actions.push(e),this},e.delay=function(t){var e=bUt(t);return this._actions.push(e),this},e.call=function(t,e,i){var n=oUt(t,e,i);return this._actions.push(n),this},e.sequence=function(){for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];var r=t._wrappedSequence(i);return r&&this._actions.push(r),this},e.parallel=function(){for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];var r=t._wrappedParallel(i);return r&&this._actions.push(r),this},e.timeScale=function(t){return this._timeScale=t,this._finalAction&&this._finalAction.setSpeed(t),this},e.getTimeScale=function(){return this._timeScale},e.repeat=function(e,i){if(e===1/0)return this.repeatForever(i);var n,r=this._actions;return(n=i instanceof t?i._union(!1):r.pop())&&r.push(dUt(n,e)),this},e.repeatForever=function(e){var i,n=this._actions;return(i=e instanceof t?e._union(!1):n.pop())&&0!==n.length?n.push(dUt(i,Number.MAX_SAFE_INTEGER)):i instanceof uUt?n.push(mUt(i)):at(16394),this},e.reverseTime=function(e){var i,n=this._actions;return(i=e instanceof t?e._union(!1):n.pop())instanceof uUt?n.push(wUt(i)):at(16395),this},e.hide=function(){if(this._target instanceof eb){var t=new nUt;this._actions.push(t)}return this},e.show=function(){if(this._target instanceof eb){var t=new iUt;this._actions.push(t)}return this},e.removeSelf=function(){if(this._target instanceof eb){var t=sUt(!1);this._actions.push(t)}return this},e.destroySelf=function(){if(this._target instanceof eb){var t=sUt(!0);this._actions.push(t)}return this},t.getRunningCount=function(t){return IUt().getNumberOfRunningActionsInTarget(t)},t.stopAll=function(){IUt().removeAllActions()},t.stopAllByTag=function(t,e){IUt().removeAllActionsByTag(t,e)},t.stopAllByTarget=function(t){IUt().removeAllActionsFromTarget(t)},t.pauseAllByTarget=function(t){IUt().pauseTarget(t)},t.resumeAllByTarget=function(t){IUt().resumeTarget(t)},e._union=function(t){var e=this._actions;if(0===e.length)return null;var i=fUt(e);return t&&this.updateOwnerForAction(i),i},e._unionForStart=function(){var t=this._actions;return 0===t.length?null:1===t.length&&t[0]instanceof pUt?t[0]:fUt(t)},t._tweenToActions=function(e){var i=t._tmpArgs;i.length=0;for(var n=e.length,r=0;r<n;r++){var s=e[r],a=s._union(!0);a&&(a.setSpeed(s._timeScale),i.push(a))}},t._wrappedSequence=function(e){t._tweenToActions(e);var i=fUt(t._tmpArgs);return this._tmpArgs.length=0,i},t._wrappedParallel=function(e){t._tweenToActions(e);var i,n=(i=t._tmpArgs,new yUt(i));return this._tmpArgs.length=0,n},n(t,[{key:"running",get:function(){return!!this._finalAction&&IUt().isActionRunning(this._finalAction)}},{key:"duration",get:function(){return this._finalAction?this._finalAction.getDuration():0}}]),t}());function rGt(t){return new nGt(t)}function sGt(t){return at(16396),new nGt(t)}nGt._tmpArgs=[],C.Tween=nGt,C.tween=rGt,C.tweenUtil=sGt;var aGt=new cr,oGt={NONE:0,COLOR:1,SPRITE:2,SCALE:3};Re(oGt);var hGt={CLICK:"click"},uGt=t("gS",(MUt=Kh("cc.Button"),PUt=Zh(110),EUt=Qh(lL),OUt=Ou(eb),kUt=Ou(oGt),RUt=Ou(nR),FUt=Ou(nR),LUt=Ou(nR),VUt=Ou(nR),NUt=Ou([mg]),MUt(zUt=PUt(zUt=EUt((iGt=function(t){function e(){var e;return(e=t.call(this)||this).clickEvents=GUt&&GUt(),e._interactable=HUt&&HUt(),e._transition=WUt&&WUt(),e._normalColor=jUt&&jUt(),e._hoverColor=qUt&&qUt(),e._pressedColor=XUt&&XUt(),e._disabledColor=YUt&&YUt(),e._normalSprite=JUt&&JUt(),e._hoverSprite=KUt&&KUt(),e._pressedSprite=QUt&&QUt(),e._disabledSprite=ZUt&&ZUt(),e._duration=$Ut&&$Ut(),e._zoomScale=tGt&&tGt(),e._target=eGt&&eGt(),e._pressed=!1,e._hovered=!1,e._fromColor=new cr,e._toColor=new cr,e._time=0,e._transitionFinished=!0,e._fromScale=nr(),e._toScale=nr(),e._originalScale=null,e._sprite=null,e._targetScale=nr(),e}s(e,t);var i=e.prototype;return i.__preload=function(){this.target||(this.target=this.node),this._applyTarget(),this._resetState()},i.onEnable=function(){this._registerNodeEvent()},i.onDisable=function(){this._resetState(),this._unregisterNodeEvent()},i.onDestroy=function(){this.target.isValid&&this._unregisterTargetEvent(this.target)},i.update=function(t){var e=this.target;if(!this._transitionFinished&&e&&(1===this._transition||3===this._transition)){this._time+=t;var i=1;if(this._duration>0&&(i=this._time/this._duration),i>=1&&(i=1),1===this._transition){var n=e._uiProps.uiComp;cr.lerp(aGt,this._fromColor,this._toColor,i),n&&(n.color=aGt)}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(BL);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(GV)),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&&(mg.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(BL);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(GV);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}(yg),iGt.Transition=oGt,iGt.EventType=hGt,v((UUt=iGt).prototype,"target",[OUt],Object.getOwnPropertyDescriptor(UUt.prototype,"target"),UUt.prototype),v(UUt.prototype,"transition",[kUt],Object.getOwnPropertyDescriptor(UUt.prototype,"transition"),UUt.prototype),v(UUt.prototype,"normalSprite",[RUt],Object.getOwnPropertyDescriptor(UUt.prototype,"normalSprite"),UUt.prototype),v(UUt.prototype,"pressedSprite",[FUt],Object.getOwnPropertyDescriptor(UUt.prototype,"pressedSprite"),UUt.prototype),v(UUt.prototype,"hoverSprite",[LUt],Object.getOwnPropertyDescriptor(UUt.prototype,"hoverSprite"),UUt.prototype),v(UUt.prototype,"disabledSprite",[VUt],Object.getOwnPropertyDescriptor(UUt.prototype,"disabledSprite"),UUt.prototype),GUt=zh(UUt.prototype,"clickEvents",[NUt,uu],(function(){return[]})),HUt=zh(UUt.prototype,"_interactable",[uu],(function(){return!0})),WUt=zh(UUt.prototype,"_transition",[uu],(function(){return 0})),jUt=zh(UUt.prototype,"_normalColor",[uu],(function(){return cr.WHITE.clone()})),qUt=zh(UUt.prototype,"_hoverColor",[uu],(function(){return new cr(211,211,211,255)})),XUt=zh(UUt.prototype,"_pressedColor",[uu],(function(){return cr.WHITE.clone()})),YUt=zh(UUt.prototype,"_disabledColor",[uu],(function(){return new cr(124,124,124,255)})),JUt=zh(UUt.prototype,"_normalSprite",[uu],(function(){return null})),KUt=zh(UUt.prototype,"_hoverSprite",[uu],(function(){return null})),QUt=zh(UUt.prototype,"_pressedSprite",[uu],(function(){return null})),ZUt=zh(UUt.prototype,"_disabledSprite",[uu],(function(){return null})),$Ut=zh(UUt.prototype,"_duration",[uu],(function(){return.1})),tGt=zh(UUt.prototype,"_zoomScale",[uu],(function(){return 1.2})),eGt=zh(UUt.prototype,"_target",[uu],(function(){return null})),zUt=UUt))||zUt)||zUt)||zUt));C.Button=uGt;var lGt=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}();lGt._tabIndexList=[];var cGt=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}(),fGt=B.document,_Gt=new Kr,dGt=new Kr,pGt=new ir,mGt=null,gGt=0,yGt=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_"+ ++gGt,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(),lGt.add(this),this.setTabIndex(t.tabIndex),this._initStyleSheet(),this._registerEventListeners(),this._addDomToGameContainer(),IO.instance.on("canvas-resize",this._resize,this),sh.on("window-resize",this._resize,this))},i.clear=function(){IO.instance.off("canvas-resize",this._resize,this),sh.off("window-resize",this._resize,this),this._removeEventListeners(),this._removeDomFromGameContainer(),lGt.remove(this),mGt===this&&(mGt=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,lGt.resort()},i.setSize=function(t,e){var i=this._edTxt;i&&(i.style.width=t+"px",i.style.height=e+"px")},i.beginEditing=function(){mGt&&mGt!==this&&mGt.setFocus(!1),this._editing=!0,mGt=this,this._delegate._editBoxEditingDidBegan(),this._showDom(),this._edTxt.focus()},i.endEditing=function(){this._edTxt.blur()},i._createInput=function(){this._isTextArea=!1,this._edTxt=fGt.createElement("input")},i._createTextArea=function(){this._isTextArea=!0,this._edTxt=fGt.createElement("textarea")},i._addDomToGameContainer=function(){XO.container&&this._edTxt&&(XO.container.appendChild(this._edTxt),fGt.head.appendChild(this._placeholderStyleSheet))},i._removeDomFromGameContainer=function(){Ke(XO.container,this._edTxt)&&this._edTxt&&XO.container.removeChild(this._edTxt),Ke(fGt.head,this._placeholderStyleSheet)&&fGt.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()),hh.isMobile&&this._showDomOnMobile()},i._hideDom=function(){var t=this._edTxt;t&&this._delegate&&(t.style.display="none",this._delegate._showLabels()),hh.isMobile&&this._hideDomOnMobile()},i._showDomOnMobile=function(){hh.os!==Oo.ANDROID&&hh.os!==Oo.OHOS||(sh.handleResizeEvent=!1,this._adjustWindowScroll())},i._hideDomOnMobile=function(){hh.os!==Oo.ANDROID&&hh.os!==Oo.OHOS||(sh.handleResizeEvent=!0),this._scrollBackWindow()},i._isElementInViewport=function(){if(this._edTxt){var t=this._edTxt.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(B.innerHeight||fGt.documentElement.clientHeight)&&t.right<=(B.innerWidth||fGt.documentElement.clientWidth)}return!1},i._adjustWindowScroll=function(){var t=this;setTimeout((function(){B.scrollY<40&&!t._isElementInViewport()&&t._edTxt.scrollIntoView({block:"start",inline:"nearest",behavior:"smooth"})}),400)},i._scrollBackWindow=function(){setTimeout((function(){hh.browserType!==Mo.WECHAT||hh.os!==Oo.IOS?B.scrollTo(0,0):B.top&&B.top.scrollTo(0,0)}),400)},i._updateMatrix=function(){if(this._edTxt){var t=this._delegate.node,e=zO.getScaleX(),i=zO.getScaleY(),n=zO.getViewportRect(),r=sh.devicePixelRatio;t.getWorldMatrix(_Gt);var s=t._getUITransformComp();if(s&&(ir.set(pGt,-s.anchorX*s.width,-s.anchorY*s.height,pGt.z),Kr.transform(_Gt,_Gt,pGt)),t._getUITransformComp()){var a=YE.root.batcher2D.getFirstRenderCamera(t);if(a){a.node.getWorldRT(dGt);var o=dGt.m12,h=dGt.m13,u=uh.center;dGt.m12=u.x-(dGt.m00*o+dGt.m04*h),dGt.m13=u.y-(dGt.m01*o+dGt.m05*h),e/=r,i/=r,ir.set(pGt,e,i,1),Kr.scale(dGt,dGt,pGt);var l=XO.container,c=parseInt(l&&l.style.paddingLeft||"0");c+=n.x/r;var f=parseInt(l&&l.style.paddingBottom||"0");f+=n.y/r,dGt.m12+=c,dGt.m13+=f,Kr.multiply(dGt,dGt,_Gt);var _="matrix("+dGt.m00+","+-dGt.m01+","+-dGt.m04+","+dGt.m05+","+dGt.m12+","+-dGt.m13+")";this._edTxt.style.transform=_,this._edTxt.style["-webkit-transform"]=_,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=fGt.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 cF?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 LV.HorizontalAlign.LEFT:n.style.textAlign="left";break;case LV.HorizontalAlign.CENTER:n.style.textAlign="center";break;case LV.HorizontalAlign.RIGHT:n.style.textAlign="right"}}}},i._updatePlaceholderLabel=function(t){if(t){var e=t.font;e=!e||e instanceof cF?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 LV.HorizontalAlign.LEFT:a="left";break;case LV.HorizontalAlign.CENTER:a="center";break;case LV.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+";}",hh.browserType===Mo.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&&hh.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(),lGt.next(t))},n.onBlur=function(){hh.isMobile&&i&&n.compositionEnd(),t._editing=!1,mGt=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}(cGt),vGt={DEFAULT:0,DONE:1,SEND:2,SEARCH:3,GO:4,NEXT:5};Ee(vGt);var bGt={ANY:0,EMAIL_ADDR:1,NUMERIC:2,PHONE_NUMBER:3,URL:4,DECIMAL:5,SINGLE_LINE:6};Ee(bGt);var SGt,wGt,xGt,TGt,AGt,CGt,DGt,BGt,IGt,MGt,PGt,EGt,OGt,kGt,RGt,FGt,LGt,VGt,NGt,zGt,UGt,GGt,HGt,WGt,jGt,qGt,XGt,YGt,JGt,KGt={PASSWORD:0,SENSITIVE:1,INITIAL_CAPS_WORD:2,INITIAL_CAPS_SENTENCE:3,INITIAL_CAPS_ALL_CHARACTERS:4,DEFAULT:5};Ee(KGt);var QGt,ZGt,$Gt,tHt,eHt,iHt,nHt,rHt,sHt,aHt,oHt,hHt,uHt,lHt,cHt,fHt,_Ht,dHt,pHt,mHt,gHt,yHt,vHt,bHt,SHt,wHt,xHt,THt,AHt=t("gT",(SGt=Kh("cc.EditBox"),wGt=Zh(110),xGt=Qh(lL),TGt=Ou(LV),AGt=Ou(LV),CGt=Ou(nR),DGt=Ou(KGt),BGt=Ou(bGt),IGt=Ou(vGt),MGt=Ou([mg]),PGt=Ou([mg]),EGt=Ou([mg]),OGt=Ou([mg]),SGt(kGt=wGt(kGt=xGt((JGt=function(t){function e(){var e;return(e=t.call(this)||this).editingDidBegan=FGt&&FGt(),e.textChanged=LGt&&LGt(),e.editingDidEnded=VGt&&VGt(),e.editingReturn=NGt&&NGt(),e._impl=null,e._background=null,e._textLabel=zGt&&zGt(),e._placeholderLabel=UGt&&UGt(),e._returnType=GGt&&GGt(),e._string=HGt&&HGt(),e._tabIndex=WGt&&WGt(),e._backgroundImage=jGt&&jGt(),e._inputFlag=qGt&&qGt(),e._inputMode=XGt&&XGt(),e._maxLength=YGt&&YGt(),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(){YE.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(){mg.emitEvents(this.editingDidBegan,this),this.node.emit("editing-did-began",this)},i._editBoxEditingDidEnded=function(t){mg.emitEvents(this.editingDidEnded,this),this.node.emit("editing-did-ended",this,t)},i._editBoxTextChanged=function(t){t=this._updateLabelStringStyle(t,!0),this.string=t,mg.emitEvents(this.textChanged,t,this),this.node.emit("text-changed",this)},i._editBoxEditingReturn=function(t){mg.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),YE.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(GV);t||(t=this.node.addComponent(GV)),t!==this._background&&(t.type=GV.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 eb("TEXT_LABEL")).layer=this.node.layer),(t=e.getComponent(LV))||(t=e.addComponent(LV)),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 eb("PLACEHOLDER_LABEL")).layer=this.node.layer),(t=e.getComponent(LV))||(t=e.addComponent(LV)),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<s;++a)r+="●";t=r}return t},i._registerEvent=function(){var t=this,e=t.node;e.on("touch-start",t._onTouchBegan,t),e.on("touch-end",t._onTouchEnded,t)},i._unregisterEvent=function(){var t=this,e=t.node;e.off("touch-start",t._onTouchBegan,t),e.off("touch-end",t._onTouchEnded,t)},i._onBackgroundSpriteFrameChanged=function(){this._background&&(this.backgroundImage=this._background.spriteFrame)},i._registerBackgroundEvent=function(){var t=this._background&&this._background.node;null==t||t.on("spriteframe-changed",this._onBackgroundSpriteFrameChanged,this)},i._unregisterBackgroundEvent=function(){var t=this._background&&this._background.node;null==t||t.off("spriteframe-changed",this._onBackgroundSpriteFrameChanged,this)},i._updateLabelPosition=function(t){var e=this.node._getUITransformComp(),i=-e.anchorX*e.width,n=-e.anchorY*e.height,r=this._placeholderLabel,s=this._textLabel;s&&(s.node._getUITransformComp().setContentSize(t.width-2,t.height),s.node.setPosition(i+2,n+t.height,s.node.position.z),0===this._inputMode&&(s.verticalAlign=0),s.enableWrapText=0===this._inputMode),r&&(r.node._getUITransformComp().setContentSize(t.width-2,t.height),r.node.setPosition(i+2,n+t.height,r.node.position.z),r.enableWrapText=0===this._inputMode)},i._resizeChildNodes=function(){var t=this.node._getUITransformComp(),e=this._textLabel&&this._textLabel.node;e&&(e.setPosition(-t.width/2,t.height/2,e.position.z),e._getUITransformComp().setContentSize(t.contentSize));var i=this._placeholderLabel&&this._placeholderLabel.node;i&&(i.setPosition(-t.width/2,t.height/2,i.position.z),i._getUITransformComp().setContentSize(t.contentSize));var n=this._background&&this._background.node;n&&n._getUITransformComp().setContentSize(t.contentSize),this._syncSize()},i._xrUnClick=function(){},i._xrKeyBoardInput=function(){},n(e,[{key:"string",get:function(){return this._string},set:function(t){this._maxLength>=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}(yg),JGt._EditBoxImpl=cGt,JGt.KeyboardReturnType=vGt,JGt.InputFlag=KGt,JGt.InputMode=bGt,JGt.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"},v((RGt=JGt).prototype,"textLabel",[TGt],Object.getOwnPropertyDescriptor(RGt.prototype,"textLabel"),RGt.prototype),v(RGt.prototype,"placeholderLabel",[AGt],Object.getOwnPropertyDescriptor(RGt.prototype,"placeholderLabel"),RGt.prototype),v(RGt.prototype,"backgroundImage",[CGt],Object.getOwnPropertyDescriptor(RGt.prototype,"backgroundImage"),RGt.prototype),v(RGt.prototype,"inputFlag",[DGt],Object.getOwnPropertyDescriptor(RGt.prototype,"inputFlag"),RGt.prototype),v(RGt.prototype,"inputMode",[BGt],Object.getOwnPropertyDescriptor(RGt.prototype,"inputMode"),RGt.prototype),v(RGt.prototype,"returnType",[IGt],Object.getOwnPropertyDescriptor(RGt.prototype,"returnType"),RGt.prototype),FGt=zh(RGt.prototype,"editingDidBegan",[MGt,uu],(function(){return[]})),LGt=zh(RGt.prototype,"textChanged",[PGt,uu],(function(){return[]})),VGt=zh(RGt.prototype,"editingDidEnded",[EGt,uu],(function(){return[]})),NGt=zh(RGt.prototype,"editingReturn",[OGt,uu],(function(){return[]})),zGt=zh(RGt.prototype,"_textLabel",[uu],(function(){return null})),UGt=zh(RGt.prototype,"_placeholderLabel",[uu],(function(){return null})),GGt=zh(RGt.prototype,"_returnType",[uu],(function(){return 0})),HGt=zh(RGt.prototype,"_string",[uu],(function(){return""})),WGt=zh(RGt.prototype,"_tabIndex",[uu],(function(){return 0})),jGt=zh(RGt.prototype,"_backgroundImage",[uu],(function(){return null})),qGt=zh(RGt.prototype,"_inputFlag",[uu],(function(){return 5})),XGt=zh(RGt.prototype,"_inputMode",[uu],(function(){return 0})),YGt=zh(RGt.prototype,"_maxLength",[uu],(function(){return 20})),kGt=RGt))||kGt)||kGt)||kGt));"object"==typeof window&&"object"==typeof document&&(AHt._EditBoxImpl=yGt),C.internal.EditBox=AHt;var CHt={NONE:0,HORIZONTAL:1,VERTICAL:2,GRID:3};Re(CHt);var DHt={NONE:0,CONTAINER:1,CHILDREN:2};Re(DHt);var BHt={HORIZONTAL:0,VERTICAL:1};Re(BHt);var IHt={BOTTOM_TO_TOP:0,TOP_TO_BOTTOM:1};Re(IHt);var MHt={LEFT_TO_RIGHT:0,RIGHT_TO_LEFT:1};Re(MHt);var PHt={NONE:0,FIXED_ROW:1,FIXED_COL:2};Re(PHt);var EHt,OHt,kHt,RHt,FHt,LHt,VHt,NHt,zHt,UHt,GHt,HHt,WHt,jHt=new ir,qHt=t("gU",(QGt=Kh("cc.Layout"),ZGt=Zh(110),$Gt=Qh(lL),tHt=Ou(CHt),eHt=Ou(DHt),iHt=Ou(BHt),nHt=Ou(IHt),rHt=Ou(MHt),sHt=Ou(PHt),QGt(aHt=ZGt(aHt=$Gt((THt=function(t){function e(){var e;return(e=t.call(this)||this)._resizeMode=hHt&&hHt(),e._layoutType=uHt&&uHt(),e._cellSize=lHt&&lHt(),e._startAxis=cHt&&cHt(),e._paddingLeft=fHt&&fHt(),e._paddingRight=_Ht&&_Ht(),e._paddingTop=dHt&&dHt(),e._paddingBottom=pHt&&pHt(),e._spacingX=mHt&&mHt(),e._spacingY=gHt&&gHt(),e._verticalDirection=yHt&&yHt(),e._horizontalDirection=vHt&&vHt(),e._constraint=bHt&&bHt(),e._constraintNum=SHt&&SHt(),e._affectedByScale=wHt&&wHt(),e._isAlign=xHt&&xHt(),e._layoutSize=new ms(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(ms.ZERO)&&t.setContentSize(this._layoutSize),this._childrenChanged()},i.onDisable=function(){this._usefulLayoutObj.length=0,this._removeEventListeners()},i._checkUsefulObj=function(){this._usefulLayoutObj.length=0;for(var t=this.node.children,e=0;e<t.length;++e){var i=t[e],n=i._getUITransformComp();i.activeInHierarchy&&n&&this._usefulLayoutObj.push(n)}},i._addEventListeners=function(){YE.on("director_after_update",this.updateLayout,this),this.node.on("size-changed",this._resized,this),this.node.on("anchor-changed",this._doLayoutDirty,this),this.node.on("child-added",this._childAdded,this),this.node.on("child-removed",this._childRemoved,this),this.node.on("sibling-order-changed",this._childrenChanged,this),this.node.on("childrenSiblingOrderChanged",this.updateLayout,this),this._addChildrenEventListeners()},i._removeEventListeners=function(){YE.off("director_after_update",this.updateLayout,this),this.node.off("size-changed",this._resized,this),this.node.off("anchor-changed",this._doLayoutDirty,this),this.node.off("child-added",this._childAdded,this),this.node.off("child-removed",this._childRemoved,this),this.node.off("sibling-order-changed",this._childrenChanged,this),this.node.off("childrenSiblingOrderChanged",this.updateLayout,this),this._removeChildrenEventListeners()},i._addChildrenEventListeners=function(){for(var t=this.node.children,e=0;e<t.length;++e){var i=t[e];i.on("size-changed",this._doLayoutDirty,this),i.on("transform-changed",this._transformDirty,this),i.on("anchor-changed",this._doLayoutDirty,this),i.on("active-in-hierarchy-changed",this._childrenChanged,this)}},i._removeChildrenEventListeners=function(){for(var t=this.node.children,e=0;e<t.length;++e){var i=t[e];i.off("size-changed",this._doLayoutDirty,this),i.off("transform-changed",this._transformDirty,this),i.off("anchor-changed",this._doLayoutDirty,this),i.off("active-in-hierarchy-changed",this._childrenChanged,this)}},i._childAdded=function(t){t.on("size-changed",this._doLayoutDirty,this),t.on("transform-changed",this._transformDirty,this),t.on("anchor-changed",this._doLayoutDirty,this),t.on("active-in-hierarchy-changed",this._childrenChanged,this),this._childrenChanged()},i._childRemoved=function(t){t.off("size-changed",this._doLayoutDirty,this),t.off("transform-changed",this._transformDirty,this),t.off("anchor-changed",this._doLayoutDirty,this),t.off("active-in-hierarchy-changed",this._childrenChanged,this),this._childrenChanged()},i._resized=function(){this._layoutSize.set(this.node._getUITransformComp().contentSize),this._doLayoutDirty()},i._doLayoutHorizontally=function(t,e,i,n){var r=this.node._getUITransformComp().anchorPoint,s=this._getFixedBreakingNum(),a=1,o=this._paddingLeft;1===this._horizontalDirection&&(a=-1,o=this._paddingRight);var h=(this._horizontalDirection-r.x)*t+a*o,u=h-a*this._spacingX,l=0,c=0,f=0,_=0,d=!1,p=this._usefulLayoutObj.length,m=this._cellSize.width,g=this._getPaddingH();3!==this._layoutType&&2===this._resizeMode&&(m=(t-g-(p-1)*this._spacingX)/p);for(var y=this._usefulLayoutObj,v=0;v<y.length;++v){var b=y[v],S=b.node,w=S.scale,x=this._getUsedScaleValue(w.x),T=this._getUsedScaleValue(w.y);2===this._resizeMode&&(b.width=m/x,3===this._layoutType&&(b.height=this._cellSize.height/T));var A=Math.abs(this._horizontalDirection-b.anchorX),C=b.width*x,D=b.height*T;D>f&&(_=Math.max(f,_),c=f||D,f=D),u+=a*(A*C+this._spacingX);var B=a*(1-A)*C;if(e){if(s>0)(d=v/s>0&&v%s==0)&&(c=f>D?f:c);else if(C>t-g)u>h+a*A*C&&(d=!0);else{var I=(1-this._horizontalDirection-r.x)*t,M=u+B+a*(a>0?this._paddingRight:this._paddingLeft);d=Math.abs(M)>Math.abs(I)}d&&(u=h+a*A*C,D!==f&&(c=f),l+=c+this._spacingY,c=f=D)}var P=i(S,b,l);n&&S.setPosition(u,P),u+=B}return c=Math.max(c,f),Math.max(_,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,_=0,d=!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 y=this._usefulLayoutObj,v=0;v<y.length;++v){var b=y[v],S=b.node,w=S.scale,x=this._getUsedScaleValue(w.x),T=this._getUsedScaleValue(w.y);2===this._resizeMode&&(b.height=m/T,3===this._layoutType&&(b.width=this._cellSize.width/x));var A=Math.abs(this._verticalDirection-b.anchorY),C=b.width*x,D=b.height*T;C>l&&(c=Math.max(l,c),f=l||C,l=C),u+=a*(A*D+this._spacingY);var B=a*(1-A)*D;if(e){if(s>0)(d=v/s>0&&v%s==0)&&(f=l>D?l:f);else if(D>t-g)u>h+a*A*D&&(d=!0);else{var I=(1-this._verticalDirection-r.y)*t,M=u+B+a*(a>0?this._paddingTop:this._paddingBottom);d=Math.abs(M)>Math.abs(I)}d&&(u=h+a*A*D,C!==l&&(f=l),_+=f+this._spacingX,f=l=C)}var P=i(S,b,_);n&&(S.getPosition(jHt),S.setPosition(P,u,jHt.z)),u+=B}return f=Math.max(f,l),Math.max(c,_+f)+this._getPaddingH()},i._doLayoutGridAxisHorizontal=function(t,e){var i=this,n=e.width,r=1,s=-t.y*e.height,a=this._paddingBottom;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;n<t.length;++n){var r=t[n],s=r.node.scale;e+=r.width*this._getUsedScaleValue(s.x)}e+=(i-1)*this._spacingX+this._getPaddingH()}else e=this.node._getUITransformComp().width;return e},i._getVerticalBaseHeight=function(){var t=this._usefulLayoutObj,e=0,i=t.length;if(1===this._resizeMode){for(var n=0;n<t.length;++n){var r=t[n],s=r.node.scale;e+=r.height*this._getUsedScaleValue(s.y)}e+=(i-1)*this._spacingY+this._getPaddingV()}else e=this.node._getUITransformComp().height;return e},i._doLayout=function(){var t=this;if(this._init&&!this._childrenDirty||(this._checkUsefulObj(),this._init=!0,this._childrenDirty=!1),1===this._layoutType){var e=this._getHorizontalBaseWidth();this._doLayoutHorizontally(e,!1,(function(e){return(t._isAlign?ir.ZERO:e.position).y}),!0),this.node._getUITransformComp().width=e}else if(2===this._layoutType){var i=this._getVerticalBaseHeight();this._doLayoutVertically(i,!1,(function(e){return(t._isAlign?ir.ZERO:e.position).x}),!0),this.node._getUITransformComp().height=i}else 3===this._layoutType&&this._doLayoutGrid()},i._getUsedScaleValue=function(t){return this._affectedByScale?Math.abs(t):1},i._transformDirty=function(t){4&t&&1&t&&this._affectedByScale&&this._doLayoutDirty()},i._doLayoutDirty=function(){this._layoutDirty=!0},i._childrenChanged=function(){this._childrenDirty=!0,this._doLayoutDirty()},i._getPaddingH=function(){return this._paddingLeft+this._paddingRight},i._getPaddingV=function(){return this._paddingTop+this._paddingBottom},i._getFixedBreakingNum=function(){if(3!==this._layoutType||0===this._constraint||this._constraintNum<=0)return 0;var t=1===this._constraint?Math.ceil(this._usefulLayoutObj.length/this._constraintNum):this._constraintNum;return 1===this._startAxis&&(t=2===this._constraint?Math.ceil(this._usefulLayoutObj.length/this._constraintNum):this._constraintNum),t},n(e,[{key:"alignHorizontal",get:function(){return this._isAlign},set:function(t){1===this._layoutType&&(this._isAlign=t,this._doLayoutDirty())}},{key:"alignVertical",get:function(){return this._isAlign},set:function(t){2===this._layoutType&&(this._isAlign=t,this._doLayoutDirty())}},{key:"type",get:function(){return this._layoutType},set:function(t){this._layoutType=t,this._doLayoutDirty()}},{key:"resizeMode",get:function(){return this._resizeMode},set:function(t){0!==this._layoutType&&(this._resizeMode=t,this._doLayoutDirty())}},{key:"cellSize",get:function(){return this._cellSize},set:function(t){this._cellSize!==t&&(this._cellSize.set(t),this._doLayoutDirty())}},{key:"startAxis",get:function(){return this._startAxis},set:function(t){this._startAxis!==t&&(this._startAxis=t,this._doLayoutDirty())}},{key:"paddingLeft",get:function(){return this._paddingLeft},set:function(t){this._paddingLeft!==t&&(this._paddingLeft=t,this._doLayoutDirty())}},{key:"paddingRight",get:function(){return this._paddingRight},set:function(t){this._paddingRight!==t&&(this._paddingRight=t,this._doLayoutDirty())}},{key:"paddingTop",get:function(){return this._paddingTop},set:function(t){this._paddingTop!==t&&(this._paddingTop=t,this._doLayoutDirty())}},{key:"paddingBottom",get:function(){return this._paddingBottom},set:function(t){this._paddingBottom!==t&&(this._paddingBottom=t,this._doLayoutDirty())}},{key:"spacingX",get:function(){return this._spacingX},set:function(t){this._spacingX!==t&&(this._spacingX=t,this._doLayoutDirty())}},{key:"spacingY",get:function(){return this._spacingY},set:function(t){this._spacingY!==t&&(this._spacingY=t,this._doLayoutDirty())}},{key:"verticalDirection",get:function(){return this._verticalDirection},set:function(t){this._verticalDirection!==t&&(this._verticalDirection=t,this._doLayoutDirty())}},{key:"horizontalDirection",get:function(){return this._horizontalDirection},set:function(t){this._horizontalDirection!==t&&(this._horizontalDirection=t,this._doLayoutDirty())}},{key:"padding",get:function(){return this._paddingLeft},set:function(t){this.paddingLeft===t&&this._paddingRight===t&&this._paddingTop===t&&this._paddingBottom===t||(this._paddingLeft=this._paddingRight=this._paddingTop=this._paddingBottom=t,this._doLayoutDirty())}},{key:"constraint",get:function(){return this._constraint},set:function(t){0!==this._layoutType&&this._constraint!==t&&(this._constraint=t,this._doLayoutDirty())}},{key:"constraintNum",get:function(){return this._constraintNum},set:function(t){0!==this._constraint&&this._constraintNum!==t&&(t<=0&&at(16400),this._constraintNum=t,this._doLayoutDirty())}},{key:"affectedByScale",get:function(){return this._affectedByScale},set:function(t){this._affectedByScale=t,this._doLayoutDirty()}}]),e}(yg),THt.Type=CHt,THt.VerticalDirection=IHt,THt.HorizontalDirection=MHt,THt.ResizeMode=DHt,THt.AxisDirection=BHt,THt.Constraint=PHt,v((oHt=THt).prototype,"type",[tHt],Object.getOwnPropertyDescriptor(oHt.prototype,"type"),oHt.prototype),v(oHt.prototype,"resizeMode",[eHt],Object.getOwnPropertyDescriptor(oHt.prototype,"resizeMode"),oHt.prototype),v(oHt.prototype,"startAxis",[iHt],Object.getOwnPropertyDescriptor(oHt.prototype,"startAxis"),oHt.prototype),v(oHt.prototype,"verticalDirection",[nHt],Object.getOwnPropertyDescriptor(oHt.prototype,"verticalDirection"),oHt.prototype),v(oHt.prototype,"horizontalDirection",[rHt],Object.getOwnPropertyDescriptor(oHt.prototype,"horizontalDirection"),oHt.prototype),v(oHt.prototype,"constraint",[sHt],Object.getOwnPropertyDescriptor(oHt.prototype,"constraint"),oHt.prototype),hHt=zh(oHt.prototype,"_resizeMode",[uu],(function(){return 0})),uHt=zh(oHt.prototype,"_layoutType",[uu],(function(){return 0})),lHt=zh(oHt.prototype,"_cellSize",[uu],(function(){return new ms(40,40)})),cHt=zh(oHt.prototype,"_startAxis",[uu],(function(){return 0})),fHt=zh(oHt.prototype,"_paddingLeft",[uu],(function(){return 0})),_Ht=zh(oHt.prototype,"_paddingRight",[uu],(function(){return 0})),dHt=zh(oHt.prototype,"_paddingTop",[uu],(function(){return 0})),pHt=zh(oHt.prototype,"_paddingBottom",[uu],(function(){return 0})),mHt=zh(oHt.prototype,"_spacingX",[uu],(function(){return 0})),gHt=zh(oHt.prototype,"_spacingY",[uu],(function(){return 0})),yHt=zh(oHt.prototype,"_verticalDirection",[uu],(function(){return 1})),vHt=zh(oHt.prototype,"_horizontalDirection",[uu],(function(){return 0})),bHt=zh(oHt.prototype,"_constraint",[uu],(function(){return 0})),SHt=zh(oHt.prototype,"_constraintNum",[uu],(function(){return 2})),wHt=zh(oHt.prototype,"_affectedByScale",[uu],(function(){return!1})),xHt=zh(oHt.prototype,"_isAlign",[uu],(function(){return!1})),aHt=oHt))||aHt)||aHt)||aHt));C.Layout=qHt;var XHt={HORIZONTAL:0,VERTICAL:1,FILLED:2};Ee(XHt);var YHt,JHt,KHt,QHt,ZHt,$Ht,tWt,eWt,iWt,nWt,rWt,sWt,aWt,oWt=t("gV",(EHt=Kh("cc.ProgressBar"),OHt=Zh(110),kHt=Qh(lL),RHt=Ou(GV),FHt=Ou(XHt),EHt(LHt=OHt(LHt=kHt((WHt=function(t){function e(){var e;return(e=t.call(this)||this)._barSprite=NHt&&NHt(),e._mode=zHt&&zHt(),e._totalLength=UHt&&UHt(),e._progress=GHt&&GHt(),e._reverse=HHt&&HHt(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._updateBarStatus()},i._initBarSprite=function(){if(this._barSprite){var t=this._barSprite.node;if(!t)return;var e=this.node._getUITransformComp(),i=e.contentSize,n=e.anchorPoint,r=t._getUITransformComp().contentSize;if(2===this._barSprite.fillType&&(this._mode=2),0===this._mode?this.totalLength=r.width:1===this._mode?this.totalLength=r.height:this.totalLength=this._barSprite.fillRange,t.parent===this.node){var s=-i.width*n.x;t.setPosition(s,0,0)}}},i._updateBarStatus=function(){if(this._barSprite){var t=this._barSprite.node;if(!t)return;var e=t._getUITransformComp(),i=e.anchorPoint,n=e.contentSize,r=new ds(0,.5),s=tn(this._progress),a=this._totalLength*s,o=n,h=0,u=0;switch(this._mode){case 0:this._reverse&&(r=new ds(1,.5)),o=new ms(a,n.height),h=this._totalLength,u=n.height;break;case 1:r=this._reverse?new ds(.5,1):new ds(.5,0),o=new ms(n.width,a),h=n.width,u=this._totalLength}if(2===this._mode)this._barSprite.type!==GV.Type.FILLED?at(16397):(this._reverse&&(a*=-1),this._barSprite.fillRange=a);else if(this._barSprite.type!==GV.Type.FILLED){var l=r.x-i.x,c=r.y-i.y,f=new ir(t.position);f.add3f(h*l,u*c,0),t.setPosition(f),e.setAnchorPoint(r),e.setContentSize(o)}else at(16398)}},n(e,[{key:"barSprite",get:function(){return this._barSprite},set:function(t){this._barSprite!==t&&(this._barSprite=t,this._initBarSprite())}},{key:"mode",get:function(){return this._mode},set:function(t){if(this._mode!==t&&(this._mode=t,this._barSprite)){var e=this._barSprite.node;if(!e)return;var i=e._getUITransformComp().contentSize;0===this._mode?this.totalLength=i.width:1===this._mode?this.totalLength=i.height:2===this._mode&&(this.totalLength=this._barSprite.fillRange)}}},{key:"totalLength",get:function(){return this._totalLength},set:function(t){2===this._mode&&(t=tn(t)),this._totalLength!==t&&(this._totalLength=t,this._updateBarStatus())}},{key:"progress",get:function(){return this._progress},set:function(t){this._progress!==t&&(this._progress=t,this._updateBarStatus())}},{key:"reverse",get:function(){return this._reverse},set:function(t){this._reverse!==t&&(this._reverse=t,this._barSprite&&(this._barSprite.fillStart=1-this._barSprite.fillStart),this._updateBarStatus())}}]),e}(yg),WHt.Mode=XHt,v((VHt=WHt).prototype,"barSprite",[RHt],Object.getOwnPropertyDescriptor(VHt.prototype,"barSprite"),VHt.prototype),v(VHt.prototype,"mode",[FHt],Object.getOwnPropertyDescriptor(VHt.prototype,"mode"),VHt.prototype),NHt=zh(VHt.prototype,"_barSprite",[uu],(function(){return null})),zHt=zh(VHt.prototype,"_mode",[uu],(function(){return 0})),UHt=zh(VHt.prototype,"_totalLength",[uu],(function(){return 1})),GHt=zh(VHt.prototype,"_progress",[uu],(function(){return.1})),HHt=zh(VHt.prototype,"_reverse",[uu],(function(){return!1})),LHt=VHt))||LHt)||LHt)||LHt));C.ProgressBar=oWt;var hWt=new ir,uWt=new ir,lWt=new ir,cWt=new ds,fWt=new cr,_Wt=new ds,dWt={HORIZONTAL:0,VERTICAL:1};Re(dWt);var pWt,mWt=t("gW",(YHt=Kh("cc.ScrollBar"),JHt=Zh(110),KHt=Qh(lL),QHt=Ou(GV),ZHt=Ou(dWt),YHt($Ht=JHt($Ht=KHt((aWt=function(t){function e(){var e;return(e=t.call(this)||this)._scrollView=eWt&&eWt(),e._handle=iWt&&iWt(),e._direction=nWt&&nWt(),e._enableAutoHide=rWt&&rWt(),e._autoHideTime=sWt&&sWt(),e._touching=!1,e._opacity=255,e._autoHideRemainingTime=0,e}s(e,t);var i=e.prototype;return i.hide=function(){this._autoHideRemainingTime=0,this._setOpacity(0)},i.show=function(){this._autoHideRemainingTime=this._autoHideTime,this._opacity=255,this._setOpacity(this._opacity)},i.onScroll=function(t){if(this._scrollView){var e=this._scrollView.content;if(e){var i=e._getUITransformComp().contentSize,n=this._scrollView.node._getUITransformComp().contentSize,r=this.node._getUITransformComp().contentSize;if(!this._conditionalDisableScrollBar(i,n)){this._enableAutoHide&&(this._autoHideRemainingTime=this._autoHideTime,this._setOpacity(this._opacity));var s=0,a=0,o=0,h=0,u=0,l=_Wt;l.set(0,0),0===this._direction?(s=i.width,a=n.width,u=r.width,o=t.x,this._convertToScrollViewSpace(l,e),h=-l.x):1===this._direction&&(s=i.height,a=n.height,u=r.height,o=t.y,this._convertToScrollViewSpace(l,e),h=-l.y);var c=this._calculateLength(s,a,u,o),f=_Wt;this._calculatePosition(f,s,a,u,h,o,c),this._updateLength(c),this._updateHandlerPosition(f)}}}},i.setScrollView=function(t){this._scrollView=t},i.onTouchBegan=function(){this._enableAutoHide&&(this._touching=!0)},i.onTouchEnded=function(){if(this._enableAutoHide&&(this._touching=!1,!(this._autoHideTime<=0))){if(this._scrollView){var t=this._scrollView.content;if(t){var e=t._getUITransformComp().contentSize,i=this._scrollView.node._getUITransformComp().contentSize;if(this._conditionalDisableScrollBar(e,i))return}}this._autoHideRemainingTime=this._autoHideTime}},i.onEnable=function(){var t=this.node.getComponent(GV);t&&(this._opacity=t.color.a)},i.start=function(){this._enableAutoHide&&this._setOpacity(0)},i.update=function(t){this._processAutoHide(t)},i._convertToScrollViewSpace=function(t,e){var i=this._scrollView&&this._scrollView.node._getUITransformComp(),n=e._getUITransformComp();if(i&&n){hWt.set(-n.anchorX*n.width,-n.anchorY*n.height,0),n.convertToWorldSpaceAR(hWt,uWt);var r=i.convertToNodeSpaceAR(uWt);r.x+=i.anchorX*i.width,r.y+=i.anchorY*i.height,t.set(r.x,r.y)}else t.set(ds.ZERO)},i._setOpacity=function(t){if(this._handle){var e=this.node.getComponent(GV);e&&(fWt.set(e.color),fWt.a=t,e.color=fWt),(e=this._handle.getComponent(GV))&&(fWt.set(e.color),fWt.a=t,e.color=fWt)}},i._updateHandlerPosition=function(t){if(this._handle){var e=lWt;this._fixupHandlerPosition(e),this._handle.node.setPosition(t.x+e.x,t.y+e.y,e.z)}},i._fixupHandlerPosition=function(t){var e=this.node._getUITransformComp(),i=e.contentSize,n=e.anchorPoint,r=this.handle.node._getUITransformComp().contentSize,s=this.handle.node.parent;ir.set(hWt,-i.width*n.x,-i.height*n.y,0);var a=this.node._getUITransformComp().convertToWorldSpaceAR(hWt,uWt),o=t;o.set(0,0,0),s._getUITransformComp().convertToNodeSpaceAR(a,o),0===this.direction?o.set(o.x,o.y+(i.height-r.height)/2,o.z):1===this.direction&&o.set(o.x+(i.width-r.width)/2,o.y,o.z),this.handle.node.setPosition(o)},i._conditionalDisableScrollBar=function(t,e){return t.width<=e.width&&0===this._direction||t.height<=e.height&&1===this._direction},i._calculateLength=function(t,e,i,n){var r=t;return n&&(r+=20*(n>0?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===cWt.x&&n.y===cWt.y||e.setAnchorPoint(cWt),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}(yg),aWt.Direction=dWt,v((tWt=aWt).prototype,"handle",[QHt],Object.getOwnPropertyDescriptor(tWt.prototype,"handle"),tWt.prototype),v(tWt.prototype,"direction",[ZHt],Object.getOwnPropertyDescriptor(tWt.prototype,"direction"),tWt.prototype),eWt=zh(tWt.prototype,"_scrollView",[uu],(function(){return null})),iWt=zh(tWt.prototype,"_handle",[uu],(function(){return null})),nWt=zh(tWt.prototype,"_direction",[uu],(function(){return 0})),rWt=zh(tWt.prototype,"_enableAutoHide",[uu],(function(){return!1})),sWt=zh(tWt.prototype,"_autoHideTime",[uu],(function(){return 1})),$Ht=tWt))||$Ht)||$Ht)||$Ht));C.ScrollBar=mWt;var gWt,yWt,vWt,bWt,SWt,wWt,xWt,TWt,AWt,CWt,DWt,BWt,IWt,MWt,PWt,EWt,OWt,kWt,RWt,FWt,LWt,VWt=t("g$",Kh("cc.ViewGroup")(pWt=Zh(110)(pWt=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(yg))||pWt)||pWt);C.ViewGroup=VWt;var NWt,zWt,UWt,GWt,HWt,WWt,jWt,qWt,XWt,YWt,JWt,KWt,QWt,ZWt=1e-4,$Wt=nr(),tjt=nr(),ejt=ps(),ijt=ps(),njt=function(){return(new Date).getMilliseconds()},rjt={"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},sjt={anchor:ps(),applyToHorizontal:!1,applyToVertical:!1},ajt=function(t,e,i,n){sjt.anchor.set(t,e),sjt.applyToHorizontal=i,sjt.applyToVertical=n},ojt={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"},hjt=t("gX",(gWt=Kh("cc.ScrollView"),yWt=Zh(110),vWt=Qh(lL),bWt=Ou(eb),SWt=Ou(mWt),wWt=Ou(mWt),xWt=Ou([mg]),gWt(TWt=yWt(TWt=vWt((LWt=function(t){function e(){var e;return(e=t.call(this)||this).bounceDuration=CWt&&CWt(),e.brake=DWt&&DWt(),e.elastic=BWt&&BWt(),e.inertia=IWt&&IWt(),e.horizontal=MWt&&MWt(),e.vertical=PWt&&PWt(),e.cancelInnerEvents=EWt&&EWt(),e.scrollEvents=OWt&&OWt(),e._autoScrolling=!1,e._scrolling=!1,e._content=kWt&&kWt(),e._horizontalScrollBar=RWt&&RWt(),e._verticalScrollBar=FWt&&FWt(),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=ps();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),ajt(t,e,i,n);var a=this._calculateMovePercentDelta(sjt);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)<ZWt&&Math.abs(t.y-e.y)<ZWt||(this._content.setPosition(t),this._outOfBoundaryAmountDirty=!0)}},i.getContentPosition=function(){return this._getContentPosition()},i._getContentPosition=function(){return this._content?(this._contentPos.set(this._content.position),this._contentPos):ir.ZERO.clone()},i.isScrolling=function(){return this._scrolling},i.isAutoScrolling=function(){return this._autoScrolling},i.getScrollEndedEventTiming=function(){return ZWt},i.start=function(){this._calculateBoundary(),this._content&&YE.once("director_before_draw",this._adjustContentOutOfBoundary,this)},i.onEnable=function(){var t=this;t._registerEvent();var e=this._content;if(e){e.on("size-changed",t._calculateBoundary,t),e.on("transform-changed",t._scaleChanged,t);var i=t.view;i&&(i.node.on("transform-changed",t._scaleChanged,t),i.node.on("size-changed",t._calculateBoundary,t))}t._calculateBoundary(),t._updateScrollBarState()},i.update=function(t){var e=this._deltaAmount;this._autoScrolling?(this._processAutoScrolling(t),e.x=0,e.y=0):0===e.x&&0===e.y||(this._processDeltaMove(e),e.x=0,e.y=0)},i.onDisable=function(){var t=this;t._unregisterEvent();var e=t.content;if(e){e.off("size-changed",t._calculateBoundary,t),e.off("transform-changed",t._scaleChanged,t);var i=t.view;i&&(i.node.off("transform-changed",t._scaleChanged,t),i.node.off("size-changed",t._calculateBoundary,t))}t._deltaAmount.set(0,0),t._hideScrollBar(),t.stopAutoScroll()},i._registerEvent=function(){var t=this,e=t.node;e.on("touch-start",t._onTouchBegan,t,!0),e.on("touch-move",t._onTouchMoved,t,!0),e.on("touch-end",t._onTouchEnded,t,!0),e.on("touch-cancel",t._onTouchCancelled,t,!0),e.on("mouse-wheel",t._onMouseWheel,t,!0),wM.on("handle-input",t._dispatchEventHandleInput,t),wM.on("gamepad-input",t._dispatchEventHandleInput,t)},i._unregisterEvent=function(){var t=this,e=t.node;e.off("touch-start",t._onTouchBegan,t,!0),e.off("touch-move",t._onTouchMoved,t,!0),e.off("touch-end",t._onTouchEnded,t,!0),e.off("touch-cancel",t._onTouchCancelled,t,!0),e.off("mouse-wheel",t._onMouseWheel,t,!0),wM.off("handle-input",t._dispatchEventHandleInput,t),wM.off("gamepad-input",t._dispatchEventHandleInput,t)},i._onMouseWheel=function(t,e){var i=this;if(i.enabledInHierarchy&&!i._hasNestedViewGroup(t,e)){var n=t.getScrollY(),r=$Wt;i.vertical?r.set(0,-.1*n,0):i.horizontal&&r.set(-.1*n,0,0),i._mouseWheelEventElapsedTime=0,i._deltaAmount.add(r),i._stopMouseWheel||(i._handlePressLogic(),i.schedule(this._checkMouseWheel,1/60),i._stopMouseWheel=!0),i._stopPropagationIfTargetIsMe(t)}},i._onTouchBegan=function(t,e){var i=this;i.enabledInHierarchy&&i._content&&(i._hasNestedViewGroup(t,e)||(i._handlePressLogic(),i._touchMoved=!1,i._stopPropagationIfTargetIsMe(t)))},i._onTouchMoved=function(t,e){var i=this;if(i.enabledInHierarchy&&i._content&&!i._hasNestedViewGroup(t,e)){var n=t.touch;if(i._handleMoveLogic(n),i.cancelInnerEvents){var r=n.getUILocation(ejt);if(r.subtract(n.getUIStartLocation(ijt)),r.length()>7&&!i._touchMoved&&t.target!==i.node){var s=new Yy(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(qHt);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!==Hy.CAPTURING_PHASE)return!1;if(e)for(var i=0;i<e.length;i++){var n=e[i];if(this.node===n)return!(!t.target||!t.target.getComponent(VWt));if(n.getComponent(VWt))return!0}return!1},i._startInertiaScroll=function(t){$Wt.set(t),$Wt.multiplyScalar(.7),this._startAttenuatingAutoScroll($Wt,t)},i._calculateAttenuatedFactor=function(t){return this.brake<=0?1-this.brake:(1-this.brake)*(1/(1+14e-6*t+t*t*8e-9))},i._startAttenuatingAutoScroll=function(t,e){var i=t.clone();if(i.normalize(),this._content&&this.view){var n=this._content._getUITransformComp().contentSize,r=this.view.contentSize,s=n.width-r.width,a=n.height-r.height,o=this._calculateAttenuatedFactor(s),h=this._calculateAttenuatedFactor(a);i.x=i.x*s*(1-this.brake)*o,i.y=i.y*a*h*(1-this.brake),i.z=0}var u=t.length(),l=i.length()/u;this.brake>0&&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,ZWt)||(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=$Wt;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);$Wt.set(this._getContentPosition()),$Wt.add(i),$Wt.set(Math.round(1e4*$Wt.x)*ZWt,Math.round(1e4*$Wt.y)*ZWt,$Wt.z),this._setContentPosition($Wt);var n=this._getHowMuchOutOfBoundary();ejt.set(n.x,n.y),this._updateScrollBar(ejt),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,ZWt)&&!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.x<this._rightBoundary&&(e.x=this._rightBoundary-(n+t.x));var r=this._getContentTopBoundary(),s=this._getContentBottomBoundary();return r+t.y<this._topBoundary?e.y=this._topBoundary-(r+t.y):s+t.y>this._bottomBoundary&&(e.y=this._bottomBoundary-(s+t.y)),t.equals(ir.ZERO,ZWt)&&(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<<rjt[t];if(this._scrollEventEmitMask&e)return;this._scrollEventEmitMask|=e}mg.emitEvents(this.scrollEvents,this,rjt[t]),this.node.emit(t,this)},i._adjustContentOutOfBoundary=function(){if(this._content){this._outOfBoundaryAmountDirty=!0;var t=this._getHowMuchOutOfBoundary();!t.equals(ir.ZERO,ZWt)&&($Wt.set(this._getContentPosition()),$Wt.add(t),this._setContentPosition($Wt),this._updateScrollBar(ds.ZERO))}},i._hideScrollBar=function(){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.hide(),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.hide()},i._updateScrollBarState=function(){var t=this;if(t._content&&t.view){var e=t.view,i=t._content._getUITransformComp(),n=t._verticalScrollBar;n&&n.isValid&&(i.height<e.height||Zi(i.height,e.height)?n.hide():n.show());var r=t._horizontalScrollBar;r&&r.isValid&&(i.width<e.width||Zi(i.width,e.width)?r.hide():r.show())}},i._stopPropagationIfTargetIsMe=function(t){t.eventPhase===Hy.AT_TARGET&&t.target===this.node&&(t.propagationStopped=!0)},i._processDeltaMove=function(t){this._scrollChildren(t),this._gatherTouchMove(t)},i._handleMoveLogic=function(t){this._getLocalAxisAlignDelta(this._deltaPos,t),this._deltaAmount.add(this._deltaPos)},i._handleReleaseLogic=function(t){var e=this;e._getLocalAxisAlignDelta(e._deltaPos,t),e._gatherTouchMove(e._deltaPos),e._processInertiaScroll(),e._scrolling&&(e._scrolling=!1,e._autoScrolling||e._dispatchEvent("scroll-ended"))},i._getLocalAxisAlignDelta=function(t,e){var i=this.node._getUITransformComp();i&&(e.getUILocation(ejt),e.getUIPreviousLocation(ijt),$Wt.set(ejt.x,ejt.y,0),tjt.set(ijt.x,ijt.y,0),i.convertToNodeSpaceAR($Wt,$Wt),i.convertToNodeSpaceAR(tjt,tjt),ir.subtract(t,$Wt,tjt))},i._scrollChildren=function(t){var e=this;e._clampDelta(t);var i,n=t;e.elastic&&(i=e._getHowMuchOutOfBoundary(),n.x*=0===i.x?1:.5,n.y*=0===i.y?1:.5),e.elastic||(i=e._getHowMuchOutOfBoundary(n),n.add(i));var r="",s="";if(e._content){var a=e._content._getUITransformComp(),o=a.anchorX,h=a.anchorY,u=a.width,l=a.height,c=e._content.position||ir.ZERO;e.vertical&&(n.y>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=njt(),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<e.width&&(t.x=0),i.height<e.height&&(t.y=0)}},i._gatherTouchMove=function(t){var e=this,i=t.clone();for(e._clampDelta(i);e._touchMoveDisplacements.length>=5;)e._touchMoveDisplacements.shift(),e._touchMoveTimeDeltas.shift();e._touchMoveDisplacements.push(i);var n=njt();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,ZWt))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,ZWt)&&this.brake<1&&this._startInertiaScroll(t)}this._onScrollBarTouchEnded()},i._isOutOfBoundary=function(){return!this._getHowMuchOutOfBoundary().equals(ir.ZERO,ZWt)},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)<=ZWt;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,ZWt)||(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,ZWt))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.height<t.height&&(r=a.height-t.height,n.y=i-r),a.width<t.width&&(r=a.width-t.width,n.x=s)}e._updateScrollBarState(),e._moveContent(n),e._adjustContentOutOfBoundary()},i._scaleChanged=function(t){4===t&&this._calculateBoundary()},i._xrHoverEnter=function(){},i._xrHoverExit=function(){},i._dispatchEventHandleInput=function(t){t instanceof Jy?t.gamepad:t instanceof Ky&&t.handleInputDevice,this.enabledInHierarchy},i._xrThumbStickMove=function(t){var e=this;if(e.enabledInHierarchy){var i=t.y,n=$Wt;e.vertical?n.set(0,-62.5*i,0):e.horizontal&&n.set(-62.5*i,0,0),e._mouseWheelEventElapsedTime=0,e._deltaAmount.add(n),e._stopMouseWheel||(e._handlePressLogic(),e.schedule(e._checkMouseWheel,1/60,NaN,0),e._stopMouseWheel=!0)}},n(e,[{key:"content",get:function(){return this._content},set:function(t){if(this._content!==t){var e=t&&t.parent&&t.parent._getUITransformComp();!t||t&&e?(this._content=t,this._calculateBoundary()):it(4302)}}},{key:"horizontalScrollBar",get:function(){var t=this._horizontalScrollBar;return t&&!t.isValid&&ht(4303,"horizontal",this.node.name),t},set:function(t){this._horizontalScrollBar!==t&&(this._horizontalScrollBar=t,this._horizontalScrollBar&&(this._horizontalScrollBar.setScrollView(this),this._updateScrollBar(ds.ZERO)))}},{key:"verticalScrollBar",get:function(){var t=this._verticalScrollBar;return t&&!t.isValid&&ht(4303,"vertical",this.node.name),t},set:function(t){this._verticalScrollBar!==t&&(this._verticalScrollBar=t,this._verticalScrollBar&&(this._verticalScrollBar.setScrollView(this),this._updateScrollBar(ds.ZERO)))}},{key:"view",get:function(){var t=this._content&&this._content.parent;return t?t._getUITransformComp():null}}]),e}(VWt),LWt.EventType=ojt,CWt=zh((AWt=LWt).prototype,"bounceDuration",[uu],(function(){return 1})),DWt=zh(AWt.prototype,"brake",[uu],(function(){return.5})),BWt=zh(AWt.prototype,"elastic",[uu],(function(){return!0})),IWt=zh(AWt.prototype,"inertia",[uu],(function(){return!0})),v(AWt.prototype,"content",[bWt],Object.getOwnPropertyDescriptor(AWt.prototype,"content"),AWt.prototype),MWt=zh(AWt.prototype,"horizontal",[uu],(function(){return!0})),v(AWt.prototype,"horizontalScrollBar",[SWt],Object.getOwnPropertyDescriptor(AWt.prototype,"horizontalScrollBar"),AWt.prototype),PWt=zh(AWt.prototype,"vertical",[uu],(function(){return!0})),v(AWt.prototype,"verticalScrollBar",[wWt],Object.getOwnPropertyDescriptor(AWt.prototype,"verticalScrollBar"),AWt.prototype),EWt=zh(AWt.prototype,"cancelInnerEvents",[uu],(function(){return!0})),OWt=zh(AWt.prototype,"scrollEvents",[xWt,uu],(function(){return[]})),kWt=zh(AWt.prototype,"_content",[uu],(function(){return null})),RWt=zh(AWt.prototype,"_horizontalScrollBar",[uu],(function(){return null})),FWt=zh(AWt.prototype,"_verticalScrollBar",[uu],(function(){return null})),TWt=AWt))||TWt)||TWt)||TWt));C.ScrollView=hjt;var ujt=new ir,ljt={Horizontal:0,Vertical:1};Re(ljt);var cjt,fjt,_jt,djt,pjt,mjt,gjt,yjt,vjt,bjt,Sjt,wjt=t("gY",(NWt=Kh("cc.Slider"),zWt=Zh(110),UWt=Qh(lL),GWt=Ou(GV),HWt=Ou(ljt),WWt=Ou([mg]),NWt(jWt=zWt(jWt=UWt((QWt=function(t){function e(){var e;return(e=t.call(this)||this).slideEvents=XWt&&XWt(),e._handle=YWt&&YWt(),e._direction=JWt&&JWt(),e._progress=KWt&&KWt(),e._offset=new ir,e._dragging=!1,e._touchHandle=!1,e._handleLocalPos=new ir,e._touchPos=new ir,e}s(e,t);var i=e.prototype;return i.__preload=function(){this._updateHandlePosition()},i.onEnable=function(){var t=this,e=t.node,i=t._handle;if(t._updateHandlePosition(),e.on("touch-start",t._onTouchBegan,t),e.on("touch-move",t._onTouchMoved,t),e.on("touch-end",t._onTouchEnded,t),e.on("touch-cancel",t._onTouchCancelled,t),i&&i.isValid){var n=i.node;n.on("touch-start",t._onHandleDragStart,t),n.on("touch-move",t._onTouchMoved,t),n.on("touch-end",t._onTouchEnded,t)}},i.onDisable=function(){var t=this,e=t.node,i=t._handle;if(e.off("touch-start",t._onTouchBegan,t),e.off("touch-move",t._onTouchMoved,t),e.off("touch-end",t._onTouchEnded,t),e.off("touch-cancel",t._onTouchCancelled,t),i&&i.isValid){var n=i.node;n.off("touch-start",t._onHandleDragStart,t),n.off("touch-move",t._onTouchMoved,t),n.off("touch-end",t._onTouchEnded,t)}},i._onHandleDragStart=function(t){if(t&&this._handle&&this._handle.node._getUITransformComp()){this._dragging=!0,this._touchHandle=!0;var e=t.touch.getUILocation();ir.set(this._touchPos,e.x,e.y,0),this._handle.node._getUITransformComp().convertToNodeSpaceAR(this._touchPos,this._offset),t.propagationStopped=!0}},i._onTouchBegan=function(t){this._handle&&t&&(this._dragging=!0,this._touchHandle||this._handleSliderLogic(t.touch),t.propagationStopped=!0)},i._onTouchMoved=function(t){this._dragging&&t&&(this._handleSliderLogic(t.touch),t.propagationStopped=!0)},i._onTouchEnded=function(t){this._dragging=!1,this._touchHandle=!1,this._offset=new ir,t&&(t.propagationStopped=!0)},i._onTouchCancelled=function(t){this._dragging=!1,t&&(t.propagationStopped=!0)},i._handleSliderLogic=function(t){this._updateProgress(t),this._emitSlideEvent()},i._emitSlideEvent=function(){mg.emitEvents(this.slideEvents,this),this.node.emit("slide",this)},i._updateProgress=function(t){if(this._handle&&t){var e=t.getUILocation();ir.set(this._touchPos,e.x,e.y,0);var i=this.node._getUITransformComp(),n=i.convertToNodeSpaceAR(this._touchPos,ujt);0===this.direction?this.progress=tn(.5+(n.x-this._offset.x)/i.width):this.progress=tn(.5+(n.y-this._offset.y)/i.height)}},i._updateHandlePosition=function(){if(this._handle){this._handleLocalPos.set(this._handle.node.position);var t=this.node._getUITransformComp();0===this._direction?this._handleLocalPos.x=-t.width*t.anchorX+this.progress*t.width:this._handleLocalPos.y=-t.height*t.anchorY+this.progress*t.height,this._handle.node.setPosition(this._handleLocalPos)}},i._changeLayout=function(){var t=this.node._getUITransformComp(),e=t.contentSize;if(t.setContentSize(e.height,e.width),this._handle){var i=this._handle.node.position;0===this._direction?this._handle.node.setPosition(i.x,0,i.z):this._handle.node.setPosition(0,i.y,i.z),this._updateHandlePosition()}},i._xrHandleProgress=function(){},i._xrClick=function(){},i._xrUnClick=function(){},i._xrHoverStay=function(){},n(e,[{key:"handle",get:function(){return this._handle},set:function(t){this._handle!==t&&(this._handle=t)}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this._changeLayout())}},{key:"progress",get:function(){return this._progress},set:function(t){this._progress!==t&&(this._progress=t,this._updateHandlePosition())}}]),e}(yg),QWt.Direction=ljt,v((qWt=QWt).prototype,"handle",[GWt],Object.getOwnPropertyDescriptor(qWt.prototype,"handle"),qWt.prototype),v(qWt.prototype,"direction",[HWt],Object.getOwnPropertyDescriptor(qWt.prototype,"direction"),qWt.prototype),XWt=zh(qWt.prototype,"slideEvents",[WWt,uu],(function(){return[]})),YWt=zh(qWt.prototype,"_handle",[uu],(function(){return null})),JWt=zh(qWt.prototype,"_direction",[uu],(function(){return 0})),KWt=zh(qWt.prototype,"_progress",[uu],(function(){return.1})),jWt=qWt))||jWt)||jWt)||jWt));function xjt(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return Object.assign.apply(Object,[{}].concat(e))}C.Slider=wjt;var Tjt,Ajt,Cjt,Djt,Bjt,Ijt,Mjt,Pjt=t("gZ",(cjt=Kh("cc.Toggle"),fjt=Zh(110),_jt=Qh(lL),djt=Ou(GV),pjt=Ou([mg]),cjt(mjt=fjt(mjt=_jt((Sjt=function(t){function e(){var e;return(e=t.call(this)||this).checkEvents=yjt&&yjt(),e._isChecked=vjt&&vjt(),e._checkMark=bjt&&bjt(),e}s(e,t);var i=e.prototype;return i._internalToggle=function(){this.isChecked=!this.isChecked},i._set=function(t,e){if(void 0===e&&(e=!0),this._isChecked!=t){this._isChecked=t;var i=this._toggleContainer;i&&i.enabled&&this.enabled&&(t||!i.anyTogglesChecked()&&!i.allowSwitchOff)&&(this._isChecked=!0,i.notifyToggleCheck(this,e)),this.playEffect(),e&&this._emitToggleEvents()}},i.playEffect=function(){this._checkMark&&(this._checkMark.node.active=this._isChecked)},i.setIsCheckedWithoutNotify=function(t){this._set(t,!1)},i.onEnable=function(){t.prototype.onEnable.call(this),this.playEffect(),this.node.on(e.EventType.CLICK,this._internalToggle,this)},i.onDisable=function(){t.prototype.onDisable.call(this),this.node.off(e.EventType.CLICK,this._internalToggle,this)},i._emitToggleEvents=function(){this.node.emit(e.EventType.TOGGLE,this),this.checkEvents&&mg.emitEvents(this.checkEvents,this)},n(e,[{key:"isChecked",get:function(){return this._isChecked},set:function(t){this._set(t)}},{key:"checkMark",get:function(){return this._checkMark},set:function(t){this._checkMark!==t&&(this._checkMark=t)}},{key:"_resizeToTarget",set:function(t){t&&this._resizeNodeToTargetNode()}},{key:"_toggleContainer",get:function(){var t=this.node.parent;return C.Node.isNode(t)?t.getComponent("cc.ToggleContainer"):null}}]),e}(uGt),Sjt.EventType=xjt({TOGGLE:"toggle"},hGt),v((gjt=Sjt).prototype,"checkMark",[djt],Object.getOwnPropertyDescriptor(gjt.prototype,"checkMark"),gjt.prototype),yjt=zh(gjt.prototype,"checkEvents",[pjt,uu],(function(){return[]})),vjt=zh(gjt.prototype,"_isChecked",[uu],(function(){return!0})),bjt=zh(gjt.prototype,"_checkMark",[uu],(function(){return null})),mjt=gjt))||mjt)||mjt)||mjt));C.Toggle=Pjt;var Ejt,Ojt,kjt,Rjt,Fjt,Ljt,Vjt,Njt,zjt,Ujt,Gjt,Hjt,Wjt,jjt,qjt,Xjt,Yjt,Jjt,Kjt,Qjt,Zjt,$jt,tqt,eqt,iqt,nqt,rqt=t("g_",(Tjt=Kh("cc.ToggleContainer"),Ajt=Zh(110),Cjt=Ou([mg]),Tjt(Djt=Ajt((Bjt=function(t){function e(){var e;return(e=t.call(this)||this)._allowSwitchOff=Ijt&&Ijt(),e.checkEvents=Mjt&&Mjt(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){this.ensureValidState(),this.node.on("child-added",this.ensureValidState,this),this.node.on("child-removed",this.ensureValidState,this)},i.onDisable=function(){this.node.off("child-added",this.ensureValidState,this),this.node.off("child-removed",this.ensureValidState,this)},i.activeToggles=function(){return this.toggleItems.filter((function(t){return t.isChecked}))},i.anyTogglesChecked=function(){return!!this.toggleItems.find((function(t){return t.isChecked}))},i.notifyToggleCheck=function(t,e){if(void 0===e&&(e=!0),this.enabledInHierarchy){for(var i=0;i<this.toggleItems.length;i++){var n=this.toggleItems[i];n!==t&&(e?n.isChecked=!1:n.setIsCheckedWithoutNotify(!1))}this.checkEvents&&C.Component.EventHandler.emitEvents(this.checkEvents,t)}},i.ensureValidState=function(){var t=this.toggleItems;if(!this._allowSwitchOff&&!this.anyTogglesChecked()&&0!==t.length){var e=t[0];e.isChecked=!0,this.notifyToggleCheck(e)}var i=this.activeToggles();if(i.length>1)for(var n=i[0],r=0;r<i.length;++r){var s=i[r];s!==n&&(s.isChecked=!1)}},n(e,[{key:"allowSwitchOff",get:function(){return this._allowSwitchOff},set:function(t){this._allowSwitchOff=t}},{key:"toggleItems",get:function(){return this.node.children.map((function(t){var e=t.getComponent("cc.Toggle");return e&&e.enabled?e:null})).filter(Boolean)}}]),e}(yg),Ijt=zh(Bjt.prototype,"_allowSwitchOff",[uu],(function(){return!1})),Mjt=zh(Bjt.prototype,"checkEvents",[Cjt,uu],(function(){return[]})),Djt=Bjt))||Djt)||Djt));C.ToggleContainer=rqt;var sqt=new ds;function aqt(t){var e=t._getUITransformComp();return t instanceof RI?uh:e?e.contentSize:ms.ZERO}function oqt(t,e,i,n){t.parent?sqt.set(t.parent.scale.x,t.parent.scale.y):sqt.set(0,0);for(var r=sqt.x,s=sqt.y,a=0,o=0,h=t.parent;;){if(!h)return i.x=i.y=0,void(n.x=n.y=1);var u=h.position;if(a+=u.x,o+=u.y,(h=h.parent)===e)break;h?sqt.set(h.scale.x,h.scale.y):sqt.set(0,0);var l=sqt.x,c=sqt.y;a*=l,o*=c,r*=l,s*=c}n.x=0!==r?1/r:1,n.y=0!==s?1/s:1,i.x=-a,i.y=-o}var hqt={ONCE:0,ALWAYS:1,ON_WINDOW_RESIZE:2};Re(hqt);var uqt,lqt,cqt,fqt,_qt,dqt,pqt,mqt,gqt,yqt,vqt,bqt,Sqt={TOP:1,MID:2,BOT:4,LEFT:8,CENTER:16,RIGHT:32,HORIZONTAL:56,VERTICAL:7},wqt=t("h0",(Ejt=Kh("cc.Widget"),Ojt=Zh(110),kjt=Qh(lL),Rjt=Ou(eb),Fjt=Ou(hqt),Ejt(Ljt=Ojt(Ljt=kjt((nqt=function(t){function e(){var e;return(e=t.call(this)||this)._lastPos=new ir,e._lastSize=new ms,e._dirty=!0,e._hadAlignOnce=!1,e._alignFlags=Njt&&Njt(),e._target=zjt&&zjt(),e._left=Ujt&&Ujt(),e._right=Gjt&&Gjt(),e._top=Hjt&&Hjt(),e._bottom=Wjt&&Wjt(),e._horizontalCenter=jjt&&jjt(),e._verticalCenter=qjt&&qjt(),e._isAbsLeft=Xjt&&Xjt(),e._isAbsRight=Yjt&&Yjt(),e._isAbsTop=Jjt&&Jjt(),e._isAbsBottom=Kjt&&Kjt(),e._isAbsHorizontalCenter=Qjt&&Qjt(),e._isAbsVerticalCenter=Zjt&&Zjt(),e._originalWidth=$jt&&$jt(),e._originalHeight=tqt&&tqt(),e._alignMode=eqt&&eqt(),e._lockFlags=iqt&&iqt(),e}s(e,t);var i=e.prototype;return i.updateAlignment=function(){A._widgetManager.updateAlignment(this.node)},i._validateTargetInDEV=function(){},i.setDirty=function(){this._recursiveDirty()},i.onEnable=function(){this.node.getPosition(this._lastPos),this._lastSize.set(this.node._getUITransformComp().contentSize),A._widgetManager.add(this),this._hadAlignOnce=!1,this._registerEvent(),this._registerTargetEvents()},i.onDisable=function(){A._widgetManager.remove(this),this._unregisterEvent(),this._unregisterTargetEvents()},i.onDestroy=function(){this._removeParentEvent()},i._adjustWidgetToAllowMovingInEditor=function(){},i._adjustWidgetToAllowResizingInEditor=function(){},i._adjustWidgetToAnchorChanged=function(){this.setDirty()},i._adjustTargetToParentChanged=function(t){t&&this._unregisterOldParentEvents(t),this.node.getParent()&&this._registerTargetEvents(),this._setDirtyByMode()},i._registerEvent=function(){this.node.on("transform-changed",this._setDirtyByMode,this),this.node.on("size-changed",this._setDirtyByMode,this),this.node.on("anchor-changed",this._adjustWidgetToAnchorChanged,this),this.node.on("parent-changed",this._adjustTargetToParentChanged,this)},i._unregisterEvent=function(){this.node.off("transform-changed",this._setDirtyByMode,this),this.node.off("size-changed",this._setDirtyByMode,this),this.node.off("anchor-changed",this._adjustWidgetToAnchorChanged,this)},i._removeParentEvent=function(){this.node.off("parent-changed",this._adjustTargetToParentChanged,this)},i._autoChangedValue=function(t,e){if((this._alignFlags&t)>0){var i=this.node.parent&&this.node.parent._uiProps,n=i&&i.uiTransformComp,r=n?n.contentSize:uh;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(lL)&&(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}(yg),nqt.AlignMode=hqt,v((Vjt=nqt).prototype,"target",[Rjt],Object.getOwnPropertyDescriptor(Vjt.prototype,"target"),Vjt.prototype),v(Vjt.prototype,"alignMode",[Fjt],Object.getOwnPropertyDescriptor(Vjt.prototype,"alignMode"),Vjt.prototype),Njt=zh(Vjt.prototype,"_alignFlags",[uu],(function(){return 0})),zjt=zh(Vjt.prototype,"_target",[uu],(function(){return null})),Ujt=zh(Vjt.prototype,"_left",[uu],(function(){return 0})),Gjt=zh(Vjt.prototype,"_right",[uu],(function(){return 0})),Hjt=zh(Vjt.prototype,"_top",[uu],(function(){return 0})),Wjt=zh(Vjt.prototype,"_bottom",[uu],(function(){return 0})),jjt=zh(Vjt.prototype,"_horizontalCenter",[uu],(function(){return 0})),qjt=zh(Vjt.prototype,"_verticalCenter",[uu],(function(){return 0})),Xjt=zh(Vjt.prototype,"_isAbsLeft",[uu],(function(){return!0})),Yjt=zh(Vjt.prototype,"_isAbsRight",[uu],(function(){return!0})),Jjt=zh(Vjt.prototype,"_isAbsTop",[uu],(function(){return!0})),Kjt=zh(Vjt.prototype,"_isAbsBottom",[uu],(function(){return!0})),Qjt=zh(Vjt.prototype,"_isAbsHorizontalCenter",[uu],(function(){return!0})),Zjt=zh(Vjt.prototype,"_isAbsVerticalCenter",[uu],(function(){return!0})),$jt=zh(Vjt.prototype,"_originalWidth",[uu],(function(){return 0})),tqt=zh(Vjt.prototype,"_originalHeight",[uu],(function(){return 0})),eqt=zh(Vjt.prototype,"_alignMode",[uu],(function(){return 2})),iqt=zh(Vjt.prototype,"_lockFlags",[uu,cu],(function(){return 0})),Ljt=Vjt))||Ljt)||Ljt)||Ljt));A.internal.computeInverseTransForTarget=oqt,A.internal.getReadonlyNodeSize=aqt,A.Widget=wqt;var xqt=new cr,Tqt={HORIZONTAL:0,VERTICAL:1};Re(Tqt);var Aqt,Cqt,Dqt,Bqt,Iqt,Mqt,Pqt,Eqt,Oqt,kqt,Rqt,Fqt,Lqt,Vqt,Nqt,zqt,Uqt,Gqt,Hqt,Wqt,jqt,qqt,Xqt,Yqt,Jqt=t("h2",(uqt=Kh("cc.PageViewIndicator"),lqt=Zh(110),cqt=Ou(nR),fqt=Ou(Tqt),_qt=Ou(ms),uqt(dqt=lqt((bqt=function(t){function e(){var e;return(e=t.call(this)||this).spacing=mqt&&mqt(),e._spriteFrame=gqt&&gqt(),e._direction=yqt&&yqt(),e._cellSize=vqt&&vqt(),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(qHt),this._layout||(this._layout=this.addComponent(qHt));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 eb;t.layer=this.node.layer;var e=t.addComponent(GV);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;i<t.length;++i){var n=t[i];if(n._uiProps.uiComp){var r=n._uiProps.uiComp;xqt.set(r.color),xqt.a=127.5,r.color=xqt}}if(t[e]._uiProps.uiComp){var s=t[e]._uiProps.uiComp;xqt.set(s.color),xqt.a=255,s.color=xqt}}}},i._refresh=function(){if(this._pageView){var t=this._indicators,e=this._pageView.getPages();if(e.length!==t.length){var i=0;if(e.length>t.length)for(i=0;i<e.length;++i)t[i]||(t[i]=this._createIndicator());else for(i=t.length-e.length;i>0;--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}(yg),bqt.Direction=Tqt,v((pqt=bqt).prototype,"spriteFrame",[cqt],Object.getOwnPropertyDescriptor(pqt.prototype,"spriteFrame"),pqt.prototype),v(pqt.prototype,"direction",[fqt],Object.getOwnPropertyDescriptor(pqt.prototype,"direction"),pqt.prototype),v(pqt.prototype,"cellSize",[_qt],Object.getOwnPropertyDescriptor(pqt.prototype,"cellSize"),pqt.prototype),mqt=zh(pqt.prototype,"spacing",[uu],(function(){return 0})),gqt=zh(pqt.prototype,"_spriteFrame",[uu],(function(){return null})),yqt=zh(pqt.prototype,"_direction",[uu],(function(){return 0})),vqt=zh(pqt.prototype,"_cellSize",[uu],(function(){return new ms(20,20)})),dqt=pqt))||dqt)||dqt));C.PageViewIndicator=Jqt;var Kqt=new ds,Qqt={Unified:0,Free:1};Re(Qqt);var Zqt={HORIZONTAL:0,VERTICAL:1};Re(Zqt);var $qt=t("h1",(Aqt=Kh("cc.PageView"),Cqt=Zh(110),Dqt=Ou(Qqt),Bqt=Ou(Zqt),Iqt=Ou(Jqt),Mqt=Ou(mWt),Pqt=Ou(mWt),Eqt=Ou([mg]),Oqt=Ou([mg]),Aqt(kqt=Cqt((Yqt=function(t){function e(){var e;return(e=t.call(this)||this).autoPageTurningThreshold=Fqt&&Fqt(),e.horizontal=Lqt&&Lqt(),e.vertical=Vqt&&Vqt(),e.cancelInnerEvents=Nqt&&Nqt(),e.scrollEvents=zqt&&zqt(),e.pageTurningSpeed=Uqt&&Uqt(),e.pageEvents=Gqt&&Gqt(),e._sizeMode=Hqt&&Hqt(),e._direction=Wqt&&Wqt(),e._scrollThreshold=jqt&&jqt(),e._pageTurningEventTiming=qqt&&qqt(),e._indicator=Xqt&&Xqt(),e._curPageIdx=0,e._lastPageIdx=0,e._pages=[],e._initContentPos=nr(),e._scrollCenterOffsetX=[],e._scrollCenterOffsetY=[],e._touchBeganPosition=ps(),e._touchEndPosition=ps(),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<i;e++)this.content.removeChild(t[e]);this._pages.length=0,this._updatePageView()}},i.scrollToPage=function(t,e){void 0===e&&(e=.3),t<0||t>=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(qHt);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;n<e;++n){var r=this._pages[n].position;0===this.direction?this._scrollCenterOffsetX[n]=Math.abs(i.x+r.x):this._scrollCenterOffsetY[n]=Math.abs(i.y+r.y)}this.indicator&&this.indicator._refresh()}},i._updateAllPagesSize=function(){var t=this.view;if(this.content&&t&&0===this._sizeMode)for(var e=this._pages,i=t.contentSize,n=0,r=e.length;n<r;n++)e[n]._getUITransformComp().setContentSize(i)},i._handleReleaseLogic=function(){this._autoScrollToPage(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent(e.EventType.SCROLL_ENDED))},i._onTouchBegan=function(e,i){e.touch.getUILocation(Kqt),ds.set(this._touchBeganPosition,Kqt.x,Kqt.y),t.prototype._onTouchBegan.call(this,e,i)},i._onTouchMoved=function(e,i){t.prototype._onTouchMoved.call(this,e,i)},i._onTouchEnded=function(e,i){e.touch.getUILocation(Kqt),ds.set(this._touchEndPosition,Kqt.x,Kqt.y),t.prototype._onTouchEnded.call(this,e,i)},i._onTouchCancelled=function(e,i){e.touch.getUILocation(Kqt),ds.set(this._touchEndPosition,Kqt.x,Kqt.y),t.prototype._onTouchCancelled.call(this,e,i)},i._onMouseWheel=function(){},i._syncScrollDirection=function(){this.horizontal=0===this.direction,this.vertical=1===this.direction},i._syncSizeMode=function(){var t=this.view;if(this.content&&t){var e=this.content.getComponent(qHt);if(e){if(1===this._sizeMode&&this._pages.length>0){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<t.length;++e){var i=t[e];this._pages.indexOf(i)>=0||this._pages.push(i)}this._syncScrollDirection(),this._syncSizeMode(),this._updatePageView()}},i._dispatchPageTurningEvent=function(){this._lastPageIdx!==this._curPageIdx&&(this._lastPageIdx=this._curPageIdx,mg.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(n<this._pages.length){if(this._isScrollable(e,i,n))return void this.scrollToPage(n,r);var s=this._calculateTouchMoveVelocity();if(this._isQuicklyScrollable(s))return void this.scrollToPage(n,r)}this.scrollToPage(i,r)}},n(e,[{key:"sizeMode",get:function(){return this._sizeMode},set:function(t){this._sizeMode!==t&&(this._sizeMode=t,this._syncSizeMode())}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this._syncScrollDirection())}},{key:"scrollThreshold",get:function(){return this._scrollThreshold},set:function(t){this._scrollThreshold!==t&&(this._scrollThreshold=t)}},{key:"pageTurningEventTiming",get:function(){return this._pageTurningEventTiming},set:function(t){this._pageTurningEventTiming!==t&&(this._pageTurningEventTiming=t)}},{key:"indicator",get:function(){return this._indicator},set:function(t){this._indicator!==t&&(this._indicator=t,this.indicator&&this.indicator.setPageView(this))}},{key:"curPageIdx",get:function(){return this._curPageIdx}},{key:"verticalScrollBar",get:function(){return t.prototype.verticalScrollBar},set:function(t){this.verticalScrollBar=t}},{key:"horizontalScrollBar",get:function(){return t.prototype.horizontalScrollBar},set:function(t){this.horizontalScrollBar=t}}]),e}(hjt),Yqt.SizeMode=Qqt,Yqt.Direction=Zqt,Yqt.EventType=xjt({PAGE_TURNING:"page-turning"},ojt),v((Rqt=Yqt).prototype,"sizeMode",[Dqt],Object.getOwnPropertyDescriptor(Rqt.prototype,"sizeMode"),Rqt.prototype),v(Rqt.prototype,"direction",[Bqt],Object.getOwnPropertyDescriptor(Rqt.prototype,"direction"),Rqt.prototype),v(Rqt.prototype,"indicator",[Iqt],Object.getOwnPropertyDescriptor(Rqt.prototype,"indicator"),Rqt.prototype),Fqt=zh(Rqt.prototype,"autoPageTurningThreshold",[uu],(function(){return 100})),v(Rqt.prototype,"verticalScrollBar",[Mqt,Gu],Object.getOwnPropertyDescriptor(Rqt.prototype,"verticalScrollBar"),Rqt.prototype),v(Rqt.prototype,"horizontalScrollBar",[Pqt,Gu],Object.getOwnPropertyDescriptor(Rqt.prototype,"horizontalScrollBar"),Rqt.prototype),Lqt=zh(Rqt.prototype,"horizontal",[Gu,uu],(function(){return!0})),Vqt=zh(Rqt.prototype,"vertical",[Gu,uu],(function(){return!0})),Nqt=zh(Rqt.prototype,"cancelInnerEvents",[Gu,uu],(function(){return!0})),zqt=zh(Rqt.prototype,"scrollEvents",[Eqt,uu,Gu],(function(){return[]})),Uqt=zh(Rqt.prototype,"pageTurningSpeed",[uu],(function(){return.3})),Gqt=zh(Rqt.prototype,"pageEvents",[Oqt,uu],(function(){return[]})),Hqt=zh(Rqt.prototype,"_sizeMode",[uu],(function(){return 0})),Wqt=zh(Rqt.prototype,"_direction",[uu],(function(){return 0})),jqt=zh(Rqt.prototype,"_scrollThreshold",[uu],(function(){return.5})),qqt=zh(Rqt.prototype,"_pageTurningEventTiming",[uu],(function(){return.1})),Xqt=zh(Rqt.prototype,"_indicator",[uu],(function(){return null})),kqt=Rqt))||kqt)||kqt));C.PageView=$qt;var tXt=new ir,eXt=new ds,iXt=new ds,nXt=new ds(1,1),rXt=new ds,sXt=new ds;function aXt(t,e){if(!e._hadAlignOnce){0===e.alignMode&&(e._hadAlignOnce=!0);var i,n=e.target,r=iXt,s=nXt;n?oqt(t,i=n,r,s):i=t.parent;var a=aqt(i),o=i instanceof RI||!i.getComponent(lL),h=o?eXt:i.getComponent(lL).anchorPoint,u=o;t.getPosition(tXt);var l=t._getUITransformComp(),c=tXt.x,f=tXt.y,_=l.anchorPoint,d=t.scale;if(56&e.alignFlags){var p=0,m=0,g=a.width;u?(p=uh.left.x,m=uh.right.x):m=(p=-h.x*g)+g,p+=e.isAbsoluteLeft?e.left:e.left*g,m-=e.isAbsoluteRight?e.right:e.right*g,n&&(p+=r.x,p*=s.x,m+=r.x,m*=s.x);var y=0,v=_.x,b=d.x;if(b<0&&(v=1-v,b=-b),e.isStretchWidth)y=m-p,0!==b&&(l.width=y/b),c=p+v*y;else{if(y=l.width*b,e.isAlignHorizontalCenter){var S=e.isAbsoluteHorizontalCenter?e.horizontalCenter:e.horizontalCenter*g,w=(.5-h.x)*a.width;n&&(S*=s.x,w+=r.x,w*=s.x),c=w+(v-.5)*y+S}else c=e.isAlignLeft?p+v*y:m+(v-1)*y;Zi(b,0,Ki)?y=l.width:y/=b}e._lastSize.width=y}if(7&e.alignFlags){var x=0,T=0,A=a.height;u?(T=uh.bottom.y,x=uh.top.y):x=(T=-h.y*A)+A,T+=e.isAbsoluteBottom?e.bottom:e.bottom*A,x-=e.isAbsoluteTop?e.top:e.top*A,n&&(T+=r.y,T*=s.y,x+=r.y,x*=s.y);var C=0,D=_.y,B=d.y;if(B<0&&(D=1-D,B=-B),e.isStretchHeight)C=x-T,0!==B&&(l.height=C/B),f=T+D*C;else{if(C=l.height*B,e.isAlignVerticalCenter){var I=e.isAbsoluteVerticalCenter?e.verticalCenter:e.verticalCenter*A,M=(.5-h.y)*a.height;n&&(I*=s.y,M+=r.y,M*=s.y),f=M+(D-.5)*C+I}else f=e.isAlignBottom?T+D*C:x+(D-1)*C;Zi(B,0,Ki)?C=l.height:C/=B}e._lastSize.height=C}t.setPosition(c,f,tXt.z),ir.set(e._lastPos,c,f,tXt.z)}}function oXt(t){var e=t.getComponent(wqt);if(e&&e.enabled){if(!A.isValid(t,!0))return;fXt.push(e)}for(var i,n=p(t.children);!(i=n()).done;){var r=i.value;r.active&&oXt(r)}}function hXt(){var t=YE.getScene();if(t){_Xt.isAligning=!0,_Xt._nodesOrderDirty&&(fXt.length=0,oXt(t),_Xt._nodesOrderDirty=!1);var e=null,i=_Xt._activeWidgetsIterator;for(i.i=0;i.i<fXt.length;++i.i)(e=fXt[i.i])._dirty&&(aXt(e.node,e),e._dirty=!1);_Xt.isAligning=!1}}var uXt,lXt,cXt,fXt=[],_Xt=t("h7",A._widgetManager={isAligning:!1,_nodesOrderDirty:!1,_activeWidgetsIterator:new ye(fXt),animationState:null,init:function(){YE.on("director_after_scene_launch",hXt),YE.on("director_after_update",hXt),IO.instance.on("design-resolution-changed",this.onResized,this);var t=this.onResized.bind(this);IO.instance.on("canvas-resize",t),sh.on("window-resize",t)},add:function(){this._nodesOrderDirty=!0},remove:function(t){this._activeWidgetsIterator.remove(t)},onResized:function(){var t=YE.getScene();t&&this.refreshWidgetOnResized(t)},refreshWidgetOnResized:function(t){var e=eb.isNode(t)&&t.getComponent(wqt);e&&e.enabled&&(2===e.alignMode||1===e.alignMode)&&e.setDirty();for(var i,n=p(t.children);!(i=n()).done;){var r=i.value;this.refreshWidgetOnResized(r)}},updateOffsetsToStayPut:function(t,e){function i(t,e){return Math.abs(t-e)>1e-10?e:t}var n=t.node,r=n.parent;if(r){var s=rXt;s.set(0,0);var a=sXt;if(a.set(1,1),t.target&&oqt(n,r=t.target,s,a),!e)return;var o=r._uiProps&&r._getUITransformComp(),h=o?o.anchorPoint:eXt,u=n._getUITransformComp(),l=aqt(r),c=u.anchorPoint,f=n.position,_=Sqt,d=n.scale,p=0;if(e&_.LEFT){var m=-h.x*l.width;m+=s.x,m*=a.x,p=f.x-c.x*u.width*Math.abs(d.x)-m,t.isAbsoluteLeft||(p/=l.width),p/=a.x,t.left=i(t.left,p)}if(e&_.RIGHT){var g=(1-h.x)*l.width;g+=s.x,p=(g*=a.x)-(f.x+(1-c.x)*u.width*Math.abs(d.x)),t.isAbsoluteRight||(p/=l.width),p/=a.x,t.right=i(t.right,p)}if(e&_.TOP){var y=(1-h.y)*l.height;y+=s.y,p=(y*=a.y)-(f.y+(1-c.y)*u.height*Math.abs(d.y)),t.isAbsoluteTop||(p/=l.height),p/=a.y,t.top=i(t.top,p)}if(e&_.BOT){var v=-h.y*l.height;v+=s.y,v*=a.y,p=f.y-c.y*u.height*Math.abs(d.y)-v,t.isAbsoluteBottom||(p/=l.height),p/=a.y,t.bottom=i(t.bottom,p)}}},updateAlignment:function t(e){var i=e.parent;i&&eb.isNode(i)&&t(i);var n=e.getComponent(wqt);n&&i&&aXt(e,n)},AlignMode:hqt,AlignFlags:Sqt});YE.on("director_init",(function(){_Xt.init()}));var dXt,pXt,mXt,gXt,yXt,vXt,bXt,SXt,wXt,xXt,TXt,AXt,CXt=t("h3",Kh("cc.SafeArea")(uXt=Zh(110)(uXt=Qh(wqt)((lXt=function(t){function e(){var e;return(e=t.call(this)||this)._symmetric=cXt&&cXt(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){this.updateArea(),sh.on("window-resize",this.updateArea,this),sh.on("orientation-change",this.updateArea,this)},i.onDisable=function(){sh.off("window-resize",this.updateArea,this),sh.off("orientation-change",this.updateArea,this)},i.updateArea=function(){var t=this.node.getComponent(wqt),e=this.node.getComponent(lL);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=zO.getVisibleSize(),s=r.width,a=r.height,o=hh.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),_Xt.add(t)}},n(e,[{key:"symmetric",get:function(){return this._symmetric},set:function(t){this._symmetric=t}}]),e}(yg),cXt=zh(lXt.prototype,"_symmetric",[uu],(function(){return!0})),uXt=lXt))||uXt)||uXt)||uXt);C.SafeArea=CXt;var DXt,BXt=t("h4",(dXt=Kh("cc.UICoordinateTracker"),pXt=Zh(110),mXt=Ou(eb),gXt=Ou(iU),yXt=Ou([mg]),dXt(vXt=pXt((bXt=function(t){function e(){var e;return(e=t.call(this)||this).syncEvents=SXt&&SXt(),e._target=wXt&&wXt(),e._camera=xXt&&xXt(),e._useScale=TXt&&TXt(),e._distance=AXt&&AXt(),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);mg.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}(yg),v(bXt.prototype,"target",[mXt],Object.getOwnPropertyDescriptor(bXt.prototype,"target"),bXt.prototype),v(bXt.prototype,"camera",[gXt],Object.getOwnPropertyDescriptor(bXt.prototype,"camera"),bXt.prototype),SXt=zh(bXt.prototype,"syncEvents",[yXt,uu],(function(){return[]})),wXt=zh(bXt.prototype,"_target",[uu],(function(){return null})),xXt=zh(bXt.prototype,"_camera",[uu],(function(){return null})),TXt=zh(bXt.prototype,"_useScale",[uu],(function(){return!0})),AXt=zh(bXt.prototype,"_distance",[uu],(function(){return 1})),vXt=bXt))||vXt)||vXt)),IXt=["touch-start","touch-end","touch-move","mouse-down","mouse-move","mouse-up","mouse-enter","mouse-leave","mouse-wheel"];function MXt(t){t.propagationStopped=!0}var PXt,EXt,OXt,kXt,RXt,FXt=t("h5",Kh("cc.BlockInputEvents")(DXt=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;t<IXt.length;t++)this.node.on(IXt[t],MXt,this)},i.onDisable=function(){for(var t=0;t<IXt.length;t++)this.node.off(IXt[t],MXt,this)},e}(yg))||DXt),LXt=t("h6",Kh("cc.SubContextView")(PXt=Zh(110)(PXt=Qh(lL)((EXt=function(t){function e(){var e;return(e=t.call(this)||this)._fps=OXt&&OXt(),e._sprite=null,e._imageAsset=new Hm,e._texture=new Ey,e._updatedTime=0,e._updateInterval=0,e._openDataContext=null,e._content=new eb("content"),e._designResolutionSize=kXt&&kXt(),e._content.hideFlags|=1032,e._updatedTime=performance.now(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){cR.getOpenDataContext?(this._updateInterval=1e3/this._fps,this._openDataContext=cR.getOpenDataContext(),this._initSharedCanvas(),this._initContentNode(),this._updateSubContextView(),this._updateContentLayer()):this.enabled=!1},i.onEnable=function(){this._registerNodeEvent()},i.onDisable=function(){this._unregisterNodeEvent()},i._initSharedCanvas=function(){if(this._openDataContext){var t=this._openDataContext.canvas,e=this._designResolutionSize.width,i=this._designResolutionSize.height;t.width=e,t.height=i}},i._initContentNode=function(){if(this._openDataContext){var t=this._openDataContext.canvas,e=this._imageAsset;if(e.reset(t),this._texture.image=e,this._texture.create(t.width,t.height),this._sprite=this._content.getComponent(GV),this._sprite||(this._sprite=this._content.addComponent(GV)),this._sprite.spriteFrame)this._sprite.spriteFrame.texture=this._texture;else{var i=new nR;i.texture=this._texture,this._sprite.spriteFrame=i}this._content.parent=this.node}},i._updateSubContextView=function(){if(this._openDataContext){var t=this.node.getComponent(lL),e=this._content.getComponent(lL),i=t.width/e.width,n=t.height/e.height,r=i>n?n:i;e.width*=r,e.height*=r;var s=zO.getViewportRect(),a=e.getBoundingBoxToWorld(),o=zO.getVisibleSize(),h=sh.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}(yg),OXt=zh(EXt.prototype,"_fps",[uu],(function(){return 60})),kXt=zh(EXt.prototype,"_designResolutionSize",[uu],(function(){return new ms(640,960)})),PXt=EXt))||PXt)||PXt)||PXt);C.SubContextView=LXt,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 VXt,NXt,zXt,UXt,GXt,HXt,WXt,jXt=t("hb",Kh("cc.UIReorderComponent")(RXt=function(){at(1408,"UIReorderComponent")})||RXt);C.UIReorderComponent=jXt,C.ButtonComponent=uGt,le(uGt,"cc.ButtonComponent"),C.EditBoxComponent=AHt,le(AHt,"cc.EditBoxComponent"),C.LayoutComponent=qHt,le(qHt,"cc.LayoutComponent"),C.ProgressBarComponent=oWt,le(oWt,"cc.ProgressBarComponent"),C.ScrollViewComponent=hjt,le(hjt,"cc.ScrollViewComponent"),C.ScrollBarComponent=mWt,le(mWt,"cc.ScrollBarComponent"),C.SliderComponent=wjt,le(wjt,"cc.SliderComponent"),C.ToggleComponent=Pjt,le(Pjt,"cc.ToggleComponent"),C.ToggleContainerComponent=rqt,le(rqt,"cc.ToggleContainerComponent"),C.WidgetComponent=wqt,le(wqt,"cc.WidgetComponent"),C.PageViewComponent=$qt,le($qt,"cc.PageViewComponent"),C.PageViewIndicatorComponent=Jqt,le(Jqt,"cc.PageViewIndicatorComponent"),C.SafeAreaComponent=CXt,le(CXt,"cc.SafeAreaComponent"),le(BXt,"cc.UICoordinateTrackerComponent"),C.BlockInputEventsComponent=FXt,le(FXt,"cc.BlockInputEventsComponent"),mt(IO.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(IO.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 qXt,XXt,YXt,JXt=ps(),KXt=t("hc",(VXt=Kh("cc.UISkew"),NXt=Ou(fi),zXt=Ou(ds),VXt(UXt=$h((GXt=function(t){function e(){var e;return(e=t.call(this)||this)._skew=HXt&&HXt(),e._rotational=WXt&&WXt(),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,eb._incSkewCompCount(),this._syncNative(!0),this._updateNodeTransformFlags()},i.onDisable=function(){this._skewEnabled=!1,eb._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?JXt.set(t,e):ds.copy(JXt,t),ds.equals(i,JXt)||(i.set(JXt),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}(yg),HXt=zh(GXt.prototype,"_skew",[uu],(function(){return ps()})),WXt=zh(GXt.prototype,"_rotational",[uu],(function(){return!1})),v(GXt.prototype,"rotational",[NXt],Object.getOwnPropertyDescriptor(GXt.prototype,"rotational"),GXt.prototype),v(GXt.prototype,"skew",[zXt],Object.getOwnPropertyDescriptor(GXt.prototype,"skew"),GXt.prototype),UXt=GXt))||UXt)||UXt));A.UISkew=KXt;var QXt=t("hd",Kh("cc.VideoClip")((XXt=function(t){function e(){var e;return(e=t.call(this)||this)._duration=YXt&&YXt(),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),YXt=zh(XXt.prototype,"_duration",[uu],(function(){return 0})),qXt=XXt))||qXt),ZXt=B.document;function $Xt(t,e,i){var n=ZXt.createElement("video"),r=ZXt.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 tYt(t,e,i,n){var r=new QXt;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}Mx.register({".mp4":$Xt,".avi":$Xt,".mov":$Xt,".mpg":$Xt,".mpeg":$Xt,".rm":$Xt,".rmvb":$Xt}),Hx.register({".mp4":tYt,".avi":tYt,".mov":tYt,".mpg":tYt,".mpeg":tYt,".rm":tYt,".rmvb":tYt});var eYt=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(lL),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)},C.game.on(C.Game.EVENT_PAUSE,this._onInterruptedBegin),C.game.on(C.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&&J("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(),C.game.off(C.Game.EVENT_PAUSE,this._onInterruptedBegin),C.game.off(C.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 YE.root.batcher2D.getFirstRenderCamera(this._node)}}]),t}();C.internal.VideoPlayerImpl=eYt;var iYt=B.document,nYt=-Math.pow(2,15),rYt=$r(),sYt=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();B.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){hh.browserType!==Mo.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 hh.os===Oo.IOS&&hh.isBrowser?(t?i.webkitEnterFullscreen&&i.webkitEnterFullscreen():i.webkitExitFullscreen&&i.webkitExitFullscreen(),void(this._fullScreenOnAwake=i.webkitDisplayingFullscreen)):oh.supportsFullScreen?void(t?(hh.browserType===Mo.IE&&(i.style.transform=""),i.setAttribute("x5-video-player-fullscreen","true"),oh.requestFullScreen(i,(function(t){var n=hh.browserType===Mo.IE?t.msFullscreenElement:t.fullscreenElement;e._fullScreenOnAwake=n===i}),(function(){e._fullScreenOnAwake=!1}))):(i.removeAttribute("x5-video-player-fullscreen"),oh.exitFullScreen())):(this._fullScreenOnAwake=t,this._forceUpdate=!0,void this.syncMatrix())},i.syncStayOnBottom=function(t){this._video&&(this._video.style["z-index"]=t?nYt: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&&Ke(XO.container,t)&&(XO.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=iYt.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(),XO.container.appendChild(e);var i=iYt.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(rYt),t.update(!0),t.worldMatrixToScreen(rYt,rYt,XO.canvas.width,XO.canvas.height);var e=0,i=0;if(this._fullScreenOnAwake?(e=uh.width,i=uh.height):(e=this._uiTrans.contentSize.width,i=this._uiTrans.contentSize.height),this._forceUpdate||this._m00!==rYt.m00||this._m01!==rYt.m01||this._m04!==rYt.m04||this._m05!==rYt.m05||this._m12!==rYt.m12||this._m13!==rYt.m13||this._w!==e||this._h!==i){this._m00=rYt.m00,this._m01=rYt.m01,this._m04=rYt.m04,this._m05=rYt.m05,this._m12=rYt.m12,this._m13=rYt.m13,this._w=e,this._h=i;var n=sh.devicePixelRatio,r=1/n,s=1/n,a=XO.container,o=rYt.m00*r,h=rYt.m01,u=rYt.m04,l=rYt.m05*s;this._video.style.width=this._w+"px",this._video.style.height=this._h+"px",hh.browserType!==Mo.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,_=this._uiTrans.anchorPoint,d=_.x,p=_.y,m=c*rYt.m00*d,g=f*rYt.m05*p,y=a&&a.style.paddingLeft?parseInt(a.style.paddingLeft):0,v=a&&a.style.paddingBottom?parseInt(a.style.paddingBottom):0,b="matrix("+o+","+-h+","+-u+","+l+","+(rYt.m12*r-m+y)+","+-(rYt.m13*s-g+v)+")";this._video.style.transform=b,this._video.style["-webkit-transform"]=b,hh.browserType!==Mo.IE&&(this._forceUpdate=!1)}}}},e}(eYt),aYt=function(){function t(){}return t.getImpl=function(t){return new sYt(t)},t}();C.internal.VideoPlayerImplManager=aYt;var oYt,hYt,uYt,lYt,cYt,fYt,_Yt,dYt,pYt,mYt,gYt,yYt,vYt,bYt,SYt,wYt,xYt,TYt,AYt,CYt,DYt,BYt=Ee({REMOTE:0,LOCAL:1}),IYt=t("he",(oYt=Kh("cc.VideoPlayer"),hYt=Qh(lL),uYt=Ou(QXt),lYt=Ou(BYt),cYt=Ou(QXt),fYt=Ou([mg]),oYt(_Yt=hYt((DYt=function(t){function e(){var e;return(e=t.call(this)||this)._resourceType=pYt&&pYt(),e._remoteURL=mYt&&mYt(),e._clip=gYt&&gYt(),e._playOnAwake=yYt&&yYt(),e._volume=vYt&&vYt(),e._mute=bYt&&bYt(),e._playbackRate=SYt&&SYt(),e._loop=wYt&&wYt(),e._fullScreenOnAwake=xYt&&xYt(),e._stayOnBottom=TYt&&TYt(),e._keepAspectRatio=AYt&&AYt(),e._impl=null,e._cachedCurrentTime=0,e.videoPlayerEvent=CYt&&CYt(),e}s(e,t);var i=e.prototype;return i.syncSource=function(){var t=this._impl;t&&(this._resourceType===BYt.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=aYt.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(){mg.emitEvents(this.videoPlayerEvent,this,"meta-loaded"),this.node.emit("meta-loaded",this)},i.onReadyToPlay=function(){this._playOnAwake&&!this.isPlaying&&this.play(),mg.emitEvents(this.videoPlayerEvent,this,"ready-to-play"),this.node.emit("ready-to-play",this)},i.onPlaying=function(){mg.emitEvents(this.videoPlayerEvent,this,"playing"),this.node.emit("playing",this)},i.onPaused=function(){mg.emitEvents(this.videoPlayerEvent,this,"paused"),this.node.emit("paused",this)},i.onStopped=function(){mg.emitEvents(this.videoPlayerEvent,this,"stopped"),this.node.emit("stopped",this)},i.onCompleted=function(){mg.emitEvents(this.videoPlayerEvent,this,"completed"),this.node.emit("completed",this)},i.onError=function(){mg.emitEvents(this.videoPlayerEvent,this,"error"),this.node.emit("error",this)},i.onClicked=function(){mg.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}(yg),DYt.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"},DYt.ResourceType=BYt,pYt=zh((dYt=DYt).prototype,"_resourceType",[uu],(function(){return BYt.LOCAL})),mYt=zh(dYt.prototype,"_remoteURL",[uu],(function(){return""})),gYt=zh(dYt.prototype,"_clip",[uYt,uu],(function(){return null})),yYt=zh(dYt.prototype,"_playOnAwake",[uu],(function(){return!0})),vYt=zh(dYt.prototype,"_volume",[uu],(function(){return 1})),bYt=zh(dYt.prototype,"_mute",[uu],(function(){return!1})),SYt=zh(dYt.prototype,"_playbackRate",[uu],(function(){return 1})),wYt=zh(dYt.prototype,"_loop",[uu],(function(){return!1})),xYt=zh(dYt.prototype,"_fullScreenOnAwake",[uu],(function(){return!1})),TYt=zh(dYt.prototype,"_stayOnBottom",[uu],(function(){return!1})),AYt=zh(dYt.prototype,"_keepAspectRatio",[uu],(function(){return!0})),v(dYt.prototype,"resourceType",[lYt],Object.getOwnPropertyDescriptor(dYt.prototype,"resourceType"),dYt.prototype),v(dYt.prototype,"clip",[cYt],Object.getOwnPropertyDescriptor(dYt.prototype,"clip"),dYt.prototype),CYt=zh(dYt.prototype,"videoPlayerEvent",[uu,fYt],(function(){return[]})),_Yt=dYt))||_Yt)||_Yt));C.internal.VideoPlayer=IYt,pt(IYt.prototype,"VideoPlayer.prototype",[{name:"onPasued",newName:"onPaused"}]);var MYt=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(lL),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;r<i;r++)n[r-1]=arguments[r];e.call(this,n)}},e.destroy=function(){this.removeWebView(),this._wrapper=null,this._webview=null,this._loaded=!1,this._component=null,this._uiTrans=null,this._forceUpdate=!1,this._componentEventList.clear()},n(t,[{key:"loaded",get:function(){return this._loaded}},{key:"componentEventList",get:function(){return this._componentEventList}},{key:"webview",get:function(){return this._webview}},{key:"state",get:function(){return this._state}},{key:"UICamera",get:function(){return YE.root.batcher2D.getFirstRenderCamera(this._node)}}]),t}();C.internal.WebViewImpl=MYt;var PYt=B.document,EYt=$r(),OYt=function(t){function e(e){return t.call(this,e)||this}s(e,t);var i=e.prototype;return i._bindDomEvent=function(){var t=this;this.webview&&this.webview.addEventListener("load",(function(e){t._forceUpdate=!0,t.dispatchEvent("loaded");var i=e.target,n=i.contentDocument&&i.contentDocument.body;n&&n.innerHTML.includes("404")&&t.dispatchEvent("error",n.innerHTML)}))},i.loadURL=function(t){this.webview&&(this.webview.src=t,this.dispatchEvent("loading"))},i.createWebView=function(){var t=PYt.createElement("div");this._wrapper=t,t.id="webview-wrapper";var e=t.style;e["-webkit-overflow"]="auto",e["-webkit-overflow-scrolling"]="touch",e.position="absolute",e.bottom="0px",e.left="0px",e.transformOrigin="0px 100% 0px",e["-webkit-transform-origin"]="0px 100% 0px",XO.container.appendChild(t);var i=PYt.createElement("iframe");this._webview=i;var n=i.style;i.id="webview",n.border="none",n.width="100%",n.height="100%",t.appendChild(i),this._bindDomEvent()},i.removeWebView=function(){var t=this._wrapper;Ke(XO.container,t)&&XO.container.removeChild(t),this.reset()},i.enable=function(){this._wrapper&&(this._wrapper.style.visibility="visible")},i.disable=function(){this._wrapper&&(this._wrapper.style.visibility="hidden")},i.evaluateJS=function(t){if(this.webview){var e=this.webview.contentWindow;if(e)try{e.eval(t)}catch(t){this.dispatchEvent("error",t),J(t)}}},i.setOnJSCallback=function(){Y("The platform does not support")},i.setJavascriptInterfaceScheme=function(){Y("The platform does not support")},i.syncMatrix=function(){if(this._wrapper&&this._uiTrans&&this._component&&"hidden"!==this._wrapper.style.visibility){var t=this.UICamera;if(t){this._component.node.getWorldMatrix(EYt),t.update(!0),t.worldMatrixToScreen(EYt,EYt,XO.canvas.width,XO.canvas.height);var e=this._uiTrans.contentSize,i=e.width,n=e.height;if(this._forceUpdate||this._m00!==EYt.m00||this._m01!==EYt.m01||this._m04!==EYt.m04||this._m05!==EYt.m05||this._m12!==EYt.m12||this._m13!==EYt.m13||this._w!==i||this._h!==n){this._m00=EYt.m00,this._m01=EYt.m01,this._m04=EYt.m04,this._m05=EYt.m05,this._m12=EYt.m12,this._m13=EYt.m13,this._w=i,this._h=n;var r=sh.devicePixelRatio,s=1/r,a=1/r,o=XO.container,h=EYt.m00*s,u=EYt.m01,l=EYt.m04,c=EYt.m05*a;this._wrapper.style.width=i+"px",this._wrapper.style.height=n+"px";var f=this._w*s,_=this._h*a,d=f*EYt.m00*this._uiTrans.anchorX,p=_*EYt.m05*this._uiTrans.anchorY,m=o&&o.style.paddingLeft?parseInt(o.style.paddingLeft):0,g=o&&o.style.paddingBottom?parseInt(o.style.paddingBottom):0,y="matrix("+h+","+-u+","+-l+","+c+","+(EYt.m12*s-d+m)+","+-(EYt.m13*a-p+g)+")";this._wrapper.style.transform=y,this._wrapper.style["-webkit-transform"]=y,this._forceUpdate=!1}}}},e}(MYt),kYt=function(){function t(){}return t.getImpl=function(t){return new OYt(t)},t}();C.internal.WebViewImplManager=kYt;var RYt,FYt,LYt,VYt,NYt,zYt,UYt,GYt,HYt=t("hf",(RYt=Kh("cc.WebView"),FYt=Qh(lL),LYt=Ou([mg]),RYt(VYt=FYt((GYt=function(t){function e(){var e;return(e=t.call(this)||this)._url=zYt&&zYt(),e._impl=null,e.webviewEvents=UYt&&UYt(),e}s(e,t);var i=e.prototype;return i.setJavascriptInterfaceScheme=function(t){this._impl&&this._impl.setJavascriptInterfaceScheme(t)},i.setOnJSCallback=function(t){this._impl&&this._impl.setOnJSCallback(t)},i.evaluateJS=function(t){this._impl&&this._impl.evaluateJS(t)},i.__preload=function(){this._impl=kYt.getImpl(this);var t=this._impl.componentEventList;t.set("loading",this.onLoading.bind(this)),t.set("loaded",this.onLoaded.bind(this)),t.set("error",this.onError.bind(this)),this._impl.loadURL(this._url)},i.onLoading=function(){mg.emitEvents(this.webviewEvents,this,"loading"),this.node.emit("loading",this)},i.onLoaded=function(){mg.emitEvents(this.webviewEvents,this,"loaded"),this.node.emit("loaded",this)},i.onError=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];mg.emitEvents(this.webviewEvents,this,"error",e),this.node.emit("error",this,e)},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()},n(e,[{key:"url",get:function(){return this._url},set:function(t){this._url=t,this._impl&&this._impl.loadURL(t)}},{key:"nativeWebView",get:function(){return this._impl&&this._impl.webview||null}},{key:"state",get:function(){return this._impl?this._impl.state:"none"}}]),e}(yg),GYt.EventType={NONE:"none",LOADING:"loading",LOADED:"loaded",ERROR:"error"},zYt=zh((NYt=GYt).prototype,"_url",[uu],(function(){return"https://cocos.com"})),UYt=zh(NYt.prototype,"webviewEvents",[uu,LYt],(function(){return[]})),VYt=NYt))||VYt)||VYt));C.internal.WebView=HYt;var WYt=new ir,jYt=Js.create(0,0,0,1),qYt=new gh(0,0,0,.5,.5,.5),XYt=new gh,YYt=new ho((function(){return{model:null,depth:0}}),128);function JYt(t,e){var i=0;t.node&&(ir.subtract(WYt,t.worldBounds?t.worldBounds.center:t.node.worldPosition,e.position),i=ir.dot(WYt,e.forward));var n=YYt.alloc();return n.model=t,n.depth=i,n}function KYt(t,e){var i=t.validPunctualLights;i.length=0;for(var n=e.scene.spotLights,r=e.node.scene.globals.disableLightmap,s=0;s<n.length;s++){var a=n[s];a.baked&&!r||(Js.set(jYt,a.position.x,a.position.y,a.position.z,a.range),Za.sphereFrustum(jYt,e.frustum)&&i.push(a))}for(var o=e.scene.sphereLights,h=0;h<o.length;h++){var u=o[h];u.baked&&!r||(Js.set(jYt,u.position.x,u.position.y,u.position.z,u.range),Za.sphereFrustum(jYt,e.frustum)&&i.push(u))}for(var l=e.scene.pointLights,c=0;c<l.length;c++){var f=l[c];f.baked||(Js.set(jYt,f.position.x,f.position.y,f.position.z,f.range),Za.sphereFrustum(jYt,e.frustum)&&i.push(f))}for(var _=e.scene.rangedDirLights,d=0;d<_.length;d++){var p=_[d];gh.transform(XYt,qYt,p.node.getWorldMatrix()),Za.aabbFrustum(XYt,e.frustum)&&i.push(p)}t.validPunctualLights=i}function QYt(t,e,i){var n=t.scene.mainLight,r=e.csmLayers.layerObjects,s=i.validFrustum,a=i.shadowObjects;a.length=0;for(var o=t.visibility,h=r.length-1;h>=0;h--){var u=r.array[h];if(u){var l=u.model;l&&l.enabled&&l.node&&((o&l.node.layer)===l.node.layer||o&l.visFlags)&&l.worldBounds&&l.castShadow?Za.aabbFrustum(l.worldBounds,s)&&(a.push(u),i.level<n.csmLevel&&n.csmOptimizationMode===XT.RemoveDuplicates&&Za.aabbFrustumCompletelyInside(l.worldBounds,s)&&r.fastRemove(h)):r.fastRemove(h)}else r.fastRemove(h)}}function ZYt(t,e,i){var n=i.scene,r=n.mainLight,s=t.shadows,a=t.skybox,o=t.csmLayers,h=t.renderObjects;YYt.freeArray(h),h.length=0;var u=o.castShadowObjects;u.length=0;var l=o.layerObjects;l.clear(),s.enabled&&(e.updateShadowUBORange(56,s.shadowColor),s.type===WT.ShadowMap&&r&&r.node&&o.update(t,i)),8&i.clearFlag&&(a.enabled&&a.model?h.push(JYt(a.model,i)):0!==i.cameraUsage&&2!==i.cameraUsage&&at(15100,i.name));var c=n.models,f=i.visibility;function _(t){if(t.enabled){if(n.isCulledByLod(i,t))return;if(t.castShadow&&(u.push(JYt(t,i)),l.push(JYt(t,i))),t.node&&(f&t.node.layer)===t.node.layer||f&t.visFlags){if(t.worldBounds&&!Za.aabbFrustum(t.worldBounds,i.frustum))return;h.push(JYt(t,i))}}}for(var d=0;d<c.length;d++)_(c[d])}var $Yt,tJt,eJt,iJt,nJt,rJt=new md(2,2,0,2,2,2),sJt=new md(1,1,0,2,2,2),aJt=function(){function t(t){this._descriptorSetMap=new Map,this._device=t,this._linearSampler=this._device.getSampler(rJt),this._pointSampler=this._device.getSampler(sJt);var e=new zd(Tb.bindings);this._descriptorSetLayout=this._device.createDescriptorSetLayout(e),this._globalDescriptorSet=this._device.createDescriptorSet(new Ud(this._descriptorSetLayout))}var e=t.prototype;return e.regenLayout=function(){var t=new zd(Tb.bindings);this._descriptorSetLayout=this._device.createDescriptorSetLayout(t),this._globalDescriptorSet=this._device.createDescriptorSet(new Ud(this._descriptorSetLayout))},e.bindBuffer=function(t,e){this._globalDescriptorSet.bindBuffer(t,e);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindBuffer(t,e),n=i.next()},e.bindSampler=function(t,e){this._globalDescriptorSet.bindSampler(t,e);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindSampler(t,e),n=i.next()},e.bindTexture=function(t,e){this._globalDescriptorSet.bindTexture(t,e);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindTexture(t,e),n=i.next()},e.update=function(){this._globalDescriptorSet.update();for(var t=this._descriptorSetMap.values(),e=t.next();!e.done;)e.value.update(),e=t.next()},e.getOrCreateDescriptorSet=function(t){var e=this._device;if(!this._descriptorSetMap.has(t)){var i=this._globalDescriptorSet,n=e.createDescriptorSet(new Ud(this._descriptorSetLayout));this._descriptorSetMap.set(t,n);for(var r=0;r<8;r++)n.bindBuffer(r,i.getBuffer(r)),n.bindSampler(r,i.getSampler(r)),n.bindTexture(r,i.getTexture(r));var s=e.createBuffer(new ud(18,3,256,256));n.bindBuffer(Ib.BINDING,s),n.update()}return this._descriptorSetMap.get(t)},e.destroy=function(){this._descriptorSetLayout.destroy()},n(t,[{key:"descriptorSetMap",get:function(){return this._descriptorSetMap}},{key:"linearSampler",get:function(){return this._linearSampler}},{key:"pointSampler",get:function(){return this._pointSampler}},{key:"descriptorSetLayout",get:function(){return this._descriptorSetLayout}},{key:"globalDescriptorSet",get:function(){return this._globalDescriptorSet},set:function(t){this._globalDescriptorSet=t}}]),t}(),oJt=new Kr,hJt=new Kr,uJt=new Kr,lJt=new Vn,cJt=new Vn(0,0,1,0),fJt=new ir,_Jt=Kr.toArray,dJt=Vn.toArray,pJt=cr.toArray,mJt=function(){function t(){this._globalUBO=new Float32Array(20),this._cameraUBO=new Float32Array(148),this._shadowUBO=new Float32Array(64),this._csmUBO=new Float32Array(164)}t.updateGlobalUBOView=function(t,e){var i=A.director,n=i.root,r=e,s=Math.floor(t.width),a=Math.floor(t.height);r[0]=n.cumulativeTime,r[1]=n.frameTime,r[2]=i.getTotalFrames(),r[3]=n.cumulativeTime-Math.floor(n.frameTime),r[4]=s,r[5]=a,r[6]=1/s,r[7]=1/a,r[8]=s,r[9]=a,r[10]=1/r[8],r[11]=1/r[9],A.internal.reflectionProbeManager&&(r[12]=A.internal.reflectionProbeManager.getMaxProbeId()+1);for(var o=n.debugView,h=0;h<=3;h++)r[16+h]=0;if(o.isEnabled()){r[16]=o.singleMode;for(var u=0;u<17;u++){var l=u%8;r[17+(u>>3)]+=(o.isCompositeModeEnabled(u)?1:0)*Math.pow(10,l)}r[19]+=(o.lightingWithAlbedo?1:0)*Math.pow(10,6),r[19]+=(o.csmLayerColoration?1:0)*Math.pow(10,7)}},t.updateCameraUBOView=function(t,e,i){var n,r=(i.scene?i.scene:A.director.getScene().renderScene).mainLight,s=t.pipelineSceneData,a=s.ambient,o=s.skybox,h=s.fog,u=s.shadows,l=e,c=i.exposure,f=s.isHDR;if(l[104]=s.shadingScale,l[105]=s.shadingScale,l[106]=1/l[104],l[107]=1/l[105],l[108]=c,l[109]=1/c,l[110]=f?1:0,l[111]=1/NM.standardExposureValue,r){var _=r.shadowEnabled&&u.type===WT.ShadowMap?1:0,d=r.direction;if(cJt.set(d.x,d.y,d.z,_),dJt(l,cJt,112),ir.toArray(l,r.color,116),r.useColorTemperature){var p=r.colorTemperatureRGB;l[116]*=p.x,l[117]*=p.y,l[118]*=p.z}l[119]=f?r.illuminance*c:r.illuminance}else cJt.set(0,0,1,0),dJt(l,cJt,112),dJt(l,Vn.ZERO,116);var m=a.skyColor;m.w=f?a.skyIllum*c:a.skyIllum,l[120]=m.x,l[121]=m.y,l[122]=m.z,l[123]=m.w,l[124]=a.groundAlbedo.x,l[125]=a.groundAlbedo.y,l[126]=a.groundAlbedo.z,l[127]=o.envmap?null==(n=o.envmap)?void 0:n.mipmapLevel:1,_Jt(l,i.matView,0),_Jt(l,i.node.worldMatrix,16),ir.toArray(l,i.position,96),_Jt(l,i.matProj,32),_Jt(l,i.matProjInv,48),_Jt(l,i.matViewProj,64),_Jt(l,i.matViewProjInv,80),l[99]=this.getCombineSignY(),l[100]=i.surfaceTransform,l[101]=i.cameraUsage,l[102]=Math.cos(nn(s.skybox.getRotationAngle())),l[103]=Math.sin(nn(s.skybox.getRotationAngle()));var g=h.colorArray;l[128]=g.x,l[129]=g.y,l[130]=g.z,l[131]=g.z,l[132]=h.fogStart,l[133]=h.fogEnd,l[134]=h.fogDensity,l[136]=h.fogTop,l[137]=h.fogRange,l[138]=h.fogAtten,l[140]=i.nearClip,l[141]=i.farClip,l[142]=i.getClipSpaceMinz(),l[144]=s.shadingScale*i.window.width*i.viewport.x,l[145]=s.shadingScale*i.window.height*i.viewport.y,l[146]=s.shadingScale*i.window.width*i.viewport.z,l[147]=s.shadingScale*i.window.height*i.viewport.w},t.getPCFRadius=function(t,e){var i=t.size.x;switch(e.shadowPcf){case jT.HARD:return 0;case jT.SOFT:return 1/(.5*i);case jT.SOFT_2X:return 2/(.5*i);case jT.SOFT_4X:return 3/(.5*i)}return 0},t.updatePlanarNormalAndDistance=function(t,e){ir.normalize(fJt,t.normal),e[60]=fJt.x,e[61]=fJt.y,e[62]=fJt.z,e[63]=-t.distance},t.updateShadowUBOView=function(e,i,n,r){var s=e.device,a=r.scene.mainLight,o=e.pipelineSceneData,h=o.shadows,u=o.csmLayers,l=i,c=n,f=o.csmSupported,_=jS(s)?0:1;if(a&&h.enabled){if(h.type===WT.ShadowMap){if(a.shadowEnabled){if(a.shadowFixedArea||a.csmLevel===qT.LEVEL_1||!f){var d=u.specialLayer.matShadowView,p=u.specialLayer.matShadowProj,m=u.specialLayer.matShadowViewProj,g=.1,y=0,v=0;a.shadowFixedArea?(g=a.shadowNear,y=a.shadowFar,v=0):(y=u.specialLayer.shadowCameraFar,v=1),_Jt(l,d,0),l[36]=p.m10,l[37]=p.m14,l[38]=p.m11,l[39]=p.m15,l[40]=p.m00,l[41]=p.m05,l[42]=1/p.m00,l[43]=1/p.m05,_Jt(l,m,16),lJt.set(g,y,0,1-a.shadowSaturation),dJt(l,lJt,44),lJt.set(0,_,a.shadowNormalBias,v),dJt(l,lJt,52)}else{for(var b=this.getPCFRadius(h,a),S=0;S<a.csmLevel;S++){var w=u.layers[S],x=w.matShadowView;lJt.set(x.m00,x.m04,x.m08,b),dJt(c,lJt,0+4*S),lJt.set(x.m01,x.m05,x.m09,w.splitCameraNear),dJt(c,lJt,16+4*S),lJt.set(x.m02,x.m06,x.m10,w.splitCameraFar),dJt(c,lJt,32+4*S);var T=w.csmAtlas;dJt(c,T,48+4*S);var A=w.matShadowViewProj;_Jt(c,A,64+16*S);var C=w.matShadowProj;c[128+4*S]=C.m10,c[129+4*S]=C.m14,c[130+4*S]=C.m11,c[131+4*S]=C.m15,c[144+4*S]=C.m00,c[145+4*S]=C.m05,c[146+4*S]=1/C.m00,c[147+4*S]=1/C.m05}lJt.set(a.csmTransitionRange,0,0,0),dJt(c,lJt,160),lJt.set(.1,a.shadowDistance,0,1-a.shadowSaturation),dJt(l,lJt,44),lJt.set(0,_,a.shadowNormalBias,a.csmLevel),dJt(l,lJt,52)}lJt.set(h.size.x,h.size.y,a.shadowPcf,a.shadowBias),dJt(l,lJt,48)}}else t.updatePlanarNormalAndDistance(h,l),lJt.set(0,0,0,h.planeBias),dJt(l,lJt,48);pJt(l,h.shadowColor,56)}},t.updateShadowUBOLightView=function(t,e,i,n){var r=t.device,s=t.pipelineSceneData,a=s.shadows,o=s.csmLayers,h=e,u=jS(r)?0:1,l=t.device.capabilities,c=s.csmSupported;switch(i.type){case 0:var f=i;if(a.enabled&&f&&f.shadowEnabled&&a.type===WT.ShadowMap){var _,d,p,m=.1,g=0,y=0;if(f.shadowFixedArea||f.csmLevel===qT.LEVEL_1||!c)_=o.specialLayer.matShadowView,d=o.specialLayer.matShadowProj,p=o.specialLayer.matShadowViewProj,f.shadowFixedArea?(m=f.shadowNear,g=f.shadowFar,y=0):(m=.1,g=o.specialLayer.shadowCameraFar,y=1),lJt.set(0,u,f.shadowNormalBias,0),dJt(h,lJt,52);else{var v=o.layers[n];_=v.matShadowView,d=v.matShadowProj,p=v.matShadowViewProj,m=v.splitCameraNear,g=v.splitCameraFar,y=f.csmLevel}_Jt(h,_,0),h[36]=d.m10,h[37]=d.m14,h[38]=d.m11,h[39]=d.m15,h[40]=d.m00,h[41]=d.m05,h[42]=1/d.m00,h[43]=1/d.m05,_Jt(h,p,16),lJt.set(m,g,0,1-f.shadowSaturation),dJt(h,lJt,44),lJt.set(0,u,f.shadowNormalBias,y),dJt(h,lJt,52),lJt.set(a.size.x,a.size.y,f.shadowPcf,f.shadowBias),dJt(h,lJt,48)}break;case 2:var b=i;a.enabled&&b&&b.shadowEnabled&&(Kr.invert(oJt,i.node.getWorldMatrix()),_Jt(h,oJt,0),Kr.perspective(hJt,b.angle,1,.001,b.range,!0,l.clipSpaceMinZ,l.clipSpaceSignY,0),Kr.multiply(uJt,hJt,oJt),_Jt(h,uJt,16),lJt.set(.01,i.range,0,0),dJt(h,lJt,44),lJt.set(a.size.x,a.size.y,b.shadowPcf,b.shadowBias),dJt(h,lJt,48),lJt.set(2,u,b.shadowNormalBias,0),dJt(h,lJt,52))}pJt(h,a.shadowColor,56)},t.getCombineSignY=function(){return t._combineSignY};var e=t.prototype;return e._initCombineSignY=function(){var e=this._device;t._combineSignY=.5*e.capabilities.screenSpaceSignY+.5<<1|.5*e.capabilities.clipSpaceSignY+.5},e.activate=function(t,e){this._device=t,this._pipeline=e;var i=this._pipeline.descriptorSet;if(!qS()){this._initCombineSignY();var n=t.createBuffer(new ud(18,3,80,80));i.bindBuffer(Db.BINDING,n);var r=t.createBuffer(new ud(18,3,592,592));i.bindBuffer(Bb.BINDING,r);var s=t.createBuffer(new ud(18,3,256,256));i.bindBuffer(Ib.BINDING,s);var a=t.createBuffer(new ud(18,3,656,656));i.bindBuffer(Mb.BINDING,a)}},e.updateGlobalUBO=function(e){var i=this._pipeline.globalDSManager,n=this._pipeline.descriptorSet,r=this._pipeline.commandBuffers;n.update(),t.updateGlobalUBOView(e,this._globalUBO),r[0].updateBuffer(n.getBuffer(Db.BINDING),this._globalUBO),i.bindBuffer(Db.BINDING,n.getBuffer(Db.BINDING)),i.update()},e.updateCameraUBO=function(e){var i=this._pipeline.globalDSManager,n=this._pipeline.descriptorSet,r=this._pipeline.commandBuffers;t.updateCameraUBOView(this._pipeline,this._cameraUBO,e),r[0].updateBuffer(n.getBuffer(Bb.BINDING),this._cameraUBO),i.bindBuffer(Bb.BINDING,n.getBuffer(Bb.BINDING)),i.update()},e.updateShadowUBO=function(e){var i=this._pipeline.pipelineSceneData;if(i.shadows.enabled){var n=this._pipeline.globalDSManager,r=this._pipeline.descriptorSet,s=this._pipeline.commandBuffers,a=i.shadowFrameBufferMap,o=e.scene.mainLight;o&&a.has(o)&&n.bindTexture(4,a.get(o).colorTextures[0]),t.updateShadowUBOView(this._pipeline,this._shadowUBO,this._csmUBO,e),n.update(),s[0].updateBuffer(r.getBuffer(Ib.BINDING),this._shadowUBO),s[0].updateBuffer(r.getBuffer(Mb.BINDING),this._csmUBO)}},e.updateShadowUBOLight=function(e,i,n){void 0===n&&(n=0),t.updateShadowUBOLightView(this._pipeline,this._shadowUBO,i,n),e.bindTexture(4,WS(this._pipeline.device)),e.bindTexture(6,WS(this._pipeline.device)),e.update(),this._pipeline.commandBuffers[0].updateBuffer(e.getBuffer(Ib.BINDING),this._shadowUBO)},e.updateShadowUBORange=function(t,e){e instanceof Kr?_Jt(this._shadowUBO,e,t):e instanceof cr&&pJt(this._shadowUBO,e,t)},e.destroy=function(){},t}();mJt._combineSignY=0;var gJt,yJt,vJt,bJt,SJt,wJt,xJt,TJt,AJt=t("hw",Kh("RenderStage")((tJt=function(){function t(){this._name=eJt&&eJt(),this._priority=iJt&&iJt(),this._enabled=!0,this._tag=nJt&&nJt(),this._pipeline=void 0,this._flow=void 0}var e=t.prototype;return e.initialize=function(t){return this._name=t.name,this._priority=t.priority,t.tag&&(this._tag=t.tag),!0},e.activate=function(t,e){this._pipeline=t,this._flow=e},n(t,[{key:"name",get:function(){return this._name}},{key:"priority",get:function(){return this._priority}},{key:"tag",get:function(){return this._tag}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}}]),t}(),eJt=zh(tJt.prototype,"_name",[uu],(function(){return""})),iJt=zh(tJt.prototype,"_priority",[uu],(function(){return 0})),nJt=zh(tJt.prototype,"_tag",[uu],(function(){return 0})),$Yt=tJt))||$Yt);A.RenderStage=AJt;var CJt,DJt,BJt,IJt,MJt,PJt,EJt=t("hv",(gJt=Kh("RenderFlow"),yJt=Ou([AJt]),gJt((bJt=function(){function t(){this._name=SJt&&SJt(),this._priority=wJt&&wJt(),this._tag=xJt&&xJt(),this._stages=TJt&&TJt(),this._pipeline=void 0}var e=t.prototype;return e.initialize=function(t){return this._name=t.name,this._priority=t.priority,this._stages=t.stages,t.tag&&(this._tag=t.tag),!0},e.activate=function(t){this._pipeline=t,this._stages.sort((function(t,e){return t.priority-e.priority}));for(var e=0,i=this._stages.length;e<i;e++)this._stages[e].activate(t,this)},e.render=function(t){for(var e=0,i=this._stages.length;e<i;e++)this._stages[e].enabled&&this._stages[e].render(t)},e.destroy=function(){for(var t=0,e=this._stages.length;t<e;t++)this._stages[t].destroy();this._stages.length=0},n(t,[{key:"name",get:function(){return this._name}},{key:"priority",get:function(){return this._priority}},{key:"tag",get:function(){return this._tag}},{key:"stages",get:function(){return this._stages}},{key:"pipeline",get:function(){return this._pipeline}}]),t}(),SJt=zh(bJt.prototype,"_name",[uu],(function(){return""})),wJt=zh(bJt.prototype,"_priority",[uu],(function(){return 0})),xJt=zh(bJt.prototype,"_tag",[uu],(function(){return 0})),TJt=zh(bJt.prototype,"_stages",[yJt,uu],(function(){return[]})),vJt=bJt))||vJt));A.RenderFlow=EJt;var OJt=new K_,kJt=new nd,RJt=function(){this.renderPass=null,this.sampler=null,this.prefiterTex=null,this.downsampleTexs=[],this.upsampleTexs=[],this.combineTex=null,this.prefilterFramebuffer=null,this.downsampleFramebuffers=[],this.upsampleFramebuffers=[],this.combineFramebuffer=null};function FJt(t){for(var e,i=666,n=p(t.colorTextures);!(e=n()).done;){var r=e.value,s=null==r?void 0:r.info;i=qf(s.type+"_"+s.usage+"_"+s.format+"_"+s.width+"_"+s.height+"_"+s.flags+"_\n "+s.layerCount+"_"+s.levelCount+"_"+s.samples+"_"+s.depth+"_"+s.externalRes,i)}if(t.depthStencilTexture){var a=t.depthStencilTexture.info;i=qf(a.type+"_"+a.usage+"_"+a.format+"_"+a.width+"_"+a.height+"_"+a.flags+"_\n "+a.layerCount+"_"+a.levelCount+"_"+a.samples+"_"+a.depth+"_"+a.externalRes,i)}return i}var LJt=t("hu",(CJt=Kh("cc.RenderPipeline"),DJt=Ou([EJt]),CJt((IJt=function(t){function e(e){var i;return(i=t.call(this,e)||this)._tag=MJt&&MJt(),i._flows=PJt&&PJt(),i._quadIB=null,i._quadVBOnscreen=null,i._quadVBOffscreen=null,i._quadIAOnscreen=null,i._quadIAOffscreen=null,i._eventProcessor=new NP,i._device=void 0,i._globalDSManager=void 0,i._descriptorSet=void 0,i._commandBuffers=[],i._pipelineUBO=new mJt,i._macros={},i._constantMacros="",i._profiler=null,i._geometryRenderer=null,i._pipelineRenderData=null,i._renderPasses=new Map,i._width=0,i._height=0,i._lastUsedRenderArea=new K_,i._clusterEnabled=!1,i._bloomEnabled=!1,i}s(e,t);var i=e.prototype;return i.getPipelineRenderData=function(){return this._pipelineRenderData},i.initialize=function(t){return this._flows=t.flows,t.tag&&(this._tag=t.tag),!0},i.createRenderPass=function(t,e,i){var n=this._device,r=new Id,s=new Md;r.format=e,s.format=i,s.stencilStoreOp=1,s.depthStoreOp=1,1&t||(8&t?r.loadOp=1:(r.loadOp=0,r.barrier=n.getGeneralBarrier(new Rd(2097152,2097152)))),6&~t&&(2&t||(s.depthLoadOp=0),4&t||(s.stencilLoadOp=0)),s.barrier=n.getGeneralBarrier(new Rd(4194304,4194304));var a=new Od([r],s);return n.createRenderPass(a)},i.getRenderPass=function(t,e){var i=qf(FJt(e)+"_"+t,666),n=this._renderPasses.get(i);return n||(n=this.createRenderPass(t,e.colorTextures[0].format,e.depthStencilTexture.format),this._renderPasses.set(i,n),n)},i.newFramebufferByRatio=function(t){for(var e=this.pipelineSceneData,i=this._width*e.shadingScale,n=this._height*e.shadingScale,r=t.colorTextures,s=0;s<r.length;s++)r[s].resize(i,n);t.depthStencilTexture&&t.depthStencilTexture.resize(i,n);var a=this._device.createFramebuffer(new Vd(t.renderPass,r,t.depthStencilTexture));return t.destroy(),a},i.generateRenderArea=function(t,e){var i=t.viewport,n=t.window.width,r=t.window.height;e.x=i.x*n,e.y=i.y*r,e.width=i.width*n,e.height=i.height*r},i.generateViewport=function(t,e){this.generateRenderArea(t,OJt),e||(e=kJt);var i=this.pipelineSceneData.shadingScale;return e.left=OJt.x*i,e.top=OJt.y*i,e.width=OJt.width*i,e.height=OJt.height*i,e},i.generateScissor=function(t,e){e||(e=OJt),this.generateRenderArea(t,e);var i=this.pipelineSceneData.shadingScale;return e.x*=i,e.y*=i,e.width*=i,e.height*=i,e},i.getMacroString=function(t){var e=this._macros[t];return void 0===e?"":e},i.getMacroInt=function(t){var e=this._macros[t];return void 0===e?0:e},i.getMacroBool=function(t){var e=this._macros[t];return void 0!==e&&e},i.setMacroString=function(t,e){this._macros[t]=e},i.setMacroInt=function(t,e){this._macros[t]=e},i.setMacroBool=function(t,e){this._macros[t]=e},i.activate=function(){this._device=Wp.gfxDevice,this._generateConstantMacros(),this._globalDSManager=new aJt(this._device),this._descriptorSet=this._globalDSManager.globalDescriptorSet,this._pipelineUBO.activate(this._device,this),this._macros.CC_USE_HDR=this._pipelineSceneData.isHDR,this._macros.CC_USE_DEBUG_VIEW=0,this._generateConstantMacros(),this._pipelineSceneData.activate(this._device);for(var t=0;t<this._flows.length;t++)this._flows[t].activate(this);return!0},i._ensureEnoughSize=function(){},i.render=function(t){if(0!==t.length){this.updateGeometryRenderer(t),this._commandBuffers[0].begin(),this.emit("render-frame-begin",t),this._ensureEnoughSize(t),NT(t);for(var e=0;e<t.length;e++){var i=t[e];if(i.scene){this.emit("render-camera-begin",i),KYt(this.pipelineSceneData,i),ZYt(this.pipelineSceneData,this.pipelineUBO,i),this._pipelineUBO.updateGlobalUBO(i.window),this._pipelineUBO.updateCameraUBO(i);for(var n=0;n<this._flows.length;n++)this._flows[n].render(i);this.emit("render-camera-end",i)}}this.emit("render-frame-end",t),this._commandBuffers[0].end(),this._device.queue.submit(this._commandBuffers)}},i._destroyQuadInputAssembler=function(){this._quadIB&&(this._quadIB.destroy(),this._quadIB=null),this._quadVBOnscreen&&(this._quadVBOnscreen.destroy(),this._quadVBOnscreen=null),this._quadVBOffscreen&&(this._quadVBOffscreen.destroy(),this._quadVBOffscreen=null),this._quadIAOnscreen&&(this._quadIAOnscreen.destroy(),this._quadIAOnscreen=null),this._quadIAOffscreen&&(this._quadIAOffscreen.destroy(),this._quadIAOffscreen=null)},i._destroyBloomData=function(){var t,e=this._pipelineRenderData.bloom;if(null!==e){e.prefiterTex&&e.prefiterTex.destroy(),e.prefilterFramebuffer&&e.prefilterFramebuffer.destroy();for(var i=0;i<e.downsampleTexs.length;++i)e.downsampleTexs[i].destroy(),e.downsampleFramebuffers[i].destroy();e.downsampleTexs.length=0,e.downsampleFramebuffers.length=0;for(var n=0;n<e.upsampleTexs.length;++n)e.upsampleTexs[n].destroy(),e.upsampleFramebuffers[n].destroy();e.upsampleTexs.length=0,e.upsampleFramebuffers.length=0,e.combineTex&&e.combineTex.destroy(),e.combineFramebuffer&&e.combineFramebuffer.destroy(),null==(t=e.renderPass)||t.destroy(),this._pipelineRenderData.bloom=null}},i._genQuadVertexData=function(t,e){var i=new Float32Array(16),n=e.x/this._width,r=(e.x+e.width)/this._width,s=e.y/this._height,a=(e.y+e.height)/this._height;if(this.device.capabilities.screenSpaceSignY>0){var o=a;a=s,s=o}var h=0;switch(t){case 0:h=0,i[h++]=-1,i[h++]=-1,i[h++]=n,i[h++]=a,i[h++]=1,i[h++]=-1,i[h++]=r,i[h++]=a,i[h++]=-1,i[h++]=1,i[h++]=n,i[h++]=s,i[h++]=1,i[h++]=1,i[h++]=r,i[h++]=s;break;case 1:h=0,i[h++]=-1,i[h++]=-1,i[h++]=r,i[h++]=a,i[h++]=1,i[h++]=-1,i[h++]=r,i[h++]=s,i[h++]=-1,i[h++]=1,i[h++]=n,i[h++]=a,i[h++]=1,i[h++]=1,i[h++]=n,i[h++]=s;break;case 2:h=0,i[h++]=-1,i[h++]=-1,i[h++]=n,i[h++]=s,i[h++]=1,i[h++]=-1,i[h++]=r,i[h++]=s,i[h++]=-1,i[h++]=1,i[h++]=n,i[h++]=a,i[h++]=1,i[h++]=1,i[h++]=r,i[h++]=a;break;case 3:h=0,i[h++]=-1,i[h++]=-1,i[h++]=n,i[h++]=s,i[h++]=1,i[h++]=-1,i[h++]=n,i[h++]=a,i[h++]=-1,i[h++]=1,i[h++]=r,i[h++]=s,i[h++]=1,i[h++]=1,i[h++]=r,i[h++]=a}return i},i._createQuadInputAssembler=function(){var t=new QE,e=this._device.createBuffer(new ud(10,3,64,16));if(!e)return t;var i=this._device.createBuffer(new ud(6,1,6,1));if(!i)return t;var n=new Uint8Array(6);n[0]=0,n[1]=1,n[2]=2,n[3]=1,n[4]=3,n[5]=2,i.update(n);var r=new Array(2);r[0]=new Cd("a_position",21),r[1]=new Cd("a_texCoord",21);var s=this._device.createInputAssembler(new Bd(r,[e],i));return t.quadIB=i,t.quadVB=e,t.quadIA=s,t},i.updateQuadVertexData=function(t,e){var i=this._lastUsedRenderArea;if(i.x!==t.x||i.y!==t.y||i.width!==t.width||i.height!==t.height){var n=this._genQuadVertexData(0,t);this._quadVBOffscreen.update(n);var r=this._genQuadVertexData(e.swapchain&&e.swapchain.surfaceTransform||0,t);this._quadVBOnscreen.update(r),i.copy(t)}},i.destroy=function(){for(var e,i,n=0;n<this._flows.length;n++)this._flows[n].destroy();this._flows.length=0,this._descriptorSet&&this._descriptorSet.destroy(),null==(e=this._globalDSManager)||e.destroy();for(var r=0;r<this._commandBuffers.length;r++)this._commandBuffers[r].destroy();return this._commandBuffers.length=0,this._pipelineUBO.destroy(),null==(i=this._pipelineSceneData)||i.destroy(),t.prototype.destroy.call(this)},i.onGlobalPipelineStateChanged=function(){},i._generateConstantMacros=function(){var t="";t+="#define CC_DEVICE_SUPPORT_FLOAT_TEXTURE "+(3&this.device.getFormatFeatures(44)?1:0)+"\n",t+="#define CC_ENABLE_CLUSTERED_LIGHT_CULLING "+(this._clusterEnabled?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 "+(Vo.os===Oo.ANDROID&&Vo.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 "+$b.JOINT_UNIFORM_CAPACITY+"\n",this._constantMacros=t},i.updateGeometryRenderer=function(t){if(!this._geometryRenderer)for(var e=0;e<t.length;e++){var i=t[e];if(i&&i.window&&i.window.swapchain)return i.initGeometryRenderer(),void(this._geometryRenderer=i.geometryRenderer)}},i.generateBloomRenderData=function(){if(null==this._pipelineRenderData.bloom){var t=this._pipelineRenderData.bloom=new RJt,e=this.device,i=new Id;i.format=35,i.loadOp=1,i.storeOp=0,i.barrier=e.getGeneralBarrier(new Rd(0,2097152)),t.renderPass=e.createRenderPass(new Od([i]));var n=this._width,r=this._height;t.prefiterTex=e.createTexture(new dd(1,20,35,n>>1,r>>1)),t.prefilterFramebuffer=e.createFramebuffer(new Vd(t.renderPass,[t.prefiterTex])),n>>=1,r>>=1;for(var s=0;s<6;++s)t.downsampleTexs.push(e.createTexture(new dd(1,20,35,n>>1,r>>1))),t.downsampleFramebuffers[s]=e.createFramebuffer(new Vd(t.renderPass,[t.downsampleTexs[s]])),t.upsampleTexs.push(e.createTexture(new dd(1,20,35,n,r))),t.upsampleFramebuffers[s]=e.createFramebuffer(new Vd(t.renderPass,[t.upsampleTexs[s]])),n>>=1,r>>=1;t.combineTex=e.createTexture(new dd(1,20,35,this._width,this._height)),t.combineFramebuffer=e.createFramebuffer(new Vd(t.renderPass,[t.combineTex])),t.sampler=this.globalDSManager.linearSampler}},i.on=function(t,e,i,n){return this._eventProcessor.on(t,e,i,n)},i.once=function(t,e,i){return this._eventProcessor.once(t,e,i)},i.off=function(t,e,i){this._eventProcessor.off(t,e,i)},i.emit=function(t,e,i,n,r,s){this._eventProcessor.emit(t,e,i,n,r,s)},i.targetOff=function(t){this._eventProcessor.targetOff(t)},i.removeAll=function(t){this._eventProcessor.removeAll(t)},i.hasEventListener=function(t,e,i){return this._eventProcessor.hasEventListener(t,e,i)},n(e,[{key:"tag",get:function(){return this._tag}},{key:"flows",get:function(){return this._flows}},{key:"quadIAOnscreen",get:function(){return this._quadIAOnscreen}},{key:"quadIAOffscreen",get:function(){return this._quadIAOffscreen}},{key:"constantMacros",get:function(){return this._constantMacros}},{key:"macros",get:function(){return this._macros}},{key:"device",get:function(){return this._device}},{key:"globalDSManager",get:function(){return this._globalDSManager}},{key:"descriptorSetLayout",get:function(){return this._globalDSManager.descriptorSetLayout}},{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"commandBuffers",get:function(){return this._commandBuffers}},{key:"pipelineUBO",get:function(){return this._pipelineUBO}},{key:"pipelineSceneData",get:function(){return this._pipelineSceneData}},{key:"profiler",get:function(){return this._profiler},set:function(t){this._profiler=t}},{key:"geometryRenderer",get:function(){return this._geometryRenderer}},{key:"clusterEnabled",get:function(){return this._clusterEnabled},set:function(t){this._clusterEnabled=t}},{key:"bloomEnabled",get:function(){return this._bloomEnabled},set:function(t){this._bloomEnabled=t}},{key:"shadingScale",get:function(){return this._pipelineSceneData.shadingScale},set:function(t){this._pipelineSceneData.shadingScale!==t&&(this._pipelineSceneData.shadingScale=t,this.emit("attachment-scale-changed",t))}}]),e}(Cm),MJt=zh(IJt.prototype,"_tag",[uu],(function(){return 0})),PJt=zh(IJt.prototype,"_flows",[DJt,uu],(function(){return[]})),BJt=IJt))||BJt));function VJt(t,e){return t.hash-e.hash||t.depth-e.depth||t.shaderId-e.shaderId}function NJt(t,e){return t.priority-e.priority||t.hash-e.hash||e.depth-t.depth||t.shaderId-e.shaderId}A.RenderPipeline=LJt,gt(LJt.prototype,"RenderPipeline.prototype",[{name:"geometryRenderer",suggest:"please use camera.geometryRenderer instead."}]);var zJt=function(){function t(t){this._passDesc=t,this._passPool=new uo((function(){return{priority:0,hash:0,depth:0,shaderId:0,subModel:null,passIdx:0}}),64),this.queue=new lo(64,this._passDesc.sortFunc)}var e=t.prototype;return e.clear=function(){this.queue.clear(),this._passPool.reset()},e.insertRenderPass=function(t,e,i){var n=t.model.subModels[e],r=n.passes[i],s=n.shaders[i];if(r.blendState.targets[0].blend!==this._passDesc.isTransparent||!(r.phase&this._passDesc.phases))return!1;var a=r.priority<<16|n.priority<<8|i,o=this._passPool.add();return o.priority=t.model.priority,o.hash=a,o.depth=t.depth||0,o.shaderId=s.typedID,o.subModel=n,o.passIdx=i,this.queue.push(o),!0},e.sort=function(){this.queue.sort()},e.recordCommandBuffer=function(t,e,i){for(var n=0;n<this.queue.length;++n){var r=this.queue.array[n],s=r.subModel,a=r.passIdx,o=s.inputAssembler,h=s.passes[a],u=s.shaders[a],l=AT.getOrCreatePipelineState(t,h,u,e,o);i.bindPipelineState(l),i.bindDescriptorSet(1,h.descriptorSet),i.bindDescriptorSet(2,s.descriptorSet),i.bindInputAssembler(o),i.draw(o)}},t}();function UJt(t){for(var e=0,i=0;i<t.stages.length;i++)e|=gT(t.stages[i]);var n=VJt;switch(t.sortMode){case 1:n=NJt;break;case 0:n=VJt}return new zJt({isTransparent:t.isTransparent,phases:e,sortFunc:n})}function GJt(t){t.clear()}function HJt(t){t.sort()}var WJt=function(){function t(){this.queue=new Set,this._renderQueue=[]}var e=t.prototype;return e.clear=function(){for(var t=this.queue.values(),e=t.next();!e.done;)e.value.clear(),e=t.next();this._renderQueue.length=0,this.queue.clear()},e.sort=function(){for(var t=this.queue.values(),e=t.next();!e.done;)e.value.pass.blendState.targets[0].blend||this._renderQueue.push(e.value),e=t.next();for(e=(t=this.queue.values()).next();!e.done;)e.value.pass.blendState.targets[0].blend&&this._renderQueue.push(e.value),e=t.next()},e.uploadBuffers=function(t){for(var e=this.queue.values(),i=e.next();!i.done;)i.value.hasPendingModels&&i.value.uploadBuffers(t),i=e.next()},e.recordCommandBuffer=function(t,e,i,n,r){void 0===n&&(n=null);for(var s=0===this._renderQueue.length?this.queue.values():this._renderQueue[Symbol.iterator](),a=s.next();!a.done;){var o=a.value,h=o.instances,u=o.pass;if(o.hasPendingModels){i.bindDescriptorSet(1,u.descriptorSet);for(var l=null,c=0;c<h.length;++c){var f=h[c];if(f.count){var _=f.shader,d=AT.getOrCreatePipelineState(t,u,_,e,f.ia);l!==d&&(i.bindPipelineState(d),l=d),n&&i.bindDescriptorSet(0,n),r?i.bindDescriptorSet(2,f.descriptorSet,r):i.bindDescriptorSet(2,f.descriptorSet,a.value.dynamicOffsets),i.bindInputAssembler(f.ia),i.draw(f.ia)}}}a=s.next()}},t}(),jJt=new ho((function(){return{subModel:null,passIdx:-1,dynamicOffsets:[],lights:[]}}),16),qJt=new ir,XJt=new Float32Array(4),YJt=[],JJt=[],KJt=new Kr,QJt=new Kr,ZJt=new gh(0,0,0,.5,.5,.5),$Jt=new gh;function tKt(t,e){return!(!e.worldBounds||Za.aabbWithAABB(e.worldBounds,t.aabb))}function eKt(t,e){return!(!e.worldBounds||Za.aabbWithAABB(e.worldBounds,t.aabb)&&Za.aabbFrustum(e.worldBounds,t.frustum))}function iKt(t,e){return!(!e.worldBounds||Za.aabbWithAABB(e.worldBounds,t.aabb))}function nKt(t,e){return gh.transform($Jt,ZJt,t.node.getWorldMatrix()),!(!e.worldBounds||Za.aabbWithAABB(e.worldBounds,$Jt))}var rKt="forward-add",sKt=gT(rKt),aKt=[];function oKt(t,e,i){void 0===i&&(i="default");var n=A.rendering;qS()&&(sKt=n.getPhaseID(n.getPassID(i),rKt)),e.length=0;for(var r=!1,s=0;s<t.length;s++){for(var a=t[s].passes,o=-1,h=0;h<a.length;h++)if((!n||!n.enableEffectImport)&&a[h].phase===sKt||qS()&&a[h].phaseID===sKt){o=h,r=!0;break}e.push(o)}return r}var hKt,uKt,lKt,cKt,fKt,_Kt,dKt,pKt,mKt,gKt,yKt,vKt,bKt,SKt,wKt,xKt,TKt,AKt,CKt,DKt,BKt,IKt,MKt,PKt,EKt,OKt,kKt,RKt,FKt,LKt,VKt,NKt,zKt,UKt,GKt,HKt,WKt,jKt,qKt,XKt,YKt,JKt,KKt,QKt,ZKt,$Kt,tQt,eQt,iQt,nQt,rQt,sQt,aQt,oQt,hQt,uQt,lQt,cQt,fQt,_Qt,dQt,pQt,mQt,gQt,yQt,vQt,bQt,SQt,wQt,xQt,TQt,AQt,CQt,DQt,BQt,IQt,MQt,PQt,EQt=function(){function t(t){this._lightPasses=[],this._instancedLightPassPool=jJt.alloc(),this._shadowUBO=new Float32Array(64),this._lightBufferCount=16,this._instancedQueues=[],this._lightMeterScale=1e4,this._pipeline=t,this._device=t.device;var e=this._device.capabilities.uboOffsetAlignment;this._lightBufferStride=Math.ceil(80/e)*e,this._lightBufferElementCount=this._lightBufferStride/4,this._lightBuffer=this._device.createBuffer(new ud(18,3,this._lightBufferStride*this._lightBufferCount,this._lightBufferStride)),this._firstLightBufferView=this._device.createBuffer(new ld(this._lightBuffer,0,80)),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount)}var e=t.prototype;return e.clear=function(){this._instancedQueues.forEach((function(t){t.clear()})),this._instancedQueues.length=0;for(var t=0;t<this._lightPasses.length;t++){var e=this._lightPasses[t];e.dynamicOffsets.length=0,e.lights.length=0}jJt.freeArray(this._lightPasses),this._lightPasses.length=0,this._instancedLightPassPool.dynamicOffsets.length=0,this._instancedLightPassPool.lights.length=0},e.destroy=function(){for(var t=this._pipeline.globalDSManager.descriptorSetMap,e=t.keys,i=0;i<e.length;i++){var n=e[i],r=t.get(n);r&&(r.getBuffer(Ib.BINDING).destroy(),r.getTexture(4).destroy(),r.getTexture(6).destroy(),r.destroy()),t.delete(n)}},e._bindForwardAddLight=function(t,e){void 0===e&&(e="default");for(var i=this._pipeline.pipelineSceneData.renderObjects,n=0;n<i.length;n++){var r=i[n].model,s=r.subModels;if(oKt(s,aKt,e)&&(JJt.length=0,this._lightCulling(r,t),JJt.length||!(t.length>0)))for(var a=0;a<s.length;a++){var o=aKt[a];if(!(o<0)){var h=s[a],u=h.passes[o];h.passes[0].blendState.targets[0].blend||(h.descriptorSet.bindBuffer(Yb.BINDING,this._firstLightBufferView),h.descriptorSet.update(),this._addRenderQueue(u,h,r,o))}}}},e.gatherLightPasses=function(t,e,i){void 0===i&&(i="default"),this.clear();var n=this._pipeline.pipelineSceneData.validPunctualLights;if(n.length){this._updateUBOs(t,e),this._updateLightDescriptorSet(t,e),this._bindForwardAddLight(n,i);for(var r=0;r<n.length;r++){var s=n[r];this._instancedLightPassPool.lights.push(s),this._instancedLightPassPool.dynamicOffsets.push(this._lightBufferStride*r)}this._instancedQueues.forEach((function(t){t.uploadBuffers(e)}))}else this._bindForwardAddLight(n,i)},e.recordCommandBuffer=function(t,e,i){for(var n=this._pipeline.globalDSManager,r=0;r<this._instancedQueues.length;++r){var s=this._instancedLightPassPool.lights[r];YJt[0]=this._instancedLightPassPool.dynamicOffsets[r];var a=n.getOrCreateDescriptorSet(s);this._instancedQueues[r].recordCommandBuffer(t,e,i,a,YJt)}for(var o=0;o<this._lightPasses.length;o++){var h=this._lightPasses[o],u=h.subModel,l=h.passIdx,c=h.dynamicOffsets,f=h.lights,_=u.passes[l],d=u.shaders[l],p=u.inputAssembler,m=AT.getOrCreatePipelineState(t,_,d,e,p),g=_.descriptorSet,y=u.descriptorSet;i.bindPipelineState(m),i.bindDescriptorSet(1,g),i.bindInputAssembler(p);for(var v=0;v<c.length;++v){var b=f[v],S=n.getOrCreateDescriptorSet(b);YJt[0]=c[v],i.bindDescriptorSet(0,S),i.bindDescriptorSet(2,y,YJt),i.draw(p)}}},e._lightCulling=function(t,e){for(var i=!1,n=0;n<e.length;n++){var r=e[n];switch(r.type){case 1:i=tKt(r,t);break;case 2:i=eKt(r,t);break;case 3:i=iKt(r,t);break;case 4:i=nKt(r,t)}i||JJt.push(n)}},e._addRenderQueue=function(t,e,i,n){var r=this._pipeline.pipelineSceneData.validPunctualLights,s=t.batchingScheme,a=null;0===s&&((a=jJt.alloc()).subModel=e,a.passIdx=n);for(var o=0;o<JJt.length;o++){var h=JJt[o],u=r[h];if((u.visibility&i.node.layer)===i.node.layer)if(1===s){var l=t.getInstancedBuffer(o);l.merge(e,n),l.dynamicOffsets[0]=this._lightBufferStride,this._instancedQueues[o]||(this._instancedQueues[o]=new WJt),this._instancedQueues[o].queue.add(l)}else a.lights.push(u),a.dynamicOffsets.push(this._lightBufferStride*h)}0===s&&this._lightPasses.push(a)},e._updateLightDescriptorSet=function(t,e){for(var i=this._pipeline.device,n=this._pipeline.pipelineSceneData,r=n.shadows,s=n.shadowFrameBufferMap,a=t.scene.mainLight,o=jS(i)?0:1,h=this._pipeline.globalDSManager,u=n.validPunctualLights,l=this._pipeline.device.capabilities,c=0;c<u.length;c++){var f=u[c],_=h.getOrCreateDescriptorSet(f);if(_){var d=void 0,p=void 0;switch(f.type){case 1:a&&mJt.updatePlanarNormalAndDistance(r,this._shadowUBO),this._shadowUBO[48]=r.size.x,this._shadowUBO[49]=r.size.y,this._shadowUBO[50]=1,this._shadowUBO[51]=0,this._shadowUBO[52]=1,this._shadowUBO[53]=o,this._shadowUBO[54]=0,this._shadowUBO[55]=0,cr.toArray(this._shadowUBO,r.shadowColor,56);break;case 2:var m=f;if(a&&mJt.updatePlanarNormalAndDistance(r,this._shadowUBO),Kr.invert(KJt,f.node.getWorldMatrix()),Kr.perspective(QJt,f.angle,1,.001,f.range,!0,l.clipSpaceMinZ,l.clipSpaceSignY,0),d=QJt.clone(),p=QJt.clone().invert(),Kr.multiply(QJt,QJt,KJt),Kr.toArray(this._shadowUBO,KJt,0),Kr.toArray(this._shadowUBO,QJt,16),this._shadowUBO[44]=.01,this._shadowUBO[45]=f.range,this._shadowUBO[46]=0,this._shadowUBO[47]=0,this._shadowUBO[48]=r.size.x,this._shadowUBO[49]=r.size.y,this._shadowUBO[50]=m.shadowPcf,this._shadowUBO[51]=m.shadowBias,this._shadowUBO[52]=2,this._shadowUBO[53]=o,this._shadowUBO[54]=m.shadowNormalBias,this._shadowUBO[55]=0,this._shadowUBO[36]=d.m10,this._shadowUBO[37]=d.m14,this._shadowUBO[38]=d.m11,this._shadowUBO[39]=d.m15,this._shadowUBO[32]=p.m10,this._shadowUBO[33]=p.m14,this._shadowUBO[34]=p.m11,this._shadowUBO[35]=p.m15,this._shadowUBO[40]=d.m00,this._shadowUBO[41]=d.m05,this._shadowUBO[42]=1/d.m00,this._shadowUBO[43]=1/d.m05,cr.toArray(this._shadowUBO,r.shadowColor,56),s.has(f)){var g,y=null==(g=s.get(f))?void 0:g.colorTextures[0];y&&h.bindTexture(6,y)}break;case 3:a&&mJt.updatePlanarNormalAndDistance(r,this._shadowUBO),this._shadowUBO[48]=r.size.x,this._shadowUBO[49]=r.size.y,this._shadowUBO[50]=1,this._shadowUBO[51]=0,this._shadowUBO[52]=3,this._shadowUBO[53]=o,this._shadowUBO[54]=0,this._shadowUBO[55]=0,cr.toArray(this._shadowUBO,r.shadowColor,56)}h.update(),e.updateBuffer(_.getBuffer(Ib.BINDING),this._shadowUBO)}}},e._updateUBOs=function(t,e){var i=t.exposure,n=this._pipeline.pipelineSceneData,r=n.isHDR,s=n.shadows,a=n.validPunctualLights;a.length>this._lightBufferCount&&(this._firstLightBufferView.destroy(),this._lightBufferCount=fn(a.length),this._lightBuffer.resize(this._lightBufferStride*this._lightBufferCount),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount),this._firstLightBufferView=Wp.gfxDevice.createBuffer(new ld(this._lightBuffer,0,80)));for(var o=0,h=0;o<a.length;o++,h+=this._lightBufferElementCount){var u=a[o];switch(u.type){case 1:if(ir.toArray(XJt,u.position),XJt[3]=1,this._lightBufferData.set(XJt,h+0),XJt[0]=u.size,XJt[1]=u.range,XJt[2]=0,XJt[3]=0,this._lightBufferData.set(XJt,h+8),ir.toArray(XJt,u.color),u.useColorTemperature){var l=u.finalColor;XJt[0]=l.x,XJt[1]=l.y,XJt[2]=l.z}XJt[3]=r?u.luminance*i*this._lightMeterScale:u.luminance,this._lightBufferData.set(XJt,h+4);break;case 2:if(ir.toArray(XJt,u.position),XJt[3]=2,this._lightBufferData.set(XJt,h+0),XJt[0]=u.size,XJt[1]=u.range,XJt[2]=u.spotAngle,XJt[3]=s.enabled&&u.shadowEnabled&&s.type===WT.ShadowMap?1:0,this._lightBufferData.set(XJt,h+8),ir.toArray(XJt,u.direction),this._lightBufferData.set(XJt,h+12),ir.toArray(XJt,u.color),u.useColorTemperature){var c=u.finalColor;XJt[0]=c.x,XJt[1]=c.y,XJt[2]=c.z}XJt[3]=r?u.luminance*i*this._lightMeterScale:u.luminance,this._lightBufferData.set(XJt,h+4),XJt[0]=0,XJt[1]=0,XJt[2]=0,XJt[3]=u.angleAttenuationStrength,this._lightBufferData.set(XJt,h+16);break;case 3:if(ir.toArray(XJt,u.position),XJt[3]=3,this._lightBufferData.set(XJt,h+0),XJt[0]=0,XJt[1]=u.range,XJt[2]=0,XJt[3]=0,this._lightBufferData.set(XJt,h+8),ir.toArray(XJt,u.color),u.useColorTemperature){var f=u.finalColor;XJt[0]=f.x,XJt[1]=f.y,XJt[2]=f.z}XJt[3]=r?u.luminance*i*this._lightMeterScale:u.luminance,this._lightBufferData.set(XJt,h+4);break;case 4:ir.toArray(XJt,u.position),XJt[3]=4,this._lightBufferData.set(XJt,h+0),ir.toArray(XJt,u.right),XJt[3]=0,this._lightBufferData.set(XJt,h+8),ir.toArray(XJt,u.direction),XJt[3]=0,this._lightBufferData.set(XJt,h+12);var _=u.scale;if(qJt.set(.5*_.x,.5*_.y,.5*_.z),ir.toArray(XJt,qJt),XJt[3]=0,this._lightBufferData.set(XJt,h+16),ir.toArray(XJt,u.color),u.useColorTemperature){var d=u.finalColor;XJt[0]=d.x,XJt[1]=d.y,XJt[2]=d.z}XJt[3]=r?u.illuminance*i:u.illuminance,this._lightBufferData.set(XJt,h+4)}}e.updateBuffer(this._lightBuffer,this._lightBufferData)},t}();Re(__),Re(p_),Re(I_),Re(B_),Re(M_),Re(s_),Re({SCENE:0,POSTPROCESS:1,UI:2}),hKt=Kh("RenderTextureDesc"),uKt=Ou(__),lKt=Ou(p_),cKt=Ou(s_),hKt((fKt=function(){this.name=_Kt&&_Kt(),this.type=dKt&&dKt(),this.usage=pKt&&pKt(),this.format=mKt&&mKt(),this.width=gKt&&gKt(),this.height=yKt&&yKt()},_Kt=zh(fKt.prototype,"name",[uu],(function(){return""})),dKt=zh(fKt.prototype,"type",[uKt],(function(){return 1})),pKt=zh(fKt.prototype,"usage",[lKt],(function(){return 16})),mKt=zh(fKt.prototype,"format",[cKt],(function(){return 0})),gKt=zh(fKt.prototype,"width",[uu],(function(){return-1})),yKt=zh(fKt.prototype,"height",[uu],(function(){return-1})),fKt));var OQt=(vKt=Kh("RenderTextureConfig"),bKt=Ou(wP),vKt((wKt=function(){this.name=xKt&&xKt(),this.texture=TKt&&TKt()},xKt=zh(wKt.prototype,"name",[uu],(function(){return""})),TKt=zh(wKt.prototype,"texture",[bKt],(function(){return null})),SKt=wKt))||SKt);AKt=Kh("MaterialConfig"),CKt=Ou(GT),AKt((DKt=function(){this.name=BKt&&BKt(),this.material=IKt&&IKt()},BKt=zh(DKt.prototype,"name",[uu],(function(){return""})),IKt=zh(DKt.prototype,"material",[CKt],(function(){return null})),DKt)),MKt=Kh("FrameBufferDesc"),PKt=Ou([_i]),EKt=Ou(wP),MKt((OKt=function(){this.name=kKt&&kKt(),this.renderPass=RKt&&RKt(),this.colorTextures=FKt&&FKt(),this.depthStencilTexture=LKt&&LKt(),this.texture=VKt&&VKt()},kKt=zh(OKt.prototype,"name",[uu],(function(){return""})),RKt=zh(OKt.prototype,"renderPass",[uu],(function(){return 0})),FKt=zh(OKt.prototype,"colorTextures",[PKt],(function(){return[]})),LKt=zh(OKt.prototype,"depthStencilTexture",[uu],(function(){return""})),VKt=zh(OKt.prototype,"texture",[EKt],(function(){return null})),OKt));var kQt=(NKt=Kh("ColorDesc"),zKt=Ou(s_),UKt=Ou(B_),GKt=Ou(I_),HKt=Ou(M_),WKt=Ou(M_),NKt((qKt=function(){this.format=XKt&&XKt(),this.loadOp=YKt&&YKt(),this.storeOp=JKt&&JKt(),this.sampleCount=KKt&&KKt(),this.beginAccesses=QKt&&QKt(),this.endAccesses=ZKt&&ZKt()},XKt=zh(qKt.prototype,"format",[zKt],(function(){return 0})),YKt=zh(qKt.prototype,"loadOp",[UKt],(function(){return 1})),JKt=zh(qKt.prototype,"storeOp",[GKt],(function(){return 0})),KKt=zh(qKt.prototype,"sampleCount",[uu],(function(){return 1})),QKt=zh(qKt.prototype,"beginAccesses",[HKt],(function(){return 0})),ZKt=zh(qKt.prototype,"endAccesses",[WKt],(function(){return 2097152})),jKt=qKt))||jKt),RQt=($Kt=Kh("DepthStencilDesc"),tQt=Ou(s_),eQt=Ou(B_),iQt=Ou(I_),nQt=Ou(B_),rQt=Ou(I_),sQt=Ou(M_),aQt=Ou(M_),$Kt((hQt=function(){this.format=uQt&&uQt(),this.depthLoadOp=lQt&&lQt(),this.depthStoreOp=cQt&&cQt(),this.stencilLoadOp=fQt&&fQt(),this.stencilStoreOp=_Qt&&_Qt(),this.sampleCount=dQt&&dQt(),this.beginAccesses=pQt&&pQt(),this.endAccesses=mQt&&mQt()},uQt=zh(hQt.prototype,"format",[tQt],(function(){return 0})),lQt=zh(hQt.prototype,"depthLoadOp",[eQt],(function(){return 1})),cQt=zh(hQt.prototype,"depthStoreOp",[iQt],(function(){return 0})),fQt=zh(hQt.prototype,"stencilLoadOp",[nQt],(function(){return 1})),_Qt=zh(hQt.prototype,"stencilStoreOp",[rQt],(function(){return 0})),dQt=zh(hQt.prototype,"sampleCount",[uu],(function(){return 1})),pQt=zh(hQt.prototype,"beginAccesses",[sQt],(function(){return 0})),mQt=zh(hQt.prototype,"endAccesses",[aQt],(function(){return 4194304})),oQt=hQt))||oQt);gQt=Kh("RenderPassDesc"),yQt=Ou([kQt]),vQt=Ou(RQt),gQt((bQt=function(){this.index=SQt&&SQt(),this.colorAttachments=wQt&&wQt(),this.depthStencilAttachment=xQt&&xQt()},SQt=zh(bQt.prototype,"index",[uu],(function(){return-1})),wQt=zh(bQt.prototype,"colorAttachments",[yQt],(function(){return[]})),xQt=zh(bQt.prototype,"depthStencilAttachment",[vQt],(function(){return new RQt})),bQt));var FQt={FRONT_TO_BACK:0,BACK_TO_FRONT:1};Re(FQt);var LQt=(TQt=Kh("RenderQueueDesc"),AQt=Ou(FQt),CQt=Ou([_i]),TQt((BQt=function(){this.isTransparent=IQt&&IQt(),this.sortMode=MQt&&MQt(),this.stages=PQt&&PQt()},IQt=zh(BQt.prototype,"isTransparent",[uu],(function(){return!1})),MQt=zh(BQt.prototype,"sortMode",[AQt],(function(){return 0})),PQt=zh(BQt.prototype,"stages",[CQt],(function(){return[]})),DQt=BQt))||DQt),VQt=new gh,NQt=gT("planar-shadow");function zQt(t){var e=t.passes,i=A.rendering;qS()&&(NQt=i.getPhaseID(i.getPassID("default"),"planar-shadow"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===NQt||qS()&&e[n].phaseID===NQt)return n;return-1}var UQt,GQt,HQt,WQt,jQt,qQt,XQt,YQt,JQt=function(){function t(t){this._subModelArray=[],this._shaderArray=[],this._passArray=[],this._castModels=[],this._instancedQueue=new WJt,this._pipeline=void 0,this._pipeline=t}var e=t.prototype;return e.clear=function(){this._subModelArray.length=0,this._shaderArray.length=0,this._passArray.length=0,this._instancedQueue.clear(),this._castModels.length=0},e.gatherShadowPasses=function(t,e){this.clear();var i=this._pipeline.pipelineSceneData.shadows;if(i.enabled&&i.type===WT.Planar&&!(i.normal.length()<1e-6)){var n=t.scene,r=t.frustum,s=!!(t.visibility&Ly.BitMask.DEFAULT);if(n.mainLight&&s){for(var a=n.models,o=t.visibility,h=0;h<a.length;h++){var u=a[h];n.isCulledByLod(t,u)||u.enabled&&u.node&&u.castShadow&&u.node&&(o&u.node.layer)===u.node.layer&&this._castModels.push(u)}for(var l=0;l<this._castModels.length;l++){var c=this._castModels[l];if(!c.worldBounds||(gh.transform(VQt,c.worldBounds,i.matLight),Za.aabbFrustum(VQt,r)))for(var f=c.subModels,_=0;_<f.length;_++){var d=f[_],p=zQt(d);if(p<0){this._subModelArray.push(d);var m=i.getPlanarShader(d.patches);if(!m)continue;this._shaderArray.push(m),this._passArray.push(i.material.passes[0])}else{var g=d.passes[p];if(1===g.batchingScheme){var y=g.getInstancedBuffer();y.merge(d,p),this._instancedQueue.queue.add(y)}else{var v=d.shaders[p];this._subModelArray.push(d),v&&this._shaderArray.push(v),this._passArray.push(g)}}}}this._instancedQueue.uploadBuffers(e)}}},e.recordCommandBuffer=function(t,e,i){var n=this._pipeline.pipelineSceneData.shadows;if(n.enabled&&n.type===WT.Planar){this._instancedQueue.recordCommandBuffer(t,e,i);for(var r=0;r<this._subModelArray.length;++r){var s=this._subModelArray[r],a=this._shaderArray[r],o=this._passArray[r],h=s.inputAssembler,u=AT.getOrCreatePipelineState(t,o,a,e,h),l=o.descriptorSet;i.bindPipelineState(u),i.bindDescriptorSet(1,l),i.bindDescriptorSet(2,s.descriptorSet),i.bindInputAssembler(h),i.draw(h)}}},t}(),KQt=function(){function t(){this._phaseID=gT("default");var t=A.rendering;qS()&&(this._phaseID=t.getPhaseID(t.getPassID("default"),"default"))}var e=t.prototype;return e.activate=function(t){this._pipeline=t},e.render=function(t,e){for(var i=this._pipeline,n=i.device,r=i.commandBuffers[0],s=t.scene.batches,a=0;a<s.length;a++){var o=s[a],h=!1;if(t.visibility&o.visFlags&&(h=!0),h)for(var u=o.shaders.length,l=0;l<u;l++){var c=o.passes[l];if(c.phase===this._phaseID){var f=o.shaders[l],_=o.inputAssembler,d=AT.getOrCreatePipelineState(n,c,f,e,_);r.bindPipelineState(d),r.bindDescriptorSet(1,c.descriptorSet);var p=o.descriptorSet;r.bindDescriptorSet(2,p),r.bindInputAssembler(_),r.draw(_)}}}},t}(),QQt=[new rd(0,0,0,1)],ZQt=t("hj",(UQt=Kh("ForwardStage"),GQt=Ou([LQt]),UQt((qQt=function(t){function e(){var e;return(e=t.call(this)||this).renderQueues=jQt&&jQt(),e._renderQueues=[],e._renderArea=new K_,e._instancedQueue=new WJt,e._phaseID=gT("default"),e._clearFlag=4294967295,e._uiPhase=new KQt,e.additiveInstanceQueues=[],e}s(e,t);var i=e.prototype;return i.addRenderInstancedQueue=function(t){this.additiveInstanceQueues.includes(t)||this.additiveInstanceQueues.push(t)},i.removeRenderInstancedQueue=function(t){var e=this.additiveInstanceQueues.indexOf(t);e>-1&&this.additiveInstanceQueues.splice(e,1)},i.initialize=function(e){return t.prototype.initialize.call(this,e),e.renderQueues&&(this.renderQueues=e.renderQueues),!0},i.activate=function(e,i){t.prototype.activate.call(this,e,i);for(var n=0;n<this.renderQueues.length;n++)this._renderQueues[n]=UJt(this.renderQueues[n]);this._additiveLightQueue=new EQt(this._pipeline),this._planarQueue=new JQt(this._pipeline),this._uiPhase.activate(e)},i.destroy=function(){},i.render=function(t){var e,i=this._pipeline,n=i.device;this._instancedQueue.clear(),this._renderQueues.forEach(GJt);for(var r=i.pipelineSceneData.renderObjects,s=0,a=0,o=0,h=0;h<r.length;++h){var u=r[h],l=u.model.subModels;for(s=0;s<l.length;++s){var c=l[s],f=c.passes;for(a=0;a<f.length;++a){var _=f[a];if(_.phase===this._phaseID&&4294967295===_.passID)if(1===_.batchingScheme){var d=_.getInstancedBuffer();d.merge(c,a),this._instancedQueue.queue.add(d)}else for(o=0;o<this._renderQueues.length;o++)this._renderQueues[o].insertRenderPass(u,s,a)}}}this._instancedQueue.sort(),this._renderQueues.forEach(HJt);var p=i.commandBuffers[0];i.pipelineUBO.updateShadowUBO(t);for(var m=0;m<this.additiveInstanceQueues.length;m++)this.additiveInstanceQueues[m].uploadBuffers(p);this._instancedQueue.uploadBuffers(p),this._additiveLightQueue.gatherLightPasses(t,p),this._planarQueue.gatherShadowPasses(t,p),1&t.clearFlag&&(QQt[0].x=t.clearColor.x,QQt[0].y=t.clearColor.y,QQt[0].z=t.clearColor.z,QQt[0].w=t.clearColor.w),i.generateRenderArea(t,this._renderArea);var g=t.window.framebuffer,y=i.getRenderPass(t.clearFlag&this._clearFlag,g);p.beginRenderPass(y,g,this._renderArea,QQt,t.clearDepth,t.clearStencil),p.bindDescriptorSet(0,i.descriptorSet),this._renderQueues[0].recordCommandBuffer(n,y,p);for(var v=0;v<this.additiveInstanceQueues.length;v++)this.additiveInstanceQueues[v].recordCommandBuffer(n,y,p);this._instancedQueue.recordCommandBuffer(n,y,p),this._additiveLightQueue.recordCommandBuffer(n,y,p),p.bindDescriptorSet(0,i.descriptorSet),this._planarQueue.recordCommandBuffer(n,y,p),this._renderQueues[1].recordCommandBuffer(n,y,p),null==(e=t.geometryRenderer)||e.render(y,p,i.pipelineSceneData),this._uiPhase.render(t,y),zT(n,y,p,i.profiler,t),p.endRenderPass()},e}(AJt),qQt.initInfo={name:"ForwardStage",priority:10,tag:0,renderQueues:[{isTransparent:!1,sortMode:0,stages:["default"]},{isTransparent:!0,sortMode:1,stages:["default","planarShadow"]}]},jQt=zh((WQt=qQt).prototype,"renderQueues",[GQt,uu],(function(){return[]})),HQt=WQt))||HQt)),$Qt=t("hi",Kh("ForwardFlow")((YQt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._stages.length){var i=new ZQt;i.initialize(ZQt.initInfo),this._stages.push(i)}return!0},i.activate=function(e){t.prototype.activate.call(this,e)},i.render=function(e){t.prototype.render.call(this,e)},i.destroy=function(){t.prototype.destroy.call(this)},e}(EJt),YQt.initInfo={name:Sb,priority:1,stages:[]},XQt=YQt))||XQt),tZt=gT("shadow-caster");function eZt(t){var e=t.passes,i=A.rendering;qS()&&(tZt=i.getPhaseID(i.getPassID("default"),"shadow-caster"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===tZt||qS()&&e[n].phaseID===tZt)return n;return-1}var iZt,nZt,rZt,sZt,aZt=function(){function t(t){this._subModelsArray=[],this._passArray=[],this._shaderArray=[],this._instancedQueue=new WJt,this._pipeline=t}var e=t.prototype;return e.gatherLightPasses=function(t,e,i,n){void 0===n&&(n=0),this.clear();var r=this._pipeline.pipelineSceneData,s=r.shadows;if(e&&s.enabled&&s.type===WT.ShadowMap){switch(e.type){case 0:var a=e;if(a.shadowEnabled){var o,h=r.csmLayers;QYt(t,r,o=a.shadowFixedArea?h.specialLayer:h.layers[n]);for(var u=o.shadowObjects,l=0;l<u.length;l++){var c=u[l].model;this.add(c,n)}}break;case 2:var f=e;if(f.shadowEnabled)for(var _=f.visibility,d=r.csmLayers.castShadowObjects,p=0;p<d.length;p++){var m=d[p].model;(!m.worldBounds||(_&m.node.layer)===m.node.layer&&Za.aabbFrustum(m.worldBounds,f.frustum))&&this.add(m,n)}}this._instancedQueue.uploadBuffers(i)}},e.clear=function(){this._subModelsArray.length=0,this._shaderArray.length=0,this._passArray.length=0,this._instancedQueue.clear()},e.add=function(t,e){for(var i=t.subModels,n=0;n<i.length;n++){var r=i[n],s=eZt(r);if(!(s<0)){var a=r.passes[s];if(1===a.batchingScheme){var o=a.getInstancedBuffer(e);o.merge(r,s),this._instancedQueue.queue.add(o)}else{var h=r.shaders[s];this._subModelsArray.push(r),h&&this._shaderArray.push(h),this._passArray.push(a)}}}},e.recordCommandBuffer=function(t,e,i){this._instancedQueue.recordCommandBuffer(t,e,i);for(var n=0;n<this._subModelsArray.length;++n){var r=this._subModelsArray[n],s=this._shaderArray[n],a=this._passArray[n],o=r.inputAssembler,h=AT.getOrCreatePipelineState(t,a,s,e,o),u=a.descriptorSet;i.bindPipelineState(h),i.bindDescriptorSet(1,u),i.bindDescriptorSet(2,r.descriptorSet),i.bindInputAssembler(o),i.draw(o)}},t}(),oZt=[new rd(1,1,1,1)],hZt=t("hr",Kh("ShadowStage")((nZt=function(t){function e(){var e;return(e=t.call(this)||this)._additiveShadowQueue=void 0,e._shadowFrameBuffer=null,e._renderArea=new K_,e._light=null,e._globalDS=null,e._level=0,e._isShadowMapCleared=!1,e}s(e,t);var i=e.prototype;return i.setUsage=function(t,e,i,n){void 0===n&&(n=0),this._globalDS=t,this._light=e,this._shadowFrameBuffer=i,this._level=n},i.destroy=function(){var t;this._shadowFrameBuffer=null,this._globalDS=null,this._light=null,null==(t=this._additiveShadowQueue)||t.clear()},i.clearFramebuffer=function(t){if(this._light&&this._shadowFrameBuffer&&!this._isShadowMapCleared){oZt[0].w=t.clearColor.w;var e=this._pipeline,i=e.pipelineSceneData,n=i.shadingScale,r=i.shadows,s=t.viewport,a=r.size;this._renderArea.x=s.x*a.x,this._renderArea.y=s.y*a.y,this._renderArea.width=s.width*a.x*n,this._renderArea.height=s.height*a.y*n;var o=e.commandBuffers[0],h=this._shadowFrameBuffer.renderPass;o.beginRenderPass(h,this._shadowFrameBuffer,this._renderArea,oZt,t.clearDepth,t.clearStencil),o.endRenderPass(),this._isShadowMapCleared=!0}},i.render=function(t){var e=this._pipeline,i=e.pipelineSceneData,n=i.shadows,r=this._globalDS,s=e.commandBuffers[0],a=this._level,o=e.device;if(this._light&&this._shadowFrameBuffer){this._pipeline.pipelineUBO.updateShadowUBOLight(r,this._light,a),this._additiveShadowQueue.gatherLightPasses(t,this._light,s,a);var h=n.size;switch(this._light.type){case 0:var u=this._light;if(u.shadowFixedArea||u.csmLevel===qT.LEVEL_1||!i.csmSupported)this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=h.x,this._renderArea.height=h.y;else{var l=o.capabilities.screenSpaceSignY;this._renderArea.x=a%2*.5*h.x,this._renderArea.y=l>0?.5*(1-Math.floor(a/2))*h.y:.5*Math.floor(a/2)*h.y,this._renderArea.width=.5*h.x,this._renderArea.height=.5*h.y}break;case 2:this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=h.x,this._renderArea.height=h.y}var c=this._shadowFrameBuffer.renderPass;s.beginRenderPass(c,this._shadowFrameBuffer,this._renderArea,oZt,t.clearDepth,t.clearStencil),s.bindDescriptorSet(0,r),this._additiveShadowQueue.recordCommandBuffer(o,c,s),s.endRenderPass(),this._isShadowMapCleared=!1}},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._additiveShadowQueue=new aZt(e),this._isShadowMapCleared=!1},e}(AJt),nZt.initInfo={name:"ShadowStage",priority:10,tag:0},iZt=nZt))||iZt),uZt=[],lZt=t("hq",Kh("ShadowFlow")((sZt=function(t){function e(){var e;return(e=t.call(this)||this)._shadowRenderPass=null,e}s(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._stages.length){var i=new hZt;i.initialize(hZt.initInfo),this._stages.push(i)}return!0},i.activate=function(e){t.prototype.activate.call(this,e);var i=jS(e.device)?0:1;e.macros.CC_SHADOWMAP_FORMAT=i;var n=6===e.device.gfxAPI?1:0;e.macros.CC_SHADOWMAP_USE_LINEAR_DEPTH=n,e.pipelineSceneData.csmSupported=e.device.capabilities.maxFragmentUniformVectors>=99,e.macros.CC_SUPPORT_CASCADED_SHADOW_MAP=e.pipelineSceneData.csmSupported,e.macros.CC_SHADOW_TYPE=0,e.macros.CC_DIR_SHADOW_PCF_TYPE=jT.HARD,e.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,e.macros.CC_CASCADED_LAYERS_TRANSITION=0,e.onGlobalPipelineStateChanged()},i.render=function(t){var e=this._pipeline,i=e.pipelineSceneData.shadows,n=e.pipelineSceneData.csmLayers,r=e.pipelineSceneData.shadowFrameBufferMap,s=n.castShadowObjects,a=this._pipeline.pipelineSceneData.validPunctualLights;if(i.enabled&&i.type===WT.ShadowMap){for(var o=0,h=0;o<i.maxReceived&&h<a.length;){var u=a[h];2===u.type&&u.shadowEnabled&&(uZt.push(u),o++),h++}if(0!==s.length){i.shadowMapDirty&&this.resizeShadowMap();var l=t.scene.mainLight;if(l&&l.shadowEnabled){var c=e.descriptorSet;r.has(l)||this._initShadowFrameBuffer(e,l,t.window.swapchain);var f=r.get(l);if(l.shadowFixedArea)this._renderStage(t,l,f,c);else for(var _=e.pipelineSceneData.csmSupported?l.csmLevel:1,d=0;d<_;d++)this._renderStage(t,l,f,c,d)}for(var p=0;p<uZt.length;p++){var m=uZt[p],g=e.globalDSManager.getOrCreateDescriptorSet(m);r.has(m)||this._initShadowFrameBuffer(e,m,t.window.swapchain);var y=r.get(m);this._renderStage(t,m,y,g)}uZt.length=0}else this.clearShadowMap(uZt,t)}},i.destroy=function(){if(t.prototype.destroy.call(this),this._pipeline){for(var e=this._pipeline.pipelineSceneData.shadowFrameBufferMap,i=Array.from(e.values()),n=0;n<i.length;n++){var r=i[n];if(r){for(var s=r.colorTextures,a=0;a<s.length;a++){var o=s[a];o&&o.destroy()}s.length=0;var h=r.depthStencilTexture;h&&h.destroy(),r.destroy()}}e.clear()}this._shadowRenderPass&&this._shadowRenderPass.destroy()},i._initShadowFrameBuffer=function(t,e){var i=t.device,n=t.pipelineSceneData.shadows.size,r=t.pipelineSceneData.shadowFrameBufferMap,s=jS(i)?11:35;if(!this._shadowRenderPass){var a=new Id;a.format=s,a.loadOp=1,a.storeOp=0,a.sampleCount=1;var o=new Md;o.format=55,o.depthLoadOp=1,o.depthStoreOp=1,o.stencilLoadOp=1,o.stencilStoreOp=1,o.sampleCount=1;var h=new Od([a],o);this._shadowRenderPass=i.createRenderPass(h)}var u=[];u.push(i.createTexture(new dd(1,20,s,n.x,n.y)));var l=i.createTexture(new dd(1,32,55,n.x,n.y)),c=i.createFramebuffer(new Vd(this._shadowRenderPass,u,l));r.set(e,c)},i._renderStage=function(t,e,i,n,r){void 0===r&&(r=0);for(var s=0;s<this._stages.length;s++){var a=this._stages[s];a.setUsage(n,e,i,r),a.render(t)}},i.clearShadowMap=function(t,e){var i=this._pipeline,n=i.pipelineSceneData,r=e.scene.mainLight;if(r){var s=this._pipeline.descriptorSet;n.shadowFrameBufferMap.has(r)||this._initShadowFrameBuffer(this._pipeline,r,e.window.swapchain);for(var a=n.shadowFrameBufferMap.get(r),o=0;o<this._stages.length;o++){var h=this._stages[o];h.setUsage(s,r,a),h.clearFramebuffer(e)}}for(var u=0;u<t.length;u++){var l=t[u],c=i.globalDSManager.getOrCreateDescriptorSet(l);n.shadowFrameBufferMap.has(l)||this._initShadowFrameBuffer(this._pipeline,l,e.window.swapchain);for(var f=n.shadowFrameBufferMap.get(l),_=0;_<this._stages.length;_++){var d=this._stages[_];d.setUsage(c,l,f),d.clearFramebuffer(e)}}},i.resizeShadowMap=function(){for(var t,e=this._pipeline.pipelineSceneData.shadows,i=e.size,n=this._pipeline,r=n.device,s=n.pipelineSceneData.shadowFrameBufferMap,a=jS(r)?11:35,o=p(s.keys());!(t=o()).done;){var h=t.value,u=s.get(h);if(u){var l=[];l.push(n.device.createTexture(new dd(1,20,a,i.x,i.y)));var c=u.depthStencilTexture;c&&c.resize(i.x,i.y);var f=u.renderPass;u.destroy();var _=r.createFramebuffer(new Vd(f,l,c));s.set(h,_)}}e.shadowMapDirty=!1},e}(EJt),sZt.initInfo={name:wb,priority:0,tag:0,stages:[]},rZt=sZt))||rZt),cZt="CC_USE_RGBE_OUTPUT",fZt=gT("default"),_Zt=gT("reflect-map");function dZt(t){var e=t.passes,i=A.rendering;qS()&&(fZt=i.getPhaseID(i.getPassID("default"),"default"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===fZt||qS()&&e[n].phaseID===fZt)return n;return-1}function pZt(t){var e=t.passes,i=A.rendering;qS()&&(_Zt=i.getPhaseID(i.getPassID("default"),"reflect-map"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===_Zt||qS()&&e[n].phaseID===_Zt)return n;return-1}var mZt,gZt,yZt,vZt,bZt,SZt,wZt,xZt,TZt,AZt=function(){function t(t){this._subModelsArray=[],this._passArray=[],this._shaderArray=[],this._rgbeSubModelsArray=[],this._instancedQueue=new WJt,this._patches=[],this._pipeline=t}var e=t.prototype;return e.gatherRenderObjects=function(t,e,i){this.clear();var n=e.scene,r=this._pipeline.pipelineSceneData.skybox;r.enabled&&r.model&&8&t.camera.clearFlag&&this.add(r.model);for(var s=n.models,a=t.visibility,o=0;o<s.length;o++){var h=s[o];h.node&&!n.isCulledByLod(e,h)&&((a&h.node.layer)===h.node.layer||a&h.visFlags)&&h.enabled&&h.worldBounds&&h.bakeToReflectionProbe&&(0===t.probeType?Za.aabbWithAABB(h.worldBounds,t.boundingBox)&&this.add(h):Za.aabbFrustum(h.worldBounds,t.camera.frustum)&&this.add(h))}this._instancedQueue.uploadBuffers(i)},e.clear=function(){this._subModelsArray.length=0,this._shaderArray.length=0,this._passArray.length=0,this._instancedQueue.clear(),this._rgbeSubModelsArray.length=0},e.add=function(t){for(var e=t.subModels,i=0;i<e.length;i++){var n=e[i];if(!n.passes[0].blendState.targets[0].blend){var r=pZt(n),s=!0;if(r<0&&(r=dZt(n),s=!1),!(r<0)){var a=n.passes[r],o=a.batchingScheme;if(!s){this._patches=[],this._patches=this._patches.concat(n.patches);var h=[{name:cZt,value:!0}];this._patches=this._patches.concat(h),n.onMacroPatchesStateChanged(this._patches),this._rgbeSubModelsArray.push(n)}if(1===o){var u=a.getInstancedBuffer();u.merge(n,r),this._instancedQueue.queue.add(u)}else{var l=n.shaders[r];this._subModelsArray.push(n),l&&this._shaderArray.push(l),this._passArray.push(a)}}}}},e.recordCommandBuffer=function(t,e,i){this._instancedQueue.recordCommandBuffer(t,e,i);for(var n=0;n<this._subModelsArray.length;++n){var r=this._subModelsArray[n],s=this._shaderArray[n],a=this._passArray[n],o=r.inputAssembler,h=AT.getOrCreatePipelineState(t,a,s,e,o),u=a.descriptorSet;i.bindPipelineState(h),i.bindDescriptorSet(1,u),i.bindDescriptorSet(2,r.descriptorSet),i.bindInputAssembler(o),i.draw(o)}this.resetRGBEMacro(),this._instancedQueue.clear()},e.resetRGBEMacro=function(){for(var t=0;t<this._rgbeSubModelsArray.length;t++){this._patches=[];var e=this._rgbeSubModelsArray[t];if(this._patches=this._patches.concat(e.patches),this._patches){for(var i=0;i<this._patches.length;i++)if(this._patches[i].name===cZt){this._patches.splice(i,1);break}e.onMacroPatchesStateChanged(this._patches)}}},t}(),CZt=[new rd(1,1,1,1)],DZt=t("ht",Kh("ReflectionProbeStage")((gZt=function(t){function e(){var e;return(e=t.call(this)||this)._frameBuffer=null,e._renderArea=new K_,e._probe=null,e._probeRenderQueue=void 0,e._rgbeColor=new ir,e}s(e,t);var i=e.prototype;return i.setUsageInfo=function(t,e){this._probe=t,this._frameBuffer=e},i.destroy=function(){var t;this._frameBuffer=null,null==(t=this._probeRenderQueue)||t.clear()},i.clearFramebuffer=function(t){if(this._frameBuffer){CZt[0].w=t.clearColor.w;var e=this._pipeline,i=e.pipelineSceneData.shadingScale,n=t.viewport,r=this._probe.resolution;this._renderArea.x=n.x*r,this._renderArea.y=n.y*r,this._renderArea.width=n.width*r*i,this._renderArea.height=n.height*r*i;var s=e.commandBuffers[0],a=this._frameBuffer.renderPass;s.beginRenderPass(a,this._frameBuffer,this._renderArea,CZt,t.clearDepth,t.clearStencil),s.endRenderPass()}},i.render=function(t){var e=this._pipeline,i=e.commandBuffers[0];this._probeRenderQueue.gatherRenderObjects(this._probe,t,i),e.pipelineUBO.updateCameraUBO(this._probe.camera),this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=this._probe.renderArea().x,this._renderArea.height=this._probe.renderArea().y;var n=this._frameBuffer.renderPass;if(1&this._probe.camera.clearFlag){this._rgbeColor.x=this._probe.camera.clearColor.x,this._rgbeColor.y=this._probe.camera.clearColor.y,this._rgbeColor.z=this._probe.camera.clearColor.z;var r=pr(this._rgbeColor);CZt[0].x=r.x,CZt[0].y=r.y,CZt[0].z=r.z,CZt[0].w=r.w}var s=e.device;i.beginRenderPass(n,this._frameBuffer,this._renderArea,CZt,this._probe.camera.clearDepth,this._probe.camera.clearStencil),i.bindDescriptorSet(0,e.descriptorSet),this._probeRenderQueue.recordCommandBuffer(s,n,i),i.endRenderPass(),e.pipelineUBO.updateCameraUBO(t)},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._probeRenderQueue=new AZt(e)},e}(AJt),gZt.initInfo={name:"ReflectionProbeStage",priority:10,tag:0},mZt=gZt))||mZt),BZt=t("hs",Kh("ReflectionProbeFlow")((vZt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._stages.length){var i=new DZt;i.initialize(DZt.initInfo),this._stages.push(i)}return!0},i.activate=function(e){t.prototype.activate.call(this,e)},i.render=function(t){if(A.internal.reflectionProbeManager)for(var e=A.internal.reflectionProbeManager.getProbes(),i=0;i<e.length;i++)e[i].needRender&&1===e[i].probeType&&this._renderStage(t,e[i])},i.destroy=function(){t.prototype.destroy.call(this)},i._renderStage=function(t,e){for(var i=0;i<this._stages.length;i++){var n=this._stages[i];if(1===e.probeType)A.internal.reflectionProbeManager.updatePlanarMap(e,null),n.setUsageInfo(e,e.realtimePlanarTexture.window.framebuffer),n.render(t),A.internal.reflectionProbeManager.updatePlanarMap(e,e.realtimePlanarTexture.getGFXTexture());else{for(var r=0;r<6;r++){var s=e.bakedCubeTextures[r];if(!s)return;e.updateCameraDir(r),n.setUsageInfo(e,s.window.framebuffer),n.render(t)}e.needRender=!1}}},e}(EJt),vZt.initInfo={name:"PIPELINE_FLOW_RELECTION_PROBE",priority:0,tag:0,stages:[]},yZt=vZt))||yZt);function IZt(){var t=new s$t;return t.initialize({flows:[]}),t}var MZt,PZt,EZt,OZt,kZt,RZt,FZt,LZt,VZt,NZt,zZt,UZt,GZt,HZt,WZt,jZt,qZt,XZt,YZt,JZt,KZt,QZt,ZZt,$Zt,t$t,e$t,i$t,n$t,r$t,s$t=t("hg",(bZt=Kh("ForwardPipeline"),SZt=Ou([OQt]),bZt((xZt=function(t){function e(){var e;return(e=t.call(this)||this).renderTextures=TZt&&TZt(),e._postRenderPass=null,e}s(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._flows.length){var i=new lZt;i.initialize(lZt.initInfo),this._flows.push(i);var n=new BZt;n.initialize(BZt.initInfo),this._flows.push(n);var r=new $Qt;r.initialize($Qt.initInfo),this._flows.push(r)}return!0},i.activate=function(e){return this._macros={CC_PIPELINE_TYPE:0},this._pipelineSceneData=new CO,!(!t.prototype.activate.call(this,e)||!this._activeRenderer(e)&&(ht(2402),1))},i._ensureEnoughSize=function(t){for(var e=this._width,i=this._height,n=0;n<t.length;++n){var r=t[n].window;e=Math.max(r.width,e),i=Math.max(r.height,i)}e===this._width&&i===this._height||(this._width=e,this._height=i)},i.destroy=function(){this._destroyUBOs(),this._destroyQuadInputAssembler();for(var e=this._renderPasses.values(),i=e.next();!i.done;)i.value.destroy(),i=e.next();return this._commandBuffers.length=0,t.prototype.destroy.call(this)},i._activeRenderer=function(){var t=this.device;this._commandBuffers.push(t.commandBuffer);var e=this._descriptorSet,i=this.globalDSManager.pointSampler;return e.bindSampler(4,i),e.bindTexture(4,WS(this.device)),e.bindSampler(6,i),e.bindTexture(6,WS(this.device)),e.update(),!0},i._destroyUBOs=function(){var t=this._descriptorSet;t&&(t.getBuffer(Db.BINDING).destroy(),t.getBuffer(Ib.BINDING).destroy(),t.getBuffer(Bb.BINDING).destroy(),t.getTexture(4).destroy(),t.getTexture(6).destroy())},n(e,[{key:"postRenderPass",get:function(){return this._postRenderPass}}]),e}(LJt),TZt=zh(xZt.prototype,"renderTextures",[SZt,uu],(function(){return[]})),wZt=xZt))||wZt)),a$t=[new rd(0,0,0,0),new rd(0,0,0,0),new rd(0,0,0,0)],o$t=t("hm",(MZt=Kh("GbufferStage"),PZt=Ou([LQt]),MZt((RZt=function(t){function e(){var e;return(e=t.call(this)||this).renderQueues=kZt&&kZt(),e._renderQueues=[],e._renderArea=new K_,e._instancedQueue=new WJt,e._phaseID=gT("default"),e}s(e,t);var i=e.prototype;return i.initialize=function(e){return t.prototype.initialize.call(this,e),e.renderQueues&&(this.renderQueues=e.renderQueues),!0},i.activate=function(e,i){t.prototype.activate.call(this,e,i);for(var n=0;n<this.renderQueues.length;n++)this._renderQueues[n]=UJt(this.renderQueues[n])},i.destroy=function(){},i.render=function(t){this._instancedQueue.clear();var e=this._pipeline,i=e.device;this._renderQueues.forEach(GJt),e.generateRenderArea(t,this._renderArea),e.updateQuadVertexData(this._renderArea,t.window);for(var n=e.pipelineSceneData.renderObjects,r=0,s=0,a=0,o=0;o<n.length;++o){var h=n[o],u=h.model.subModels;for(r=0;r<u.length;++r){var l=u[r],c=l.passes;for(s=0;s<c.length;++s){var f=c[s];if(f.phase===this._phaseID)if(1===f.batchingScheme){var _=f.getInstancedBuffer();_.merge(l,s),this._instancedQueue.queue.add(_)}else for(a=0;a<this._renderQueues.length;a++)this._renderQueues[a].insertRenderPass(h,r,s)}}}this._renderQueues.forEach(HJt);var d=e.commandBuffers[0];this._instancedQueue.uploadBuffers(d),1&t.clearFlag&&(e.pipelineSceneData.isHDR?BT(a$t[0],t.clearColor):(a$t[0].x=t.clearColor.x,a$t[0].y=t.clearColor.y,a$t[0].z=t.clearColor.z)),a$t[0].w=t.clearColor.w;var p=e.getPipelineRenderData().gbufferFrameBuffer,m=p.renderPass;d.beginRenderPass(m,p,this._renderArea,a$t,t.clearDepth,t.clearStencil),d.setScissor(e.generateScissor(t)),d.setViewport(e.generateViewport(t)),d.bindDescriptorSet(0,e.descriptorSet);for(var g=0;g<this.renderQueues.length;g++)this._renderQueues[g].recordCommandBuffer(i,m,d);this._instancedQueue.recordCommandBuffer(i,m,d),d.endRenderPass()},e}(AJt),RZt.initInfo={name:"GbufferStage",priority:10,tag:0,renderQueues:[{isTransparent:!1,sortMode:0,stages:["default"]},{isTransparent:!0,sortMode:1,stages:["default"]}]},kZt=zh((OZt=RZt).prototype,"renderQueues",[PZt,uu],(function(){return[]})),EZt=OZt))||EZt)),h$t=new ir,u$t=new gh(0,0,0,.5,.5,.5),l$t=new gh,c$t=[new rd(0,0,0,1)],f$t=t("hn",(FZt=Kh("LightingStage"),LZt=Ou(GT),VZt=Ou([LQt]),FZt((HZt=function(t){function e(){var e;return(e=t.call(this)||this)._deferredLitsBufs=null,e._maxDeferredLights=Jb.LIGHTS_PER_PASS,e._lightBufferData=null,e._lightMeterScale=1e4,e._descriptorSet=null,e._renderArea=new K_,e._planarQueue=null,e._uiPhase=new KQt,e._deferredMaterial=UZt&&UZt(),e.renderQueues=GZt&&GZt(),e._phaseID=gT("default"),e._renderQueues=[],e}s(e,t);var i=e.prototype;return i.initialize=function(e){return t.prototype.initialize.call(this,e),!0},i.gatherLights=function(t){for(var e=this._pipeline,i=e.pipelineSceneData.isHDR,n=e.commandBuffers[0],r=t.scene.sphereLights,s=t.scene.spotLights,a=t.scene.pointLights,o=t.scene.rangedDirLights,h=Js.create(0,0,0,1),u=new Float32Array(4),l=t.exposure,c=0,f=Vn.length,_=f*this._maxDeferredLights,d=0;d<r.length&&c<this._maxDeferredLights;d++,++c){var p=r[d];if(Js.set(h,p.position.x,p.position.y,p.position.z,p.range),Za.sphereFrustum(h,t.frustum)){if(ir.toArray(u,p.position),u[3]=1,this._lightBufferData.set(u,c*f),ir.toArray(u,p.color),p.useColorTemperature){var m=p.finalColor;u[0]=m.x,u[1]=m.y,u[2]=m.z}u[3]=i?p.luminance*l*this._lightMeterScale:p.luminance,this._lightBufferData.set(u,c*f+1*_),u[0]=p.size,u[1]=p.range,u[2]=0,this._lightBufferData.set(u,c*f+2*_)}}for(var g=0;g<s.length&&c<this._maxDeferredLights;g++,++c){var y=s[g];if(Js.set(h,y.position.x,y.position.y,y.position.z,y.range),Za.sphereFrustum(h,t.frustum)){if(ir.toArray(u,y.position),u[3]=2,this._lightBufferData.set(u,c*f+0*_),ir.toArray(u,y.color),y.useColorTemperature){var v=y.finalColor;u[0]=v.x,u[1]=v.y,u[2]=v.z}u[3]=i?y.luminance*l*this._lightMeterScale:y.luminance,this._lightBufferData.set(u,c*f+1*_),u[0]=y.size,u[1]=y.range,u[2]=y.spotAngle,this._lightBufferData.set(u,c*f+2*_),ir.toArray(u,y.direction),this._lightBufferData.set(u,c*f+3*_)}}for(var b=0;b<a.length&&c<this._maxDeferredLights;b++,++c){var S=a[b];if(Js.set(h,S.position.x,S.position.y,S.position.z,S.range),Za.sphereFrustum(h,t.frustum)){if(ir.toArray(u,S.position),u[3]=3,this._lightBufferData.set(u,c*f),ir.toArray(u,S.color),S.useColorTemperature){var w=S.finalColor;u[0]=w.x,u[1]=w.y,u[2]=w.z}u[3]=i?S.luminance*l*this._lightMeterScale:S.luminance,this._lightBufferData.set(u,c*f+1*_),u[0]=0,u[1]=S.range,u[2]=0,this._lightBufferData.set(u,c*f+2*_)}}for(var x=0;x<o.length&&c<this._maxDeferredLights;x++,++c){var T=o[x];if(gh.transform(l$t,u$t,T.node.getWorldMatrix()),Za.aabbFrustum(l$t,t.frustum)){if(ir.toArray(u,T.position),u[3]=4,this._lightBufferData.set(u,c*f),ir.toArray(u,T.color),T.useColorTemperature){var A=T.finalColor;u[0]=A.x,u[1]=A.y,u[2]=A.z}u[3]=i?T.illuminance*l:T.illuminance,this._lightBufferData.set(u,c*f+1*_),ir.toArray(u,T.right),u[3]=0,this._lightBufferData.set(u,c*f+2*_),ir.toArray(u,T.direction),u[3]=0,this._lightBufferData.set(u,c*f+3*_);var C=T.scale;h$t.set(.5*C.x,.5*C.y,.5*C.z),ir.toArray(u,h$t),u[3]=0,this._lightBufferData.set(u,c*f+4*_)}}var D=3*_+3;this._lightBufferData.set([c],D),n.updateBuffer(this._deferredLitsBufs,this._lightBufferData)},i._createStageDescriptor=function(t){var e=this._pipeline.device,i=64*this._maxDeferredLights;i=Math.ceil(i/e.capabilities.uboOffsetAlignment)*e.capabilities.uboOffsetAlignment,this._deferredLitsBufs=e.createBuffer(new ud(18,3,i,e.capabilities.uboOffsetAlignment));var n=e.createBuffer(new ld(this._deferredLitsBufs,0,i));this._lightBufferData=new Float32Array(i/4),this._descriptorSet=e.createDescriptorSet(new Ud(t.localSetLayout)),this._descriptorSet.bindBuffer(Yb.BINDING,n);var r=e.createBuffer(new ud(18,1,224,224));this._descriptorSet.bindBuffer(0,r)},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._uiPhase.activate(e);for(var n=0;n<this.renderQueues.length;n++)this._renderQueues[n]=UJt(this.renderQueues[n]);this._planarQueue=new JQt(this._pipeline),this._deferredMaterial&&(e.pipelineSceneData.deferredLightingMaterial=this._deferredMaterial)},i.destroy=function(){var t;null==(t=this._deferredLitsBufs)||t.destroy(),this._deferredLitsBufs=null,this._descriptorSet=null},i.render=function(t){var e,i=this._pipeline,n=i.device,r=i.commandBuffers[0],s=i.pipelineSceneData,a=s.renderObjects;this._planarQueue.gatherShadowPasses(t,r),i.generateRenderArea(t,this._renderArea);for(var o=i.getPipelineRenderData(),h=s.deferredLightingMaterial.passes[0],u=h.getShaderVariant(),l=0;l<3;++l)h.descriptorSet.bindTexture(l,o.gbufferRenderTargets[l]),h.descriptorSet.bindSampler(l,o.sampler);h.descriptorSet.bindTexture(3,o.outputDepth),h.descriptorSet.bindSampler(3,o.sampler),h.descriptorSet.update(),this._descriptorSet||this._createStageDescriptor(h),this.gatherLights(t),1&t.clearFlag&&(c$t[0].x=t.clearColor.x,c$t[0].y=t.clearColor.y,c$t[0].z=t.clearColor.z),c$t[0].w=0;var c=o.outputFrameBuffer,f=c.renderPass;i.pipelineUBO.updateShadowUBO(t),r.beginRenderPass(f,c,this._renderArea,c$t,t.clearDepth,t.clearStencil),r.setScissor(i.generateScissor(t)),r.setViewport(i.generateViewport(t)),r.bindDescriptorSet(0,i.descriptorSet);var _=i.quadIAOffscreen,d=null;null!=h&&null!=u&&null!=_&&(d=AT.getOrCreatePipelineState(n,h,u,f,_)),null!=d&&(this._descriptorSet.update(),r.bindPipelineState(d),r.bindDescriptorSet(1,h.descriptorSet),r.bindDescriptorSet(2,this._descriptorSet),r.bindInputAssembler(_),r.draw(_)),this._renderQueues.forEach(GJt);for(var p=0,m=0,g=0,y=0;y<a.length;++y){var v=a[y],b=v.model.subModels;for(p=0;p<b.length;++p){var S=b[p].passes;for(m=0;m<S.length;++m)if(S[m].phase===this._phaseID)for(g=0;g<this._renderQueues.length;g++)this._renderQueues[g].insertRenderPass(v,p,m)}}if(a.length>0){this._renderQueues.forEach(HJt);for(var w=0;w<this._renderQueues.length;w++)this._renderQueues[w].recordCommandBuffer(n,f,r);this._planarQueue.recordCommandBuffer(n,f,r)}null==(e=t.geometryRenderer)||e.render(f,r,i.pipelineSceneData),this._uiPhase.render(t,f),r.endRenderPass()},e}(AJt),HZt.initInfo={name:"LightingStage",priority:15,tag:0},UZt=zh((zZt=HZt).prototype,"_deferredMaterial",[LZt,uu],(function(){return null})),GZt=zh(zZt.prototype,"renderQueues",[VZt,uu],(function(){return[]})),NZt=zZt))||NZt)),_$t=[new rd(0,0,0,1)],d$t=t("hp",(WZt=Kh("PostProcessStage"),jZt=Ou(GT),qZt=Ou([LQt]),WZt((QZt=function(t){function e(){var e;return(e=t.call(this)||this)._postProcessMaterial=JZt&&JZt(),e.renderQueues=KZt&&KZt(),e._renderArea=new K_,e._stageDesc=null,e._localUBO=null,e._uiPhase=new KQt,e}s(e,t);var i=e.prototype;return i.initialize=function(e){return t.prototype.initialize.call(this,e),!0},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._postProcessMaterial&&(e.pipelineSceneData.postprocessMaterial=this._postProcessMaterial),this._uiPhase.activate(e)},i.destroy=function(){},i.render=function(t){var e=this._pipeline,i=e.device,n=e.pipelineSceneData,r=e.commandBuffers[0];e.pipelineUBO.updateCameraUBO(t);var s=t.viewport;this._renderArea.x=s.x*t.window.width,this._renderArea.y=s.y*t.window.height,this._renderArea.width=s.width*t.window.width,this._renderArea.height=s.height*t.window.height;var a=e.getPipelineRenderData(),o=t.window.framebuffer,h=e.getRenderPass(t.clearFlag,o);1&t.clearFlag&&(_$t[0].x=t.clearColor.x,_$t[0].y=t.clearColor.y,_$t[0].z=t.clearColor.z),_$t[0].w=t.clearColor.w,r.beginRenderPass(h,o,this._renderArea,_$t,t.clearDepth,t.clearStencil),r.bindDescriptorSet(0,e.descriptorSet);var u=n.postprocessMaterial.passes[0],l=u.getShaderVariant();e.bloomEnabled?u.descriptorSet.bindTexture(0,a.bloom.combineTex):u.descriptorSet.bindTexture(0,a.outputRenderTargets[0]),u.descriptorSet.bindSampler(0,a.sampler),u.descriptorSet.update();var c=t.window.swapchain?e.quadIAOnscreen:e.quadIAOffscreen,f=null;null!=u&&null!=l&&null!=c&&(f=AT.getOrCreatePipelineState(i,u,l,h,c));var _=e.pipelineSceneData.renderObjects;null!=f&&_.length>0&&(this._stageDesc||(this._stageDesc=i.createDescriptorSet(new Ud(u.localSetLayout)),this._localUBO=i.createBuffer(new ud(18,1,224,224)),this._stageDesc.bindBuffer(0,this._localUBO)),this._stageDesc.update(),r.bindPipelineState(f),r.bindDescriptorSet(1,u.descriptorSet),r.bindDescriptorSet(2,this._stageDesc),r.bindInputAssembler(c),r.draw(c)),this._uiPhase.render(t,h),zT(i,h,r,e.profiler,t),r.endRenderPass()},e}(AJt),QZt.initInfo={name:"PostProcessStage",priority:19,tag:0},JZt=zh((YZt=QZt).prototype,"_postProcessMaterial",[jZt,uu],(function(){return null})),KZt=zh(YZt.prototype,"renderQueues",[qZt,uu],(function(){return[]})),XZt=YZt))||XZt)),p$t=function(t){function e(){var e;return(e=t.call(this)||this)._antiAliasing=0,e}s(e,t);var i=e.prototype;return i.updatePipelineSceneData=function(){this.updatePipelinePassInfo()},i.updateBloomPass=function(){if(this._bloomMaterial){var t=this._bloomMaterial.passes[0];t.beginChangeStatesSilently(),t.tryCompile(),t.endChangeStatesSilently();for(var e=0;e<6;++e){var i=this._bloomMaterial.passes[1+e];i.beginChangeStatesSilently(),i.tryCompile(),i.endChangeStatesSilently();var n=this._bloomMaterial.passes[7+e];n.beginChangeStatesSilently(),n.tryCompile(),n.endChangeStatesSilently()}var r=this._bloomMaterial.passes[13];r.beginChangeStatesSilently(),r.tryCompile(),r.endChangeStatesSilently()}},i.updatePostProcessPass=function(){if(this.postprocessMaterial){var t=this.postprocessMaterial.passes[0];t.beginChangeStatesSilently(),t.tryCompile(),t.endChangeStatesSilently()}},i.initPipelinePassInfo=function(){var t=new GT;t._uuid="builtin-deferred-material",t.initialize({effectName:"pipeline/deferred-lighting"});for(var e=0;e<t.passes.length;++e)t.passes[e].tryCompile();this._deferredLightingMaterial=t;var i=new GT;i._uuid="builtin-bloom-material",i.initialize({effectName:"pipeline/bloom"});for(var n=0;n<i.passes.length;++n)i.passes[n].tryCompile();this._bloomMaterial=i;var r=new GT;r._uuid="builtin-post-process-material",r.initialize({effectName:"pipeline/post-process",defines:{ANTIALIAS_TYPE:this._antiAliasing}});for(var s=0;s<r.passes.length;++s)r.passes[s].tryCompile();this._postprocessMaterial=r,this.updatePipelinePassInfo()},i.updatePipelinePassInfo=function(){this.updateBloomPass(),this.updatePostProcessPass(),this.updateDeferredPassInfo()},i.activate=function(e){return t.prototype.activate.call(this,e),this.initPipelinePassInfo(),!0},i.updateDeferredPassInfo=function(){this.updateDeferredLightPass()},i.updateDeferredLightPass=function(){if(this._deferredLightingMaterial){C.director.root.pipeline.macros.CC_RECEIVE_SHADOW=1;var t=this._deferredLightingMaterial.passes[0];t.beginChangeStatesSilently(),t.tryCompile(),t.endChangeStatesSilently()}},n(e,[{key:"antiAliasing",get:function(){return this._antiAliasing},set:function(t){if(this._antiAliasing=t,this._postprocessMaterial){var e=this._postprocessMaterial.passes[0].defines;Object.assign(e,{ANTIALIAS_TYPE:t});var i=new GT;i.initialize({effectAsset:this._postprocessMaterial.effectAsset,defines:e});for(var n=0;n<i.passes.length;++n)i.passes[n].tryCompile();this._postprocessMaterial=i}}},{key:"bloomMaterial",get:function(){return this._bloomMaterial},set:function(t){this._bloomMaterial!==t&&t&&(this._bloomMaterial=t,this.updatePipelinePassInfo())}},{key:"postprocessMaterial",get:function(){return this._postprocessMaterial},set:function(t){this._postprocessMaterial!==t&&t&&(this._postprocessMaterial=t,this.updatePipelinePassInfo())}},{key:"deferredLightingMaterial",get:function(){return this._deferredLightingMaterial},set:function(t){this._deferredLightingMaterial!==t&&t&&(this._deferredLightingMaterial=t,this.updatePipelinePassInfo())}}]),e}(CO),m$t=[new rd(0,0,0,1)],g$t=function(){};ZZt=g$t,g$t.TEXTURE_SIZE_OFFSET=0,g$t.COUNT=ZZt.TEXTURE_SIZE_OFFSET+4,g$t.SIZE=4*ZZt.COUNT;var y$t,v$t,b$t,S$t,w$t,x$t,T$t,A$t=t("ho",($Zt=Kh("BloomStage"),t$t=Ou(GT),$Zt((r$t=function(t){function e(){var e;return(e=t.call(this)||this).threshold=1,e.intensity=.8,e.iterations=2,e._bloomMaterial=n$t&&n$t(),e._renderArea=new K_,e._bloomUBO=[],e}s(e,t);var i=e.prototype;return i.initialize=function(e){return t.prototype.initialize.call(this,e),!0},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._bloomMaterial&&(e.pipelineSceneData.bloomMaterial=this._bloomMaterial)},i.destroy=function(){},i.render=function(t){var e,i=this._pipeline;if(i.generateBloomRenderData(),(null!=(e=t.window)&&e.swapchain||i.macros.CC_PIPELINE_TYPE)&&i.bloomEnabled&&0!==i.pipelineSceneData.renderObjects.length){if(0===this._bloomUBO.length)for(var n=0;n<14;++n)this._bloomUBO[n]=i.device.createBuffer(new ud(18,3,g$t.SIZE,g$t.SIZE));1&t.clearFlag&&(m$t[0].x=t.clearColor.x,m$t[0].y=t.clearColor.y,m$t[0].z=t.clearColor.z),m$t[0].w=t.clearColor.w,this._prefilterPass(t,i),this._downsamplePass(t,i),this._upsamplePass(t,i),this._combinePass(t,i)}},i._prefilterPass=function(t,e){e.generateRenderArea(t,this._renderArea),this._renderArea.width>>=1,this._renderArea.height>>=1;var i=e.commandBuffers[0],n=e.pipelineSceneData.bloomMaterial.passes[0],r=e.getPipelineRenderData(),s=r.bloom,a=new Float32Array(g$t.COUNT);a[g$t.TEXTURE_SIZE_OFFSET+2]=this.threshold,i.updateBuffer(this._bloomUBO[0],a),i.beginRenderPass(s.renderPass,s.prefilterFramebuffer,this._renderArea,m$t,0,0),i.bindDescriptorSet(0,e.descriptorSet),n.descriptorSet.bindBuffer(0,this._bloomUBO[0]),n.descriptorSet.bindTexture(1,r.outputRenderTargets[0]),n.descriptorSet.bindSampler(1,s.sampler),n.descriptorSet.update(),i.bindDescriptorSet(1,n.descriptorSet);var o=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,h=null,u=n.getShaderVariant();null!=n&&null!=u&&null!=o&&(h=AT.getOrCreatePipelineState(e.device,n,u,s.renderPass,o)),null!=h&&(i.bindPipelineState(h),i.bindInputAssembler(o),i.draw(o)),i.endRenderPass()},i._downsamplePass=function(t,e){e.generateRenderArea(t,this._renderArea),this._renderArea.width>>=1,this._renderArea.height>>=1;for(var i=e.commandBuffers[0],n=e.pipelineSceneData.bloomMaterial,r=e.getPipelineRenderData().bloom,s=new Float32Array(g$t.COUNT),a=0;a<this.iterations;++a){s[g$t.TEXTURE_SIZE_OFFSET+0]=this._renderArea.width,s[g$t.TEXTURE_SIZE_OFFSET+1]=this._renderArea.height,i.updateBuffer(this._bloomUBO[a+1],s),this._renderArea.width>>=1,this._renderArea.height>>=1,i.beginRenderPass(r.renderPass,r.downsampleFramebuffers[a],this._renderArea,m$t,0,0);var o=n.passes[1+a],h=o.getShaderVariant();o.descriptorSet.bindBuffer(0,this._bloomUBO[a+1]),0===a?o.descriptorSet.bindTexture(1,r.prefiterTex):o.descriptorSet.bindTexture(1,r.downsampleTexs[a-1]),o.descriptorSet.bindSampler(1,r.sampler),o.descriptorSet.update(),i.bindDescriptorSet(1,o.descriptorSet);var u=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,l=null;null!=o&&null!=h&&null!=u&&(l=AT.getOrCreatePipelineState(e.device,o,h,r.renderPass,u)),null!=l&&(i.bindPipelineState(l),i.bindInputAssembler(u),i.draw(u)),i.endRenderPass()}},i._upsamplePass=function(t,e){var i=e.getPipelineRenderData().bloom;e.generateRenderArea(t,this._renderArea),this._renderArea.width>>=this.iterations+1,this._renderArea.height>>=this.iterations+1;for(var n=e.commandBuffers[0],r=e.pipelineSceneData.bloomMaterial,s=new Float32Array(g$t.COUNT),a=0;a<this.iterations;++a){var o=a+6+1;s[g$t.TEXTURE_SIZE_OFFSET+0]=this._renderArea.width,s[g$t.TEXTURE_SIZE_OFFSET+1]=this._renderArea.height,n.updateBuffer(this._bloomUBO[o],s),this._renderArea.width<<=1,this._renderArea.height<<=1,n.beginRenderPass(i.renderPass,i.upsampleFramebuffers[this.iterations-1-a],this._renderArea,m$t,0,0);var h=r.passes[7+a],u=h.getShaderVariant();h.descriptorSet.bindBuffer(0,this._bloomUBO[o]),0===a?h.descriptorSet.bindTexture(1,i.downsampleTexs[this.iterations-1]):h.descriptorSet.bindTexture(1,i.upsampleTexs[this.iterations-a]),h.descriptorSet.bindSampler(1,i.sampler),h.descriptorSet.update(),n.bindDescriptorSet(1,h.descriptorSet);var l=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,c=null;null!=h&&null!=u&&null!=l&&(c=AT.getOrCreatePipelineState(e.device,h,u,i.renderPass,l)),null!=c&&(n.bindPipelineState(c),n.bindInputAssembler(l),n.draw(l)),n.endRenderPass()}},i._combinePass=function(t,e){e.generateRenderArea(t,this._renderArea);var i=e.commandBuffers[0],n=e.pipelineSceneData.bloomMaterial,r=e.getPipelineRenderData(),s=r.bloom,a=new Float32Array(g$t.COUNT);a[g$t.TEXTURE_SIZE_OFFSET+3]=this.intensity,i.updateBuffer(this._bloomUBO[13],a),i.beginRenderPass(s.renderPass,s.combineFramebuffer,this._renderArea,m$t,0,0),i.bindDescriptorSet(0,e.descriptorSet);var o=n.passes[13];o.descriptorSet.bindBuffer(0,this._bloomUBO[13]),o.descriptorSet.bindTexture(1,r.outputRenderTargets[0]),o.descriptorSet.bindTexture(2,s.upsampleTexs[0]),o.descriptorSet.bindSampler(1,s.sampler),o.descriptorSet.bindSampler(2,s.sampler),o.descriptorSet.update(),i.bindDescriptorSet(1,o.descriptorSet);var h=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,u=null,l=o.getShaderVariant();null!=o&&null!=l&&null!=h&&(u=AT.getOrCreatePipelineState(e.device,o,l,s.renderPass,h)),null!=u&&(i.bindPipelineState(u),i.bindInputAssembler(h),i.draw(h)),i.endRenderPass()},e}(AJt),r$t.initInfo={name:"BloomStage",priority:18,tag:0},n$t=zh((i$t=r$t).prototype,"_bloomMaterial",[t$t,uu],(function(){return null})),e$t=i$t))||e$t)),C$t=t("hl",Kh("MainFlow")((v$t=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._stages.length){var i=new o$t;i.initialize(o$t.initInfo),this._stages.push(i);var n=new f$t;n.initialize(f$t.initInfo),this._stages.push(n);var r=new A$t;r.initialize(A$t.initInfo),this._stages.push(r);var s=new d$t;s.initialize(d$t.initInfo),this._stages.push(s)}return!0},i.activate=function(e){t.prototype.activate.call(this,e)},i.render=function(e){t.prototype.render.call(this,e)},i.destroy=function(){t.prototype.destroy.call(this)},e}(EJt),v$t.initInfo={name:bb,priority:1,stages:[]},y$t=v$t))||y$t),D$t=function(t){function e(){var e;return(e=t.call(this)||this).gbufferFrameBuffer=null,e.gbufferRenderTargets=[],e}return s(e,t),e}((function(){this.outputFrameBuffer=null,this.outputRenderTargets=[],this.outputDepth=null,this.sampler=null,this.bloom=null})),B$t=t("hk",(b$t=Kh("DeferredPipeline"),S$t=Ou([OQt]),b$t((x$t=function(t){function e(){var e;return(e=t.call(this)||this)._gbufferRenderPass=null,e._lightingRenderPass=null,e.renderTextures=T$t&&T$t(),e}s(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._flows.length){var i=new lZt;i.initialize(lZt.initInfo),this._flows.push(i);var n=new C$t;n.initialize(C$t.initInfo),this._flows.push(n)}return!0},i.activate=function(e){return this._macros={CC_PIPELINE_TYPE:1},this._pipelineSceneData=new p$t,!(!t.prototype.activate.call(this,e)||!this._activeRenderer(e)&&(ht(2402),1))},i.destroy=function(){this._destroyUBOs(),this._destroyQuadInputAssembler(),this._destroyDeferredData();for(var e=this._renderPasses.values(),i=e.next();!i.done;)i.value.destroy(),i=e.next();return this._commandBuffers.length=0,t.prototype.destroy.call(this)},i.onGlobalPipelineStateChanged=function(){this.pipelineSceneData.updatePipelineSceneData()},i.getPipelineRenderData=function(){return this._pipelineRenderData||this._generateDeferredRenderData(),this._pipelineRenderData},i._activeRenderer=function(t){var e=this.device;this._commandBuffers.push(e.commandBuffer);var i=this.globalDSManager.pointSampler;this._descriptorSet.bindSampler(4,i),this._descriptorSet.bindTexture(4,mT.get("default-texture").getGFXTexture()),this._descriptorSet.bindSampler(6,i),this._descriptorSet.bindTexture(6,mT.get("default-texture").getGFXTexture()),this._descriptorSet.update();var n=new QE;if(!(n=this._createQuadInputAssembler()).quadIB||!n.quadVB||!n.quadIA)return!1;this._quadIB=n.quadIB,this._quadVBOffscreen=n.quadVB,this._quadIAOffscreen=n.quadIA;var r=this._createQuadInputAssembler();if(!r.quadIB||!r.quadVB||!r.quadIA)return!1;if(this._quadVBOnscreen=r.quadVB,this._quadIAOnscreen=r.quadIA,!this._gbufferRenderPass){var s=new Id;s.format=41,s.loadOp=1,s.storeOp=0;var a=new Id;a.format=41,a.loadOp=1,a.storeOp=0;var o=new Id;o.format=41,o.loadOp=1,o.storeOp=0;var h=new Md;h.format=55,h.depthLoadOp=1,h.depthStoreOp=0,h.stencilLoadOp=1,h.stencilStoreOp=0;var u=new Od([s,a,o],h);this._gbufferRenderPass=e.createRenderPass(u)}if(!this._lightingRenderPass){var l=new Id;l.format=35,l.loadOp=1,l.storeOp=0,l.barrier=e.getGeneralBarrier(new Rd(0,2097152));var c=new Md;c.format=55,c.depthLoadOp=0,c.depthStoreOp=1,c.stencilLoadOp=0,c.stencilStoreOp=1,l.barrier=e.getGeneralBarrier(new Rd(4194304,4194304));var f=new Od([l],c);this._lightingRenderPass=e.createRenderPass(f)}return this._width=t.width,this._height=t.height,this._generateDeferredRenderData(),!0},i._destroyUBOs=function(){this._descriptorSet&&(this._descriptorSet.getBuffer(Db.BINDING).destroy(),this._descriptorSet.getBuffer(Ib.BINDING).destroy(),this._descriptorSet.getBuffer(Bb.BINDING).destroy(),this._descriptorSet.getTexture(4).destroy(),this._descriptorSet.getTexture(6).destroy())},i._destroyDeferredData=function(){var t=this._pipelineRenderData;if(t){t.gbufferFrameBuffer&&t.gbufferFrameBuffer.destroy(),t.outputFrameBuffer&&t.outputFrameBuffer.destroy(),t.outputDepth&&t.outputDepth.destroy();for(var e=0;e<t.gbufferRenderTargets.length;e++)t.gbufferRenderTargets[e].destroy();t.gbufferRenderTargets.length=0;for(var i=0;i<t.outputRenderTargets.length;i++)t.outputRenderTargets[i].destroy();t.outputRenderTargets.length=0,this._destroyBloomData()}this._pipelineRenderData=null},i._ensureEnoughSize=function(t){for(var e=this._width,i=this._height,n=0;n<t.length;++n){var r=t[n].window;e=Math.max(r.width,e),i=Math.max(r.height,i)}e===this._width&&i===this._height||(this._width=e,this._height=i,this._destroyDeferredData(),this._generateDeferredRenderData())},i._generateDeferredRenderData=function(){for(var t=this,e=this.device,i=this._pipelineRenderData=new D$t,n=this.pipelineSceneData,r=0;r<3;++r)i.gbufferRenderTargets.push(e.createTexture(new dd(1,20,41,this._width*n.shadingScale,this._height*n.shadingScale)));i.outputDepth=e.createTexture(new dd(1,36,55,this._width*n.shadingScale,this._height*n.shadingScale)),i.gbufferFrameBuffer=e.createFramebuffer(new Vd(this._gbufferRenderPass,i.gbufferRenderTargets,i.outputDepth)),i.outputRenderTargets.push(e.createTexture(new dd(1,20,41,this._width*n.shadingScale,this._height*n.shadingScale))),i.outputFrameBuffer=e.createFramebuffer(new Vd(this._lightingRenderPass,i.outputRenderTargets,null)),i.sampler=this.globalDSManager.pointSampler,this.on("attachment-scale-changed",(function(e){i.sampler=e<1?t.globalDSManager.pointSampler:t.globalDSManager.linearSampler,i.gbufferFrameBuffer=t.newFramebufferByRatio(i.gbufferFrameBuffer),i.gbufferFrameBuffer=t.newFramebufferByRatio(i.outputFrameBuffer)}))},e}(LJt),T$t=zh(x$t.prototype,"renderTextures",[S$t,uu],(function(){return[]})),w$t=x$t))||w$t)),I$t=Object.freeze({__proto__:null,BloomStage:A$t,DeferredPipeline:B$t,ForwardFlow:$Qt,ForwardPipeline:s$t,ForwardStage:ZQt,GbufferStage:o$t,LightingStage:f$t,MainFlow:C$t,PostProcessStage:d$t,ReflectionProbeFlow:BZt,ReflectionProbeStage:DZt,RenderFlow:EJt,RenderPipeline:LJt,RenderStage:AJt,ShadowFlow:lZt,ShadowStage:hZt,createDefaultPipeline:IZt});C.legacy_rendering=I$t;var M$t=function(t){function e(){var e;return(e=t.call(this)||this)._gpuDescriptorSet=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._layout=t.layout;var e=t.layout.getGpuDescriptorSetLayout(),i=e.bindings,n=e.descriptorIndices,r=e.descriptorCount;this._buffers=Array(r).fill(null),this._textures=Array(r).fill(null),this._samplers=Array(r).fill(null);var s=[];this._gpuDescriptorSet={gpuDescriptors:s,descriptorIndices:n};for(var a=0;a<i.length;++a)for(var o=i[a],h=0;h<o.count;h++){var u={type:o.descriptorType,gpuBuffer:null,gpuTextureView:null,gpuSampler:null};s.push(u)}},i.destroy=function(){this._layout=null,this._gpuDescriptorSet=null},i.update=function(){if(this._isDirty&&this._gpuDescriptorSet){for(var t=this._gpuDescriptorSet.gpuDescriptors,e=0;e<t.length;++e)t[e].type&np?this._buffers[e]&&(t[e].gpuBuffer=this._buffers[e].getGpuBuffer()):t[e].type&rp&&(this._textures[e]&&(t[e].gpuTextureView=this._textures[e].gpuTextureView),this._samplers[e]&&(t[e].gpuSampler=this._samplers[e].gpuSampler));this._isDirty=!1}},n(e,[{key:"gpuDescriptorSet",get:function(){return this._gpuDescriptorSet}}]),e}(wp),P$t=[10497,33648,33071,33071],E$t=new Float32Array(4),O$t=Math.max,k$t=Math.min;function R$t(t){switch(t){case 4:case 6:case 14:case 16:case 24:case 25:case 27:case 36:case 35:case 37:case 39:case 56:case 58:case 60:case 61:case 62:case 63:case 64:case 66:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 79:case 81:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:default:return 5121;case 5:case 7:case 15:case 17:case 26:case 28:case 38:case 40:case 65:case 67:case 80:case 82:return 5120;case 8:case 18:case 29:case 41:return 5131;case 9:case 19:case 30:case 42:return 5123;case 10:case 20:case 31:case 43:return 5122;case 11:case 21:case 32:case 44:case 53:case 54:case 69:case 68:return 5126;case 12:case 22:case 33:case 45:return 5125;case 13:case 23:case 34:case 46:return 5124;case 47:return 33635;case 48:return 35899;case 49:return 32820;case 50:return 32819;case 51:case 52:return 33640;case 55:return 34042}}function F$t(t){switch(t){case 1:return 6406;case 2:return 6409;case 3:return 6410;case 4:return 33321;case 5:return 36756;case 6:return 33330;case 7:return 33329;case 14:return 33323;case 15:return 36757;case 16:return 33336;case 17:return 33335;case 24:return 32849;case 26:return 36758;case 27:return 36221;case 28:return 36239;case 36:case 35:return 32856;case 38:return 36759;case 39:return 36220;case 40:return 36238;case 10:return 33331;case 9:return 33332;case 8:return 33325;case 20:return 33337;case 19:return 33338;case 18:return 33327;case 31:return 36233;case 30:return 36215;case 29:return 34843;case 43:return 36232;case 42:return 36214;case 41:return 34842;case 13:return 33333;case 12:return 33334;case 11:return 33326;case 23:return 33339;case 22:return 33340;case 21:return 33328;case 34:return 36227;case 33:return 36209;case 32:return 34837;case 46:return 36226;case 45:return 36208;case 44:return 34836;case 47:return 36194;case 49:return 32855;case 50:return 32854;case 25:return 35905;case 37:return 35907;case 51:return 32857;case 52:return 36975;case 48:return 35898;case 54:return 36012;case 55:return 35056;case 56:return 33776;case 57:return 33777;case 58:return 35916;case 59:return 35917;case 60:return 33778;case 61:return 35918;case 62:return 33779;case 63:return 35919;case 72:return 36196;case 73:return 37492;case 74:return 37493;case 75:return 37494;case 76:return 37495;case 77:return 37496;case 78:return 37497;case 79:return 37488;case 80:return 37489;case 81:return 37490;case 82:return 37491;case 83:return 35841;case 84:return 35843;case 85:return 35840;case 86:return 35842;case 89:return 37808;case 90:return 37809;case 91:return 37810;case 92:return 37811;case 93:return 37812;case 94:return 37813;case 95:return 37814;case 96:return 37815;case 97:return 37816;case 98:return 37817;case 99:return 37818;case 100:return 37819;case 101:return 37820;case 102:return 37821;case 103:return 37840;case 104:return 37841;case 105:return 37842;case 106:return 37843;case 107:return 37844;case 108:return 37845;case 109:return 37846;case 110:return 37847;case 111:return 37848;case 112:return 37849;case 113:return 37850;case 114:return 37851;case 115:return 37852;case 116:return 37853;default:return ht(16309),6408}}function L$t(t){switch(t){case 1:return 6406;case 2:return 6409;case 3:return 6410;case 4:case 5:case 6:case 7:case 9:case 10:case 8:case 12:case 13:case 11:return 6403;case 14:case 15:case 16:case 17:case 19:case 20:case 18:case 22:case 23:case 21:return 33319;case 24:case 26:case 27:case 28:case 30:case 31:case 29:case 33:case 34:case 32:case 48:case 47:case 25:return 6407;case 36:case 35:case 38:case 39:case 40:case 42:case 43:case 41:case 45:case 46:case 44:case 51:case 49:case 50:case 37:return 6408;case 54:return 6402;case 55:return 34041;case 56:return 33776;case 57:return 33777;case 58:return 35916;case 59:return 35917;case 60:return 33778;case 61:return 35918;case 62:return 33779;case 63:return 35919;case 72:return 36196;case 73:return 37492;case 74:return 37493;case 75:return 37494;case 76:return 37495;case 77:return 37496;case 78:return 37497;case 79:return 37488;case 80:return 37489;case 81:return 37490;case 82:return 37491;case 83:return 35841;case 84:return 35843;case 85:return 35840;case 86:return 35842;case 89:return 37808;case 90:return 37809;case 91:return 37810;case 92:return 37811;case 93:return 37812;case 94:return 37813;case 95:return 37814;case 96:return 37815;case 97:return 37816;case 98:return 37817;case 99:return 37818;case 100:return 37819;case 101:return 37820;case 102:return 37821;case 103:return 37840;case 104:return 37841;case 105:return 37842;case 106:return 37843;case 107:return 37844;case 108:return 37845;case 109:return 37846;case 110:return 37847;case 111:return 37848;case 112:return 37849;case 113:return 37850;case 114:return 37851;case 115:return 37852;case 116:return 37853;default:return ht(16310),6408}}function V$t(t){switch(t){case 1:return 35670;case 2:return 35671;case 3:return 35672;case 4:return 35673;case 5:return 5124;case 6:return 35667;case 7:return 35668;case 8:return 35669;case 9:return 5125;case 13:return 5126;case 14:return 35664;case 15:return 35665;case 16:return 35666;case 17:return 35674;case 18:return 35685;case 19:return 35686;case 20:return 35687;case 21:return 35675;case 22:return 35688;case 23:return 35689;case 24:return 35690;case 25:return 35676;case 28:return 35678;case 29:return 36289;case 30:return 35679;case 31:return 35680;default:return ht(16311),0}}function N$t(t){switch(t){case 35670:return 1;case 35671:return 2;case 35672:return 3;case 35673:return 4;case 5124:return 5;case 35667:return 6;case 35668:return 7;case 35669:return 8;case 5125:return 9;case 36294:return 10;case 36295:return 11;case 36296:return 12;case 5126:return 13;case 35664:return 14;case 35665:return 15;case 35666:return 16;case 35674:return 17;case 35685:return 18;case 35686:return 19;case 35687:return 20;case 35675:return 21;case 35688:return 22;case 35689:return 23;case 35690:return 24;case 35676:return 25;case 35678:return 28;case 36289:return 29;case 35679:return 30;case 35680:return 31;default:return ht(16313),0}}function z$t(t){switch(t){case 35670:case 5124:case 5125:case 5126:case 35678:case 36289:case 36292:case 35679:case 35680:case 36298:case 36303:case 36299:case 36300:case 36306:case 36311:case 36307:case 36308:return 4;case 35671:case 35667:case 36294:case 35664:return 8;case 35672:case 35668:case 36295:case 35665:return 12;case 35673:case 35669:case 36296:case 35666:case 35674:return 16;case 35685:case 35687:return 24;case 35686:case 35689:return 32;case 35675:return 36;case 35688:case 35690:return 48;case 35676:return 64;default:return ht(16314),0}}function U$t(t){switch(t){case 35674:case 35685:case 35686:return 2;case 35687:case 35675:case 35688:return 3;case 35689:case 35690:case 35676:return 4;default:return 1}}var G$t=[512,513,514,515,516,517,518,519],H$t=[0,7680,7681,7682,7683,5386,34055,34056],W$t=[32774,32778,32779,32775,32776],j$t=[0,1,770,772,771,773,768,774,769,775,776,32769,32770,32771,32772];function q$t(t,e){var i=t.gl,n=t.getStateCache(),r=2&e.memUsage?35048:35044;if(8&e.usage){e.glTarget=34962;var s=i.createBuffer();s&&(e.glBuffer=s,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),a0t.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),a0t.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 X$t(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),a0t.gpuInputAssembler=null,i.bindBuffer(34962,null),n.glArrayBuffer=null;break;case 34963:r&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),a0t.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 Y$t(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),a0t.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),a0t.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 J$t(t,e,i,n,r){if(64&e.usage){e.indirects.clearDraws();for(var s=i.drawInfos,a=0;a<s.length;++a)e.indirects.setDrawInfo(n+a,s[a])}else{var o=i,h=t.gl,u=t.getStateCache();switch(e.glTarget){case 34962:t.extensions.useVAO&&u.glVAO&&(h.bindVertexArray(null),u.glVAO=null),a0t.gpuInputAssembler=null,u.glArrayBuffer!==e.glBuffer&&(h.bindBuffer(34962,e.glBuffer),u.glArrayBuffer=e.glBuffer),Vo.os===Oo.IOS&&2&e.memUsage&&0===n&&r===o.byteLength?h.bufferData(e.glTarget,o,h.DYNAMIC_DRAW):r===o.byteLength?h.bufferSubData(e.glTarget,n,o):h.bufferSubData(e.glTarget,n,o.slice(0,r));break;case 34963:t.extensions.useVAO&&u.glVAO&&(h.bindVertexArray(null),u.glVAO=null),a0t.gpuInputAssembler=null,u.glElementArrayBuffer!==e.glBuffer&&(h.bindBuffer(34963,e.glBuffer),u.glElementArrayBuffer=e.glBuffer),Vo.os===Oo.IOS&&2&e.memUsage&&0===n&&r===o.byteLength?h.bufferData(e.glTarget,o,h.DYNAMIC_DRAW):r===o.byteLength?h.bufferSubData(e.glTarget,n,o):h.bufferSubData(e.glTarget,n,o.slice(0,r));break;case 35345:u.glUniformBuffer!==e.glBuffer&&(h.bindBuffer(35345,e.glBuffer),u.glUniformBuffer=e.glBuffer),Vo.os===Oo.IOS&&2&e.memUsage&&0===n&&r===o.byteLength?h.bufferData(e.glTarget,o,h.DYNAMIC_DRAW):r===o.byteLength?h.bufferSubData(e.glTarget,n,o):h.bufferSubData(e.glTarget,n,new Float32Array(o,0,r/4));break;default:ht(16316)}}}function K$t(t,e){var i=t.gl,n=t.getStateCache(),r=t.capabilities;e.glInternalFmt=F$t(e.format),e.glFormat=L$t(e.format),e.glType=R$t(e.format);var s=e.width,a=e.height,o=e.depth,h=e.arrayLayer;switch(e.type){case 1:e.glTarget=3553;var u=O$t(s,a);if(u>r.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),ip[e.format].isCompressed)for(var c=0;c<e.mipLevel;++c){var f=op(e.format,s,a,1),_=new Uint8Array(f);i.compressedTexImage2D(3553,c,e.glInternalFmt,s,a,0,_),s=O$t(1,s>>1),a=O$t(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 d=O$t(s,a);if(d>r.maxTextureSize&&ht(9100,d,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),ip[e.format].isCompressed)for(var m=0;m<e.mipLevel;++m){var g=op(e.format,s,a,h),y=new Uint8Array(g);i.compressedTexImage3D(35866,m,e.glInternalFmt,s,a,h,0,y),s=O$t(1,s>>1),a=O$t(1,a>>1)}else i.texStorage3D(35866,e.mipLevel,e.glInternalFmt,s,a,h)}break;case 2:e.glTarget=32879;var v=O$t(O$t(s,a),o);if(v>r.max3DTextureSize&&ht(9100,v,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),ip[e.format].isCompressed)for(var S=0;S<e.mipLevel;++S){var w=op(e.format,s,a,o),x=new Uint8Array(w);i.compressedTexImage3D(32879,S,e.glInternalFmt,s,a,o,0,x),s=O$t(1,s>>1),a=O$t(1,a>>1)}else i.texStorage3D(32879,e.mipLevel,e.glInternalFmt,s,a,o)}break;case 3:e.glTarget=34067;var T=O$t(s,a);if(T>r.maxCubeMapTextureSize&&ht(9100,T,r.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var A=n.glTexUnits[n.texUnit];if(A.glTexture!==e.glTexture&&(i.bindTexture(34067,e.glTexture),A.glTexture=e.glTexture),ip[e.format].isCompressed)for(var C=0;C<e.mipLevel;++C){for(var D=op(e.format,s,a,1),B=new Uint8Array(D),I=0;I<6;++I)i.compressedTexImage2D(34069+I,C,e.glInternalFmt,s,a,0,B);s=O$t(1,s>>1),a=O$t(1,a>>1)}else i.texStorage2D(34067,e.mipLevel,e.glInternalFmt,s,a)}break;default:ht(16317),e.type=1,e.glTarget=3553}}function Q$t(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;a<r.length;++a)r[a].glTexture===e.glTexture&&(i.activeTexture(33984+a),s=a,i.bindTexture(e.glTarget,null),r[a].glTexture=null);n.texUnit=s,e.glTexture=null}if(e.glRenderbuffer){var o=n.glRenderbuffer;i.deleteRenderbuffer(e.glRenderbuffer),o===e.glRenderbuffer&&(i.bindRenderbuffer(36161,null),n.glRenderbuffer=null),e.glRenderbuffer=null}}function Z$t(t,e){if(e.size){var i=t.gl,n=t.getStateCache(),r=t.capabilities,s=e.width,a=e.height,o=e.depth,h=e.arrayLayer;switch(e.type){case 1:e.glTarget=3553;var u=O$t(s,a);if(u>r.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),ip[e.format].isCompressed)for(var c=0;c<e.mipLevel;++c){var f=op(e.format,s,a,1),_=new Uint8Array(f);i.compressedTexImage2D(3553,c,e.glInternalFmt,s,a,0,_),s=O$t(1,s>>1),a=O$t(1,a>>1)}else Q$t(t,e),K$t(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 d=O$t(s,a);if(d>r.maxTextureSize&&ht(9100,d,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),ip[e.format].isCompressed)for(var m=0;m<e.mipLevel;++m){var g=op(e.format,s,a,h),y=new Uint8Array(g);i.compressedTexImage3D(35866,m,e.glInternalFmt,s,a,h,0,y),s=O$t(1,s>>1),a=O$t(1,a>>1)}else i.texStorage3D(35866,e.mipLevel,e.glInternalFmt,s,a,h)}break;case 2:e.glTarget=32879;var v=O$t(O$t(s,a),o);if(v>r.max3DTextureSize&&ht(9100,v,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),ip[e.format].isCompressed)for(var S=0;S<e.mipLevel;++S){var w=op(e.format,s,a,o),x=new Uint8Array(w);i.compressedTexImage3D(32879,S,e.glInternalFmt,s,a,o,0,x),s=O$t(1,s>>1),a=O$t(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=O$t(s,a);T>r.maxCubeMapTextureSize&&ht(9100,T,r.maxTextureSize);var A=n.glTexUnits[n.texUnit];if(A.glTexture!==e.glTexture&&(i.bindTexture(34067,e.glTexture),A.glTexture=e.glTexture),ip[e.format].isCompressed)for(var C=0;C<6;++C){s=e.width,a=e.height;for(var D=0;D<e.mipLevel;++D){var B=op(e.format,s,a,1),I=new Uint8Array(B);i.compressedTexImage2D(34069+C,D,e.glInternalFmt,s,a,0,I),s=O$t(1,s>>1),a=O$t(1,a>>1)}}else Q$t(t,e),K$t(t,e);break;default:ht(16317),e.type=1,e.glTarget=3553}}}function $$t(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<r.length;++s)r[s]===n.value&&(i.bindSampler(s,null),r[s]=null)}e.glSamplers.clear()}function t0t(t,e){for(var i=t.getStateCache(),n=0;n<e.gpuColorViews.length;++n)if(e.gpuColorViews[n].gpuTexture.isSwapchainTexture)return void(e.isOffscreen=!1);var r=t.gl,s=[],a=r.createFramebuffer();if(a){e.glFramebuffer=a,i.glFramebuffer!==e.glFramebuffer&&r.bindFramebuffer(36160,e.glFramebuffer);for(var o=0;o<e.gpuColorViews.length;++o){var h=e.gpuColorViews[o],u=h.gpuTexture;u&&(u.glTexture?r.framebufferTexture2D(36160,36064+o,u.glTarget,u.glTexture,h.baseLevel):r.framebufferRenderbuffer(36160,36064+o,36161,u.glRenderbuffer),s.push(36064+o),e.width=k$t(e.width,u.width>>h.baseLevel),e.height=k$t(e.height,u.height>>h.baseLevel))}var l=e.gpuDepthStencilView;if(l){var c=l.gpuTexture,f=ip[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=k$t(e.width,c.width>>l.baseLevel),e.height=k$t(e.height,c.height>>l.baseLevel)}r.drawBuffers(s);var _=r.checkFramebufferStatus(36160);if(36053!==_)switch(_){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 e0t(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 i0t(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+++" "}))),J(n.getShaderInfoLog(t.glShader));for(var h=0;h<e.gpuStages.length;h++){var u=e.gpuStages[o];u.glShader&&(n.deleteShader(u.glShader),u.glShader=null)}return{v:void 0}}},o=0;o<e.gpuStages.length;o++)if(i=a())return i.v;var h=n.createProgram();if(h){e.glProgram=h;for(var u=!(!A.rendering||!A.rendering.enableEffectImport),l=0;l<e.gpuStages.length;l++){var c=e.gpuStages[l];n.attachShader(e.glProgram,c.glShader)}n.linkProgram(e.glProgram);for(var f=0;f<e.gpuStages.length;f++){var _=e.gpuStages[f];_.glShader&&(n.detachShader(e.glProgram,_.glShader),n.deleteShader(_.glShader),_.glShader=null)}if(!n.getProgramParameter(e.glProgram,35714))return ht(16326,e.name),void J(n.getProgramInfoLog(e.glProgram));rt(16325,e.name);var d=n.getProgramParameter(e.glProgram,35721);e.glInputs=new Array(d);for(var p=0;p<d;++p){var m=n.getActiveAttrib(e.glProgram,p);if(m){var g,y=m.name.indexOf("[");g=-1!==y?m.name.substring(0,y):m.name;var v=n.getAttribLocation(e.glProgram,g),b=N$t(m.type),S=z$t(m.type);e.glInputs[p]={name:g,type:b,stride:S,count:m.size,size:S*m.size,glType:m.type,glLoc:v}}}var w,x,T,C,D=n.getProgramParameter(e.glProgram,35382);if(D){e.glBlocks=new Array(D);for(var B=0;B<D;++B){var I=(w=n.getActiveUniformBlockName(e.glProgram,B)).indexOf("[");-1!==I&&(w=w.substring(0,I)),C=null;for(var M=0;M<e.blocks.length;M++)if(e.blocks[M].name===w){C=e.blocks[M];break}if(C){x=B,T=n.getActiveUniformBlockParameter(e.glProgram,x,35392);var P=u?C.flattened:C.binding+(t.bindingMappings.blockOffsets[C.set]||0);n.uniformBlockBinding(e.glProgram,x,P),e.glBlocks[B]={set:C.set,binding:C.binding,idx:x,name:w,size:T,glBinding:P}}else ht(16404,w)}}for(var E=0;E<e.subpassInputs.length;++E){var O=e.subpassInputs[E];e.samplerTextures.push(new vd(O.set,O.binding,O.name,28,O.count))}if(e.samplerTextures.length>0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var k=0;k<e.samplerTextures.length;++k){var R=e.samplerTextures[k];e.glSamplerTextures[k]={set:R.set,binding:R.binding,name:R.name,type:R.type,count:R.count,units:[],glUnits:null,glType:V$t(R.type),glLoc:null}}}var F=[],L=[],V=r.texUnitCacheMap;if(u)for(var N=0;N<e.samplerTextures.length;++N){var z=e.samplerTextures[N],U=n.getUniformLocation(e.glProgram,z.name);U&&-1!==U.id&&(F.push(e.glSamplerTextures[N]),L.push(U)),void 0===V[z.name]&&(V[z.name]=z.flattened%s.maxTextureUnits)}else{for(var G=0,H=0;H<e.blocks.length;++H)e.blocks[H].set===t.bindingMappings.flexibleSet&&G++;for(var W=0,j=0;j<e.samplerTextures.length;++j){var q=e.samplerTextures[j],X=n.getUniformLocation(e.glProgram,q.name);if(X&&-1!==X.id&&(F.push(e.glSamplerTextures[j]),L.push(X)),void 0===V[q.name]){var Y=q.binding+t.bindingMappings.samplerTextureOffsets[q.set]+W;q.set===t.bindingMappings.flexibleSet&&(Y-=G),V[q.name]=Y%s.maxTextureUnits,W+=q.count-1}}}if(F.length){for(var K=[],Q=0;Q<F.length;++Q){var Z=F[Q],$=V[Z.name];if(void 0!==$){Z.glLoc=L[Q];for(var tt=0;tt<Z.count;++tt){for(;K[$];)$=($+1)%s.maxTextureUnits;Z.units.push($),K[$]=!0}}}for(var et=0,it=0;it<F.length;++it){var nt=F[it];if(!nt.glLoc){for(nt.glLoc=L[it];K[et];)et++;for(var st=0;st<nt.count;++st){for(;K[et];)et=(et+1)%s.maxTextureUnits;void 0===V[nt.name]&&(V[nt.name]=et),nt.units.push(et),K[et]=!0}}}r.glProgram!==e.glProgram&&n.useProgram(e.glProgram);for(var at=0;at<F.length;at++){var ot=F[at];ot.glUnits=new Int32Array(ot.units),n.uniform1iv(ot.glLoc,ot.glUnits)}r.glProgram!==e.glProgram&&n.useProgram(r.glProgram)}e.glSamplerTextures=F}}function n0t(t,e){var i=t.gl,n=t.getStateCache();e.glProgram&&(i.deleteProgram(e.glProgram),n.glProgram===e.glProgram&&(i.useProgram(null),n.glProgram=null),e.glProgram=null)}function r0t(t,e){t.gl,e.glAttribs=new Array(e.attributes.length);for(var i=[0,0,0,0,0,0,0,0],n=0;n<e.attributes.length;++n){var r=e.attributes[n],s=void 0!==r.stream?r.stream:0,a=e.gpuVertexBuffers[s],o=R$t(r.format),h=ip[r.format].size;e.glAttribs[n]={name:r.name,glBuffer:a.glBuffer,glType:o,size:h,count:ip[r.format].count,stride:a.stride,componentCount:U$t(o),isNormalized:void 0!==r.isNormalized&&r.isNormalized,isInstanced:void 0!==r.isInstanced&&r.isInstanced,offset:i[s]},i[s]+=h}}function s0t(t,e){for(var i=t.gl,n=t.getStateCache(),r=e.glVAOs.values(),s=r.next(),a=n.glVAO;!s.done;)i.deleteVertexArray(s.value),a===s.value&&(i.bindVertexArray(null),a=null),s=r.next();n.glVAO=a,e.glVAOs.clear()}var a0t={gpuPipelineState:null,gpuInputAssembler:null,glPrimitive:0,invalidateAttachments:[]};function o0t(t,e,i,n,r,s,a){var o=t.gl,h=t.getStateCache(),u=0;if(i&&e){h.glFramebuffer!==i.glFramebuffer&&(o.bindFramebuffer(36160,i.glFramebuffer),h.glFramebuffer=i.glFramebuffer),h.viewport.left===n.x&&h.viewport.top===n.y&&h.viewport.width===n.width&&h.viewport.height===n.height||(o.viewport(n.x,n.y,n.width,n.height),h.viewport.left=n.x,h.viewport.top=n.y,h.viewport.width=n.width,h.viewport.height=n.height),h.scissorRect.x===n.x&&h.scissorRect.y===n.y&&h.scissorRect.width===n.width&&h.scissorRect.height===n.height||(o.scissor(n.x,n.y,n.width,n.height),h.scissorRect.x=n.x,h.scissorRect.y=n.y,h.scissorRect.width=n.width,h.scissorRect.height=n.height),a0t.invalidateAttachments.length=0;for(var l=0;l<r.length;++l){var c=e.colorAttachments[l];if(0!==c.format)switch(c.loadOp){case 0:break;case 1:if(15!==h.bs.targets[0].blendColorMask&&o.colorMask(!0,!0,!0,!0),1===e.colorAttachments.length){var f=r[0];o.clearColor(f.x,f.y,f.z,f.w),u|=16384}else E$t[0]=r[l].x,E$t[1]=r[l].y,E$t[2]=r[l].z,E$t[3]=r[l].w,o.clearBufferfv(6144,l,E$t);break;case 2:a0t.invalidateAttachments.push(36064+l)}}if(e.depthStencilAttachment&&0!==e.depthStencilAttachment.format){switch(e.depthStencilAttachment.depthLoadOp){case 0:break;case 1:h.dss.depthWrite||o.depthMask(!0),o.clearDepth(s),u|=256;break;case 2:a0t.invalidateAttachments.push(36096)}if(ip[e.depthStencilAttachment.format].hasStencil)switch(e.depthStencilAttachment.stencilLoadOp){case 0:break;case 1:h.dss.stencilWriteMaskFront||o.stencilMaskSeparate(1028,65535),h.dss.stencilWriteMaskBack||o.stencilMaskSeparate(1029,65535),o.clearStencil(a),u|=1024;break;case 2:a0t.invalidateAttachments.push(36128)}}if(i.glFramebuffer&&a0t.invalidateAttachments.length&&o.invalidateFramebuffer(36160,a0t.invalidateAttachments),u&&o.clear(u),16384&u){var _=h.bs.targets[0].blendColorMask;if(15!==_){var d=!!(1&_),p=!!(2&_),m=!!(4&_),g=!!(8&_);o.colorMask(d,p,m,g)}}256&u&&!h.dss.depthWrite&&o.depthMask(!1),1024&u&&(h.dss.stencilWriteMaskFront||o.stencilMaskSeparate(1028,0),h.dss.stencilWriteMaskBack||o.stencilMaskSeparate(1029,0))}}function h0t(t,e,i,n,r,s){var a=t.gl,o=t.capabilities,h=t.getStateCache(),u=h.rs,l=h.dss,c=h.bs,f=c.blendColor,_=e&&e.gpuShader,d=!1;if(e&&a0t.gpuPipelineState!==e){if(a0t.gpuPipelineState=e,a0t.glPrimitive=e.glPrimitive,_){var p=_.glProgram;h.glProgram!==p&&(a.useProgram(p),h.glProgram=p,d=!0)}var m=e.rs;if(m){if(u.cullMode!==m.cullMode){switch(m.cullMode){case 0:a.disable(2884);break;case 1:a.enable(2884),a.cullFace(1028);break;case 2:a.enable(2884),a.cullFace(1029)}u.cullMode=m.cullMode}var g=m.isFrontFaceCCW;u.isFrontFaceCCW!==g&&(a.frontFace(g?2305:2304),u.isFrontFaceCCW=g),u.depthBias===m.depthBias&&u.depthBiasSlop===m.depthBiasSlop||(a.polygonOffset(m.depthBias,m.depthBiasSlop),u.depthBias=m.depthBias,u.depthBiasSlop=m.depthBiasSlop),u.lineWidth!==m.lineWidth&&(a.lineWidth(m.lineWidth),u.lineWidth=m.lineWidth)}var y=e.dss;y&&(l.depthTest!==y.depthTest&&(y.depthTest?a.enable(2929):a.disable(2929),l.depthTest=y.depthTest),l.depthWrite!==y.depthWrite&&(a.depthMask(y.depthWrite),l.depthWrite=y.depthWrite),l.depthFunc!==y.depthFunc&&(a.depthFunc(G$t[y.depthFunc]),l.depthFunc=y.depthFunc),l.stencilTestFront===y.stencilTestFront&&l.stencilTestBack===y.stencilTestBack||(y.stencilTestFront||y.stencilTestBack?a.enable(2960):a.disable(2960),l.stencilTestFront=y.stencilTestFront,l.stencilTestBack=y.stencilTestBack),l.stencilFuncFront===y.stencilFuncFront&&l.stencilRefFront===y.stencilRefFront&&l.stencilReadMaskFront===y.stencilReadMaskFront||(a.stencilFuncSeparate(1028,G$t[y.stencilFuncFront],y.stencilRefFront,y.stencilReadMaskFront),l.stencilFuncFront=y.stencilFuncFront,l.stencilRefFront=y.stencilRefFront,l.stencilReadMaskFront=y.stencilReadMaskFront),l.stencilFailOpFront===y.stencilFailOpFront&&l.stencilZFailOpFront===y.stencilZFailOpFront&&l.stencilPassOpFront===y.stencilPassOpFront||(a.stencilOpSeparate(1028,H$t[y.stencilFailOpFront],H$t[y.stencilZFailOpFront],H$t[y.stencilPassOpFront]),l.stencilFailOpFront=y.stencilFailOpFront,l.stencilZFailOpFront=y.stencilZFailOpFront,l.stencilPassOpFront=y.stencilPassOpFront),l.stencilWriteMaskFront!==y.stencilWriteMaskFront&&(a.stencilMaskSeparate(1028,y.stencilWriteMaskFront),l.stencilWriteMaskFront=y.stencilWriteMaskFront),l.stencilFuncBack===y.stencilFuncBack&&l.stencilRefBack===y.stencilRefBack&&l.stencilReadMaskBack===y.stencilReadMaskBack||(a.stencilFuncSeparate(1029,G$t[y.stencilFuncBack],y.stencilRefBack,y.stencilReadMaskBack),l.stencilFuncBack=y.stencilFuncBack,l.stencilRefBack=y.stencilRefBack,l.stencilReadMaskBack=y.stencilReadMaskBack),l.stencilFailOpBack===y.stencilFailOpBack&&l.stencilZFailOpBack===y.stencilZFailOpBack&&l.stencilPassOpBack===y.stencilPassOpBack||(a.stencilOpSeparate(1029,H$t[y.stencilFailOpBack],H$t[y.stencilZFailOpBack],H$t[y.stencilPassOpBack]),l.stencilFailOpBack=y.stencilFailOpBack,l.stencilZFailOpBack=y.stencilZFailOpBack,l.stencilPassOpBack=y.stencilPassOpBack),l.stencilWriteMaskBack!==y.stencilWriteMaskBack&&(a.stencilMaskSeparate(1029,y.stencilWriteMaskBack),l.stencilWriteMaskBack=y.stencilWriteMaskBack));var v=e.bs;if(v){c.isA2C!==v.isA2C&&(v.isA2C?a.enable(32926):a.disable(32926),c.isA2C=v.isA2C);var b=v.blendColor;f.x===b.x&&f.y===b.y&&f.z===b.z&&f.w===b.w||(a.blendColor(b.x,b.y,b.z,b.w),f.x=b.x,f.y=b.y,f.z=b.z,f.w=b.w);var S=v.targets[0],w=h.bs.targets[0];w.blend!==S.blend&&(S.blend?a.enable(3042):a.disable(3042),w.blend=S.blend),w.blendEq===S.blendEq&&w.blendAlphaEq===S.blendAlphaEq||(a.blendEquationSeparate(W$t[S.blendEq],W$t[S.blendAlphaEq]),w.blendEq=S.blendEq,w.blendAlphaEq=S.blendAlphaEq),w.blendSrc===S.blendSrc&&w.blendDst===S.blendDst&&w.blendSrcAlpha===S.blendSrcAlpha&&w.blendDstAlpha===S.blendDstAlpha||(a.blendFuncSeparate(j$t[S.blendSrc],j$t[S.blendDst],j$t[S.blendSrcAlpha],j$t[S.blendDstAlpha]),w.blendSrc=S.blendSrc,w.blendDst=S.blendDst,w.blendSrcAlpha=S.blendSrcAlpha,w.blendDstAlpha=S.blendDstAlpha),w.blendColorMask!==S.blendColorMask&&(a.colorMask(!!(1&S.blendColorMask),!!(2&S.blendColorMask),!!(4&S.blendColorMask),!!(8&S.blendColorMask)),w.blendColorMask=S.blendColorMask)}}if(e&&e.gpuPipelineLayout&&_){for(var x=_.glBlocks.length,T=e.gpuPipelineLayout.dynamicOffsetIndices,A=0;A<x;A++){var C=_.glBlocks[A],D=n[C.set],B=D&&D.descriptorIndices[C.binding],I=B>=0&&D.gpuDescriptors[B];if(I&&I.gpuBuffer){var M=T[C.set],P=M&&M[C.binding],E=I.gpuBuffer.glOffset;P>=0&&(E+=r[P]),h.glBindUBOs[C.glBinding]===I.gpuBuffer.glBuffer&&h.glBindUBOOffsets[C.glBinding]===E||(E?a.bindBufferRange(35345,C.glBinding,I.gpuBuffer.glBuffer,E,I.gpuBuffer.size):a.bindBufferBase(35345,C.glBinding,I.gpuBuffer.glBuffer),h.glUniformBuffer=h.glBindUBOs[C.glBinding]=I.gpuBuffer.glBuffer,h.glBindUBOOffsets[C.glBinding]=E)}}for(var O=_.glSamplerTextures.length,k=0;k<O;k++)for(var R=_.glSamplerTextures[k],F=n[R.set],L=F&&F.descriptorIndices[R.binding],V=L>=0&&F.gpuDescriptors[L],N=0;N<R.units.length;N++){var z=R.units[N],U=h.glTexUnits[z];if(V&&V.gpuTextureView&&V.gpuTextureView.gpuTexture&&V.gpuSampler){var G=V.gpuTextureView,H=G.gpuTexture,W=G.baseLevel,j=W+G.levelCount;if(H.size>0){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||a0t.gpuInputAssembler!==i))if(a0t.gpuInputAssembler=i,t.extensions.useVAO){var X=i.glVAOs.get(_.glProgram);if(!X){var Y;X=a.createVertexArray(),i.glVAOs.set(_.glProgram,X),a.bindVertexArray(X),a.bindBuffer(34962,null),a.bindBuffer(34963,null),h.glArrayBuffer=null,h.glElementArrayBuffer=null;for(var J=0;J<_.glInputs.length;J++){var K=_.glInputs[J];Y=null;for(var Q=0;Q<i.glAttribs.length;Q++){var Z=i.glAttribs[Q];if(Z.name===K.name){Y=Z;break}}if(Y){h.glArrayBuffer!==Y.glBuffer&&(a.bindBuffer(34962,Y.glBuffer),h.glArrayBuffer=Y.glBuffer);for(var $=0;$<Y.componentCount;++$){var tt=K.glLoc+$,et=Y.offset+Y.size*$;a.enableVertexAttribArray(tt),h.glCurrentAttribLocs[tt]=!0,a.vertexAttribPointer(tt,Y.count,Y.glType,Y.isNormalized,Y.stride,et),a.vertexAttribDivisor(tt,Y.isInstanced?1:0)}}}var it=i.gpuIndexBuffer;it&&a.bindBuffer(34963,it.glBuffer),a.bindVertexArray(null),a.bindBuffer(34962,null),a.bindBuffer(34963,null),h.glArrayBuffer=null,h.glElementArrayBuffer=null}h.glVAO!==X&&(a.bindVertexArray(X),h.glVAO=X)}else{for(var nt=0;nt<o.maxVertexAttributes;++nt)h.glCurrentAttribLocs[nt]=!1;for(var rt=0;rt<_.glInputs.length;rt++){for(var st=_.glInputs[rt],at=null,ot=0;ot<i.glAttribs.length;ot++){var ht=i.glAttribs[ot];if(ht.name===st.name){at=ht;break}}if(at){h.glArrayBuffer!==at.glBuffer&&(a.bindBuffer(34962,at.glBuffer),h.glArrayBuffer=at.glBuffer);for(var ut=0;ut<at.componentCount;++ut){var lt=st.glLoc+ut,ct=at.offset+at.size*ut;!h.glEnabledAttribLocs[lt]&<>=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 _t=0;_t<o.maxVertexAttributes;++_t)h.glEnabledAttribLocs[_t]!==h.glCurrentAttribLocs[_t]&&(a.disableVertexAttribArray(_t),h.glEnabledAttribLocs[_t]=!1)}if(e&&e.dynamicStates.length)for(var dt=e.dynamicStates.length,pt=0;pt<dt;pt++)switch(e.dynamicStates[pt]){case 1:u.lineWidth!==s.lineWidth&&(a.lineWidth(s.lineWidth),u.lineWidth=s.lineWidth);break;case 2:u.depthBias===s.depthBiasConstant&&h.rs.depthBiasSlop===s.depthBiasSlope||(a.polygonOffset(s.depthBiasConstant,s.depthBiasSlope),u.depthBias=s.depthBiasConstant,u.depthBiasSlop=s.depthBiasSlope);break;case 4:var mt=s.blendConstant;f.x===mt.x&&f.y===mt.y&&f.z===mt.z&&f.w===mt.w||(a.blendColor(mt.x,mt.y,mt.z,mt.w),f.copy(mt));break;case 16:var gt=s.stencilStatesFront,yt=s.stencilStatesBack;l.stencilWriteMaskFront!==gt.writeMask&&(a.stencilMaskSeparate(1028,gt.writeMask),l.stencilWriteMaskFront=gt.writeMask),l.stencilWriteMaskBack!==yt.writeMask&&(a.stencilMaskSeparate(1029,yt.writeMask),l.stencilWriteMaskBack=yt.writeMask);break;case 32:var vt=s.stencilStatesFront,bt=s.stencilStatesBack;l.stencilRefFront===vt.reference&&l.stencilReadMaskFront===vt.compareMask||(a.stencilFuncSeparate(1028,G$t[l.stencilFuncFront],vt.reference,vt.compareMask),l.stencilRefFront=vt.reference,l.stencilReadMaskFront=vt.compareMask),l.stencilRefBack===bt.reference&&l.stencilReadMaskBack===bt.compareMask||(a.stencilFuncSeparate(1029,G$t[l.stencilFuncBack],bt.reference,bt.compareMask),l.stencilRefBack=bt.reference,l.stencilReadMaskBack=bt.compareMask)}}function u0t(t,e){var i=t.gl,n=a0t.gpuInputAssembler,r=a0t.glPrimitive,s=t.extensions.WEBGL_multi_draw;if(n){var a=n.gpuIndexBuffer;if(n.gpuIndirectBuffer){var o=n.gpuIndirectBuffer.indirects;if(o.drawByIndex){for(var h=0;h<o.drawCount;h++)o.byteOffsets[h]=o.offsets[h]*a.stride;if(s)o.instancedDraw?s.multiDrawElementsInstancedWEBGL(r,o.counts,0,n.glIndexType,o.byteOffsets,0,o.instances,0,o.drawCount):s.multiDrawElementsWEBGL(r,o.counts,0,n.glIndexType,o.byteOffsets,0,o.drawCount);else for(var u=0;u<o.drawCount;u++)o.instances[u]?i.drawElementsInstanced(r,o.counts[u],n.glIndexType,o.byteOffsets[u],o.instances[u]):i.drawElements(r,o.counts[u],n.glIndexType,o.byteOffsets[u])}else if(s)o.instancedDraw?s.multiDrawArraysInstancedWEBGL(r,o.offsets,0,o.counts,0,o.instances,0,o.drawCount):s.multiDrawArraysWEBGL(r,o.offsets,0,o.counts,0,o.drawCount);else for(var l=0;l<o.drawCount;l++)o.instances[l]?i.drawArraysInstanced(r,o.offsets[l],o.counts[l],o.instances[l]):i.drawArrays(r,o.offsets[l],o.counts[l])}else if(e.instanceCount)if(a){if(e.indexCount>0){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 l0t(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 c0t(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||l0t(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;u<n.length;u++){var l=n[u];r.texSubImage2D(3553,l.texSubres.mipLevel,l.texOffset.x,l.texOffset.y,i.glFormat,i.glType,e[o++])}break;case 34067:for(var c=0;c<n.length;c++){var f=n[c],_=f.texSubres,d=f.texOffset,p=_.baseArrayLayer+_.layerCount;for(h=_.baseArrayLayer;h<p;++h)r.texSubImage2D(34069+h,_.mipLevel,d.x,d.y,i.glFormat,i.glType,e[o++])}break;default:ht(16327)}1&i.flags&&r.generateMipmap(i.glTarget)}var f0t=new Uint8Array(1);function _0t(t,e,i,n,r){var s=fp(e).height,a=op(e,r.width,r.height,r.depth),o=op(e,n.width,1,1),h=op(e,n.width,n.height,1),u=op(e,r.width,1,1),l=cp(ip[e]);f0t.byteLength<a&&(f0t=new Uint8Array(a));for(var c=0,f=i,_=0;_<r.depth;_++){f=i+h*_;for(var d=0;d<r.height;d+=s)f0t.subarray(c,c+u).set(new Uint8Array(t.buffer,t.byteOffset+f,u)),c+=u,f+=o}var p=a/l.BYTES_PER_ELEMENT;return lt(Number.isInteger(p),9101),new l(f0t.buffer,0,p)}function d0t(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,u=ip[i.format],l=cp(u),c=u.isCompressed,f=fp(i.format),_=new Q_,d=new J_,p=new Q_;switch(i.glTarget){case 3553:for(var m=0;m<n.length;m++){var g=n[m],y=g.texSubres.mipLevel,v=g.texOffset,b=g.texExtent,S=b.width,w=b.height,x=f.width,T=f.height,A=g.buffStride;d.x=0===v.x?0:_p(v.x,x),d.y=0===v.y?0:_p(v.y,T),_.width=S<x?S:_p(S,x),_.height=w<T?S:_p(w,T),p.width=A>0?A:_.width,p.height=g.buffTexHeight>0?g.buffTexHeight:_.height;var C=S+d.x===i.width>>y?S:_.width,D=w+d.y===i.height>>y?w:_.height,B=void 0,I=e[o++];if(p.width===_.width&&p.height===_.height){var M=op(i.format,C,D,1)/l.BYTES_PER_ELEMENT;lt(Number.isInteger(M),9101),B=new l(I.buffer,I.byteOffset+g.buffOffset,M)}else B=_0t(I,i.format,g.buffOffset,p,_);c?36196!==i.glInternalFmt?r.compressedTexSubImage2D(3553,y,d.x,d.y,C,D,i.glFormat,B):r.compressedTexImage2D(3553,y,i.glInternalFmt,C,D,0,B):r.texSubImage2D(3553,y,d.x,d.y,C,D,i.glFormat,i.glType,B)}break;case 35866:for(var P=0;P<n.length;P++){var E=n[P],O=E.texSubres.mipLevel,k=E.texOffset,R=E.texExtent,F=R.width,L=R.height,V=f.width,N=f.height,z=E.buffStride,U=E.texSubres;d.x=0===k.x?0:_p(k.x,V),d.y=0===k.y?0:_p(k.y,N),_.width=F<V?F:_p(F,V),_.height=L<N?F:_p(L,N),_.depth=1,p.width=z>0?z:_.width,p.height=E.buffTexHeight>0?E.buffTexHeight:_.height;var G=F+d.x===i.width>>O?F:_.width,H=L+d.y===i.height>>O?L:_.height,W=U.baseArrayLayer+U.layerCount;for(h=U.baseArrayLayer;h<W;++h){d.z=h;var j=void 0,q=e[o++];if(p.width===_.width&&p.height===_.height){var X=op(i.format,G,H,1)/l.BYTES_PER_ELEMENT;lt(Number.isInteger(X),9101),j=new l(q.buffer,q.byteOffset+E.buffOffset,X)}else j=_0t(q,i.format,E.buffOffset,p,_);c?36196!==i.glInternalFmt?r.compressedTexSubImage3D(35866,O,d.x,d.y,d.z,G,H,_.depth,i.glFormat,j):r.compressedTexImage3D(35866,O,i.glInternalFmt,G,H,_.depth,0,j):r.texSubImage3D(35866,O,d.x,d.y,d.z,G,H,_.depth,i.glFormat,i.glType,j)}}break;case 32879:for(var Y=0;Y<n.length;Y++){var J=n[Y],K=J.texSubres.mipLevel,Q=J.texOffset,Z=J.texExtent,$=Z.width,tt=Z.height,et=f.width,it=f.height,nt=J.buffStride;d.x=0===Q.x?0:_p(Q.x,et),d.y=0===Q.y?0:_p(Q.y,it),d.z=Q.z,_.width=$<et?$:_p($,et),_.height=tt<it?$:_p(tt,it),_.depth=Z.depth,p.width=nt>0?nt:_.width,p.height=J.buffTexHeight>0?J.buffTexHeight:_.height;var rt=$+d.x===i.width>>K?$:_.width,st=tt+d.y===i.height>>K?tt:_.height,at=void 0,ot=e[o++];if(p.width===_.width&&p.height===_.height){var ut=op(i.format,rt,st,_.depth)/l.BYTES_PER_ELEMENT;lt(Number.isInteger(ut),9101),at=new l(ot.buffer,ot.byteOffset+J.buffOffset,ut)}else at=_0t(ot,i.format,J.buffOffset,p,_);c?36196!==i.glInternalFmt?r.compressedTexSubImage3D(35866,K,d.x,d.y,d.z,rt,st,_.depth,i.glFormat,at):r.compressedTexImage3D(35866,K,i.glInternalFmt,rt,st,_.depth,0,at):r.texSubImage3D(35866,K,d.x,d.y,d.z,rt,st,_.depth,i.glFormat,i.glType,at)}break;case 34067:for(var ct=0;ct<n.length;ct++){var ft=n[ct],_t=ft.texSubres.mipLevel,dt=ft.texOffset,pt=ft.texExtent,mt=pt.width,gt=pt.height,yt=f.width,vt=f.height,bt=ft.buffStride,St=ft.texSubres;d.x=0===dt.x?0:_p(dt.x,yt),d.y=0===dt.y?0:_p(dt.y,vt),_.width=mt<yt?mt:_p(mt,yt),_.height=gt<vt?mt:_p(gt,vt),p.width=bt>0?bt:_.width,p.height=ft.buffTexHeight>0?ft.buffTexHeight:_.height;var wt=mt+d.x===i.width>>_t?mt:_.width,xt=gt+d.y===i.height>>_t?gt:_.height,Tt=St.baseArrayLayer+St.layerCount;for(h=St.baseArrayLayer;h<Tt;++h){var At=void 0,Ct=e[o++];if(p.width===_.width&&p.height===_.height){var Dt=op(i.format,wt,xt,1)/l.BYTES_PER_ELEMENT;lt(Number.isInteger(Dt),9101),At=new l(Ct.buffer,Ct.byteOffset+ft.buffOffset,Dt)}else At=_0t(Ct,i.format,ft.buffOffset,p,_);c?36196!==i.glInternalFmt?r.compressedTexSubImage2D(34069+h,_t,d.x,d.y,wt,xt,i.glFormat,At):r.compressedTexImage2D(34069+h,_t,i.glInternalFmt,wt,xt,0,At):r.texSubImage2D(34069+h,_t,d.x,d.y,wt,xt,i.glFormat,i.glType,At)}}break;default:ht(16327)}1&i.flags&&r.generateMipmap(i.glTarget)}function p0t(t,e,i,n){var r=t.gl,s=t.getStateCache(),a=r.createFramebuffer();r.bindFramebuffer(36160,a);var o=0,h=0,u=1,l=1;if(3553===e.glTarget)for(var c=0;c<n.length;c++){var f=n[c];r.framebufferTexture2D(36160,36064,e.glTarget,e.glTexture,f.texSubres.mipLevel),o=f.texOffset.x,h=f.texOffset.y,u=f.texExtent.width,l=f.texExtent.height,r.readPixels(o,h,u,l,e.glFormat,e.glType,i[c])}else ht(16399);r.bindFramebuffer(36160,null),s.glFramebuffer=null,r.deleteFramebuffer(a)}function m0t(t,e,i,n,r){var s=t.gl,a=t.getStateCache(),o=t.blitManager;if(o){var h=2===r||3===r?9729:9728,u=o.srcFramebuffer,l=o.dstFramebuffer,c=a.glReadFramebuffer,f=a.glFramebuffer,_=n[0].srcSubres.mipLevel,d=n[0].dstSubres.mipLevel,p=function(t){var e=0,i=36064;return t.hasStencil?i=33306:t.hasDepth&&(i=36096),t.hasDepth||t.hasStencil?(t.hasDepth&&(e|=256),t.hasStencil&&(e|=1024)):e|=16384,{mask:e,attachment:i}},m=n.map((function(t,e){return e}));m.sort((function(t,e){return n[t].srcSubres.mipLevel-n[e].srcSubres.mipLevel}));var g=p(ip[e.format]),y=g.mask,v=g.attachment,b=p(ip[i.format]).attachment;a.glReadFramebuffer!==u&&(s.bindFramebuffer(36008,u),a.glReadFramebuffer=u),a.glFramebuffer!==l&&(s.bindFramebuffer(36009,l),a.glFramebuffer=l),e.glTexture?s.framebufferTexture2D(36008,v,e.glTarget,e.glTexture,_):s.framebufferRenderbuffer(36008,v,36161,e.glRenderbuffer),i.glTexture?s.framebufferTexture2D(36009,b,i.glTarget,i.glTexture,d):s.framebufferRenderbuffer(36009,b,36161,i.glRenderbuffer);for(var S=0;S<m.length;S++){var w=n[m[S]];e.glTexture&&_!==w.srcSubres.mipLevel&&(_=w.srcSubres.mipLevel,s.framebufferTexture2D(36008,v,e.glTarget,e.glTexture,_)),i.glTexture&&d!==w.dstSubres.mipLevel&&(d=w.dstSubres.mipLevel,s.framebufferTexture2D(36009,b,i.glTarget,i.glTexture,d)),s.blitFramebuffer(w.srcOffset.x,w.srcOffset.y,w.srcOffset.x+w.srcExtent.width,w.srcOffset.y+w.srcExtent.height,w.dstOffset.x,w.dstOffset.y,w.dstOffset.x+w.dstExtent.width,w.dstOffset.y+w.dstExtent.height,y,h)}a.glReadFramebuffer!==c&&(s.bindFramebuffer(36008,c),a.glReadFramebuffer=c),a.glFramebuffer!==f&&(s.bindFramebuffer(36009,f),a.glFramebuffer=f)}}var g0t=function(){function t(){}return t.setInstance=function(e){t._instance=e},n(t,null,[{key:"instance",get:function(){return t._instance}}]),t}();g0t._instance=null;var y0t=function(){function t(){this.counts=void 0,this.offsets=void 0,this.instances=void 0,this.drawCount=0,this.drawByIndex=!1,this.instancedDraw=!1,this.byteOffsets=void 0,this._capacity=4,this.counts=new Int32Array(4),this.offsets=new Int32Array(4),this.instances=new Int32Array(4),this.byteOffsets=new Int32Array(4)}var e=t.prototype;return e.clearDraws=function(){this.drawCount=0,this.drawByIndex=!1,this.instancedDraw=!1},e.setDrawInfo=function(t,e){this._ensureCapacity(t),this.drawByIndex=e.indexCount>0,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}(),v0t=function(){function t(){this._srcFramebuffer=void 0,this._dstFramebuffer=void 0;var t=g0t.instance.gl;this._srcFramebuffer=t.createFramebuffer(),this._dstFramebuffer=t.createFramebuffer()}return t.prototype.destroy=function(){var t=g0t.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}(),b0t=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 y0t,glTarget:0,glBuffer:null,glOffset:0},q$t(g0t.instance,this._gpuBuffer),g0t.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(this._isBufferView||(X$t(g0t.instance,this._gpuBuffer),g0t.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&&(Y$t(g0t.instance,this._gpuBuffer),g0t.instance.memoryStatus.bufferSize-=e,g0t.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,J$t(g0t.instance,this._gpuBuffer,t,0,i))},e}(pp),S0t=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 Kd,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=g0t.instance.bindingMappings.blockOffsets.length,i=0;i<e;i++)this._curGPUDescriptorSets.push(null)},i.destroy=function(){},i.begin=function(){this._curGPUPipelineState=null,this._curGPUInputAssembler=null,this._curGPUDescriptorSets.length=0,this._numDrawCalls=0,this._numInstances=0,this._numTris=0},i.end=function(){this._isStateInvalid&&this.bindStates(),this._isInRenderPass=!1},i.beginRenderPass=function(){ht(16401),this._isInRenderPass=!0},i.endRenderPass=function(){this._isInRenderPass=!1},i.bindPipelineState=function(t){var e=t.gpuPipelineState;e!==this._curGPUPipelineState&&(this._curGPUPipelineState=e,this._isStateInvalid=!0)},i.bindDescriptorSet=function(t,e,i){var n=e.gpuDescriptorSet;if(n!==this._curGPUDescriptorSets[t]&&(this._curGPUDescriptorSets[t]=n,this._isStateInvalid=!0),i){var r,s=null==(r=this._curGPUPipelineState)?void 0:r.gpuPipelineLayout;if(s){for(var a=this._curDynamicOffsets,o=s.dynamicOffsetOffsets[t],h=0;h<i.length;h++)a[o+h]=i[h];this._isStateInvalid=!0}}},i.bindInputAssembler=function(t){var e=t.gpuInputAssembler;this._curGPUInputAssembler=e,this._isStateInvalid=!0},i.setViewport=function(t){var e=this._curDynamicStates.viewport;e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height&&e.minDepth===t.minDepth&&e.maxDepth===t.maxDepth||(e.left=t.left,e.top=t.top,e.width=t.width,e.height=t.height,e.minDepth=t.minDepth,e.maxDepth=t.maxDepth,this._isStateInvalid=!0)},i.setScissor=function(t){var e=this._curDynamicStates.scissor;e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height||(e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,this._isStateInvalid=!0)},i.setLineWidth=function(t){this._curDynamicStates.lineWidth!==t&&(this._curDynamicStates.lineWidth=t,this._isStateInvalid=!0)},i.setDepthBias=function(t,e,i){var n=this._curDynamicStates;n.depthBiasConstant===t&&n.depthBiasClamp===e&&n.depthBiasSlope===i||(n.depthBiasConstant=t,n.depthBiasClamp=e,n.depthBiasSlope=i,this._isStateInvalid=!0)},i.setBlendConstants=function(t){var e=this._curDynamicStates.blendConstant;e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w||(e.copy(t),this._isStateInvalid=!0)},i.setDepthBound=function(t,e){var i=this._curDynamicStates;i.depthMinBounds===t&&i.depthMaxBounds===e||(i.depthMinBounds=t,i.depthMaxBounds=e,this._isStateInvalid=!0)},i.setStencilWriteMask=function(t,e){var i=this._curDynamicStates.stencilStatesFront,n=this._curDynamicStates.stencilStatesBack;1&t&&i.writeMask!==e&&(i.writeMask=e,this._isStateInvalid=!0),2&t&&n.writeMask!==e&&(n.writeMask=e,this._isStateInvalid=!0)},i.setStencilCompareMask=function(t,e,i){var n=this._curDynamicStates.stencilStatesFront,r=this._curDynamicStates.stencilStatesBack;1&t&&(n.compareMask===i&&n.reference===e||(n.reference=e,n.compareMask=i,this._isStateInvalid=!0)),2&t&&(r.compareMask===i&&r.reference===e||(r.reference=e,r.compareMask=i,this._isStateInvalid=!0))},i.draw=function(){ht(16328)},i.updateBuffer=function(){ht(16329)},i.copyBuffersToTexture=function(){ht(16330)},i.execute=function(){ht(16402)},i.pipelineBarrier=function(){},i.bindStates=function(){ht(16401),this._isStateInvalid=!1},i.blitTexture=function(){ht(16401)},e}(mp),w0t=function(t){function e(){var e;return(e=t.call(this)||this)._gpuFramebuffer=null,e._gpuColorViews=[],e._gpuDepthStencilView=void 0,e}s(e,t);var i=e.prototype;return i.getGpuFramebuffer=function(){return this._gpuFramebuffer},i.initialize=function(t){var e,i=this;this._renderPass=t.renderPass,this._colorTextures=t.colorTextures||[],this._depthStencilTexture=t.depthStencilTexture||null;for(var n=[],r=0;r<t.colorTextures.length;r++){var s=t.colorTextures[r];s&&n.push(s.gpuTextureView)}var a=null;t.depthStencilTexture&&(a=t.depthStencilTexture.gpuTextureView);var o=Number.MAX_SAFE_INTEGER,h=Number.MAX_SAFE_INTEGER;this._gpuFramebuffer={gpuRenderPass:t.renderPass.getGpuRenderPass(),gpuColorViews:n,gpuDepthStencilView:a,glFramebuffer:null,isOffscreen:!0,get width(){return this.gpuColorViews.length>0?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}},t0t(g0t.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&&(e0t(g0t.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;i<t.gpuColorViews.length;i++)if(t.gpuColorViews[i].gpuTexture.glTexture!==this._gpuColorViews[i])return!0;if((null==(e=t.gpuDepthStencilView)?void 0:e.gpuTexture.glTexture)!==this._gpuDepthStencilView)return!0}return!1}}]),e}(bp),x0t=function(t){function e(){var e;return(e=t.call(this)||this)._gpuInputAssembler=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){if(0!==t.vertexBuffers.length){if(this._attributes=t.attributes,this._attributesHash=this.computeAttributesHash(),this._vertexBuffers=t.vertexBuffers,t.indexBuffer)this._indexBuffer=t.indexBuffer,this._drawInfo.indexCount=this._indexBuffer.size/this._indexBuffer.stride,this._drawInfo.firstIndex=0;else{var e=this._vertexBuffers[0];this._drawInfo.vertexCount=e.size/e.stride,this._drawInfo.firstVertex=0,this._drawInfo.vertexOffset=0}this._drawInfo.instanceCount=0,this._drawInfo.firstInstance=0,this._indirectBuffer=t.indirectBuffer||null;for(var i=new Array(t.vertexBuffers.length),n=0;n<t.vertexBuffers.length;++n){var r=t.vertexBuffers[n];r.getGpuBuffer()&&(i[n]=r.getGpuBuffer())}var s=null,a=0;if(t.indexBuffer&&(s=t.indexBuffer.getGpuBuffer()))switch(s.stride){case 1:a=5121;break;case 2:a=5123;break;case 4:a=5125;break;default:ht(16332)}var o=null;t.indirectBuffer&&(o=t.indirectBuffer.getGpuBuffer()),this._gpuInputAssembler={attributes:t.attributes,gpuVertexBuffers:i,gpuIndexBuffer:s,gpuIndirectBuffer:o,glAttribs:[],glIndexType:a,glVAOs:new Map},r0t(g0t.instance,this._gpuInputAssembler)}else ht(16331)},i.destroy=function(){var t=g0t.instance;this._gpuInputAssembler&&t.extensions.useVAO&&s0t(t,this._gpuInputAssembler),this._gpuInputAssembler=null},n(e,[{key:"gpuInputAssembler",get:function(){return this._gpuInputAssembler}}]),e}(Sp),T0t=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this)._gpuDescriptorSetLayout=null,e}return e.getGpuDescriptorSetLayout=function(){return this._gpuDescriptorSetLayout},e.initialize=function(t){Array.prototype.push.apply(this._bindings,t.bindings);for(var e=0,i=-1,n=[],r=0;r<this._bindings.length;r++){var s=this._bindings[r];n.push(e),e+=s.count,s.binding>i&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;o<this._bindings.length;o++){var h=this._bindings[o];this._bindingIndices[h.binding]=o,a[h.binding]=n[o]}for(var u=[],l=0;l<this._bindings.length;l++){var c=this._bindings[l];if(10&c.descriptorType)for(var f=0;f<c.count;f++)u.push(c.binding)}this._gpuDescriptorSetLayout={bindings:this._bindings,dynamicBindings:u,descriptorIndices:a,descriptorCount:e}},e.destroy=function(){this._bindings.length=0},i}(xp),A0t=function(t){function e(){var e;return(e=t.call(this)||this)._gpuPipelineLayout=null,e}s(e,t);var i=e.prototype;return i.getGpuPipelineLayout=function(){return this._gpuPipelineLayout},i.initialize=function(t){Array.prototype.push.apply(this._setLayouts,t.setLayouts);for(var e=[],i=[],n=0,r=[],s=0;s<this._setLayouts.length;s++){for(var a=this._setLayouts[s],o=a.getGpuDescriptorSetLayout(),h=o.dynamicBindings,u=Array(a.bindingIndices.length).fill(-1),l=0;l<h.length;l++){var c=h[l];u[c]<0&&(u[c]=n+l)}i.push(o),e.push(u),r.push(n),n+=h.length}this._gpuPipelineLayout={gpuSetLayouts:i,dynamicOffsetIndices:e,dynamicOffsetCount:n,dynamicOffsetOffsets:r}},i.destroy=function(){this._setLayouts.length=0},e}(Tp),C0t=[0,1,3,2,0,0,0,4,5,6,0,0,0,0],D0t=function(t){function e(){var e;return(e=t.call(this)||this)._gpuPipelineState=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._primitive=t.primitive,this._shader=t.shader,this._pipelineLayout=t.pipelineLayout;var e=this._bs;if(t.blendState){var i=t.blendState,n=i.targets;n&&n.forEach((function(t,i){e.setTarget(i,t)})),void 0!==i.isA2C&&(e.isA2C=i.isA2C),void 0!==i.isIndepend&&(e.isIndepend=i.isIndepend),void 0!==i.blendColor&&(e.blendColor=i.blendColor)}Object.assign(this._rs,t.rasterizerState),Object.assign(this._dss,t.depthStencilState),this._is=t.inputState,this._renderPass=t.renderPass,this._dynamicStates=t.dynamicStates;for(var r=[],s=0;s<31;s++)this._dynamicStates&1<<s&&r.push(1<<s);this._gpuPipelineState={glPrimitive:C0t[t.primitive],gpuShader:t.shader.gpuShader,gpuPipelineLayout:t.pipelineLayout.getGpuPipelineLayout(),rs:t.rasterizerState,dss:t.depthStencilState,bs:t.blendState,gpuRenderPass:t.renderPass.getGpuRenderPass(),dynamicStates:r}},i.destroy=function(){this._gpuPipelineState=null},n(e,[{key:"gpuPipelineState",get:function(){return this._gpuPipelineState}}]),e}(Mp),B0t=function(t){function e(){return t.call(this)||this}s(e,t);var i=e.prototype;return i.beginRenderPass=function(t,e,i,n,r,s){o0t(g0t.instance,t.getGpuRenderPass(),e.getGpuFramebuffer(),i,n,r,s),this._isInRenderPass=!0},i.draw=function(t){if(this._isInRenderPass){this._isStateInvalid&&this.bindStates();var e="drawInfo"in t?t.drawInfo:t;u0t(g0t.instance,e),++this._numDrawCalls,this._numInstances+=e.instanceCount;var i=e.indexCount||e.vertexCount;if(this._curGPUPipelineState)switch(this._curGPUPipelineState.glPrimitive){case 4:this._numTris+=i/3*Math.max(e.instanceCount,1);break;case 5:case 6:this._numTris+=(i-2)*Math.max(e.instanceCount,1)}}else ht(16328)},i.setViewport=function(t){var e=g0t.instance.gl,i=g0t.instance.getStateCache();i.viewport.left===t.left&&i.viewport.top===t.top&&i.viewport.width===t.width&&i.viewport.height===t.height||(e.viewport(t.left,t.top,t.width,t.height),i.viewport.left=t.left,i.viewport.top=t.top,i.viewport.width=t.width,i.viewport.height=t.height)},i.setScissor=function(t){var e=g0t.instance.gl,i=g0t.instance.getStateCache();i.scissorRect.x===t.x&&i.scissorRect.y===t.y&&i.scissorRect.width===t.width&&i.scissorRect.height===t.height||(e.scissor(t.x,t.y,t.width,t.height),i.scissorRect.x=t.x,i.scissorRect.y=t.y,i.scissorRect.width=t.width,i.scissorRect.height=t.height)},i.updateBuffer=function(t,e,i){if(this._isInRenderPass)ht(16329);else{var n,r=t.getGpuBuffer();r&&(n=void 0!==i?i:64&t.usage?0:e.byteLength,J$t(g0t.instance,r,e,0,n))}},i.copyBuffersToTexture=function(t,e,i){if(this._isInRenderPass)ht(16330);else{var n=e.gpuTexture;n&&d0t(g0t.instance,t,n,i)}},i.execute=function(){ht(16402)},i.bindStates=function(){h0t(g0t.instance,this._curGPUPipelineState,this._curGPUInputAssembler,this._curGPUDescriptorSets,this._curDynamicOffsets,this._curDynamicStates),this._isStateInvalid=!1},i.blitTexture=function(t,e,i,n){var r=t.gpuTexture,s=e.gpuTexture;m0t(g0t.instance,r,s,i,n)},e}(S0t),I0t=function(t){function e(){var e;return(e=t.call(this)||this).numDrawCalls=0,e.numInstances=0,e.numTris=0,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._type=t.type},i.destroy=function(){},i.submit=function(t){for(var e=0;e<t.length;e++){var i=t[e];this.numDrawCalls+=i.numDrawCalls,this.numInstances+=i.numInstances,this.numTris+=i.numTris}},i.clear=function(){this.numDrawCalls=0,this.numInstances=0,this.numTris=0},e}(Pp),M0t=function(t){function e(){var e;return(e=t.call(this)||this)._gpuRenderPass=null,e}s(e,t);var i=e.prototype;return i.getGpuRenderPass=function(){return this._gpuRenderPass},i.initialize=function(t){this._colorInfos=t.colorAttachments,this._depthStencilInfo=t.depthStencilAttachment,this._subpasses=t.subpasses,this._gpuRenderPass={colorAttachments:this._colorInfos,depthStencilAttachment:this._depthStencilInfo},this._hash=this.computeHash()},i.destroy=function(){this._gpuRenderPass=null},e}(Ep),P0t=function(t){function e(e,i){var n,r,s;return(n=t.call(this,e,i)||this)._gpuSampler=null,n._gpuSampler={glSamplers:new Map,minFilter:n._info.minFilter,magFilter:n._info.magFilter,mipFilter:n._info.mipFilter,addressU:n._info.addressU,addressV:n._info.addressV,addressW:n._info.addressW,glMinFilter:0,glMagFilter:0,glWrapS:0,glWrapT:0,glWrapR:0,getGLSampler:function(t,e,i){var n=t.gl,r=e<<16|i;if(!this.glSamplers.has(r)){var s=n.createSampler();if(s){this.glSamplers.set(r,s);var a=n.samplerParameteri.bind(n),o=n.samplerParameterf.bind(n);a(s,10241,this.glMinFilter),a(s,10240,this.glMagFilter),a(s,10242,this.glWrapS),a(s,10243,this.glWrapT),a(s,32882,this.glWrapR),o(s,33082,e),o(s,33083,i)}}return this.glSamplers.get(r)}},r=g0t.instance,s=n._gpuSampler,r.gl,2===s.minFilter||3===s.minFilter?2===s.mipFilter||3===s.mipFilter?s.glMinFilter=9987:1===s.mipFilter?s.glMinFilter=9985:s.glMinFilter=9729:2===s.mipFilter||3===s.mipFilter?s.glMinFilter=9986:1===s.mipFilter?s.glMinFilter=9984:s.glMinFilter=9728,2===s.magFilter||3===s.magFilter?s.glMagFilter=9729:s.glMagFilter=9728,s.glWrapS=P$t[s.addressU],s.glWrapT=P$t[s.addressV],s.glWrapR=P$t[s.addressW],n}return s(e,t),e.prototype.destroy=function(){this._gpuSampler&&($$t(g0t.instance,this._gpuSampler),this._gpuSampler=null)},n(e,[{key:"gpuSampler",get:function(){return this._gpuSampler}}]),e}(Op),E0t=function(t){function e(){var e;return(e=t.call(this)||this)._gpuShader=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._name=t.name,this._stages=t.stages,this._attributes=t.attributes,this._blocks=t.blocks,this._samplers=t.samplers,this._gpuShader={name:t.name,blocks:t.blocks.slice(),samplerTextures:t.samplerTextures.slice(),subpassInputs:t.subpassInputs.slice(),gpuStages:new Array(t.stages.length),glProgram:null,glInputs:[],glUniforms:[],glBlocks:[],glSamplerTextures:[]};for(var e=0;e<t.stages.length;++e){var i=t.stages[e];this._gpuShader.gpuStages[e]={type:i.stage,source:i.source,glShader:null}}},i.destroy=function(){this._gpuShader&&(n0t(g0t.instance,this._gpuShader),this._gpuShader=null)},n(e,[{key:"gpuShader",get:function(){return null===this._gpuShader.glProgram&&i0t(g0t.instance,this._gpuShader),this._gpuShader}}]),e}(kp),O0t=function(){function t(){this.glArrayBuffer=null,this.glElementArrayBuffer=null,this.glUniformBuffer=null,this.glBindUBOs=[],this.glBindUBOOffsets=[],this.glVAO=null,this.texUnit=0,this.glTexUnits=[],this.glSamplerUnits=[],this.glRenderbuffer=null,this.glFramebuffer=null,this.glReadFramebuffer=null,this.viewport=new nd,this.scissorRect=new K_(0,0,0,0),this.rs=new Ap,this.dss=new Cp,this.bs=new Bp,this.glProgram=null,this.glEnabledAttribLocs=[],this.glCurrentAttribLocs=[],this.texUnitCacheMap={}}return t.prototype.initialize=function(t,e,i){for(var n=0;n<t;++n)this.glTexUnits.push({glTexture:null});this.glSamplerUnits.length=t,this.glSamplerUnits.fill(null),this.glBindUBOs.length=e,this.glBindUBOs.fill(null),this.glBindUBOOffsets.length=e,this.glBindUBOOffsets.fill(0),this.glEnabledAttribLocs.length=i,this.glEnabledAttribLocs.fill(!1),this.glCurrentAttribLocs.length=i,this.glCurrentAttribLocs.fill(!1)},t}(),k0t=function(t){function e(){var e;return(e=t.call(this)||this)._gpuTexture=null,e._gpuTextureView=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t,e){var i=this,n=g0t.instance,r=i._info,s=i._viewInfo,a=t,o=t;if("texture"in t&&(a=o.texture.info,i._isTextureView=!0),r.copy(a),i._isPowerOf2=sp(r.width)&&sp(r.height),i._size=hp(r.format,i.width,i.height,i.depth,r.levelCount)*r.layerCount,i._isTextureView){var h;if(s.copy(o),i._gpuTexture=o.texture._gpuTexture,(null==(h=i._gpuTexture)?void 0:h.format)!==a.format)return void it(16403);i._gpuTextureView={gpuTexture:i._gpuTexture,type:o.type,format:o.format,baseLevel:o.baseLevel,levelCount:o.levelCount}}else i._gpuTexture={type:a.type,format:a.format,usage:a.usage,width:a.width,height:a.height,depth:a.depth,size:i._size,arrayLayer:a.layerCount,mipLevel:a.levelCount,samples:a.samples,flags:a.flags,isPowerOf2:i._isPowerOf2,glTarget:0,glInternalFmt:0,glFormat:0,glType:0,glUsage:0,glTexture:null,glRenderbuffer:null,glWrapS:0,glWrapT:0,glMinFilter:0,glMagFilter:0,isSwapchainTexture:e||!1},i._gpuTexture.isSwapchainTexture||(K$t(n,i._gpuTexture),n.memoryStatus.textureSize+=i._size),s.texture=i,s.type=t.type,s.format=t.format,s.baseLevel=0,s.levelCount=t.levelCount,s.baseLayer=0,s.layerCount=t.layerCount,i._gpuTextureView={gpuTexture:i._gpuTexture,type:s.type,format:s.format,baseLevel:s.baseLevel,levelCount:s.levelCount}},i.destroy=function(){var t=this,e=g0t.instance;!t._isTextureView&&t._gpuTexture&&(Q$t(e,t._gpuTexture),e.memoryStatus.textureSize-=t._size,t._gpuTexture=null)},i.getTextureHandle=function(){var t=this._gpuTexture;return t?t.glTexture?t.glTexture:t.glRenderbuffer?t.glRenderbuffer:0:0},i.resize=function(t,i){var n=this,r=g0t.instance,s=n._info;if(s.width!==t||s.height!==i){s.levelCount===e.getLevelCount(s.width,s.height)?s.levelCount=e.getLevelCount(t,i):s.levelCount>1&&(s.levelCount=Math.min(s.levelCount,e.getLevelCount(t,i)));var a=n._size;s.width=t,s.height=i,n._size=hp(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||(Z$t(r,o),r.memoryStatus.textureSize-=a,r.memoryStatus.textureSize+=n._size))}},i.initAsSwapchainTexture=function(t){var e=new dd;e.format=t.format,e.usage=ip[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),R0t="webglcontextlost";function F0t(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 L0t(t,e){for(var i=["","WEBKIT_","MOZ_"],n=0;n<i.length;++n){var r=t.getExtension(i[n]+e);if(r)return r}return null}function V0t(t){var e={EXT_texture_filter_anisotropic:L0t(t,"EXT_texture_filter_anisotropic"),EXT_color_buffer_half_float:L0t(t,"EXT_color_buffer_half_float"),EXT_color_buffer_float:L0t(t,"EXT_color_buffer_float"),WEBGL_compressed_texture_etc1:L0t(t,"WEBGL_compressed_texture_etc1"),WEBGL_compressed_texture_etc:L0t(t,"WEBGL_compressed_texture_etc"),WEBGL_compressed_texture_pvrtc:L0t(t,"WEBGL_compressed_texture_pvrtc"),WEBGL_compressed_texture_astc:L0t(t,"WEBGL_compressed_texture_astc"),WEBGL_compressed_texture_s3tc:L0t(t,"WEBGL_compressed_texture_s3tc"),WEBGL_compressed_texture_s3tc_srgb:L0t(t,"WEBGL_compressed_texture_s3tc_srgb"),WEBGL_debug_shaders:L0t(t,"WEBGL_debug_shaders"),WEBGL_lose_context:L0t(t,"WEBGL_lose_context"),WEBGL_debug_renderer_info:L0t(t,"WEBGL_debug_renderer_info"),OES_texture_half_float_linear:L0t(t,"OES_texture_half_float_linear"),OES_texture_float_linear:L0t(t,"OES_texture_float_linear"),WEBGL_multi_draw:null,useVAO:!0};return Vo.os!==Oo.ANDROID&&Vo.os!==Oo.IOS&&(e.WEBGL_multi_draw=L0t(t,"WEBGL_multi_draw")),e}function N0t(t){var e=null;try{var i={alpha:Ue.ENABLE_TRANSPARENT_CANVAS,antialias:Ue.ENABLE_WEBGL_ANTIALIAS,depth:!0,stencil:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,powerPreference:"default",failIfMajorPerformanceCaveat:!1};e=t.getContext("webgl2",i)}catch(t){return null}return e}var z0t=function(t){function e(){var e;return(e=t.call(this)||this).stateCache=new O0t,e.nullTex2D=null,e.nullTexCube=null,e._canvas=null,e._webGL2ContextLostHandler=null,e._extensions=null,e._blitManager=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){var e=this;e._canvas=t.windowHandle,e._webGL2ContextLostHandler=e._onWebGLContextLost.bind(e),e._canvas.addEventListener(R0t,e._onWebGLContextLost);var i=g0t.instance,n=i.gl,r=i.capabilities;e.stateCache.initialize(r.maxTextureUnits,r.maxUniformBufferBindings,r.maxVertexAttributes),e._extensions=V0t(n),F0t(n);var s=55,a=n.getParameter(3414),o=n.getParameter(3415);a&&o?s=55:a&&(s=54),e._colorTexture=new k0t,e._colorTexture.initAsSwapchainTexture({swapchain:e,format:35,width:t.width,height:t.height}),e._depthStencilTexture=new k0t,e._depthStencilTexture.initAsSwapchainTexture({swapchain:e,format:s,width:t.width,height:t.height}),e.nullTex2D=i.createTexture(new dd(1,4,35,2,2,0)),e.nullTexCube=i.createTexture(new dd(3,4,35,2,2,0,6));var h=new id;h.texExtent.width=2,h.texExtent.height=2;var u=new Uint8Array(e.nullTex2D.size);u.fill(0),i.copyBuffersToTexture([u],e.nullTex2D,[h]),h.texSubres.layerCount=6,i.copyBuffersToTexture([u,u,u,u,u,u],e.nullTexCube,[h]),e._blitManager=new v0t},i.destroy=function(){var t=this;t._canvas&&t._webGL2ContextLostHandler&&(t._canvas.removeEventListener(R0t,t._webGL2ContextLostHandler),t._webGL2ContextLostHandler=null),t.nullTex2D&&(t.nullTex2D.destroy(),t.nullTex2D=null),t.nullTexCube&&(t.nullTexCube.destroy(),t.nullTexCube=null),t._blitManager&&(t._blitManager.destroy(),t._blitManager=null),t._extensions=null,t._canvas=null},i.resize=function(t,e){var i=this;i._colorTexture.width===t&&i._colorTexture.height===e||(Q("Resizing swapchain: "+t+"x"+e),i._canvas.width=t,i._canvas.height=e,i._colorTexture.resize(t,e),i._depthStencilTexture.resize(t,e))},i._onWebGLContextLost=function(t){at(11e3),Y(t)},n(e,[{key:"extensions",get:function(){return this._extensions}},{key:"blitManager",get:function(){return this._blitManager}}]),e}(vp);function U0t(t,e,i){for(var n=0;n<e.length;++n)t[e[n]]=i}function G0t(t,e,i){for(var n=0;n<e.length;++n)t[e[n]]=i}var H0t=t("hx",function(t){function e(){var e;return(e=t.call(this)||this)._swapchain=null,e._context=null,e._bindingMappings=null,e._textureExclusive=new Array(117),e}s(e,t);var i=e.prototype;return i.getStateCache=function(){return this._swapchain.stateCache},i.initialize=function(t){g0t.setInstance(this),this._gfxAPI=7;var e=this._bindingMappingInfo=t.bindingMappingInfo,i=[],n=[],r=e.setIndices[0];i[r]=0,n[r]=0;for(var s=1;s<e.setIndices.length;++s){var a=e.setIndices[s],o=e.setIndices[s-1];i[a]=e.maxBlockCounts[o]+i[o],n[a]=e.maxSamplerTextureCounts[o]+n[o]}for(var h=0;h<e.setIndices.length;++h){var u=e.setIndices[h];n[u]-=e.maxBlockCounts[u]}this._bindingMappings={blockOffsets:i,samplerTextureOffsets:n,flexibleSet:e.setIndices[e.setIndices.length-1]};var l=this._context=N0t(gp.canvas);if(!l)return ht(16405),!1;this._queue=this.createQueue(new jd(0)),this._cmdBuff=this.createCommandBuffer(new Wd(this._queue));var c=l.getParameter.bind(l),f=this._caps;if(f.maxVertexAttributes=c(34921),f.maxVertexUniformVectors=c(36347),Vo.os===Oo.IOS){var _=f.maxVertexUniformVectors;hh.browserType===Mo.WECHAT?f.maxVertexUniformVectors=_<256?_:256:hh.browserType===Mo.SAFARI&&(f.maxVertexUniformVectors=_<512?_:512)}f.maxFragmentUniformVectors=c(36349),f.maxTextureUnits=c(34930),f.maxVertexTextureUnits=c(35660),f.maxUniformBufferBindings=c(35375),f.maxUniformBlockSize=c(35376),f.maxTextureSize=c(3379),f.maxCubeMapTextureSize=c(34076),f.maxArrayTextureLayers=c(35071),f.max3DTextureSize=c(32883),f.uboOffsetAlignment=c(35380);var d=l.getSupportedExtensions(),p="";d&&d.forEach((function(t){p+=t+" "}));var m=V0t(l);m.WEBGL_debug_renderer_info?(this._renderer=c(m.WEBGL_debug_renderer_info.UNMASKED_RENDERER_WEBGL),this._vendor=c(m.WEBGL_debug_renderer_info.UNMASKED_VENDOR_WEBGL)):(this._renderer=c(7937),this._vendor=c(7936));var g=c(7938),y=this._features;y.fill(!1),this.initFormatFeatures(m),y[0]=!0,y[1]=!0,y[2]=!0,y[3]=!0;var v="";return this.getFormatFeatures(72)&&(v+="etc1 "),this.getFormatFeatures(73)&&(v+="etc2 "),this.getFormatFeatures(56)&&(v+="dxt "),this.getFormatFeatures(83)&&(v+="pvrtc "),this.getFormatFeatures(89)&&(v+="astc "),Q("WebGL2 device initialized."),Q("RENDERER: "+this._renderer),Q("VENDOR: "+this._vendor),Q("VERSION: "+g),Q("COMPRESSED_FORMAT: "+v),Q("EXTENSIONS: "+p),!0},i.destroy=function(){this._queue&&(this._queue.destroy(),this._queue=null),this._cmdBuff&&(this._cmdBuff.destroy(),this._cmdBuff=null);for(var t=this._samplers.values(),e=t.next();!e.done;)e.value.destroy(),e=t.next();this._swapchain=null},i.flushCommands=function(){},i.acquire=function(){},i.present=function(){var t=this._queue;this._numDrawCalls=t.numDrawCalls,this._numInstances=t.numInstances,this._numTris=t.numTris,t.clear()},i.initFormatFeatures=function(t){var e=this._formatFeatures,i=this._textureExclusive;e.fill(0),i.fill(!0);var n=31;U0t(e,[4,14,24,35],n),U0t(e,[5,15,26,38,47,50,49,51,25,37,48,53,54,55],n=15),e[52]=15,U0t(e,[8,18,29,41],n=27),U0t(e,[11,21,32,44],n=26),e[52]=15,U0t(e,[7,6,10,9,13,12,17,16,20,19,23,22,28,27,31,30,34,33,40,39,43,42,46,45],n=31),G0t(i,[4,14,24,47,50,49,35,51,52,37,7,6,10,9,13,12,17,16,20,19,23,22,40,39,43,42,46,45,54,55],!1),t.EXT_color_buffer_float&&(e[11]|=1,e[21]|=1,e[44]|=1,G0t(i,[11,21,44],!1)),t.EXT_color_buffer_half_float&&G0t(i,[8,18,41],!1),t.OES_texture_float_linear&&(e[32]|=4,e[44]|=4,e[11]|=4,e[21]|=4),t.OES_texture_half_float_linear&&(e[29]|=4,e[41]|=4,e[8]|=4,e[18]|=4),t.WEBGL_compressed_texture_etc1&&(e[72]=6),t.WEBGL_compressed_texture_etc&&U0t(e,[73,77,74,78,75,76],6),t.WEBGL_compressed_texture_s3tc&&U0t(e,[56,57,58,59,60,61,62,63],6),t.WEBGL_compressed_texture_pvrtc&&U0t(e,[83,84,85,86],6),t.WEBGL_compressed_texture_astc&&U0t(e,[89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116],6)},i.createCommandBuffer=function(t){var e=new(0===t.type?B0t:S0t);return e.initialize(t),e},i.createSwapchain=function(t){var e=new z0t;return this._swapchain=e,e.initialize(t),e},i.createBuffer=function(t){var e=new b0t;return e.initialize(t),e},i.createTexture=function(t){var e=new k0t;return e.initialize(t),e},i.createDescriptorSet=function(t){var e=new M$t;return e.initialize(t),e},i.createShader=function(t){var e=new E0t;return e.initialize(t),e},i.createInputAssembler=function(t){var e=new x0t;return e.initialize(t),e},i.createRenderPass=function(t){var e=new M0t;return e.initialize(t),e},i.createFramebuffer=function(t){var e=new w0t;return e.initialize(t),e},i.createDescriptorSetLayout=function(t){var e=new T0t;return e.initialize(t),e},i.createPipelineLayout=function(t){var e=new A0t;return e.initialize(t),e},i.createPipelineState=function(t){var e=new D0t;return e.initialize(t),e},i.createQueue=function(t){var e=new I0t;return e.initialize(t),e},i.getSampler=function(t){var e=Op.computeHash(t);return this._samplers.has(e)||this._samplers.set(e,new P0t(t,e)),this._samplers.get(e)},i.getSwapchains=function(){return[this._swapchain]},i.getGeneralBarrier=function(t){var e=Fp.computeHash(t);return this._generalBarrierss.has(e)||this._generalBarrierss.set(e,new Fp(t,e)),this._generalBarrierss.get(e)},i.getTextureBarrier=function(t){var e=Lp.computeHash(t);return this._textureBarriers.has(e)||this._textureBarriers.set(e,new Lp(t,e)),this._textureBarriers.get(e)},i.getBufferBarrier=function(t){var e=Vp.computeHash(t);return this._bufferBarriers.has(e)||this._bufferBarriers.set(e,new Vp(t,e)),this._bufferBarriers.get(e)},i.copyBuffersToTexture=function(t,e,i){d0t(this,t,e.gpuTexture,i)},i.copyTextureToBuffers=function(t,e,i){p0t(this,t.gpuTexture,e,i)},i.copyTexImagesToTexture=function(t,e,i){c0t(this,t,e.gpuTexture,i)},n(e,[{key:"gl",get:function(){return this._context}},{key:"extensions",get:function(){return this._swapchain.extensions}},{key:"nullTex2D",get:function(){return this._swapchain.nullTex2D}},{key:"nullTexCube",get:function(){return this._swapchain.nullTexCube}},{key:"textureExclusive",get:function(){return this._textureExclusive}},{key:"bindingMappings",get:function(){return this._bindingMappings}},{key:"blitManager",get:function(){return this._swapchain.blitManager}}]),e}(gp));C.WebGL2Device=H0t}}}));
|